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.hkm.oc.wv.supportwebview.webviewSupports.java

protected void toolbartoggle() {
    ActionBar ab = getActionBar();
    if (ab.isShowing())
        ab.hide();
    else/*from  www.j  ava  2s  .  c om*/
        ab.show();
}

From source file:com.mac.SafeWalk.WelcomeActivity.java

/**
 * Called when the activity is first created.
 *///ww  w.  j av a  2 s  .c om
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.welcome_screen);
    // Create adapter
    collectionPagerAdapter = new CollectionPagerAdapter(getSupportFragmentManager());

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

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

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

    // Set up the ViewPager
    // Attache the adapter and implement listener in order to respond when user swipes between sections.
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(collectionPagerAdapter);
    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // Select the corresponding tab when user swipes
            actionBar.setSelectedNavigationItem(position);
            ImageView dot1 = (ImageView) findViewById(R.id.sliding_dot1);
            ImageView dot2 = (ImageView) findViewById(R.id.sliding_dot2);
            switch (position) {
            case 0:
                animate(dot1);
                break;
            case 1:
                animate(dot2);
                break;
            case 2:
                break;
            }
        }
    });
    // For each of the sections, add tab to the action bar.
    for (int i = 0; i < collectionPagerAdapter.getCount(); i++) {
        // Create tabs
        actionBar.addTab(actionBar.newTab().setTabListener(this));
    }
    Settings.getSettings().setContext(this);
}

From source file:com.google.samples.apps.abelana.LoginActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    mUserInfoStore = new UserInfoStore(this);
    ActionBar actionBar = getActionBar();
    if (actionBar != null)
        actionBar.hide();

    // Step 1: Create a GitkitClient.
    // The configurations are set in the AndroidManifest.xml. You can also set or overwrite them
    // by calling the corresponding setters on the GitkitClient builder.
    ////from  w w  w  .  j a  v  a 2 s.  c  om

    mGitkitClient = GitkitClient.newBuilder(this, new GitkitClient.SignInCallbacks() {
        // Implement the onSignIn method of GitkitClient.SignInCallbacks interface.
        // This method is called when the sign-in process succeeds. A Gitkit IdToken and the signed
        // in account information are passed to the callback.
        @Override
        public void onSignIn(IdToken idToken, GitkitUser user) {
            mUserInfoStore.saveIdTokenAndGitkitUser(idToken, user);
            showProfilePage(idToken, user);
        }

        // Implement the onSignInFailed method of GitkitClient.SignInCallbacks interface.
        // This method is called when the sign-in process fails.
        @Override
        public void onSignInFailed() {
            Toast.makeText(LoginActivity.this, "Sign in failed", Toast.LENGTH_LONG).show();
        }
    }).build();

    // Step 2: Check if there is an already signed in user.
    // If there is an already signed in user, show the ic_profile page and welcome message.
    // Otherwise, show a sign in button.
    //
    if (mUserInfoStore.isUserLoggedIn()) {
        showProfilePage(mUserInfoStore.getSavedIdToken(), mUserInfoStore.getSavedGitkitUser());
    } else {
        showSignInPage();
    }

}

From source file:com.joshmoles.byobcontroller.ControlActivity.java

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

    setContentView(R.layout.activity_control);

    // Hide the action bar
    ActionBar actionBar = getActionBar();
    actionBar.hide();

    // Get the variables passed from super
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        pass = extras.getString(Consts.GAME_PASSWORD);
        Log.d(Consts.CONTROL_AREA, "Received extras from Loading.");
        myConfig = (ConfigEntry) getIntent().getParcelableExtra(Consts.CONFIG_OBJ);
    }//from  w w  w  . j a  va 2s.c  o  m

    // Go and configure all the touch listeners.
    registerOnTouchListeners();

    // Set up everything for pubnub.

    // Update the channel names.
    lobbyCh = Consts.LOBBY_PREFIX + pass;
    gameCh = Consts.GAME_PREFIX + pass;
    privGameCh = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID);

    // Go and configure pubnub
    configurePubnub();
}

From source file:com.stj.fileexplorer.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    // add begin by xugaoming@20140317, don't need to restore
    // fragments automaticaly if killed by system for memory,
    // it will mess up the logic
    savedInstanceState = null;//from   w  w  w  .j ava  2s .c  o  m
    // add end

    super.onCreate(savedInstanceState);
    StorageHelper.getInstance(this);
    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    final ActionBar bar = getActionBar();
    bar.hide();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    //        mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category),
    //                FileCategoryActivity.class, null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null);

    FileViewActivity fileViewActivity = ((FileViewActivity) getFragment(Util.SDCARD_TAB_INDEX));
    fileViewActivity.registBottomBtnPressListener(this);

    /*mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote),
        ServerControlActivity.class, null);*/
    int selectedItem = PreferenceManager.getDefaultSharedPreferences(this).getInt(INSTANCESTATE_TAB,
            Util.CATEGORY_TAB_INDEX);
    if (Intent.ACTION_PICK.equals(getIntent().getAction())) {
        selectedItem = Util.SDCARD_TAB_INDEX;
    }
    //add begin by xugaoming@20140517, add function to locate
    //to a directory
    Intent intent = getIntent();
    if (intent != null && intent.getStringExtra("goto_dir") != null) {
        selectedItem = Util.SDCARD_TAB_INDEX;
    }
    //add end
    bar.setSelectedNavigationItem(0);
}

From source file:com.manning.androidhacks.hack044.MainActivity3X.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from   www.  j a v  a2  s  .  c  om

    final View contentView = findViewById(R.id.content);

    contentView.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            final ActionBar actionBar = getActionBar();
            if (actionBar != null) {
                contentView.setSystemUiVisibility(visibility);

                if (visibility == View.STATUS_BAR_VISIBLE) {
                    actionBar.show();
                } else {
                    actionBar.hide();
                }
            }
        }
    });

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

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

@SuppressLint("InlinedApi")
@Override/*w  ww.j  a  v  a 2  s.  c o  m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_screen_slide);

    // Start to import data from DB
    mThread.delegate = this;
    mCurr = -1;

    /**
     * View Initialization
     **/

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

    /**
     * Set Profile Picture
     **/
    ProfilePictureView profilePictureView = (ProfilePictureView) findViewById(
            R.id.button_show_user_details_slide);
    profilePictureView.setProfileId(LoginActivity.user.getID());

    profilePictureView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent infoIntent = new Intent(ScreenSlideActivity.this, UserInfoActivity.class);
            ScreenSlideActivity.this.startActivity(infoIntent);

        }
    });

    /**
     * Get Values
     **/
    Intent inIntent = getIntent();
    setmServiceProviderType(inIntent.getStringExtra("TYPE_EXTRA"));

    if (getmServiceProviderType() != null && getmServiceProviderType().equals("help")) {
        mThread.execute(DynamoDBManagerType.GET_TASKS.toString());
    } else {
        mThread.execute(DynamoDBManagerType.GET_PROVIDER.toString(),
                ServiceProvider.stringToEnum(getmServiceProviderType()).toString());
    }

    /**
     * Set Lower Bar Functions
     */
    ((LinearLayout) findViewById(R.id.button_add_new_location)).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent addNewIntent;
            if (getmServiceProviderType().equals("help")) {
                addNewIntent = new Intent(ScreenSlideActivity.this, AddNewTaskActivity.class);
                ScreenSlideActivity.this.startActivity(addNewIntent);
            } else {
                addNewIntent = new Intent(ScreenSlideActivity.this, AddSPActivity.class);
                ScreenSlideActivity.this.startActivity(addNewIntent);
            }

        }
    });

    // TODO "Rank" button Handler

    LinearLayout rankButton = (LinearLayout) findViewById(R.id.button_rank);
    if (getmServiceProviderType().equals("help")) {
        rankButton.setVisibility(View.INVISIBLE);
    } else {
        rankButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                // TODO Rank Dialog

            }
        });
    }

    LinearLayout editButton = (LinearLayout) findViewById(R.id.button_edit);
    if (getmServiceProviderType().equals("help")) {
        editButton.setVisibility(View.INVISIBLE);
    } else {
        editButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent editIntent = null;
                editIntent = new Intent(ScreenSlideActivity.this, EditActivity.class);
                editIntent.putExtra("SP_NUMBER", mCurr);
                ScreenSlideActivity.this.startActivity(editIntent);

                // TODO - update SP when editing is finished
            }
        });
    }

    // Titles
    TextView titleRank = ((TextView) findViewById(R.id.button_rank_title));
    TextView titleAdd = ((TextView) findViewById(R.id.button_add_new_location_title));
    TextView titleEdit = ((TextView) findViewById(R.id.button_edit_title));

    // Define Font
    Typeface font = Typeface.createFromAsset(getAssets(), "fonts/GOTHIC.TTF");
    titleRank.setTypeface(font);
    titleAdd.setTypeface(font);
    titleEdit.setTypeface(font);

}

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

/**
 * Shows the progress UI and hides the form. Source: Android Developers
 * Login Example/* w ww . jav a2  s . c o 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.catrobat.catroid.ui.WebViewActivity.java

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

    ActionBar actionBar = getActionBar();
    actionBar.hide();

    Intent intent = getIntent();//from   w w  w .  j a va  2  s. c  o  m
    url = intent.getStringExtra(INTENT_PARAMETER_URL);
    if (url == null) {
        url = Constants.BASE_URL_HTTPS;
    }
    callingActivity = intent.getStringExtra(CALLING_ACTIVITY);

    webView = (WebView) findViewById(R.id.webView);
    webView.setBackgroundColor(
            ResourcesCompat.getColor(getResources(), R.color.application_background_color, null));
    webView.setWebViewClient(new MyWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    String language = String.valueOf(Constants.CURRENT_CATROBAT_LANGUAGE_VERSION);
    String flavor = Constants.FLAVOR_DEFAULT;
    String version = Utils.getVersionName(getApplicationContext());
    String platform = Constants.PLATFORM_DEFAULT;
    webView.getSettings().setUserAgentString(
            "Catrobat/" + language + " " + flavor + "/" + version + " Platform/" + platform);

    webView.loadUrl(url);

    webView.setDownloadListener(new DownloadListener() {
        @Override
        public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype,
                long contentLength) {
            Log.d(WebViewActivity.class.getSimpleName(),
                    "contentDisposition: " + contentDisposition + "   " + mimetype);

            if (getExtensionFromContentDisposition(contentDisposition).contains(Constants.CATROBAT_EXTENSION)) {
                DownloadUtil.getInstance().prepareDownloadAndStartIfPossible(WebViewActivity.this, url);
            } else if (url.contains(Constants.LIBRARY_BASE_URL)) {
                String name = getMediaNameFromUrl(url);
                String mediaType = getMediaTypeFromContentDisposition(contentDisposition);
                String fileName = name + getExtensionFromContentDisposition(contentDisposition);
                String tempPath = null;
                switch (mediaType) {
                case Constants.MEDIA_TYPE_LOOK:
                    tempPath = Constants.TMP_LOOKS_PATH;
                    break;
                case Constants.MEDIA_TYPE_SOUND:
                    tempPath = Constants.TMP_SOUNDS_PATH;
                }
                String filePath = Utils.buildPath(tempPath, fileName);
                resultIntent.putExtra(MEDIA_FILE_PATH, filePath);
                DownloadUtil.getInstance().prepareMediaDownloadAndStartIfPossible(WebViewActivity.this, url,
                        mediaType, name, filePath, callingActivity);
            } else {
                DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));

                request.setTitle(getString(R.string.notification_download_title_pending) + " "
                        + DownloadUtil.getInstance().getProjectNameFromUrl(url));
                request.setDescription(getString(R.string.notification_download_pending));
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,
                        DownloadUtil.getInstance().getProjectNameFromUrl(url) + ANDROID_APPLICATION_EXTENSION);
                request.setMimeType(mimetype);

                registerReceiver(onDownloadComplete,
                        new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));

                DownloadManager downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
                downloadManager.enqueue(request);
            }
        }
    });
}

From source file:com.lambdal.railgun.PInfo.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Set the activity
    PInfo.activity = this;
    int packageCount = PInfo.getPackages().size();

    // Hide the status bar.
    Window w = getWindow();/*from w ww .  j ava2  s . c  o m*/
    w.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    w.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    setContentView(R.layout.activity_main);
    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.hide();
    // getActionBar().setBackgroundDrawable(new
    // ColorDrawable(Color.argb(128, 0, 0, 0)));
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    mSectionsPagerAdapter.pageCount = packageCount;

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    mViewPager.setOnClickListener(new ViewPager.OnClickListener() {
        @Override
        public void onClick(View view) {
            // When swiping between pages, select the
            // corresponding tab.
            int currentAppIndex = DummySectionFragment.currentAppIndex;
            ArrayList<PInfo> appList = PInfo.getInstalledApps(false);
            PInfo app = appList.get(currentSelectedTabIndex.intValue());
            // Open the app:
            Intent launchIntent = getPackageManager().getLaunchIntentForPackage(app.pname);
            try {
                startActivity(launchIntent);
            } catch (Exception e) {
                Log.v("We ran into an exception when launching intent: " + app.pname, e.toString());
            }
            Log.v("We have a tap event which happened at index: ",
                    app.toString() + " " + currentSelectedTabIndex.toString());
        }
    });

    for (int i = 0; i < PInfo.getPackages().size(); i++) {
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}