@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_commit_file_view); setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); repo = getIntent().getParcelableExtra(EXTRA_REPOSITORY); commit = getStringExtra(EXTRA_HEAD); sha = getStringExtra(EXTRA_BASE); path = getStringExtra(EXTRA_PATH); loadingBar = finder.find(R.id.pb_loading); codeView = finder.find(R.id.wv_code); file = CommitUtils.getName(path); isMarkdownFile = MarkdownUtils.isMarkdown(file); editor = new SourceEditor(codeView); editor.setWrap(PreferenceUtils.getCodePreferences(this).getBoolean(WRAP, false)); ActionBar actionBar = getSupportActionBar(); int lastSlash = path.lastIndexOf('/'); if (lastSlash != -1) actionBar.setTitle(path.substring(lastSlash + 1)); else actionBar.setTitle(path); actionBar.setSubtitle(getString(R.string.commit_prefix) + CommitUtils.abbreviate(commit)); avatars.bind(actionBar, repo.owner); loadContent(); }
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (getIntent().getExtras() != null) { boolean doPlayTrack = getIntent().getExtras().getBoolean("playTrack"); mArtistName = getIntent().getExtras().getString("artist"); ActionBar actionbar = getSupportActionBar(); if (mArtistName != null) { actionbar.setTitle(mArtistName); } else { actionbar.setTitle(""); } if (!mHasRestored) { mPosition = getIntent().getExtras().getInt("position"); ArrayList<TrackInfo> top10tracks = getIntent().getExtras().getParcelableArrayList("top10tracks"); PlayerFragment playerFragment = (PlayerFragment) getFragmentManager().findFragmentById(R.id.ss_player_fragment); playerFragment.initializeTrack(mArtistName, top10tracks, mPosition, doPlayTrack); } } }
/** * 设置标题 @Title: setTitle * * @param actionBar * @param spannableString */ public static void setTitle( android.support.v7.app.ActionBar actionBar, SpannableString spannableString) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN && Build.MANUFACTURER.toUpperCase().equals("LGE")) { actionBar.setTitle(spannableString.toString()); } else { actionBar.setTitle(spannableString); } }
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); if (navigationDepth == 0) actionBar.setTitle(getTitle()); else if (navigationDepth == 1) actionBar.setTitle(subCategoryTitle); else if (navigationDepth == 2) actionBar.setTitle(resultListTitle); else if (navigationDepth == 3) actionBar.setTitle(detailViewTitle); else if (navigationDepth == 4) actionBar.setTitle(searchQueryTitle); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_issue_edit); titleText = finder.find(R.id.et_issue_title); bodyText = finder.find(R.id.et_issue_body); milestoneGraph = finder.find(R.id.ll_milestone_graph); milestoneText = finder.find(R.id.tv_milestone); milestoneClosed = finder.find(R.id.v_closed); assigneeAvatar = finder.find(R.id.iv_assignee_avatar); assigneeText = finder.find(R.id.tv_assignee_name); labelsText = finder.find(R.id.tv_labels); Intent intent = getIntent(); if (savedInstanceState != null) issue = savedInstanceState.getParcelable(EXTRA_ISSUE); if (issue == null) issue = intent.getParcelableExtra(EXTRA_ISSUE); if (issue == null) issue = new Issue(); repository = InfoUtils.createRepoFromData( intent.getStringExtra(EXTRA_REPOSITORY_OWNER), intent.getStringExtra(EXTRA_REPOSITORY_NAME)); checkCollaboratorStatus(); setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (issue.number > 0) if (IssueUtils.isPullRequest(issue)) actionBar.setTitle(getString(R.string.pull_request_title) + issue.number); else actionBar.setTitle(getString(R.string.issue_title) + issue.number); else actionBar.setTitle(R.string.new_issue); actionBar.setSubtitle(InfoUtils.createRepoId(repository)); avatars.bind(actionBar, (User) intent.getParcelableExtra(EXTRA_USER)); titleText.addTextChangedListener( new TextWatcherAdapter() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { super.onTextChanged(s, start, before, count); updateSaveMenu(s); } }); updateSaveMenu(); titleText.setText(issue.title); bodyText.setText(issue.body); }
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); if (mSelectPos != 2) { mTitle = mMainTitles[mSelectPos]; actionBar.setDisplayShowCustomEnabled(false); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); } else { actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(mActionbarCustom); actionBar.setTitle(""); } }
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(getString(R.string.action_settings)); } }
@Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments try { initFragments(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.main_container, fragments[position]).commit(); // Titel setzen ActionBar actionBar = getSupportActionBar(); if (actionBar != null) actionBar.setTitle(getResources().getStringArray(R.array.array_pager_titels)[position]); /*if (toolbar!=null) toolbar.setTitle(getResources().getStringArray(R.array.array_pager_titels)[position]);*/ } catch (Exception e) { e.printStackTrace(); } // Daten aus "MyContact" speichern new Thread( new Runnable() { public void run() { saveDataFromMyContact(); } }) .start(); }
/** * Updates title bar and home buttons (state and icon). * * <p>Assumes that navigation drawer is NOT visible. */ protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) { String title = getString(R.string.default_display_name_for_root_folder); // default boolean inRoot; /// choose the appropiate title if (chosenFile == null) { chosenFile = mFile; // if no file is passed, current file decides } inRoot = (chosenFile == null || (chosenFile.isFolder() && chosenFile.getParentId() == FileDataStorageManager.ROOT_PARENT_ID)); if (!inRoot) { title = chosenFile.getFileName(); } /// set the chosen title ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(title); /// also as content description View actionBarTitleView = getWindow() .getDecorView() .findViewById(getResources().getIdentifier("action_bar_title", "id", "android")); if (actionBarTitleView != null) { // it's null in Android 2.x actionBarTitleView.setContentDescription(title); } /// set home button properties mDrawerToggle.setDrawerIndicatorEnabled(inRoot); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.proanswerwrite, container, false); dbVersion = ((MainActivity) getActivity()).getDBVersion(); mTwoPane = ((MainActivity) getActivity()).getTwoPane(); num = getArguments().getString("num"); ansCount = getArguments().getString("ansCount"); dbHelper = new DBHelper(getActivity(), dbName, null, dbVersion); db = dbHelper.getWritableDatabase(); sql = "SELECT * FROM inner_db;"; Cursor cursor = db.rawQuery(sql, null); cursor.moveToFirst(); tempnick = cursor.getString(3); abar = ((MainActivity) getActivity()).getSupportActionBar(); abar.setTitle(tempnick + "님에게 답변중"); abar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); abar.setDisplayHomeAsUpEnabled(true); ldialog = new LoadingDialog(this.getActivity()); // 변경 ldialog .getWindow() .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); ldialog.show(); answerViewThread = (AnswerViewThread) new AnswerViewThread(); answerViewThread.execute(); conet = (EditText) rootView.findViewById(R.id.replycon); conet.setPadding(20, 20, 20, 20); return rootView; }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final ActionBar actionBar = UIUtils.getSupportActionBar(getActivity()); actionBar.setTitle(R.string.private_messages); mViewPager = (ViewPager) view.findViewById(R.id.message_view_pager); mViewPager.setAdapter(mAdapter); final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.pager_tab_strip); tabLayout.setSelectedIndicatorColors(getResources().getColor(android.R.color.white)); tabLayout.setViewPager(mViewPager); final FloatingActionButton button = (FloatingActionButton) view.findViewById(R.id.message_fragment_action_create); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(final View v) { final DialogFragment fragment = CreateMessageFragment.createInstance(); fragment.setTargetFragment(MessagePagerFragment.this, CREATE_MESSAGE_REQUEST_CODE); fragment.show(getFragmentManager(), "createMessage"); } }); if (CompatUtils.hasLollipop()) { CompatUtils.setBackground(button, getResources().getDrawable(R.drawable.fab_background)); } else { button.setBackgroundColor(getResources().getColor(R.color.fab_color)); } }
@Override protected void onInitActionBar() { // TODO Auto-generated method stub super.onInitActionBar(); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.saoyy); }
public void updateActionBarTitle() { actionBar.setTitle( getString( R.string.image_index, pagerFragment.getViewPager().getCurrentItem() + 1, pagerFragment.getPaths().size())); }
public void setupActionBar(boolean isUpEnabled, String title, int upIcon) { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(isUpEnabled); actionBar.setDisplayShowTitleEnabled(true); actionBar.setHomeAsUpIndicator(upIcon); actionBar.setTitle(title); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_thumbnails); FragmentManager fm = getFragmentManager(); ThumbnailsFragment thumbnailsFragment = (ThumbnailsFragment) fm.findFragmentByTag(Utils.THUMBNAILS_FRAGMENT_TAG); if (thumbnailsFragment == null) { FragmentTransaction ft = fm.beginTransaction(); ft.replace( R.id.thumbnails_fragment_container, new ThumbnailsFragment(), Utils.THUMBNAILS_FRAGMENT_TAG); ft.commit(); fm.executePendingTransactions(); } // set title and subtitle to action bar ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle("Krok 9 z 9"); actionBar.setSubtitle("Przesyłanie zdjęc na serwer"); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.panza_galeria); // Facebook StatusCallback callback = new StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) {} }; uiHelper = new UiLifecycleHelper(this, callback); uiHelper.onCreate(savedInstanceState); g_imagenesBitmap = new ArrayList<Bitmap>(); PanzaActivity_sqlCon db = new PanzaActivity_sqlCon(getApplicationContext()); g_imagenes = db.getImagenes(); g_llContenedor = (LinearLayout) findViewById(R.id.llContenedor); if (g_imagenes.size() > 0) { new LoadImagesFromSDCard().execute(""); } ActionBar barra = getSupportActionBar(); barra.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME); barra.setTitle(""); barra.setIcon(R.drawable.logo02); barra.setBackgroundDrawable(getResources().getDrawable(R.drawable.gradiente)); barra.setDisplayHomeAsUpEnabled(true); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.review_laundry); ActionBar bar = getSupportActionBar(); bar.setBackgroundDrawable( new ColorDrawable(Color.parseColor(getResources().getString(R.string.action_bar_color)))); bar.setDisplayShowHomeEnabled(true); bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true); Intent intent = getIntent(); listView_laundry_review = (ListView) findViewById(R.id.listView_laundry_review); bar.setTitle(intent.getExtras().getString("LaundryName") + " Reviews"); if (Network.HaveNetworkConnection(LaundryReview.this)) { getReview(intent.getExtras().getString("LaundryId")); } else { AlertUtil alert = new AlertUtil(); alert.messageAlert( LaundryReview.this, getResources().getString(R.string.network_title), getResources().getString(R.string.network_message)); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_note); Intent intent = getIntent(); mNote = (Note) intent.getSerializableExtra("note"); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setHomeAsUpIndicator(R.drawable.ic_keyboard_backspace_black_24dp); supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setTitle(""); } FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(ViewNoteActivity.this, EditNoteActivity.class); intent.putExtra("note", mNote); startActivityForResult(intent, VIEW_REQUEST_CODE); } }); initViews(); initListeners(); }
private void navigate(int menuItem) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { int titleRes = 0; switch (menuItem) { case R.id.nav_item_favorites: titleRes = R.string.favorites; getSupportFragmentManager() .beginTransaction() .replace(R.id.content_fragment_container, FavoritesFragment.newInstance()) .commit(); break; case R.id.nav_item_departures: titleRes = R.string.real_time_departures; getSupportFragmentManager() .beginTransaction() .replace(R.id.content_fragment_container, DeparturesFragment.newInstance()) .commit(); break; case R.id.nav_item_debug: titleRes = R.string.debug; getSupportFragmentManager() .beginTransaction() .replace(R.id.content_fragment_container, ManualRequestFragment.newInstance()) .addToBackStack(null) .commit(); break; } actionBar.setTitle(getResources().getString(titleRes)); } }
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP); actionBar.setTitle(R.string.app_name); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sentencegroups_act); Log.d(TAG, "onCreate"); handleIntent(getIntent()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setTitle(R.string.sentences_title); SentencesFragment cleanFragment = (SentencesFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame); if (cleanFragment == null) { cleanFragment = SentencesFragment.newInstance(); ActivityUtils.addFragmentToActivity( getSupportFragmentManager(), cleanFragment, R.id.contentFrame); } presenter = new SentencesPresenter(cleanFragment); selectPresenter = new SentencesSelectPresenter(cleanFragment); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settle_info); ActionBar mActionBar = getSupportActionBar(); mActionBar.setHomeButtonEnabled(true); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setTitle("提现明细"); mListView = (AutoRefreshListView) findViewById(R.id.settle_listview); mListView.setOnGetToButtomListener( new AutoRefreshListView.OnGetToButtomListener() { @Override public void onButtomAndNetOk() { fetchData(); } }); mListView.setIfAutoScroll(false); adapter = new MAdapter(); mListView.setAdapter(adapter); if (CodeUtil.checkNetState(this)) { loadDate = DateUtil.getNowDate(); fetchData(); } else { mListView.setStateNoMoreData(); } }
private void initTitleBar() { mSpinnerAdapter = new MySpinnerAdapter(getLayoutInflater()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar supportActionBar = getSupportActionBar(); supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setDisplayShowHomeEnabled(true); supportActionBar.setHomeButtonEnabled(true); supportActionBar.setTitle(""); supportActionBar.setDisplayShowCustomEnabled(true); supportActionBar.setCustomView(R.layout.actionbar_custom_spinner); Spinner spinner = (Spinner) supportActionBar.getCustomView().findViewById(R.id.spinner); spinner.setAdapter(mSpinnerAdapter); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mSpinnerAdapter.setCheckPos(position); changePageShow(position); } @Override public void onNothingSelected(AdapterView<?> parent) {} }); }
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle("CE SMART TRACKER"); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#003366"))); }
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); // actionBar.setDisplayHomeAsUpEnabled(false); // actionBar.setDisplayShowTitleEnabled(true); // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
/** Metodo que crea/inicializa la activity */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // En realidad, casi todas las activities son iguales (de momento) :) setContentView(R.layout.activity_calendarios); ActionBar actionBar = getSupportActionBar(); // Guardamos el layout del fondo, para aniadir luego botones o lo que // corresponda: layout = (LinearLayout) findViewById(R.id.fondo); // Extraemos los parámetros de la llamada del intent: Intent intent = getIntent(); categoriaId = intent.getStringExtra("com.example.activitydeportes.categoriaId"); deporteId = intent.getStringExtra("com.example.activitydeportes.deporteId"); actionBar.setTitle("Competiciones"); actionBar.setSubtitle("Calendario: " + categoriaId + " / " + deporteId); gestorPreferencias = new GestorPreferencias(this); listaElegidos = gestorPreferencias.getListaEquiposEscogidos(); // Creamos el AsyncTask que pide los datos mediante el servicio Web: // Le pasamos la URL base: SolicitudCalendariosTask task = new SolicitudCalendariosTask(Global.baseURLServidorNice); task.execute(categoriaId, deporteId); }
private void customActionBar() { actionBar = ((LandingActivity) getActivity()).getSupportActionBar(); actionBar.removeAllTabs(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle("Select Address"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Define o layout. setContentView(R.layout.layout_naoescolar_view_activity); // Recupera a barra de ação. ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(R.string.words_non_school); } // Define o evento de clique para o botao flutuante. findViewById(R.id.fab) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new AddOrEditNaoEscolarDialog(EstudoViewActivity.this, null).show(); } }); // Recupera o controle do ListView. list = (ListView) findViewById(R.id.naoescolar_view_list); // Carrega a lista de atividades não-escolares. update(); }
@Override public void applySelfActionBar() { if (parentActivity == null) { return; } ActionBar actionBar = parentActivity.getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setSubtitle(null); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowCustomEnabled(false); actionBar.setCustomView(null); actionBar.setTitle(getStringEntry(R.string.NotificationsAndSounds)); TextView title = (TextView)parentActivity.findViewById(R.id.action_bar_title); if (title == null) { final int subtitleId = parentActivity.getResources().getIdentifier("action_bar_title", "id", "android"); title = (TextView)parentActivity.findViewById(subtitleId); } if (title != null) { title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); title.setCompoundDrawablePadding(0); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set the layout setContentView(R.layout.activity_directory_browser); // Gets the bundle data Bundle bundle = getIntent().getExtras(); if (bundle != null) { // Reads the title if (bundle.containsKey(EXTRA_TITLE)) mTitle = bundle.getString(EXTRA_TITLE); // Reads the start path if (bundle.containsKey(EXTRA_PATH)) { String path = bundle.getString(EXTRA_PATH); if (path != null) { mPath = new File(path); // Default directory if (!mPath.exists()) { mPath = Environment.getExternalStorageDirectory(); } } } } // Setup the actionbar ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // Set the title actionBar.setTitle(mTitle); actionBar.setSubtitle(mPath.getAbsolutePath()); } }