@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pengamat); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); mController = new ControllerPengamat(PengamatActivity.this); // untuk swipeToRefresh configViews(); // mController.startFetching(); // rv2.setHasFixedSize(true); // initializeData(); // initializeAdapter(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_page); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null) .show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { // oncreate set up super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); myDb = new DatabaseHelper(this); // db helper class created. Courseid = myDb .newCourseDBInstert(); // This will add an insert and return the id for the user in this // session Log.i("Main long", Courseid + ""); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); FragmentManager fm = getFragmentManager(); fm.beginTransaction().replace(R.id.content_frame, new ViewScores()).commit(); setTitle("Scores"); }
@Override public void setDrawer() { navigation = (NavigationView) findViewById(R.id.navigation); drawer = (DrawerLayout) findViewById(R.id.drawer); navigation.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // 设置点击事件 Log.i("Tag", menuItem.getItemId() + ""); mPresenter.switchType(menuItem.getItemId()); // closeFloatActionButton(); return false; } }); ActionBarDrawerToggle abdt = new ActionBarDrawerToggle(this, drawer, 0, 0) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); } }; abdt.syncState(); drawer.setDrawerListener(abdt); }
/** * *************************************************** * * <p>Called with the current top-most fragment. * * <p>*************************************************** */ protected void onNotifyTop(AKiteFragment topFragment) { ActionBar actionBar = getActionBar(); // Determine which fragment is top-most String tag = topFragment.getTag(); if (tag != null && tag.equals(ChooseProductGroupFragment.TAG)) { ///// Home page ///// // We only enable the menu on the home page mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); // We display the logo on the home page actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); } else { mDrawerToggle.setDrawerIndicatorEnabled(false); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); // On other pages we show a title actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowCustomEnabled(false); } super.onNotifyTop(topFragment); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ButterKnife.bind(this); FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); PrincipalFragment principalFragment = new PrincipalFragment(); transaction.add(R.id.content_main, principalFragment); transaction.commit(); setTitle(R.string.principal); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView.setNavigationItemSelectedListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DataBindingUtil.setContentView(this, R.layout.activity_main); NavigationView navigation = (NavigationView) findViewById(R.id.main_nav); navigation.setNavigationItemSelectedListener(this); drawer = (DrawerLayout) findViewById(R.id.main_drawer); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, 0, 0); drawer.setDrawerListener(toggle); toggle.syncState(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); chapter = new ChapterFragment(); forum = new ForumFragment(); game = new GameFragment(); transaction .add(R.id.main_container, chapter) .add(R.id.main_container, forum) .add(R.id.main_container, game) .detach(forum) .detach(game) .detach(chapter) .attach(chapter) .commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // ROTAZIONE SCHERMO BLOCCATA this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); viewPager = (ViewPager) findViewById(R.id.viewpagerHome); setupViewPager(viewPager); tabLayout = (TabLayout) findViewById(R.id.tabsHome); tabLayout.setupWithViewPager(viewPager); setTitle("Home"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); HistoryFragment fragment = new HistoryFragment(); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment); fragmentTransaction.commit(); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
private void configViews() { // 设置显示Toolbar setSupportActionBar(mToolbar); // 设置Drawerlayout开关指示器,即Toolbar最左边的那个icon ActionBarDrawerToggle mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.open, R.string.close); mActionBarDrawerToggle.syncState(); mDrawerLayout.setDrawerListener(mActionBarDrawerToggle); // 给NavigationView填充顶部区域,也可在xml中使用app:headerLayout="@layout/header_nav"来设置 mNavigationView.inflateHeaderView(R.layout.view_nav_header); // 给NavigationView填充Menu菜单,也可在xml中使用app:menu="@menu/menu_nav"来设置 mNavigationView.inflateMenu(R.menu.menu_nav); // 自己写的方法,设置NavigationView中menu的item被选中后要执行的操作 onNavgationViewMenuItemSelected(mNavigationView); // 初始化ViewPager的适配器,并设置给它 pageAdapter = new CardPageAdapter(getSupportFragmentManager(), mTitles); mViewPager.setAdapter(pageAdapter); // 设置ViewPager最大缓存的页面个数 mViewPager.setOffscreenPageLimit(5); // 给ViewPager添加页面动态监听器(为了让Toolbar中的Title可以变化相应的Tab的标题) mViewPager.addOnPageChangeListener(this); mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); // 将TabLayout和ViewPager进行关联,让两者联动起来 mTabLayout.setupWithViewPager(mViewPager); // 设置Tablayout的Tab显示ViewPager的适配器中的getPageTitle函数获取到的标题 mTabLayout.setTabsFromPagerAdapter(pageAdapter); // 设置FloatingActionButton的点击事件 mFloatingActionButton.setOnClickListener(this); }
private void initNavigationView() { drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.view_navigation_open, R.string.view_navigation_close); drawerLayout.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.navigation); navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { drawerLayout.closeDrawers(); switch (menuItem.getItemId()) { case R.id.actionNotificationItem: showNotificationTab(); } return true; } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); this.setTitle(R.string.title_activity_start); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); checkSD(); }
public static ActionBarDrawerToggle getMenuDrawer( final ActionBarActivity ctx, final ActionBar actionBar, DrawerLayout drawerLayout) { ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle( ctx, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.string .open_memu_drawer_description_for_accesibility, /* "open drawer" description for accessibility */ R.string .close_memu_drawer_description_for_accesibility /* "close drawer" description for accessibility */) { public void onDrawerClosed(View view) { actionBar.invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { // supportInvalidateOptionsMenu(); actionBar.invalidateOptionsMenu(); InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(ctx.getCurrentFocus().getWindowToken(), 0); } }; drawerLayout.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); return mDrawerToggle; }
private void initNavigationView() { this.drawerLayout = (DrawerLayout) this.findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, this.drawerLayout, this.toolbar, R.string.view_navigation_open, R.string.view_navigation_close); this.drawerLayout.setDrawerListener(toggle); toggle.syncState(); this.navigationView = (NavigationView) this.findViewById(R.id.navigation_view); this.navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { drawerLayout.closeDrawers(); NavigationMenuReceiver.menuReceiver(SearchActivity.this, item); return true; } }); this.navigationView.setCheckedItem(R.id.menu_navigation_search); NavigationMenuView menuView = (NavigationMenuView) this.navigationView.getChildAt(0); if (menuView != null) menuView.setVerticalScrollBarEnabled(false); }
/** * Initializes the activity and the view of the main page * * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); navHeaderLayout = navigationView.getHeaderView(0); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contacts); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(this.getResources().getColor(R.color.colorPrimary)); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(ContactsActivity.this, AddContactActivity.class); startActivity(intent); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mUserPreference = new UserPreference(MainActivity.this); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); View headerView = navigationView.getHeaderView(0); TextView txtUsername = (TextView) headerView.findViewById(R.id.txt_username); TextView txtEmail = (TextView) headerView.findViewById(R.id.txt_email); txtUsername.setText(mUserPreference.getName()); txtEmail.setText(mUserPreference.getEmail()); if (mCurrentLocationFragment == null) { mCurrentLocationFragment = new CurrentLocationFragment(); } setUpFragment(mCurrentLocationFragment, CurrentLocationFragment.class.getSimpleName()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // FragmentTransaction tx = getSupportFragmentManager().beginTransaction(); // tx.replace(R.id.container, new MapsFragment()); // tx.commit(); if (AppGlobals.isVirgin()) { Intent i = new Intent(MainActivity.this, LoginActivity.class); startActivity(i); } setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_people); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); // TODO: for debug purposes. Delete when finished final ArrayList<User> sampleUsersList = User.getSampleUsersList(PeopleActivity.this); ArrayList<User> userList = new ArrayList<>(); Cursor cursor = new UserSqlOperations(this) .queryAll(null, UserContract.Columns.USERNAME, SqlOperations.SortOrder.ASC); while (cursor.moveToNext()) { Log.v(TAG, "Next cursor position"); User user = User.makeUser(cursor); userList.add(user); if (user != null) Log.v(TAG, String.format("User created: %s", user.toString())); } listView = (ListView) findViewById(R.id.people_list_view); listAdapter = new PeopleListAdapter(this, userList); listAdapter.notifyDataSetChanged(); if (listView != null) listView.setAdapter(listAdapter); // set FAB final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_people); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { // TODO: implement adding new user Toast.makeText( PeopleActivity.this, "Sorry, this was my next thing to do. It is actually done on server side", Toast.LENGTH_SHORT) .show(); } }); // connect to FollowersService bindService(FollowersService.makeIntent(this), followerServiceConnection, BIND_AUTO_CREATE); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ButterKnife.bind(this); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); menu = navigationView.getMenu(); // Load menu // deleteDatabase("sub_reddit-db"); DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "sub_reddit-db", null); SQLiteDatabase db = helper.getWritableDatabase(); DaoMaster daoMaster = new DaoMaster(db); DaoSession daoSession = daoMaster.newSession(); SubRedditDao subRedditDao = daoSession.getSubRedditDao(); menuList = subRedditDao.loadAll(); if (menuList.size() == 0) { // init Log.i("MyTag", "Subreddit init - list was empty"); subRedditDao.insert(new SubReddit(null, "art", "art")); subRedditDao.insert(new SubReddit(null, "belgium", "belgium")); subRedditDao.insert(new SubReddit(null, "gifs", "gifs")); subRedditDao.insert(new SubReddit(null, "funny", "funny")); subRedditDao.insert(new SubReddit(null, "pics", "pics")); subRedditDao.insert(new SubReddit(null, "diy", "diy")); menuList = subRedditDao.loadAll(); } // Dynamicly load menu for (SubReddit item : menuList) { menu.add(R.id.menuSubreddit, menuList.indexOf(item), Menu.NONE, item.getTitle()); } // Load fragment Bundle bundle = new Bundle(); bundle.putLong("subRedditId", menuList.get(0).getId()); Fragment fragment = new SubRedditListFragment(); fragment.setArguments(bundle); getSupportFragmentManager() .beginTransaction() .add(R.id.frameLayoutMain, fragment) .addToBackStack(null) .commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // getSupportActionBar().setDisplayHomeAsUpEnabled(true); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null) .show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); // bagian menu tabs viewPagerMain = (ViewPager) findViewById(R.id.viewpagerMain); setupViewPager(viewPagerMain); tabLayoutMain = (TabLayout) findViewById(R.id.tabsMain); tabLayoutMain.setupWithViewPager(viewPagerMain); setupTabIcons(); // bagian notifikasi GCMClientManager pushClientManager = new GCMClientManager(this, GCM_SENDER_ID); pushClientManager.registerIfNeeded( new GCMClientManager.RegistrationCompletedHandler() { @Override public void onSuccess(String registrationId, boolean isNewRegistration) { Log.d("Registration id", registrationId); // send this registrationId to your server } @Override public void onFailure(String ex) { super.onFailure(ex); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_user); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); drawer = (DrawerLayout) findViewById(R.id.drawer_layout_createUser); navigationView = (NavigationView) findViewById(R.id.nav_view); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView.setNavigationItemSelectedListener(this); mContentFragment = new ShowUserFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.add(R.id.createUser_viewgroup, mContentFragment); fragmentTransaction.commit(); /*Spinner userlevel_spinner = (Spinner) findViewById(R.id.userRightSpinner); userlevel_spinner.setOnItemSelectedListener(new CustomSelectedItemListener()); mUsernameField = (EditText) findViewById(R.id.userName); mPasswordField = (EditText) findViewById(R.id.userPassword); mUserLevelSpinner = (Spinner) findViewById(R.id.userRightSpinner); mCreateUserBtn = (Button) findViewById(R.id.addUserButton); mCreateUserBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // showProgress(true); String username = mUsernameField.getText().toString(); String password = mPasswordField.getText().toString(); String usrLevel = mUserLevelSpinner.getSelectedItem().toString(); int userlevel = 2; if(usrLevel.equals("Admin")) userlevel = 1; mCreateUserTask = new CreateUserTask(username, password, userlevel); mCreateUserTask.execute((Void) null); } });*/ }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detalhes_celula); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); android.support.v7.app.ActionBar bar = getSupportActionBar(); bar.setTitle("Lista das Células"); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); celulaSelecionada = getIntent().getExtras().getParcelable("celulaSelecionada"); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(DetalhesCelula.this, MapsCelulas.class); Bundle parametros = new Bundle(); parametros.putString("filtroDia", "9"); parametros.putString("filtroTipo", "9"); intent.putExtras(parametros); intent.putExtra("celulaSelecionada", (Parcelable) celulaSelecionada); startActivity(intent); } }); TextView nome = (TextView) findViewById(R.id.textViewNome); nome.setText(celulaSelecionada.getNome()); TextView endereco = (TextView) findViewById(R.id.textViewEndereco); endereco.setText(celulaSelecionada.getEndereco()); TextView lider = (TextView) findViewById(R.id.textViewNomeLider); lider.setText(celulaSelecionada.getLiderNome()); TextView telefone = (TextView) findViewById(R.id.textViewTelefone); telefone.setText(celulaSelecionada.getTelefoneInformacao()); TextView dia = (TextView) findViewById(R.id.textViewDiaHora); dia.setText(celulaSelecionada.getDiaHora()); TextView tipo = (TextView) findViewById(R.id.textViewTipo); tipo.setText("Célula de " + celulaSelecionada.getTipo() + " - " + celulaSelecionada.getRede()); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map2); mapFragment.getMapAsync(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); IntentFilter filter = new IntentFilter(); filter.addAction(getString(R.string.intent_bl_stopped)); filter.addAction(getString(R.string.intent_action_bl_user_stopped)); filter.addAction(getString(R.string.intent_action_bl_user_changing)); LocalBroadcastManager.getInstance(this).registerReceiver(brdcstRcvr, filter); brcstRcvrBlAdapt = new BrcstBlAdaptChanged(); setContentView(R.layout.act_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, R.string.tst_fab, Snackbar.LENGTH_LONG) .setAction(R.string.cd_btn_filter, null) .show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); rcycDevices = (RecyclerView) findViewById(R.id.my_recycler_view); rcycDevices.setHasFixedSize(true); rcycLayoutManager = new LinearLayoutManager(this); rcycDevices.setLayoutManager(rcycLayoutManager); rcycAdaptDevices = new AdaptScans(); rcycDevices.setAdapter(rcycAdaptDevices); if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) { Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show(); } if (savedInstanceState == null) { blAdapt = ((BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.drawer_layout); ButterKnife.bind(this); // Initializing Toolbar and setting it as the actionbar setSupportActionBar(toolbar); WDUtils.applyFontForToolbarTitle(this); // Setting Navigation View Item Selected Listener to handle the item click of the navigation // menu navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { // This method will trigger on item Click of navigation menu @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // Checking if the item is in checked state or not, if not make it in checked state menuItem.setChecked(!menuItem.isChecked()); // Closing drawer_menu on item click drawerLayout.closeDrawers(); DrawerBaseActivity.this.onNavigationItemSelected(menuItem); return true; } }); ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.drawer_open_drawer_accesibility_string, R.string.drawer_close_drawer_accesibility_string) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); DrawerBaseActivity.this.onDrawerClosed(drawerView); } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); DrawerBaseActivity.this.onDrawerOpened(drawerView); } }; drawerLayout.setDrawerListener(actionBarDrawerToggle); // calling sync state is necessary or else your hamburger icon wont show up actionBarDrawerToggle.syncState(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_index); demenagement = (Button) findViewById(R.id.demenagement); menage = (Button) findViewById(R.id.menage); cours = (Button) findViewById(R.id.cour); autre = (Button) findViewById(R.id.autre); demenagement.setOnClickListener(this); menage.setOnClickListener(this); cours.setOnClickListener(this); autre.setOnClickListener(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); TextView wel = (TextView) findViewById(R.id.well); String user = ""; if (Login.loginuser != null) user = Login.loginuser; // wel.setText(Login.getLoginuser()); View view = getLayoutInflater().inflate(R.layout.nav_header_index, null); TextView log = (TextView) view.findViewById(R.id.TextView1); try { log.setText("Soyez le bienvenu " + user); } catch (Exception e) { } wel.setText("Soyez le bienvenu M " + user); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Index.this, RequestService.class); startActivity(intent); Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null) .show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
private void initView() { setSupportActionBar(binding.toolbar); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, binding.drawer, binding.toolbar, R.string.open, R.string.close); binding.drawer.setDrawerListener(toggle); toggle.syncState(); binding.navView.setNavigationItemSelectedListener(this); binding.navView.setCheckedItem(R.id.nav_all_sessions); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AppSettings.initialize(this, this); dataManager = new NewsManager(this); permissionHandler = new StoragePermissionHandler(this); if (AppSettings.firstStart()) { Intent intent = new Intent(this, SelectSitesActivity.class); intent.putExtra(AppCode.SEND_PURPOSE, SelectSitesActivity.For.APP_FIRST_START); startActivity(intent); finish(); return; } setContentView(R.layout.a_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); assert navigationView != null : "Navigation view is null"; navigationView.setNavigationItemSelectedListener(this); fragmentManager = new FragmentManager(this, navigationView, R.id.main_content); updateDrawer(true); Bundle extras = getIntent().getExtras(); if (extras != null && extras.containsKey(AppCode.SEND_NEWS_IDS)) { int[] news_codes = extras.getIntArray(AppCode.SEND_NEWS_IDS); newsFragment = NewsListFragment.instanceForNotification(news_codes); } else newsFragment = NewsListFragment.instanceFor(-1); if (extras != null && extras.containsKey(AppCode.RESTART)) { ScheduledDownloadReceiver.scheduleDownloads( this, new ScheduleManager(this).getDownloadSchedules()); } newsFragment.setRetainInstance(true); fragmentManager.addFragment(newsFragment, R.id.nav_my_news); }
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. if (mDrawerToggle != null) { mDrawerToggle.syncState(); if (isDrawerOpen()) { getSupportActionBar().setTitle(R.string.app_name); mDrawerToggle.setDrawerIndicatorEnabled(true); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null) .show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); // WebView mwebView = (WebView) findViewById(R.id.myWebView); WebSettings webSettings = mwebView.getSettings(); webSettings.setJavaScriptEnabled(true); // improve webView performance mwebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH); mwebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); mwebView.getSettings().setAppCacheEnabled(true); mwebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); webSettings.setUseWideViewPort(true); webSettings.setSavePassword(true); webSettings.setSaveFormData(true); webSettings.setEnableSmoothTransition(true); mwebView.loadUrl("http://www.newsweek.com"); // force links open in webview only mwebView.setWebViewClient(new MyWebviewClient()); }