List of usage examples for android.app ActionBar getThemedContext
public Context getThemedContext()
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void applyColorFilterToMenuIcon(Activity activity, Menu menu) { final ActionBar actionBar = activity.getActionBar(); final Context context = actionBar != null ? actionBar.getThemedContext() : activity; final int color = getThemeForegroundColor(context); final int popupTheme = getActionBarPopupThemeRes(context); final int popupColor = getThemeForegroundColor(context, popupTheme); final int highlightColor = getUserAccentColor(activity); applyColorFilterToMenuIcon(menu, color, popupColor, highlightColor, Mode.SRC_ATOP); }
From source file:com.commonsware.android.feedfrags.FeedsNavActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_nav);/*from www. j a v a 2 s .co m*/ ActionBar bar = getActionBar(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { adapter = new ArrayAdapter<Feed>(bar.getThemedContext(), R.layout.row, Feed.getFeeds()); } else { adapter = new ArrayAdapter<Feed>(this, R.layout.row, Feed.getFeeds()); } bar.setListNavigationCallbacks(adapter, new NavListener()); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayHomeAsUpEnabled(true); }
From source file:de.vanita5.twittnuker.activity.BasePreferenceActivity.java
@Override public TwidereMenuInflater getTwidereMenuInflater() { if (mMenuInflater != null) return mMenuInflater; final ActionBar actionBar = getActionBar(); if (actionBar != null) { return mMenuInflater = new TwidereMenuInflater(actionBar.getThemedContext()); }/*from ww w . j a v a 2s.c om*/ return mMenuInflater = new TwidereMenuInflater(this); }
From source file:com.github.riotopsys.malforandroid2.activity.HubActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate"); setContentView(R.layout.main);//from www . j a v a 2 s . c om ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar .setListNavigationCallbacks( new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, getResources().getStringArray(R.array.drop_down_nav_options)), this); setupAnimeAdapter(); setupMangaAdapter(); if (!state.isSyncScheduled()) { //somehow we hit this point with out starting the sync, so we'll do it now BootReciever.scheduleSync(state, this); } if (detailFrame != null) { transitionDetail(false); } if (savedInstanceState != null) { actionBar.setSelectedNavigationItem(savedInstanceState.getInt("MODE")); } apprater.onAppOpened(this); }
From source file:dude.morrildl.weatherport.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // We store the list of airports the user has expressed interest in in // SharedPrefs, as a list (well, Set) of Strings SharedPreferences prefs = getSharedPreferences("prefs", Context.MODE_PRIVATE); Set<String> currentSet = prefs.getStringSet("airports", null); if (currentSet == null || currentSet.size() < 1) { // i.e. first run -- hard-default KSFO to the list HashSet<String> defaultSet = new HashSet<String>(); defaultSet.add("KSFO"); prefs.edit().putStringSet("airports", defaultSet).commit(); currentSet = defaultSet;//from ww w. j a v a2s .c om } // enable the nav spinner, which we'll use to pick which airport to look // at ActionBar bar = getActionBar(); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); ArrayList<String> currentList = new ArrayList<String>(); currentList.addAll(currentSet); Collections.sort(currentList); adapter = new ArrayAdapter<CharSequence>(bar.getThemedContext(), android.R.layout.simple_spinner_dropdown_item); adapter.addAll(currentList); bar.setListNavigationCallbacks(adapter, new OnNavigationListener() { @Override public boolean onNavigationItemSelected(int arg0, long arg1) { // this re-ups the data whenever the user changes the current // airport startAsyncFetch(adapter.getItem(arg0).toString()); return true; } }); // Let's set up a fancy new v2 MapView, for the lulz mapFragment = new SupportMapFragment(); pagerAdapter = new TwoFragmentPagerAdapter(this, getSupportFragmentManager(), new DetailsFragment(), mapFragment); viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setAdapter(pagerAdapter); viewPager.setOnPageChangeListener(this); // No placemarker on the map because I've always secretly hated that // glyph }
From source file:com.herasymc.cmput301counter.CounterSummaryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_counter_summary); list = CounterList.getInstance(getApplicationContext()); id = (int) getIntent().getLongExtra("id", -1); // if id is -1, summarize all counters // Set up the action bar to show a dropdown list. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); // Set up the dropdown list navigation in the action bar. actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1,//w ww .ja v a 2 s . co m new String[] { getString(R.string.title_summary_minute), getString(R.string.title_summary_hour), getString(R.string.title_summary_day), getString(R.string.title_summary_week), getString(R.string.title_summary_month) }), this); }
From source file:org.floens.chan.ui.activity.BoardActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boardFragment = ThreadFragment.newInstance(this); threadFragment = ThreadFragment.newInstance(this); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.left_pane, boardFragment); ft.replace(R.id.right_pane, threadFragment); ft.commitAllowingStateLoss();/*w w w .j a va 2s. c o m*/ final ActionBar actionBar = getActionBar(); actionBar.setListNavigationCallbacks( new ArrayAdapter<String>(actionBar.getThemedContext(), R.layout.board_select_spinner, android.R.id.text1, ChanApplication.getBoardManager().getSavedKeys()), this); updatePaneState(); updateActionBarState(); Intent startIntent = getIntent(); Uri startUri = startIntent.getData(); if (savedInstanceState != null) { threadLoadable.readFromBundle(this, "thread", savedInstanceState); startLoadingThread(threadLoadable); // Reset page etc. Loadable tmp = new Loadable(); tmp.readFromBundle(this, "board", savedInstanceState); loadBoard(tmp.board); } else { if (startUri != null) { handleIntentURI(startUri); } if (boardLoadable.mode == Loadable.Mode.INVALID) { List<String> savedValues = ChanApplication.getBoardManager().getSavedValues(); if (savedValues.size() > 0) { loadBoard(savedValues.get(0)); } } } }
From source file:cz.zcu.kiv.eeg.mobile.base.ui.NavigationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.base);/*from www . j a v a2 s . com*/ SharedPreferences credentials = getSharedPreferences(Values.PREFS_CREDENTIALS, Context.MODE_PRIVATE); username = credentials.getString("username", null); password = credentials.getString("password", null); SYNC_URL = credentials.getString("url", null); db = new CBDatabase(Keys.DB_NAME, NavigationActivity.this); startSync(); db = new CBDatabase(Keys.DB_NAME, NavigationActivity.this); UserProfile logged_up = db.fetchUserProfileData(); String loggedUserId = logged_up.getUserId(); String loggedUserName = logged_up.getUserName(); // String getDefaultResgrpId = db.fetchDefaultResearchGroup(getLoggedUserId); SharedPreferences tempData = getSharedPreferences(Values.PREFS_TEMP, Context.MODE_PRIVATE); SharedPreferences.Editor editor = tempData.edit(); if (loggedUserId == null) { Toast.makeText(NavigationActivity.this, "Error in pulling user profile data", Toast.LENGTH_LONG).show(); } else { Toast.makeText(NavigationActivity.this, "user id= " + loggedUserId + " userName=" + loggedUserName, Toast.LENGTH_LONG).show(); editor.putString("loggedUserDocID", loggedUserId); editor.putString("loggedUserName", loggedUserName); editor.commit(); } // if(getDefaultResgrpId==null){ // Toast.makeText(NavigationActivity.this,"Error in pulling def res grp",Toast.LENGTH_LONG).show(); // }else{ // Toast.makeText(NavigationActivity.this,"def res grp id= "+getDefaultResgrpId,Toast.LENGTH_LONG).show(); // editor.putString("loggedUserDefGrpID", getDefaultResgrpId); // editor.commit(); // } Database database = db.getDatabase(); Toast.makeText(NavigationActivity.this, "doc count= " + database.getDocumentCount(), Toast.LENGTH_LONG) .show(); final ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); // Locate DrawerLayout in drawer_main.xml drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); ListAdapter drawerAdapter = new MenuAdapter(actionBar.getThemedContext(), R.layout.base_menu_row, getResources().getStringArray(R.array.sections_list_icons), getResources().getStringArray(R.array.sections_list)); drawerList.setAdapter(drawerAdapter); drawerList.setOnItemClickListener(this); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_navigation_drawer, R.string.nav_open, R.string.nav_close) { public void onDrawerClosed(View view) { super.onDrawerClosed(view); } public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; drawerLayout.setDrawerListener(drawerToggle); if (savedInstanceState == null) { openSection(0); } if (savedInstanceState != null) { previousFragment = savedInstanceState.getInt("previousFragment", 0); } }
From source file:com.google.adsensequickstart.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); apiController = ApiController.getApiController(this); // Set up the action bar to show a dropdown list. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Set up the dropdown list navigation in the action bar. actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[] { getString(R.string.title_section1), getString(R.string.title_section2), getString(R.string.title_section3) }), this); }
From source file:com.aknowledge.v1.automation.RemoteActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_remote); myApp = (PyHomeController) getApplication(); final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[] { "All" }), this); }