本文整理汇总了Java中com.afollestad.materialdialogs.Theme类的典型用法代码示例。如果您正苦于以下问题:Java Theme类的具体用法?Java Theme怎么用?Java Theme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Theme类属于com.afollestad.materialdialogs包,在下文中一共展示了Theme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showThemed
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
@OnClick(R.id.themed) public void showThemed() {
new MaterialDialog.Builder(this)
.title(R.string.useGoogleLocationServices)
.content(R.string.useGoogleLocationServicesPrompt)
.positiveText(R.string.agree)
.negativeText(R.string.disagree)
.positiveColorRes(R.color.material_red_400)
.negativeColorRes(R.color.material_red_400)
.titleGravity(GravityEnum.CENTER)
.titleColorRes(R.color.material_red_400)
.contentColorRes(android.R.color.white)
.backgroundColorRes(R.color.material_blue_grey_800)
.dividerColorRes(R.color.accent)
.btnSelector(R.drawable.md_btn_selector_custom, DialogAction.POSITIVE)
.positiveColor(Color.WHITE)
.negativeColorAttr(android.R.attr.textColorSecondaryInverse)
.theme(Theme.DARK)
.show();
}
示例2: createDialogInput
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
/**
* Creates a dialog to type in text
*/
public void createDialogInput(String header, String content, MaterialDialog.InputCallback callback, MaterialDialog.SingleButtonCallback buttonCallback) {
new MaterialDialog.Builder(mContext)
.positiveText(R.string.Ok)
.negativeText(R.string.Cancel)
//.neutralText(R.string.attach_media)
.autoDismiss(false)
.onAny(buttonCallback)
.buttonRippleColorRes(R.color.colorAccent)
.positiveColorRes(R.color.colorStateBlue)
.negativeColorRes(R.color.colorStateOrange)
.theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
.title(header)
.content(content)
.inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE | InputType.TYPE_TEXT_FLAG_MULTI_LINE)
.input(mContext.getString(R.string.text_enter_text), null, callback)
.show();
}
示例3: createDialogMessage
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
/**
* Creates a dialog to display a message
*/
public void createDialogMessage(String header, String body, String pos, String neg, MaterialDialog.SingleButtonCallback buttonCallback) {
// Build the alert dialog
new MaterialDialog.Builder(mContext)
.onAny(buttonCallback)
.positiveText(pos)
.negativeText(neg)
.typeface(Typeface.SANS_SERIF,Typeface.SANS_SERIF)
.iconRes(app_prefs.isLightTheme()?R.drawable.ic_new_releases_black_24dp:R.drawable.ic_new_releases_white_24dp)
.buttonRippleColorRes(R.color.colorAccent)
.positiveColorRes(R.color.colorStateBlue)
.negativeColorRes(R.color.colorStateOrange)
.theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
.title(header)
.content(body)
.show();
}
示例4: createDialogSelection
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void createDialogSelection(String title , int selection, MaterialDialog.ListCallbackSingleChoice callbackSingleChoice, MaterialDialog.SingleButtonCallback positive, int index){
new MaterialDialog.Builder(mContext)
.title(title)
.items(selection)
.typeface(Typeface.SANS_SERIF,Typeface.SANS_SERIF)
.iconRes(app_prefs.isLightTheme()?R.drawable.ic_view_list_black_24dp:R.drawable.ic_view_list_white_24dp)
.buttonRippleColorRes(R.color.colorAccent)
.positiveColorRes(R.color.colorStateBlue)
.negativeColorRes(R.color.colorStateOrange)
.theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
.itemsCallbackSingleChoice(index, callbackSingleChoice)
.positiveText(R.string.Apply)
.neutralText(R.string.Cancel)
.onPositive(positive)
.onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
})
.show();
}
示例5: createSorceryDialog
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
private void createSorceryDialog() {
PhilosopherStone stone = new SorceryStone.Builder(getActivity())
.titleColor(Color.MAGENTA)
.titleGravity(GravityEnum.CENTER)
.contentColor(Color.CYAN)
.contentGravity(GravityEnum.CENTER)
.buttonRippleColor(Color.YELLOW)
.contentLineSpacing(2.0f)
.theme(Theme.DARK)
.setPhilosopherStone(new ColorPaletteStone()) // special power
.build();
Material.Builder builder = new Material.Builder(getActivity())
.setTitle("Sorcery Stone")
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok, null)
.setPhilosopherStone(stone);
DialogAlchemy.show(getFragmentManager(), builder.build(),
new MaterialDialogsTransmutationCircle());
}
示例6: showProgressDialog
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void showProgressDialog(@Nullable String content) {
if (this.mProgressDialog == null) {
this.mProgressDialog = new MaterialDialog.Builder(this)
.theme(Theme.LIGHT)
.content(content == null ? "请稍后..." : content)
.progress(true, 0)
.cancelable(false)
.show();
} else {
this.mProgressDialog.setContent(content == null ? "请稍后..." : content);
}
if (!this.mProgressDialog.isShowing()) {
this.mProgressDialog.show();
}
}
示例7: onMenuItemFontSizeClick
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void onMenuItemFontSizeClick(){
String[] fontSizes = getResources().getStringArray(R.array.readview_font_size_entries);
int index = Arrays.binarySearch(fontSizes, mFontSizePref.get());
MaterialDialog.Builder dialogBuilder = new MaterialDialog.Builder(this)
.title(R.string.settings_item_font_size_dialog_title)
.items(fontSizes)
.theme(isNightMode() ? Theme.DARK : Theme.LIGHT)
.itemsCallbackSingleChoice(index, (materialDialog, view, selection, charSequence) -> {
mFontSizePref.set(charSequence.toString());
mFontSize = PreferenceConverter.getFontSize(NovelReadViewActivity.this, charSequence.toString());
mNovelReadAdapter.setFontSize(mFontSize);
//getPresenter().getSplitTextPainter().setTextSize(mFontSize);
getPresenter().splitChapterAndDisplay(mNovelChapters.get(chapterIndex).getTitle(),
mCurrentContent);
return true;
})
.positiveText(R.string.dialog_choose);
MaterialDialog dialog = dialogBuilder.build();
dialog.setOnDismissListener(dialogInterface -> hideSystemUI());
dialog.show();
}
示例8: onMenuItemPageCurlModeClick
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void onMenuItemPageCurlModeClick(){
String[] pageCurlModes = getResources().getStringArray(R.array.scroll_mode_string_entries);
String[] pageCurlModeValues = getResources().getStringArray(R.array.scroll_mode_value_entries);
String currentMode = mScrollMode.get();
int index = Arrays.binarySearch(pageCurlModeValues, currentMode);
MaterialDialog.Builder dialogBuilder = new MaterialDialog.Builder(this)
.title(R.string.settings_item_scroll_mode_title)
.items(pageCurlModes)
.theme(isNightMode() ? Theme.DARK : Theme.LIGHT)
.itemsCallbackSingleChoice(index, (materialDialog, view, selection, charSequence) -> {
if(selection == index) return false;
mScrollMode.set(pageCurlModeValues[selection]);
mReadWidgetContainer.removeAllViews();
recreate();
return true;
})
.positiveText(R.string.dialog_choose);
MaterialDialog dialog = dialogBuilder.build();
dialog.setOnDismissListener(dialogInterface -> hideSystemUI());
dialog.show();
}
示例9: onClickGender
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
@OnClick(R.id.layout_gender)
public void onClickGender() {
new MaterialDialog.Builder(getActivity())
.theme(Theme.LIGHT)
.title("Gender")
.items(Gender.getStringValues(getActivity()))
.itemsCallbackSingleChoice(mPresenter.getCurrentGender() - 1, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Gender gender = Gender.fromValue(getActivity(), text.toString());
if (gender != null) {
mPresenter.setCurrentGender(gender.getIntValue());
}
return true;
}
})
.positiveText("Done")
.show();
}
示例10: onClickActivityFactor
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
@OnClick(R.id.layout_activity_factor)
public void onClickActivityFactor() {
new MaterialDialog.Builder(getActivity())
.theme(Theme.LIGHT)
.title("Activity Level")
.items(ActivityFactor.getStringValues(getActivity()))
.itemsCallbackSingleChoice(mPresenter.getCurrentActivityFactor() - 1, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
ActivityFactor activityFactor = ActivityFactor.fromValue(getActivity(), text.toString());
if (activityFactor != null) {
mPresenter.setCurrentActivityFactor(activityFactor.getIntValue());
}
return true;
}
})
.positiveText("Done")
.show();
}
示例11: onClickGoal
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
@OnClick(R.id.layout_goal)
public void onClickGoal() {
new MaterialDialog.Builder(getActivity())
.theme(Theme.LIGHT)
.title("Goal")
.items(Goal.getStringValues(getActivity()))
.itemsCallbackSingleChoice(mPresenter.getCurrentGoal() - 1, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
Goal goal = Goal.fromValue(getActivity(), text.toString());
if (goal != null) {
mPresenter.setCurrentGoal(goal.getIntValue());
}
return true;
}
})
.positiveText("Done")
.show();
}
示例12: onDailyClick
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
@OnClick(com.zireck.calories.R.id.layout_daily)
public void onDailyClick() {
mMaterialDialog = new MaterialDialog.Builder(getActivity())
.title("Daily Meal")
.items(Mealtime.getStringValues(getActivity()))
.itemsCallbackSingleChoice(0, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog materialDialog, View view, int which,
CharSequence text) {
mTextDaily.setText(text);
return false;
}
})
.theme(Theme.LIGHT)
.widgetColorRes(com.zireck.calories.R.color.primary)
.positiveText("Choose")
.positiveColorRes(com.zireck.calories.R.color.primary)
.negativeText("Cancel")
.negativeColorRes(com.zireck.calories.R.color.primary)
.show();
}
示例13: showSortDialog
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void showSortDialog(final Main m) {
String[] sort = m.getResources().getStringArray(R.array.sortby);
int current = Integer.parseInt(m.Sp.getString("sortby", "0"));
MaterialDialog.Builder a = new MaterialDialog.Builder(m.getActivity());
if(m.theme1==1)a.theme(Theme.DARK);
a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
m.Sp.edit().putString("sortby", "" + which).commit();
m.getSortModes();
m.loadlist(new File(m.current), false);
dialog.dismiss();
return true;
}
});
a.title(R.string.sortby);
a.build().show();
}
示例14: showHistoryDialog
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void showHistoryDialog(final Main m) {
final ArrayList<String> paths = m.history.readTable();
final MaterialDialog.Builder a = new MaterialDialog.Builder(m.getActivity());
a.positiveText(R.string.cancel);
a.positiveColor(Color.parseColor(m.fabSkin));
a.title(R.string.history);
if(m.theme1==1)
a.theme(Theme.DARK);
LayoutInflater layoutInflater = (LayoutInflater) m.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.list_dialog, null);
ListView listView = (ListView) view.findViewById(R.id.listView);
listView.setDivider(null);
a.customView(view, true);
a.autoDismiss(true);
MaterialDialog x=a.build();
HiddenAdapter adapter = new HiddenAdapter(m.getActivity(),m, R.layout.bookmarkrow, toFileArray(paths),m.hidden,x,true);
listView.setAdapter(adapter);
x.show();
}
示例15: showHiddenDialog
import com.afollestad.materialdialogs.Theme; //导入依赖的package包/类
public void showHiddenDialog(final Main m) {
final ArrayList<String> paths = m.hidden.readTable();
final MaterialDialog.Builder a = new MaterialDialog.Builder(m.getActivity());
a.positiveText(R.string.cancel);
a.positiveColor(Color.parseColor(m.fabSkin));
a.title(R.string.hiddenfiles);
if(m.theme1==1)
a.theme(Theme.DARK);
LayoutInflater layoutInflater = (LayoutInflater) m.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.list_dialog, null);
ListView listView = (ListView) view.findViewById(R.id.listView);
a.customView(view, true);
a.autoDismiss(true);
listView.setDivider(null);
MaterialDialog x=a.build();
HiddenAdapter adapter = new HiddenAdapter(m.getActivity(),m, R.layout.bookmarkrow, toFileArray(paths),m.hidden,x,false);
listView.setAdapter(adapter);
x.show();
}