android.content.res.Configuration#SCREENLAYOUT_SIZE_LARGE源码实例Demo

下面列出了android.content.res.Configuration#SCREENLAYOUT_SIZE_LARGE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: sms-ticket   文件: UIUtils.java
public static String getScreenSizeAsString(Context context) {
    String size = null;
    int screenLayout = context.getResources().getConfiguration().screenLayout;
    if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        size = "large";
    }
    if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        size = "xlarge";
    }
    if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        size = "normal";
    }
    if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        size = "small";
    }
    if ((screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_UNDEFINED) {
        size = "undefined";
    }
    return size;
}
 
源代码2 项目: GestureViews   文件: DecorUtils.java
private static int getNavBarHeight(Context context) {
    boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    boolean hasNavBar = !hasMenuKey && !hasBackKey;

    if (hasNavBar) {
        boolean isPortrait = context.getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_PORTRAIT;

        boolean isTablet = (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK)
                >= Configuration.SCREENLAYOUT_SIZE_LARGE;

        String key = isPortrait ? "navigation_bar_height"
                : (isTablet ? "navigation_bar_height_landscape" : null);

        return key == null ? 0 : getDimenSize(context, key);
    } else {
        return 0;
    }
}
 
源代码3 项目: Dota2Helper   文件: YoukuPlayerView.java
public void initialize(YoukuBasePlayerManager mYoukuBaseActivity) {
	PackageManager pm = mYoukuBaseActivity.getBaseActivity()
			.getPackageManager();
	String ver = "4.1";
	try {
		ver = pm.getPackageInfo(mYoukuBaseActivity.getBaseActivity()
				.getPackageName(), 0).versionName;
	} catch (NameNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	boolean isTablet = (this.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
	String ua = (isTablet ? "Youku HD;" : "Youku;") + ver + ";Android;"
			+ android.os.Build.VERSION.RELEASE + ";"
			+ android.os.Build.MODEL;

	Logger.d(TAG, "initialize(): ua = " + ua);

	initialize(mYoukuBaseActivity, 10001, "4e308edfc33936d7", ver, ua,
			false, -7L, "631l1i1x3fv5vs2dxlj5v8x81jqfs2om");
}
 
源代码4 项目: chips-input-layout   文件: Utils.java
static int getNavBarHeight(Context c) {
    int result = 0;
    boolean hasMenuKey = ViewConfiguration.get(c).hasPermanentMenuKey();
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

    if (!hasMenuKey && !hasBackKey) {
        // The device has a navigation bar
        final Resources res = c.getResources();
        final Configuration config = res.getConfiguration();

        int orientation = config.orientation;
        int resourceId;

        // Check if the device is a tablet
        if ((config.screenLayout&Configuration.SCREENLAYOUT_SIZE_MASK)
                >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
            resourceId = res.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT
                    ? "navigation_bar_height" : "navigation_bar_height_landscape",
                    "dimen", "android");
        } else {
            resourceId = res.getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT
                    ? "navigation_bar_height" : "navigation_bar_width",
                    "dimen", "android");
        }

        if (resourceId > 0) {
            return res.getDimensionPixelSize(resourceId);
        }
    }
    return result;
}
 
源代码5 项目: TheGreatAdapter   文件: ViewUtils.java
public static boolean isLargeScreen(Context context) {
    return getScreenSize(context) == Configuration.SCREENLAYOUT_SIZE_LARGE ||
            getScreenSize(context) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
 
源代码6 项目: Android-utils   文件: DeviceUtils.java
private static boolean isTabletInner(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
            Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码7 项目: SmartFlasher   文件: Utils.java
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码8 项目: SuperToasts   文件: SuperToast.java
/**
 * Modify various attributes of the SuperToast before being shown.
 */
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
protected void onPrepareShow() {
    final int sdkVersion = android.os.Build.VERSION.SDK_INT;

    // Modify various attributes of the message TextView
    this.mTextView.setText(this.mStyle.message);
    this.mTextView.setTypeface(this.mTextView.getTypeface(), this.mStyle.messageTypefaceStyle);
    this.mTextView.setTextColor(this.mStyle.messageTextColor);
    this.mTextView.setTextSize(this.mStyle.messageTextSize);
    if (this.mStyle.messageIconResource > 0) {
        if (this.mStyle.messageIconPosition == Style.ICONPOSITION_LEFT) {
            this.mTextView.setCompoundDrawablesWithIntrinsicBounds(
                    this.mStyle.messageIconResource, 0, 0, 0);
        } else if (this.mStyle.messageIconPosition == Style.ICONPOSITION_TOP) {
            this.mTextView.setCompoundDrawablesWithIntrinsicBounds(
                    0, this.mStyle.messageIconResource, 0, 0);
        } else if (this.mStyle.messageIconPosition == Style.ICONPOSITION_RIGHT) {
            this.mTextView.setCompoundDrawablesWithIntrinsicBounds(
                    0, 0, this.mStyle.messageIconResource, 0);
        } else if (this.mStyle.messageIconPosition == Style.ICONPOSITION_BOTTOM) {
            this.mTextView.setCompoundDrawablesWithIntrinsicBounds(
                    0, 0, 0, this.mStyle.messageIconResource);
        }
    }

    // Handle depreciated API for setting the background
    if (sdkVersion >= Build.VERSION_CODES.JELLY_BEAN) {
        this.mView.setBackground(BackgroundUtils.getBackground(this.mStyle, this.mStyle.color));
        // Give Lollipop devices a nice shadow (does not work with transparent backgrounds)
        if (sdkVersion >= Build.VERSION_CODES.LOLLIPOP) mView.setElevation(3f);
    } else this.mView.setBackgroundDrawable(BackgroundUtils.getBackground(this.mStyle, this.mStyle.color));

    // Make adjustments that are specific to Lollipop frames
    if (this.mStyle.frame == Style.FRAME_LOLLIPOP) {
        this.mTextView.setGravity(Gravity.START);

        // We are on a big screen device, show the SuperToast on the bottom left with padding
        if ((this.mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
                >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
            this.mStyle.xOffset = BackgroundUtils.convertToDIP(12);
            this.mStyle.yOffset = BackgroundUtils.convertToDIP(12);
            this.mStyle.width = BackgroundUtils.convertToDIP(288);
            this.mStyle.gravity = Gravity.BOTTOM | Gravity.START;

            // Simple background shape with rounded corners
            final GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setCornerRadius(BackgroundUtils.convertToDIP(2));
            gradientDrawable.setColor(this.mStyle.color);

            // Handle depreciated API for setting the background
            if (sdkVersion >= Build.VERSION_CODES.JELLY_BEAN) this.mView.setBackground(gradientDrawable);
            else this.mView.setBackgroundDrawable(gradientDrawable);

        // We are NOT on a big screen device, show the SuperToast on the bottom with NO padding
        } else {
            this.mStyle.yOffset = 0;
            this.mStyle.width = FrameLayout.LayoutParams.MATCH_PARENT;
        }
        
        // Set the priority color of the Lollipop frame if any
        if (this.mStyle.priorityColor != 0) {
            mView.findViewById(R.id.border).setVisibility(View.VISIBLE);
            mView.findViewById(R.id.border).setBackgroundColor(this.mStyle.priorityColor);
        }
    }
    // Used for PriorityQueue comparisons
    this.getStyle().timestamp = System.currentTimeMillis();
}
 
源代码9 项目: Yahala-Messenger   文件: Utilities.java
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码10 项目: xDrip-plus   文件: BgGraphBuilder.java
static public boolean isLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码11 项目: 2048-android   文件: MainActivity.java
@SuppressLint({"SetJavaScriptEnabled", "ShowToast", "ClickableViewAccessibility"})
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Don't show an action bar or title
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    // Enable hardware acceleration
    getWindow().setFlags(LayoutParams.FLAG_HARDWARE_ACCELERATED,
            LayoutParams.FLAG_HARDWARE_ACCELERATED);

    // Apply previous setting about showing status bar or not
    applyFullScreen(isFullScreen());

    // Check if screen rotation is locked in settings
    boolean isOrientationEnabled = false;
    try {
        isOrientationEnabled = Settings.System.getInt(getContentResolver(),
                Settings.System.ACCELEROMETER_ROTATION) == 1;
    } catch (SettingNotFoundException e) {
        Log.d(MAIN_ACTIVITY_TAG, "Settings could not be loaded");
    }

    // If rotation isn't locked and it's a LARGE screen then add orientation changes based on sensor
    int screenLayout = getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    if (((screenLayout == Configuration.SCREENLAYOUT_SIZE_LARGE)
            || (screenLayout == Configuration.SCREENLAYOUT_SIZE_XLARGE))
            && isOrientationEnabled) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    setContentView(R.layout.activity_main);

    DialogChangeLog changeLog = DialogChangeLog.newInstance(this);
    if (changeLog.isFirstRun()) {
        changeLog.getLogDialog().show();
    }

    // Load webview with game
    mWebView = findViewById(R.id.mainWebView);
    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setDatabaseEnabled(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setDatabasePath(getFilesDir().getParentFile().getPath() + "/databases");

    // If there is a previous instance restore it in the webview
    if (savedInstanceState != null) {
        mWebView.restoreState(savedInstanceState);
    } else {
        // Load webview with current Locale language
        mWebView.loadUrl("file:///android_asset/2048/index.html?lang=" + Locale.getDefault().getLanguage());
    }

    Toast.makeText(getApplication(), R.string.toggle_fullscreen, Toast.LENGTH_SHORT).show();
    // Set fullscreen toggle on webview LongClick
    mWebView.setOnTouchListener((v, event) -> {
        // Implement a long touch action by comparing
        // time between action up and action down
        long currentTime = System.currentTimeMillis();
        if ((event.getAction() == MotionEvent.ACTION_UP)
                && (Math.abs(currentTime - mLastTouch) > mTouchThreshold)) {
            boolean toggledFullScreen = !isFullScreen();
            saveFullScreen(toggledFullScreen);
            applyFullScreen(toggledFullScreen);
        } else if (event.getAction() == MotionEvent.ACTION_DOWN) {
            mLastTouch = currentTime;
        }
        // return so that the event isn't consumed but used
        // by the webview as well
        return false;
    });

    pressBackToast = Toast.makeText(getApplicationContext(), R.string.press_back_again_to_exit,
            Toast.LENGTH_SHORT);
}
 
源代码12 项目: WanAndroid   文件: ViewHelper.java
private static boolean isTablet(@NonNull Resources resources) {
    return (resources.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码13 项目: heads-up   文件: SettingsActivity.java
/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 */
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
    & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码14 项目: BotLibre   文件: MainActivity.java
public static boolean isTablet(Context context) {
	return (context.getResources().getConfiguration().screenLayout
			& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码15 项目: FastLib   文件: AppUtil.java
public static boolean isPad(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码16 项目: AndroidUtilCode   文件: DeviceUtils.java
/**
 * Return whether device is tablet.
 *
 * @return {@code true}: yes<br>{@code false}: no
 */
public static boolean isTablet() {
    return (Resources.getSystem().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码17 项目: QuranAndroid   文件: TranslationReadActivity.java
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码18 项目: BotLibre   文件: MainActivity.java
public static boolean isTablet(Context context) {
	return (context.getResources().getConfiguration().screenLayout
			& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码19 项目: grblcontroller   文件: GrblActivity.java
public static boolean isTablet(Context context){
    return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
 
源代码20 项目: o2oa   文件: CommonUtils.java
/**
 * 判断是否是平板
 * 这个方法是从 Google I/O App for Android 的源码里找来的,非常准确。
 * @param context
 * @return
 */
public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}