Java Code Examples for android.support.v7.widget.Toolbar#setTitleTextAppearance()

The following examples show how to use android.support.v7.widget.Toolbar#setTitleTextAppearance() . 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: AboutActivity.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if(Utils.hasKitKat() && !Utils.hasLollipop()){
		setTheme(R.style.Theme_Document_Translucent);
	}
	setContentView(R.layout.activity_about);

	Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
	mToolbar.setTitleTextAppearance(this, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
	if(Utils.hasKitKat() && !Utils.hasLollipop()) {
		//((LinearLayout.LayoutParams) mToolbar.getLayoutParams()).setMargins(0, getStatusBarHeight(this), 0, 0);
		mToolbar.setPadding(0, getStatusBarHeight(this), 0, 0);
	}
	int color = SettingsActivity.getPrimaryColor();
	mToolbar.setBackgroundColor(color);
	setSupportActionBar(mToolbar);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setTitle(null);
	setUpDefaultStatusBar();

	initControls();
}
 
Example 2
Source File: AboutActivity.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if(Utils.hasKitKat() && !Utils.hasLollipop()){
		setTheme(R.style.Theme_Document_Translucent);
	}
	setContentView(R.layout.activity_about);

	Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
	mToolbar.setTitleTextAppearance(this, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
	if(Utils.hasKitKat() && !Utils.hasLollipop()) {
		//((LinearLayout.LayoutParams) mToolbar.getLayoutParams()).setMargins(0, getStatusBarHeight(this), 0, 0);
		mToolbar.setPadding(0, getStatusBarHeight(this), 0, 0);
	}
	int color = SettingsActivity.getPrimaryColor();
	mToolbar.setBackgroundColor(color);
	setSupportActionBar(mToolbar);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setTitle(null);
	setUpDefaultStatusBar();

	initControls();
}
 
Example 3
Source File: AboutActivity.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if(Utils.hasKitKat() && !Utils.hasLollipop()){
		setTheme(R.style.Theme_Document_Translucent);
	}
	setContentView(R.layout.activity_about);

	Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
	mToolbar.setTitleTextAppearance(this, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
	if(Utils.hasKitKat() && !Utils.hasLollipop()) {
		//((LinearLayout.LayoutParams) mToolbar.getLayoutParams()).setMargins(0, getStatusBarHeight(this), 0, 0);
		mToolbar.setPadding(0, getStatusBarHeight(this), 0, 0);
	}
	int color = SettingsActivity.getPrimaryColor();
	mToolbar.setBackgroundColor(color);
	setSupportActionBar(mToolbar);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setTitle(null);
	setUpDefaultStatusBar();

	initControls();
}
 
Example 4
Source File: BottomToolbarPhone.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the height and title text appearance of the provided toolbar so that its style is
 * consistent with BottomToolbarPhone.
 * @param otherToolbar The other {@link Toolbar} to style.
 */
public void setOtherToolbarStyle(Toolbar otherToolbar) {
    // Android's Toolbar class typically changes its height based on device orientation.
    // BottomToolbarPhone has a fixed height. Update |toolbar| to match.
    otherToolbar.getLayoutParams().height = getHeight();

    // Android Toolbar action buttons are aligned based on the minimum height.
    int extraTopMargin = getExtraTopMargin();
    otherToolbar.setMinimumHeight(getHeight() - extraTopMargin);

    otherToolbar.setTitleTextAppearance(
            otherToolbar.getContext(), R.style.BottomSheetContentTitle);
    ApiCompatibilityUtils.setPaddingRelative(otherToolbar,
            ApiCompatibilityUtils.getPaddingStart(otherToolbar),
            otherToolbar.getPaddingTop() + extraTopMargin,
            ApiCompatibilityUtils.getPaddingEnd(otherToolbar), otherToolbar.getPaddingBottom());

    otherToolbar.requestLayout();
}
 
Example 5
Source File: BaseActivity.java    From AndroidReview with GNU General Public License v3.0 5 votes vote down vote up
/**
     * 初始化ToolBar
     */
    public void initToolBar() {
        toolbar = (Toolbar) findViewById(R.id.tb_toolbar);
        if (toolbar != null) {
//            toolbar.setLogo(R.mipmap.ic_top);
            toolbar.setBackgroundColor(getResources().getColor(R.color.theme_color));
            toolbar.setTitleTextAppearance(this, R.style.ToolBarTitleTextApperance);
            setSupportActionBar(toolbar);
        }
    }
 
Example 6
Source File: SwapWorkflowActivity.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).setSecureWindow(this);
    super.onCreate(savedInstanceState);

    currentView = new SwapView(this); // dummy placeholder to avoid NullPointerExceptions;

    if (!bindService(new Intent(this, SwapService.class), serviceConnection,
            BIND_ABOVE_CLIENT | BIND_IMPORTANT)) {
        Toast.makeText(this, "ERROR: cannot bind to SwapService!", Toast.LENGTH_LONG).show();
        finish();
    }

    setContentView(R.layout.swap_activity);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextAppearance(getApplicationContext(), R.style.SwapTheme_Wizard_Text_Toolbar);
    setSupportActionBar(toolbar);

    container = (ViewGroup) findViewById(R.id.container);

    localBroadcastManager = LocalBroadcastManager.getInstance(this);
    localBroadcastManager.registerReceiver(downloaderInterruptedReceiver,
            new IntentFilter(Downloader.ACTION_INTERRUPTED));

    wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    wifiApControl = WifiApControl.getInstance(this);

    bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    new SwapDebug().logStatus();
}
 
Example 7
Source File: StandaloneActivity.java    From FireFiles with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
    if(Utils.hasLollipop()){
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    else if(Utils.hasKitKat()){
        setTheme(R.style.Theme_Document_Translucent);
    }
    setUpStatusBar();
    // Debug.waitForDebugger();
    super.onCreate(icicle);
    mRoots = DocumentsApplication.getRootsCache(this);
    setResult(Activity.RESULT_CANCELED);
    setContentView(R.layout.activity);
    final Context context = this;
    final Resources res = getResources();
    // Strongly define our horizontal dimension; we leave vertical as
    final WindowManager.LayoutParams a = getWindow().getAttributes();
    final Point size = new Point();
    getWindowManager().getDefaultDisplay().getSize(size);
    // a.width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
    getWindow().setAttributes(a);
    mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
    if (icicle != null) {
        mState = icicle.getParcelable(EXTRA_STATE);
    } else {
        buildDefaultState();
    }
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitleTextAppearance(context,
            android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    mToolbarStack = (Spinner) findViewById(R.id.stack);
    mToolbarStack.setOnItemSelectedListener(mStackListener);
    mRootsToolbar = (Toolbar) findViewById(R.id.roots_toolbar);
    if (mRootsToolbar != null) {
        mRootsToolbar.setTitleTextAppearance(context,
                android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    }
    setSupportActionBar(mToolbar);
    RootsFragment.show(getFragmentManager(), null);
    if (!mState.restored) {
        new RestoreStackTask().execute();
    } else {
        onCurrentDirectoryChanged(ANIM_NONE);
    }
}
 
Example 8
Source File: StandaloneActivity.java    From FireFiles with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
    if(Utils.hasLollipop()){
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    else if(Utils.hasKitKat()){
        setTheme(R.style.Theme_Document_Translucent);
    }
    setUpStatusBar();
    // Debug.waitForDebugger();
    super.onCreate(icicle);
    mRoots = DocumentsApplication.getRootsCache(this);
    setResult(Activity.RESULT_CANCELED);
    setContentView(R.layout.activity);
    final Context context = this;
    final Resources res = getResources();
    // Strongly define our horizontal dimension; we leave vertical as
    final WindowManager.LayoutParams a = getWindow().getAttributes();
    final Point size = new Point();
    getWindowManager().getDefaultDisplay().getSize(size);
    // a.width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
    getWindow().setAttributes(a);
    mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
    if (icicle != null) {
        mState = icicle.getParcelable(EXTRA_STATE);
    } else {
        buildDefaultState();
    }
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitleTextAppearance(context,
            android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    mToolbarStack = (Spinner) findViewById(R.id.stack);
    mToolbarStack.setOnItemSelectedListener(mStackListener);
    mRootsToolbar = (Toolbar) findViewById(R.id.roots_toolbar);
    if (mRootsToolbar != null) {
        mRootsToolbar.setTitleTextAppearance(context,
                android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    }
    setSupportActionBar(mToolbar);
    RootsFragment.show(getFragmentManager(), null);
    if (!mState.restored) {
        new RestoreStackTask().execute();
    } else {
        onCurrentDirectoryChanged(ANIM_NONE);
    }
}
 
Example 9
Source File: StandaloneActivity.java    From FireFiles with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
    if(Utils.hasLollipop()){
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    else if(Utils.hasKitKat()){
        setTheme(R.style.Theme_Document_Translucent);
    }
    setUpStatusBar();
    // Debug.waitForDebugger();
    super.onCreate(icicle);
    mRoots = DocumentsApplication.getRootsCache(this);
    setResult(Activity.RESULT_CANCELED);
    setContentView(R.layout.activity);
    final Context context = this;
    final Resources res = getResources();
    // Strongly define our horizontal dimension; we leave vertical as
    final WindowManager.LayoutParams a = getWindow().getAttributes();
    final Point size = new Point();
    getWindowManager().getDefaultDisplay().getSize(size);
    // a.width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
    getWindow().setAttributes(a);
    mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
    if (icicle != null) {
        mState = icicle.getParcelable(EXTRA_STATE);
    } else {
        buildDefaultState();
    }
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitleTextAppearance(context,
            android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    mToolbarStack = (Spinner) findViewById(R.id.stack);
    mToolbarStack.setOnItemSelectedListener(mStackListener);
    mRootsToolbar = (Toolbar) findViewById(R.id.roots_toolbar);
    if (mRootsToolbar != null) {
        mRootsToolbar.setTitleTextAppearance(context,
                android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
    }
    setSupportActionBar(mToolbar);
    RootsFragment.show(getFragmentManager(), null);
    if (!mState.restored) {
        new RestoreStackTask().execute();
    } else {
        onCurrentDirectoryChanged(ANIM_NONE);
    }
}