List of usage examples for android.content.res Configuration ORIENTATION_LANDSCAPE
int ORIENTATION_LANDSCAPE
To view the source code for android.content.res Configuration ORIENTATION_LANDSCAPE.
Click Source Link
From source file:com.klinker.android.twitter.ui.drawer_activities.lists.ChoosenListActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else {/* w w w. j av a 2 s .c om*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } context = this; sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); settings = AppSettings.getInstance(this); if (settings.advanceWindowed) { setUpWindow(); } Utils.setUpPopupTheme(this, settings); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.lists)); setContentView(R.layout.ptr_list_layout); if (!settings.isTwitterLoggedIn) { Intent login = new Intent(context, LoginActivity.class); startActivity(login); finish(); } mPullToRefreshLayout = (FullScreenSwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); spinner = (LinearLayout) findViewById(R.id.list_progress); mPullToRefreshLayout.setOnRefreshListener(new FullScreenSwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { onRefreshStarted(); } }); if (settings.addonTheme) { mPullToRefreshLayout.setColorScheme(settings.accentInt, SwipeProgressBar.COLOR2, settings.accentInt, SwipeProgressBar.COLOR3); } else { if (settings.theme != AppSettings.THEME_LIGHT) { mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR2, context.getResources().getColor(R.color.app_color), SwipeProgressBar.COLOR3); } else { mPullToRefreshLayout.setColorScheme(context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_1), context.getResources().getColor(R.color.app_color), getResources().getColor(R.color.light_ptr_2)); } } listView = (AsyncListView) findViewById(R.id.listView); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { final int lastItem = firstVisibleItem + visibleItemCount; if (lastItem == totalItemCount && canRefresh) { getLists(); } } }); BitmapLruCache cache = App.getInstance(context).getBitmapCache(); ArrayListLoader loader = new ArrayListLoader(cache, context); ItemManager.Builder builder = new ItemManager.Builder(loader); builder.setPreloadItemsEnabled(true).setPreloadItemsCount(50); builder.setThreadPoolSize(4); listView.setItemManager(builder.build()); listName = getIntent().getStringExtra("list_name"); listId = Integer.parseInt(getIntent().getStringExtra("list_id")); actionBar.setTitle(listName); getLists(); Utils.setActionBar(context); }
From source file:de.gebatzens.ggvertretungsplan.fragment.SubstFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { bundle = ((MainActivity) getActivity()).savedState; mViewPager = (ViewPager) view.findViewById(R.id.viewpager); mGGFrag = new SubstAdapter(this, savedInstanceState, (MainActivity) getActivity()); if (bundle != null) { mGGFrag.heute.spinnerPos = bundle.getInt("ggvp_frag_today_spinner"); mGGFrag.morgen.spinnerPos = bundle.getInt("ggvp_frag_tomorrow_spinner"); }// ww w .jav a 2 s . c o m mViewPager.setAdapter(mGGFrag); mViewPager.setOffscreenPageLimit(3); if (bundle != null) mViewPager.setCurrentItem(bundle.getInt("ggvp_tab")); mToolbar = (Toolbar) ((MainActivity) this.getActivity()).mToolbar; ColorDrawable mToolbarColor = (ColorDrawable) mToolbar.getBackground(); int mToolbarColorId = mToolbarColor.getColor(); mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs); mSlidingTabLayout.setBackgroundColor(mToolbarColorId); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mSlidingTabLayout.setPadding(toPixels(48), 0, toPixels(48), 0); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { mSlidingTabLayout.setPadding(toPixels(8), 0, toPixels(8), 0); } mSlidingTabLayout.setViewPager(mViewPager); swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.refresh); // Setup refresh listener which triggers new data loading swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { GGApp.GG_APP.refreshAsync(new Runnable() { @Override public void run() { swipeContainer.post(new Runnable() { @Override public void run() { swipeContainer.setRefreshing(false); } }); } }, true, GGApp.FragmentType.PLAN); } }); // Configure the refreshing colors swipeContainer.setColorSchemeResources(R.color.custom_material_green, R.color.custom_material_red, R.color.custom_material_blue, R.color.custom_material_orange); FrameLayout contentFrame = (FrameLayout) getActivity().findViewById(R.id.content_fragment); contentFrame.setVisibility(View.VISIBLE); LinearLayout fragmentLayout = (LinearLayout) getActivity().findViewById(R.id.fragment_layout); Animation fadeIn = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.fade_in); fragmentLayout.startAnimation(fadeIn); }
From source file:com.near.chimerarevo.fragments.ProductsListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.products_grid_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;/* ww w . ja va 2 s. c om*/ } else isLandscapeLarge = false; if (!isLandscapeLarge) v.setPadding(0, getResources().getDimensionPixelSize(R.dimen.actionbar_height), 0, 0); GridView mGrid = (GridView) v.findViewById(R.id.products_grid); mCat = (Spinner) v.findViewById(R.id.category_spinner); mBrand = (Spinner) v.findViewById(R.id.brand_spinner); mLoading = (ProgressWheel) v.findViewById(R.id.product_progress); brandsList = new ArrayList<>(); catList = new ArrayList<>(); catIdList = new ArrayList<>(); arrayList = new ArrayList<>(); mAdapter = new ProductsAdapter(arrayList); if (mGrid != null) { mGrid.setAdapter(mAdapter); mGrid.setOnScrollListener(this); mGrid.setOnItemClickListener(this); } return v; }
From source file:de.gebatzens.sia.fragment.SubstFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); bundle = ((MainActivity) getActivity()).savedState; mViewPager = (ViewPager) view.findViewById(R.id.viewpager); substAdapter = new SubstAdapter(this, savedInstanceState, mViewPager); /*if(bundle != null) { for(int i = 0; i < substAdapter.fragments.size(); i++) substAdapter.fragments.get(i).spinnerPos = bundle.getInt("ggvp_frag_spinner_" + i); }*//* w ww .j av a2 s. co m*/ mViewPager.setAdapter(substAdapter); mViewPager.setOffscreenPageLimit(2); if (bundle != null) mViewPager.setCurrentItem(bundle.getInt("ggvp_tab")); mTabLayout = (TabLayout) view.findViewById(R.id.tab_layout); mTabLayout.setupWithViewPager(mViewPager); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mTabLayout.setPadding(toPixels(48), 0, toPixels(48), 0); mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { mTabLayout.setTabMode(TabLayout.MODE_FIXED); } FrameLayout contentFrame = (FrameLayout) getActivity().findViewById(R.id.content_fragment); contentFrame.setVisibility(View.VISIBLE); }
From source file:by.gdgminsk.animationguide.ContactDetailsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && getResources().getBoolean(R.bool.translucent_status)) { int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; getWindow().getDecorView().setSystemUiVisibility(flags); }/* w ww . j a v a 2 s.c o m*/ setContentView(R.layout.activity_contact_details); mCurrentOrientation = getResources().getConfiguration().orientation; boolean land = mCurrentOrientation == Configuration.ORIENTATION_LANDSCAPE; if (savedInstanceState == null) { mInitialOrientation = mCurrentOrientation; } else { mInitialOrientation = savedInstanceState.getInt(KEY_INITIAL_ORIENTATION); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); // getSupportActionBar() can't return null here because we set it one row above //noinspection ConstantConditions ab.setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); Contact contact = intent.getParcelableExtra(EXTRA_CONTACT); if (contact == null) { Log.e(LOG_TAG, "contact is not provided"); finish(); return; } mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar); mOverlay = findViewById(R.id.overlay); mPhotoView = (ImageView) findViewById(R.id.contact_photo); RecyclerView detailsList = (RecyclerView) findViewById(R.id.details_list); detailsList.setAdapter(new ContactDetailsAdapter(contact, this)); if (!land) { ObservableCollapsingToolbarLayout collapsingToolbar = (ObservableCollapsingToolbarLayout) findViewById( R.id.toolbar_layout); collapsingToolbar.setOnScrollListener(mOnScrollListener); mPhotoView.setOnClickListener(mPhotoClickListener); } ab.setTitle(contact.getName()); loadPhoto(contact); }
From source file:br.org.funcate.dynamicforms.FragmentDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // don't permit rotation int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {/* www . jav a 2 s .c om*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } String tags = ""; String defaultSectionName = FormUtilities.DEFAULT_SESSION_NAME; Intent intent = getIntent(); Bundle extras = intent.getExtras(); String geojsonTags = ""; if (extras != null) { pointId = extras.getLong(LibraryConstants.SELECTED_POINT_ID); formName = extras.getString(FormUtilities.ATTR_FORMNAME); tags = extras.getString(FormUtilities.ATTR_JSON_TAGS); if (extras.containsKey(FormUtilities.ATTR_GEOJSON_TAGS)) { geojsonTags = extras.getString(FormUtilities.ATTR_GEOJSON_TAGS); } // here are the attribute values from feature to populate form in edit operation if (extras.containsKey(FormUtilities.ATTR_DATA_VALUES)) { existingFeatureData = extras.getBundle(FormUtilities.ATTR_DATA_VALUES); } workingDirectory = extras.getString(FormUtilities.MAIN_APP_WORKING_DIRECTORY); } try { sectionObject = TagsManager.getInstance(tags).getSectionByName(defaultSectionName); if (sectionObject == null) { Toast.makeText(getApplicationContext(), "Failure on get form session.", Toast.LENGTH_LONG).show(); System.out.println("Failure on load JSON form from database."); this.finish(); } JSONObject geojson = new JSONObject(geojsonTags); sectionObject.put(FormUtilities.ATTR_GEOJSON_TAGS, geojson); } catch (JSONException e) { Toast.makeText(getApplicationContext(), "Incorrect form configuration.", Toast.LENGTH_LONG).show(); System.out.println("Failure on load JSON form from database."); e.printStackTrace(); this.finish(); } setContentView(R.layout.details_activity_layout); }
From source file:com.dm.wallpaper.board.fragments.AboutFragment.java
private void resetRecyclerViewPadding(int orientation) { if (mRecyclerView == null) return;/*from ww w . java 2 s . co m*/ int padding = 0; int navBar = 0; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { padding = getActivity().getResources().getDimensionPixelSize(R.dimen.content_padding); navBar = padding; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { boolean tabletMode = getActivity().getResources().getBoolean(R.bool.android_helpers_tablet_mode); if (tabletMode || orientation == Configuration.ORIENTATION_PORTRAIT) { navBar = WindowHelper.getNavigationBarHeight(getActivity()); } navBar += WindowHelper.getStatusBarHeight(getContext()); } navBar += ViewHelper.getToolbarHeight(getActivity()); mRecyclerView.setPadding(padding, padding, 0, navBar); }
From source file:de.hackerspacebremen.StartActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/*from w w w .j av a 2 s . co m*/ this.state = null; this.changeShown = false; this.mapShown = false; this.newsShown = false; if (this.getIntent() != null && this.getIntent().getAction() != null && this.getIntent().getAction().equals("android.intent.action.VIEW")) { if (this.getIntent().getBooleanExtra("widget", false)) { this.manageFragment(FragmentState.ONLY_STATUS, null); } else { this.manageFragment(FragmentState.CHANGE_SHOWN, null); } } else { if (savedInstanceState != null && savedInstanceState.getString("state") != null) { this.state = FragmentState.parseToState(savedInstanceState.getString("state")); if ((getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT && state == FragmentState.CHANGE_SHOWN && savedInstanceState.getString("change_json") != null) || (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && state == FragmentState.CHANGE_SHOWN)) { this.manageFragment(state, savedInstanceState); } // this.manageFragment(FragmentState.parseToState(savedInstanceState.getString("state")),savedInstanceState); } else { this.manageFragment(FragmentState.ONLY_STATUS, savedInstanceState); } } }
From source file:com.github.guwenk.smuradio.SignInDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { builder = new AlertDialog.Builder(getActivity()); View signInDialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_sign_in, null); builder.setView(signInDialogView);//from w w w. j av a2 s . c o m builder.setMessage(R.string.upload_your_song); checkBox = (CheckBox) signInDialogView.findViewById(R.id.checkBox2); int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } check1 = false; check2 = false; check3 = false; // Log.d(AuthTag, "onCreateDialog " + check1 + " " + check2 + " " + check3); this.mGoogleApiClient = OrderActivity.getmGoogleApiClient(); mAuth = FirebaseAuth.getInstance(); selectFileButton = (Button) signInDialogView.findViewById(R.id.selectFileButton); selectFileButton.setOnClickListener(new customButtonClickListener()); signInButton = (SignInButton) signInDialogView.findViewById(R.id.sign_in_button); signInButton.setStyle(SignInButton.SIZE_WIDE, SignInButton.COLOR_AUTO); signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { signIn(); } }); builder.setPositiveButton(getString(R.string.next), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO upload song } }); builder.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); SpannableString ss = new SpannableString(getString(R.string.you_accepting_license_agreement)); ClickableSpan clickableSpan = new ClickableSpan() { @Override public void onClick(View textView) { Log.d(AuthTag, "click"); LicenseDialog licenseDialog = new LicenseDialog(); licenseDialog.show(getFragmentManager(), "Sing in dialog"); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(true); } }; ss.setSpan(clickableSpan, 14, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); TextView textView = (TextView) signInDialogView.findViewById(R.id.textView); textView.setText(ss); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setHighlightColor(Color.TRANSPARENT); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { check2 = isChecked; Log.d(AuthTag, "Checked: " + isChecked); buttonStatus(); } }); mStorageRef = FirebaseStorage.getInstance().getReference(); alert = builder.create(); return alert; }
From source file:com.landenlabs.all_devtool.ScreenFragment.java
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Checks the orientation of the screen if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Ui.viewById(m_layout, R.id.touch_pos).setVisibility(View.INVISIBLE); Ui.viewById(m_layout, R.id.grid_size).setVisibility(View.INVISIBLE); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { Ui.viewById(m_layout, R.id.touch_pos).setVisibility(View.VISIBLE); Ui.viewById(m_layout, R.id.grid_size).setVisibility(View.VISIBLE); }//from www.j av a 2s . co m updateView(); }