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


Java DeviceUtils類代碼示例

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


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

示例1: showNewDataToast

import com.jess.arms.utils.DeviceUtils; //導入依賴的package包/類
public TipsView showNewDataToast() {

        inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mDisplayMetrics = DeviceUtils.getDisplayMetrics(mContext);

        mToastView = inflate.inflate(R.layout.tipsview, null);
        mToastView.setMinimumWidth(mDisplayMetrics.widthPixels);//設置控件最小寬度為手機屏幕寬度

        mTextView = (TextView) mToastView.findViewById(R.id.new_data_toast_message);
        mTextView.setText(text);
        mTextView.setTextColor(ArmsUtils.getColor(mContext, R.color.white));
        setView(mToastView);
        setDuration(Toast.LENGTH_SHORT);
        setGravity(Gravity.TOP, 0, (int) (mDisplayMetrics.density * 55));

        if (isSound) {
            mPlayer = MediaPlayer.create(mContext, R.raw.newdatatoast);
            mPlayer.setOnCompletionListener(mediaPlayer -> mediaPlayer.release());
        }
        show();
        return this;
    }
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:24,代碼來源:TipsView.java

示例2: onReceive

import com.jess.arms.utils.DeviceUtils; //導入依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
        int netWorkState = DeviceUtils.getNetworkType(context);
        if (netWorkState == NETTYPE_CMWAP||netWorkState == NETTYPE_CMNET){
            EventBus.getDefault().post("",EventBusTags.NET_CHANGE_FLOW);
        }
    }
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:10,代碼來源:NetBroadcastReceiver.java

示例3: initData

import com.jess.arms.utils.DeviceUtils; //導入依賴的package包/類
@Override
public void initData(Bundle savedInstanceState) {
    initToolBar();
    switchFlow.setChecked((Boolean) SharedPreferencesUtils.getParam(this,Constants.SETTING_FLOW,true));
    switchWifi.setChecked((Boolean) SharedPreferencesUtils.getParam(this,Constants.SETTING_WIFI,true));
    switchSplash.setChecked((Boolean) SharedPreferencesUtils.getParam(this,Constants.SETTING_SPLASH,false));
    tvVersionName.setText("當前版本"+DeviceUtils.getVersionName(this));
    if (BmobUser.getCurrentUser()==null){
        ctlLogout.setVisibility(View.GONE);
    }
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:12,代碼來源:SettingsActivity.java

示例4: setErrorType

import com.jess.arms.utils.DeviceUtils; //導入依賴的package包/類
public void setErrorType(int i) {
    setVisibility(View.VISIBLE);
    switch (i) {
    case NETWORK_ERROR:
        mErrorState = NETWORK_ERROR;
        // img.setBackgroundDrawable(SkinsUtil.getDrawable(context,"pagefailed_bg"));
        if (DeviceUtils.hasInternet(getContext())) {
            tv.setText(R.string.error_view_load_error_click_to_refresh);
            img.setBackgroundResource(R.drawable.pagefailed_bg);
        } else {
            tv.setText(R.string.error_view_network_error_click_to_refresh);
            img.setBackgroundResource(R.drawable.page_icon_network);
        }
        img.setVisibility(View.VISIBLE);
        animProgress.setVisibility(View.GONE);
        clickEnable = true;
        break;
    case NETWORK_LOADING:
        mErrorState = NETWORK_LOADING;
        // animProgress.setBackgroundDrawable(SkinsUtil.getDrawable(context,"loadingpage_bg"));
        animProgress.setVisibility(View.VISIBLE);
        img.setVisibility(View.GONE);
        tv.setText(R.string.error_view_loading);
        clickEnable = false;
        break;
    case NODATA:
        mErrorState = NODATA;
        // img.setBackgroundDrawable(SkinsUtil.getDrawable(context,"page_icon_empty"));
        img.setBackgroundResource(R.drawable.page_icon_empty);
        img.setVisibility(View.VISIBLE);
        animProgress.setVisibility(View.GONE);
        setTvNoDataContent();
        clickEnable = true;
        break;
    case HIDE_LAYOUT:
        setVisibility(View.GONE);
        mErrorState = HIDE_LAYOUT;
        break;
    case NODATA_ENABLE_CLICK:
        mErrorState = NODATA_ENABLE_CLICK;
        img.setBackgroundResource(R.drawable.page_icon_empty);
        // img.setBackgroundDrawable(SkinsUtil.getDrawable(context,"page_icon_empty"));
        img.setVisibility(View.VISIBLE);
        animProgress.setVisibility(View.GONE);
        setTvNoDataContent();
        clickEnable = true;
        break;
    default:
        break;
    }
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:52,代碼來源:EmptyLayout.java


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