Java Code Examples for androidx.appcompat.app.ActionBar#setTitle()

The following examples show how to use androidx.appcompat.app.ActionBar#setTitle() . 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: SignUpFragment.java    From tindroid with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    setHasOptionsMenu(false);

    AppCompatActivity activity = (AppCompatActivity) getActivity();
    if (activity == null) {
        return null;
    }

    ActionBar bar = activity.getSupportActionBar();
    if (bar != null) {
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setTitle(R.string.sign_up);
    }

    View fragment = inflater.inflate(R.layout.fragment_signup, container, false);

    fragment.findViewById(R.id.signUp).setOnClickListener(this);

    return fragment;
}
 
Example 2
Source File: AboutActivity.java    From EdXposedManager with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ThemeUtil.setTheme(this);
    setContentView(R.layout.activity_container);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    toolbar.setNavigationOnClickListener(view -> finish());

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setTitle(R.string.nav_item_about);
        ab.setDisplayHomeAsUpEnabled(true);
    }

    setFloating(toolbar, R.string.details);

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction().add(R.id.container, new AboutFragment()).commit();
    }
}
 
Example 3
Source File: BaseActivity.java    From DKVideoPlayer with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getLayoutResId() != 0) {
        setContentView(getLayoutResId());
    } else if (getContentView() != null) {
        setContentView(getContentView());
    }

    //标题栏设置
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(getTitleResId());
        if (enableBack()) {
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
    }

    initView();

}
 
Example 4
Source File: LabActivity.java    From a with GNU General Public License v3.0 5 votes vote down vote up
public void setupActionBar(String title) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(title);
    }
}
 
Example 5
Source File: CodeRulesActivity.java    From SmsCode with GNU General Public License v3.0 5 votes vote down vote up
private void refreshActionBar(String title) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(title);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 6
Source File: FavoriteActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 7
Source File: DescriptionFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@Override public void load(boolean create, boolean refresh, Bundle savedInstanceState) {
  if (!TextUtils.isEmpty(description) && !TextUtils.isEmpty(appName)) {

    descriptionContainer.setText(AptoideUtils.HtmlU.parse(description));
    if (hasToolbar()) {
      ActionBar bar = ((AppCompatActivity) getActivity()).getSupportActionBar();
      if (bar != null) {
        bar.setTitle(appName);
      }
      if (hasAppc) {
        setupAppcAppView();
      }
    }
    finishLoading();
  } else if (hasAppId) {
    GetAppRequest.of(appId, partnerId == null ? null : storeName,
        StoreUtils.getStoreCredentials(storeName, storeCredentialsProvider), packageName,
        baseBodyBodyInterceptor, httpClient, converterFactory,
        ((AptoideApplication) getContext().getApplicationContext()).getTokenInvalidator(),
        ((AptoideApplication) getContext().getApplicationContext()).getDefaultSharedPreferences(),
        appBundlesVisibilityManager)
        .execute(getApp -> {
          setupAppDescription(getApp);
          setupTitle(getApp);
          finishLoading();
          if (hasAppc(getApp)) {
            hasAppc = true;
            setupAppcAppView();
          }
        }, false);
  } else {
    Logger.getInstance()
        .e(TAG, "App id unavailable");
    setDataUnavailable();
  }
}
 
Example 8
Source File: SimpleBookListEditActivity.java    From a with GNU General Public License v3.0 5 votes vote down vote up
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 9
Source File: SimpleBookListDetailActivity.java    From a with GNU General Public License v3.0 5 votes vote down vote up
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 10
Source File: WebViewActivity.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setTitle(CharSequence title) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(title);
    }
}
 
Example 11
Source File: CodeConverterActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle("");
    }
}
 
Example 12
Source File: BaseFragment.java    From hipda with GNU General Public License v2.0 5 votes vote down vote up
protected void setActionBarTitle(CharSequence title) {
    if (getActivity() != null) {
        ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
        String t = Utils.nullToText(title);
        if (actionBar != null && !t.equals(actionBar.getTitle())) {
            actionBar.setTitle(t);
        }
    }
}
 
Example 13
Source File: FilePickerActivity.java    From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void postInit() {
    super.postInit();
    ActionBar actionBar;
    if ((actionBar = ((BaseActivity) getActivity()).getSupportActionBar()) != null) {
        actionBar.setTitle(mPath);
    }
}
 
Example 14
Source File: BookCoverEditActivity.java    From MyBookshelf with GNU General Public License v3.0 5 votes vote down vote up
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.cover_change_source);
    }
}
 
Example 15
Source File: SettingActivity.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void setupActionBar() {
    AppCompat.setToolbarNavIconTint(toolbar, getResources().getColor(R.color.colorBarText));
    this.setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.setting);
    }
}
 
Example 16
Source File: ShortcutActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onStart() {
    super.onStart();
    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setTitle(R.string.create_shortcut);
    }
}
 
Example 17
Source File: AboutActivity.java    From Chimee with MIT License 5 votes vote down vote up
private void setupToolbar() {
	Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);
	ActionBar actionBar = getSupportActionBar();
	if (actionBar != null) {
		actionBar.setDisplayHomeAsUpEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);
		actionBar.setTitle("");
	}
}
 
Example 18
Source File: AboutActivity.java    From AppsMonitor with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.about);
    }

    ((TextView) findViewById(R.id.version)).setText(
            String.format(Locale.getDefault(),
                    getResources().getString(R.string.version), BuildConfig.VERSION_NAME));
}
 
Example 19
Source File: LauncherActivity.java    From Android-Plugin-Framework with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	EventBus.getDefault().register(this);
       //测试databinding
	//PluginLauncherBinding bing =  DataBindingUtil.setContentView(this, R.layout.plugin_launcher);
	//DataBindingTestVO dataBindingTestVO = new DataBindingTestVO("DataBind:打开PluginHellWorld");
	//bing.setTest(dataBindingTestVO);

	setContentView(R.layout.plugin_launcher);
       ButterKnifeCompat.bind(this);

	testLog();

       fakeThisForUmengSdk = fakeActivityForUMengSdk(LauncherActivity.this);

       requestPermission();

	ActionBar actionBar = getSupportActionBar();
	actionBar.setTitle("这是插件首屏");
	actionBar.setSubtitle("这是副标题");
	actionBar.setLogo(R.drawable.ic_launcher);
	actionBar.setIcon(R.drawable.ic_launcher);
	actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP
			| ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);

	findViewById( R.id.onClickHellowrld).setOnClickListener(this);
	findViewById( R.id.onClickPluginNormalFragment).setOnClickListener(this);
	findViewById( R.id.onClickPluginSpecFragment).setOnClickListener(this);
	findViewById( R.id.onClickPluginForDialogActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginForOppoAndVivoActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginNotInManifestActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginFragmentTestActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginSingleTaskActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestOpenPluginActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestTabActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginWebViewActivity).setOnClickListener(this);
	findViewById( R.id.onClickTransparentActivity).setOnClickListener(this);
	findViewById( R.id.onClickDesignActivity).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestReceiver).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestReceiver2).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestService).setOnClickListener(this);
	findViewById( R.id.onClickPluginTestService2).setOnClickListener(this);
	findViewById( R.id.onTestFileProvider).setOnClickListener(this);

       testQueryIntentActivities();
       testAlarm();
       testService();
       testMeta();
       testVersion1();
       testVersion2();
	testMuliDex();
	testUseLibray();
}
 
Example 20
Source File: MainActivity.java    From Passbook with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    mApp = Application.getInstance();
    if(mApp == null || mApp.getAccountManager() == null) {
        super.onCreate(savedInstanceState);
        Intent intent = new Intent(this, HomeActivity.class);
        startActivity(intent);
        finish();
        return;
    }
    if(savedInstanceState==null) {
        MainListFragment.clearCache();
    }
    this.setTheme(C.THEMES[Application.Options.mTheme]);
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
            WindowManager.LayoutParams.FLAG_SECURE);
    this.setContentView(R.layout.activity_main);
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        View v = findViewById(R.id.panel_main);
        mRootView = v.getRootView();
        mStatusColor = C.ThemedColors[C.colorPrimary];
        mRootView.setBackgroundColor(mStatusColor);
    }
    setupToolbar();
    mNavigationDrawer = (NavigationDrawerFragment)getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);
    DrawerLayout drawerLayout = findViewById(R.id.drawer_layout);
    mNavigationDrawer.setUp(R.id.navigation_drawer, drawerLayout);
    mMainList = (MainListFragment)getSupportFragmentManager()
            .findFragmentById(R.id.panel_main);
    if(savedInstanceState != null) {
        DeleteCategory dialog = (DeleteCategory)getSupportFragmentManager()
                .findFragmentByTag("delete_category");
        if(dialog!=null) {
            dialog.setListener(this::deleteCategory);
        }
        mTitle = savedInstanceState.getString("pb_title");
    }
    else {
        mTitle = getString(R.string.all_accounts);
    }
    ActionBar actionBar = getSupportActionBar();
    if (actionBar!=null) {
        actionBar.setTitle(mTitle);
    }
}