Java Code Examples for android.support.v7.app.ActionBar#setSubtitle()

The following examples show how to use android.support.v7.app.ActionBar#setSubtitle() . 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: AddProfileActivity.java    From KA27 with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    BundleScrubber.scrub(getIntent());

    Bundle localeBundle = getIntent().getBundleExtra(EXTRA_BUNDLE);
    BundleScrubber.scrub(localeBundle);

    ActionBar actionBar;
    if ((actionBar = getSupportActionBar()) != null) {
        actionBar.setTitle(getString(R.string.profile));
        if (PluginBundleManager.isBundleValid(localeBundle)) {
            String message;
            if ((message = localeBundle.getString(PluginBundleManager.BUNDLE_EXTRA_STRING_MESSAGE)) != null)
                actionBar.setSubtitle(message.split(DIVIDER)[0]);
        }
    }

    setFragment(R.id.content_frame, ProfileFragment.newInstance());
}
 
Example 2
Source File: BaseFragment.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (isRootFragment) {
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            if (titleRes != 0) {
                actionBar.setTitle(titleRes);
            } else {
                actionBar.setTitle(title);
            }
            actionBar.setSubtitle(subtitle);
            actionBar.setDisplayShowCustomEnabled(showCustom);
            actionBar.setDisplayHomeAsUpEnabled(homeAsUp);
            actionBar.setDisplayShowHomeEnabled(showHome);
            actionBar.setDisplayShowTitleEnabled(showTitle);
            onConfigureActionBar(actionBar);
        }
    }
}
 
Example 3
Source File: Card.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@UiThread
void showSuccessResult(CardRecordModel.RecordList l){

    // new search
    if(cardadapter == null){
        count = l.getCount();
        setListViewAdapter(l.getRecords());
        String tips = getString(R.string.tips_card_record_count) + count;
        AppMsg.makeText(getSherlockActivity(),tips,AppMsg.STYLE_INFO).show();
        UIHelper.getDialog().dismiss();
    }else{
        // next page;
        cardadapter.addAll(l.getRecords());
        pullListView.onRefreshComplete();
        cardadapter.notifyDataSetChanged();
        adapter.notifyDataSetChanged();
        pullListView.setRefreshing(false);
    }

    ActionBar actionBar = getSherlockActivity().getSupportActionBar();
    actionBar.setSubtitle(getString(R.string.title_sub_card) + l.getAmount());
}
 
Example 4
Source File: DeviceServicesActivity.java    From BleSensorTag with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.device_services_activity);

    gattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
    gattServicesList.setOnChildClickListener(this);
    final View emptyView = findViewById(R.id.empty_view);
    gattServicesList.setEmptyView(emptyView);

    dataCharacteristic = (TextView) findViewById(R.id.data_characteristic_uuid);
    dataValue = (TextView) findViewById(R.id.data_characteristic_value);

    //noinspection ConstantConditions
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    final String deviceName = getDeviceName();
    if (TextUtils.isEmpty(deviceName)) {
        //noinspection ConstantConditions
        actionBar.setTitle(getDeviceAddress());
    } else {
        //noinspection ConstantConditions
        actionBar.setTitle(deviceName);
        actionBar.setSubtitle(getDeviceAddress());
    }
    actionBar.setDisplayHomeAsUpEnabled(true);
}
 
Example 5
Source File: MeFragment.java    From Pioneer with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (getActivity() instanceof AppCompatActivity) {
        ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
        if (actionBar != null) {
            actionBar.setSubtitle(R.string.title_me);
        }
    } else {
        getActivity().setTitle(R.string.title_me);
    }
}
 
Example 6
Source File: BaseFragment.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setSubtitle(String subtitle) {
    this.subtitle = subtitle;

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(subtitle);
    }
}
 
Example 7
Source File: DirectoryBrowserActivity.java    From PlayMusicExporter with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set the layout
    setContentView(R.layout.activity_directory_browser);

    // Gets the bundle data
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        // Reads the title
        if (bundle.containsKey(EXTRA_TITLE))
            mTitle = bundle.getString(EXTRA_TITLE);

        // Reads the start path
        if (bundle.containsKey(EXTRA_PATH)) {
            String path = bundle.getString(EXTRA_PATH);
            if (path != null) {
                mPath = new File(path);

                // Default directory
                if (!mPath.exists()) {
                    mPath = Environment.getExternalStorageDirectory();
                }
            }
        }
    }

    // Setup the actionbar
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Set the title
        actionBar.setTitle(mTitle);
        actionBar.setSubtitle(mPath.getAbsolutePath());
    }



}
 
Example 8
Source File: MainActivity.java    From SteamGifts with MIT License 5 votes vote down vote up
@Override
public void onUpdatePoints(final int newPoints) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        if (SteamGiftsUserData.getCurrent(this).isLoggedIn() && getCurrentFragment() instanceof GiveawayListFragment) {
            actionBar.setSubtitle(String.format("%dP", newPoints));
        } else {
            actionBar.setSubtitle(null);
        }
    }
}
 
Example 9
Source File: SuperActivityToastFragment.java    From SuperToasts with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ActionBar actionBar = ((MainActivity) getActivity()).getSupportActionBar();
    if (actionBar != null) actionBar.setSubtitle("SuperActivityToast");

    /*
     * Restore any showing/pending SuperActivityToasts after orientation change
     * and reattach any listeners.
     */
    SuperActivityToast.onRestoreState(getActivity(), savedInstanceState,
            ListenerUtils.newInstance()
                    .putListener("good_tag_name", onButtonClickListener));
}
 
Example 10
Source File: MainActivity.java    From CineLog with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    new ThemeWrapper().setThemeWithPreferences(this);

    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    ActionBar actionbar = getSupportActionBar();
    if (actionbar != null) {
        actionbar.setDisplayHomeAsUpEnabled(true);
        actionbar.setHomeAsUpIndicator(R.drawable.menu);
        actionbar.setTitle(R.string.toolbar_title_reviews);
        actionbar.setSubtitle(R.string.app_name);
    }

    setViewPager(viewPager);
    tabLayout.setupWithViewPager(viewPager);

    fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setReviewFragment();
        }
    });

    configureDrawer();

    checkNeededFix();
}
 
Example 11
Source File: WishlistActivity.java    From CineLog with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    new ThemeWrapper().setThemeWithPreferences(this);

    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    setViewPager(viewPager);

    fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setReviewFragment();
        }
    });

    setSupportActionBar(toolbar);
    ActionBar actionbar = getSupportActionBar();
    if (actionbar != null) {
        actionbar.setDisplayHomeAsUpEnabled(true);
        actionbar.setHomeAsUpIndicator(R.drawable.menu);
        actionbar.setTitle(R.string.toolbar_title_wishlist);
        actionbar.setSubtitle(R.string.app_name);
    }

    configureDrawer();
}
 
Example 12
Source File: GalleryActivity.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
private void configToolbar() {
    toolbar = findViewById(R.id.toolbar);
    
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_toolbar_shade));
        actionBar.setTitle(title);
        actionBar.setSubtitle(clickedImage + 1 + "/" + attachments.size());
    }
}
 
Example 13
Source File: TodayFragment.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
private void configToolbar() {
    if (getActivity() != null) {
        ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
        if (actionBar != null) {
            actionBar.setTitle(R.string.drawer_menu_today);
            actionBar.setSubtitle(null);
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white);
        }
    }
}
 
Example 14
Source File: SuperToastFragment.java    From SuperToasts with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ActionBar actionBar = ((MainActivity) getActivity()).getSupportActionBar();
    if (actionBar != null) actionBar.setSubtitle("SuperToast");
}
 
Example 15
Source File: AssignmentsFragment.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
private void configToolbar() {
    if (getActivity() != null) {
        ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
        if (actionBar != null) {
            actionBar.setTitle(R.string.drawer_menu_category);
            actionBar.setDisplayHomeAsUpEnabled(true);
            String subTitle = category != null ? category.getName() : null;
            actionBar.setSubtitle(subTitle);
            actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24dp);
        }
    }
}
 
Example 16
Source File: CommonActivity.java    From SteamGifts with MIT License 5 votes vote down vote up
protected void updateTitle(Fragment fragment) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        String fragmentTitle = getFragmentTitle(fragment);
        actionBar.setTitle(fragmentTitle);

        if (fragment instanceof IActivityTitle) {
            String extraTitle = ((IActivityTitle) fragment).getExtraTitle();
            if (extraTitle != null && !extraTitle.equals(fragmentTitle)) {
                actionBar.setSubtitle(extraTitle);
            }
        }
    }
}
 
Example 17
Source File: BaseActivity.java    From ETHWallet with GNU General Public License v3.0 4 votes vote down vote up
protected void setSubtitle(String subtitle) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(subtitle);
    }
}
 
Example 18
Source File: BaseActivity.java    From trust-wallet-android-source with GNU General Public License v3.0 4 votes vote down vote up
protected void setSubtitle(String subtitle) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(subtitle);
    }
}
 
Example 19
Source File: BluetoothActivity.java    From AndroidDemo with MIT License 4 votes vote down vote up
private void setSubtitle(@NonNull String subtitle) {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setSubtitle(subtitle);
}
 
Example 20
Source File: BaseActivity.java    From Leaderboards with Apache License 2.0 4 votes vote down vote up
protected void setToolbarSubtitle(String subtitle) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setSubtitle(subtitle);
    }
}