本文整理汇总了Java中it.neokree.materialnavigationdrawer.elements.MaterialSection类的典型用法代码示例。如果您正苦于以下问题:Java MaterialSection类的具体用法?Java MaterialSection怎么用?Java MaterialSection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaterialSection类属于it.neokree.materialnavigationdrawer.elements包,在下文中一共展示了MaterialSection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeRunningTripOfferState
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
private void removeRunningTripOfferState() {
SharedPreferences prefs = getActivity().getSharedPreferences(Constants.SHARED_PREF_FILE_PREFERENCES,
Context.MODE_PRIVATE);
prefs.edit().remove(Constants.SHARED_PREF_KEY_RUNNING_TRIP_OFFER).apply();
// Change "My Trip" (driver) to "Offer Trip" in navigation drawer
MaterialNavigationDrawer drawer = ((MaterialNavigationDrawer) getActivity());
// Find "last" "My Trip", so we don't accidentally rename the join-trip-my trip
List<MaterialSection> sections = drawer.getSectionList();
MaterialSection section = null;
for (MaterialSection s : sections) {
if (s.getTitle().equals(getString(R.string.menu_my_trip))) {
section = s;
}
}
section.setTitle(getString(R.string.menu_offer_trip));
// The next fragment shows the "Offer trip" screen
drawer.setFragment(new OfferTripFragment(), getString(R.string.menu_offer_trip));
}
示例2: syncSectionsState
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
private void syncSectionsState(MaterialSection section) {
currentSection = section;
// search in first list
int position = sectionList.indexOf(section);
if(position != -1) {
for (int i = 0;i < sectionList.size();i++)
if(i != position)
sectionList.get(i).unSelect();
}
else {
// section is a bottom section
position = bottomSectionList.indexOf(section);
for (int i = 0;i < bottomSectionList.size();i++)
if(i != position)
bottomSectionList.get(i).unSelect();
}
}
示例3: changeToolbarColor
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
public void changeToolbarColor(MaterialSection section) {
int sectionPrimaryColor;
int sectionPrimaryColorDark;
if (section.hasSectionColor() && !uniqueToolbarColor) {
if (!section.hasSectionColorDark())
sectionPrimaryColorDark = darkenColor(section.getSectionColor());
else
sectionPrimaryColorDark = section.getSectionColorDark();
sectionPrimaryColor = section.getSectionColor();
} else {
sectionPrimaryColorDark = primaryDarkColor;
sectionPrimaryColor = primaryColor;
}
this.getToolbar().setBackgroundColor(sectionPrimaryColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
this.statusBar.setImageDrawable(new ColorDrawable(sectionPrimaryColorDark));
}
示例4: getRateThisAppOnClickListener
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
private MaterialSectionListener getRateThisAppOnClickListener()
{
return new MaterialSectionListener()
{
@Override
public void onClick(MaterialSection section)
{
Uri uri = Uri.parse("market://details?id=" + NavigationDrawerActivity.this.getApplicationContext().getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
goToMarket.addFlags(getFlags());
try {
startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id=" + NavigationDrawerActivity.this.getApplicationContext().getPackageName())));
}
}
};
}
示例5: onClick
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
@Override
public void onClick(final MaterialSection section) {
// TODO: workaround of the bug closing drawer onClick and KEY_MENU pressed when is a tablet device
if (getCurrentSection().equals(section)) {
if (! deviceSupportMultiPane()) {
closeDrawer();
}
return;
}
if (section == horarioViagemSection) {
HorarioViagemFragment fragment = (HorarioViagemFragment) section.getTargetFragment();
if (fragment.isViewingBusStopPage()) {
fragment.reloadPageFromArguments(buildFinalUrl(getString(
R.string.url_rmtc_horario_viagem)));
return;
} else {
section.setTarget(newHorarioViagemPageFragment(BaseActivity.this));
}
} else {
showFabMenu();
}
super.onClick(section);
}
示例6: searchStopCode
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
/**
* Performs search in the fragment {@link mx.x10.filipebezerra.horariosrmtcgoiania.fragments.HorarioViagemFragment}
*
* @param stopCode bus stop number retrieved from {@link SearchManager#QUERY}
*/
@SuppressWarnings("unchecked")
public void searchStopCode(final String stopCode) {
mFabMenu.setVisibility(View.GONE);
HorarioViagemFragment fragment = (HorarioViagemFragment) horarioViagemSection
.getTargetFragment();
if (fragment.isViewingBusStopPage()) {
Bundle arguments = buildHorarioViagemUrl(BaseActivity.this, stopCode);
fragment.reloadPageFromArguments(arguments);
} else {
MaterialSection currentSection = getCurrentSection();
if (horarioViagemSection != currentSection) {
currentSection.unSelect();
horarioViagemSection.select();
changeToolbarColor(horarioViagemSection);
}
setFragment(WebViewFragmentFactory.newHorarioViagemPageFragment(
BaseActivity.this, stopCode), horarioViagemSection.getTitle());
setSection(horarioViagemSection);
}
}
示例7: init
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
// setup header
View customHeaderView = LayoutInflater.from(this)
.inflate(R.layout.custom_header_layout, null);
this.setDrawerHeaderCustom(customHeaderView);
MaterialSection accountSection = newSection(
"Account",
new IconDrawable(this, Iconify.IconValue.fa_cogs),
new AccountFragment()
);
MaterialSection cartSection = newSection(
"Cart",
new IconDrawable(this, Iconify.IconValue.fa_shopping_cart),
new CartFragment()
);
MaterialSection walletSection = newSection(
"Wallet",
new IconDrawable(this, Iconify.IconValue.fa_money),
new WalletFragment()
);
this.addSection(cartSection);
this.addSection(walletSection);
this.addSection(accountSection);
this.setDefaultSectionLoaded(0);
disableLearningPattern();
currentDrawer = this;
}
示例8: init
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
// setup header
View customHeaderView = LayoutInflater.from(this)
.inflate(R.layout.custom_header_layout, null);
this.setDrawerHeaderCustom(customHeaderView);
MaterialSection deliveriesSection = newSection(
"Deliveries",
new IconDrawable(this, Iconify.IconValue.fa_money),
new DeliveryManagerFragment()
);
MaterialSection settingsSection = newSection(
"Settings",
new IconDrawable(this, Iconify.IconValue.fa_cog),
new SettingsFragment()
);
this.addSection(deliveriesSection);
this.addSection(settingsSection);
this.setDefaultSectionLoaded(0);
disableLearningPattern();
currentDrawer = this;
}
示例9: init
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
@Override
public void init(Bundle savedInstanceState) {
// add accounts
MaterialAccount account = new MaterialAccount(this.getResources(),"NeoKree","[email protected]", R.drawable.photo, R.drawable.bamboo);
this.addAccount(account);
MaterialAccount account2 = new MaterialAccount(this.getResources(),"Hatsune Miky","[email protected]",R.drawable.photo2,R.drawable.mat2);
this.addAccount(account2);
MaterialAccount account3 = new MaterialAccount(this.getResources(),"Example","[email protected]",R.drawable.photo,R.drawable.mat3);
this.addAccount(account3);
// add account sections
this.addAccountSection(newSection("Account settings",R.drawable.ic_settings_black_24dp,new MaterialSectionListener() {
@Override
public void onClick(MaterialSection section) {
Toast.makeText(CustomAccountSection.this,"Account settings clicked",Toast.LENGTH_SHORT).show();
// for default section is selected when you click on it
section.unSelect(); // so deselect the section if you want
}
}));
// create sections
this.addSection(newSection("Section 1", new FragmentIndex()));
this.addSection(newSection("Section 2",new FragmentIndex()));
this.addSection(newSection("Section 3",R.drawable.ic_mic_white_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#9c27b0")));
this.addSection(newSection("Section",R.drawable.ic_hotel_grey600_24dp,new FragmentButton()).setSectionColor(Color.parseColor("#03a9f4")));
// create bottom section
this.addBottomSection(newSection("Bottom Section",R.drawable.ic_settings_black_24dp,new Intent(this,Settings.class)));
}
示例10: onClick
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
@Override
public void onClick(MaterialSection section) {
section.unSelect(); // remove the selected color
if(!drawerTouchLocked) {
int accountPosition = section.getAccountPosition();
MaterialAccount account = findAccountNumber(accountPosition);
// switch accounts position
currentAccount.setAccountNumber(accountPosition);
account.setAccountNumber(MaterialAccount.FIRST_ACCOUNT);
currentAccount = account;
notifyAccountDataChanged();
// call change account method
if (accountListener != null)
accountListener.onChangeAccount(account);
// change account list
accountSwitcherListener.onClick(null);
// close drawer
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
}
}
示例11: setSection
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
/**
* Set the section informations.<br />
* In short:
* <ul>
* <li>set the section title into the toolbar</li>
* <li>set the section color to the toolbar</li>
* <li>open/call the target</li>
* </ul>
*
* This method is equal to a user tap on a drawer section.
* @param section the section which is replaced
*/
public void setSection(MaterialSection section) {
section.select();
syncSectionsState(section);
switch (section.getTarget()) {
case MaterialSection.TARGET_FRAGMENT:
// se l'utente clicca sulla stessa schermata in cui si trova si chiude il drawer e basta
if(section == currentSection) {
if(!deviceSupportMultiPane())
layout.closeDrawer(drawer);
return;
}
changeToolbarColor(section);
setFragment((Fragment) section.getTargetFragment(), section.getTitle(), (Fragment) currentSection.getTargetFragment());
afterFragmentSetted((Fragment) section.getTargetFragment(),section.getTitle());
break;
case MaterialSection.TARGET_ACTIVITY:
this.startActivity(section.getTargetIntent());
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
break;
case MaterialSection.TARGET_LISTENER:
// call the section listener
section.getTargetListener().onClick(section);
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
default:
break;
}
// se il target e' un activity la sezione corrente rimane quella precedente
if(section.getTarget() != MaterialSection.TARGET_ACTIVITY ) {
syncSectionsState(section);
}
}
示例12: findElementBySection
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
private Element findElementBySection(MaterialSection section) {
for(Element element : elementsList)
if (element.getElement() == section)
return element;
return null;
}
示例13: addSection
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
public void addSection(MaterialSection section) {
// section.setPosition(sectionList.size());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
section.setTypeface(fontManager.getRobotoMedium());
sectionList.add(section);
ViewParent parent = section.getView().getParent();
sections.addView(section.getView(),params);
// add the element to the list
elementsList.add(new Element(Element.TYPE_SECTION,section));
}
示例14: removeSection
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
public void removeSection(MaterialSection section) {
// remove section from section list and recalculate positions
sectionList.remove(section);
// removes section view from the drawer
sections.removeView(section.getView());
}
示例15: addBottomSection
import it.neokree.materialnavigationdrawer.elements.MaterialSection; //导入依赖的package包/类
public void addBottomSection(MaterialSection section) {
// section.setPosition(BOTTOM_SECTION_START + bottomSectionList.size());
section.setTypeface(fontManager.getRobotoRegular());
bottomSectionList.add(section);
// add the element to the list
elementsList.add(new Element(Element.TYPE_BOTTOM_SECTION,section));
}