Example usage for android.app ActionBar setDisplayShowTitleEnabled

List of usage examples for android.app ActionBar setDisplayShowTitleEnabled

Introduction

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

Prototype

public abstract void setDisplayShowTitleEnabled(boolean showTitle);

Source Link

Document

Set whether an activity title/subtitle should be displayed.

Usage

From source file:cz.urbangaming.galgs.GAlg.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayList<String> itemList = new ArrayList<String>();
    //TODO:Make static, use String constants strings.xml
    itemList.add(getResources().getString(R.string.workmode_add));
    itemList.add(getResources().getString(R.string.workmode_edit));
    itemList.add(getResources().getString(R.string.workmode_delete));
    this.aAdpt = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1,
            itemList);// ww w . j  a  va 2s . co m
    actionBar.setListNavigationCallbacks(aAdpt, this);
    mGLSurfaceView = new GLSurfaceView(this);

    if (detectOpenGLES20()) {
        // Tell the surface view we want to create an OpenGL ES 2.0-compatible
        // context, and set an OpenGL ES 2.0-compatible renderer.
        mGLSurfaceView.setEGLContextClientVersion(2);
        pointsRenderer = new PointsRenderer(this);
        mGLSurfaceView.setRenderer(pointsRenderer);
    } else {
        // TODO: Handle as an unrecoverable error and leave the activity somehow...
    }

    // External files preparation

    InputStream in = null;
    OutputStream out = null;
    try {
        Log.d(DEBUG_TAG, "Media rady: " + isExternalStorageWritable());

        AssetManager assetManager = getAssets();
        in = assetManager.open(GALGS_CLASS_FILE);
        if (in != null) {
            galgsRubyClassesDirectory = new File(GALGS_CLASS_DIR);
            galgsRubyClassesDirectory.mkdir();
            if (!galgsRubyClassesDirectory.isDirectory()) {
                Log.d(DEBUG_TAG, "Hmm, " + galgsRubyClassesDirectory + " does not exist, trying mkdirs...");
                galgsRubyClassesDirectory.mkdirs();
            }
            File outputFile = new File(galgsRubyClassesDirectory, GALGS_CLASS_FILE);
            if (outputFile.exists()) {
                // Load from what user might have edited
                outputFile = new File(galgsRubyClassesDirectory, GALGS_CLASS_FILE + ".orig");
            }
            out = new FileOutputStream(outputFile);
            copyFile(in, out);
            in.close();
            in = null;
            out.flush();
            out.close();
            out = null;
        } else {
            Log.e("IO HELL", "Asset " + GALGS_CLASS_FILE + " not found...");
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // Stops the thing from trashing the context on pause/resume.
    mGLSurfaceView.setPreserveEGLContextOnPause(true);
    setContentView(mGLSurfaceView);

}

From source file:nrec.basil.wimuconsole.SensorSettingsActivity.java

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

    // Set up the action bar to show a dropdown list which will
    // contain the various sensors that can be configured.  Some
    // sensors are local (camera) some are remote bluetooth devices
    // (IMU, Barometer etc.)
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, getResources().getStringArray(R.array.sensors_list)),
            this);

    // Specify a SpinnerAdapter to populate the wIMU list
    ArrayAdapter<CharSequence> imuAdapter = ArrayAdapter.createFromResource(this, R.array.wimu_list,
            android.R.layout.simple_spinner_item);
    imuAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    imuSpinner = (Spinner) findViewById(R.id.wimulist);
    imuSpinner.setAdapter(imuAdapter);//from  w w w .  java  2  s.  com

    // Load the BASIL start/stop/reset commands
    InputStream input = getResources().openRawResource(R.raw.basilstart);
    try {
        input.read(basilStart, 0, 26);
    } catch (IOException e) {
        Log.e(TAG, "Could not read BASIL start command", e);
    }
    input = getResources().openRawResource(R.raw.basilstop);
    try {
        input.read(basilStop, 0, 26);
    } catch (IOException e) {
        Log.e(TAG, "Could not read BASIL stop command", e);
    }
    input = getResources().openRawResource(R.raw.basilreset);
    try {
        input.read(basilReset, 0, 26);
    } catch (IOException e) {
        Log.e(TAG, "Could not read BASIL reset command", e);
    }

    // Get the default filename for logging
    EditText logfilename = (EditText) findViewById(R.id.logfilename);
    mLogFileName = logfilename.toString();

    // Get local Bluetooth adapter
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    // If the adapter is null, then Bluetooth is not supported
    if (mBluetoothAdapter == null) {
        Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        finish();
        return;
    }
}

From source file:com.semaphore.sm.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean darktheme = prefs.getBoolean("darktheme", false);
    if (darktheme)
        setTheme(android.R.style.Theme_Holo);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/*from ww w . j a  va 2 s.co  m*/
    // setup action bar for tabs

    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception ex) {
        // Ignore
    }

    if ("mako".equals(android.os.Build.DEVICE))
        Device = SemaDevices.Mako;
    else
        Device = SemaDevices.I9000;

    if (Device == SemaDevices.Mako)
        sp = new SemaN4Properties();
    else
        sp = new SemaI9000Properties();

    checkSU_BB();
    unpackScripts();

    checkFirstRun();

    mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), this);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mPagerAdapter);

    PagerTabStrip pagerTitleStrip = (PagerTabStrip) findViewById(R.id.pager_title_strip);
    pagerTitleStrip.setDrawFullUnderline(true);
    pagerTitleStrip.setTabIndicatorColor(0x33b5e5);

    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);

    actionBar.setTitle("Semaphore Manager");

    actionBar.setSubtitle(SemaphoreVer);

    updateSummaries();

}

From source file:fr.cph.chicago.activity.BusActivity.java

@Override
public final boolean onCreateOptionsMenu(final Menu menu) {
    super.onCreateOptionsMenu(menu);
    this.mMenu = menu;

    // Inflate menu with no search
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main_no_search, menu);

    // Modify action bar title
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("Bus");

    // Load top bar animation
    MenuItem refreshMenuItem = menu.findItem(R.id.action_refresh);
    refreshMenuItem.setActionView(R.layout.progressbar);
    refreshMenuItem.expandActionView();//from w ww .j a  va  2 s . c o m

    return true;
}

From source file:com.emman.tame.MainActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();

    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(R.layout.action_bar);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);/*from  w ww  .j  a v a2 s . co  m*/
}

From source file:com.scto.filerenamer.FileRenamerActivity.java

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

    mSettings = Prefs.getSharedPreferences(this);
    mSettings.registerOnSharedPreferenceChangeListener(this);

    if (Prefs.getThemeType(this) == false) {
        mThemeId = R.style.AppTheme_Light;
        setTheme(mThemeId);//  w w  w  . j  a  va 2s. c om
    } else {
        mThemeId = R.style.AppTheme_Dark;
        setTheme(mThemeId);
    }

    ActionBar mActionBar = getActionBar();
    if (mActionBar != null) {
        mActionBar.setDisplayHomeAsUpEnabled(true);
        mActionBar.setDisplayShowHomeEnabled(true);
        mActionBar.setDisplayShowTitleEnabled(true);
        mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    } else {
        if (BuildConfig.DEBUG) {
            Log.w("[" + TAG + "]", "mActionBar == null");
        }
    }

    setContentView(R.layout.fragment_tabs_pager);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup();

    mViewPager = (ViewPager) findViewById(R.id.pager);

    mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

    mTabsAdapter.addTab(
            mTabHost.newTabSpec(getString(R.string.addNumber)).setIndicator(getString(R.string.addNumber)),
            AddNumbersFragment.class, null);
    mTabsAdapter.addTab(
            mTabHost.newTabSpec(getString(R.string.addCustom)).setIndicator(getString(R.string.addCustom)),
            AddCustomFragment.class, null);
    mTabsAdapter.addTab(
            mTabHost.newTabSpec(getString(R.string.addDate)).setIndicator(getString(R.string.addDate)),
            AddCharsFragment.class, null);
    mTabsAdapter.addTab(mTabHost.newTabSpec(getString(R.string.findAndReplace))
            .setIndicator(getString(R.string.findAndReplace)), AddDateFragment.class, null);
    mTabsAdapter.addTab(
            mTabHost.newTabSpec(getString(R.string.removeChars)).setIndicator(getString(R.string.removeChars)),
            RemoveCharsFragment.class, null);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        this.setTitle(extras.getString("dir") + " :: " + getString(R.string.app_name));
    } else {
        if (BuildConfig.DEBUG) {
            Log.w("[" + TAG + "]", "onCreate( savedInstanceState ) : extras == null");
        }
        this.setTitle(" :: " + getString(R.string.app_name));
    }

    if (savedInstanceState != null) {
        mActionBar.setSelectedNavigationItem(savedInstanceState.getInt("action_bar_tab", 0));
        mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab_host"));
    }
}

From source file:com.xortech.multipanic.PanicAddMain.java

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

    // REMOVE THE TITLE FROM THE ACTIONBAR
    ActionBar actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setDisplayShowTitleEnabled(false);

    panicList = (ListView) findViewById(R.id.tagList);
    panicList.setItemsCanFocus(false);// w  w w . jav a  2  s.  c  o  m
    addBtn = (Button) findViewById(R.id.add_btn);

    Set_Referash_Data();

    /**
     * LISTENER TO ADD OR UPDATE A NEW USER TO THE PANIC NUMBERS DATABASE
     * */
    addBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent addPanic = new Intent(PanicAddMain.this, PanicAddUpdate.class);
            addPanic.putExtra("called", "add");
            addPanic.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(addPanic);
            finish();
        }
    });

    /**
     * LISTENER TO OPEN/CLOSE THE EXPANSION OF EACH CLICKED ITEM IN THE LISTVIEW
     */
    panicList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {

            View toolbar = view.findViewById(R.id.expandable);

            // Creating the expand animation for the item
            ExpandAnimation expandAni = new ExpandAnimation(toolbar, 500);

            // Start the animation on the toolbar
            toolbar.startAnimation(expandAni);
        }
    });
}

From source file:com.antew.redditinpictures.library.ui.ImageViewerActivity.java

/**
 * Enable some additional newer visibility and ActionBar features to create a more
 * immersive photo viewing experience./*w ww .j  a v a 2s . c o  m*/
 * <p/>
 * Initialize the mActionBarHeight variable.
 */
private void initializeActionBar() {
    final ActionBar actionBar = getActionBar();

    // Hide title text and set home as up
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.reddit_in_pictures);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Calculate ActionBar height
    TypedValue tv = new TypedValue();
    if (getTheme() != null && getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        mActionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
    }
}

From source file:com.amagi82.kerbalspaceapp.MissionPlanner.java

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

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    getActionBar().setTitle(R.string.title_activity_mission_planner);

    if (savedInstanceState == null) {
        // Load saved missionData if available.
        try {//w w  w . j a  v  a2 s  .  c  om
            FileInputStream inStream = new FileInputStream(
                    Environment.getExternalStorageDirectory() + File.separator + "MissionData");
            ObjectInputStream objectInStream = new ObjectInputStream(inStream);
            int count = objectInStream.readInt();
            for (int i = 0; i < count; i++)
                missionData.add((MissionData) objectInStream.readObject());
            objectInStream.close();
        } catch (OptionalDataException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        // if the list is empty, add the default planet
        if (missionData.size() == 0) {
            missionData = setFirstMissionData();
        }
    } else {
        missionData = savedInstanceState.getParcelableArrayList("key");
    }

    mBackgroundContainer = (BackgroundContainer) findViewById(R.id.listViewBackground);
    mListView = (ListView) findViewById(R.id.list);
    tvTotalDeltaV = (TextView) findViewById(R.id.tvTotalDeltaV);
    mAdapter = new StableArrayAdapter(this, missionData, mTouchListener);

    // add the newDestination button as a footer below the listview
    ImageView newDestination = new ImageView(this);
    newDestination.setImageResource(R.drawable.ic_plus);
    mListView.addFooterView(newDestination);
    newDestination.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int possibleIconState = 0; // Lets MissionDestination know which icons it's allowed to use
            if (missionData.size() < 1) {
                possibleIconState = 1;
            }
            Intent intent = new Intent(MissionPlanner.this, MissionDestination.class);
            intent.putExtra("possibleIconState", possibleIconState);
            intent.putExtra("isNewItem", true); // Places the result as a new item in the listview
            startActivityForResult(intent, 0);
        }
    });
    mListView.setAdapter(mAdapter);
}

From source file:com.lugia.timetable.SubjectDetailActivity.java

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

    mWeekName = Utils.getWeekNameString(SubjectDetailActivity.this, Utils.SHORT_WEEK_NAME);
    mTimeName = Utils.getTimeNameString(SubjectDetailActivity.this);

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);

    PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager());

    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    PagerTabStrip tabStrip = (PagerTabStrip) findViewById(R.id.pager_tab_strip);

    RelativeLayout headerLayout = (RelativeLayout) findViewById(R.id.layout_header);

    TextView subjectTitleTextView = (TextView) findViewById(R.id.text_subject_title);
    TextView lectureSectionTextView = (TextView) findViewById(R.id.text_lecture_section);
    TextView tutorialSectionTextView = (TextView) findViewById(R.id.text_tutorial_section);
    TextView creditHoursTextView = (TextView) findViewById(R.id.text_credit_hour);

    Bundle intentExtra = getIntent().getExtras();

    SubjectList subjectList = SubjectList.getInstance(SubjectDetailActivity.this);

    String subjectCode = intentExtra.getString(EXTRA_SUBJECT_CODE);

    mSubject = subjectList.findSubject(subjectCode);

    String subjectDescription = mSubject.getSubjectDescription();
    String lectureSection = mSubject.getLectureSection();
    String tutorialSection = mSubject.getTutorialSection();

    int colorIndex = mSubject.getColor();
    int creditHours = mSubject.getCreditHours();

    mColors = Utils.getForegroundColor(SubjectDetailActivity.this, colorIndex);
    mBackgrounds = Utils.getBackgroundDrawableResourceId(colorIndex);

    viewPager.setAdapter(adapter);//  www  . j a  v a 2s. com
    headerLayout.setBackgroundColor(mColors);

    tabStrip.setTextColor(mColors);
    tabStrip.setTabIndicatorColor(mColors);

    subjectTitleTextView.setText(subjectCode + " - " + subjectDescription);
    lectureSectionTextView.setText(lectureSection);
    tutorialSectionTextView.setText(tutorialSection);
    creditHoursTextView.setText(creditHours + " Credit Hours");

    if (tutorialSection == null)
        tutorialSectionTextView.setVisibility(View.GONE);

    // user click the event reminder notification, show the event detail
    if (getIntent().getAction() != null && getIntent().getAction().equals(ACTION_VIEW_EVENT)) {
        long eventId = intentExtra.getLong(EXTRA_EVENT_ID, -1);

        Event event = mSubject.findEvent(eventId);

        if (event != null) {
            Bundle args = new Bundle();

            args.putString(EventDetailDialogFragment.EXTRA_SUBJECT_CODE, mSubject.getSubjectCode());
            args.putLong(EventDetailDialogFragment.EXTRA_EVENT_ID, event.getId());

            // dont allow event editing in such situation
            args.putBoolean(EventDetailDialogFragment.EXTRA_EDITABLE, false);

            EventDetailDialogFragment f = EventDetailDialogFragment.newInstance(args);

            f.show(getFragmentManager(), event.getName());
        } else
            Toast.makeText(SubjectDetailActivity.this, "No such event.", Toast.LENGTH_SHORT).show();
    }
}