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: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.//from w ww  .j av  a2s.  com
   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
   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"));
   }
}

From source file:com.waz.zclient.utils.ViewUtils.java

public static void lockScreenOrientation(int orientation, Activity activity) {
    switch (orientation) {
    case Configuration.ORIENTATION_PORTRAIT:
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;/*from www  . j a  va2  s  .  co  m*/
    case Configuration.ORIENTATION_LANDSCAPE:
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
    default:
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        break;
    }
}

From source file:com.yojiokisoft.japanesecalc.activity.SkinActivity.java

/**
 * ??//w  ww  . java  2 s. c  om
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_skin);

    int imageW = MyResource.dpi2Px(53);
    int imageH = MyResource.dpi2Px(80);
    int margin7 = MyResource.dpi2Px(7);
    int margin3 = MyResource.dpi2Px(3);

    mSkinResName = SettingDao.getInstance().getSkin();

    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        CustomScrollView scrollView = (CustomScrollView) findViewById(R.id.horizontal_scrollview);
        scrollView.setScrollStateListener(mImageVScrolled);
    } else {
        CustomHorizontalScrollView scrollView = (CustomHorizontalScrollView) findViewById(
                R.id.horizontal_scrollview);
        scrollView.setScrollStateListener(mImageHScrolled);
    }
    LinearLayout imageContainer = (LinearLayout) findViewById(R.id.image_container);
    mLeftArrow = (ImageView) findViewById(R.id.left_arrow);
    mRightArrow = (ImageView) findViewById(R.id.right_arrow);
    mPager = (ViewPager) findViewById(R.id.pager);
    mUseButton = (Button) findViewById(R.id.use_button);

    mUseButton.setOnClickListener(mUseButtonClicked);

    BackImageDao backImageDao = new BackImageDao();
    List<BackImageEntity> items = backImageDao.queryForAll();
    int resId;
    int size = items.size();
    ImageView[] images = new ImageView[size];
    for (int i = 0; i < size; i++) {
        images[i] = new ImageView(this);
        resId = MyResource.getResourceIdByName("s_" + items.get(i).resourceName);
        images[i].setImageResource(resId);
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            images[i].setLayoutParams(new LayoutParams(imageH, imageW + margin7));
            images[i].setPadding(0, margin3, 0, margin3);
        } else {
            images[i].setLayoutParams(new LayoutParams(imageW + margin7, imageH));
            images[i].setPadding(margin3, 0, margin3, 0);
        }
        images[i].setTag(i);
        images[i].setOnClickListener(mImageClicked);
        imageContainer.addView(images[i]);
    }

    SkinPagerAdapter adapter = new SkinPagerAdapter(this, items);
    mPager.setAdapter(adapter);
    mPager.setOnPageChangeListener(mPageChanged);
    setUseButtonText(items.get(0).resourceName);
}

From source file:com.anjalimacwan.fragment.WelcomeFragment.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override/*  w  w w  .jav a2  s .c  om*/
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Set values
    setRetainInstance(true);
    setHasOptionsMenu(true);

    // Animate elevation change
    if (getActivity().findViewById(R.id.layoutMain).getTag().equals("main-layout-large")
            && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        LinearLayout noteViewEdit = (LinearLayout) getActivity().findViewById(R.id.noteViewEdit);
        LinearLayout noteList = (LinearLayout) getActivity().findViewById(R.id.noteList);

        noteViewEdit.animate().z(0f);
        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
            noteList.animate().z(getResources().getDimensionPixelSize(R.dimen.note_list_elevation_land));
        else
            noteList.animate().z(getResources().getDimensionPixelSize(R.dimen.note_list_elevation));
    }
}

From source file:com.owncloud.android.ui.activity.FirstRunActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.first_run_activity);

    boolean isProviderOrOwnInstallationVisible = getResources()
            .getBoolean(R.bool.show_provider_or_own_installation);

    setSlideshowSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);

    Button loginButton = findViewById(R.id.login);
    loginButton.setBackgroundColor(Color.WHITE);
    loginButton.setTextColor(Color.BLACK);

    loginButton.setOnClickListener(v -> {
        if (getIntent().getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) {
            Intent authenticatorActivityIntent = new Intent(this, AuthenticatorActivity.class);
            authenticatorActivityIntent.putExtra(AuthenticatorActivity.EXTRA_USE_PROVIDER_AS_WEBLOGIN, false);
            startActivityForResult(authenticatorActivityIntent, FIRST_RUN_RESULT_CODE);
        } else {//from w  ww.  j  a v  a  2 s .c o  m
            finish();
        }
    });

    Button providerButton = findViewById(R.id.signup);
    providerButton.setBackgroundColor(getResources().getColor(R.color.primary_dark));
    providerButton.setTextColor(getResources().getColor(R.color.login_text_color));
    providerButton.setVisibility(isProviderOrOwnInstallationVisible ? View.VISIBLE : View.GONE);
    providerButton.setOnClickListener(v -> {
        Intent authenticatorActivityIntent = new Intent(this, AuthenticatorActivity.class);
        authenticatorActivityIntent.putExtra(AuthenticatorActivity.EXTRA_USE_PROVIDER_AS_WEBLOGIN, true);

        if (getIntent().getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) {
            startActivityForResult(authenticatorActivityIntent, FIRST_RUN_RESULT_CODE);
        } else {
            authenticatorActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(authenticatorActivityIntent);
        }
    });

    TextView hostOwnServerTextView = findViewById(R.id.host_own_server);
    hostOwnServerTextView.setTextColor(getResources().getColor(R.color.login_text_color));
    hostOwnServerTextView.setVisibility(isProviderOrOwnInstallationVisible ? View.VISIBLE : View.GONE);

    progressIndicator = findViewById(R.id.progressIndicator);
    ViewPager viewPager = findViewById(R.id.contentPanel);

    // Sometimes, accounts are not deleted when you uninstall the application so we'll do it now
    if (isFirstRun(this)) {
        AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
        if (am != null) {
            for (Account account : AccountUtils.getAccounts(this)) {
                am.removeAccount(account, null, null);
            }
        }
    }

    FeaturesViewAdapter featuresViewAdapter = new FeaturesViewAdapter(getSupportFragmentManager(),
            getFirstRun());
    progressIndicator.setNumberOfSteps(featuresViewAdapter.getCount());
    viewPager.setAdapter(featuresViewAdapter);

    viewPager.addOnPageChangeListener(this);
}

From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java

public void setOrientationPadding(View v) {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        v.setPadding(toPixels(55), toPixels(0), toPixels(55), toPixels(0));
    } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        v.setPadding(toPixels(5), toPixels(0), toPixels(5), toPixels(0));
    }/*from  w w w  .  j ava  2s.c om*/
}

From source file:com.emuneee.nctrafficcams.ui.activities.DetailActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detail_activity);

    Bundle extra = getIntent().getExtras();
    if (extra != null) {
        ArrayList<Parcelable> cameras = extra.getParcelableArrayList(Constants.BUNDLE_CAMERAS);
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setOffscreenPageLimit(3);
        mAdapter = new DetailAdapter(getSupportFragmentManager(), cameras);
        mViewPager.setAdapter(mAdapter);
        mViewPager.setCurrentItem(extra.getInt(Constants.BUNDLE_CURRENT_INDEX));
    }// ww  w. j  av a 2s. c o m
    // configure the action bar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayHomeAsUpEnabled(true);

    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        actionBar.hide();
    }
}

From source file:com.akop.bach.activity.xboxlive.FriendList.java

public boolean reoriented() {
    Configuration config = getResources().getConfiguration();
    int orientation = config.orientation;
    int coverflowMode = getAccount().getCoverflowMode();

    if (coverflowMode == XboxLiveAccount.COVERFLOW_IN_LANDSCAPE
            && orientation == Configuration.ORIENTATION_LANDSCAPE) {
        if (App.getConfig().logToConsole())
            App.logv("Reorienting ...");

        FriendCoverflow.actionShowFriends(this, getAccount());
        return true;
    } else if (coverflowMode == XboxLiveAccount.COVERFLOW_ALWAYS) {
        if (App.getConfig().logToConsole())
            App.logv("Reorienting ...");

        FriendCoverflow.actionShowFriends(this, getAccount());
        return true;
    }/*from  w  w  w .ja  v a2  s  . co m*/

    return false;
}

From source file:com.farmerbb.notepad.fragment.WelcomeFragment.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override//from   w  w  w  .ja v a2  s  .co m
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Set values
    setRetainInstance(true);
    setHasOptionsMenu(true);

    // Animate elevation change
    if (getActivity().findViewById(R.id.layoutMain).getTag().equals("main-layout-large")
            && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        LinearLayout noteViewEdit = getActivity().findViewById(R.id.noteViewEdit);
        LinearLayout noteList = getActivity().findViewById(R.id.noteList);

        noteViewEdit.animate().z(0f);
        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
            noteList.animate().z(getResources().getDimensionPixelSize(R.dimen.note_list_elevation_land));
        else
            noteList.animate().z(getResources().getDimensionPixelSize(R.dimen.note_list_elevation));
    }
}

From source file:com.cssn.samplesdk.ShowDataActivity.java

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

    boolean isTablet = getResources().getBoolean(R.bool.isTablet);

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        setContentView(R.layout.activity_show_data_landscape);
    } else {/*from   www.  j a  v a2  s .  c  om*/
        setContentView(R.layout.activity_show_data);
    }

    /*if (isTablet == false)
    {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }*/

    frontSideCardImageView = (ImageView) findViewById(R.id.frontSideCardImage);
    backSideCardImageView = (ImageView) findViewById(R.id.backSideCardImage);
    imgFaceViewer = (ImageView) findViewById(R.id.faceImage);
    imgSignatureViewer = (ImageView) findViewById(R.id.signatureImage);
    textViewCardInfo = (TextView) findViewById(R.id.textViewLicenseCardInfo);
    textViewWSResult = (TextView) findViewById(R.id.textViewWSResult);

    loadResult();
}