Java Code Examples for com.hjq.toast.ToastUtils#show()

The following examples show how to use com.hjq.toast.ToastUtils#show() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LanguageActivity.java    From MultiLanguages with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_language);

    findViewById(R.id.btn_language_auto).setOnClickListener(this);
    findViewById(R.id.btn_language_cn).setOnClickListener(this);
    findViewById(R.id.btn_language_tw).setOnClickListener(this);
    findViewById(R.id.btn_language_en).setOnClickListener(this);

    ((TextView) findViewById(R.id.tv_language_system)).setText(LanguagesManager.getLanguageString(this, LanguagesManager.getSystemLanguage(), R.string.current_language));

    Locale locale = LanguagesManager.getAppLanguage(this);
    if (LanguagesManager.equalsCountry(locale, Locale.CHINA)) {
        ToastUtils.show("简体");
    } else if (LanguagesManager.equalsCountry(locale, Locale.TAIWAN)) {
        ToastUtils.show("繁体");
    } else if (LanguagesManager.equalsLanguage(locale, Locale.ENGLISH)) {
        ToastUtils.show("英语");
    } else {
        ToastUtils.show("未知语种");
    }
}
 
Example 2
Source File: CheckNetAspect.java    From AndroidProject with Apache License 2.0 6 votes vote down vote up
/**
 * 在连接点进行方法替换
 */
@Around("method() && @annotation(checkNet)")
public void aroundJoinPoint(ProceedingJoinPoint joinPoint, CheckNet checkNet) throws Throwable {
    Application application = ActivityStackManager.getInstance().getApplication();
    if (application != null) {
        ConnectivityManager manager = ContextCompat.getSystemService(application, ConnectivityManager.class);
        if (manager != null) {
            NetworkInfo info = manager.getActiveNetworkInfo();
            // 判断网络是否连接
            if (info == null || !info.isConnected()) {
                ToastUtils.show(R.string.common_network);
                return;
            }
        }
    }
    //执行原方法
    joinPoint.proceed();
}
 
Example 3
Source File: SelectDialog.java    From AndroidProject with Apache License 2.0 6 votes vote down vote up
/**
 * {@link BaseAdapter.OnItemClickListener}
 */

@Override
public void onItemClick(RecyclerView recyclerView, View itemView, int position) {
    if (mSelectSet.containsKey(position)) {
        // 当前必须不是单选模式才能取消选中
        if (!isSingleSelect()) {
            mSelectSet.remove(position);
            notifyItemChanged(position);
        }
    } else {
        if (mMaxSelect == 1) {
            mSelectSet.clear();
            notifyDataSetChanged();
        }

        if (mSelectSet.size() < mMaxSelect) {
            mSelectSet.put(position, getItem(position));
            notifyItemChanged(position);
        } else {
            ToastUtils.show(String.format(getString(R.string.select_max_hint), mMaxSelect));
        }
    }
}
 
Example 4
Source File: SelectDialog.java    From AndroidProject with Apache License 2.0 6 votes vote down vote up
@SingleClick
@SuppressWarnings("all")
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.tv_ui_confirm:
            HashMap<Integer, Object> data = mAdapter.getSelectSet();
            if (data.size() >= mAdapter.getMinSelect()) {
                autoDismiss();
                if (mListener != null) {
                    mListener.onSelected(getDialog(), data);
                }
            } else {
                ToastUtils.show(String.format(getString(R.string.select_min_hint), mAdapter.getMinSelect()));
            }
            break;
        case R.id.tv_ui_cancel:
            autoDismiss();
            if (mListener != null) {
                mListener.onCancel(getDialog());
            }
            break;
        default:
            break;
    }
}
 
Example 5
Source File: MainActivity.java    From EasyHttp with Apache License 2.0 5 votes vote down vote up
@Override
public void noPermission(List<String> denied, boolean quick) {
    if (quick) {
        ToastUtils.show("授权失败,请手动授予权限");
        XXPermissions.startPermissionActivity(this, true);
    } else {
        ToastUtils.show("请先授予权限");
        requestPermission();
    }
}
 
Example 6
Source File: MainActivity.java    From XXPermissions with Apache License 2.0 5 votes vote down vote up
public void hasPermission(View view) {
    if (XXPermissions.hasPermission(MainActivity.this, Permission.Group.STORAGE)) {
        ToastUtils.show("已经获取到权限,不需要再次申请了");
    }else {
        ToastUtils.show("还没有获取到权限或者部分权限未授予");
    }
}
 
Example 7
Source File: ShareDialog.java    From AndroidProject with Apache License 2.0 5 votes vote down vote up
/**
 * {@link BaseAdapter.OnItemClickListener}
 */
@Override
public void onItemClick(RecyclerView recyclerView, View itemView, int position) {
    Platform platform = mAdapter.getItem(position).getSharePlatform();
    if (platform != null) {
        UmengClient.share(getActivity(), platform, mData, mListener);
    } else {
        // 复制到剪贴板
        getSystemService(ClipboardManager.class).setPrimaryClip(ClipData.newPlainText("url", mData.getShareUrl()));
        ToastUtils.show(R.string.share_platform_copy_hint);
    }
    dismiss();
}
 
Example 8
Source File: BaseActivity.java    From EasyHttp with Apache License 2.0 4 votes vote down vote up
@Override
public void onFail(Exception e) {
    ToastUtils.show(e.getMessage());
}
 
Example 9
Source File: ToastAction.java    From AndroidProject with Apache License 2.0 4 votes vote down vote up
default void toast(CharSequence text) {
    ToastUtils.show(text);
}
 
Example 10
Source File: ToastAction.java    From AndroidProject with Apache License 2.0 4 votes vote down vote up
default void toast(@StringRes int id) {
    ToastUtils.show(id);
}
 
Example 11
Source File: ToastAction.java    From AndroidProject with Apache License 2.0 4 votes vote down vote up
default void toast(Object object) {
    ToastUtils.show(object);
}
 
Example 12
Source File: ToastActivity.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
public void show1(View v) {
    for (int i = 0; i < 3; i++) {
        ToastUtils.show("我是第" + (i + 1) + "个吐司");
    }
}
 
Example 13
Source File: ToastActivity.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
public void show3(View v) {
    ToastUtils.initStyle(new ToastWhiteStyle(getApplication()));
    ToastUtils.show("动态切换白色吐司样式成功");
}
 
Example 14
Source File: ToastActivity.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
public void show4(View v) {
    ToastUtils.initStyle(new ToastBlackStyle(getApplication()));
    ToastUtils.show("动态切换黑色吐司样式成功");
}
 
Example 15
Source File: ToastActivity.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
public void show5(View v) {
    ToastUtils.initStyle(new ToastQQStyle(getApplication()));
    ToastUtils.show("QQ那种还不简单,分分钟的事");
}
 
Example 16
Source File: ToastActivity.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
public void show6(View v) {
    ToastUtils.initStyle(new ToastAliPayStyle(getApplication()));
    ToastUtils.show("支付宝那种还不简单,分分钟的事");
}
 
Example 17
Source File: ToastActivity.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
public void show7(View v) {
    // ToastUtils.setView(View.inflate(getApplication(), R.layout.toast_custom_view, null));
    ToastUtils.setView(R.layout.toast_custom_view);
    ToastUtils.setGravity(Gravity.CENTER, 0, 0);
    ToastUtils.show("我是自定义Toast");
}
 
Example 18
Source File: BaseActivity.java    From EasyHttp with Apache License 2.0 4 votes vote down vote up
@Override
public void onSucceed(Object result) {
    if (result instanceof HttpData) {
        ToastUtils.show(((HttpData) result).getMessage());
    }
}