Example usage for android.content.res Configuration SCREENLAYOUT_SIZE_LARGE

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

Introduction

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

Prototype

int SCREENLAYOUT_SIZE_LARGE

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

Click Source Link

Document

Constant for #screenLayout : a #SCREENLAYOUT_SIZE_MASK value indicating the screen is at least approximately 480x640 dp units, corresponds to the large resource qualifier.

Usage

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  w ww.j  a  v a  2s . co  m
        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//w w w.  j a va 2s .  c om
        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.tlhInganHol.android.klingonassistant.BaseActivity.java

public boolean isHorizontalTablet() {
    Configuration config = getResources().getConfiguration();
    if (config.orientation == Configuration.ORIENTATION_LANDSCAPE && (config.screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) {
        return true;
    }//  w w w.  j a  v a 2  s  .  c  o m
    return false;
}

From source file:org.chromium.chrome.browser.bookmark.ManageBookmarkActivity.java

@Override
public void finish() {
    super.finish();
    // Disables closing animation only for large/xlarge screen because the activity shows in
    // fullscreen in other cases and so closing animation doesn't look unnatural.
    if (getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE)) {
        overridePendingTransition(0, 0);
    }/*from   w  w w. j a v a 2  s.c  o m*/
}

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 .ja  v a 2  s  . com*/
    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));
    }
}

From source file:com.near.chimerarevo.fragments.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    boolean isLandscapeLarge = false;

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE)
            isLandscapeLarge = true;/*w ww. ja  va2  s .  c  o m*/
    } else
        isLandscapeLarge = false;

    if (!isLandscapeLarge)
        getListView().setPadding(0, getResources().getDimensionPixelSize(R.dimen.actionbar_height), 0, 0);
}

From source file:com.ohso.omgubuntu.BaseFragment.java

public static int getColumnByScreenSize() {
    int columnNumber = 1;
    final int sizeMask = OMGUbuntuApplication.getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    final int orientation = OMGUbuntuApplication.getContext().getResources().getConfiguration().orientation;
    switch (sizeMask) {
    case (Configuration.SCREENLAYOUT_SIZE_LARGE):
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            columnNumber = 2;//  w  w w.  j  a  va 2  s  .c  o  m
        }
        break;
    case (Configuration.SCREENLAYOUT_SIZE_XLARGE):
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            columnNumber = 3;
        } else {
            columnNumber = 2;
        }
        break;
    }

    return columnNumber;
}

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

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final int screenLayout = getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    if (screenLayout == Configuration.SCREENLAYOUT_SIZE_LARGE
            || screenLayout == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        this.initCustomButtons("1");
        this.initCustomButtons("2");
        this.initCustomButtons("3");
        this.initCustomButtons("4");
        this.initCustomButtons("5");
        this.initCustomButtons("6");
        this.initCustomButtons("7");
        this.initCustomButtons("8");
    }//www .  j  a  v  a2  s.  co  m
}

From source file:com.jpventura.alexandria.MainActivity.java

private boolean isTablet() {
    return (getApplicationContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}