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

The following examples show how to use android.app.ActionBar#setDisplayShowHomeEnabled() . 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 Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(R.string.app_name);
    actionBar.setSubtitle(null);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setHomeButtonEnabled(false);

    fragment = (MainFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);

    search = (AutoCompleteTextView) findViewById(R.id.main_header_search);
    View line = findViewById(R.id.main_header_line);
    fragment.setSearch(search);
    fragment.setLine(line);
}
 
Example 2
Source File: SomeActivity.java    From something.apk with MIT License 6 votes vote down vote up
private void configureActionbar(){
    ActionBar bar = getActionBar();
    bar.setHomeButtonEnabled(true);
    bar.setDisplayShowHomeEnabled(false);

    tint = new SystemBarTintManager(this);
    TypedValue tintColor = new TypedValue();
    if(getTheme().resolveAttribute(R.attr.statusBarBackground, tintColor, true)){
        tint.setStatusBarTintEnabled(true);
        tint.setTintColor(tintColor.data);
        defaultActionbarColor = tintColor.data;
        currentActionbarColor = tintColor.data;
    }else{
        tint.setStatusBarTintEnabled(false);
    }

    TypedValue actionbarBackground = new TypedValue();
    if(getTheme().resolveAttribute(R.attr.actionbarBackgroundLayerList, actionbarBackground, false)){
        actionbarBackgroundList = (LayerDrawable) getResources().getDrawable(actionbarBackground.data);
        actionbarBackgroundList.mutate();
        actionbarColor = (ColorDrawable) actionbarBackgroundList.findDrawableByLayerId(R.id.actionbar_background_color);
        actionbarColor.mutate();
        bar.setBackgroundDrawable(actionbarBackgroundList);
    }

}
 
Example 3
Source File: MainActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(R.string.app_name);
    actionBar.setSubtitle(null);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setHomeButtonEnabled(false);

    fragment = (MainFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);

    preferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
    editor = preferences.edit();

    layoutParams = getWindow().getAttributes();

    search = (AutoCompleteTextView) findViewById(R.id.main_header_search);
    View line = findViewById(R.id.main_header_line);
    fragment.setSearch(search);
    fragment.setLine(line);
}
 
Example 4
Source File: MainActivity.java    From SmileEssence with MIT License 5 votes vote down vote up
public void initializeView() {
    ActionBar bar = getActionBar();
    bar.setDisplayShowHomeEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    viewPager = (ViewPager) findViewById(R.id.viewPager);
    pagerAdapter = new PageListAdapter(this, viewPager);
    initializePages();
}
 
Example 5
Source File: MainActivity.java    From androidtestdebug with MIT License 5 votes vote down vote up
@Override
  public void onCreate(Bundle savedInstanceState) {		
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
	.detectActivityLeaks()
	.penaltyLog().build());

      super.onCreate(savedInstanceState);

      if(savedInstanceState != null && savedInstanceState.getInt("theme", -1) != -1) {
          mThemeId = savedInstanceState.getInt("theme");
          this.setTheme(mThemeId);
      }
              
      setContentView(R.layout.main);

      Directory.initializeDirectory(new OnDirectoryChanged());
      
      ActionBar bar = getActionBar();

      int i;
      for (i = 0; i < Directory.getCategoryCount(); i++) {
          bar.addTab(bar.newTab().setText(Directory.getCategory(i).getName())
                  .setTabListener(this));
      }

      mActionBarView = getLayoutInflater().inflate(
              R.layout.action_bar_custom, null);

      bar.setCustomView(mActionBarView);
      bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
      bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
      bar.setDisplayShowHomeEnabled(true);

      // If category is not saved to the savedInstanceState,
      // 0 is returned by default.
      if(savedInstanceState != null) {
          int category = savedInstanceState.getInt("category");
          bar.selectTab(bar.getTabAt(category));
      }
  }
 
Example 6
Source File: FormHierarchyActivity.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void addActionBarBackArrow() {
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        ActionBar bar = getActionBar();
        if (bar != null) {
            bar.setDisplayShowHomeEnabled(true);
            bar.setDisplayHomeAsUpEnabled(true);
        }
    }
}
 
Example 7
Source File: MainActivity.java    From androidtestdebug with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if(savedInstanceState != null && savedInstanceState.getInt("theme", -1) != -1) {
        mThemeId = savedInstanceState.getInt("theme");
        this.setTheme(mThemeId);
    }
            
    setContentView(R.layout.main);

    Directory.initializeDirectory(new OnDirectoryChanged());
    
    ActionBar bar = getActionBar();

    int i;
    for (i = 0; i < Directory.getCategoryCount(); i++) {
        bar.addTab(bar.newTab().setText(Directory.getCategory(i).getName())
                .setTabListener(this));
    }

    mActionBarView = getLayoutInflater().inflate(
            R.layout.action_bar_custom, null);

    bar.setCustomView(mActionBarView);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(true);

    // If category is not saved to the savedInstanceState,
    // 0 is returned by default.
    if(savedInstanceState != null) {
        int category = savedInstanceState.getInt("category");
        bar.selectTab(bar.getTabAt(category));
    }
}
 
Example 8
Source File: BreadcrumbBarFragment.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
private void configureSimpleNav(Activity activity, ActionBar actionBar) {
    boolean showNav = true;
    if (activity instanceof CommCareActivity) {
        showNav = ((CommCareActivity)activity).isBackEnabled();
    }

    if (showNav) {
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    actionBar.setDisplayShowTitleEnabled(true);
    String title = getBestTitle(activity);
    actionBar.setTitle(title);
}
 
Example 9
Source File: MainActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	sharedPreferences = new FanfanSharedPreferences(MainActivity.this);
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowHomeEnabled(false);
	if (!sharedPreferences.getLogInStatus(false)) {
		draweritems = this.getResources().getStringArray(
				R.array.nologindrawerliststring);
	} else {
		draweritems = this.getResources().getStringArray(
				R.array.drawerliststring);
		// Login();
	}
	mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager()
			.findFragmentById(R.id.navigation_drawer);
	mTitle = getTitle();

	// Set up the drawer.
	mNavigationDrawerFragment.setUp(R.id.navigation_drawer,
			(DrawerLayout) findViewById(R.id.drawer_layout));
	// ���������Զ��������
	UmengUpdateAgent.update(MainActivity.this);
	// �û���������̨����Ƿ����µ����Կ����ߵĻظ���
	FeedbackAgent mAgent = new FeedbackAgent(MainActivity.this);
	mAgent.sync();
	MobclickAgent.updateOnlineConfig(MainActivity.this);
}
 
Example 10
Source File: SettingFirmwareActivity.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected void onCreate(Bundle bundle)
{
    super.onCreate(bundle);
    FragmentTransaction fragmenttransaction = getFragmentManager().beginTransaction();
    a = (SettingFirmwareFragment)Fragment.instantiate(this, cn/com/smartdevices/bracelet/ui/SettingFirmwareActivity$SettingFirmwareFragment.getName());
    fragmenttransaction.add(0x1020002, a);
    fragmenttransaction.commit();
    ActionBar actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setDisplayShowHomeEnabled(false);
    actionbar.setDisplayUseLogoEnabled(false);
}
 
Example 11
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 12
Source File: DialtactsActivity.java    From coursera-android with MIT License 5 votes vote down vote up
/**
 * Goes back to usual Phone UI with tags. Previously selected Tag and associated Fragment
 * should be automatically focused again.
 */
private void exitSearchUi() {
    final ActionBar actionBar = getActionBar();

    // Hide the search fragment, if exists.
    if (mSearchFragment != null) {
        mSearchFragment.setUserVisibleHint(false);

        final FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.hide(mSearchFragment);
        transaction.commitAllowingStateLoss();
    }

    // We want to hide SearchView and show Tabs. Also focus on previously selected one.
    actionBar.setDisplayShowCustomEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    for (int i = 0; i < TAB_INDEX_COUNT; i++) {
        sendFragmentVisibilityChange(i, i == mViewPager.getCurrentItem());
    }

    // Before exiting the search screen, reset swipe state.
    mDuringSwipe = false;
    mUserTabClick = false;

    mViewPager.setVisibility(View.VISIBLE);

    hideInputMethod(getCurrentFocus());

    // Request to update option menu.
    invalidateOptionsMenu();

    // See comments in onActionViewExpanded()
    mSearchView.onActionViewCollapsed();
    mInSearchUi = false;
}
 
Example 13
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 14
Source File: MainActivity.java    From weixin with Apache License 2.0 5 votes vote down vote up
private void initView() {
	ActionBar actionBar = this.getActionBar();
	actionBar.setDisplayShowHomeEnabled(false);
	actionBar.setDisplayShowTitleEnabled(true);
	setOverflowShowingAlways();

	mFragmentManager = getFragmentManager();
	mRg_tab = (RadioGroup) findViewById(R.id.cgt_rg_tab);
	mRg_tab.setOnCheckedChangeListener(this);
}
 
Example 15
Source File: FeedBack.java    From MainScreenShow with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	
	super.onCreate(savedInstanceState);
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayShowHomeEnabled(false);
	setContentView(R.layout.activity_feedback);
	
	content = (EditText) findViewById(R.id.edit_fb);
	qq = (EditText) findViewById(R.id.edit_fb_qq);
	
}
 
Example 16
Source File: MaterialMenuIcon.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override @TargetApi(14)
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = activity.getActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example 17
Source File: MaterialMenuIcon.java    From Conquer with Apache License 2.0 5 votes vote down vote up
@Override @TargetApi(14)
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = activity.getActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example 18
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 19
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 20
Source File: MainActivity.java    From androidtestdebug with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if(savedInstanceState != null && savedInstanceState.getInt("theme", -1) != -1) {
        mThemeId = savedInstanceState.getInt("theme");
        this.setTheme(mThemeId);
    }
            
    setContentView(R.layout.main);

    Directory.initializeDirectory(new OnDirectoryChanged());
    
    ActionBar bar = getActionBar();

    int i;
    for (i = 0; i < Directory.getCategoryCount(); i++) {
        bar.addTab(bar.newTab().setText(Directory.getCategory(i).getName())
                .setTabListener(this));
    }

    mActionBarView = getLayoutInflater().inflate(
            R.layout.action_bar_custom, null);

    bar.setCustomView(mActionBarView);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(true);

    // If category is not saved to the savedInstanceState,
    // 0 is returned by default.
    if(savedInstanceState != null) {
        int category = savedInstanceState.getInt("category");
        bar.selectTab(bar.getTabAt(category));
    }
}