本文整理汇总了Java中android.support.v7.app.ActionBarDrawerToggle.syncState方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBarDrawerToggle.syncState方法的具体用法?Java ActionBarDrawerToggle.syncState怎么用?Java ActionBarDrawerToggle.syncState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.ActionBarDrawerToggle
的用法示例。
在下文中一共展示了ActionBarDrawerToggle.syncState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flex_box_layout);
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);
if (drawer != null) {
drawer.addDrawerListener(toggle);
}
toggle.syncState();
initNavigation();
initListener();
}
示例2: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
consola = (TextView) findViewById(R.id.log);
log = "";
ok = false;
et1 = (EditText)findViewById(R.id.threshold);
et2 = (EditText)findViewById(R.id.window_len);
et3 = (EditText)findViewById(R.id.maxts);
et4 = (EditText)findViewById(R.id.readyforescast);
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.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
示例3: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@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);
}
示例4: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation_menu);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final 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();
}
});
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close
);
drawer.addDrawerListener(toggle);
toggle.syncState();
drawer.openDrawer(Gravity.START);
}
示例5: setupNavigationDrawer
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
private void setupNavigationDrawer() {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
}
};
drawerToggle.syncState();
drawerToggle.setDrawerIndicatorEnabled(true);
drawerLayout.setDrawerListener(drawerToggle);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.navigationRecyclerView);
navigationAdapter = new NavigationAdapter(this, schedules, schedules.indexOf(loadedSchedule));
recyclerView.setAdapter(navigationAdapter);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
}
示例6: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reportes_navigation_drawer);
this.setTitle(R.string.nav_reportes);
/*menu*/
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_reportes);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.reportes_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.reportes_nav_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.setCheckedItem(R.id.nav_reportes);
}
示例7: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@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, "Well done Paolo! Thanks too Dom and Mihchele", 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);
}
示例8: initViews
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
private void initViews() {
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.setDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
示例9: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
initCollapsingToolbar();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, 0, 0);
actionBarDrawerToggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
pref = new SharedPref(this);
if(new Connection(this).isInternet()){
profileBasicInfo(pref.getUserId());
}
}
示例10: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inicio_navigation_drawer);
this.setTitle(R.string.nav_inicio);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_inicio);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.inicio_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.inicio_nav_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.setCheckedItem(R.id.nav_inicio);
}
示例11: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitle(getResources().getString(R.string.navigate_title));
setSupportActionBar(mToolbar);
mAppBarLayout = (AppBarLayout) findViewById(R.id.bar_layout);
mShowMenu = false;
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar,
R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mDrawerLayout.addDrawerListener(toggle);
toggle.syncState();
mNavigationView = (NavigationView) findViewById(R.id.nav_view);
mNavigationView.setNavigationItemSelectedListener(this);
mFragmentStack = new Stack<>();
NavigateFragment navigateFragment = NavigateFragment.newInstance();
setFragment(navigateFragment, NAVIGATE_ID);
mNavigationView.getMenu().getItem(mCurrentFragmentId).setChecked(true);
setUserHeader();
AdapterFactory.getInstance().getUserAdapter(this).addOnCurrentUserUpdateListener(
new Runnable() {
@Override
public void run() {
Log.d("DrawerActivityListener", "CURRENT USER UPDATE LISTENER");
setUserHeader();
}
}
);
checkNewAchievementsEvents();
}
示例12: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
unbinder = ButterKnife.bind(this);
toolbar.setTitle("Mosby MVI");
toolbar.inflateMenu(R.menu.activity_main_toolbar);
toolbar.setOnMenuItemClickListener(item -> {
getSupportFragmentManager().beginTransaction()
.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out,
android.R.anim.fade_in, android.R.anim.fade_out)
.add(R.id.drawerLayout, new SearchFragment())
.addToBackStack("Search")
.commit();
return true;
});
ActionBarDrawerToggle toggle =
new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
if (savedInstanceState == null) {
showCategoryItems(MainMenuItem.HOME);
} else {
title = savedInstanceState.getString(KEY_TOOLBAR_TITLE);
toolbar.setTitle(title);
}
// TODO Create a Presenter & ViewState for this Activity
DependencyInjection dependencyInjection = SampleApplication.getDependencyInjection(this);
disposable = dependencyInjection.getMainMenuPresenter()
.getViewStateObservable()
.filter(state -> state instanceof MenuViewState.DataState)
.cast(MenuViewState.DataState.class)
.map(this::findSelectedMenuItem)
.subscribe(this::showCategoryItems);
clearSelectionRelay = dependencyInjection.getClearSelectionRelay();
}
示例13: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Set up screen UI (recycler, FAB, nav drawer, etc.)
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();
getGaTracker().sendUserEvent(new GaEvent("FAB Category", "FAB Action", "FAB Label", "FAB Custom Dimension"), true);
//TODO dont make users have to set true/false every time here
}
});
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.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
setCustomDimension1("User 1234");
setCustomDimension2("Admin");
// Open main fragment
getSupportFragmentManager().beginTransaction()
.add(R.id.container, MainFragment.newInstance())
.commit();
}
示例14: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_foodie_home);
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);
checkLocationPermission();
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapView = mapFragment.getView();
mapView.setContentDescription("MAP NOT READY");
mapFragment.getMapAsync(this);
recieveData();
}
示例15: onCreate
import android.support.v7.app.ActionBarDrawerToggle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
// START Google sign in API client
// configure sign-in to request user info
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken(Constants.SERVER_CLIENT_ID)
.requestServerAuthCode(Constants.SERVER_CLIENT_ID)
.build();
// build client with access to Google Sign-In API and the options specified by gso
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
// END Google sign in API client
// START prepare main layout
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mProgressBar = findViewById(R.id.progressBar);
mSwipeRefreshLayout = findViewById(R.id.swipe_container);
mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorAccent));
mSwipeRefreshLayout.setRefreshing(true);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
updateAndDisplayRegisteredKeys();
}
});
mRecyclerView = findViewById(R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new SecurityTokenAdapter(new ArrayList<Map<String, String>>(),
R.layout.row_token, U2FDemoActivity.this);
// END prepare main layout
// START prepare drawer layout
DrawerLayout drawer = 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);
navigationView.setItemIconTintList(null);
View header = navigationView.getHeaderView(0);
mUserEmailTextView = header.findViewById(R.id.userEmail);
mDisplayNameTextView = header.findViewById(R.id.displayName);
Menu menu = navigationView.getMenu();
mU2fOperationMenuItem = menu.findItem(R.id.nav_u2fOperations);
mSignInMenuItem = menu.findItem(R.id.nav_signin);
mSignOutMenuItem = menu.findItem(R.id.nav_signout);
mSignInButton = findViewById(R.id.sign_in_button);
mSignInButton.setSize(SignInButton.SIZE_WIDE);
mSignInButton.setScopes(gso.getScopeArray());
mSignInButton.setOnClickListener(this);
// END prepare drawer layout
// request SignIn or load registered tokens
updateUI();
}