List of usage examples for android.app ActionBar DISPLAY_SHOW_HOME
int DISPLAY_SHOW_HOME
To view the source code for android.app ActionBar DISPLAY_SHOW_HOME.
Click Source Link
From source file:com.ape.filemanager.FileExplorerTabActivityOld.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_pager); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES); mIsMyOsOptionMenuStyle = getResources().getBoolean(R.bool.myos_option_menu_style); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category), FileCategoryActivityMyOS.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null); if (getResources().getBoolean(R.bool.have_cloud_file)) { mTabsAdapter.addTab(bar.newTab().setText(R.string.cloud_storage), CloudFileActivity.class, null); } else {/*from ww w . j a v a 2 s . c om*/ mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null); } int tabIndex; Intent intent = getIntent(); String action = intent.getAction(); if (getIntent().getData() != null) { tabIndex = Util.SDCARD_TAB_INDEX; } else if (!TextUtils.isEmpty(action)) { if (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT) || action.equals("com.mediatek.filemanager.ADD_FILE")) { tabIndex = Util.CATEGORY_TAB_INDEX; } else if (action.equals(CloudFileUtil.CLOUD_STORAGE_ACTION)) { tabIndex = Util.REMOTE_TAB_INDEX; } else { tabIndex = Util.CATEGORY_TAB_INDEX; } } else { tabIndex = Util.CATEGORY_TAB_INDEX; //For market require. // tabIndex = PreferenceManager.getDefaultSharedPreferences(this) // .getInt(INSTANCESTATE_TAB, Util.CATEGORY_TAB_INDEX); } bar.setSelectedNavigationItem(tabIndex); mMountPointManager = MountPointManager.getInstance(); mMountPointManager.init(this); }
From source file:com.stj.fileexplorer.FileExplorerTabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // add begin by xugaoming@20140317, don't need to restore // fragments automaticaly if killed by system for memory, // it will mess up the logic savedInstanceState = null;//ww w .j a v a 2 s. co m // add end super.onCreate(savedInstanceState); StorageHelper.getInstance(this); setContentView(R.layout.fragment_pager); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES); final ActionBar bar = getActionBar(); bar.hide(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME); mTabsAdapter = new TabsAdapter(this, mViewPager); // mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category), // FileCategoryActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null); FileViewActivity fileViewActivity = ((FileViewActivity) getFragment(Util.SDCARD_TAB_INDEX)); fileViewActivity.registBottomBtnPressListener(this); /*mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null);*/ int selectedItem = PreferenceManager.getDefaultSharedPreferences(this).getInt(INSTANCESTATE_TAB, Util.CATEGORY_TAB_INDEX); if (Intent.ACTION_PICK.equals(getIntent().getAction())) { selectedItem = Util.SDCARD_TAB_INDEX; } //add begin by xugaoming@20140517, add function to locate //to a directory Intent intent = getIntent(); if (intent != null && intent.getStringExtra("goto_dir") != null) { selectedItem = Util.SDCARD_TAB_INDEX; } //add end bar.setSelectedNavigationItem(0); }
From source file:com.xandy.calendar.event.EditEventActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.simple_frame_layout); mEventInfo = getEventInfoFromIntent(icicle); mReminders = getReminderEntriesFromIntent(); mEventColorInitialized = getIntent().hasExtra(EXTRA_EVENT_COLOR); mEventColor = getIntent().getIntExtra(EXTRA_EVENT_COLOR, -1); mEditFragment = (EditEventFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame); mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config); if (mIsMultipane) { getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); getActionBar().setTitle(mEventInfo.id == -1 ? R.string.event_create : R.string.event_edit); } else {// ww w.j a v a 2s .co m // getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, // ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME| // ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); } if (mEditFragment == null) { Intent intent = null; if (mEventInfo.id == -1) { intent = getIntent(); } mEditFragment = new EditEventFragment(mEventInfo, mReminders, mEventColorInitialized, mEventColor, false, intent); mEditFragment.mShowModifyDialogOnLaunch = getIntent() .getBooleanExtra(CalendarController.EVENT_EDIT_ON_LAUNCH, false); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.main_frame, mEditFragment); ft.show(mEditFragment); ft.commit(); } }
From source file:com.android.calendar.event.EditEventActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.simple_frame_layout); mEventInfo = getEventInfoFromIntent(icicle); mReminders = getReminderEntriesFromIntent(); mEventColorInitialized = getIntent().hasExtra(EXTRA_EVENT_COLOR); mEventColor = getIntent().getIntExtra(EXTRA_EVENT_COLOR, -1); mEditFragment = (EditEventFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame); mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config); if (mIsMultipane) { getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); getActionBar().setTitle(mEventInfo.id == -1 ? R.string.event_create : R.string.event_edit); } else {//from w w w .j a v a 2 s. co m getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); } if (mEditFragment == null) { Intent intent = null; boolean readOnly = false; if (mEventInfo.id == -1) { intent = getIntent(); readOnly = intent.getBooleanExtra(EXTRA_READ_ONLY, false); } mEditFragment = new EditEventFragment(mEventInfo, mReminders, mEventColorInitialized, mEventColor, readOnly, intent); mEditFragment.mShowModifyDialogOnLaunch = getIntent() .getBooleanExtra(CalendarController.EVENT_EDIT_ON_LAUNCH, false); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.main_frame, mEditFragment); ft.show(mEditFragment); ft.commit(); } }
From source file:com.example.android.donebar.DoneBarActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // BEGIN_INCLUDE (inflate_set_custom_view) // Inflate a "Done/Cancel" custom action bar view. final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext() .getSystemService(LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done_cancel, null); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override/*from ww w . jav a 2 s . c om*/ public void onClick(View v) { // "Done" int id = generateId(); EditText number = (EditText) findViewById(R.id.caller_phone_number); EditText information = (EditText) findViewById(R.id.caller_information); checkAvailability(id, number.getText().toString(), information.getText().toString()); finish(); } }); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // "Cancel" finish(); } }); // Show the custom action bar view and hide the normal Home icon and title. final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // END_INCLUDE (inflate_set_custom_view) setContentView(R.layout.activity_done_bar); }
From source file:io.oceanos.shaderbox.ShaderEditorActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final LayoutInflater inflater = getLayoutInflater(); final View customActionBarView = inflater.inflate(R.layout.actionbar_view_save, null); final View shaderActionView = customActionBarView.findViewById(R.id.actionbar_view); final View shaderActionSave = customActionBarView.findViewById(R.id.actionbar_save); shaderActionView.setOnClickListener(new View.OnClickListener() { @Override/*from w ww . j a v a2 s . com*/ public void onClick(View v) { if (result.isSuccess()) onView(shader); else { Toast errorMsg = Toast.makeText(getBaseContext(), result.getError(), Toast.LENGTH_LONG); errorMsg.getView().setBackgroundColor(getResources().getColor(R.color.editor_color_error)); errorMsg.show(); } } }); shaderActionSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onSave(shader); } }); fps = (TextView) customActionBarView.findViewById(R.id.text_fps); viewError = (TextView) shaderActionView.findViewById(R.id.viewError); final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); setContentView(R.layout.activity_editor); Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); ShaderDatabase database = new ShaderDatabase(getBaseContext()); if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); long id = database.newShader(); Cursor cursor = database.findById(id); if (cursor.moveToFirst()) shader = Shader.getValues(cursor); cursor.close(); if (sharedText != null) shader.setText(sharedText); else shader.setText(""); } } else { long id = intent.getLongExtra("ID", 0); Cursor cursor = database.findById(id); if (cursor.moveToFirst()) shader = Shader.getValues(cursor); cursor.close(); } database.close(); setSymbolListener(R.id.action_tab, '\t'); setSymbolListener(R.id.action_rpo, '('); setSymbolListener(R.id.action_rpc, ')'); setSymbolListener(R.id.action_cpo, '{'); setSymbolListener(R.id.action_cpc, '}'); setSymbolListener(R.id.action_dotcoma, ';'); setSymbolListener(R.id.action_coma, ','); setSymbolListener(R.id.action_dot, '.'); setSymbolListener(R.id.action_plus, '+'); setSymbolListener(R.id.action_minus, '-'); setSymbolListener(R.id.action_times, '*'); setSymbolListener(R.id.action_div, '/'); setSymbolListener(R.id.action_equal, '='); setSymbolListener(R.id.action_spo, '['); setSymbolListener(R.id.action_spc, ']'); setSymbolListener(R.id.action_and, '&'); setSymbolListener(R.id.action_or, '|'); setSymbolListener(R.id.action_greater, '>'); setSymbolListener(R.id.action_lesser, '<'); setSymbolListener(R.id.action_cardinal, '#'); final Handler uiHandler = new Handler(this); renderer = new ShaderRenderer(shader, uiHandler); shaderView = (ShaderGLView) findViewById(R.id.shader_view); shaderView.setRenderer(renderer); shaderView.setVRModeEnabled(false); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); int textSize = Integer.parseInt(prefs.getString("pref_editor_text_size", "14")); int opacity = Integer.parseInt(prefs.getString("pref_editor_opacity", "127")); editor = (ShaderEditor) findViewById(R.id.editor); editor.setTextSize(textSize); editor.setBackgroundColor(opacity << 24); editor.setHorizontallyScrolling(true); editor.setHorizontalScrollBarEnabled(true); editor.setText(shader.getText()); ScrollView scroll = (ScrollView) findViewById(R.id.scroll); editor.setScrollView(scroll); compileRT = prefs.getBoolean("pref_compile_rt", true); }
From source file:es.farfuteam.vncpp.controller.ActivityTabs.java
/** * @param savedInstanceState//from ww w.j av a 2 s . c o m * @brief This is the onCreate method * @details The onCreate method adds an actionBar to the activity with two tabs (recent and favorites). * It also load the preferences file into the prefs attribute and sets the rememeberExit attribute. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_host); final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME); final String recents = getString(R.string.recents); final String favorites = getString(R.string.favoritesTab); // add tabs Tab tab1 = actionBar.newTab().setText(recents) .setTabListener(new TabListener<ListFragmentTab>(this, "tab1", ListFragmentTab.class)); actionBar.addTab(tab1); Tab tab2 = actionBar.newTab().setText(favorites) .setTabListener(new TabListener<ListFragmentTabFav>(this, "tab2", ListFragmentTabFav.class)); actionBar.addTab(tab2); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //accedemos a fichero preferencias (Configuration.getInstance()).setPrefs(getSharedPreferences("PreferencesFile", Context.MODE_PRIVATE)); (Configuration.getInstance()).readPrefs(); // Orientation Change Occurred if (savedInstanceState != null) { int currentTabIndex = savedInstanceState.getInt("tab_index"); actionBar.setSelectedNavigationItem(currentTabIndex); } //nombre en la activity bar final String title = getString(R.string.connections); setTitle(title); }
From source file:fr.cph.stock.android.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.v(TAG, "MainActivity onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.main);// ww w .j a v a2 s . c o m Bundle b = getIntent().getExtras(); portfolio = b.getParcelable("portfolio"); ada = new MainListAdapter(this, portfolio); listView = (ListView) findViewById(R.id.mainList); listView.setAdapter(ada); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Intent intent; switch (position) { case 0: intent = new Intent(getBaseContext(), AccountActivity.class); intent.putExtra("portfolio", portfolio); startActivityForResult(intent, MainActivity.ACCOUNT_REQUEST); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; case 1: intent = new Intent(getBaseContext(), EquityActivity.class); intent.putExtra("portfolio", portfolio); startActivityForResult(intent, MainActivity.EQUITY_REQUEST); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; case 2: intent = new Intent(getBaseContext(), OverallActivity.class); intent.putExtra("portfolio", portfolio); startActivityForResult(intent, MainActivity.OVERALL_REQUEST); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; } } }); ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); errorView = (TextView) findViewById(R.id.errorMessage); errorView.setOnClickListener(new ErrorMainOnClickListener(listView, errorView)); EasyTracker.getInstance().setContext(this); // Set context EasyTracker.getInstance().setContext(getApplicationContext()); // Instantiate the Tracker tracker = EasyTracker.getTracker(); }
From source file:com.xandy.calendar.SearchActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); // This needs to be created before setContentView mController = CalendarController.getInstance(this); mHandler = new Handler(); mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config); mShowEventDetailsWithAgenda = Utils.getConfigBool(this, R.bool.show_event_details_with_agenda); setContentView(R.layout.search);/*from w w w .j av a 2 s . co m*/ setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); mContentResolver = getContentResolver(); if (mIsMultipane) { getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP); } else { getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME); } // Must be the first to register because this activity can modify the // list of event handlers in it's handle method. This affects who the // rest of the handlers the controller dispatches to are. mController.registerEventHandler(HANDLER_KEY, this); mDeleteEventHelper = new DeleteEventHelper(this, this, false /* don't exit when done */); long millis = 0; if (icicle != null) { // Returns 0 if key not found millis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME); if (DEBUG) { Log.v(TAG, "Restore value from icicle: " + millis); } } if (millis == 0) { // Didn't find a time in the bundle, look in intent or current time millis = Utils.timeFromIntentInMillis(getIntent()); } Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query; if (icicle != null && icicle.containsKey(BUNDLE_KEY_RESTORE_SEARCH_QUERY)) { query = icicle.getString(BUNDLE_KEY_RESTORE_SEARCH_QUERY); } else { query = intent.getStringExtra(SearchManager.QUERY); } if ("TARDIS".equalsIgnoreCase(query)) { Utils.tardis(); } initFragments(millis, query); } }
From source file:com.klinker.android.twitter.settings.configure_pages.ConfigurePagerActivity.java
public void setUpDoneDiscard() { LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext() .getSystemService(LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate(R.layout.actionbar_done_discard, null); TextView doneButton = (TextView) customActionBarView.findViewById(R.id.done); doneButton.setText(getResources().getString(R.string.done_label)); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() { @Override// w w w . ja v a2 s. c om public void onClick(View v) { int currentAccount = sharedPrefs.getInt("current_account", 1); SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putInt("account_" + currentAccount + "_page_1", PageOneFragment.type); editor.putInt("account_" + currentAccount + "_page_2", PageTwoFragment.type); editor.putLong("account_" + currentAccount + "_list_1_long", PageOneFragment.listId); editor.putLong("account_" + currentAccount + "_list_2_long", PageTwoFragment.listId); editor.putString("account_" + currentAccount + "_name_1", PageOneFragment.listName); editor.putString("account_" + currentAccount + "_name_2", PageTwoFragment.listName); editor.commit(); onBackPressed(); } }); customActionBarView.findViewById(R.id.actionbar_discard).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); // Show the custom action bar view and hide the normal Home icon and title. final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); }