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:org.site_monitor.activity.PrefSettingsActivity.java

/**
 * Helper method to determine if the device has an extra-large screen. For example, 10" tablets are extra-large.
 *///  ww w . j  a va 2  s .c o m

private static boolean isXLargeTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

From source file:com.raja.knowme.FragmentSpecialization.java

private AppTextView addItem(final SpecializationDetailsObject data) {
    final AppTextView mTextView = new AppTextView(getActivity());

    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        //   Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        LayoutParams mViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSpecializationName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(14);//from  w  w w .  j a v a2s.c  o m
        mTextView.setPadding(3, 15, 0, 0);
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        //   Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show();
        LayoutParams mViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSpecializationName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(16);
        mTextView.setPadding(3, 15, 0, 0);
    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        //  Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show();
        LayoutParams mViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSpecializationName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(20);
        mTextView.setPadding(3, 15, 0, 0);

    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        //  Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show();
        LayoutParams mViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSpecializationName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(24);
        mTextView.setPadding(3, 15, 0, 0);
    }

    //Undefined Size

    else {
        //Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show();
        LayoutParams mViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSpecializationName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(20);
        mTextView.setPadding(3, 15, 0, 0);

    }

    /*try {
      mTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, mImage, 0);
    } catch (Exception e) {
      Log.w(this.getClass().getName(), "Drawable not found for : " + name);
    }*/
    if (data.getSpecializationLink().length() > 0) {
        mTextView.setBackgroundResource(R.drawable.button_config);
        mTextView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (data.getSpecializationLink().trim().length() > 0)
                    openWebPage(data.getSpecializationLink(), mTextView);
                else {
                    mTextView.startAnimation(shake);
                    Toast.makeText(getActivity(), R.string.error_redirection_link, Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
    return mTextView;
}

From source file:com.raja.knowme.FragmentSkills.java

private AppTextView addItem(final SkillsDetailsObject data) {
    final AppTextView mTextView = new AppTextView(getActivity());

    /*                 Multiple Screen Size Condition             */

    // Small Size

    if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        // Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show();
        LinearLayout.LayoutParams mViewParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSkillsName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(12);//from  w w w.  j a v a 2s  .  co  m
        mTextView.setPadding(3, 15, 0, 0);
    }

    //Normal Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
        // Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show();
        LinearLayout.LayoutParams mViewParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSkillsName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(16);
        mTextView.setPadding(3, 15, 0, 0);

    }

    // Large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        //  Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show();
        LinearLayout.LayoutParams mViewParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSkillsName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(20);
        mTextView.setPadding(3, 15, 0, 0);

    }

    //X-large Size

    else if ((getContext().getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
        //  Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show();
        LinearLayout.LayoutParams mViewParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSkillsName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(24);
        mTextView.setPadding(3, 15, 0, 0);

    }

    //Undefined Size

    else {
        // Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show();
        LinearLayout.LayoutParams mViewParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        mViewParams.setMargins(0, 5, -5, 0);
        mTextView.setLayoutParams(mViewParams);
        mTextView.setText(data.getSkillsName());
        mTextView.setGravity(Gravity.LEFT);
        mTextView.setTextColor(Color.WHITE);
        mTextView.setTextSize(20);
        mTextView.setPadding(3, 15, 0, 0);

    }

    /*try {
      mTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, mImage, 0);
    } catch (Exception e) {
      Log.w(this.getClass().getName(), "Drawable not found for : " + name);
    }*/
    if (data.getSkillsLink().length() > 0) {
        mTextView.setBackgroundResource(R.drawable.button_config);
        mTextView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (data.getSkillsLink().trim().length() > 0)
                    openWebPage(data.getSkillsLink(), mTextView);
                else {
                    mTextView.startAnimation(shake);
                    Toast.makeText(getActivity(), R.string.error_redirection_link, Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
    return mTextView;
}

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");
    }//from  w ww . j a  v a  2s  .  co  m
}

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;/*from ww w.  j a va 2 s .co m*/
        }
        break;
    case (Configuration.SCREENLAYOUT_SIZE_XLARGE):
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            columnNumber = 3;
        } else {
            columnNumber = 2;
        }
        break;
    }

    return columnNumber;
}

From source file:net.olejon.spotcommander.MyTools.java

public boolean allowLandscape() {
    final int size = mContext.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;

    return ((size) == Configuration.SCREENLAYOUT_SIZE_LARGE
            || (size) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
}

From source file:net.movelab.cmlibrary.MapMyData.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    final int screenSize = getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK;
    if (screenSize != Configuration.SCREENLAYOUT_SIZE_LARGE
            && screenSize != Configuration.SCREENLAYOUT_SIZE_XLARGE)
        requestWindowFeature(Window.FEATURE_NO_TITLE);

    // TODO add all of the alerts from countdown activity regarding sensors
    // off, sm off etc.

    Context context = getApplicationContext();
    PropertyHolder.init(context);/*from  w w  w  .  ja  va 2 s .c  o  m*/
    PowerSensor.init(context);

    if (Util.trafficCop(this))
        finish();

    if (!PropertyHolder.getInitialStartDateSet()) {
        Calendar now = Calendar.getInstance();
        now.setTimeInMillis(System.currentTimeMillis());
        PropertyHolder.setMapStartDate(now);
        PropertyHolder.setInitialStartDateSet(true);
    }

    minDist = Util.getMinDist();
    // Log.e("FixGet", "minDist=" + minDist);

    setContentView(R.layout.map_layout);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    // pauseToggle = !PropertyHolder.isServiceOn();

    mPoints = new ArrayList<MapPoint>();

    myMapController = mapView.getController();
    myMapController.setZoom(15);

    progressbar = (ProgressBar) findViewById(R.id.mapProgressbar);
    progressbar.setProgress(0);

    progressbarText = (TextView) findViewById(R.id.progressBarLabel);

    progressNotificationArea = (LinearLayout) findViewById(R.id.mapProgressNotificationArea);

    receiverNotificationArea = (LinearLayout) findViewById(R.id.mapReceiverNotificationArea);

    mReceiversOffWarning = (TextView) findViewById(R.id.mapReceiversOffWarning);

    dateArea = (RelativeLayout) findViewById(R.id.dateArea);

    dateRangeText = (TextView) findViewById(R.id.dateSelectionText);

    dateRangeText.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent e) {

            if (e.getAction() == MotionEvent.ACTION_DOWN) {

                dateRangeText.setBackgroundResource(R.drawable.red_border_pressed);
            }
            if (e.getAction() == MotionEvent.ACTION_UP) {

                dateRangeText.setBackgroundResource(R.drawable.red_border);
            }

            return false;
        }

    });

    dateRangeText.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            Intent i = new Intent(MapMyData.this, Settings.class);
            i.putExtra(DATES_BUTTON_MESSAGE, true);
            startActivity(i);

        }

    });

    getIntro = PropertyHolder.getIntro();
    isPro = PropertyHolder.getProVersion();

    AppRater.app_launched(this);

    privacyZones = new ArrayList<GeoPoint>();

}

From source file:net.olejon.mdapp.MyTools.java

public boolean isTablet() {
    int size = mContext.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;

    return ((size) == Configuration.SCREENLAYOUT_SIZE_LARGE
            || (size) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
}

From source file:tr.com.turkcellteknoloji.turkcellupdater.Utilities.java

@SuppressLint("NewApi")
static boolean isTablet(Context context) {
    if (android.os.Build.VERSION.SDK_INT > 12) {
        return context.getResources().getConfiguration().smallestScreenWidthDp > 600;
    } else if (android.os.Build.VERSION.SDK_INT > 10) {
        int size = context.getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK;
        return (size == Configuration.SCREENLAYOUT_SIZE_LARGE)
                || (size == Configuration.SCREENLAYOUT_SIZE_XLARGE);
    } else {//from  w w  w  .  j  a va2  s.  c  om
        return false;
    }
}

From source file:timer.com.maydaysdk.MayDayMessageChatFragment.java

private int getScreenResolution() {
    int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
    int height;/*  ww  w .j  a va  2s.  c  o  m*/
    switch (screenSize) {
    case Configuration.SCREENLAYOUT_SIZE_LARGE:
        height = MayDayConstant.SIZE_LARGE;
        break;
    case Configuration.SCREENLAYOUT_SIZE_NORMAL:
        height = MayDayConstant.SIZE_NORMAL;
        break;
    case Configuration.SCREENLAYOUT_SIZE_SMALL:
        height = MayDayConstant.SIZE_SMALL;
        break;
    case Configuration.SCREENLAYOUT_SIZE_XLARGE:
        height = MayDayConstant.SIZE_XLARGE;
        break;
    default:
        height = MayDayConstant.SIZE_SMALL;
    }
    return height;
}