Example usage for android.app ActionBar DISPLAY_SHOW_TITLE

List of usage examples for android.app ActionBar DISPLAY_SHOW_TITLE

Introduction

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

Prototype

int DISPLAY_SHOW_TITLE

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

Click Source Link

Document

Show the activity title and subtitle, if present.

Usage

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 {//from  ww w . j a v a2 s  .co  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: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();/*w  w  w . ja v  a2  s .com*/
        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:htw.bui.openreskit.meter.SeriesActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mOverlayFramelayout = new FrameLayout(this);

    setContentView(mOverlayFramelayout);
    View view = getLayoutInflater().inflate(R.layout.series_fragment, mOverlayFramelayout, false);
    mOverlayFramelayout.addView(view);/*from  ww w  .  j  a  v a2 s  .co  m*/
    mContext = this;
    mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false);

    if (Utils.isTablet(this)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }

    ActionBar bar = getActionBar();
    bar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
    bar.setDisplayShowHomeEnabled(true);

    EnterValueFragment enterValueFrag = (EnterValueFragment) mFragMan
            .findFragmentById(R.id.enter_value_fragment);
    if (enterValueFrag != null) {
        enterValueFrag.getView().setVisibility(View.INVISIBLE);
    }

}

From source file:dude.morrildl.weatherport.MainActivity.java

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

    setContentView(R.layout.activity_main);

    // We store the list of airports the user has expressed interest in in
    // SharedPrefs, as a list (well, Set) of Strings
    SharedPreferences prefs = getSharedPreferences("prefs", Context.MODE_PRIVATE);

    Set<String> currentSet = prefs.getStringSet("airports", null);
    if (currentSet == null || currentSet.size() < 1) {
        // i.e. first run -- hard-default KSFO to the list
        HashSet<String> defaultSet = new HashSet<String>();
        defaultSet.add("KSFO");
        prefs.edit().putStringSet("airports", defaultSet).commit();
        currentSet = defaultSet;/*from   w w w . ja  v a2s . c  o  m*/
    }

    // enable the nav spinner, which we'll use to pick which airport to look
    // at
    ActionBar bar = getActionBar();
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayList<String> currentList = new ArrayList<String>();
    currentList.addAll(currentSet);
    Collections.sort(currentList);
    adapter = new ArrayAdapter<CharSequence>(bar.getThemedContext(),
            android.R.layout.simple_spinner_dropdown_item);
    adapter.addAll(currentList);

    bar.setListNavigationCallbacks(adapter, new OnNavigationListener() {
        @Override
        public boolean onNavigationItemSelected(int arg0, long arg1) {
            // this re-ups the data whenever the user changes the current
            // airport
            startAsyncFetch(adapter.getItem(arg0).toString());
            return true;
        }
    });

    // Let's set up a fancy new v2 MapView, for the lulz
    mapFragment = new SupportMapFragment();
    pagerAdapter = new TwoFragmentPagerAdapter(this, getSupportFragmentManager(), new DetailsFragment(),
            mapFragment);
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    viewPager.setOnPageChangeListener(this);
    // No placemarker on the map because I've always secretly hated that
    // glyph
}

From source file:com.example.android.donebar.DoneBarActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // BEGIN_INCLUDE (inflate_set_custom_view)
    // Inflate a "Done/Cancel" custom action bar view.
    final LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext()
            .getSystemService(LAYOUT_INFLATER_SERVICE);
    final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done_cancel, null);
    customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(new View.OnClickListener() {
        @Override/*from  ww w .  ja v  a2  s. co  m*/
        public void onClick(View v) {
            // "Done"
            int id = generateId();
            EditText number = (EditText) findViewById(R.id.caller_phone_number);
            EditText information = (EditText) findViewById(R.id.caller_information);

            checkAvailability(id, number.getText().toString(), information.getText().toString());

            finish();
        }
    });
    customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // "Cancel"
            finish();
        }
    });

    // Show the custom action bar view and hide the normal Home icon and title.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    // END_INCLUDE (inflate_set_custom_view)

    setContentView(R.layout.activity_done_bar);
}

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();//from ww  w.  j av  a 2 s  .  com
        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();//  w w  w  . ja va  2  s .  c o 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:org.openmidaas.app.activities.MainTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main_tab);

    //Get the text
    tabProfile = getResources().getString(R.string.profileTabtext);
    tabScan = getResources().getString(R.string.scanTabtext);
    tabInputURL = getResources().getString(R.string.urlTabtext);

    //Enabling action bar
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);/*from   w  ww.  j a v a 2  s .  c o  m*/
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.show();
    getOverflowMenu();

    mActivity = this;
    mProgressDialog = new ProgressDialog(mActivity);

    mAttributeListFragment = new AttributeListFragment();
    mUrlInputFragment = new EnterURLDialogFragment();
    mScanFragment = new ScanFragment();

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setOnTabChangedListener(listener);
    mTabHost.setup();
    mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    //initializing tabs
    initializeTab();
    //Check for updates
    checkForUpdates();
    //See if its being called to process URL from push message. 
    //MainAcivity not being killed to be consistent with what happens when the URL taken via QR code etc.
    if ((getIntent().getExtras() != null) && !getIntent().getExtras().isEmpty()) {
        if (getIntent().getAction().equals(Constants.IntentActionMessages.PROCESS_URL)) {
            processUrl(getIntent().getExtras().getString("url"));
        }
    }
}

From source file:com.yohpapa.overlaymusicplayer.activity.MainActivity.java

private void setupActionBar() {
    ActionBar bar = getActionBar();//from   ww w  .ja va  2s.co m
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(false);
    bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

    int lastPosition = PrefUtils.getInt(this, R.string.pref_last_tab_position, 0);

    for (int i = 0; i < fragmentNames.length; i++) {

        ActionBar.Tab tab = bar.newTab();
        tab.setText(fragmentNames[i]);
        tab.setTabListener(new ActionBar.TabListener() {
            @Override
            public void onTabUnselected(Tab tab, FragmentTransaction ft) {
                Log.d(TAG, "onTabUnselected");
            }

            @Override
            public void onTabSelected(Tab tab, FragmentTransaction ft) {
                ViewPager pager = (ViewPager) findViewById(R.id.fragment_pager);
                pager.setCurrentItem(tab.getPosition());
                PrefUtils.setInt(MainActivity.this, R.string.pref_last_tab_position, tab.getPosition());
            }

            @Override
            public void onTabReselected(Tab tab, FragmentTransaction ft) {
                Fragment fragment = fragments[tab.getPosition()];
                if (fragment instanceof CommonListFragment) {
                    ((CommonListFragment) fragment).onTapWhenSelected();
                }
            }
        });
        boolean isSelected = false;
        if (i == lastPosition) {
            isSelected = true;
        }
        bar.addTab(tab, isSelected);
    }
}

From source file:io.oceanos.shaderbox.ShaderEditorActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final LayoutInflater inflater = getLayoutInflater();
    final View customActionBarView = inflater.inflate(R.layout.actionbar_view_save, null);
    final View shaderActionView = customActionBarView.findViewById(R.id.actionbar_view);
    final View shaderActionSave = customActionBarView.findViewById(R.id.actionbar_save);
    shaderActionView.setOnClickListener(new View.OnClickListener() {
        @Override//from   w  w  w  .ja v a  2 s .  c  om
        public void onClick(View v) {
            if (result.isSuccess())
                onView(shader);
            else {
                Toast errorMsg = Toast.makeText(getBaseContext(), result.getError(), Toast.LENGTH_LONG);
                errorMsg.getView().setBackgroundColor(getResources().getColor(R.color.editor_color_error));
                errorMsg.show();
            }
        }
    });
    shaderActionSave.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onSave(shader);
        }
    });

    fps = (TextView) customActionBarView.findViewById(R.id.text_fps);
    viewError = (TextView) shaderActionView.findViewById(R.id.viewError);

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    setContentView(R.layout.activity_editor);

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    ShaderDatabase database = new ShaderDatabase(getBaseContext());
    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
            long id = database.newShader();
            Cursor cursor = database.findById(id);
            if (cursor.moveToFirst())
                shader = Shader.getValues(cursor);
            cursor.close();
            if (sharedText != null)
                shader.setText(sharedText);
            else
                shader.setText("");
        }
    } else {
        long id = intent.getLongExtra("ID", 0);
        Cursor cursor = database.findById(id);
        if (cursor.moveToFirst())
            shader = Shader.getValues(cursor);
        cursor.close();
    }
    database.close();

    setSymbolListener(R.id.action_tab, '\t');
    setSymbolListener(R.id.action_rpo, '(');
    setSymbolListener(R.id.action_rpc, ')');
    setSymbolListener(R.id.action_cpo, '{');
    setSymbolListener(R.id.action_cpc, '}');
    setSymbolListener(R.id.action_dotcoma, ';');
    setSymbolListener(R.id.action_coma, ',');
    setSymbolListener(R.id.action_dot, '.');
    setSymbolListener(R.id.action_plus, '+');
    setSymbolListener(R.id.action_minus, '-');
    setSymbolListener(R.id.action_times, '*');
    setSymbolListener(R.id.action_div, '/');
    setSymbolListener(R.id.action_equal, '=');
    setSymbolListener(R.id.action_spo, '[');
    setSymbolListener(R.id.action_spc, ']');
    setSymbolListener(R.id.action_and, '&');
    setSymbolListener(R.id.action_or, '|');
    setSymbolListener(R.id.action_greater, '>');
    setSymbolListener(R.id.action_lesser, '<');
    setSymbolListener(R.id.action_cardinal, '#');

    final Handler uiHandler = new Handler(this);
    renderer = new ShaderRenderer(shader, uiHandler);

    shaderView = (ShaderGLView) findViewById(R.id.shader_view);
    shaderView.setRenderer(renderer);
    shaderView.setVRModeEnabled(false);

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    int textSize = Integer.parseInt(prefs.getString("pref_editor_text_size", "14"));
    int opacity = Integer.parseInt(prefs.getString("pref_editor_opacity", "127"));
    editor = (ShaderEditor) findViewById(R.id.editor);
    editor.setTextSize(textSize);
    editor.setBackgroundColor(opacity << 24);
    editor.setHorizontallyScrolling(true);
    editor.setHorizontalScrollBarEnabled(true);

    editor.setText(shader.getText());

    ScrollView scroll = (ScrollView) findViewById(R.id.scroll);
    editor.setScrollView(scroll);

    compileRT = prefs.getBoolean("pref_compile_rt", true);
}