Java Code Examples for android.support.v7.app.ActionBar#setDisplayHomeAsUpEnabled()
The following examples show how to use
android.support.v7.app.ActionBar#setDisplayHomeAsUpEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugActivity.java From Rumble with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings_debug); setTitle(R.string.settings_debug); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowHomeEnabled(false); CheckBox checkBox = (CheckBox)findViewById(R.id.debug_check_box); checkBox.setChecked(RumblePreferences.isLogcatDebugEnabled(this)); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { RumblePreferences.setLogcatDebugging(DebugActivity.this, isChecked); EventLogger.getInstance().init(); } }); }
Example 2
Source File: BaseActivity.java From SimpleNews with Apache License 2.0 | 6 votes |
@Override public void setContentView(int layoutResID) { super.setContentView(layoutResID); getTheme().applyStyle(PrefUtilities.getInstance().getFontStyle().getResId(), true); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getTitle()); if (!(this instanceof NewsActivity)) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowCustomEnabled(true); } } setLastColor(); }
Example 3
Source File: DetailActivity.java From KotlinMVPRxJava2Dagger2GreenDaoRetrofitDemo with Apache License 2.0 | 6 votes |
@Override protected void initView() { setSupportActionBar(toolbar_deitail); ActionBar supportActionBar = getSupportActionBar(); supportActionBar.setDisplayHomeAsUpEnabled(true); collapsingtoolbarlayout.setCollapsedTitleTextColor(Color.parseColor("#ffffff")); collapsingtoolbarlayout.setExpandedTitleColor(Color.parseColor("#00ffffff")); toolbar_deitail.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); alphaAnimation = ObjectAnimator.ofFloat(pb_detail, "alpha", 1.0f, 0f); alphaAnimation.setDuration(1000); alphaAnimation.setInterpolator(new DecelerateInterpolator()); webViewSetting(); floatingactionbutton_details.setOnClickListener(this); initAnimation(); }
Example 4
Source File: VideoDetailsActivity.java From HeroVideo-master with Apache License 2.0 | 6 votes |
@SuppressLint("SetTextI18n") @Override public void initToolbar() { mToolbar.setTitle(""); setSupportActionBar(mToolbar); ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); } //设置还没收缩时状态下字体颜色 mCollapsingToolbarLayout.setExpandedTitleColor(Color.TRANSPARENT); //设置收缩后Toolbar上字体的颜色 mCollapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE); mAvText.setText("av" + av); }
Example 5
Source File: MyElectricSettingsActivity.java From AndroidApp with GNU Affero General Public License v3.0 | 5 votes |
private void setUpToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(R.string.settings); actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 6
Source File: PaletteActivity.java From twoh-android-material-design with MIT License | 5 votes |
private void setupToolbar(){ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle("TWOH's Palette View Example"); }
Example 7
Source File: Mpdecision.java From Kernel-Tuner with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { preferences = PreferenceManager.getDefaultSharedPreferences(this); super.onCreate(savedInstanceState); setContentView(R.layout.mpdecision_new); mp_switch = (Switch) findViewById(R.id.mp_switch); swMpEnabled = (Switch)findViewById(R.id.swMpEnabled); idleSpinner = (Spinner) findViewById(R.id.bg); scroffSpinner = (Spinner) findViewById(R.id.spinner2); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); maxCpus = (EditText) findViewById(R.id.max_cpus); minCpus = (EditText) findViewById(R.id.min_cpus); thrIds = new int[]{R.id.one_cpu_hotplug, R.id.one_cpu_hotplug_time, R.id.two_cpus_hotplug, R.id.two_cpu_hotplug_time, R.id.two_cpus_unplug, R.id.two_cpu_unplug_time, R.id.three_cpus_hotplug, R.id.three_cpu_hotplug_time, R.id.three_cpus_unplug, R.id.three_cpu_unplug_time, R.id.four_cpus_unplug, R.id.four_cpu_unplug_time}; for (int i = 0; i < thrIds.length; i++) { thrTxt[i] = (EditText) findViewById(thrIds[i]); } etDelay = (EditText) findViewById(R.id.ed1); etPause = (EditText) findViewById(R.id.ed2); readMpdec(); }
Example 8
Source File: SmoothProgressBarActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TileView tileView = new TileView(this); // // Set the minimum parameters // tileView.setSize(6252, 4087); // tileView.addDetailLevel(1f, "big-world-map50.gif", "big-world-map.gif"); // tileView.addDetailLevel(0.1f, "big-world-map5.gif", "big-world-map.gif"); // setContentView(tileView); setTheme(R.style.LandingTheme); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.smooth_progress_bar_activity); ButterKnife.inject(this); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar, 300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.invisiablViewHandler, 0, smoothProgressBar, 2000); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar1, 2300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.invisiablViewHandler, 0, smoothProgressBar1, 4000); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar2, 4300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.invisiablViewHandler, 0, smoothProgressBar2, 6000); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar3, 6300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.invisiablViewHandler, 0, smoothProgressBar3, 8000); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar, 8300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar1, 8300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar2, 8300); HandlerUtils.sendMessageHandlerDelay(HandlerUtils.visiablViewHandler, 0, smoothProgressBar3, 8300); }
Example 9
Source File: SettingsActivity.java From pretixdroid with GNU General Public License v3.0 | 5 votes |
/** * Set up the {@link android.app.ActionBar}, if the API is available. */ private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 10
Source File: BudgetActivity.java From budget-watch with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.budget_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if(actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } _db = new DBHelper(this); }
Example 11
Source File: CreateNewTaskActivity.java From citrus with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_new_task); ButterKnife.bind(this); Toolbar toolbar = findById(this, R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); } mTaskNameEditText.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0); return true; } return false; } }); mUIThreadRealm = Realm.getDefaultInstance(); }
Example 12
Source File: DetailFragment.java From WanAndroid with Apache License 2.0 | 5 votes |
@Override public void initViews(View view) { toolbar = view.findViewById(R.id.toolBar); DetailActivity activity = (DetailActivity) getActivity(); activity.setSupportActionBar(toolbar); ActionBar actionBar = activity.getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); webViewContainer = view.findViewById(R.id.web_view_container); }
Example 13
Source File: SettingsActivity.java From ForPDA with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentThemeIsDark = App.get().isDarkTheme(); setTheme(currentThemeIsDark ? R.style.PreferenceAppThemeDark : R.style.PreferenceAppThemeLight); setContentView(R.layout.activity_settings); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(R.string.activity_title_settings); } PreferenceFragmentCompat fragment = null; Intent intent = getIntent(); if (intent != null) { String settingsArgument = intent.getStringExtra(ARG_NEW_PREFERENCE_SCREEN); if (settingsArgument != null) { if (settingsArgument.equals(NotificationsSettingsFragment.PREFERENCE_SCREEN_NAME)) { fragment = new NotificationsSettingsFragment(); } } } if (fragment == null) { fragment = new SettingsFragment(); } getSupportFragmentManager().beginTransaction().replace(R.id.fragment_content, fragment).commit(); /*View view = findViewById(R.id.fragment_content); view.setBackgroundColor(Color.TRANSPARENT); view.setBackgroundColor(Color.rgb(4, 26, 55));*/ App.get().addPreferenceChangeObserver(appThemeChangeObserver); }
Example 14
Source File: SettingsActivity.java From journaldev with MIT License | 5 votes |
/** * Set up the {@link android.app.ActionBar}, if the API is available. */ private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 15
Source File: BaseActivity.java From trust-wallet-android-source with GNU General Public License v3.0 | 4 votes |
protected void enableDisplayHomeAsUp() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 16
Source File: BaseNowplayingFragment.java From Muzesto with GNU General Public License v3.0 | 4 votes |
public void setSongDetails(View view) { albumart = (ImageView) view.findViewById(R.id.album_art); shuffle = (ImageView) view.findViewById(R.id.shuffle); repeat = (ImageView) view.findViewById(R.id.repeat); next = (MaterialIconView) view.findViewById(R.id.next); previous = (MaterialIconView) view.findViewById(R.id.previous); fabNext = (FloatingActionButton) view.findViewById(R.id.next_fab); fabPrevious = (FloatingActionButton) view.findViewById(R.id.previous_fab); mPlayPause = (PlayPauseButton) view.findViewById(R.id.playpause); playPauseFloating = (FloatingActionButton) view.findViewById(R.id.playpausefloating); playPauseWrapper = view.findViewById(R.id.playpausewrapper); songtitle = (TextView) view.findViewById(R.id.song_title); songtitle.setSelected(true); songalbum = (TextView) view.findViewById(R.id.song_album); songartist = (TextView) view.findViewById(R.id.song_artist); songduration = (TextView) view.findViewById(R.id.song_duration); elapsedtime = (TextView) view.findViewById(R.id.song_elapsed_time); timelyView11 = (TimelyView) view.findViewById(R.id.timelyView11); timelyView12 = (TimelyView) view.findViewById(R.id.timelyView12); timelyView13 = (TimelyView) view.findViewById(R.id.timelyView13); timelyView14 = (TimelyView) view.findViewById(R.id.timelyView14); timelyView15 = (TimelyView) view.findViewById(R.id.timelyView15); hourColon = (TextView) view.findViewById(R.id.hour_colon); mProgress = (SeekBar) view.findViewById(R.id.song_progress); mCircularProgress = (CircularSeekBar) view.findViewById(R.id.song_progress_circular); recyclerView = (RecyclerView) view.findViewById(R.id.queue_recyclerview); Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); if (toolbar != null) { ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar(); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(""); } if (mPlayPause != null && getActivity() != null) { mPlayPause.setColor(ContextCompat.getColor(getContext(), android.R.color.white)); } if (playPauseFloating != null) { playPauseDrawable.setColorFilter(TimberUtils.getBlackWhiteColor(accentColor), PorterDuff.Mode.MULTIPLY); playPauseFloating.setImageDrawable(playPauseDrawable); if (MusicPlayer.isPlaying()) playPauseDrawable.transformToPause(false); else playPauseDrawable.transformToPlay(false); } if (mCircularProgress != null) { mCircularProgress.setCircleProgressColor(ContextCompat.getColor(getActivity(), R.color.colorAccent)); mCircularProgress.setPointerColor(ContextCompat.getColor(getActivity(), R.color.colorAccent)); mCircularProgress.setPointerHaloColor(ContextCompat.getColor(getActivity(), R.color.colorAccent)); } if (timelyView11 != null) { String time = TimberUtils.makeShortTimeString(getActivity(), MusicPlayer.position() / 1000); if (time.length() < 5) { timelyView11.setVisibility(View.GONE); timelyView12.setVisibility(View.GONE); hourColon.setVisibility(View.GONE); changeDigit(timelyView13, time.charAt(0) - '0'); changeDigit(timelyView14, time.charAt(2) - '0'); changeDigit(timelyView15, time.charAt(3) - '0'); } else if (time.length() == 5) { timelyView12.setVisibility(View.VISIBLE); changeDigit(timelyView12, time.charAt(0) - '0'); changeDigit(timelyView13, time.charAt(1) - '0'); changeDigit(timelyView14, time.charAt(3) - '0'); changeDigit(timelyView15, time.charAt(4) - '0'); } else { timelyView11.setVisibility(View.VISIBLE); hourColon.setVisibility(View.VISIBLE); changeDigit(timelyView11, time.charAt(0) - '0'); changeDigit(timelyView12, time.charAt(2) - '0'); changeDigit(timelyView13, time.charAt(3) - '0'); changeDigit(timelyView14, time.charAt(5) - '0'); changeDigit(timelyView15, time.charAt(6) - '0'); } } setSongDetails(); }
Example 17
Source File: MapDownloadActivity.java From satstat with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { Bundle state = savedInstanceState; if (state == null) state = this.getIntent().getBundleExtra(Const.KEY_SAVED_INSTANCE_STATE); super.onCreate(state); if (state != null) { manager = (DownloadTreeStateManager) state.getSerializable(STATE_KEY_TREE_MANAGER); } if (manager == null) manager = new DownloadTreeStateManager(); builder = new TreeBuilder<RemoteFile>(manager); setContentView(R.layout.activity_map_download); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); downloadProgress = (ProgressBar) findViewById(R.id.downloadProgress); downloadErrorLayout = (LinearLayout) findViewById(R.id.downloadErrorLayout); downloadRetry = (Button) findViewById(R.id.downloadRetry); treeView = (TreeViewList) findViewById(R.id.downloadList); /* * FIXME: Android wants the number of distinct layouts, which here is the same as the number of * levels and in theory unlimited. Using more levels than specified here will cause exceptions which * are beyond our control (only system functions in the call stack) and semi-random (creating more * levels than specified will work initially but the code will barf sometime later, e.g. on scroll). * * The maximum number of levels is currently 4 (multilingual/continent/country/region.map), * therefore 5 is safe even if another one level is added. However, if the layout on the server ever * changes and goes beyond that, we'll get semi-random crashes. */ treeViewAdapter = new DownloadTreeViewAdapter(this, manager, 5); treeView.setAdapter(treeViewAdapter); treeView.setCollapsible(true); treeView.setCollapsedDrawable(getResources().getDrawable(R.drawable.ic_expand_more)); treeView.setExpandedDrawable(getResources().getDrawable(R.drawable.ic_expand_less)); treeView.setIndentWidth(24); downloadErrorLayout.setVisibility(View.GONE); OnClickListener clis = new OnClickListener () { @Override public void onClick(View v) { if (v == downloadRetry) { treeView.setVisibility(View.GONE); downloadErrorLayout.setVisibility(View.GONE); downloadProgress.setVisibility(View.VISIBLE); // get data from server dirListTask = new RemoteDirListTask(MapDownloadActivity.this, null); dirListTask.execute(MAP_DOWNLOAD_BASE_URL); } } }; downloadRetry.setOnClickListener(clis); List<RemoteFile> topItems = manager.getChildren(null); if ((topItems == null) || (topItems.size() == 0)) { treeView.setVisibility(View.GONE); downloadProgress.setVisibility(View.VISIBLE); // get data from server dirListTask = new RemoteDirListTask(this, null); dirListTask.execute(MAP_DOWNLOAD_BASE_URL); } treeViewAdapter.registerIntentReceiver(); }
Example 18
Source File: PrinterListActivity.java From octoandroid with GNU General Public License v3.0 | 4 votes |
private void setUpArrow(ActionBar actionBar) { if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } }
Example 19
Source File: MovieDetailActivity.java From Movies-Android-Kata with Apache License 2.0 | 4 votes |
private void showUpButtonInActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
Example 20
Source File: UserDetailsActivity.java From githot with Apache License 2.0 | 4 votes |
private void initView() { Toolbar mToolbar = (Toolbar) findViewById(R.id.id_user_details_toobar); setSupportActionBar(mToolbar); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setHomeAsUpIndicator(R.mipmap.ic_back_arrow); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(mCurrentUser); } mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.id_hot_repos_swipe_refresh_layout); //设置卷内的颜色 mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mData.clear(); mAdapter.notifyDataSetChanged(); fetchData(mCurrentUser); } }); mAdapter = new UserDetailsListAdapterHolder(this, mData); mRecyclerView = (RecyclerView) findViewById(R.id.id_activity_user_details); mRecyclerView.setAdapter(mAdapter); mLinearLayoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(mLinearLayoutManager); float paddingStart = getResources().getDimension(R.dimen.repos_hot_divider_padding_start); mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST, paddingStart, false)); mAdapter.setOnItemClickListener(new UserDetailsListAdapterHolder.OnItemClickListener() { @Override public void onItemClick(View view, int position) { L.i("====="); Intent intent = new Intent(); intent.setClass(UserDetailsActivity.this, ReposDetailsActivity.class); intent.putExtra("repos_data", mData.get(position)); startActivity(intent); } }); }