當前位置: 首頁>>代碼示例>>Java>>正文


Java NetChangeObserver類代碼示例

本文整理匯總了Java中com.github.obsessive.library.netstatus.NetChangeObserver的典型用法代碼示例。如果您正苦於以下問題:Java NetChangeObserver類的具體用法?Java NetChangeObserver怎麽用?Java NetChangeObserver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NetChangeObserver類屬於com.github.obsessive.library.netstatus包,在下文中一共展示了NetChangeObserver類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.github.obsessive.library.netstatus.NetChangeObserver; //導入依賴的package包/類
@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();
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:73,代碼來源:BaseAppCompatActivity.java

示例2: onCreate

import com.github.obsessive.library.netstatus.NetChangeObserver; //導入依賴的package包/類
@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();
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:73,代碼來源:BaseFragmentActivity.java

示例3: onCreate

import com.github.obsessive.library.netstatus.NetChangeObserver; //導入依賴的package包/類
@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();
}
 
開發者ID:Dreamer206602,項目名稱:SimplifyReader2,代碼行數:54,代碼來源:BasePlayerActivity.java


注:本文中的com.github.obsessive.library.netstatus.NetChangeObserver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。