android.app.ActionBar Java Examples

The following examples show how to use android.app.ActionBar. 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: DialtactsActivity.java    From coursera-android with MIT License 6 votes vote down vote up
@Override
public void onPageSelected(int position) {
    if (DEBUG) Log.d(TAG, "onPageSelected: position: " + position);
    final ActionBar actionBar = getActionBar();
    if (mDialpadFragment != null) {
        if (mDuringSwipe && position == TAB_INDEX_DIALER) {
            // TODO: Figure out if we want this or not. Right now
            // - with this call, both fake buttons and real action bar overlap
            // - without this call, there's tiny flicker happening to search/menu buttons.
            // If we can reduce the flicker without this call, it would be much better.
            // updateFakeMenuButtonsVisibility(true);
        }
    }

    if (mCurrentPosition == position) {
        Log.w(TAG, "Previous position and next position became same (" + position + ")");
    }

    actionBar.selectTab(actionBar.getTabAt(position));
    mNextPosition = position;
}
 
Example #2
Source File: UDActionBar.java    From VideoOS-Android-SDK with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Varargs invoke(Varargs args) {
     ActionBar actionBar = LuaViewUtil.getActionBar(getGlobals());
    if (actionBar != null) {
         CharSequence title = actionBar.getTitle();
        if (!TextUtils.isEmpty(title)) {
            return valueOf(title.toString());
        } else {
             View view = actionBar.getCustomView();
            if (view != null) {
                 Object tag = view.getTag(Constants.RES_LV_TAG);
                return tag instanceof LuaValue ? (LuaValue) tag : NIL;
            }
        }
    }
    return NIL;
}
 
Example #3
Source File: MainActivity.java    From KrGallery with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 隐藏状态栏
 * <p>
 * 在setContentView前调用
 */
protected void hideStatusBar() {
    final int sdkVer = Build.VERSION.SDK_INT;
    if (sdkVer < 16) {
        //4.0及一下
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
    }
}
 
Example #4
Source File: MainActivity.java    From desCharts with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.ac_main);
   
   // setup the action bar to show a dropdown list
   final ActionBar aBar = getActionBar();
   aBar.setDisplayShowTitleEnabled(false);
   aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

   // setup the dropdown list navigation in the action bar
   aBar.setListNavigationCallbacks(
      new ArrayAdapter<String>(aBar.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),
                        getString(R.string.title_section4),
                        getString(R.string.title_section5),
                        getString(R.string.title_section6)  } ),this);
}
 
Example #5
Source File: WebViewActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    Intent intent = getIntent();
    String title = intent.getStringExtra(getString(R.string.webview_intent_title));
    String subTitle = intent.getStringExtra(getString(R.string.webview_intent_subtitle));

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(title);
    actionBar.setSubtitle(subTitle);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fragment = (WebViewFragment) getSupportFragmentManager().findFragmentById(R.id.webview_fragment);

    preferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
    editor = preferences.edit();

    layoutParams = getWindow().getAttributes();
}
 
Example #6
Source File: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	// setup action bar for tabs
	ActionBar actionBar = getActionBar();
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
	actionBar.setDisplayShowTitleEnabled(false);

	Tab tab = actionBar
			.newTab()
			.setText("First tab")
			.setTabListener(
					new MyTabListener<DetailFragment>(this, "artist",
							DetailFragment.class));
	actionBar.addTab(tab);

	tab = actionBar
			.newTab()
			.setText("Second Tab")
			.setTabListener(
					new MyTabListener<ImageFragment>(this, "album",
							ImageFragment.class));
	actionBar.addTab(tab);

}
 
Example #7
Source File: PXVirtualActionBarSplitAdapter.java    From pixate-freestyle-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean updateStyle(List<PXRuleSet> ruleSets, List<PXStylerContext> contexts) {
    if (!super.updateStyle(ruleSets, contexts)) {
        return false;
    }

    PXStylerContext context = contexts.get(0);
    ActionBar actionBar = (ActionBar) context.getStyleable();
    // We just overwrite the exiting background. No states merging here.
    RectF bounds = PXActionBarStyleAdapter.getActionBarBounds(actionBar);
    if (PixateFreestyle.ICS_OR_BETTER) {
        setBackgroundICS(context, actionBar, bounds);
    } else {
        // TODO - add a compatible call for earlier API
        if (PXLog.isLogging()) {
            PXLog.w(getClass().getSimpleName(),
                    "Unable to set ActionBar split background. API version < 14.");
        }
    }
    return true;
}
 
Example #8
Source File: CoreMaterialActivity.java    From MaterialDesignSupport with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.core_material);

    if (isActionBarNecessary() == false) {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
        return;
    }

    setupActionBarVisibility();
    setupActionBarAttributes();
    setupLeftNavigationMenu();
    setupLeftNavigationClickListener();
}
 
Example #9
Source File: DuoDrawerToggleHoneycomb.java    From duo-navigation-drawer with Apache License 2.0 6 votes vote down vote up
public static SetIndicatorInfo setActionBarDescription(SetIndicatorInfo info, Activity activity,
                                                       int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    if (info.setHomeAsUpIndicator != null) {
        try {
            final ActionBar actionBar = activity.getActionBar();
            info.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
            if (Build.VERSION.SDK_INT <= 19) {
                // For API 19 and earlier, we need to manually force the
                // action bar to generate a new content description.
                actionBar.setSubtitle(actionBar.getSubtitle());
            }
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return info;
}
 
Example #10
Source File: MainActivity.java    From NexusData with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    getActionBar().setListNavigationCallbacks(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Arrays.asList("Todo", "Completed")), new ActionBar.OnNavigationListener() {
        @Override
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            if (itemPosition == 0) {
                displayMode = DisplayMode.TODO;
            } else {
                displayMode = DisplayMode.COMPLETED;
            }
            refreshUI();
            return true;
        }
    });

    listView = (ListView)findViewById(R.id.todo_tasks_list);

    refreshUI();
}
 
Example #11
Source File: ArticleCollectionActivity.java    From aard2-android with GNU General Public License v3.0 6 votes vote down vote up
private void updateTitle(int position) {
    Log.d("updateTitle", ""+position + " count: " + articleCollectionPagerAdapter.getCount());
    Slob.Blob blob = articleCollectionPagerAdapter.get(position);
    CharSequence pageTitle = articleCollectionPagerAdapter.getPageTitle(position);
    Log.d("updateTitle", ""+blob);
    ActionBar actionBar = getActionBar();
    if (blob != null) {
        String dictLabel = blob.owner.getTags().get("label");
        actionBar.setTitle(dictLabel);
        Application app = (Application)getApplication();
        app.history.add(app.getUrl(blob));
    }
    else {
        actionBar.setTitle("???");
    }
    actionBar.setSubtitle(pageTitle);
}
 
Example #12
Source File: ActionbarUtil.java    From buddycloud-android with Apache License 2.0 6 votes vote down vote up
@SuppressLint("NewApi")
private static void setActionBar(final ActionBar actionBar, 
		final com.actionbarsherlock.app.ActionBar sherlockActionBar, 
		final int iconResc) {
	if (actionBar == null || sherlockActionBar == null) return;
	
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
		actionBar.setHomeAsUpIndicator(iconResc);
		sherlockActionBar.setDisplayHomeAsUpEnabled(true);
		sherlockActionBar.setHomeButtonEnabled(true);
	} else {
		sherlockActionBar.setLogo(iconResc);
		sherlockActionBar.setDisplayUseLogoEnabled(true);
		sherlockActionBar.setDisplayHomeAsUpEnabled(true);
		sherlockActionBar.setHomeButtonEnabled(true);
	}
}
 
Example #13
Source File: MainActivity.java    From pixate-freestyle-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    Tab tab = actionBar.newTab().setText(R.string.tab1_title)
            .setTabListener(new TabListener(this, Fragment1.class.getName()));
    actionBar.addTab(tab);
    tab = actionBar.newTab().setText(R.string.tab2_title)
            .setTabListener(new TabListener(this, Fragment2.class.getName()));
    actionBar.addTab(tab);
    tab = actionBar.newTab().setText(R.string.tab3_title)
            .setTabListener(new TabListener(this, Fragment3.class.getName()));
    actionBar.addTab(tab);

    // Initiate Pixate
    PixateFreestyle.init(this);
}
 
Example #14
Source File: ActionBarDrawerToggleHoneycomb.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
public static Object setActionBarDescription(Object info, Activity activity,
        int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    final SetIndicatorInfo sii = (SetIndicatorInfo) info;
    if (sii.setHomeAsUpIndicator != null) {
        try {
            final ActionBar actionBar = activity.getActionBar();
            sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
            if (Build.VERSION.SDK_INT <= 19) {
                // For API 19 and earlier, we need to manually force the
                // action bar to generate a new content description.
                actionBar.setSubtitle(actionBar.getSubtitle());
            }
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return info;
}
 
Example #15
Source File: QrReaderView.java    From flutter_qr_reader with MIT License 6 votes vote down vote up
public QrReaderView(Context context, PluginRegistry.Registrar registrar, int id, Map<String, Object> params){
    this.mContext = context;
    this.mParams = params;
    this.mRegistrar = registrar;

    // 创建视图
    int width = (int) mParams.get("width");
    int height = (int) mParams.get("height");
    _view = new QRCodeReaderView(mContext);
    ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(width, height);
    _view.setLayoutParams(layoutParams);
    _view.setOnQRCodeReadListener(this);
    _view.setQRDecodingEnabled(true);
    _view.forceAutoFocus();
    int interval = mParams.containsKey(EXTRA_FOCUS_INTERVAL) ? (int) mParams.get(EXTRA_FOCUS_INTERVAL) : 2000;
    _view.setAutofocusInterval(interval);
    _view.setTorchEnabled((boolean)mParams.get(EXTRA_TORCH_ENABLED));

    // 操作监听
    mMethodChannel = new MethodChannel(registrar.messenger(), "me.hetian.flutter_qr_reader.reader_view_" + id);
    mMethodChannel.setMethodCallHandler(this);
}
 
Example #16
Source File: NavigationDrawerFragment.java    From MultiSlider with Apache License 2.0 5 votes vote down vote up
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example #17
Source File: ActionBarDrawerToggleHoneycomb.java    From Overchan-Android with GNU General Public License v3.0 5 votes vote down vote up
SetIndicatorInfo(Activity activity) {
    try {
        setHomeAsUpIndicator = ActionBar.class.getDeclaredMethod("setHomeAsUpIndicator",
                Drawable.class);
        setHomeActionContentDescription = ActionBar.class.getDeclaredMethod(
                "setHomeActionContentDescription", Integer.TYPE);

        // If we got the method we won't need the stuff below.
        return;
    } catch (NoSuchMethodException e) {
        // Oh well. We'll use the other mechanism below instead.
    }

    final View home = activity.findViewById(android.R.id.home);
    if (home == null) {
        // Action bar doesn't have a known configuration, an OEM messed with things.
        return;
    }

    final ViewGroup parent = (ViewGroup) home.getParent();
    final int childCount = parent.getChildCount();
    if (childCount != 2) {
        // No idea which one will be the right one, an OEM messed with things.
        return;
    }

    final View first = parent.getChildAt(0);
    final View second = parent.getChildAt(1);
    final View up = first.getId() == android.R.id.home ? second : first;

    if (up instanceof ImageView) {
        // Jackpot! (Probably...)
        upIndicatorView = (ImageView) up;
    }
}
 
Example #18
Source File: PresentationActivity.java    From MaterialDesignSupport with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getActionBar();
    actionBar.show();
    actionBar.setTitle(null);
    actionBar.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
 
Example #19
Source File: FaBoPinListActivity.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fabo_pin_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    setTitle(R.string.activity_fabo_virtual_service_pin_title);

    ProfileData p = getIntent().getParcelableExtra("profile");
    if (ProfileDataUtil.isMultiChoicePin(p)) {
        showPinFragment(new FaBoPinCheckBoxFragment());
    } else {
        showPinFragment(new FaBoPinRadioGroupFragment());
    }

    Button saveBtn = findViewById(R.id.activity_fabo_pin_save_btn);
    saveBtn.setOnClickListener((view) -> {
        savePinList();
    });

    // バックキーを押下された時を考慮してキャンセルを設定しておく
    setResult(RESULT_CANCELED, new Intent());
}
 
Example #20
Source File: PreferencesActivity.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setTitle(R.string.preferences);
		
		ActionBar actionBar = getActionBar();
		actionBar.setDisplayShowTitleEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setHomeButtonEnabled(true);
		actionBar.setLogo(this.getResources().getDrawable(R.drawable.ic_action_up));
		actionBar.setDisplayUseLogoEnabled(true);
		
		addPreferencesFromResource(R.xml.preferences);
		
//		lockScreenMode = (ListPreference) findPreference(Preferences.Keys.LOCK_SCREEN_MODE);
//		updateSummaryWithChoice(lockScreenMode, lockScreenMode.getValue(), getResources().getStringArray(R.array.lockScreenOptions_));

		language = (ListPreference) findPreference(Preferences.Keys.LANGUAGE);
		updateSummaryWithChoice(language, language.getValue(), getResources().getStringArray(R.array.languages_));
		
		//originalImage = (ListPreference) findPreference(Models.IUser.ASSET_ENCRYPTION);
		//updateSummaryWithChoice(originalImage, originalImage.getValue(), getResources().getStringArray(R.array.originalImageOptions_));

		panicAction = (ListPreference) findPreference(Preferences.Keys.PANIC_ACTION);
		updateSummaryWithChoice(panicAction, panicAction.getValue(), getResources().getStringArray(R.array.panicActionOptions_));
	}
 
Example #21
Source File: PlayerActivity.java    From FlutterYoutube with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        if (getIntent().getBooleanExtra("appBarVisible", false)) {
            setupActionBarColor(actionBar);
        } else {
            actionBar.hide();
        }
    }

    API_KEY = getIntent().getStringExtra("api");
    videoId = getIntent().getStringExtra("videoId");
    goFullScreen = getIntent().getBooleanExtra("fullScreen", false);
    autoPlay = getIntent().getBooleanExtra("autoPlay", false);
    backgroundColor = getIntent().getIntExtra("backgroundColor" , 0xFF1b1b1b);

    final RelativeLayout rootView = (RelativeLayout) findViewById(R.id.root_view);
    rootView.setBackgroundColor(backgroundColor);
    getWindow().getDecorView().setBackgroundColor(backgroundColor);

    youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
    youTubeView.initialize(API_KEY, this);
}
 
Example #22
Source File: FeedBack.java    From MainScreenShow with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	
	super.onCreate(savedInstanceState);
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayUseLogoEnabled(false);
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayShowHomeEnabled(false);
	setContentView(R.layout.activity_feedback);
	
	content = (EditText) findViewById(R.id.edit_fb);
	qq = (EditText) findViewById(R.id.edit_fb_qq);
	
}
 
Example #23
Source File: CustomView.java    From GmailLikePullToRefresh with Apache License 2.0 5 votes vote down vote up
public CustomView(Context context, ActionBar actionbar) {
    super(context);
    component = CustomComponent.CustomComponentInstance();

    if (actionbar == null) {
        isActionBarDisabled = true;
    } else {
        actionBarView = actionbar;
        component.actionBarDisplayOptions = actionBarView.getDisplayOptions();
    }
    init(context);
}
 
Example #24
Source File: NavigationDrawerFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example #25
Source File: CommonUtils.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
private static int getSmartBarHeight(Activity activity) {
    ActionBar actionbar = activity.getActionBar();
    if (actionbar != null)
        try {
            Class c = Class.forName("com.android.internal.R$dimen");
            Object obj = c.newInstance();
            Field field = c.getField("mz_action_button_min_height");
            int height = Integer.parseInt(field.get(obj).toString());
            return activity.getResources().getDimensionPixelSize(height);
        } catch (Exception e) {
            e.printStackTrace();
            actionbar.getHeight();
        }
    return 0;
}
 
Example #26
Source File: InterstitialActivity.java    From MaterialDesignSupport with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getActionBar();
    actionBar.show();
    actionBar.setTitle(null);
    actionBar.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    interstitialFragment = new InterstitialFragment();
    addFragment(interstitialFragment, InterstitialFragment.TAG);
}
 
Example #27
Source File: ActionBarHelperNative.java    From WayHoo with Apache License 2.0 5 votes vote down vote up
SetIndicatorInfo(Activity activity) {
    try {
        setHomeAsUpIndicator = ActionBar.class.getDeclaredMethod("setHomeAsUpIndicator", Drawable.class);
        setHomeActionContentDescription = ActionBar.class.getDeclaredMethod(
                "setHomeActionContentDescription", Integer.TYPE);

        // If we got the method we won't need the stuff below.
        return;
    } catch (Throwable t) {
        // Oh well. We'll use the other mechanism below instead.
    }

    final View home = activity.findViewById(android.R.id.home);
    if (home == null) {
        // Action bar doesn't have a known configuration, an OEM messed with things.
        return;
    }

    final ViewGroup parent = (ViewGroup) home.getParent();
    final int childCount = parent.getChildCount();
    if (childCount != 2) {
        // No idea which one will be the right one, an OEM messed with things.
        return;
    }

    final View first = parent.getChildAt(0);
    final View second = parent.getChildAt(1);
    final View up = first.getId() == android.R.id.home ? second : first;

    if (up instanceof ImageView) {
        // Jackpot! (Probably...)
        upIndicatorView = (ImageView) up;
    }
}
 
Example #28
Source File: Preferences.java    From XInstaller with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, parent, savedInstanceState);

    WebView v = new WebView(getActivity());

    ActionBar ab = getActivity().getActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setHomeButtonEnabled(true);
    }
    return v;
}
 
Example #29
Source File: GalleryFragment.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	super.onCreateOptionsMenu(menu, inflater);
	inflater.inflate(R.menu.activity_home_gallery, menu);

	MenuItem menuFilter = menu.findItem(R.id.menu_filter);
	Spinner spinner = (Spinner) menuFilter.getActionView();
	GalleryFilterAdapter spinnerAdapter = new GalleryFilterAdapter(spinner.getContext(), this.getResources().getTextArray(R.array.filter_options));
	spinner.setAdapter(spinnerAdapter);
	spinner.setOnItemSelectedListener(this);
	
	mMenuItemBatchOperations = menu.findItem(R.id.menu_select);
	
	miDropbox = menu.findItem(R.id.menu_remote_access_dropbox);
	DropboxSyncManager dsm = DropboxSyncManager.getInstance(a);
	if (dsm != null && dsm.isSyncing())
		miDropbox.setChecked(true);
	
	ActionBar actionBar = getActivity().getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.home_gallery_title);
	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(false);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setLogo(this.getResources().getDrawable(
			R.drawable.ic_action_up));
	actionBar.setDisplayUseLogoEnabled(true);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
Example #30
Source File: MainActivity.java    From jaop with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public ActionBar getActionBar() {
    try {
        ActionBar actionBar = super.getActionBar();
        return actionBar;
    } catch (Exception e) {
        return null;
    }
}