本文整理汇总了Java中com.github.johnpersano.supertoasts.util.Style类的典型用法代码示例。如果您正苦于以下问题:Java Style类的具体用法?Java Style怎么用?Java Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Style类属于com.github.johnpersano.supertoasts.util包,在下文中一共展示了Style类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyDown
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
if ((System.currentTimeMillis() - exitTime) > 3000) {
// TToast.show(getResources().getString(R.string.exit_once_more_hint));
// Snackbar.make(mContainer,R.string.exit_once_more_hint,Snackbar.LENGTH_SHORT).show();
SuperActivityToast.create(this, getResources().getString(R.string.exit_once_more_hint),
SuperToast.Duration.SHORT, Style.getStyle(Style.BLUE, SuperToast.Animations.FLYIN)).show();
exitTime = System.currentTimeMillis();
} else {
finish();
}
return true;
}
return super.onKeyDown(keyCode, event);
}
示例2: showMsg
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
public void showMsg(int kind, String msg){
SuperToast superToast = null;
switch (kind){
case TOAST_ALERT:
superToast = SuperToast.create(this, msg, SuperToast.Duration.LONG,
Style.getStyle(Style.RED, SuperToast.Animations.POPUP));
break;
case TOAST_INFO:
superToast = SuperToast.create(this, msg, SuperToast.Duration.LONG,
Style.getStyle(Style.GRAY, SuperToast.Animations.POPUP));
break;
case TOAST_SUCCESS:
superToast = SuperToast.create(this, msg, SuperToast.Duration.LONG,
Style.getStyle(Style.GREEN, SuperToast.Animations.POPUP));
break;
}
superToast.show();
}
示例3: afterSearchResult
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
private void afterSearchResult(List<SongInfo> songInfos){
if(null == songInfos){
SuperToast.create(getActivity()
, "什么都没有找到"
, SuperToast.Duration.LONG
, Style.getStyle(Style.RED, SuperToast.Animations.FADE)).show();
}else {
SearchListAdaptar searchListAdaptar = new SearchListAdaptar(getActivity(), songInfos, new SearchListAdaptar.ItemClick() {
@Override
public void onSearchItemClick(int postion, SongInfo songInfo) {
((MainActivity)getActivity()).onSearchItemClick(songInfo);
}
});
searchRecycler.setAdapter(searchListAdaptar);
}
}
示例4: onTaskCompleted
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
@Override
public void onTaskCompleted(UnicapRequestResult result) {
final StudentCredentials credentials = mAuthTask.getCredentials();
if (result.isSuccess()) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
mRegistrationSignInButton.animate().setDuration(shortAnimTime).alpha(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
Bundle data = new Bundle();
data.putString(AccountManager.KEY_ACCOUNT_NAME, credentials.getRegistration());
data.putString(AccountManager.KEY_ACCOUNT_TYPE, AccountGeneral.ACCOUNT_TYPE);
data.putString(AccountManager.KEY_AUTHTOKEN, credentials.getAuthToken());
data.putString(PARAM_USER_PASS, credentials.getPassword());
Intent intent = new Intent();
intent.putExtras(data);
finishLogin(intent);
}
});
} else {
onTaskCancelled();
// Clean up to prevent broken data
UnicapDataManager.cleanUserData(credentials.getRegistration());
SuperToast superToast = new SuperToast(LoginActivity.this, Style.getStyle(Style.RED, SuperToast.Animations.FLYIN));
superToast.setText(result.getExceptionMessage(LoginActivity.this));
superToast.setDuration(SuperToast.Duration.EXTRA_LONG);
superToast.setIcon(R.drawable.ic_warning_white_24dp, SuperToast.IconPosition.LEFT);
superToast.show();
}
isLoginInProgress = false;
}
示例5: create
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
/**
* Returns a {@value #TAG} with a specified style.
*
* @param activity {@link android.app.Activity}
* @param textCharSequence {@link CharSequence}
* @param durationInteger {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
* @param style {@link com.github.johnpersano.supertoasts.util.Style}
*
* @return {@link SuperActivityToast}
*/
public static SuperActivityToast create(Activity activity, CharSequence textCharSequence, int durationInteger, Style style) {
final SuperActivityToast superActivityToast = new SuperActivityToast(activity);
superActivityToast.setText(textCharSequence);
superActivityToast.setDuration(durationInteger);
superActivityToast.setStyle(style);
return superActivityToast;
}
示例6: setStyle
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
/**
* Private method used to set a default style to the {@value #TAG}
*/
private void setStyle(Style style) {
this.setAnimations(style.animations);
this.setTypefaceStyle(style.typefaceStyle);
this.setTextColor(style.textColor);
this.setBackground(style.background);
}
示例7: create
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
/**
* Returns a {@value #TAG} with a specified style.
*
* @param context {@link android.content.Context}
* @param textCharSequence {@link CharSequence}
* @param durationInteger {@link com.github.johnpersano.supertoasts.SuperToast.Duration}
* @param style {@link com.github.johnpersano.supertoasts.util.Style}
*
* @return SuperCardToast
*/
public static SuperToast create(Context context, CharSequence textCharSequence, int durationInteger, Style style) {
final SuperToast superToast = new SuperToast(context);
superToast.setText(textCharSequence);
superToast.setDuration(durationInteger);
superToast.setStyle(style);
return superToast;
}
示例8: onOptionsItemSelected
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
SuperToast.create(KaoYanApplication.appContext, "Setting", SuperToast.Duration.SHORT,
Style.getStyle(Style.BLUE, SuperToast.Animations.SCALE)).show();
return true;
}
return super.onOptionsItemSelected(item);
}
示例9: deletMusicByName
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
void deletMusicByName(final String songName) {
Observable.create(new Observable.OnSubscribe<String>() {
@Override
public void call(Subscriber<? super String> subscriber) {
try {
Dao dao = dbHelper.getDao(SongInfo.class);
DeleteBuilder deleteBuilder = dao.deleteBuilder();
deleteBuilder.where().eq("title", songName);
deleteBuilder.delete();
subscriber.onCompleted();
} catch (SQLException e) {
e.printStackTrace();
subscriber.onError(e);
}
}
})
.subscribeOn(Schedulers.from(Constant.executor))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<String>() {
@Override
public void call(String s) {
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
SuperToast.create(getActivity()
, "删除歌曲失败"
, SuperToast.Duration.LONG
, Style.getStyle(Style.RED, SuperToast.Animations.FADE)).show();
}
});
}
示例10: preparePlay
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
public void preparePlay() {
checkIsLike();
if (null != musicPlayModel.getMusicInfoCurrent().getSrc()) {
try {
mediaPlayer.reset();
mediaPlayer.setDataSource(musicPlayModel.getMusicInfoCurrent().getSrc());
mediaPlayer.prepareAsync();
} catch (IOException e) {
e.printStackTrace();
SuperToast.create(mContext, "歌曲信息出错", SuperToast.Duration.LONG, Style.getStyle(Style.RED, SuperToast.Animations.FADE)).show();
}
} else {
SuperToast.create(mContext, "歌曲信息出错", SuperToast.Duration.LONG, Style.getStyle(Style.RED, SuperToast.Animations.FADE)).show();
}
}
示例11: onSearch
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
@Click(R.id.search_icon)
void onSearch(){
if(0 == mainViewPager.getCurrentItem()){
switchPager(true, switchPagerDuration);
materialMenu.animateIconState(MaterialMenuDrawable.IconState.ARROW);
YoYo.with(Techniques.FadeOutLeft).duration(switchPagerDuration).playOn(title);
YoYo.with(Techniques.FadeOutLeft).duration(switchPagerDuration).playOn(subTitle);
if (searchET.getVisibility() == View.GONE) {
searchET.setVisibility(View.VISIBLE);
}
YoYo.with(Techniques.FadeIn).duration(switchPagerDuration).withListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
searchET.setFocusable(true);
searchET.setFocusableInTouchMode(true);
searchET.requestFocus();
}
}).playOn(searchET);
}else {
if("".equals(searchET.getText().toString())){
YoYo.with(Techniques.Shake).playOn(searchET);
SuperToast.create(this
, "搜索文字不能为空"
, SuperToast.Duration.LONG
, Style.getStyle(Style.RED
, SuperToast.Animations.FADE)).show();
}else {
searchFragment.search(searchET.getText().toString(), true);
}
}
}
示例12: onCancelled
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
@Override
protected void onCancelled() {
pull.setRefreshing(false);
SuperToast.create(
fragment.getActivity(),
context.getString(R.string.repo_add_successful),
SuperToast.Duration.VERY_SHORT,
Style.getStyle(Style.BLUE)
).show();
}
示例13: logoutAction
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
private void logoutAction() {
RAction rAction = new RAction(MainActivity.this);
BAction bAction = new BAction(MainActivity.this);
try {
rAction.openDatabase(true);
bAction.openDatabase(true);
rAction.deleteAll();
bAction.unMarkAll();
rAction.closeDatabase();
bAction.closeDatabase();
} catch (SQLException s) {
rAction.closeDatabase();
bAction.closeDatabase();
SuperToast.create(
MainActivity.this,
getString(R.string.main_logout_failed),
SuperToast.Duration.VERY_SHORT,
Style.getStyle(Style.RED)
).show();
}
SharedPreferences preferences = getSharedPreferences(getString(R.string.login_sp), MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.remove(getString(R.string.login_sp_oauth));
editor.remove(getString(R.string.login_sp_username));
editor.remove(getString(R.string.login_sp_highlight_num));
editor.remove(getString(R.string.login_sp_highlight_css));
editor.commit();
fragment.allTaskDown();
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
MainActivity.this.finish();
}
示例14: setStyle
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
/**
* Private method used to set a default style to the {@value #TAG}
*/
private void setStyle(Style style) {
this.setAnimations(style.animations);
this.setTypefaceStyle(style.typefaceStyle);
this.setTextColor(style.textColor);
this.setBackground(style.background);
if (this.mType == Type.BUTTON) {
this.setDividerColor(style.dividerColor);
this.setButtonTextColor(style.buttonTextColor);
}
}
示例15: setStyle
import com.github.johnpersano.supertoasts.util.Style; //导入依赖的package包/类
/**
* Private method used to set a default style to the {@value #TAG}
*/
private void setStyle(Style style) {
this.setAnimations(style.animations);
this.setTypefaceStyle(style.typefaceStyle);
this.setTextColor(style.textColor);
this.setBackground(style.background);
if(this.mType == Type.BUTTON) {
this.setDividerColor(style.dividerColor);
this.setButtonTextColor(style.buttonTextColor);
}
}