Search in sources :

Example 1 with NetChangeObserver

use of com.github.obsessive.library.netstatus.NetChangeObserver in project SimplifyReader by chentao0707.

the class BaseAppCompatActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (toggleOverridePendingTransition()) {
        switch(getOverridePendingTransitionMode()) {
            case LEFT:
                overridePendingTransition(R.anim.left_in, R.anim.left_out);
                break;
            case RIGHT:
                overridePendingTransition(R.anim.right_in, R.anim.right_out);
                break;
            case TOP:
                overridePendingTransition(R.anim.top_in, R.anim.top_out);
                break;
            case BOTTOM:
                overridePendingTransition(R.anim.bottom_in, R.anim.bottom_out);
                break;
            case SCALE:
                overridePendingTransition(R.anim.scale_in, R.anim.scale_out);
                break;
            case FADE:
                overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
                break;
        }
    }
    super.onCreate(savedInstanceState);
    // base setup
    Bundle extras = getIntent().getExtras();
    if (null != extras) {
        getBundleExtras(extras);
    }
    if (isBindEventBusHere()) {
        EventBus.getDefault().register(this);
    }
    SmartBarUtils.hide(getWindow().getDecorView());
    setTranslucentStatus(isApplyStatusBarTranslucency());
    mContext = this;
    TAG_LOG = this.getClass().getSimpleName();
    BaseAppManager.getInstance().addActivity(this);
    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    mScreenDensity = displayMetrics.density;
    mScreenHeight = displayMetrics.heightPixels;
    mScreenWidth = displayMetrics.widthPixels;
    if (getContentViewLayoutID() != 0) {
        setContentView(getContentViewLayoutID());
    } else {
        throw new IllegalArgumentException("You must return a right contentView layout resource Id");
    }
    mNetChangeObserver = new NetChangeObserver() {

        @Override
        public void onNetConnected(NetUtils.NetType type) {
            super.onNetConnected(type);
            onNetworkConnected(type);
        }

        @Override
        public void onNetDisConnect() {
            super.onNetDisConnect();
            onNetworkDisConnected();
        }
    };
    NetStateReceiver.registerObserver(mNetChangeObserver);
    initViewsAndEvents();
}
Also used : NetChangeObserver(com.github.obsessive.library.netstatus.NetChangeObserver) NetUtils(com.github.obsessive.library.netstatus.NetUtils) Bundle(android.os.Bundle) DisplayMetrics(android.util.DisplayMetrics)

Example 2 with NetChangeObserver

use of com.github.obsessive.library.netstatus.NetChangeObserver in project SimplifyReader by chentao0707.

the class BasePlayerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // base setup
    mHelper = new SwipeBackActivityHelper(this);
    mHelper.onActivityCreate();
    Bundle extras = getIntent().getExtras();
    if (null != extras) {
        getBundleExtras(extras);
    }
    if (isBindEventBusHere()) {
        EventBus.getDefault().register(this);
    }
    SmartBarUtils.hide(getWindow().getDecorView());
    setTranslucentStatus(isApplyStatusBarTranslucency());
    mContext = this;
    TAG_LOG = this.getClass().getSimpleName();
    BaseAppManager.getInstance().addActivity(this);
    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    mScreenDensity = displayMetrics.density;
    mScreenHeight = displayMetrics.heightPixels;
    mScreenWidth = displayMetrics.widthPixels;
    if (getContentViewLayoutID() != 0) {
        setContentView(getContentViewLayoutID());
    } else {
        throw new IllegalArgumentException("You must return a right contentView layout resource Id");
    }
    mNetChangeObserver = new NetChangeObserver() {

        @Override
        public void onNetConnected(NetUtils.NetType type) {
            super.onNetConnected(type);
            onNetworkConnected(type);
        }

        @Override
        public void onNetDisConnect() {
            super.onNetDisConnect();
            onNetworkDisConnected();
        }
    };
    NetStateReceiver.registerObserver(mNetChangeObserver);
    initViewsAndEvents();
}
Also used : NetChangeObserver(com.github.obsessive.library.netstatus.NetChangeObserver) NetUtils(com.github.obsessive.library.netstatus.NetUtils) Bundle(android.os.Bundle) SwipeBackActivityHelper(com.github.obsessive.library.swipeback.SwipeBackActivityHelper) DisplayMetrics(android.util.DisplayMetrics)

Example 3 with NetChangeObserver

use of com.github.obsessive.library.netstatus.NetChangeObserver in project SimplifyReader by chentao0707.

the class BaseFragmentActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (toggleOverridePendingTransition()) {
        switch(getOverridePendingTransitionMode()) {
            case LEFT:
                overridePendingTransition(R.anim.left_in, R.anim.left_out);
                break;
            case RIGHT:
                overridePendingTransition(R.anim.right_in, R.anim.right_out);
                break;
            case TOP:
                overridePendingTransition(R.anim.top_in, R.anim.top_out);
                break;
            case BOTTOM:
                overridePendingTransition(R.anim.bottom_in, R.anim.bottom_out);
                break;
            case SCALE:
                overridePendingTransition(R.anim.scale_in, R.anim.scale_out);
                break;
            case FADE:
                overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
                break;
        }
    }
    super.onCreate(savedInstanceState);
    // base setup
    Bundle extras = getIntent().getExtras();
    if (null != extras) {
        getBundleExtras(extras);
    }
    if (isBindEventBusHere()) {
        EventBus.getDefault().register(this);
    }
    SmartBarUtils.hide(getWindow().getDecorView());
    setTranslucentStatus(isApplyStatusBarTranslucency());
    mContext = this;
    TAG_LOG = this.getClass().getSimpleName();
    BaseAppManager.getInstance().addActivity(this);
    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    mScreenDensity = displayMetrics.density;
    mScreenHeight = displayMetrics.heightPixels;
    mScreenWidth = displayMetrics.widthPixels;
    if (getContentViewLayoutID() != 0) {
        setContentView(getContentViewLayoutID());
    } else {
        throw new IllegalArgumentException("You must return a right contentView layout resource Id");
    }
    mNetChangeObserver = new NetChangeObserver() {

        @Override
        public void onNetConnected(NetUtils.NetType type) {
            super.onNetConnected(type);
            onNetworkConnected(type);
        }

        @Override
        public void onNetDisConnect() {
            super.onNetDisConnect();
            onNetworkDisConnected();
        }
    };
    NetStateReceiver.registerObserver(mNetChangeObserver);
    initViewsAndEvents();
}
Also used : NetChangeObserver(com.github.obsessive.library.netstatus.NetChangeObserver) NetUtils(com.github.obsessive.library.netstatus.NetUtils) Bundle(android.os.Bundle) DisplayMetrics(android.util.DisplayMetrics)

Aggregations

Bundle (android.os.Bundle)3 DisplayMetrics (android.util.DisplayMetrics)3 NetChangeObserver (com.github.obsessive.library.netstatus.NetChangeObserver)3 NetUtils (com.github.obsessive.library.netstatus.NetUtils)3 SwipeBackActivityHelper (com.github.obsessive.library.swipeback.SwipeBackActivityHelper)1