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.thelastcrusade.soundstream.CoreActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar bar = getActionBar();
    bar.show();

    //Get the GoogleAnalytics singleton. Note that the SDK uses
    // the application context to avoid leaking the current context.
    mGaInstance = GoogleAnalytics.getInstance(this);
    // Use the GoogleAnalytics singleton to get a Tracker.
    mGaTracker = mGaInstance.getTracker(getString(R.string.ga_trackingId));

    //set the layout for the content - this is just a placeholder
    setContentView(R.layout.content_frame);

    //set the layout for the menu
    setBehindContentView(R.layout.menu_frame);

    //add the menu
    menu = new MenuFragment();
    getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, menu).commit();

    playbar = new PlaybarFragment();
    getSupportFragmentManager().beginTransaction().replace(R.id.playbar, playbar).commit();

    //We want to start off at the connect page if this is the first time
    // the activity is created
    if (savedInstanceState == null) {
        Transitions.transitionToConnect(this);
    } else {//from   w  w  w .  j ava  2 s .  co  m
        enableSlidingMenu();
    }
    // setup the sliding bar
    setSlidingActionBarEnabled(false);
    getSlidingMenu().setBehindWidthRes(R.dimen.show_menu);
    createServiceLocators();
    registerReceivers();
}

From source file:de.ribeiro.android.gso.activities.PlanActivity.java

@SuppressLint("NewApi")
@Override/*from ww w. j a va 2  s.co  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ImageButton FAB;
    // Android Version prfen, wenn neuer als API11,
    Boolean actionBarAvailable = false;
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // ActionBar anfragen
        actionBarAvailable = getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    }
    _logger = new Logger(this, "PlanActivity");
    setContentView(R.layout.activity_plan);
    this.ctxt = new MyContext(this, this);

    Configuration c = getResources().getConfiguration();
    this.orientation = c.orientation;
    _logger.Info("Creating PlanActivity with orientation int: " + orientation);
    try {
        File f = new File(this.getCacheDir(), "date.bin");
        if (f.exists() && f.canRead()) {
            ctxt.mProfil.stupid.currentDate = (Calendar) FileOPs.loadObject(f);
            f.delete();
        }
    } catch (Exception e) {
        _logger.Error("An Error occurred while loading date.bin file", e);
    }

    ctxt.mProfil = new ProfilManager(ctxt).getCurrentProfil();
    ctxt.mProfil.setPrefs();
    LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
    lbm.registerReceiver(mMessageReceiver, new IntentFilter(Const.BROADCASTREFRESH));
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        int noticationId = extras.getInt("notificationId");

        if (noticationId != 0) {
            extras.remove("notificationId");
            //notication aus taskbar entfernen
            NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            nm.cancel(noticationId);
            Calendar date = new GregorianCalendar();
            date.setTimeInMillis(extras.getLong("date"));

            extras.remove("weekIndex");
            int profilIndex = extras.getInt("profilIndex");
            extras.remove("profilIndex");

            //alle Profile laden
            ProfilManager pm = new ProfilManager(ctxt);
            if (pm.profiles.size() >= pm.currentProfilIndex) {
                pm.profiles.get(pm.currentProfilIndex).setPrefs();
                if (profilIndex > pm.profiles.size() - 1)
                    profilIndex = 0;
                else
                    pm.currentProfilIndex = profilIndex;
                pm.applyProfilIndex();
                ctxt.mProfil.loadPrefs();
            }

            ctxt.mProfil.stupid.currentDate = date;

        }

        ctxt.newVersionReqSetup = extras.getBoolean("newVersionInfo", false);
    }

    ActionBar actionBar = getActionBar();
    if (ctxt.mIsRunning)
        actionBar.show();

    ctxt.executor.post(new PlanActivityLuncher(PlanActivity.this));

    //        FAB = (ImageButton) findViewById(R.id.imageButton);
    //        FAB.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                ctxt.getCurStupid().currentDate = new GregorianCalendar();
    //                ctxt.pager.setPage(ctxt.getCurStupid().currentDate);
    //            }
    //        });
}

From source file:org.jorge.lolin1.ui.activities.ChampionDetailFragmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    if (!preferences.getBoolean("showcase_champion_detail_done", Boolean.FALSE))
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    selectedChampion = getIntent().getParcelableExtra(SELECTED_CHAMPION);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_champion_detail);
    ActionBar actionBar;
    assert getActionBar() != null;
    if (findViewById(R.id.champion_title) != null) {
        //Portrait layout
        if (!(actionBar = getActionBar()).isShowing()) {
            actionBar.show();
        }//w  ww . jav a  2  s  . c o  m
        actionBar.setDisplayHomeAsUpEnabled(Boolean.TRUE);
        ((TextView) findViewById(R.id.champion_name)).setText(selectedChampion.getName());
        ((TextView) findViewById(R.id.champion_title)).setText(selectedChampion.getTitle());
        initChampionInfoPager();
        if (!preferences.getBoolean("showcase_champion_detail_done", Boolean.FALSE))
            detailShowcase = new ShowcaseView.Builder(this).setContentText(R.string.tutorial_detail_contents)
                    .setContentTitle(R.string.tutorial_detail_title)
                    .setStyle(R.style.CustomShowcaseThemePlusNoButton)
                    .setTarget(new ViewTarget(R.id.champion_detail_pager, this)).build();
        ChampionDetailFragmentActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((ImageView) findViewById(R.id.champion_bust))
                        .setImageDrawable(new BitmapDrawable(getResources(), ChampionManager.getInstance()
                                .getBustImageByChampion(200, 200, selectedChampion, getApplicationContext())));
            }
        });
    } else {
        //Landscape layout
        if ((actionBar = getActionBar()).isShowing()) {
            actionBar.hide();
        }
        skinsViewPager = ((ViewPager) findViewById(R.id.skins_view_pager));
        initChampionSkinsPager();
    }
}

From source file:de.uni_koblenz_landau.apow.PatientListFragment.java

/**
 * Shows the progress UI and hides the form. Source: Android Developers
 * Login Example/* w  w w.java 2s  .co  m*/
 */
private void showProgress(final boolean show) {
    mProgress = show;
    InputMethodManager inputManager = (InputMethodManager) getActivity()
            .getSystemService(FragmentActivity.INPUT_METHOD_SERVICE);
    if (getActivity().getCurrentFocus() != null) {
        inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
                InputMethodManager.HIDE_NOT_ALWAYS);
    }

    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        if (show) {
            actionBar.hide();
        } else {
            actionBar.show();
        }
    }
    int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);

    mStatusView.setVisibility(View.VISIBLE);
    mStatusView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
                }
            });

    mFormView.setVisibility(View.VISIBLE);
    mFormView.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mFormView.setVisibility(show ? View.GONE : View.VISIBLE);
                }
            });
}

From source file:org.openmidaas.app.activities.MainTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main_tab);

    //Get the text
    tabProfile = getResources().getString(R.string.profileTabtext);
    tabScan = getResources().getString(R.string.scanTabtext);
    tabInputURL = getResources().getString(R.string.urlTabtext);

    //Enabling action bar
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);//w ww. ja  va2  s. c  o  m
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.show();
    getOverflowMenu();

    mActivity = this;
    mProgressDialog = new ProgressDialog(mActivity);

    mAttributeListFragment = new AttributeListFragment();
    mUrlInputFragment = new EnterURLDialogFragment();
    mScanFragment = new ScanFragment();

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setOnTabChangedListener(listener);
    mTabHost.setup();
    mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    //initializing tabs
    initializeTab();
    //Check for updates
    checkForUpdates();
    //See if its being called to process URL from push message. 
    //MainAcivity not being killed to be consistent with what happens when the URL taken via QR code etc.
    if ((getIntent().getExtras() != null) && !getIntent().getExtras().isEmpty()) {
        if (getIntent().getAction().equals(Constants.IntentActionMessages.PROCESS_URL)) {
            processUrl(getIntent().getExtras().getString("url"));
        }
    }
}

From source file:com.actionbarsherlock.sample.hcgallery.ContentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContentView = inflater.inflate(R.layout.content_welcome, null);
    final ImageView imageView = (ImageView) mContentView.findViewById(R.id.image);
    mContentView.setDrawingCacheEnabled(false);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mContentView.setOnDragListener(new View.OnDragListener() {
            public boolean onDrag(View v, DragEvent event) {
                switch (event.getAction()) {
                case DragEvent.ACTION_DRAG_ENTERED:
                    mContentView.setBackgroundColor(getResources().getColor(R.color.drag_active_color));
                    break;

                case DragEvent.ACTION_DRAG_EXITED:
                    mContentView.setBackgroundColor(Color.TRANSPARENT);
                    break;

                case DragEvent.ACTION_DRAG_STARTED:
                    return processDragStarted(event);

                case DragEvent.ACTION_DROP:
                    mContentView.setBackgroundColor(Color.TRANSPARENT);
                    return processDrop(event, imageView);
                }//from  w w  w.  java2s . co  m
                return false;
            }
        });

        // Keep the action bar visibility in sync with the system status bar. That is, when entering
        // 'lights out mode,' hide the action bar, and when exiting this mode, show the action bar.

        final Activity activity = getActivity();
        mContentView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            public void onSystemUiVisibilityChange(int visibility) {
                ActionBar actionBar = activity.getActionBar();
                if (actionBar != null) {
                    mContentView.setSystemUiVisibility(visibility);
                    if (visibility == View.STATUS_BAR_VISIBLE) {
                        actionBar.show();
                    } else {
                        actionBar.hide();
                    }
                }
            }
        });

        // Show/hide the system status bar when single-clicking a photo. This is also called
        // 'lights out mode.' Activating and deactivating this mode also invokes the listener
        // defined above, which will show or hide the action bar accordingly.

        mContentView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (mContentView.getSystemUiVisibility() == View.STATUS_BAR_VISIBLE) {
                    mContentView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
                } else {
                    mContentView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
                }
            }
        });
    }

    // When long-pressing a photo, activate the action mode for selection, showing the
    // contextual action bar (CAB).

    mContentView.setOnLongClickListener(new View.OnLongClickListener() {
        public boolean onLongClick(View view) {
            if (mCurrentActionMode != null) {
                return false;
            }

            mCurrentActionMode = getActivity().startActionMode(mContentSelectionActionModeCallback);
            mContentView.setSelected(true);
            return true;
        }
    });

    return mContentView;
}

From source file:com.android.ex.photo.PhotoViewActivity.java

private void setLightsOutMode(boolean enabled) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        int flags = enabled
                ? View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                : View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

        // using mViewPager since we have it and we need a view
        mViewPager.setSystemUiVisibility(flags);
    } else {//from   w ww. j  a  v a2  s  .  c  o m
        final ActionBar actionBar = getActionBar();
        if (enabled) {
            actionBar.hide();
        } else {
            actionBar.show();
        }
        int flags = enabled ? View.SYSTEM_UI_FLAG_LOW_PROFILE : View.SYSTEM_UI_FLAG_VISIBLE;
        mViewPager.setSystemUiVisibility(flags);
    }
}

From source file:com.dycode.jepretstory.mediachooser.fragment.VideoFragment.java

@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    // TODO Auto-generated method stub
    ActionBar ab = getActivity().getActionBar();
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();//from   w ww  . j  a  v  a2 s  . c o m
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}

From source file:com.dycode.jepretstory.mediachooser.fragment.ImageFragment.java

@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getActivity().getActionBar();
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();/*w w  w.j  a v  a 2 s  . c  o m*/
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}

From source file:com.mishiranu.dashchan.ui.gallery.GalleryActivity.java

@TargetApi(Build.VERSION_CODES.KITKAT)
private void invalidateSystemUiVisibility() {
    ActionBar actionBar = getActionBar();
    boolean visible = isSystemUiVisible();
    if (visible) {
        actionBar.show();
    } else {//from w  w  w.  j  a v  a2  s  .co m
        actionBar.hide();
    }
    if (C.API_LOLLIPOP && expandedScreen) {
        View decorView = getWindow().getDecorView();
        int visibility = decorView.getSystemUiVisibility();
        visibility = FlagUtils.set(visibility, View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION, !visible);
        decorView.setSystemUiVisibility(visibility);
    }
    if (pagerUnit != null) {
        pagerUnit.invalidateControlsVisibility();
    }
}