// **************************************************************** // * Constructors // **************************************************************** public GroupCreateActivityViewHolder( Context context, IFragmentController fragmentController, View view) { super(context, fragmentController, view); try { AppCompatActivity activity = (AppCompatActivity) context; Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); activity.setSupportActionBar(toolbar); final ActionBar actionBar = activity.getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.drawable.ic_back); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); fragmentManager = activity.getSupportFragmentManager(); groupCreateFragment = (GroupCreateFragment) fragmentManager.findFragmentById(R.id.groupCreateFragment); groupCreateChoosePrivacyFragment = (GroupCreateChoosePrivacyFragment) fragmentManager.findFragmentById(R.id.groupCreateChoosePrivacyFragment); groupCreateChooseIconFragment = (GroupCreateChooseIconFragment) fragmentManager.findFragmentById(R.id.groupCreateChooseIconFragment); progressBar = (RelativeLayout) view.findViewById(R.id.progressBar); title = (TextView) view.findViewById(R.id.toolbarTitle); initialize(context); } catch (Exception e) { e.printStackTrace(); } }
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_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeAsUpIndicator(R.drawable.ic_menu); actionBar.setDisplayHomeAsUpEnabled(true); } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mNavigationView = (NavigationView) findViewById(R.id.nav_view); setupDrawerContent(); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbar.setTitle(getResources().getString(R.string.app_name)); final ImageView imageView = (ImageView) findViewById(R.id.backdrop); Glide.with(this).load(R.drawable.cheese_3).centerCrop().into(imageView); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); } FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.floating_layout_next); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { doLogin(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.general_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { setupViewPager(viewPager); } TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_file_view); Intent intent = getIntent(); subN = intent.getExtras().getString("subn"); tt = intent.getExtras().getString("tt"); arrayList_path = new ArrayList<String>(); arrayList_time = new ArrayList<String>(); arrayList_filecode = new ArrayList<String>(); file_list = (ListView) findViewById(R.id.list_file); adapterFile = new CustomAdapterFile(); final android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); // actionBar.setDisplayUseLogoEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.btnback); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.actionbar_layout); // actionBar.setLogo(R.drawable.btnback); TextView txt_subn = (TextView) findViewById(R.id.txt_actionbar); txt_subn.setText(subN); // Toast.makeText(getApplicationContext(),tt,Toast.LENGTH_SHORT).show(); net = new Net(); net.execute(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_color); Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar); TextView tite = (TextView) findViewById(R.id.title); tite.setText(R.string.title_activity_add_color); setSupportActionBar(mToolbar); final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24dp); ab.setDisplayHomeAsUpEnabled(true); FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.container); if (fragment == null) { fragment = AddColorFragment.newInstance(); fm.beginTransaction().add(R.id.container, fragment).commit(); } FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab); floatingActionButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
private void setupFragmentsFromExtras(Bundle extras) { Group group = extras.getParcelable(INTENT_EXTRAS_GROUP); Sender sender = extras.getParcelable(INTENT_EXTRAS_SENDER); if (group == null) { throw new RuntimeException("Group should not be null"); } ActionBar actionBar = getSupportActionBar(); // we want to always show up arrow due to always having stuff above us if (group.getId() == -1) { nw_main.setCheckedItem(R.id.navigation_allSenders); // if it's not all senders -> show up arrow } else if (actionBar != null) { actionBar.setHomeAsUpIndicator(0); } if (sender != null) { addFragment(CommandListFragment.newInstance(group, sender), R.id.fl_contentFrame); } else { addFragment( SenderListFragment.newInstance(group), R.id.fl_contentFrame, SenderListFragment.FRAGMENT_TAG, false); } }
// **************************************************************** // * Life Cycle // **************************************************************** @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.drawable.ic_menu); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setElevation(0); mySohaAPI.setReceive(this); viewHolder = new MainViewHolder( this, this, findViewById(R.id.drawer_layout), getSupportFragmentManager()); mySohaAPI.requestApi(RequestType.GIFT_POPUP, GiftPopupDTO.class, null, getTagId()); Utils.showMessageNotify(findViewById(R.id.app_content), R.string.notify_user_login_success); } catch (Exception e) { e.printStackTrace(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.mipmap.ic_launcher); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#024265"))); btnSwitch = (ImageButton) findViewById(R.id.btnSwitch); preferences = this.getPreferences(Context.MODE_PRIVATE); prefEditor = preferences.edit(); flashState = false; endWhenPaused = preferences.getBoolean("closeOnPause", false); CheckBox pauseState = (CheckBox) findViewById(R.id.cbPause); pauseState.setChecked(endWhenPaused); pauseState.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { endWhenPaused = !endWhenPaused; prefEditor.putBoolean("closeOnPause", endWhenPaused); prefEditor.commit(); } }); if (!isConnected) init(); }
private void initView() { setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu_grey); ab.setDisplayHomeAsUpEnabled(true); setupDrawerContent(navigationView); setupViewPager(viewPager); tabLayout.setupWithViewPager(viewPager); tabLayout.setOnTabSelectedListener( new TabLayout.OnTabSelectedListener() { boolean isOneSelect = false; @Override public void onTabSelected(TabLayout.Tab tab) { if (tab.getPosition() == 0) isOneSelect = true; viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) {} @Override public void onTabReselected(TabLayout.Tab tab) { if (tab.getPosition() == 0 && !isOneSelect) EventBus.getDefault().postSticky("Reselected"); isOneSelect = false; } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); preferences.applyThemeAndStatusBarColor(); setContentView(R.layout.custom_filter_activity); ButterKnife.inject(this); setSupportActionBar(toolbar); ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); supportActionBar.setTitle(R.string.FLA_new_filter); } listView = (ListView) findViewById(android.R.id.list); database.openForReading(); List<CriterionInstance> startingCriteria = new ArrayList<>(); startingCriteria.add(getStartingUniverse()); adapter = new CustomFilterAdapter(this, dialogBuilder, startingCriteria); listView.setAdapter(adapter); updateList(); setUpListeners(); }
@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(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the toolbar. toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("Welcome"); setSupportActionBar(toolbar); toolbar.setOnMenuItemClickListener(onToolbarMenuItemClickListener); ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); // Set up the navigation drawer. mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } fragContainerId = R.id.main_content; if (savedInstanceState == null) { transitionTo(DemoHomePageFragment.newInstance()); } // Uncomment me for iovation suppoort // start(getApplicationContext()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ((AppController) getApplication()).getAppComponent().inject(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { setupViewPager(viewPager); } }
@Override public boolean onCreateOptionsMenu(Menu menu) { ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.drawable.back); actionBar.setDisplayHomeAsUpEnabled(true); return true; }
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); }
public void initTitle(Toolbar toolbar) { toolbar.setTitle("首页"); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayShowHomeEnabled(true); ab.setHomeButtonEnabled(true); }
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); dataList = new ArrayList<Test_drawitem>(); mTitle = mDrawerTitle = getTitle(); draw_lay = (DrawerLayout) findViewById(R.id.drawl); draw_List = (ListView) findViewById(R.id.left_draw); // titles1=getResources().getStringArray(R.array.items1); ab = getSupportActionBar(); draw_lay.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); dataList.add(new Test_drawitem("Home", R.drawable.home)); dataList.add(new Test_drawitem("Sell Books", R.drawable.sellbook)); dataList.add(new Test_drawitem("Books Status", R.drawable.book4)); dataList.add(new Test_drawitem("Exit", R.drawable.signout)); adapter = new Test_custom_adap(this, R.layout.test_item, dataList); draw_List.setAdapter(adapter); draw_List.setOnItemClickListener(new DrawerItemClickListener()); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); fr = new NavDraw1_Frag1(); ft.replace(R.id.fl1, fr).commit(); draw_List.setItemChecked(0, true); // draw_List.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, // titles1)); // draw_List.setOnItemClickListener(new Click()); mDrawerToggle = new android.support.v4.app.ActionBarDrawerToggle( this, /* host Activity */ draw_lay, /* DrawerLayout object */ R.drawable.draw, /* nav_drawer image to replace 'Up' caret */ R.string.open_draw, /* "open drawer" description for accessibility */ R.string.close_draw /* "close drawer" description for accessibility */) { @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onDrawerClosed(View view) { getSupportActionBar().setTitle(mTitle); invalidateOptionsMenu(); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); } }; draw_lay.setDrawerListener(mDrawerToggle); ab.setHomeButtonEnabled(true); ab.setDisplayHomeAsUpEnabled(true); // for creating a back arrow for home ab.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.draw)); }
private void setToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); if (ab != null) { // Poner ícono del drawer toggle ab.setHomeAsUpIndicator(R.drawable.ic_drawer); ab.setDisplayHomeAsUpEnabled(true); } }
private void initToolbar() { ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); final ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.friends_title); } }
private void setupToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Arrow menu icon ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24dp); ab.setDisplayHomeAsUpEnabled(true); } }
private void setupToolbar() { mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar); if (mToolbar != null) { setSupportActionBar(mToolbar); } // Show menu icon final android.support.v7.app.ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); }
private void setupToolbar() { mToolbar.setTitle(getString(R.string.team)); setSupportActionBar(mToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); actionBar.setDisplayHomeAsUpEnabled(true); } }
private void remplaceToolbar() { setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); }
@Override public void initViews() { NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); toolbar.setBackgroundColor(getResources().getColor(R.color.primary)); toolbar.setAlpha(1); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeAsUpIndicator(R.drawable.ic_menu); actionBar.setDisplayHomeAsUpEnabled(true); }
private void initToolbar() { toolbar = (Toolbar) findViewById(R.id.pit_toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.ic_close); mActionBarBackgroundDrawable = toolbar.getBackground(); robotImage = (ImageView) findViewById(R.id.pit_scout_image); ObservableScrollable scrollView = (ObservableScrollable) findViewById(R.id.scroll_view); scrollView.setOnScrollChangedCallback(this); onScroll(-1, 0); }
public void setUpHomeButton() { final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); if (navigationView != null) { setupDrawerContent(navigationView); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Crashlytics Fabric.with(this, new Crashlytics()); Crashlytics.setString("git_sha", BuildConfig.GIT_SHA); // Adding Toolbar to Main screen Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); // Set Tabs inside Toolbar TabLayout tabs = (TabLayout) findViewById(R.id.tabs); tabs.setupWithViewPager(viewPager); // Create Navigation drawer and inflate layout NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer); // Adding menu icon to Toolbar ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp); supportActionBar.setDisplayHomeAsUpEnabled(true); } // Set behavior of Navigation drawer navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { // This method will trigger on item Click of navigation menu @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // Set item in checked state menuItem.setChecked(true); // TODO: add navigation // Closing drawer on item click mDrawerLayout.closeDrawers(); return true; } }); // Adding Floating Action Button to bottom right of main view FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Snackbar.make(v, "Snackbar!", Snackbar.LENGTH_LONG).show(); } }); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void initToolbar() { toolbar = (Toolbar) findViewById(R.id.app_bar); toolbar.setTitle(""); toolbar.setTitleTextColor(Color.WHITE); TextView textView = (TextView) toolbar.findViewById(R.id.mytext_appbar); textView.setText(getString(R.string.ride_details)); // toolbar.setElevation(10); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { Locale locale = Locale.getDefault(); String Locale_Str2 = locale.toString(); if (!Locale_Str2.contains("ar") && !Locale_Str2.contains("ur")) { actionBar.setHomeAsUpIndicator(R.drawable.ic_action_navigation_arrow_back); } else { actionBar.setHomeAsUpIndicator(R.drawable.ic_action_navigation_arrow_forward); } actionBar.setDisplayHomeAsUpEnabled(true); } }