Example usage for android.app ActionBar setDisplayHomeAsUpEnabled

List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled

Introduction

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

Prototype

public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);

Source Link

Document

Set whether home should be displayed as an "up" affordance.

Usage

From source file:com.cw.litenote.operation.gallery.GalleryGridAct.java

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

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    UilCommon.init();/*w  w w .  j a v  a  2  s  .co m*/

    // Using the following method will cause gallery using wrong directory path after taking pictures with C360 App
    //      int lastContentId = Note_addCameraImage.getLastCapturedImageId(this);
    //      File dir = UtilImage.getImageDirectoryByContentId(this,lastContentId);

    File dir = Util.getPicturesDir(this);

    getFiles(dir.listFiles());

    gridView = (GridView) findViewById(R.id.grid_view);

    // check if directory is created AND not empty
    if ((mImageUrls != null) && (mImageUrls.length > 0)) {
        ((GridView) gridView).setAdapter(new ImageAdapter());
    } else {
        Toast.makeText(GalleryGridAct.this, R.string.gallery_toast_no_file, Toast.LENGTH_SHORT).show();
        finish();
    }

    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
        }
    });

    // set scroll bar thumb
    gridView.setScrollbarFadingEnabled(true);
    gridView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
    Util.setScrollThumb(this, gridView);
}

From source file:name.vdg.respi55.SettingsActivity.java

/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 *///ww w .j a v a2s .  c o m
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // Show the Up button in the action bar.
        ActionBar ab = getActionBar();
        if (ab != null)
            ab.setDisplayHomeAsUpEnabled(true);
    }
}

From source file:com.cwc.litenote.PictureGridAct.java

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

    if (Build.VERSION.SDK_INT >= 11) {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
    }//from www .  j av  a  2  s  . c o m

    options = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.ic_stub)
            .showImageForEmptyUri(R.drawable.ic_color_a).showImageOnFail(R.drawable.ic_error)
            .cacheInMemory(true).cacheOnDisk(true).imageScaleType(ImageScaleType.EXACTLY)
            .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true).build();

    dirString = Environment.getExternalStorageDirectory().toString() + "/" + Util.getAppName(this) + "/picture";
    getFiles(new File(dirString).listFiles());

    gridView = (GridView) findViewById(R.id.gridview);

    // check if directory is created AND not empty
    if ((imageUrls != null) && (imageUrls.length > 0)) {
        ((GridView) gridView).setAdapter(new ImageAdapter());
    } else {
        Toast.makeText(PictureGridAct.this, R.string.gallery_toast_no_file, Toast.LENGTH_SHORT).show();
        finish();
    }

    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
        }
    });
}

From source file:com.cw.litenote.media.image.GalleryGridAct.java

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

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    UilCommon.init();//from   w w w.j  a  va  2 s  .  c  o m

    // Using the following method will cause gallery using wrong directory path after taking pictures with C360 App
    //      int lastContentId = Note_addCameraImage.getLastCapturedImageId(this);
    //      File dir = UtilImage.getImageDirectoryByContentId(this,lastContentId);

    File dir = Util.getPicturesDir(this);

    getFiles(dir.listFiles());

    gridView = (GridView) findViewById(R.id.gridview);

    // check if directory is created AND not empty
    if ((mImageUrls != null) && (mImageUrls.length > 0)) {
        ((GridView) gridView).setAdapter(new ImageAdapter());
    } else {
        Toast.makeText(GalleryGridAct.this, R.string.gallery_toast_no_file, Toast.LENGTH_SHORT).show();
        finish();
    }

    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
        }
    });

    // set scroll bar thumb
    gridView.setScrollbarFadingEnabled(true);
    gridView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
    Util.setScrollThumb(this, gridView);
}

From source file:com.phonemetra.turbo.keyboard.latin.settings.SettingsActivity.java

@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    final Intent intent = getIntent();
    if (actionBar != null) {
        mShowHomeAsUp = intent.getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true);
        actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp);
        actionBar.setHomeButtonEnabled(mShowHomeAsUp);
    }/*  w  w w  .  jav a  2  s.  co  m*/

}

From source file:fm.krui.kruifm.DJInfoActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dj_info_container_layout);
    showLoadingScreen(true);/*ww  w.  jav  a 2 s .co m*/

    // Allow custom home button actions
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayHomeAsUpEnabled(true);

    /* For each component, create a tab for navigation */
    // Stream
    ActionBar.Tab bioTab = actionBar.newTab().setText(getResources().getString(R.string.dj_bio_tab))
            .setTabListener(this);
    // Extended Playlist
    ActionBar.Tab twitterTab = actionBar.newTab().setText(getResources().getString(R.string.dj_twitter_tab))
            .setTabListener(this);

    // Then apply the tabs to the ActionBar.
    actionBar.addTab(bioTab);
    actionBar.addTab(twitterTab);

    // Download DJ object attached to the last played song to display information.
    Log.v(TAG, "Grabbing DJ information...");
    DJInfoFetcher fetcher = new DJInfoFetcher(this, this);
    fetcher.execute();
}

From source file:com.androiddevbook.onyourbike.chapter11.activities.BaseActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(canGoHome);
        }/* w w w  .  j a  v  a 2 s. com*/
    }
}

From source file:za.ac.uct.cs.lwsjam005.eshelf.activities.ReadActivity.java

private void setupActionBar() {
    ActionBar actionBar = getActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);

    actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022")));
    actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022")));
    actionBar.setSplitBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022")));

    actionBar.setIcon(thisBook.getIcon());
    actionBar.setTitle(thisBook.getTitle());
    actionBar.setSubtitle(thisBook.getAuthor());

}

From source file:com.android.inputmethod.latin.settings.SettingsActivity.java

@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    final Intent intent = getIntent();
    if (actionBar != null) {
        mShowHomeAsUp = intent.getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true);
        actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp);
        actionBar.setHomeButtonEnabled(mShowHomeAsUp);
    }// w  ww .  j av a  2  s  . co m
    StatsUtils.onSettingsActivity(intent.hasExtra(EXTRA_ENTRY_KEY) ? intent.getStringExtra(EXTRA_ENTRY_KEY)
            : EXTRA_ENTRY_VALUE_SYSTEM_SETTINGS);
}

From source file:com.krayzk9s.imgurholo.activities.ImgurHoloActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    apiCall = new ApiCall();
    apiCall.setSettings(settings);//  w w w  . j a  v  a 2 s.c o  m
    theme = settings.getString("theme", MainActivity.HOLO_LIGHT);
    if (theme.equals(MainActivity.HOLO_LIGHT))
        setTheme(R.style.AppTheme);
    else
        setTheme(R.style.AppThemeDark);
    super.onCreate(savedInstanceState);
    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (NoSuchFieldException e) {
        // Ignore
        Log.e("Error!", e.toString());
    } catch (IllegalAccessException e) {
        // Ignore
        Log.e("Error!", e.toString());
    }

    if (Integer
            .parseInt(settings.getString(getString(R.string.icon_size), getString(R.string.onetwenty))) < 120) { //getting rid of 90 because it may crash the app for large screens
        SharedPreferences.Editor editor = settings.edit();
        editor.putString(getString(R.string.icon_size), getString(R.string.onetwenty));
        editor.commit();
    }
    setContentView(R.layout.activity_other);
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
}