本文整理汇总了Java中com.github.johnpersano.supertoasts.library.Style类的典型用法代码示例。如果您正苦于以下问题:Java Style类的具体用法?Java Style怎么用?Java Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Style类属于com.github.johnpersano.supertoasts.library包,在下文中一共展示了Style类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleLoginCallback
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
public void handleLoginCallback(Uri uri) {
//Use the parameter your API exposes for the code (mostly it's "code")
String code = uri.getQueryParameter(BuildConfig.RESPONSE_TYPE);
if(code != null) {
TokenReference tokenReference = new TokenReference(mActivity);
if(tokenReference.AuthorizeNewToken(code)) {
getAppPrefs().setUserAuthenticated();
ServiceGenerator.authStateChange(mActivity);
reference = new Authorize();
reference.execute();
}
else
createSuperToast(mActivity, mActivity.getString(R.string.text_error_capture_login), R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_AMBER));
} else if ((code = uri.getQueryParameter("error")) != null)
createSuperToast(mActivity, code, R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_RED));
else
createSuperToast(mActivity, mActivity.getString(R.string.text_error_auth_login), R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_AMBER));
}
示例2: onClickSeries
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
/**
* TODO: Handle Manga Items clicks
* Bind to onClickListener in an adapter, and implement in fragment or class
* <br/>
*
* @param item the adapter position of the clicked item.
* @param vId the current view id.
*/
@Override
public void onClickSeries(ListItem item, int vId) {
switch (vId) {
case R.id.txt_anime_eps:
if(mPresenter.getAppPrefs().isAuthenticated())
new SeriesActionHelper(getActivity(), mRequestType == RequestType.USER_ANIME_LIST_REQ? KeyUtils.ANIME: KeyUtils.MANGA, item, this, mPresenter.getDefaultPrefs().isAutoIncrement()).execute();
else
mPresenter.createSuperToast(getActivity(), getString(R.string.info_login_req), R.drawable.ic_info_outline_white_18dp, Style.TYPE_STANDARD);
break;
default:
if (mRequestType == RequestType.USER_ANIME_LIST_REQ) {
Intent mAnimeStarter = new Intent(getActivity(), AnimeActivity.class);
mAnimeStarter.putExtra(AnimeActivity.MODEL_ID_KEY, item.getAnime().getId());
mAnimeStarter.putExtra(AnimeActivity.MODEL_BANNER_KEY, item.getAnime().getImage_url_banner());
startActivity(mAnimeStarter);
} else {
Intent mMangaStarter = new Intent(getActivity(), MangaActivity.class);
mMangaStarter.putExtra(MangaActivity.MODEL_ID_KEY, item.getManga().getId());
mMangaStarter.putExtra(MangaActivity.MODEL_BANNER_KEY, item.getManga().getImage_url_banner());
startActivity(mMangaStarter);
}
break;
}
}
示例3: onBackPressed
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
@Override
public void onBackPressed() {
if (mDrawer.isDrawerOpen(GravityCompat.START))
mDrawer.closeDrawer(GravityCompat.START);
else if(mFilterBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
mFilterBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
else if(!isClosing) {
isClosing = true;
mPresenter.createSuperToast(MainActivity.this,
getString(R.string.text_confirm_exit),
R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_MEDIUM,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_TEAL));
}
else
super.onBackPressed();
}
示例4: onClick
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
/**
* When Material Dialog on click occurs
*/
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if(mNavigationIndex == R.id.nav_anime || mNavigationIndex == R.id.nav_manga || mNavigationIndex == R.id.nav_myanime || mNavigationIndex == R.id.nav_mymanga || mNavigationIndex == R.id.nav_hub) {
mPresenter.createSuperToast(MainActivity.this,
getString(R.string.text_filter_applying),
R.drawable.ic_reset,
Style.TYPE_PROGRESS_BAR, Style.DURATION_VERY_SHORT,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_CYAN));
} else {
mPresenter.createSuperToast(MainActivity.this,
getString(R.string.text_filter_restriction),
R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_SHORT,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_ORANGE));
}
}
示例5: onBackPressed
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
/**
* Take care of popping the fragment back stack or finishing the activity
* as appropriate.
*/
@Override
public void onBackPressed() {
if(mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
else if(editText.hasFocus())
editText.clearFocus();
else if(!isClosing) {
isClosing = true;
mPresenter.createSuperToast(ComposerActivity.this,
getString(R.string.text_confirm_exit),
R.drawable.ic_info_outline_white_18dp,
Style.TYPE_STANDARD, Style.DURATION_MEDIUM,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_TEAL));
}
else
super.onBackPressed();
}
示例6: startAction
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
private void startAction() {
Payload.ActivityStruct activityStruct;
if(mActionType == null)
mActionType = KeyUtils.ActionType.ACTIVITY_CREATE;
switch (mActionType) {
case ACTIVITY_CREATE:
activityStruct = new Payload.ActivityStruct(editText.getText().toString());
activityActions = new RequestApiAction.ActivityActions<>(getApplicationContext(), this, mActionType, activityStruct);
break;
case ACTIVITY_EDIT:
activityStruct = new Payload.ActivityStruct(id, editText.getText().toString(), mPresenter.getCurrentUser().getId(), -1);
activityActions = new RequestApiAction.ActivityActions<>(getApplicationContext(), this, mActionType, activityStruct);
break;
}
activityActions.execute();
mPresenter.createSuperToast(this, getString(R.string.Sending), R.drawable.ic_info_outline_white_18dp,
Style.TYPE_PROGRESS_BAR, Style.DURATION_VERY_LONG,
ContextCompat.getColor(this, R.color.colorStateBlue));
}
示例7: saveGenres
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
public void saveGenres(Integer[] which, CharSequence[] text, Activity mContext) {
String genres = "";
createSuperToast(mContext,
mContext.getString(R.string.text_filter_applying),
R.drawable.ic_reset,
Style.TYPE_PROGRESS_BAR, Style.DURATION_MEDIUM,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_CYAN));
for (CharSequence temp: text) {
if(genres.isEmpty())
genres += String.format("%s",temp);
else
genres += String.format(",%s",temp);
}
for (Integer index: which)
indexGenres.add(String.valueOf(index));
// Save the built list
getApiPrefs().saveGenres(genres);
getApiPrefs().saveGenresIndices(indexGenres);
//notifyAllItems();
}
示例8: makeProgressToast
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
public static SuperActivityToast makeProgressToast(final Activity activity, final String message) {
SuperActivityToast.cancelAllSuperToasts();
final SuperActivityToast superActivityToast = new SuperActivityToast(activity, Style.TYPE_PROGRESS_BAR);
superActivityToast.setAnimations(Style.ANIMATIONS_FADE);
superActivityToast.setDuration(Style.DURATION_SHORT);
superActivityToast.setColor(Style.blue().color);
superActivityToast.setText(message);
superActivityToast.setTextSize(Style.TEXTSIZE_MEDIUM);
superActivityToast.setTouchToDismiss(true);
superActivityToast.show();
return superActivityToast;
}
示例9: makeInfoToast
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
public static SuperActivityToast makeInfoToast(final Activity activity, final String message) {
SuperActivityToast.cancelAllSuperToasts();
final SuperActivityToast superActivityToast = new SuperActivityToast(activity, Style.TYPE_STANDARD);
superActivityToast.setAnimations(Style.ANIMATIONS_FADE);
superActivityToast.setDuration(Style.DURATION_SHORT);
superActivityToast.setColor(Style.green().color);
superActivityToast.setText(message);
superActivityToast.setTextSize(Style.TEXTSIZE_MEDIUM);
superActivityToast.setTouchToDismiss(true);
superActivityToast.show();
return superActivityToast;
}
示例10: makeWarningToast
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
public static SuperActivityToast makeWarningToast(final Activity activity, final String message) {
SuperActivityToast.cancelAllSuperToasts();
final SuperActivityToast superActivityToast = new SuperActivityToast(activity, Style.TYPE_STANDARD);
superActivityToast.setAnimations(Style.ANIMATIONS_FADE);
superActivityToast.setDuration(Style.DURATION_SHORT);
superActivityToast.setColor(Style.orange().color);
superActivityToast.setText(message);
superActivityToast.setTextSize(Style.TEXTSIZE_MEDIUM);
superActivityToast.setTouchToDismiss(true);
superActivityToast.show();
return superActivityToast;
}
示例11: onLongClickSeries
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
/**
* Bind to onLongClickListener in an adapter, and implement in fragment or class
* <br/>
*
* @param item the adapter position of the clicked item.
*/
@Override
public void onLongClickSeries(ListItem item) {
if(mPresenter.getAppPrefs().isAuthenticated())
new SeriesActionHelper(getActivity(), mRequestType == RequestType.USER_ANIME_LIST_REQ? KeyUtils.ANIME: KeyUtils.MANGA, item, this, false).execute();
else
mPresenter.createSuperToast(getActivity(), getString(R.string.info_login_req), R.drawable.ic_info_outline_white_18dp, Style.TYPE_STANDARD);
}
示例12: checkStatus
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
/**
* Runs once to check if users has youtube installed
*/
private void checkStatus(){
if(!YouTubeIntents.canResolvePlayVideoIntent(this))
{
mPresenter.createSuperToast(MainActivity.this,
getString(R.string.init_youtube_missing),
R.drawable.ic_play_circle_outline_white_24dp,
Style.TYPE_STANDARD, Style.DURATION_VERY_LONG,
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE_GREY));
}
}
示例13: updateUI
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
@Override
protected void updateUI() {
mToolbar.setTitle(getString(R.string.text_reviewed_by, mReview.getUser().getDisplay_name()));
RichTextConfig.RichTextConfigBuild builder = RichText
.from(PatternMatcher.convertToStandardMarkdown(mReview.getTextRaw()))
.imageGetter(new DefaultImageGetter())
.type(RichType.MARKDOWN);
mRichText = builder.into(reviewText);
Glide.with(this).load(mReview.getUser()
.getImage_url_med()).centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(avatar);
SeriesSmall anime = mReview.getAnime();
SeriesSmall manga = mReview.getManga();
boolean isAnime = anime != null;
switch (mPresenter.getApiPrefs().getTitleLanguage()) {
case "romaji":
reviewHeading.setText(isAnime? anime.getTitle_romaji() : manga.getTitle_romaji());
break;
case "english":
reviewHeading.setText(isAnime? anime.getTitle_english() : manga.getTitle_english());
break;
case "japanese":
reviewHeading.setText(isAnime? anime.getTitle_japanese() : manga.getTitle_japanese());
break;
}
Glide.with(this).load(isAnime?anime.getImage_url_lge():manga.getImage_url_lge()).centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(reviewSeries);
mPresenter.createSuperToast(this, getString(R.string.text_processing), R.drawable.ic_info_outline_white_18dp,
Style.TYPE_PROGRESS_BAR, Style.DURATION_VERY_LONG,
ContextCompat.getColor(this, R.color.colorStateBlue));
}
示例14: displayMessage
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
public void displayMessage(String message, Context activity) {
SuperActivityToast.create(activity, new com.github.johnpersano.supertoasts.library.Style(), Style.TYPE_STANDARD)
.setText(String.format(Locale.getDefault(), " %s", message))
.setTypefaceStyle(Typeface.NORMAL)
.setIconPosition(Style.ICONPOSITION_LEFT)
.setIconResource(R.drawable.ic_info_outline_white_18dp)
.setDuration(Style.DURATION_VERY_SHORT)
.setFrame(Style.FRAME_STANDARD)
.setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE))
.setAnimations(Style.ANIMATIONS_FADE).show();
}
示例15: createSuperToast
import com.github.johnpersano.supertoasts.library.Style; //导入依赖的package包/类
/**
* Show super toast from an activity
* <br/>
* @param mContext Activity calling this method.
* @param mText Desired message to display
* @param mIcon Drawable preferred 24dp vectors will also work
* @param mType Style.TYPE type of the toast
*
* <br/>
* @see com.github.johnpersano.supertoasts.library.Style for toast duration & style
*/
public void createSuperToast(Activity mContext, String mText, @DrawableRes int mIcon, @Style.Type int mType) {
mToast = SuperActivityToast.create(mContext, new Style(), mType)
.setText(" "+mText) //add a space for the icon
.setTypefaceStyle(Typeface.NORMAL)
.setIconPosition(Style.ICONPOSITION_LEFT)
.setIconResource(mIcon)
.setDuration(Style.DURATION_VERY_SHORT)
.setFrame(Style.FRAME_LOLLIPOP)
.setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_CYAN))
.setAnimations(Style.ANIMATIONS_FLY);
mToast.show();
}