Example usage for android.content.res Configuration ORIENTATION_LANDSCAPE

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

Introduction

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

Prototype

int ORIENTATION_LANDSCAPE

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

Click Source Link

Document

Constant for #orientation , value corresponding to the land resource qualifier.

Usage

From source file:com.teddoll.movies.MovieListFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        this.colunms = 3;
    } else {/* w ww.ja  v a  2  s .  c  o  m*/
        this.colunms = 2;
    }
}

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

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

    boolean isLandscapeLarge = false;

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if ((getResources().getConfiguration().screenLayout
                & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE)
            isLandscapeLarge = true;//from www. j a  v  a 2s  .c o  m
    } else
        isLandscapeLarge = false;

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

    mListView = (RecyclerView) v.findViewById(R.id.cardList);

    mProgressContainer = v.findViewById(R.id.progressContainer);
    mListContainer = v.findViewById(R.id.listContainer);
    mEmptyText = v.findViewById(android.R.id.empty);

    ((TextView) v.findViewById(android.R.id.empty)).setText(R.string.text_nofavorites);

    return v;
}

From source file:com.daiv.android.twitter.listeners.MainDrawerClickListener.java

public MainDrawerClickListener(Context context, NotificationDrawerLayout drawer, ViewPager viewPager) {
    this.context = context;
    this.drawer = drawer;
    this.viewPager = viewPager;
    this.noWait = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
            || context.getResources().getBoolean(R.bool.isTablet);
    sharedPreferences = context.getSharedPreferences("com.daiv.android.twitter_world_preferences",
            Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);

    int currentAccount = sharedPreferences.getInt("current_account", 1);

    for (int i = 0; i < TimelinePagerAdapter.MAX_EXTRA_PAGES; i++) {
        String pageIdentifier = "account_" + currentAccount + "_page_" + (i + 1);
        int type = sharedPreferences.getInt(pageIdentifier, AppSettings.PAGE_TYPE_NONE);

        if (type != AppSettings.PAGE_TYPE_NONE) {
            swipablePages++;//from www .  j  a v a  2s . c  o  m
        }
    }

    set = sharedPreferences.getStringSet("drawer_elements_shown_" + currentAccount, new HashSet<String>());
    shownElements = new String[set.size()];
    int i = 0;
    for (Object o : set.toArray()) {
        shownElements[i] = (String) o;
        i++;
    }
}

From source file:com.yojiokisoft.japanesecalc.SkinPagerAdapter.java

/**
 * @see PagerAdapter#instantiateItem(ViewGroup, int)
 *///  w ww . ja va  2  s  .c  o m
@Override
public Object instantiateItem(ViewGroup container, int position) {
    FrameLayout layout = (FrameLayout) this.mInflter.inflate(R.layout.page_skin, null);

    mBigImage = (ImageView) layout.findViewById(R.id.big_image);
    int padding = MyResource.dpi2Px(5);
    if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        mBigImage.setPadding(0, 0, padding, 0);
    } else {
        mBigImage.setPadding(0, padding, 0, 0);
    }

    BackImageEntity item = mList.get(position);
    String resName = item.resourceName;
    int resId = MyResource.getResourceIdByName(resName);
    mBigImage.setImageResource(resId);
    mBigImage.setTag(resName);

    // ?
    container.addView(layout);

    return layout;
}

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:dev.ronlemire.samplestemplate.MainActivity.java

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

    // Test whether if enough display space for 2 panes. Only if tablet and
    // landscape.
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) {
        // 2 panes - list on left - sample on right
        setContentView(R.layout.main_land);
        StartEmptyFragment(); // clear sample pane
    } else {/*from  w ww. ja v  a  2  s .  co m*/
        // 1 pane - list and sample will overlay each other
        setContentView(R.layout.main);
    }

    // Save reference to List in order to replace later
    sampleListView = this.findViewById(R.id.list_replacer);
    messageTextView = (TextView) this.findViewById(R.id.etMessages);
    messageTextView.setEnabled(false);
    messageTextView.setTextColor(Color.parseColor("#000000")); // black

    // Receiver to catch message sent from List after a sample has been
    // picked
    sampleListReceiver = new SampleListReceiver();
    sampleListFilter = new IntentFilter(SampleListFragment.SAMPLE_LIST_FRAGMENT_BROADCAST_INTENT);

    // Messages from controls
    messageFromSampleReceiver = new MessageFromSampleReceiver();
    messageFromSampleFilter = new IntentFilter(SampleFragment.MESSAGE_FROM_SAMPLE_INTENT);

    if (savedInstanceState == null) {
        StartSampleListFragment();
    } else {
        messageTextView.setText(savedInstanceState.getString("message"));
    }
}

From source file:dev.ronlemire.samplestemplate.MainActivity.java

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

   // Test whether if enough display space for 2 panes. Only if tablet and
   // landscape./* www.  j ava2  s. c  om*/
   if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
         && isTablet()) {
      // 2 panes - list on left - sample on right
      setContentView(R.layout.main_land);
      StartEmptyFragment(); // clear sample pane
   } else {
      // 1 pane - list and sample will overlay each other
      setContentView(R.layout.main);
   }

   // Save reference to List in order to replace later
   sampleListView = this.findViewById(R.id.list_replacer);
   messageTextView = (TextView) this.findViewById(R.id.etMessages);
   messageTextView.setEnabled(false);
   messageTextView.setTextColor(Color.parseColor("#000000")); // black

   // Receiver to catch message sent from List after a sample has been
   // picked
   sampleListReceiver = new SampleListReceiver();
   sampleListFilter = new IntentFilter(
         SampleListFragment.SAMPLE_LIST_FRAGMENT_BROADCAST_INTENT);

   // Messages from controls
    messageFromSampleReceiver = new MessageFromSampleReceiver();
   messageFromSampleFilter = new IntentFilter(
         SampleFragment.MESSAGE_FROM_SAMPLE_INTENT);


   if (savedInstanceState == null) {
      StartSampleListFragment();
   }
   else {
      messageTextView.setText(savedInstanceState.getString("message"));
   }
}

From source file:com.grarak.kerneladiutor.fragments.kernel.CPUVoltageFragment.java

@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 6 : 5;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 3;
}

From source file:com.klinker.android.twitter.listeners.MainDrawerClickListener.java

public MainDrawerClickListener(Context context, NotificationDrawerLayout drawer, ViewPager viewPager) {
    this.context = context;
    this.drawer = drawer;
    this.viewPager = viewPager;
    this.noWait = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
            || context.getResources().getBoolean(R.bool.isTablet);
    sharedPreferences = context.getSharedPreferences("com.klinker.android.twitter_world_preferences",
            Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);

    int currentAccount = sharedPreferences.getInt("current_account", 1);

    int page1Type = sharedPreferences.getInt("account_" + currentAccount + "_page_1",
            AppSettings.PAGE_TYPE_NONE);
    int page2Type = sharedPreferences.getInt("account_" + currentAccount + "_page_2",
            AppSettings.PAGE_TYPE_NONE);

    if (page1Type != AppSettings.PAGE_TYPE_NONE) {
        extraPages++;/*ww w . j av  a2s .c o  m*/
    }

    if (page2Type != AppSettings.PAGE_TYPE_NONE) {
        extraPages++;
    }

    Log.v("talon_lists", extraPages + " extra pages");

}

From source file:dev.ronlemire.validation.MainActivity.java

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

    // Test whether if enough display space for 2 panes. Only if tablet and
    // landscape.
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isTablet()) {
        // 2 panes - list on left - sample on right
        setContentView(R.layout.main_land);
        StartEmptyFragment(); // clear sample pane
    } else {//from www.  j  av a  2 s.c  om
        // 1 pane - list and sample will overlay each other
        setContentView(R.layout.main);
    }

    // Save reference to List in order to replace later
    validationListView = this.findViewById(R.id.list_replacer);
    messageTextView = (TextView) this.findViewById(R.id.etMessages);
    messageTextView.setEnabled(false);
    messageTextView.setTextColor(Color.parseColor("#000000")); // black

    // Receiver to catch message sent from List after a sample has been
    // picked
    validationListReceiver = new ValidationListReceiver();
    validationListFilter = new IntentFilter(ValidationListFragment.VALIDATION_LIST_FRAGMENT_BROADCAST_INTENT);

    // Messages from controls
    messageFromHintsReceiver = new MessageFromHintsReceiver();
    messageFromHintsFilter = new IntentFilter(HintsFragment.MESSAGE_FROM_HINTS_INTENT);

    messageFromInputTypeReceiver = new MessageFromInputTypeReceiver();
    messageFromInputTypeFilter = new IntentFilter(InputTypeFragment.MESSAGE_FROM_INPUT_TYPE_INTENT);

    messageFromRegexReceiver = new MessageFromRegexReceiver();
    messageFromRegexFilter = new IntentFilter(RegexFragment.MESSAGE_FROM_REGEX_INTENT);

    if (savedInstanceState == null) {
        StartValidationListFragment();
    } else {
        messageTextView.setText(savedInstanceState.getString("message"));
    }
}