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:com.untappedkegg.rally.home.ActivityMain.java

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

    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mActionBarDrawer[curPosition]);
    }/*from ww  w. ja v  a 2 s. c  om*/
}

From source file:com.linkedin.android.eventsapp.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    pager = new ViewPager(this);
    pager.setId(R.id.pager);/*from   www. j a  v a 2  s .  c o  m*/
    pager.setOffscreenPageLimit(5);
    setContentView(pager);

    final ActionBar bar = getActionBar();
    View viewActionBar = getLayoutInflater().inflate(R.layout.layout_action_bar, null);

    TextView textviewTitle = (TextView) viewActionBar.findViewById(R.id.actionbar_textview);
    ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,
            ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
    textviewTitle.setText("UPCOMING EVENTS");
    bar.setCustomView(viewActionBar, params);
    bar.setDisplayShowCustomEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setIcon(new ColorDrawable(Color.TRANSPARENT));
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F15153")));

    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mEventTabsAdapter = new com.linkedin.android.eventsapp.EventTabsAdapter(this, pager);
    SimpleDateFormat ft = new SimpleDateFormat("E dd MMM");
    ArrayList<Event> events = EventsManager.getInstance(this).getEvents();
    for (Event event : events) {
        String eventDay = ft.format(new Date(event.getEventDate()));
        mEventTabsAdapter.addTab(bar.newTab().setText(eventDay), EventFragment.class, event);
    }
}

From source file:com.jiusg.mainscreenshow.ui.MSS.java

/**
 * ActionBar/*from   w ww.  j a v  a 2 s. c om*/
 *
 * @param layoutId Id
 */
public void setActionBarLayout(int layoutId) {
    ActionBar actionBar = getActionBar();
    if (null != actionBar) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setDisplayUseLogoEnabled(false);

        LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflator.inflate(layoutId, null);
        ActionBar.LayoutParams layout = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        actionBar.setCustomView(v, layout);
    }
}

From source file:com.patil.geobells.lite.MainActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(title);//  www.ja va 2 s  .com
}

From source file:com.app.blockydemo.ui.fragment.FormulaEditorFragment.java

private void setUpActionBar() {
    ActionBar actionBar = getActivity().getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.formula_editor_title);
}

From source file:ch.ethz.coss.nervousnet.hub.ui.SensorDisplayActivity.java

@Override
public void updateActionBar() {

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflator.inflate(R.layout.ab_nn, null);
    ActionBar actionBar;
    Switch mainSwitch;//from  w  ww  . j  a  v a  2s.c  o  m

    actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setCustomView(v);
    mainSwitch = (Switch) findViewById(R.id.mainSwitch);

    byte state = ((Application) getApplication()).getState();
    NNLog.d("SensorDisplayActivity", "state = " + state);
    mainSwitch.setChecked(state == 0 ? false : true);

    mainSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            startStopSensorService(isChecked);
        }
    });

}

From source file:com.xortech.multitag.TagAddUpdate.java

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

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

    // SET UP THE SCREEN
    Set_Add_Update_Screen();/*from w  w w . j a  v  a 2s.  c om*/

    // SET THE VISIBILITY
    String called_from = getIntent().getStringExtra("called");

    if (called_from.equalsIgnoreCase("add")) {
        add_view.setVisibility(View.VISIBLE);
        update_view.setVisibility(View.GONE);
    } else {
        update_view.setVisibility(View.VISIBLE);
        add_view.setVisibility(View.GONE);
        USER_ID = Integer.parseInt(getIntent().getStringExtra("USER_ID"));

        MyTags c = dbHandler.Get_Tag(USER_ID);

        add_tag.setText(c.getMyTag());
        add_mobile.setText(c.getMyTagPhoneNumber());
        add_secret.setText(c.getTagSecret());
        active = c.getTagStatus();

        dbHandler.close();
    }

    add_mobile.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO: Auto-generated method stub
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {
            Is_Valid_Sign_Number_Validation(6, 16, add_mobile);
        }
    });

    add_secret.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO: Auto-generated method stub
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {
            Is_Valid_Secret(add_secret);
        }
    });

    add_tag.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub 
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub
            Is_Valid_Tag_Name(add_tag);
        }
    });

    add_save_btn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (valid_tag != null && valid_mob_number != null && valid_secret != null && valid_tag.length() != 0
                    && valid_mob_number.length() != 0 && valid_secret.length() != 0) {

                newTag = new MyTags(valid_tag, valid_mob_number, valid_secret, 1);

                dbHandler.Add_Tag(newTag);
                toastMsg = "Tag Added";
                Show_Toast(toastMsg);
                ResetText();
                ResetError();
                ReturnToMain();
            } else {
                VibrateError(add_tag, add_mobile, add_secret);
                toastMsg = "Invalid Input!";
                Show_Toast(toastMsg);
                ResetText();
                ResetError();
            }
        }
    });

    update_btn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            valid_tag = add_tag.getText().toString();
            valid_mob_number = add_mobile.getText().toString();
            valid_secret = add_secret.getText().toString();

            // CHECK IF THE VALUE STATE IS NULL OR NOT
            if (valid_tag != null && valid_mob_number != null && valid_secret != null && valid_tag.length() != 0
                    && valid_mob_number.length() != 0 && valid_secret.length() != 0) {

                newTag = new MyTags(USER_ID, valid_tag, valid_mob_number, valid_secret, active);

                dbHandler.Update_Tag(newTag);
                dbHandler.close();
                toastMsg = "Tag Update Successful";
                Show_Toast(toastMsg);
                ResetText();
                ResetError();
                ReturnToMain();
            } else {
                VibrateError(add_tag, add_mobile, add_secret);
                toastMsg = "Invalid input detected.\nPlease fill in all fields.";
                Show_Toast(toastMsg);
                ResetError();
            }
        }
    });

    update_view_all.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ReturnToMain();
        }
    });

    add_view_all.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ReturnToMain();
        }
    });
}

From source file:com.digium.respoke.ChatActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    Button buttonSend = (Button) findViewById(R.id.buttonSend);

    EditText chatText = (EditText) findViewById(R.id.chatText);
    chatText = (EditText) findViewById(R.id.chatText);
    chatText.setOnKeyListener(new View.OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                sendChatMessage();/*from   w w w .  ja  v a2s . c o m*/
                return true;
            }
            return false;
        }
    });
    buttonSend.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            sendChatMessage();
        }
    });

    String remoteEndpointID = null;
    boolean shouldStartDirectConnection = false;

    // Check whether we're recreating a previously destroyed instance
    if (savedInstanceState != null) {
        remoteEndpointID = savedInstanceState.getString(ENDPOINT_ID_KEY);
        shouldStartDirectConnection = savedInstanceState.getBoolean(DIRECT_CONNECTION_KEY, false);
    } else {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            remoteEndpointID = extras.getString(ENDPOINT_ID_KEY);
            shouldStartDirectConnection = extras.getBoolean(DIRECT_CONNECTION_KEY, false);
        } else {
            // The activity must have been destroyed while it was hidden to save memory. Use the most recent persistent data.
            SharedPreferences prefs = getSharedPreferences(ConnectActivity.RESPOKE_SETTINGS, 0);
            remoteEndpointID = prefs.getString(ENDPOINT_ID_KEY, "");
            shouldStartDirectConnection = prefs.getBoolean(DIRECT_CONNECTION_KEY, false);
        }
    }

    conversation = ContactManager.sharedInstance().conversations.get(remoteEndpointID);
    remoteEndpoint = ContactManager.sharedInstance().sharedClient.getEndpoint(remoteEndpointID, true);
    setTitle(remoteEndpoint.getEndpointID());

    listAdapter = new ListDataAdapter();

    ListView lv = (ListView) findViewById(R.id.list); //retrieve the instance of the ListView from your main layout
    lv.setAdapter(listAdapter); //assign the Adapter to be used by the ListView

    if (shouldStartDirectConnection && (null == remoteEndpoint.directConnection())) {
        // If the direct connection has not been started yet, start it now
        remoteEndpoint.startDirectConnection();
    }

    directConnection = remoteEndpoint.directConnection();
    if (null != directConnection) {
        directConnection.setListener(this);
        RespokeCall call = directConnection.getCall();
        boolean caller = false;

        if (null != call) {
            call.setListener(this);
            caller = call.isCaller();
        }

        View answerView = findViewById(R.id.answer_view);
        View connectingView = findViewById(R.id.connecting_view);
        TextView callerNameView = (TextView) findViewById(R.id.caller_name_text);

        if (caller) {
            answerView.setVisibility(View.INVISIBLE);
            connectingView.setVisibility(View.VISIBLE);
        } else {
            answerView.setVisibility(View.VISIBLE);
            connectingView.setVisibility(View.INVISIBLE);
        }

        if (null != remoteEndpoint) {
            callerNameView.setText(remoteEndpoint.getEndpointID());
        } else {
            callerNameView.setText("Unknown Caller");
        }

        ActionBar actionBar = getActionBar();
        actionBar.setBackgroundDrawable(new ColorDrawable(R.color.incoming_connection_bg));
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowTitleEnabled(true);
    }
}

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

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

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

    // SET THE SCREEN
    Set_Add_Update_Screen();/*w w w .  j  a v a2 s . co m*/

    // SET VISIBILITY OF VIEW AS PER CALLING ACTIVITY
    String called_from = getIntent().getStringExtra("called");

    if (called_from.equalsIgnoreCase("add")) {
        add_view.setVisibility(View.VISIBLE);
        update_view.setVisibility(View.GONE);
    } else {
        update_view.setVisibility(View.VISIBLE);
        add_view.setVisibility(View.GONE);

        USER_ID = Integer.parseInt(getIntent().getStringExtra("USER_ID"));

        MyPanicNumbers c = dbHandler.Get_Numbers(USER_ID);

        add_tag.setText(c.getMyPanicTag());
        add_mobile.setText(c.getMyPanicPhoneNumber());
        add_email.setText(c.getMyPanicEmail());
        tActive = c.getPanicActive();
        pActive = c.getPanicActiveP();
        eActive = c.getPanicActiveE();
        dbHandler.close();
    }

    add_mobile.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO: Auto-generated method stub
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {
            Is_Valid_Sign_Number_Validation(6, 16, add_mobile);
        }
    });

    add_tag.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO: Auto-generated method stub
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub
            Is_Valid_Tag_Name(15, add_tag);
        }
    });

    add_email.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO: 
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {
            Is_Valid_Email(25, add_email);
        }
    });

    add_save_btn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            if (valid_tag != null && valid_mob_number != null && valid_tag.length() != 0
                    && valid_mob_number.length() != 0) {

                newPanic = new MyPanicNumbers(valid_tag, valid_mob_number, valid_email, 1, 1, 1);

                dbHandler.Add_Number(newPanic);
                dbHandler.close();
                toastMsg = "Tag Added";
                Show_Toast(toastMsg);
                ResetText();
                ResetError();
                ReturnToMain();
            } else {
                VibrateError(add_tag, add_mobile, add_email);
                toastMsg = "Invalid Input!";
                Show_Toast(toastMsg);
                ResetText();
                ResetError();
            }
        }
    });

    update_btn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            valid_tag = add_tag.getText().toString();
            valid_mob_number = add_mobile.getText().toString();
            valid_email = add_email.getText().toString();

            // check the value state is null or not
            if (valid_tag != null && valid_mob_number != null && valid_tag.length() != 0
                    && valid_mob_number.length() != 0) {

                newPanic = new MyPanicNumbers(USER_ID, valid_tag, valid_mob_number, valid_email, tActive,
                        pActive, eActive);

                dbHandler.Update_Number(newPanic);
                dbHandler.close();
                toastMsg = "Tag Update Successful";
                Show_Toast(toastMsg);
                ResetText();
                ResetError();
                ReturnToMain();
            } else {
                VibrateError(add_tag, add_mobile, add_email);
                toastMsg = "Invalid input detected.\nPlease fill in all fields.";
                Show_Toast(toastMsg);
                ResetError();
            }
        }
    });

    update_view_all.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ReturnToMain();
        }
    });

    add_view_all.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ReturnToMain();
        }
    });
}

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

/**
 * Restore action bar/*  w  ww  .j a va  2 s . c  o  m*/
 */
public final void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}