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:pl.lawiusz.lockscreenvisualizerxposed.SettingsActivity.java

@Override
public boolean onIsMultiPane() {
    return (getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

From source file:com.facebook.samples.socialcafe.MenuFragmentActivity.java

public void requestUserData() {
    Bundle params = new Bundle();
    int screenLayoutSize = getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_LARGE
            || screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        params.putString("fields", "name, picture.type(large)");
    } else {//from  w  ww.ja  v  a 2  s  .c  o m
        params.putString("fields", "name, picture.type(normal)");
    }
    params.putString("fields", "name, picture.type(large)");
    ((SocialCafeApplication) getActivity().getApplication()).asyncRunner.request("me", params,
            new UserDataRequestListener());
}

From source file:org.adaway.ui.ListsActivity.java

private void setTabTextBasedOnOrientation(Configuration config) {
    // longer names for landscape mode or tablets
    if (config.orientation == Configuration.ORIENTATION_LANDSCAPE
            || config.screenLayout == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        mTab1.setText(getString(R.string.lists_tab_blacklist));
        mTab2.setText(getString(R.string.lists_tab_whitelist));
        mTab3.setText(getString(R.string.lists_tab_redirection_list));

    } else {//  ww w  .  j a  va2 s  . co m
        mTab1.setText(getString(R.string.lists_tab_blacklist_short));
        mTab2.setText(getString(R.string.lists_tab_whitelist_short));
        mTab3.setText(getString(R.string.lists_tab_redirection_list_short));
    }
}

From source file:com.ryan.ryanreader.common.General.java

/**
 * ???//from   ww  w  .j  ava2 s  .  c om
 * 
 * @param context
 * @param sharedPreferences
 * @return
 */
public static boolean isTablet(final Context context, final SharedPreferences sharedPreferences) {

    final PrefsUtility.AppearanceTwopane pref = PrefsUtility.appearance_twopane(context, sharedPreferences);

    switch (pref) {
    case AUTO:
        return (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
    case NEVER:
        return false;
    case FORCE:
        return true;
    default:
        BugReportActivity.handleGlobalError(context, "Unknown AppearanceTwopane value " + pref.name());
        return false;
    }
}

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

@Override
public void updateOnView(ArrayList<ScaleData> scaleDataList) {
    ScaleUser scaleUser = OpenScale.getInstance(overviewView.getContext()).getSelectedScaleUser();

    txtOverviewTitle.setText(getResources().getString(R.string.label_overview_title_start) + " "
            + scaleUser.user_name + " " + getResources().getString(R.string.label_overview_title_end));

    List<ArcValue> arcValues = new ArrayList<ArcValue>();

    if (scaleDataList.isEmpty()) {
        lastScaleData = null;//from   ww  w . ja  v  a 2 s  .  c  om
        return;
    }

    lastScaleData = scaleDataList.get(0);

    arcValues.add(new ArcValue(lastScaleData.fat, Utils.COLOR_ORANGE));
    arcValues.add(new ArcValue(lastScaleData.water, Utils.COLOR_BLUE));
    arcValues.add(new ArcValue(lastScaleData.muscle, Utils.COLOR_GREEN));

    PieChartData pieChartData = new PieChartData(arcValues);
    pieChartData.setHasLabels(true);
    pieChartData.setFormatter(new SimpleValueFormatter(1, false, null, " %".toCharArray()));
    pieChartData.setHasCenterCircle(true);
    pieChartData.setCenterText1(
            Float.toString(lastScaleData.weight) + " " + ScaleUser.UNIT_STRING[scaleUser.scale_unit]);
    pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy (EE)").format(lastScaleData.date_time));

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE
            || (getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        pieChartData.setCenterText1FontSize(33);
        pieChartData.setCenterText2FontSize(14);
    } else {
        pieChartData.setCenterText1FontSize(12);
        pieChartData.setCenterText2FontSize(8);
        pieChartData.setValueLabelTextSize(8);
    }

    pieChart.setPieChartData(pieChartData);

    double avgWeight = 0;
    double avgFat = 0;
    double avgWater = 0;
    double avgMuscle = 0;

    for (ScaleData scaleData : scaleDataList) {
        avgWeight += scaleData.weight;
        avgFat += scaleData.fat;
        avgWater += scaleData.water;
        avgMuscle += scaleData.muscle;
    }

    avgWeight = avgWeight / scaleDataList.size();
    avgFat = avgFat / scaleDataList.size();
    avgWater = avgWater / scaleDataList.size();
    avgMuscle = avgMuscle / scaleDataList.size();

    txtAvgWeight.setText(String.format("%.1f " + ScaleUser.UNIT_STRING[scaleUser.scale_unit], avgWeight));
    txtAvgFat.setText(String.format("%.1f %%", avgFat));
    txtAvgWater.setText(String.format("%.1f %%", avgWater));
    txtAvgMuscle.setText(String.format("%.1f %%", avgMuscle));
}

From source file:com.honeycomb.cocos2dx.Soccer.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(com.honeycomb.cocos2dx.R.layout.main);
    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId("ca-app-pub-2442035138707094/8795197567");
    activity = Soccer.this;
    AndroidNDKHelper.SetNDKReciever(this);

    Cocos2dxGLSurfaceView mGLView = (Cocos2dxGLSurfaceView) findViewById(
            com.honeycomb.cocos2dx.R.id.game_gl_surfaceview);

    mGLView.setEGLContextClientVersion(2);
    mGLView.setCocos2dxRenderer(new Cocos2dxRenderer());

    new Handler().postDelayed(new Runnable() {
        @Override/*from  w  ww  .  j av a2 s  . co  m*/
        public void run() {
            Soccer.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    findViewById(com.honeycomb.cocos2dx.R.id.logolayout).setVisibility(View.GONE);
                }
            });
        }
    }, 3000);

    iapSetup = new IAPSetup();
    mIABHelper = iapSetup.mIABHelper;

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        isLargeDevice = true;
    } else if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        isLargeDevice = true;
    } else if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        isLargeDevice = false;
    } else if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        isLargeDevice = false;
    }
    gamePrefrence = getSharedPreferences("null", MODE_PRIVATE);
}

From source file:org.lol.reddit.common.General.java

public static boolean isTablet(final Context context, final SharedPreferences sharedPreferences) {

    final PrefsUtility.AppearanceTwopane pref = PrefsUtility.appearance_twopane(context, sharedPreferences);

    switch (pref) {
    case AUTO://  w w  w . ja  va  2s .  c  om
        return (context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
    case NEVER:
        return false;
    case FORCE:
        return true;
    default:
        BugReportActivity.handleGlobalError(context, "Unknown AppearanceTwopane value " + pref.name());
        return false;
    }
}

From source file:yet.another.hackernews.reader.HackernewsFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View v, int pos, long id) {
    final News news = (News) parent.getAdapter().getItem(pos);

    if (news.getTitle().equals("More")) {
        return;//w  w w . ja  v  a 2s  .  c  o m
    }

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

    switch (screenLayout) {

    case Configuration.SCREENLAYOUT_SIZE_XLARGE:

        final FragmentManager fManager = getSherlockActivity().getSupportFragmentManager();
        final ViewFragment fragment = (ViewFragment) fManager.findFragmentById(R.id.fragment_view);

        if (fragment != null) {
            ViewFragment.setNews(news);
            fragment.update(null);
            v.setEnabled(true);
        }

        break;
    default:

        Bundle sendArgs = new Bundle();
        sendArgs.putString("NewsObject", news.toString());

        Intent browser = new Intent(getSherlockActivity(), ViewActivity.class);
        browser.putExtras(sendArgs);
        startActivity(browser);

        break;
    }
}

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

@Override
public void updateOnView(ArrayList<ScaleData> scaleDataList) {
    TableRow headerRow = (TableRow) tableView.findViewById(R.id.tableHeader);
    tableDataView.removeAllViews();//from  w w w  . j a v a 2s . c o m
    tableDataView.addView(headerRow);

    for (ScaleData scaleData : scaleDataList) {
        TableRow dataRow = new TableRow(tableView.getContext());
        dataRow.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

        TextView idView = new TextView(tableView.getContext());
        idView.setText(Long.toString(scaleData.id));
        idView.setVisibility(View.GONE);
        dataRow.addView(idView);

        TextView dateTextView = new TextView(tableView.getContext());
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE
                || (getResources().getConfiguration().screenLayout
                        & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
            dateTextView.setText(new SimpleDateFormat("dd. MMM yyyy (EE)").format(scaleData.date_time));
        } else {
            dateTextView.setText(new SimpleDateFormat("dd/MM/yy").format(scaleData.date_time));
        }
        dateTextView.setPadding(0, 5, 5, 5);
        dataRow.addView(dateTextView);

        TextView timeTextView = new TextView(tableView.getContext());
        timeTextView.setText(new SimpleDateFormat("HH:mm").format(scaleData.date_time));
        timeTextView.setPadding(0, 5, 5, 5);
        dataRow.addView(timeTextView);

        TextView weightView = new TextView(tableView.getContext());
        weightView.setText(Float.toString(scaleData.weight));
        weightView.setPadding(0, 5, 5, 5);
        dataRow.addView(weightView);

        TextView fatView = new TextView(tableView.getContext());
        fatView.setText(Float.toString(scaleData.fat));
        fatView.setPadding(0, 5, 5, 5);
        dataRow.addView(fatView);

        TextView waterView = new TextView(tableView.getContext());
        waterView.setText(Float.toString(scaleData.water));
        waterView.setPadding(0, 5, 5, 5);
        dataRow.addView(waterView);

        TextView muscleView = new TextView(tableView.getContext());
        muscleView.setText(Float.toString(scaleData.muscle));
        muscleView.setPadding(0, 5, 5, 5);
        dataRow.addView(muscleView);

        Button deleteButton = new Button(tableView.getContext());
        deleteButton.setText("X");
        deleteButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
        deleteButton.setTextColor(Color.WHITE);
        deleteButton.setBackgroundResource(R.drawable.flat_selector);
        deleteButton.setGravity(Gravity.CENTER);
        deleteButton.setPadding(0, 0, 0, 0);
        deleteButton.setMinimumHeight(35);
        deleteButton.setHeight(35);
        deleteButton.setOnClickListener(new onClickListenerDelete());
        dataRow.addView(deleteButton);

        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE
                && (getResources().getConfiguration().screenLayout
                        & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE) {
            dateTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            timeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            weightView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            fatView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            waterView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            muscleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
        }

        tableDataView.addView(dataRow,
                new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    }
}