Example usage for android.app ActionBar DISPLAY_HOME_AS_UP

List of usage examples for android.app ActionBar DISPLAY_HOME_AS_UP

Introduction

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

Prototype

int DISPLAY_HOME_AS_UP

To view the source code for android.app ActionBar DISPLAY_HOME_AS_UP.

Click Source Link

Document

Display the 'home' element such that it appears as an 'up' affordance.

Usage

From source file:com.docd.purefm.settings.SettingsActivity.java

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

    final ActionBar actionBar = getActionBar();
    if (actionBar == null) {
        throw new RuntimeException("Should have ActionBar");
    }/*from www  .j a  va2  s .com*/
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP
            | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_USE_LOGO);
}

From source file:com.evilgenius.testproject.ContactsListActivity.java

public void InitActionbar() {
    actionbar = getActionBar();//from  w  w  w  .  jav a2  s  .  co  m
    actionbar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.main_normal)));
    //       Enabling Back navigation on Action Bar icon
    actionbar.setNavigationMode(ActionBar.DISPLAY_HOME_AS_UP);
    actionbar.setDisplayHomeAsUpEnabled(true);
}

From source file:com.btmura.android.reddit.app.ThingActivity.java

private void setupActionBar() {
    ActionBar bar = getActionBar();/*from   ww  w  .j  a v  a 2s. com*/
    bar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
    refreshTitle(thingBundle.hasLinkId() ? thingBundle.getLinkTitle() : thingBundle.getTitle());
}

From source file:com.xandy.calendar.event.EditEventActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.simple_frame_layout);

    mEventInfo = getEventInfoFromIntent(icicle);
    mReminders = getReminderEntriesFromIntent();
    mEventColorInitialized = getIntent().hasExtra(EXTRA_EVENT_COLOR);
    mEventColor = getIntent().getIntExtra(EXTRA_EVENT_COLOR, -1);

    mEditFragment = (EditEventFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame);

    mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config);

    if (mIsMultipane) {
        getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE,
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
        getActionBar().setTitle(mEventInfo.id == -1 ? R.string.event_create : R.string.event_edit);
    } else {// www  .  j  av  a2s .c  o m
        //            getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
        //                    ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME|
        //                    ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
    }

    if (mEditFragment == null) {
        Intent intent = null;
        if (mEventInfo.id == -1) {
            intent = getIntent();
        }

        mEditFragment = new EditEventFragment(mEventInfo, mReminders, mEventColorInitialized, mEventColor,
                false, intent);

        mEditFragment.mShowModifyDialogOnLaunch = getIntent()
                .getBooleanExtra(CalendarController.EVENT_EDIT_ON_LAUNCH, false);

        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.main_frame, mEditFragment);
        ft.show(mEditFragment);
        ft.commit();
    }
}

From source file:com.android.calendar.event.EditEventActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.simple_frame_layout);

    mEventInfo = getEventInfoFromIntent(icicle);
    mReminders = getReminderEntriesFromIntent();
    mEventColorInitialized = getIntent().hasExtra(EXTRA_EVENT_COLOR);
    mEventColor = getIntent().getIntExtra(EXTRA_EVENT_COLOR, -1);

    mEditFragment = (EditEventFragment) getSupportFragmentManager().findFragmentById(R.id.main_frame);

    mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config);

    if (mIsMultipane) {
        getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE,
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
        getActionBar().setTitle(mEventInfo.id == -1 ? R.string.event_create : R.string.event_edit);
    } else {/*  www  .j  av a2  s . c  o  m*/
        getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_HOME_AS_UP
                | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
    }

    if (mEditFragment == null) {
        Intent intent = null;
        boolean readOnly = false;
        if (mEventInfo.id == -1) {
            intent = getIntent();
            readOnly = intent.getBooleanExtra(EXTRA_READ_ONLY, false);
        }

        mEditFragment = new EditEventFragment(mEventInfo, mReminders, mEventColorInitialized, mEventColor,
                readOnly, intent);

        mEditFragment.mShowModifyDialogOnLaunch = getIntent()
                .getBooleanExtra(CalendarController.EVENT_EDIT_ON_LAUNCH, false);

        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.main_frame, mEditFragment);
        ft.show(mEditFragment);
        ft.commit();
    }
}

From source file:com.egoclean.testpregnancy.util.ActivityHelperHoneycomb.java

/** {@inheritDoc} */
@Override//from w w w . j a v  a  2  s. co  m
public void setupSubActivity() {
    super.setupSubActivity();
    // NOTE: there needs to be a content view set before this is called, so this method
    // should be called in onPostCreate.
    if (UIUtils.isTablet(mActivity)) {
        mActivity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO,
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
    } else {
        mActivity.getActionBar().setDisplayOptions(0,
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
    }
}

From source file:org.wingy.jp8chan.ui.activity.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);

    super.onCreate(savedInstanceState);

    if (postAdapter == null) {
        Logger.e(TAG, "Posts in ImageViewActivity was null");
        finish();//from w ww.  ja  v a 2  s.c o m
        return;
    }

    threadManager = threadManagerStatic;

    ThemeHelper.setTheme(this);

    progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_no_bg));
    progressBar.setIndeterminate(false);
    progressBar.setMax(1000000);

    final FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
    decorView.addView(progressBar);

    progressBar.post(new Runnable() {
        @Override
        public void run() {
            View contentView = decorView.findViewById(android.R.id.content);
            progressBar.setY(contentView.getY() - progressBar.getHeight() / 2);
        }
    });

    // Get the posts with images
    ArrayList<Post> imagePosts = new ArrayList<>();
    for (Post post : postAdapter.getList()) {
        if (post.hasImage) {
            imagePosts.add(post);
        }
    }

    // Setup our pages and adapter
    setContentView(R.layout.image_pager);
    viewPager = (ViewPager) findViewById(R.id.image_pager);
    adapter = new ImageViewAdapter(getFragmentManager(), this);
    adapter.setList(imagePosts);
    viewPager.setAdapter(adapter);
    viewPager.setOnPageChangeListener(this);

    // Select the right image
    for (int i = 0; i < imagePosts.size(); i++) {
        if (imagePosts.get(i).no == selectedId) {
            viewPager.setCurrentItem(i);
            onPageSelected(i);
            break;
        }
    }
}

From source file:org.bohrmeista.chan.ui.activity.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);

    super.onCreate(savedInstanceState);

    if (postAdapter == null) {
        Logger.e(TAG, "Posts in ImageViewActivity was null");
        finish();/*w w w.ja v  a 2s .c o m*/
        return;
    }

    threadManager = threadManagerStatic;

    ThemeHelper.setTheme(this);

    progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_no_bg));
    progressBar.setIndeterminate(false);
    progressBar.setMax(1000000);

    final FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
    decorView.addView(progressBar);

    progressBar.post(new Runnable() {
        @Override
        public void run() {
            View contentView = decorView.findViewById(android.R.id.content);
            progressBar.setY(contentView.getY() - progressBar.getHeight() / 2);
        }
    });

    // Get the posts with images
    ArrayList<Post> imagePosts = new ArrayList<>();
    for (Post post : postAdapter.getList()) {
        if (post.images.size() > 0) {
            imagePosts.add(post);
        }
    }

    // Setup our pages and adapter
    setContentView(R.layout.image_pager);
    viewPager = (ViewPager) findViewById(R.id.image_pager);
    imageAdapter = new ImageViewAdapter(getFragmentManager(), this);
    imageAdapter.setList(imagePosts);
    viewPager.setAdapter(imageAdapter);
    viewPager.setOnPageChangeListener(this);

    // Select the right image
    int imageIndex = 0;
    for (Post post : imagePosts) {
        if (post.no == selectedId) {
            viewPager.setCurrentItem(imageIndex);
            onPageSelected(imageIndex);

            thumbList = (TwoWayView) findViewById(R.id.thumbList);
            thumbListAdapter = new ThumbListAdapter(this, post.images, imageIndex);
            thumbList.setAdapter(thumbListAdapter);
            thumbList.setVisibility(post.images.size() <= 1 ? View.GONE : View.VISIBLE);
            return;
        }
        imageIndex += post.images.size();
    }
}

From source file:org.floens.chan.ui.activity.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP);

    super.onCreate(savedInstanceState);

    if (postAdapterStatic == null || threadManagerStatic == null) {
        Logger.e(TAG, "postadapter or threadmanager null");
        finish();//from  w  ww .jav  a  2  s .co m
        return;
    }

    threadManager = threadManagerStatic;
    threadManagerStatic = null;
    postAdapter = postAdapterStatic;
    postAdapterStatic = null;
    int selectedId = selectedIdStatic;
    selectedIdStatic = -1;

    ThemeHelper.setTheme(this);

    progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_no_bg));
    progressBar.setIndeterminate(false);
    progressBar.setMax(1000000);

    final FrameLayout decorView = (FrameLayout) getWindow().getDecorView();
    decorView.addView(progressBar);

    progressBar.post(new Runnable() {
        @Override
        public void run() {
            View contentView = decorView.findViewById(android.R.id.content);
            progressBar.setY(contentView.getY() - progressBar.getHeight() / 2);
        }
    });

    // Get the posts with images
    ArrayList<Post> imagePosts = new ArrayList<>();
    for (Post post : postAdapter.getList()) {
        if (post.hasImage) {
            imagePosts.add(post);
        }
    }

    // Setup our pages and adapter
    setContentView(R.layout.image_pager);
    viewPager = (ViewPager) findViewById(R.id.image_pager);
    adapter = new ImageViewAdapter(getFragmentManager(), this);
    adapter.setList(imagePosts);
    viewPager.setAdapter(adapter);
    viewPager.setOnPageChangeListener(this);

    // Select the right image
    for (int i = 0; i < imagePosts.size(); i++) {
        if (imagePosts.get(i).no == selectedId) {
            viewPager.setCurrentItem(i);
            onPageSelected(i);
            break;
        }
    }
}

From source file:com.android.calendar.selectcalendars.SelectVisibleCalendarsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
    return true;
}