Example usage for android.content.res Configuration SCREENLAYOUT_SIZE_XLARGE

List of usage examples for android.content.res Configuration SCREENLAYOUT_SIZE_XLARGE

Introduction

In this page you can find the example usage for android.content.res Configuration SCREENLAYOUT_SIZE_XLARGE.

Prototype

int SCREENLAYOUT_SIZE_XLARGE

To view the source code for android.content.res Configuration SCREENLAYOUT_SIZE_XLARGE.

Click Source Link

Document

Constant for #screenLayout : a #SCREENLAYOUT_SIZE_MASK value indicating the screen is at least approximately 720x960 dp units, corresponds to the xlarge resource qualifier.

Usage

From source file:de.wikilab.android.friendica01.Max.java

public static boolean isLarge(Configuration c) {
    return (((c.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE)
            || ((c.screenLayout// w  w w  .jav  a 2 s.  c  o  m
                    & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE));
}

From source file:net.kevxu.muzei.interfacelift.InterfaceliftMacdropsClient.java

/**
 * Get suitable photo size based on the screen size of phone.
 *
 * @return Dimension Dimension of suitable photo size.
 *///from w  w w.  jav  a  2s  .c o m
protected Dimension getSuitablePhotoDimension() {
    WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();
    display.getRealSize(size);
    final int width = size.x;
    final int height = size.y;

    int screenLayout = mContext.getResources().getConfiguration().screenLayout;
    boolean isXlarge = ((screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
    boolean isLarge = ((screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
    final boolean isTablet = isXlarge || isLarge;

    Dimension dimen;

    if (!isTablet) {
        // Wallpaper for phone needs at least [width x 2] x height
        dimen = new Dimension(width * 2, height);
    } else {
        // Wallpaper for tablet needs at least [long edge] x [long edge]
        int longEdge = width > height ? width : height;
        dimen = new Dimension(longEdge, longEdge);
    }

    return dimen;
}

From source file:eu.inmite.apps.smsjizdenka.core.ProjectBaseActivity.java

private void printDebugInfo() {
    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    DebugLog.i("Device density: " + displaymetrics.densityDpi);
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        DebugLog.i("Device size is: LARGE");
    }/*  w w w  .j  a  v a 2  s  .c o  m*/
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        DebugLog.i("Device size is: XLARGE");
    }
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        DebugLog.i("Device size is: NORMAL");
    }
    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        DebugLog.i("Device size is: SMALL");
    }
    DebugLog.i("Device is tablet: " + UIUtils.isHoneycombTablet(this));
}

From source file:com.example.administrator.mynews.view.AdMobBannerSizesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_admob_banner_sizes, container, false);

    mSizesSpinner = (Spinner) rootView.findViewById(R.id.bannersizes_spn_size);
    mLoadButton = (Button) rootView.findViewById(R.id.bannersizes_btn_loadad);
    mAdFrameLayout = (FrameLayout) rootView.findViewById(R.id.bannersizes_fl_adframe);

    String[] sizesArray;//  w w  w .j a v a  2s. c  o m

    // It is a Mobile Ads SDK policy that only the banner, large banner, and smart banner ad
    // sizes are shown on phones, and that the full banner, leaderboard, and medium rectangle
    // sizes are reserved for use on tablets.  The conditional below checks the screen size
    // and retrieves the correct list.

    int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;

    if ((screenSize == Configuration.SCREENLAYOUT_SIZE_LARGE)
            || (screenSize == Configuration.SCREENLAYOUT_SIZE_XLARGE)) {
        sizesArray = getResources().getStringArray(R.array.bannersizes_largesizes);
    } else {
        sizesArray = getResources().getStringArray(R.array.bannersizes_smallsizes);
    }

    ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(rootView.getContext(),
            android.R.layout.simple_spinner_dropdown_item, sizesArray);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mSizesSpinner.setAdapter(adapter);

    mLoadButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mAdView != null) {
                mAdFrameLayout.removeView(mAdView);
                mAdView.destroy();
            }

            mAdView = new AdView(getActivity());
            mAdView.setAdUnitId(getString(R.string.admob_banner_ad_unit_id));
            mAdFrameLayout.addView(mAdView);

            switch (mSizesSpinner.getSelectedItemPosition()) {
            case 0:
                mAdView.setAdSize(AdSize.BANNER);
                break;
            case 1:
                mAdView.setAdSize(AdSize.LARGE_BANNER);
                break;
            case 2:
                mAdView.setAdSize(AdSize.SMART_BANNER);
                break;
            case 3:
                mAdView.setAdSize(AdSize.FULL_BANNER);
                break;
            case 4:
                mAdView.setAdSize(AdSize.MEDIUM_RECTANGLE);
                break;
            case 5:
                mAdView.setAdSize(AdSize.LEADERBOARD);
                break;
            }

            mAdView.loadAd(new AdRequest.Builder().build());
        }
    });

    return rootView;
}

From source file:com.mruddy.devdataviewer.DevDataListFragment.java

@SuppressLint("InlinedApi")
private static void initMaps() {
    DevDataListFragment.DENSITY_BUCKETS.append(DisplayMetrics.DENSITY_LOW, "LDPI");
    DevDataListFragment.DENSITY_BUCKETS.append(DisplayMetrics.DENSITY_MEDIUM, "MDPI");
    DevDataListFragment.DENSITY_BUCKETS.append(DisplayMetrics.DENSITY_HIGH, "HDPI");
    DevDataListFragment.DENSITY_BUCKETS.append(DisplayMetrics.DENSITY_XHIGH, "XHDPI");
    DevDataListFragment.DENSITY_BUCKETS.append(DisplayMetrics.DENSITY_XXHIGH, "XXHDPI");
    DevDataListFragment.DENSITY_BUCKETS.append(DisplayMetrics.DENSITY_XXXHIGH, "XXXHDPI");
    DevDataListFragment.ROTATION.append(Surface.ROTATION_0, "0");
    DevDataListFragment.ROTATION.append(Surface.ROTATION_90, "90");
    DevDataListFragment.ROTATION.append(Surface.ROTATION_180, "180");
    DevDataListFragment.ROTATION.append(Surface.ROTATION_270, "270");
    DevDataListFragment.ORIENTATION.append(Configuration.ORIENTATION_UNDEFINED, "undefined");
    DevDataListFragment.ORIENTATION.append(Configuration.ORIENTATION_PORTRAIT, "portrait");
    DevDataListFragment.ORIENTATION.append(Configuration.ORIENTATION_LANDSCAPE, "landscape");
    DevDataListFragment.SCREEN_SIZE_BUCKETS.append(Configuration.SCREENLAYOUT_SIZE_UNDEFINED, "undefined");
    DevDataListFragment.SCREEN_SIZE_BUCKETS.append(Configuration.SCREENLAYOUT_SIZE_SMALL, "small");
    DevDataListFragment.SCREEN_SIZE_BUCKETS.append(Configuration.SCREENLAYOUT_SIZE_NORMAL, "normal");
    DevDataListFragment.SCREEN_SIZE_BUCKETS.append(Configuration.SCREENLAYOUT_SIZE_LARGE, "large");
    DevDataListFragment.SCREEN_SIZE_BUCKETS.append(Configuration.SCREENLAYOUT_SIZE_XLARGE, "xlarge");
}

From source file:cm.aptoide.pt.adapters.UpdatesAdapter.java

@Override
public void bindView(View view, final Context context, Cursor cursor) {
    ViewHolder holder = (ViewHolder) view.getTag();
    if (holder == null) {
        holder = new ViewHolder();
        holder.name = (TextView) view.findViewById(R.id.app_name);
        holder.icon = (ImageView) view.findViewById(R.id.app_icon);
        holder.vername = (TextView) view.findViewById(R.id.uptodate_versionname);
        holder.update = (ImageView) view.findViewById(R.id.app_update);

        if ((context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE
                || (context.getResources().getConfiguration().screenLayout
                        & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
            holder.ignore_update = (ImageView) view.findViewById(R.id.app_ignore_update);
        }/*  ww  w  .  ja v  a2  s . c o  m*/

        //            holder.downloads= (TextView) view.findViewById(R.id.downloads);
        //            holder.rating= (RatingBar) view.findViewById(R.id.stars);
        view.setTag(holder);
    }
    final long id = cursor.getLong(0);
    final String name = cursor.getString(1);
    final String apkId = cursor.getString(7);
    final String vername = cursor.getString(2);
    final int vercode = cursor.getInt(8);
    final String md5 = cursor.getString(10);
    final String apkpath = cursor.getString(11) + cursor.getString(12);
    String iconspath = cursor.getString(9) + cursor.getString(4);
    final String hash = (cursor.getString(cursor.getColumnIndex("apkid")) + "|"
            + cursor.getString(cursor.getColumnIndex("vercode")));
    holder.name.setText(name);
    ImageLoader.getInstance().displayImage(iconspath, holder.icon);
    //       try{
    //              holder.rating.setRating(Float.parseFloat(cursor.getString(5)));
    //           }catch (Exception e) {
    //              holder.rating.setRating(0);
    //         }
    //       holder.downloads.setText(cursor.getString(6));
    holder.vername.setText(context.getString(R.string.update_to) + ": " + vername);
    holder.update.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            new GetApkWebserviceInfo(mContext, serviceDownloadManager, true).execute(id);
        }
    });
    if ((context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE
            || (context.getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        holder.ignore_update.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                ViewApk apk = Database.getInstance().getApk(id, Category.INFOXML);
                Database.getInstance().addToExcludeUpdate((int) id);
                if (loader != null)
                    loader.forceLoad();
                Toast toast = Toast.makeText(context,
                        context.getString(R.string.added_to_excluded_updates_list, apk.getName()),
                        Toast.LENGTH_SHORT);
                toast.show();
            }
        });
    }
}

From source file:com.health.openscale.gui.TableFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    tableView = inflater.inflate(R.layout.fragment_table, container, false);

    tableDataView = (TableLayout) tableView.findViewById(R.id.tableDataView);

    tableView.findViewById(R.id.btnImportData).setOnClickListener(new onClickListenerImport());

    tableView.findViewById(R.id.btnExportData).setOnClickListener(new onClickListenerExport());

    tableView.findViewById(R.id.btnDeleteAll).setOnClickListener(new onClickListenerDeleteAll());

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE
            && (getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE) {
        TextView txtDateTableHeader = (TextView) tableView.findViewById(R.id.txtDateTableHeader);
        txtDateTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        TextView txtTimeTableHeader = (TextView) tableView.findViewById(R.id.txtTimeTableHeader);
        txtTimeTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        TextView txtWeightTableHeader = (TextView) tableView.findViewById(R.id.txtWeightTableHeader);
        txtWeightTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        TextView txtFatTableHeader = (TextView) tableView.findViewById(R.id.txtFatTableHeader);
        txtFatTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        TextView txtWaterTableHeader = (TextView) tableView.findViewById(R.id.txtWaterTableHeader);
        txtWaterTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        TextView txtMuscleTableHeader = (TextView) tableView.findViewById(R.id.txtMuscleTableHeader);
        txtMuscleTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        Button btnDeleteAll = (Button) tableView.findViewById(R.id.btnDeleteAll);
        btnDeleteAll.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
    }//from  w w  w .  j  av a2s.c o  m

    return tableView;
}

From source file:com.juegoteca.actividades.Opciones.java

/**
 * Helper method to determine if the device has an extra-large screen. For
 * example, 10" tablets are extra-large.
 *///w  w w .j ava 2 s.  c o m
@SuppressLint("InlinedApi")
private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

From source file:com.coinblesk.client.KeyboardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_keyboard, container, false);

    final int screenLayout = getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    switch (screenLayout) {
    case Configuration.SCREENLAYOUT_SIZE_LARGE:
    case Configuration.SCREENLAYOUT_SIZE_XLARGE:
        initLarge(view);/*from   w w w  .  j av a  2 s.  c  o m*/
        break;
    default:
        initStandard(view);
        break;
    }

    TextView t1 = (TextView) view.findViewById(R.id.amount_large_text_view);
    TextView t2 = (TextView) view.findViewById(R.id.amount_large_text_currency);
    TextView t3 = (TextView) view.findViewById(R.id.amount_small_text_view);
    TextView t4 = (TextView) view.findViewById(R.id.amount_small_text_currency);

    View.OnLongClickListener listener = new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            DialogFragment fragment = CurrencyDialogFragment.newInstance();
            if (fragment != null) {
                fragment.show(KeyboardFragment.this.getFragmentManager(), TAG);
            }
            return true;
        }
    };

    t1.setOnLongClickListener(listener);
    t2.setOnLongClickListener(listener);
    t3.setOnLongClickListener(listener);
    t4.setOnLongClickListener(listener);

    UIUtils.refreshConnectionIconStatus(getActivity(), view);

    return view;
}

From source file:com.grepsound.activities.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);//from   ww  w .  j  ava  2s  .  c  o  m

    mDarkHoverView = findViewById(R.id.dark_hover_view);
    mDarkHoverView.setAlpha(0);

    getFragmentManager().addOnBackStackChangedListener(this);

    fMenu = new PlayerFragment();
    mMainFrag = new MyProfileFragment();
    getFragmentManager().beginTransaction().replace(R.id.move_to_back_container, mMainFrag)
            .replace(R.id.left_drawer, fMenu).commit();
    int layoutSizeMask = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;

    mDrawerIsLocked = (layoutSizeMask == Configuration.SCREENLAYOUT_SIZE_LARGE
            || layoutSizeMask == Configuration.SCREENLAYOUT_SIZE_XLARGE)
            && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;

    setupNavigationDrawer(mDrawerIsLocked);
    mAccount = CreateSyncAccount(this);
    ContentResolver.addPeriodicSync(mAccount, AUTHORITY, new Bundle(), SYNC_INTERVAL);

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    Log.i(TAG, "wifi only is " + prefs.getBoolean("wifi_only", false));

}