List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled
public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
From source file:com.example.android.navigationdrawerexample.activities.MainActivity.java
private void setUpDrawerButton(ActionBar actionBar) { // ????NavigationDrawer????? actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); }
From source file:com.shafiq.mytwittle.view.DirectMessageActivity.java
boolean configureActionBarView() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(getString(R.string.dm_title) + getOtherUserScreenName()); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); return true;/*from w ww . ja v a2 s . c om*/ }
From source file:scmu.nutweet.bluetooth.BluetoothChat.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (D)/*from ww w. j a v a 2s . co m*/ Log.e(TAG, "+++ ON CREATE +++"); // Set up the window layout setContentView(R.layout.activity_chat); // Set up the action bar to show tabs. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayHomeAsUpEnabled(true); // For each of the sections in the app, add a tab to the action bar. actionBar.addTab(actionBar.newTab().setIcon(R.drawable.friends_black).setTabListener(this)); actionBar.addTab(actionBar.newTab().setIcon(R.drawable.chatmsg_black).setTabListener(this)); //stateChange(Const.mService.getState()); }
From source file:com.vbehl.connections.ui.ImageDetailActivity.java
@TargetApi(11) @Override//from w ww . ja v a2 s . c o m public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; // 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 // 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(), Images.imageUrls.length); mPager = (ViewPager) findViewById(R.id.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() { 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); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } }
From source file:com.volley.demo.ImageDetailActivity.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override// w w w . j a v a 2 s . co m public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; // 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; ImageCacheParams cacheParams = new ImageCacheParams(this, IMAGE_CACHE_DIR); cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory // The ImageFetcher takes care of loading images into our ImageView children asynchronously mImageLoader = new SimpleImageLoader(this, cacheParams);//, R.drawable.empty_photo); //mImageFetcher.setFadeInImage(false); mImageLoader.setMaxImageSize(longest); // Set up ViewPager and backing adapter mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageUrls.length); mPager = (ViewPager) findViewById(R.id.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); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } }
From source file:com.tweetlanes.android.view.ProfileActivity.java
boolean configureActionBarView() { if (mScreenName != null) { ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); int layout = R.layout.profile_title_thin; /*//from ww w. jav a2 s . c o m * // TODO: This is messy, and likely won't work for large screen devices. Need to come up with a better solution int layout; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { layout= R.layout.profile_title_thin; } else { layout = R.layout.profile_title; }*/ View profileTitleView = inflator.inflate(layout, null); ((TextView) profileTitleView.findViewById(R.id.screenname)).setText("@" + mScreenName); TextView fullNameTextView = (TextView) profileTitleView.findViewById(R.id.fullname); if (fullNameTextView != null && mUser != null) { fullNameTextView.setText(mUser.getName()); } ImageView verifiedImage = (ImageView) profileTitleView.findViewById(R.id.verifiedImage); verifiedImage.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(profileTitleView); } return true; }
From source file:org.spinsuite.login.T_Connection.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.t_connection); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);/*from ww w . java2 s. co m*/ ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); et_UrlSoap = (EditText) findViewById(R.id.et_UrlSoap); et_Method = (EditText) findViewById(R.id.et_Method); et_Timeout = (EditText) findViewById(R.id.et_Timeout); et_NameSpace = (EditText) findViewById(R.id.et_NameSpace); ch_SaveSD = (CheckBox) findViewById(R.id.ch_SaveSD); // Carlos Parada Setting Parameters for SFAndroid Service Call et_UrlSoap.setText("http://193.1.1.243:8080/ADInterface/services/SFAndroidService"); et_NameSpace.setText("http://www.erpcya.com/"); et_Method.setText("InitialLoad"); //End Carlos Parada butt_InitSync = (Button) findViewById(R.id.butt_InitSync); //lockFront(); // Init Sync butt_InitSync.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (valid()) { synchronize(); lockFront(); } } }); }
From source file:com.dl2974.andbitmap.ui.ImageDetailActivity.java
@TargetApi(11) @Override//from w w w . jav a 2 s .c o m public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; // 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 // 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(), Images.imageUrls.length); mPager = (ViewPager) findViewById(R.id.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); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } }
From source file:com.example.kent_zheng.sdk_displayingbitmaps.displayingbitmaps.ui.ImageDetailActivity.java
@TargetApi(VERSION_CODES.HONEYCOMB) @Override//from w ww . j a v a 2 s . co m public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } 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; // 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 // 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(), Images.imageUrls.length); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setPageMargin((int) getResources().getDimension(R.dimen.horizontal_page_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()) { //?! NullPointException final ActionBar actionBar = getActionBar(); // Hide title text and set home as up actionBar.setDisplayShowTitleEnabled(true); 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); if (extraCurrentItem != -1) { mPager.setCurrentItem(extraCurrentItem); } }
From source file:net.vivekiyer.GAL.Configure.java
@SuppressLint("NewApi") @Override//from w w w .ja va2 s . c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.configure); // Hook up the on click handler for the button Button button = (Button) findViewById(R.id.buttonSignIn); button.setOnClickListener(this); // Get the preferences that were entered by the user and display those to the user mPreferences = PreferenceManager.getDefaultSharedPreferences(this); String domain = mPreferences.getString(KEY_DOMAIN_PREFERENCE, ""), //$NON-NLS-1$ user = mPreferences.getString(KEY_USERNAME_PREFERENCE, ""); //$NON-NLS-1$ user = domain + (domain.length() > 0 ? "\\" : "") + user; //$NON-NLS-1$ //$NON-NLS-2$ if (user.length() > 0) setTextForId(R.id.txtDomainUserName, user); setTextForId(R.id.txtPassword, mPreferences.getString(KEY_PASSWORD_PREFERENCE, "")); //$NON-NLS-1$ setTextForId(R.id.txtServerName, mPreferences.getString(KEY_SERVER_PREFERENCE, "")); //$NON-NLS-1$ setValueForCheckbox(R.id.chkUseSSL, mPreferences.getBoolean(KEY_USE_SSL, true)); setValueForCheckbox(R.id.chkAcceptAllSSLCert, mPreferences.getBoolean(KEY_ACCEPT_ALL_CERTS, true)); EditText text = (EditText) findViewById(R.id.txtServerName); text.setOnEditorActionListener(new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) { if (actionId == EditorInfo.IME_ACTION_GO) { connect(); return true; } return false; } }); if (!Utility.isPreHoneycomb()) { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // actionBar.setBackgroundDrawable(new ColorDrawable(Color.LTGRAY)); } }