Search in sources :

Example 96 with ActionBar

use of android.app.ActionBar in project LDrawer by keklikhasan.

the class SampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);
    ActionBar ab = getActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setHomeButtonEnabled(true);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.navdrawer);
    drawerArrow = new DrawerArrowDrawable(this) {

        @Override
        public boolean isLayoutRtl() {
            return false;
        }
    };
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, drawerArrow, R.string.drawer_open, R.string.drawer_close) {

        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu();
        }

        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu();
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerToggle.syncState();
    String[] values = new String[] { "Stop Animation (Back icon)", "Stop Animation (Home icon)", "Start Animation", "Change Color", "GitHub Page", "Share", "Rate" };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, values);
    mDrawerList.setAdapter(adapter);
    mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch(position) {
                case 0:
                    mDrawerToggle.setAnimateEnabled(false);
                    drawerArrow.setProgress(1f);
                    break;
                case 1:
                    mDrawerToggle.setAnimateEnabled(false);
                    drawerArrow.setProgress(0f);
                    break;
                case 2:
                    mDrawerToggle.setAnimateEnabled(true);
                    mDrawerToggle.syncState();
                    break;
                case 3:
                    if (drawerArrowColor) {
                        drawerArrowColor = false;
                        drawerArrow.setColor(R.color.ldrawer_color);
                    } else {
                        drawerArrowColor = true;
                        drawerArrow.setColor(R.color.drawer_arrow_second_color);
                    }
                    mDrawerToggle.syncState();
                    break;
                case 4:
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/IkiMuhendis/LDrawer"));
                    startActivity(browserIntent);
                    break;
                case 5:
                    Intent share = new Intent(Intent.ACTION_SEND);
                    share.setType("text/plain");
                    share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    share.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
                    share.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_description) + "\n" + "GitHub Page :  https://github.com/IkiMuhendis/LDrawer\n" + "Sample App : https://play.google.com/store/apps/details?id=" + getPackageName());
                    startActivity(Intent.createChooser(share, getString(R.string.app_name)));
                    break;
                case 6:
                    String appUrl = "https://play.google.com/store/apps/details?id=" + getPackageName();
                    Intent rateIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(appUrl));
                    startActivity(rateIntent);
                    break;
            }
        }
    });
}
Also used : ActionBarDrawerToggle(com.ikimuhendis.ldrawer.ActionBarDrawerToggle) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) DrawerArrowDrawable(com.ikimuhendis.ldrawer.DrawerArrowDrawable) AdapterView(android.widget.AdapterView) ActionBar(android.app.ActionBar) ArrayAdapter(android.widget.ArrayAdapter)

Example 97 with ActionBar

use of android.app.ActionBar in project Talon-for-Twitter by klinker24.

the class TweetPager method setUpTheme.

public void setUpTheme() {
    Utils.setUpPopupTheme(context, settings);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    if (settings.addonTheme) {
        getWindow().getDecorView().setBackgroundColor(settings.backgroundColor);
    }
    Utils.setActionBar(context, !settings.advanceWindowed);
}
Also used : ActionBar(android.app.ActionBar)

Example 98 with ActionBar

use of android.app.ActionBar in project k-9 by k9mail.

the class MessageCompose method initializeActionBar.

private void initializeActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
}
Also used : ActionBar(android.app.ActionBar)

Example 99 with ActionBar

use of android.app.ActionBar in project Talon-for-Twitter by klinker24.

the class ConfigurePagerActivity method setUpDoneDiscard.

public void setUpDoneDiscard() {
    LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
    final View customActionBarView = inflater.inflate(R.layout.actionbar_done_discard, null);
    TextView doneButton = (TextView) customActionBarView.findViewById(R.id.done);
    doneButton.setText(getResources().getString(R.string.done_label));
    customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            int currentAccount = sharedPrefs.getInt("current_account", 1);
            SharedPreferences.Editor editor = sharedPrefs.edit();
            for (int i = 0; i < chooserAdapter.getCount(); i++) {
                if (chooserAdapter.getItem(i) instanceof ChooserFragment) {
                    ChooserFragment f = (ChooserFragment) chooserAdapter.getItem(i);
                    int num = i + 1;
                    editor.putInt("account_" + currentAccount + "_page_" + num, f.type);
                    editor.putLong("account_" + currentAccount + "_list_" + num + "_long", f.listId);
                    editor.putString("account_" + currentAccount + "_name_" + num, f.listName);
                    editor.putString("account_" + currentAccount + "_search_" + num, f.searchQuery);
                    if (f.check != null && f.check.isChecked()) {
                        editor.putInt("default_timeline_page_" + currentAccount, i);
                    }
                }
            }
            editor.commit();
            onBackPressed();
        }
    });
    customActionBarView.findViewById(R.id.actionbar_discard).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    // Show the custom action bar view and hide the normal Home icon and title.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
Also used : TextView(android.widget.TextView) TextView(android.widget.TextView) ActionBar(android.app.ActionBar)

Example 100 with ActionBar

use of android.app.ActionBar in project android-demos by novoda.

the class LeftNavBarWrapper method applyCustomParams.

private void applyCustomParams(ActionBar.LayoutParams params) {
    ActionBar bar = getLeftNavBar();
    bar.setCustomView(bar.getCustomView(), params);
}
Also used : ActionBar(android.app.ActionBar)

Aggregations

ActionBar (android.app.ActionBar)158 View (android.view.View)37 Intent (android.content.Intent)19 AdapterView (android.widget.AdapterView)11 TextView (android.widget.TextView)11 ListView (android.widget.ListView)9 SharedPreferences (android.content.SharedPreferences)8 Uri (android.net.Uri)7 ArrayAdapter (android.widget.ArrayAdapter)7 FrameLayout (android.widget.FrameLayout)7 SpannableString (android.text.SpannableString)6 BitmapRegionTileSource (com.android.photos.BitmapRegionTileSource)6 GridLayoutManager (android.support.v7.widget.GridLayoutManager)5 RecyclerView (android.support.v7.widget.RecyclerView)5 CircularProgressButton (com.dd.CircularProgressButton)5 CircularProgressButton (com.marshalchen.common.uimodule.circularProgressButton.CircularProgressButton)5 SuppressLint (android.annotation.SuppressLint)4 Bundle (android.os.Bundle)4 ViewPager (android.support.v4.view.ViewPager)4 MenuInflater (android.view.MenuInflater)4