Example usage for android.app ActionBar hide

List of usage examples for android.app ActionBar hide

Introduction

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

Prototype

public abstract void hide();

Source Link

Document

Hide the ActionBar if it is currently showing.

Usage

From source file:com.ape.filemanager.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getActionBar();
    if (actionBar != null)
        actionBar.hide();

    setContentView(R.layout.myos_activity_main);

    mMountPointManager = MountPointManager.getInstance();
    mMountPointManager.init(this);

    initTabTitles();/*  ww w.j  av  a  2 s  .c om*/
    mFragmentAdapter = new FileManagerFragmentAdapter(getFragmentManager(), this);
    restoreOrCreateFragment(savedInstanceState);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mFragmentAdapter);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    mTagPagerIndicator = (TabPageIndicator) findViewById(R.id.indicator);
    mTagPagerIndicator.setViewPager(mViewPager);
    mTagPagerIndicator.setOnPageChangeListener(mPageChangeListener);

    int tabIndex;
    Intent intent = getIntent();
    String action = intent.getAction();
    if (getIntent().getData() != null) {
        tabIndex = Util.SDCARD_TAB_INDEX;
    } else if (!TextUtils.isEmpty(action)) {
        if (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT)
                || action.equals("com.mediatek.filemanager.ADD_FILE")) {
            tabIndex = Util.CATEGORY_TAB_INDEX;
        } else if (action.equals(CloudFileUtil.CLOUD_STORAGE_ACTION)) {
            tabIndex = Util.REMOTE_TAB_INDEX;
        } else {
            tabIndex = Util.CATEGORY_TAB_INDEX;
        }
    } else {
        tabIndex = Util.CATEGORY_TAB_INDEX; //For market require.
        //          tabIndex = PreferenceManager.getDefaultSharedPreferences(this)
        //                  .getInt(INSTANCESTATE_TAB, Util.CATEGORY_TAB_INDEX);
        mHandler.sendEmptyMessageDelayed(MSG_UPDATE_VERSION, 3000);
    }
    mTagPagerIndicator.setCurrentItem(tabIndex);

    upgradeManger = UpgradeManager.newInstance(this, getApplicationInfo().packageName,
            getString(R.string.app_name));
}

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  ava  2 s. co m
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}

From source file:com.example.venkatagovardhan.docorganizer.FolderActivity.java

public void setActionbarVisible(boolean visible) {
    ActionBar actionBar = getActionBar();
    if (actionBar == null)
        return;//  www .  ja  va 2s. c om
    if (visible) {
        actionBar.show();
        setSystemBarTranslucency(false);
    } else {
        actionBar.hide();
        setSystemBarTranslucency(true);
    }
}

From source file:thproject.test.com.myapplication.SongRecognitionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_song_recognition);

    context = getApplicationContext();/* w w  w . j  a  va2 s  .c o m*/

    //handler for events within activity
    handler = new Handler() {
        public void handleMessage(Message msg) {
            Bundle data = msg.getData();
            String artist = data.getString("artist");
            String album = data.getString("album");
            String action = data.getString("action");

            //First action occurs when no tabs are present, progress dialog shown
            if (action.compareTo("test") == 0) {
                Toast.makeText(getApplicationContext(), artist + " " + album, Toast.LENGTH_SHORT).show();
            }
            //Action to show our list of albums
            if (action.compareTo("albums") == 0) {
                showAlbumDialog();
            }
            //Action to show our list of tracks
            if (action.compareTo("tracks") == 0) {
                int index = data.getInt("albumIndex");
                GnAlbum selectedAlbum = albumObjects.get(index);
                showTracksDialog(selectedAlbum);
            }
            //Actino to begin scraping
            if (action.compareTo("scrape") == 0) {
                beginScraping();
            }
            //show progress
            if (action.compareTo("showprogress") == 0) {
                progressDialog = new ProgressDialog(SongRecognitionActivity.this);
                progressDialog.setMessage("Loading tab ");
                progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                progressDialog.show();
            }

            //hide progress
            if (action.compareTo("stopprogress") == 0) {
                progressDialog.hide();
            }

            //update progress
            if (action.compareTo("progresstext") == 0) {
                String text = data.getString("text");
                progressDialog.setMessage("Loading tab " + text);
            }

            //Action to exit this activity
            if (action.compareTo("exit") == 0) {
                Intent i;
                i = new Intent(SongRecognitionActivity.this, MainTabActivity.class);
                startActivity(i);
                finish();
            }
        }
    };
    //Executing asynchronous connection
    new gnSync().execute();

    //disable application icon from ActionBar, set up remaining attributes
    ActionBar actionBar = getActionBar();
    actionBar.hide();
}

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();
        }/*from   w  w  w  .  j av a2  s. c  om*/
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}

From source file:org.orange.querysystem.CoursesInThisWeekActivity.java

/**
 * //from ww w .  j  a va2s  .c o  m
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void setTitle() {
    TextView currentTime = (TextView) findViewById(R.id.currentTime);
    String title = getString(R.string.curriculum_schedule_in_this_week);
    Integer weekNumber = SettingsActivity.getCurrentWeekNumber(this);
    if (weekNumber != null) {
        title += "(" + getString(R.string.week_of_semester, weekNumber) + ")";
    }
    //3.0?ActionBar3.0currentTime
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        //??
        currentTime.setLayoutParams(new LinearLayout.LayoutParams(0, 0));
        ActionBar mActionBar = getActionBar();
        mActionBar.setTitle(title);
        //????ActionBar
        if (getResources()
                .getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE) {
            mActionBar.hide();
        }
    } else {
        currentTime.setText(title + "\t\t" + DateFormat.getDateInstance().format(new Date()));
    }
}

From source file:il.co.togetthere.LoginActivity.java

@SuppressLint("InlinedApi")
@Override//from   w ww .  j  a  v a2s. com
public void onCreate(Bundle savedInstanceState) {

    // Hide the status bar.
    //View decorView = getWindow().getDecorView();
    //int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    //decorView.setSystemUiVisibility(uiOptions); 

    // Remember that you should never show the action bar if the
    // status bar is hidden, so hide that too if necessary.
    android.app.ActionBar actionBar = getActionBar();
    actionBar.hide();

    super.onCreate(savedInstanceState);
    uiHelper = new UiLifecycleHelper(this, callback);
    uiHelper.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        String name = savedInstanceState.getString(PENDING_ACTION_BUNDLE_KEY);
        pendingAction = PendingAction.valueOf(name);
    }

    setContentView(R.layout.activity_login);

    //initialize db credentialis for registering user
    clientManager = new AmazonClientManager(this);

    // Configure the Facebook login button
    buttonLoginFacebook = (LoginButton) findViewById(R.id.button_login_facebook);
    buttonLoginFacebook.setBackgroundResource(R.drawable.button_login_facebook);
    buttonLoginFacebook.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    buttonLoginFacebook.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
        @Override
        public void onUserInfoFetched(GraphUser user) {
            LoginActivity.this.facebookUser = user;
            LoginActivity.user.init(user); //set facebook user in user
            //TelephonyManager tMgr =  (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
            //LoginActivity.user.setPhone(tMgr.getLine1Number());

            if (user != null) {
                LoginActivity.user.syncDB();
                continuteToNextScreen();
            }

            // It's possible that we were waiting for this.user to be populated in order to post a
            // status update.
            handlePendingAction();
        }
    });

    // Configure the Google login button
    buttonLoginGoogle = (Button) findViewById(R.id.button_login_google);
    buttonLoginGoogle.setBackgroundResource(R.drawable.button_login_google);
    buttonLoginGoogle.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    buttonLoginGoogle.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Toast.makeText(getApplicationContext(), "Google+ support is coming soon...", Toast.LENGTH_SHORT)
                    .show();
        }
    });

    // Configure the Twitter login button
    buttonLoginTwitter = (Button) findViewById(R.id.button_login_twitter);
    buttonLoginTwitter.setBackgroundResource(R.drawable.button_login_twitter);
    buttonLoginTwitter.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    buttonLoginTwitter.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Toast.makeText(getApplicationContext(), "Twitter support is coming soon...", Toast.LENGTH_SHORT)
                    .show();
        }
    });

    controlsContainer = (ViewGroup) findViewById(R.id.main_ui_container);

    final FragmentManager fm = getSupportFragmentManager();
    Fragment fragment = fm.findFragmentById(R.id.fragment_container);
    if (fragment != null) {
        // If we're being re-created and have a fragment, we need to a) hide the main UI controls and
        // b) hook up its listeners again.
        controlsContainer.setVisibility(View.GONE);
        if (fragment instanceof FriendPickerFragment) {
            setFriendPickerListeners((FriendPickerFragment) fragment);
        } else if (fragment instanceof PlacePickerFragment) {
            setPlacePickerListeners((PlacePickerFragment) fragment);
        }
    }

    // Listen for changes in the back stack so we know if a fragment got popped off because the user
    // clicked the back button.
    fm.addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            if (fm.getBackStackEntryCount() == 0) {
                // We need to re-show our UI.
                controlsContainer.setVisibility(View.VISIBLE);
            }
        }
    });

    // Can we present the share dialog for regular links?
    canPresentShareDialog = FacebookDialog.canPresentShareDialog(this,
            FacebookDialog.ShareDialogFeature.SHARE_DIALOG);
    // Can we present the share dialog for photos?
    canPresentShareDialogWithPhotos = FacebookDialog.canPresentShareDialog(this,
            FacebookDialog.ShareDialogFeature.PHOTOS);
}

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 {// ww w.  java  2  s.  co  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.dhl.android.bitmapfun.ui.ImageDetailActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    // Fetch screen height and width, to use as our max size when loading images as this
    // activity runs full screen
    final DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    final int height = displaymetrics.heightPixels;
    final int width = displaymetrics.widthPixels;
    final int longest = height > width ? height : width;

    // The ImageWorker takes care of loading images into our ImageView children asynchronously
    mImageWorker = new ImageFetcher(this, longest);
    mImageWorker.setAdapter(Images.imageWorkerUrlsAdapter);
    mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, IMAGE_CACHE_DIR));
    mImageWorker.setImageFadeIn(false);/*from  w w  w . jav  a  2  s.com*/

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), mImageWorker.getAdapter().getSize());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));

    // 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.hasActionBar()) {
        final ActionBar actionBar = getActionBar();

        // Enable "up" navigation on ActionBar icon and hide title text
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);

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

        // 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();
                }
            }
        });
    }

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

From source file:co.touchlab.thumbcache.ui.ImageDetailActivity.java

@SuppressLint("NewApi")
@Override/*from w ww. ja  v  a2s . com*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    // Fetch screen height and width, to use as our max size when loading images as this
    // activity runs full screen
    final DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    final int height = displaymetrics.heightPixels;
    final int width = displaymetrics.widthPixels;
    final int longest = height > width ? height : width;

    // The ImageWorker takes care of loading images into our ImageView children asynchronously
    mImageWorker = new ImageFetcher(this, longest);
    mImageWorker.setAdapter(Images.imageWorkerUrlsAdapter);
    mImageWorker.setImageCache(ImageCache.findOrCreateCache(this, IMAGE_CACHE_DIR));
    mImageWorker.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), mImageWorker.getAdapter().getSize());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));

    // 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.hasActionBar()) {
        final ActionBar actionBar = getActionBar();

        // Enable "up" navigation on ActionBar icon and hide title text
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);

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

        // 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();
                }
            }
        });
    }

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