本文整理汇总了Java中com.github.johnpersano.supertoasts.library.utils.PaletteUtils类的典型用法代码示例。如果您正苦于以下问题:Java PaletteUtils类的具体用法?Java PaletteUtils怎么用?Java PaletteUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaletteUtils类属于com.github.johnpersano.supertoasts.library.utils包,在下文中一共展示了PaletteUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleLoginCallback
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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: onBackPressed
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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();
}
示例3: onClick
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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));
}
}
示例4: updateUI
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
@Override
protected void updateUI() {
if(mImages == null) {
SuperActivityToast.create(this, new com.github.johnpersano.supertoasts.library.Style(), com.github.johnpersano.supertoasts.library.Style.TYPE_STANDARD)
.setText(getString(R.string.layout_empty_response))
.setTypefaceStyle(Typeface.NORMAL)
.setIconPosition(com.github.johnpersano.supertoasts.library.Style.ICONPOSITION_LEFT)
.setIconResource(R.drawable.ic_close_24dp)
.setDuration(com.github.johnpersano.supertoasts.library.Style.DURATION_MEDIUM)
.setFrame(com.github.johnpersano.supertoasts.library.Style.FRAME_STANDARD)
.setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_RED))
.setAnimations(com.github.johnpersano.supertoasts.library.Style.ANIMATIONS_SCALE).show();
} else {
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mRecyclerView.setAdapter(new PreviewImageAdapter(mImages, mTypes, this));
mCardScaleHelper = new CardScaleHelper();
mCardScaleHelper.attachToRecyclerView(mRecyclerView);
}
}
示例5: updateUI
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
@Override
protected void updateUI() {
if((imageURL = getIntent().getStringExtra(IMAGE_SOURCE)) != null){
Glide.with(this).load(imageURL)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(mImageView);
}
else {
SuperActivityToast.create(this, new com.github.johnpersano.supertoasts.library.Style(), com.github.johnpersano.supertoasts.library.Style.TYPE_STANDARD)
.setText("Sorry, could not resolve content!")
.setTypefaceStyle(Typeface.NORMAL)
.setIconPosition(com.github.johnpersano.supertoasts.library.Style.ICONPOSITION_LEFT)
.setIconResource(R.drawable.ic_close_24dp)
.setDuration(com.github.johnpersano.supertoasts.library.Style.DURATION_MEDIUM)
.setFrame(com.github.johnpersano.supertoasts.library.Style.FRAME_STANDARD)
.setColor(PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_RED))
.setAnimations(com.github.johnpersano.supertoasts.library.Style.ANIMATIONS_SCALE).show();
}
}
示例6: onBackPressed
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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();
}
示例7: saveGenres
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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: getColor
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
public static int getColor(Context context) {
switch (PreferenceManager.getDefaultSharedPreferences(context).getInt(context
.getResources().getString(R.string.color_title), 0)) {
case 0: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_RED);
case 1: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_PINK);
case 2: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_PURPLE);
case 3: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_DEEP_PURPLE);
case 4: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_INDIGO);
case 5: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE);
case 6: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_LIGHT_BLUE);
case 7: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_CYAN);
case 8: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_TEAL);
case 9: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_GREEN);
case 10: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_LIGHT_GREEN);
case 11: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_LIME);
case 12: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_YELLOW);
case 13: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_AMBER);
case 14: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_ORANGE);
case 15: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_DEEP_ORANGE);
case 16: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BROWN);
case 17: return PaletteUtils.getSolidColor(PaletteUtils.GREY);
case 18: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE_GREY);
default: return PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_BLUE_GREY);
}
}
示例9: checkStatus
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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));
}
}
示例10: displayMessage
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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();
}
示例11: createSuperToast
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的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();
}
示例12: showSyncToCalendarSuccessful
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
@Override
public void showSyncToCalendarSuccessful() {
DialogFactory.createSuperToast(
this,
getResources().getString(R.string.settings_calendar_sync_successful),
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_GREEN))
.show();
}
示例13: showFileDeleteSuccess
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
@Override
public void showFileDeleteSuccess() {
DialogFactory.createSuperToast(getContext(),
getResources().getString(R.string.files_delete_success_file),
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_GREEN)).show();
reloadFiles();
}
示例14: showDirectoryDeleteSuccess
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
@Override
public void showDirectoryDeleteSuccess() {
DialogFactory.createSuperToast(getContext(),
getResources().getString(R.string.files_delete_success_directory),
PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_GREEN)).show();
reloadFiles();
}
示例15: Style
import com.github.johnpersano.supertoasts.library.utils.PaletteUtils; //导入依赖的package包/类
/**
* Public constructor for a new {@link Style}.
* This constructor will assign a few default values.
*/
public Style() {
// General SuperToast items
this.duration = DURATION_MEDIUM;
this.color = PaletteUtils.getSolidColor(PaletteUtils.MATERIAL_GREY);
this.gravity = Gravity.BOTTOM | Gravity.CENTER;
this.yOffset = BackgroundUtils.convertToDIP(64);
this.width = FrameLayout.LayoutParams.WRAP_CONTENT;
this.height = FrameLayout.LayoutParams.WRAP_CONTENT;
this.priorityLevel = PRIORITY_MEDIUM;
// Message TextView items
this.messageTypefaceStyle = Typeface.NORMAL;
this.messageTextColor = PaletteUtils.getSolidColor(PaletteUtils.WHITE);
this.messageTextSize = TEXTSIZE_SMALL;
this.messageIconPosition = ICONPOSITION_LEFT;
// SuperActivityToast Button items
this.buttonTypefaceStyle = Typeface.BOLD;
this.buttonTextColor = PaletteUtils.getSolidColor(PaletteUtils.WHITE);
this.buttonTextSize = TEXTSIZE_VERY_SMALL;
this.buttonDividerColor = PaletteUtils.getSolidColor(PaletteUtils.WHITE);
//SuperActivityToast Progress items
this.progressBarColor = PaletteUtils.getSolidColor(PaletteUtils.WHITE);
this.progressIndeterminate = true;
}