List of usage examples for android.content.pm ActivityInfo UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW
int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW
To view the source code for android.content.pm ActivityInfo UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.
Click Source Link
From source file:com.kdclient.ui.BaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock_Light); super.onCreate(savedInstanceState); mSherlock.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:android.support.v7.app.ActionBarActivityDelegateICS.java
@Override public void onCreate(Bundle savedInstanceState) { // Set framework uiOptions from the support metadata value if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) { mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }// w ww. ja v a 2 s . c om super.onCreate(savedInstanceState); if (mHasActionBar) { // If action bar is requested by inheriting from the appcompat theme, // the system will not know about that. So explicitly request for an action bar. mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); } if (mOverlayActionBar) { mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); } /* * This goofy move needs some explanation. * * The verifier on older platform versions has some interesting side effects if * a class defines a method that takes a parameter of a type that doesn't exist. * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity * cannot override the onActionModeStarted/Finished methods without causing nastiness * when it is loaded on older platform versions. * * Since these methods are actually part of the window callback and not intrinsic to * Activity itself, we can install a little shim with the window instead that knows * about the ActionMode class. Note that this means that any new methods added to * Window.Callback in the future won't get proxied without updating the support lib, * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;) */ final Window w = mActivity.getWindow(); w.setCallback(createWindowCallbackWrapper(w.getCallback())); }
From source file:us.shandian.blacklight.ui.directmessage.DirectMessageConversationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (hasSmartBar()) { getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }// w w w .j a va 2s .co m super.onCreate(savedInstanceState); setContentView(R.layout.direct_message_conversation); // Argument mUser = getIntent().getParcelableExtra("user"); getActionBar().setTitle(mUser.getName()); // View mSwipeRefresh = (SwipeUpAndDownRefreshLayout) findViewById(R.id.direct_message_refresh); mSwipeRefresh.setOnRefreshListener(this); mSwipeRefresh.setDownHasPriority(); mSwipeRefresh.setColorScheme(R.color.ptr_green, R.color.ptr_orange, R.color.ptr_red, R.color.ptr_blue); mList = (ListView) findViewById(R.id.direct_message_conversation); mText = (EditText) findViewById(R.id.direct_message_send_text); mSend = (ImageView) findViewById(R.id.direct_message_send); mList.setStackFromBottom(true); mAdapter = new DirectMessageAdapter(this, mMsgList, mUser.id); mList.setAdapter(mAdapter); mSend.setOnClickListener(this); // Emoticon Picker mEmoticons = new EmoticonFragment(); mEmoticons.setEmoticonListener(new EmoticonFragment.EmoticonListener() { @Override public void onEmoticonSelected(String name) { if (!mRefreshing) { mText.getText().append(name); } } }); getFragmentManager().beginTransaction().replace(R.id.direct_message_emoticons, mEmoticons).commit(); new Refresher().execute(true); }
From source file:us.shandian.blacklight.ui.statuses.SingleActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); super.onCreate(savedInstanceState); setContentView(R.layout.single);// ww w .jav a 2 s .co m // Arguments mMsg = getIntent().getParcelableExtra("msg"); mFavourited = mMsg.favorited; if (mMsg.user != null && mMsg.user.id != null) { mIsMine = new LoginApiCache(this).getUid().equals(mMsg.user.id); } // Init mRoot = (SlidingUpPanelLayout) findViewById(R.id.single_root); mContent = findViewById(R.id.single_content); mMsgFragment = new HackyFragment(); mCommentFragment = new StatusCommentFragment(mMsg.id); mRepostFragment = new RepostTimeLineFragment(mMsg.id); getFragmentManager().beginTransaction().replace(R.id.single_content, mMsgFragment).commit(); mPager = (ViewPager) findViewById(R.id.single_pager); mPager.setAdapter(new FragmentStatePagerAdapter(getFragmentManager()) { @Override public int getCount() { return 2; } @Override public Fragment getItem(int position) { switch (position) { case 0: return mCommentFragment; case 1: return mRepostFragment; default: return null; } } }); mCollapse = (ImageView) mRoot.findViewById(R.id.iv_collapse); mRoot.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { @Override public void onPanelSlide(View panel, float slideOffset) { Utility.setActionBarTranslation(SingleActivity.this, mRoot.getCurrentParalaxOffset()); } @Override public void onPanelCollapsed(View panel) { mCollapse.setRotation(180); Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_180); mCollapse.startAnimation(animation); } @Override public void onPanelExpanded(View panel) { mCollapse.setRotation(0); Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_180); mCollapse.startAnimation(animation); } @Override public void onPanelAnchored(View panel) { } }); mTabs = (TabHost) findViewById(R.id.single_tabs); mTabs.setup(); final String comment = getResources().getString(R.string.comment); TabHost.TabSpec tab1 = mTabs.newTabSpec(comment); tab1.setIndicator(comment); tab1.setContent(android.R.id.tabcontent); mTabs.addTab(tab1); final String repost = getResources().getString(R.string.retweet); TabHost.TabSpec tab2 = mTabs.newTabSpec(repost); tab2.setIndicator(repost); tab2.setContent(android.R.id.tabcontent); mTabs.addTab(tab2); mTabs.setCurrentTab(0); Utility.initDarkTabHost(this, mTabs); // Connect the TabHost with the ViewPager mTabs.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String id) { if (id.equals(comment)) { mPager.setCurrentItem(0); } else if (id.equals(repost)) { mPager.setCurrentItem(1); } } }); mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positonOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { mTabs.setCurrentTab(position); } @Override public void onPageScrollStateChanged(int state) { } }); }
From source file:us.shandian.blacklight.ui.statuses.NewPostActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); super.onCreate(savedInstanceState); setContentView(R.layout.post_status); mLoginCache = new LoginApiCache(this); mUserCache = new UserApiCache(this); new GetNameTask().execute(); // Init/*from w w w . ja va 2 s. c o m*/ mText = (EditText) findViewById(R.id.post_edit); mBackground = (ImageView) findViewById(R.id.post_back); mCount = (TextView) findViewById(R.id.post_count); mDrawer = (DrawerLayout) findViewById(R.id.post_drawer); // Fragments mEmoticonFragment = new EmoticonFragment(); mColorPickerFragment = new ColorPickerFragment(); getFragmentManager().beginTransaction().replace(R.id.post_emoticons, mEmoticonFragment).commit(); // Filter try { TypedArray array = getTheme().obtainStyledAttributes(R.styleable.BlackLight); mFilter = array.getColor(R.styleable.BlackLight_NewPostImgFilter, 0); array.recycle(); } catch (Exception e) { mFilter = 0; } // Listeners mEmoticonFragment.setEmoticonListener(new EmoticonFragment.EmoticonListener() { @Override public void onEmoticonSelected(String name) { mText.getText().insert(mText.getSelectionStart(), name); } }); mColorPickerFragment.setOnColorSelectedListener(new ColorPickerFragment.OnColorSelectedListener() { @Override public void onSelected(String hex) { int sel = mText.getSelectionStart(); mText.getText().insert(sel, "[" + hex + " [d"); mText.setSelection(sel + 9); } }); mText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { // How many Chinese characters (1 Chinses character = 2 English characters) try { int length = Utility.lengthOfString(s.toString()); if (DEBUG) { Log.d(TAG, "Text length = " + length); } if (length <= 140 && !s.toString().contains("\n")) { mCount.setTextColor(getResources().getColor(R.color.gray)); mCount.setText(String.valueOf(140 - length)); mIsLong = false; } else if (!(NewPostActivity.this instanceof RepostActivity) && !(NewPostActivity.this instanceof CommentOnActivity) && !(NewPostActivity.this instanceof ReplyToActivity)) { mCount.setText(getResources().getString(R.string.long_post)); mIsLong = true; } else { mCount.setTextColor(getResources().getColor(android.R.color.holo_red_light)); mCount.setText(String.valueOf(140 - length)); mIsLong = false; } } catch (Exception e) { } if (mEmoticonMenu != null) { if (mIsLong) { getFragmentManager().beginTransaction().replace(R.id.post_emoticons, mColorPickerFragment) .commit(); mEmoticonMenu.setIcon(R.drawable.ic_action_edit); mEmoticonMenu.setTitle(R.string.color); } else { getFragmentManager().beginTransaction().replace(R.id.post_emoticons, mEmoticonFragment) .commit(); mEmoticonMenu.setIcon(R.drawable.ic_action_emoticon); mEmoticonMenu.setTitle(R.string.emoticon); } } } }); // Handle share intent Intent i = getIntent(); if (i != null && i.getType() != null) { if (i.getType().indexOf("text/plain") != -1) { mText.setText(i.getStringExtra(Intent.EXTRA_TEXT)); } else if (i.getType().indexOf("image/") != -1) { Uri uri = (Uri) i.getParcelableExtra(Intent.EXTRA_STREAM); try { Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); setPicture(bitmap); } catch (IOException e) { if (DEBUG) { Log.d(TAG, Log.getStackTraceString(e)); } } } } }
From source file:ela.riskey.parammod.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSherlock.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); mSherlock.setContentView(R.layout.listview_main); AdView adView = (AdView) findViewById(R.id.adview); adView.loadAd(new AdRequest()); // Buat Folder createDirIfNotExists();//www . ja v a 2 s .c om SharedPreferences prefs = this.getSharedPreferences("paramprefs", Context.MODE_PRIVATE); Global.partisi = prefs.getString("partisi", null); }
From source file:us.shandian.blacklight.ui.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (hasSmartBar()) { getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }//from w w w . ja v a 2 s . c om Utility.initDarkMode(this); super.onCreate(savedInstanceState); setContentView(R.layout.main); // Tint Utility.enableTint(this); // Detect if the user chose to use right-handed mode boolean rightHanded = Settings.getInstance(this).getBoolean(Settings.RIGHT_HANDED, false); mDrawerGravity = rightHanded ? Gravity.RIGHT : Gravity.LEFT; // Set gravity View nav = findViewById(R.id.nav); DrawerLayout.LayoutParams p = (DrawerLayout.LayoutParams) nav.getLayoutParams(); p.gravity = mDrawerGravity; nav.setLayoutParams(p); // Initialize naviagtion drawer mDrawer = (DrawerLayout) findViewById(R.id.drawer); mToggle = new ActionBarDrawerToggle(this, mDrawer, R.drawable.ic_drawer_l, 0, 0) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); getActionBar().show(); invalidateOptionsMenu(); if (mLastChoice == null) { mLastChoice = (TextView) mMy.getChildAt(0); mLastChoice.getPaint().setFakeBoldText(true); mLastChoice.invalidate(); } ((HomeTimeLineFragment) mFragments[0]).hideFAB(); } @Override public void onDrawerClosed(View drawerView) { invalidateOptionsMenu(); if (mNext == 0) { ((HomeTimeLineFragment) mFragments[0]).showFAB(); } } }; mDrawer.setDrawerListener(mToggle); if (mDrawerGravity == Gravity.LEFT) { mDrawer.setDrawerShadow(R.drawable.drawer_shadow, Gravity.LEFT); } mMy = (ListView) findViewById(R.id.list_my); mAtMe = (ListView) findViewById(R.id.list_at_me); mOther = (ListView) findViewById(R.id.list_other); mMy.setVerticalScrollBarEnabled(false); mMy.setChoiceMode(ListView.CHOICE_MODE_NONE); mAtMe.setVerticalScrollBarEnabled(false); mAtMe.setChoiceMode(ListView.CHOICE_MODE_NONE); mOther.setVerticalScrollBarEnabled(false); mOther.setChoiceMode(ListView.CHOICE_MODE_NONE); mMy.setOnItemClickListener(this); mAtMe.setOnItemClickListener(this); mOther.setOnItemClickListener(this); // My account mName = (TextView) findViewById(R.id.my_name); mName.getPaint().setFakeBoldText(true); mAvatar = (ImageView) findViewById(R.id.my_avatar); mLoginCache = new LoginApiCache(this); mUserCache = new UserApiCache(this); initList(); new InitializerTask().execute(); new GroupsTask().execute(); findViewById(R.id.my_account).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mUser != null) { Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.setClass(MainActivity.this, UserTimeLineActivity.class); i.putExtra("user", mUser); startActivity(i); } } }); // Initialize ActionBar Style getActionBar().setHomeButtonEnabled(true); // Ignore first spinner event mIgnore = true; // Fragments mFragments[0] = new HomeTimeLineFragment(); mFragments[1] = new CommentTimeLineFragment(); mFragments[2] = new FavListFragment(); mFragments[3] = new DirectMessageUserFragment(); mFragments[4] = new MentionsTimeLineFragment(); mFragments[5] = new CommentMentionsTimeLineFragment(); mFragments[6] = new SearchFragment(); mManager = getFragmentManager(); FragmentTransaction ft = mManager.beginTransaction(); for (Fragment f : mFragments) { ft.add(R.id.container, f); ft.hide(f); } ft.commit(); switchTo(0); }
From source file:de.vanita5.twittnuker.activity.support.LinkHandlerActivity.java
private void setUiOptions(final Window window, final Uri data) { if (FlymeUtils.hasSmartBar()) { window.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); } else {/*w w w . ja va 2s . c om*/ window.setUiOptions(0); } }
From source file:nl.mpcjanssen.simpletask.TodoApplication.java
public void setActionBarStyle(@NotNull Window window) { if (getPrefs().getBoolean(getString(R.string.split_actionbar_key), true)) { window.setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }/* w w w . j a v a 2 s . c o m*/ }
From source file:com.android.settings.Settings.java
@Override public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) { Intent intent = super.onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes); // Some fragments want split ActionBar; these should stay in sync with // uiOptions for fragments also defined as activities in manifest. if (WifiSettings.class.getName().equals(fragmentName) || WifiP2pSettings.class.getName().equals(fragmentName) || BluetoothSettings.class.getName().equals(fragmentName) || DreamSettings.class.getName().equals(fragmentName) || LocationSettings.class.getName().equals(fragmentName) || ToggleAccessibilityServicePreferenceFragment.class.getName().equals(fragmentName) || PrintSettingsFragment.class.getName().equals(fragmentName) || PrintServiceSettingsFragment.class.getName().equals(fragmentName)) { intent.putExtra(EXTRA_UI_OPTIONS, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); }//from ww w . jav a 2 s .c o m if (DataUsageSummary.class.getName().equals(fragmentName)) { intent.setClass(this, DataUsageSummaryActivity.class); } else { intent.setClass(this, SubSettings.class); } return intent; }