Example usage for android.app ActionBar show

List of usage examples for android.app ActionBar show

Introduction

In this page you can find the example usage for android.app ActionBar show.

Prototype

public abstract void show();

Source Link

Document

Show the ActionBar if it is not currently showing.

Usage

From source file:com.example.camera360.ui.ImageDetailActivity.java

@SuppressWarnings("unchecked")
@TargetApi(11)/*from  w  w  w .  ja va  2 s  .  c  o  m*/
@Override
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    arrayList = (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra(IMAGE_URL);

    // Fetch screen height and width, to use as our max size when loading
    // images as this
    // activity runs full screen

    baseAnimate = new BaseAnimate();

    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our
    // images. As the
    // image scaling ensures the image is larger than this, we should be
    // left with a
    // resolution that is appropriate for both portrait and landscape. For
    // best image quality
    // we shouldn't divide by 2, but this will use more memory and require a
    // larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of
    // app memory

    mImageDetailLayout = (FrameLayout) findViewById(R.id.image_detail_layout);

    mImageDetailView = (LinearLayout) findViewById(R.id.image_detail);

    // The ImageFetcher takes care of loading images into our ImageView
    // children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), arrayList.size());

    mInflater = LayoutInflater.from(mImageDetailLayout.getContext());

    mPager = (ViewPager) findViewById(R.id.view_pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to
    // create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        final ActionBar actionBar = getActionBar();

        // Hide title text and set home as up
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    actionBar.hide();
                } else {
                    actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);

    currentIndex = extraCurrentItem;

    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }

    mPager.setOnPageChangeListener(new ImageOnPageChangeListener());

    initHeaderMenu();

    addFooterMenu();

    initImageDetail();

    setImageInfo();
}

From source file:de.bahnhoefe.deutschlands.bahnhofsfotos.DetailsActivity.java

public void onPictureClicked() {
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && !fullscreen) {
        ValueAnimator animation = ValueAnimator.ofFloat(header.getAlpha(), 0f);
        animation.setDuration(500);//w  ww.j a v  a  2 s .c  o  m
        animation.addUpdateListener(new AnimationUpdateListener());
        animation.start();
        detailsLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_IMMERSIVE);
        ActionBar bar = getActionBar();
        if (bar != null)
            bar.hide();
        android.support.v7.app.ActionBar sbar = getSupportActionBar();
        if (sbar != null)
            sbar.hide();
        fullscreen = true;
    } else {
        ValueAnimator animation = ValueAnimator
                .ofFloat(header == null ? tvBahnhofName.getAlpha() : header.getAlpha(), 1.0f);
        animation.setDuration(500);
        animation.addUpdateListener(new AnimationUpdateListener());
        animation.start();
        detailsLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
        ActionBar bar = getActionBar();
        if (bar != null)
            bar.show();
        android.support.v7.app.ActionBar sbar = getSupportActionBar();
        if (sbar != null)
            sbar.show();
        fullscreen = false;
    }

}

From source file:org.opendatakit.survey.activities.MainMenuActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    PropertiesSingleton props = CommonToolProperties.get(this, getAppName());

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;/*from  w  w  w . ja va2  s .c  o  m*/
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setCustomView(R.layout.action_bar);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, R.string.sync);
        item.setIcon(R.drawable.ic_cached_black_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, R.string.about);
        item.setIcon(R.drawable.ic_info_outline_black_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java

/**
 * This creates the WebKit. We need all our values initialized by this point.
 *///from www.j av  a  2  s .  c o  m
private void assignContentView() {
    setContentView(R.layout.main_screen);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO);
    actionBar.show();
}

From source file:org.opendatakit.survey.activities.MainMenuActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // android.os.Debug.waitForDebugger();
    submenuPage = getIntentExtras().getString("_sync_state");
    try {/*from   ww  w  .  j av  a  2  s .com*/
        // ensure that we have a BackgroundTaskFragment...
        // create it programmatically because if we place it in the
        // layout XML, it will be recreated with each screen rotation
        // and we don't want that!!!
        mPropertyManager = new PropertyManager(this);

        // must be at the beginning of any activity that can be called from an
        // external intent
        setAppName(ODKFileUtils.getOdkDefaultAppName());
        Uri uri = getIntent().getData();
        Uri formUri = null;
        if (uri != null) {
            // initialize to the URI, then we will customize further based upon the
            // savedInstanceState...
            final Uri uriFormsProvider = FormsProviderAPI.CONTENT_URI;
            final Uri uriWebView = UrlUtils.getWebViewContentUri(this);
            if (uri.getScheme().equalsIgnoreCase(uriFormsProvider.getScheme())
                    && uri.getAuthority().equalsIgnoreCase(uriFormsProvider.getAuthority())) {
                List<String> segments = uri.getPathSegments();
                if (segments != null && segments.size() == 1) {
                    String appName = segments.get(0);
                    setAppName(appName);
                } else if (segments != null && segments.size() >= 2) {
                    String appName = segments.get(0);
                    setAppName(appName);
                    String tableId = segments.get(1);
                    String formId = (segments.size() > 2) ? segments.get(2) : null;
                    formUri = Uri.withAppendedPath(Uri.withAppendedPath(
                            Uri.withAppendedPath(FormsProviderAPI.CONTENT_URI, appName), tableId), formId);
                } else {
                    createErrorDialog(getString(R.string.invalid_uri_expecting_n_segments, uri.toString(), 2),
                            EXIT);
                    return;
                }
            } else if (uri.getScheme().equals(uriWebView.getScheme())
                    && uri.getAuthority().equals(uriWebView.getAuthority())
                    && uri.getPort() == uriWebView.getPort()) {
                List<String> segments = uri.getPathSegments();
                if (segments != null && segments.size() == 1) {
                    String appName = segments.get(0);
                    setAppName(appName);
                } else {
                    createErrorDialog(getString(R.string.invalid_uri_expecting_one_segment, uri.toString()),
                            EXIT);
                    return;
                }

            } else {
                createErrorDialog(getString(R.string.unrecognized_uri, uri.toString(), uriWebView.toString(),
                        uriFormsProvider.toString()), EXIT);
                return;
            }
        }

        if (savedInstanceState != null) {
            // if appName is explicitly set, use it...
            setAppName(savedInstanceState.containsKey(IntentConsts.INTENT_KEY_APP_NAME)
                    ? savedInstanceState.getString(IntentConsts.INTENT_KEY_APP_NAME)
                    : getAppName());

            if (savedInstanceState.containsKey(CONFLICT_TABLES)) {
                mConflictTables = savedInstanceState.getBundle(CONFLICT_TABLES);
            }
        }

        try {
            String appName = getAppName();
            if (appName != null && appName.length() != 0) {
                ODKFileUtils.verifyExternalStorageAvailability();
                ODKFileUtils.assertDirectoryStructure(appName);
            }
        } catch (RuntimeException e) {
            createErrorDialog(e.getMessage(), EXIT);
            return;
        }

        WebLogger.getLogger(getAppName()).i(t, "Starting up, creating directories");

        if (savedInstanceState != null) {
            // if we are restoring, assume that initialization has already occurred.

            dispatchStringWaitingForData = savedInstanceState.containsKey(DISPATCH_STRING_WAITING_FOR_DATA)
                    ? savedInstanceState.getString(DISPATCH_STRING_WAITING_FOR_DATA)
                    : null;
            actionWaitingForData = savedInstanceState.containsKey(ACTION_WAITING_FOR_DATA)
                    ? savedInstanceState.getString(ACTION_WAITING_FOR_DATA)
                    : null;

            currentFragment = ScreenList.valueOf(savedInstanceState.containsKey(CURRENT_FRAGMENT)
                    ? savedInstanceState.getString(CURRENT_FRAGMENT)
                    : currentFragment.name());

            if (savedInstanceState.containsKey(FORM_URI)) {
                FormIdStruct newForm = FormIdStruct.retrieveFormIdStruct(getContentResolver(),
                        Uri.parse(savedInstanceState.getString(FORM_URI)));
                if (newForm != null) {
                    setAppName(newForm.appName);
                    setCurrentForm(newForm);
                }
            }
            setInstanceId(
                    savedInstanceState.containsKey(INSTANCE_ID) ? savedInstanceState.getString(INSTANCE_ID)
                            : getInstanceId());
            setUploadTableId(savedInstanceState.containsKey(UPLOAD_TABLE_ID)
                    ? savedInstanceState.getString(UPLOAD_TABLE_ID)
                    : getUploadTableId());

            String tmpScreenPath = savedInstanceState.containsKey(SCREEN_PATH)
                    ? savedInstanceState.getString(SCREEN_PATH)
                    : getScreenPath();
            String tmpControllerState = savedInstanceState.containsKey(CONTROLLER_STATE)
                    ? savedInstanceState.getString(CONTROLLER_STATE)
                    : getControllerState();
            setSectionScreenState(tmpScreenPath, tmpControllerState);

            setAuxillaryHash(savedInstanceState.containsKey(AUXILLARY_HASH)
                    ? savedInstanceState.getString(AUXILLARY_HASH)
                    : getAuxillaryHash());

            if (savedInstanceState.containsKey(SESSION_VARIABLES)) {
                sessionVariables = savedInstanceState.getBundle(SESSION_VARIABLES);
            }

            if (savedInstanceState.containsKey(SECTION_STATE_SCREEN_HISTORY)) {
                sectionStateScreenHistory = savedInstanceState
                        .getParcelableArrayList(SECTION_STATE_SCREEN_HISTORY);
            }

            if (savedInstanceState.containsKey(QUEUED_ACTIONS)) {
                String[] actionOutcomesArray = savedInstanceState.getStringArray(QUEUED_ACTIONS);
                queuedActions.clear();
                queuedActions.addAll(Arrays.asList(actionOutcomesArray));
            }

            if (savedInstanceState != null && savedInstanceState.containsKey(RESPONSE_JSON)) {
                String[] pendingResponseJSON = savedInstanceState.getStringArray(RESPONSE_JSON);
                queueResponseJSON.addAll(Arrays.asList(pendingResponseJSON));
            }
        } else if (formUri != null) {
            // request specifies a specific formUri -- try to open that
            FormIdStruct newForm = FormIdStruct.retrieveFormIdStruct(getContentResolver(), formUri);
            if (newForm == null) {
                // can't find it -- launch the initialization dialog to hopefully
                // discover it.
                WebLogger.getLogger(getAppName()).i(t, "onCreate -- calling setRunInitializationTask");
                ((Survey) getApplication()).setRunInitializationTask(getAppName());
                currentFragment = ScreenList.WEBKIT;
            } else {
                transitionToFormHelper(uri, newForm);
            }
        }
    } catch (Exception e) {
        createErrorDialog(e.getMessage(), EXIT);
    } finally {
        setContentView(R.layout.main_screen);

        ActionBar actionBar = getActionBar();
        actionBar.show();
    }
}

From source file:com.xenon.greenup.MainActivity.java

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical parent.
    actionBar.setHomeButtonEnabled(false);

    //Set the stacked background otherwise we get the gross dark gray color under the icon
    BitmapDrawable background = (BitmapDrawable) getResources().getDrawable(R.drawable.bottom_menu);
    background.setTileModeXY(TileMode.REPEAT, TileMode.MIRROR);
    actionBar.setStackedBackgroundDrawable(background);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setIcon(R.drawable.bottom_menu);

    _ViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, _ViewPager);

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < 3; i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.

        ActionBar.Tab tabToAdd = actionBar.newTab();
        if (i == 0)
            //Set the home page as active since we'll start there:
            tabToAdd.setIcon(getActiveIcon(i));
        else/*from  w  ww  .j a v a 2  s.  c om*/
            tabToAdd.setIcon(getRegularIcon(i));
        mTabsAdapter.addTab(tabToAdd);

    }

    //Setting the display to custom will push the action bar to the top
    //which gives us more real estate
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.show();
    Log.i("visible", "" + _ViewPager.VISIBLE);

}

From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;// w w w.  ja  va 2  s .  c o m
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button));
        item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption);

        // Using a file for this work now
        String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK);
        if (get.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption);

            item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption);
        }

        String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED);
        if (send.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data));
            item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption);
        }

        String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS);
        if (manage.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files));
            item.setIcon(R.drawable.trash).setShowAsAction(showOption);
        }

        String settings = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_ACCESS_SETTINGS);
        if (settings.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences));
            item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption);
        }
        item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences));
        item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption);

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

From source file:org.path.episample.android.activities.MainMenuActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM;
    MenuItem item;//from w  w  w  .  j  a v a  2  s.  c  o  m
    if (currentFragment != ScreenList.WEBKIT) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.show();

        item = menu.add(Menu.NONE, MENU_MAIN_MENU, Menu.NONE, getString(R.string.main_menu));
        item.setIcon(R.drawable.ic_action_home).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

        //item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button));
        //item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption);

        // Using a file for this work now
        String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK);
        if (get.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms));
            item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption);

            //item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms));
            //item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption);
        }

        String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED);
        if (send.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data));
            item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption);
        }

        String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS);
        if (manage.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files));
            item.setIcon(R.drawable.trash).setShowAsAction(showOption);
        }

        String settings = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_ACCESS_SETTINGS);
        if (settings.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences));
            item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption);
        }
        item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences));
        item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption);

        String backup = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_BACKUP_CENSUS);
        if (backup != null && backup.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_BACKUP_CENSUS, Menu.NONE, getString(R.string.backup_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String restore = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_RESTORE_CENSUS);
        if (restore != null && restore.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_RESTORE_CENSUS, Menu.NONE, getString(R.string.restore_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String invalidateCensus = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_INVALIDATE_CENSUS);
        if (invalidateCensus != null && invalidateCensus.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_MARK_CENSUS_AS_INVALID, Menu.NONE,
                    getString(R.string.invalidate_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String edit = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_EDIT_CENSUS);
        if (edit != null && edit.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_EDIT_CENSUS, Menu.NONE, getString(R.string.edit_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        String removeCensus = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_REMOVE_CENSUS);
        if (removeCensus != null && removeCensus.equalsIgnoreCase("true")) {
            item = menu.add(Menu.NONE, MENU_REMOVE_CENSUS, Menu.NONE, getString(R.string.remove_census));
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }

        /*String send_receive_bt = PropertiesSingleton.getProperty(appName,
                AdminPreferencesActivity.KEY_SEND_RECEIVE_BLUETOOTH);
        if (send_receive_bt != null && send_receive_bt.equalsIgnoreCase("true")) {
           item = menu.add(Menu.NONE, MENU_SEND_REVEIVE_BLUETOOTH, Menu.NONE, getString(R.string.send_receive_bluetooth));
           item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }*/

        item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about));
        item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    } else {
        ActionBar actionBar = getActionBar();
        actionBar.hide();
    }

    return true;
}

From source file:com.moro.synapsemod.MainActivity.java

@SuppressWarnings("ConstantConditions")
private void continueCreate() {
    View v = LayoutInflater.from(this).inflate(R.layout.activity_main, null);

    mViewPager = (ViewPager) v.findViewById(R.id.mainPager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPagerPageChangeListener());
    mDrawerList = (ListView) v.findViewById(R.id.left_drawer);

    String[] section_titles = new String[Utils.configSections.size()];
    for (int i = 0; i < Utils.configSections.size(); i++)
        section_titles[i] = Utils.localise(((JSONObject) Utils.configSections.get(i)).get("name"));

    mDrawerList.setAdapter(new ArrayAdapter<>(this, R.layout.drawer_item, section_titles));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    mDrawerList.setItemChecked(0, true);

    mDrawerLayout = (DrawerLayout) v.findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_action_drawer,
            R.string.drawer_open, R.string.drawer_close);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    ActionBar actionBar = getActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    mDrawerToggle.syncState();//from  w  w w  . j  ava  2s .c  o  m

    // Comprobamos "aplicar_cambios_auto" si esta activo cancelamos para que deje entrar al nuevo perfil
    SharedPreferences prefs = getSharedPreferences("moro_prefs", Context.MODE_PRIVATE);
    int auto = prefs.getInt("aplicar_cambios_auto", 0);

    // Si es 1 cancelamos para que entre el perfil y reiniciamos
    if (auto == 1) {
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("aplicar_cambios_auto", 2);
        editor.commit();
        // cancelamos
        ActionValueUpdater.cancelElements();
        // reiniciamos
        Utils.runCommand("/res/synapse/uci restart", false);
    }
    // Si es 2 aplicamos para que coja los voltajes
    else if (auto == 2) {
        SharedPreferences.Editor editor = prefs.edit();
        editor.putInt("aplicar_cambios_auto", 0);
        editor.commit();
        // aplicamos
        ActionValueUpdater.applyElements();
    }
    // Si es 0 no hacemos nada
    else if (auto == 0)
        ActionValueUpdater.refreshButtons(true);

    for (TabSectionFragment f : fragments)
        f.onElementsMainStart();

    setContentView(v);
    actionBar.show();
    Utils.appStarted = true;

    setPaddingDimensions();
    L.i("Interface creation finished in " + (System.nanoTime() - startTime) + "ns");

    if (!BootService.getBootFlag() && !BootService.getBootFlagPending()) {
        new AlertDialog.Builder(this).setTitle(R.string.popup_failed_boot_title)
                .setMessage(R.string.popup_failed_boot_message).setCancelable(true)
                .setPositiveButton(R.string.popup_failed_boot_ack, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                }).show();
    }
}

From source file:com.plusot.senselib.SenseMain.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void addMap() {
    View view = findViewById(R.id.main_rootlayout);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);// w  ww  .j  ava2s  .  c  o m
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    map = new MyMapView(this);
    LLog.d(Globals.TAG, CLASSTAG + ".addMap: Map created");
    map.setZoom(14);
    //map.setMapListener(this);
    params.setMargins(0, 0, 0, 0);
    ((RelativeLayout) view).addView(map, 0, params);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && MAPVIEW_ID == 8000)
        MAPVIEW_ID = View.generateViewId();
    map.setId(MAPVIEW_ID);
    map.setOnTouchListener(new ClickableOverlay.Listener() {

        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        @Override
        public boolean onTouch(MapView mapView, MotionEvent event) {
            //LLog.d(Globals.TAG, CLASSTAG + ".Mapview.onTouch");
            if (Build.VERSION.SDK_INT >= 11) {
                ActionBar bar = getActionBar();
                if (bar != null && !bar.isShowing())
                    bar.show();
            }
            menuVisibleClicked = System.currentTimeMillis();

            return false;
        }

        @Override
        public boolean onClick(MapView mapView, MotionEvent event) {
            toggleValuesVisible();
            return false;
        }

    });

}