Java Code Examples for android.app.ActionBar#setDisplayShowTitleEnabled()

The following examples show how to use android.app.ActionBar#setDisplayShowTitleEnabled() . 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: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	// setup action bar for tabs
	ActionBar actionBar = getActionBar();
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
	actionBar.setDisplayShowTitleEnabled(false);

	Tab tab = actionBar
			.newTab()
			.setText("First tab")
			.setTabListener(
					new MyTabListener<DetailFragment>(this, "artist",
							DetailFragment.class));
	actionBar.addTab(tab);

	tab = actionBar
			.newTab()
			.setText("Second Tab")
			.setTabListener(
					new MyTabListener<ImageFragment>(this, "album",
							ImageFragment.class));
	actionBar.addTab(tab);

}
 
Example 2
Source File: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if(savedInstanceState != null) {
        if (savedInstanceState.getInt("theme", -1) != -1) {
          mThemeId = savedInstanceState.getInt("theme");
          this.setTheme(mThemeId);
        }
        mTitlesHidden = savedInstanceState.getBoolean("titlesHidden");
    }

    setContentView(R.layout.main);

    ActionBar bar = getActionBar();
    bar.setDisplayShowTitleEnabled(false);

    ContentFragment frag = (ContentFragment) getFragmentManager()
            .findFragmentById(R.id.content_frag);
    if (frag != null) mDualFragments = true;
    
    if (mTitlesHidden) {
        getFragmentManager().beginTransaction()
                .hide(getFragmentManager().findFragmentById(R.id.titles_frag)).commit();
    }
}
 
Example 3
Source File: PreferencesActivity.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setTitle(R.string.preferences);
		
		ActionBar actionBar = getActionBar();
		actionBar.setDisplayShowTitleEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setHomeButtonEnabled(true);
		actionBar.setLogo(this.getResources().getDrawable(R.drawable.ic_action_up));
		actionBar.setDisplayUseLogoEnabled(true);
		
		addPreferencesFromResource(R.xml.preferences);
		
//		lockScreenMode = (ListPreference) findPreference(Preferences.Keys.LOCK_SCREEN_MODE);
//		updateSummaryWithChoice(lockScreenMode, lockScreenMode.getValue(), getResources().getStringArray(R.array.lockScreenOptions_));

		language = (ListPreference) findPreference(Preferences.Keys.LANGUAGE);
		updateSummaryWithChoice(language, language.getValue(), getResources().getStringArray(R.array.languages_));
		
		//originalImage = (ListPreference) findPreference(Models.IUser.ASSET_ENCRYPTION);
		//updateSummaryWithChoice(originalImage, originalImage.getValue(), getResources().getStringArray(R.array.originalImageOptions_));

		panicAction = (ListPreference) findPreference(Preferences.Keys.PANIC_ACTION);
		updateSummaryWithChoice(panicAction, panicAction.getValue(), getResources().getStringArray(R.array.panicActionOptions_));
	}
 
Example 4
Source File: HelpActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      popup(this);
      mPager = new ViewPager(this);
      mPager.setId(R.id.pager);
      setContentView(mPager);
      
      // Set up our ActionBar
      final ActionBar mAB = getActionBar();
      if (null != mAB) {
          // Create a Spannable for a custom font face in the title.
          SpannableString title = new SpannableString(getString(R.string.welcome_to));
          title.setSpan(new TypefaceSpan(this, "TimeBurner_Regular.ttf"), 0, title.length(),
                  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

          mAB.setTitle(title);
          mAB.setDisplayShowTitleEnabled(true);
          mAB.setDisplayHomeAsUpEnabled(true);
      }

// Set our Adapter for the Pager.
      mAdapter = new HelpFragmentAdapter(this);
      mPager.setAdapter(mAdapter);
      
      // We have to add the listener here, because CirclePageIndicator
      // uses the default listener to know when to change state.
      mPager.setOnPageChangeListener(this);
      
      // Save the last/ current item.
      if (savedInstanceState != null && savedInstanceState.containsKey(KEY_POSITION)) {
      	mPager.setCurrentItem(savedInstanceState.getInt(KEY_POSITION));
      }
  }
 
Example 5
Source File: ConfigurationActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public static void setupActionBar(Activity activity) {

        // Tint the status bar, if available.
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

        ActionBar actionBar = activity.getActionBar();
        if (null != actionBar) {
            actionBar.setIcon(DateUtils.AppIcon());
            actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }
 
Example 6
Source File: NavigationDrawerFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 7
Source File: GalleryFragment.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	super.onCreateOptionsMenu(menu, inflater);
	inflater.inflate(R.menu.activity_home_gallery, menu);

	MenuItem menuFilter = menu.findItem(R.id.menu_filter);
	Spinner spinner = (Spinner) menuFilter.getActionView();
	GalleryFilterAdapter spinnerAdapter = new GalleryFilterAdapter(spinner.getContext(), this.getResources().getTextArray(R.array.filter_options));
	spinner.setAdapter(spinnerAdapter);
	spinner.setOnItemSelectedListener(this);
	
	mMenuItemBatchOperations = menu.findItem(R.id.menu_select);
	
	miDropbox = menu.findItem(R.id.menu_remote_access_dropbox);
	DropboxSyncManager dsm = DropboxSyncManager.getInstance(a);
	if (dsm != null && dsm.isSyncing())
		miDropbox.setChecked(true);
	
	ActionBar actionBar = getActivity().getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.home_gallery_title);
	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(false);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setLogo(this.getResources().getDrawable(
			R.drawable.ic_action_up));
	actionBar.setDisplayUseLogoEnabled(true);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
Example 8
Source File: NavigationDrawerFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 9
Source File: HomeActivity.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
private void resetActionBar()
{
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.app_name);
	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(false);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setIcon(R.mipmap.ic_launcher);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
Example 10
Source File: UserDetailedInfoActivity.java    From weixin with Apache License 2.0 5 votes vote down vote up
private void initView() {
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayShowHomeEnabled(false);
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.text_menu_userDetailedInfo_title);
	setOverflowShowingAlways();

	mIv_userPhoto = (ImageView) findViewById(R.id.cgt_iv_userDetailedInfo_userPhoto);
	mTv_userName = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_userName);
	mIv_userSex = (ImageView) findViewById(R.id.cgt_iv_userDetailedInfo_userSex);
	mTv_userWeixin = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_userWeixin);
	mTv_nickName = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_nickname);
	mTv_area = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_area);
	mTv_personalizedSignature = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_personalizedSignature);
	mLl_personalPhoto_box = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_personalPhoto_box);
	mLl_personalPhoto = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_personalPhoto);
	mLl_socialInfo_box = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_socialInfo_box);
	mLl_socialInfo = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_socialInfo);
	mBtn_sendMsg = (Button) findViewById(R.id.cgt_btn_userDetailedInfo_sendMsg);
	mBtn_videoChat = (Button) findViewById(R.id.cgt_btn_userDetailedInfo_videoChat);

	mIv_userPhoto.setOnClickListener(this);
	mLl_personalPhoto_box.setOnClickListener(this);
	mLl_socialInfo_box.setOnClickListener(this);
	mBtn_sendMsg.setOnClickListener(this);
	mBtn_videoChat.setOnClickListener(this);
}
 
Example 11
Source File: NavigationDrawerFragment.java    From MultiSlider with Apache License 2.0 5 votes vote down vote up
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 12
Source File: HelpActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      popup(this);
      mPager = new ViewPager(this);
      mPager.setId(R.id.pager);
      setContentView(mPager);
      
      // Set up our ActionBar
      final ActionBar mAB = getActionBar();
      if (null != mAB) {
          // Create a Spannable for a custom font face in the title.
          SpannableString title = new SpannableString(getString(R.string.welcome_to));
          title.setSpan(new TypefaceSpan(this, "TimeBurner_Regular.ttf"), 0, title.length(),
                  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

          mAB.setTitle(title);
          mAB.setDisplayShowTitleEnabled(true);
          mAB.setDisplayHomeAsUpEnabled(true);
      }

// Set our Adapter for the Pager.
      mAdapter = new HelpFragmentAdapter(this);
      mPager.setAdapter(mAdapter);
      
      // We have to add the listener here, because CirclePageIndicator
      // uses the default listener to know when to change state.
      mPager.setOnPageChangeListener(this);
      
      // Save the last/ current item.
      if (savedInstanceState != null && savedInstanceState.containsKey(KEY_POSITION)) {
      	mPager.setCurrentItem(savedInstanceState.getInt(KEY_POSITION));
      }
  }
 
Example 13
Source File: MainActivity.java    From kylewbanks.com-AndroidApp with The Unlicense 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Customize the action bar
    ActionBar actionBar = getActionBar();
    if(actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);

        LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflater.inflate(R.layout.header, null);

        Typeface scriptFont = Typeface.createFromAsset(getAssets(), "fonts/script.ttf");
        TextView title = (TextView) v.findViewById(R.id.title);
        title.setTypeface(scriptFont);

        actionBar.setCustomView(v);
    }

    //Initialize Views
    postListView = (AnimatedListView) findViewById(R.id.post_list);
    postListView.setOnItemClickListener(postItemSelectedListener);


    progressBar = (ProgressBar) findViewById(R.id.loader);

    //Register as a Post List update listener
    KWBApplication application = (KWBApplication) getApplication();
    application.registerPostUpdateListener(this);
}
 
Example 14
Source File: FullScreenImageViewerActivity.java    From FreezeYou with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    ThemeUtils.processSetTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fsiva_main);
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    Intent intent = getIntent();
    if (intent != null) {
        ImageView fsiva_main_imageView = findViewById(R.id.fsiva_main_imageView);
        fsiva_main_imageView.setImageBitmap(
                BitmapFactory.decodeFile(intent.getStringExtra("imgPath"))
        );
        fsiva_main_imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    } else {
        finish();
    }

}
 
Example 15
Source File: MainActivity.java    From chromium-webview-samples with Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 16
Source File: ChartActivity.java    From AndrOBD with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
	                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

	// keep main display on?
	if(MainActivity.prefs.getBoolean("keep_screen_on", false))
	{
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	}

	// prevent activity from falling asleep
	PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
	wakeLock = Objects.requireNonNull(powerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
		getString(R.string.app_name));
	wakeLock.acquire();

	// set up action bar
	ActionBar actionBar = getActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayShowTitleEnabled(true);
	}

	setTitle(R.string.chart);

	/* get PIDs to be shown */
	int positions[] = getIntent().getIntArrayExtra(POSITIONS);

	// set up overall chart properties
	sensorData = new XYMultipleSeriesDataset();
	renderer = new XYMultipleSeriesRenderer(positions.length);
	chartView = ChartFactory.getTimeChartView(this, sensorData, renderer, "H:mm:ss");
	// set up global renderer
	renderer.setXTitle(getString(R.string.time));
	renderer.setXLabels(5);
	renderer.setYLabels(5);
	renderer.setGridColor(Color.DKGRAY);
	renderer.setShowGrid(true);
	renderer.setFitLegend(true);
	renderer.setClickEnabled(false);
	// set up chart data
	setUpChartData(positions);
	// make chart visible
	setContentView(chartView);
	// limit selected PIDs to selection
	MainActivity.setFixedPids(pidNumbers);
	// if auto hiding selected ...
	if(MainActivity.prefs.getBoolean(MainActivity.PREF_AUTOHIDE,false))
	{
		// get autohide timeout [s]
		int timeout = Integer.valueOf(
			MainActivity.prefs.getString(MainActivity.PREF_AUTOHIDE_DELAY,"15") );
		// auto hide toolbar
		toolBarHider = new AutoHider( this,
		                              mHandler,
			timeout * 1000);
		toolBarHider.start(1000);
		// wake up on touch
		chartView.setOnTouchListener(toolBarHider);
	}
}
 
Example 17
Source File: NavigationDrawerFragment.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 18
Source File: MainActivity.java    From Onosendai with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate (final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	this.prefs = new Prefs(getBaseContext());
	if (!this.prefs.isConfigured()) {
		startActivity(new Intent(getApplicationContext(), SetupActivity.class));
		finish();
		return;
	}
	this.prefs.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

	requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
	setContentView(R.layout.activity_main);

	try {
		this.conf = this.prefs.asConfig();
	}
	catch (final Exception e) { // No point continuing if any exception.
		LOG.wtf("Unparsable config.", e);
		DialogHelper.alertAndClose(this, e);
		return;
	}

	this.imageCache = new HybridBitmapCache(this, C.MAX_MEMORY_IMAGE_CACHE);

	if (this.prefs.getSharedPreferences().getBoolean(AdvancedPrefFragment.KEY_THREAD_INSPECTOR, false)) {
		final TextView jobStatus = (TextView) findViewById(R.id.jobStatus);
		jobStatus.setVisibility(View.VISIBLE);
		this.executorStatus = new ExecutorStatus(jobStatus);
	}

	this.localEs = ExecUtils.newBoundedCachedThreadPool(C.LOCAL_MAX_THREADS, new LogWrapper("LES"), this.executorStatus);
	this.netEs = ExecUtils.newBoundedCachedThreadPool(C.NET_MAX_THREADS, new LogWrapper("NES"), this.executorStatus);
	this.msgHandler = new MessageHandler(this);

	final float columnWidth = UiPrefFragment.readColumnWidth(this, this.prefs);
	this.columnsRtl = UiPrefFragment.readColumnsRtl(this.prefs);

	// If this becomes too memory intensive, switch to android.support.v4.app.FragmentStatePagerAdapter.
	final SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), this, columnWidth);
	this.viewPager = (SidebarAwareViewPager) findViewById(R.id.pager);
	this.pageSelectionListener = new VisiblePageSelectionListener(columnWidth);
	final MultiplexingOnPageChangeListener onPageChangeListener = new MultiplexingOnPageChangeListener(
			this.pageSelectionListener,
			new NotificationClearingPageSelectionListener(this));
	this.viewPager.setOnPageChangeListener(onPageChangeListener);
	this.viewPager.setAdapter(sectionsPagerAdapter);
	if (!showPageFromIntent(getIntent())) {
		if (this.columnsRtl) {
			gotoPage(0);
		}
		else {
			onPageChangeListener.onPageSelected(this.viewPager.getCurrentItem());
		}
	}

	final ActionBar ab = getActionBar();
	ab.setDisplayShowHomeEnabled(true);
	ab.setHomeButtonEnabled(true);
	ab.setDisplayShowTitleEnabled(false);
	ab.setDisplayShowCustomEnabled(true);

	this.columnTitleStrip = new ColumnTitleStrip(ab.getThemedContext());
	this.columnTitleStrip.setViewPager(this.viewPager);
	this.columnTitleStrip.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	this.columnTitleStrip.setColumnClickListener(new TitleClickListener(this));
	ab.setCustomView(this.columnTitleStrip);

	AlarmReceiver.configureAlarms(this);
	new CheckBackgroundUpdatesRunning(this, this.executorStatus).executeOnExecutor(this.localEs);
}
 
Example 19
Source File: RecyclerViewPlayGroundActivity.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 20
Source File: MusicLibrary.java    From mobile-manager-tool with MIT License 4 votes vote down vote up
/**
 * For the theme chooser
 */
private void initActionBar() {
	ActionBar actBar = getActionBar();
	actBar.setDisplayUseLogoEnabled(true);
    actBar.setDisplayShowTitleEnabled(false);
}