当前位置: 首页>>代码示例>>Java>>正文


Java ToastUtils.showShort方法代码示例

本文整理汇总了Java中com.blankj.utilcode.util.ToastUtils.showShort方法的典型用法代码示例。如果您正苦于以下问题:Java ToastUtils.showShort方法的具体用法?Java ToastUtils.showShort怎么用?Java ToastUtils.showShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.blankj.utilcode.util.ToastUtils的用法示例。


在下文中一共展示了ToastUtils.showShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onWidgetClick

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void onWidgetClick(View view) {
    switch (view.getId()) {
        case R.id.btn_clean_internal_cache:
            ToastUtils.showShort("cleanInternalCache" + CleanUtils.cleanInternalCache());
            break;
        case R.id.btn_clean_internal_files:
            ToastUtils.showShort("cleanInternalFiles" + CleanUtils.cleanInternalFiles());
            break;
        case R.id.btn_clean_internal_databases:
            ToastUtils.showShort("cleanInternalDbs" + CleanUtils.cleanInternalDbs());
            break;
        case R.id.btn_clean_internal_sp:
            ToastUtils.showShort("cleanInternalSP" + CleanUtils.cleanInternalSP());
            break;
        case R.id.btn_clean_external_cache:
            ToastUtils.showShort("cleanExternalCache" + CleanUtils.cleanExternalCache());
            break;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:CleanActivity.java

示例2: popBackStackFinish

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
/**
 * fragment回退栈管理(返回时优先处理回退栈推出)
 */
public void popBackStackFinish() {
    //设置返回键监听,返回标识是否中断其他操作
    if (onBackListener()) {
        return;
    }
    //按2次才能退出的相关代码
    if (exitToast != null && System.currentTimeMillis() - exitMillis > 2000) {
        ToastUtils.showShort(exitToast);
        exitMillis = System.currentTimeMillis();
        return;
    }
    //当回退栈中有数据时,进行fragment的回退
    if (mFragmentManager.getBackStackEntryCount() > 0) {
        mFragmentManager.popBackStack();
        return;
    }
    //否则直接finish
    finish();
}
 
开发者ID:JJS-CN,项目名称:JBase,代码行数:23,代码来源:BaseActivity.java

示例3: lazyLoad

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
/**
 * 懒加载
 */
protected void lazyLoad() {
    if (!NetworkUtils.isConnected()) {
        ToastUtils.showShort(R.string.no_internet);
        return;
    }

    if (!isPrepared || isLoadData) {
        return;
    }

    if (Key.getSetting().PREF_PRELOAD || !(getActivity() instanceof MainActivity)) {
        isLoadData = true;
        initData();
        return;
    }

    if (!isVisible) {
        return;
    }

    isLoadData = true;
    initData();

}
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:28,代码来源:BaseFragment.java

示例4: toCamera

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void toCamera(Activity activity) {
    try {
        setFile(activity);
        createImageFile();
        Uri imageUri;
        if (Build.VERSION.SDK_INT >= 24) {
            imageUri = FileProvider.getUriForFile(activity, mView.getActivity().getPackageName()+".provider", mImageFile);
        } else {
            imageUri = Uri.fromFile(mImageFile);
        }

        Intent getImageByCamera = new Intent("android.media.action.IMAGE_CAPTURE");
        getImageByCamera.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
        activity.startActivityForResult(getImageByCamera, REQUEST_CODE_TO_CAMERA);
    } catch (Exception e) {
        ToastUtils.showShort("打开相机失败");
    }
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:20,代码来源:EditNotePresenter.java

示例5: getData

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
    public void getData() {
        if (type == Key.GENE) {
            new TopicActivityPresenter<>(this, TopicGene.class);
        } else if (type == Key.QA) {
            //TODO
            ToastUtils.showShort(R.string.not_support);
            finish();
            return;
//            new TopicActivityPresenter<>(this, TopicQA.class);
        } else {
            new TopicActivityPresenter<>(this, Topic.class);
        }
        presenter.start();
        fab.setVisibility(UserState.isLogin() ? View.VISIBLE : View.INVISIBLE);
    }
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:17,代码来源:TopicActivity.java

示例6: setContentView

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void setContentView() {
    url = getIntent().getStringExtra("url");
    if (url == null) {
        ToastUtils.showShort(R.string.error);
        finish();
        return;
    }
    if (!url.startsWith("http")) {
        url = "https://ww4.sinaimg.cn/large/" + url;
    }
    setContentView(R.layout.activity_image_view);
    context = this;
}
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:15,代码来源:ImageViewActivity.java

示例7: submitFeedback

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
private void submitFeedback(){
    if(TextUtils.isEmpty(mEtContent.getText())){
        ToastUtils.showShort("请至少填写反馈内容");
    }else {
        sendFeedback();
    }
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:8,代码来源:FeedbackActivity.java

示例8: accept

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void accept(UserInfo userInfo) throws Exception {
    if (!userInfo.getNotice()) {
        ToastUtils.showShort(R.string.new_reply);
    }
    View notice_badge = navigationView.getMenu().findItem(R.id.nav_notice).getActionView();
    notice_badge.setVisibility(!userInfo.getNotice() ? View.VISIBLE : View.INVISIBLE);

    if (UserState.isLogin()) {
        return;
    }
    if (userInfo.getUsername() != null) {
        UserState.setLogin(true);
        UserState.setUserInfo(userInfo);
        Glide.with(context).load(userInfo.getAvatar()).into(nav_avatar);
        nav_username.setText(userInfo.getUsername());
        if (!userInfo.getSign()) {
            ApiManager.getDefault().Signin();
        }
    } else {
        nav_username.setText(R.string.not_log_in);
    }
    Menu menu = navigationView.getMenu();
    menu.setGroupVisible(R.id.user_root, UserState.isLogin());
    menu.findItem(R.id.nav_login).setVisible(!UserState.isLogin());
    menu.findItem(R.id.nav_logout).setVisible(UserState.isLogin());
    fab.setVisibility(UserState.isLogin() ? View.VISIBLE : View.INVISIBLE);
}
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:29,代码来源:MainActivity.java

示例9: onPreferenceClick

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
    public boolean onPreferenceClick(Preference preference) {
        String key = preference.getKey();
        if (key.equals(Key.getSetting().KEY_PREF_TABS)) {
            ToastUtils.showShort(R.string.not_support);
        } else if (key.equals(Key.getSetting().KEY_PREF_ABOUT)) {
            ActivityUtils.startActivity(IntentUtils.getAppDetailsSettingsIntent(getActivity().getPackageName()));
        }
//        TabsPreference.newInstance().show(getFragmentManager(),"edit tabs");
        return false;
    }
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:12,代码来源:SettingFragment.java

示例10: camera

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
/**
 * 拍照
 */
private void camera() {
    LogUtils.e(SDCardUtils.getSDCardPaths().get(0));

    File file = new File(mFilepath, System.currentTimeMillis() + ".jpg");
    LogUtils.e(file.getPath());
    if (!file.getParentFile().exists()) {
        file.getParentFile().mkdirs();
    }
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    //Android7.0以上URI
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        //通过FileProvider创建一个content类型的Uri
        mProviderUri = FileProvider.getUriForFile(this, "com.sdwfqin.sample.fileprovider", file);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mProviderUri);
        //添加这一句表示对目标应用临时授权该Uri所代表的文件
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    } else {
        mUri = Uri.fromFile(file);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mUri);
    }
    try {
        startActivityForResult(intent, RESULT_CODE_1);
    } catch (ActivityNotFoundException anf) {
        ToastUtils.showShort("摄像头未准备好!");
    }
}
 
开发者ID:sdwfqin,项目名称:AndroidSamples,代码行数:30,代码来源:PictureActivity.java

示例11: onWidgetClick

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void onWidgetClick(View view) {
    switch (view.getId()) {
        case R.id.btn_install_app:
            if (AppUtils.isInstallApp(Config.TEST_PKG)) {
                ToastUtils.showShort(R.string.app_install_tips);
            } else {
                AppUtils.installApp(Config.TEST_APK_PATH, "com.blankj.androidutilcode.provider");
            }
            break;
        case R.id.btn_install_app_silent:
            new Thread(new Runnable() {
                @Override
                public void run() {
                    if (AppUtils.isInstallApp(Config.TEST_PKG)) {
                        ToastUtils.showShort(R.string.app_install_tips);
                    } else {
                        if (AppUtils.installAppSilent(Config.TEST_APK_PATH)) {
                            ToastUtils.showShort(R.string.install_successfully);
                        } else {
                            ToastUtils.showShort(R.string.install_unsuccessfully);
                        }
                    }
                }
            }).start();
            break;
        case R.id.btn_uninstall_app:
            if (AppUtils.isInstallApp(Config.TEST_PKG)) {
                AppUtils.uninstallApp(Config.TEST_PKG);
            } else {
                ToastUtils.showShort(R.string.app_uninstall_tips);
            }
            break;
        case R.id.btn_uninstall_app_silent:
            if (AppUtils.isInstallApp(Config.TEST_PKG)) {
                if (AppUtils.uninstallAppSilent(Config.TEST_PKG, false)) {
                    ToastUtils.showShort(R.string.uninstall_successfully);
                } else {
                    ToastUtils.showShort(R.string.uninstall_unsuccessfully);
                }
            } else {
                ToastUtils.showShort(R.string.app_uninstall_tips);
            }
            break;
        case R.id.btn_launch_app:
            AppUtils.launchApp(this.getPackageName());
            break;
        case R.id.btn_exit_app:
            AppUtils.exitApp();
            break;
        case R.id.btn_get_app_details_settings:
            AppUtils.getAppDetailsSettings();
            break;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:56,代码来源:AppActivity.java

示例12: copyBlog

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void copyBlog() {
    String uri=mView.getActivity().getResources().getString(R.string.csdn);
    ClipboardUtils.copyText(uri);
    ToastUtils.showShort("已复制");
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:7,代码来源:DeveloperPresenter.java

示例13: initView

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void initView(Bundle savedInstanceState, View view) {
    ClickableSpan clickableSpan = new ClickableSpan() {
        @Override
        public void onClick(View widget) {
            ToastUtils.showShort("事件触发了");
        }

        @Override
        public void updateDrawState(TextPaint ds) {
            ds.setColor(Color.BLUE);
            ds.setUnderlineText(false);
        }
    };

    TextView tvAboutSpannable = (TextView) findViewById(R.id.tv_about_spannable);
    // 响应点击事件的话必须设置以下属性
    tvAboutSpannable.setMovementMethod(LinkMovementMethod.getInstance());
    tvAboutSpannable.setText(new SpannableStringUtils.Builder()
            .appendLine("测试SpannableStringUtils").setBackgroundColor(Color.LTGRAY).setBold().setForegroundColor(Color.YELLOW).setAlign(Layout.Alignment.ALIGN_CENTER)
            .append("测试")
            .append("前景色").setForegroundColor(Color.GREEN)
            .appendLine("背景色").setBackgroundColor(Color.LTGRAY)
            .appendLine("测试首行缩进").setLeadingMargin(30, 50)
            .appendLine("测试引用").setQuoteColor(Color.BLUE, 10, 10)
            .appendLine("测试列表项").setBullet(Color.GREEN, 30, 10)
            .appendLine("测试32dp字体").setFontSize(36, true)
            .append("测试")
            .appendLine("2倍字体").setFontProportion(2)
            .append("测试")
            .appendLine("横向2倍字体").setFontXProportion(2)
            .append("测试")
            .append("删除线").setStrikethrough()
            .appendLine("下划线").setUnderline()
            .append("测试")
            .append("上标").setSuperscript()
            .appendLine("下标").setSubscript()
            .append("测试")
            .append("粗体").setBold()
            .append("斜体").setItalic()
            .appendLine("粗斜体").setBoldItalic()
            .appendLine("monospace font").setFontFamily("monospace")
            .appendLine("测试自定义字体").setTypeface(Typeface.createFromAsset(getAssets(), "fonts/dnmbhs.ttf"))
            .appendLine("测试相反对齐").setAlign(Layout.Alignment.ALIGN_OPPOSITE)
            .appendLine("测试居中对齐").setAlign(Layout.Alignment.ALIGN_CENTER)
            .appendLine("测试正常对齐").setAlign(Layout.Alignment.ALIGN_NORMAL)
            .append("测试小图对齐").setBackgroundColor(Color.LTGRAY)
            .append("").setResourceId(R.drawable.shape_spannable_block_low, SpannableStringUtils.ALIGN_TOP)
            .append("").setResourceId(R.drawable.shape_spannable_block_low, SpannableStringUtils.ALIGN_CENTER)
            .append("").setResourceId(R.drawable.shape_spannable_block_low, SpannableStringUtils.ALIGN_BASELINE)
            .append("").setResourceId(R.drawable.shape_spannable_block_low, SpannableStringUtils.ALIGN_BOTTOM)
            .appendLine("end").setBackgroundColor(Color.LTGRAY)
            .append("测试顶部对齐").setBackgroundColor(Color.GREEN)
            .append("image").setResourceId(R.drawable.shape_spannable_block_high, SpannableStringUtils.ALIGN_TOP)
            .appendLine("end").setBackgroundColor(Color.GREEN)
            .append("居中对齐").setBackgroundColor(Color.LTGRAY)
            .append("").setResourceId(R.drawable.shape_spannable_block_high, SpannableStringUtils.ALIGN_CENTER)
            .appendLine("end").setBackgroundColor(Color.LTGRAY)
            .append("Baseline对齐").setBackgroundColor(Color.GREEN)
            .append("").setResourceId(R.drawable.shape_spannable_block_high, SpannableStringUtils.ALIGN_BASELINE)
            .appendLine("end").setBackgroundColor(Color.GREEN)
            .append("底部对齐").setBackgroundColor(Color.LTGRAY)
            .append("").setResourceId(R.drawable.shape_spannable_block_high, SpannableStringUtils.ALIGN_BOTTOM)
            .appendLine("end").setBackgroundColor(Color.LTGRAY)
            .append("测试")
            .appendLine("点击事件").setClickSpan(clickableSpan)
            .append("测试")
            .appendLine("Url").setUrl("https://github.com/Blankj/AndroidUtilCode")
            .append("测试")
            .append("模糊").setBlur(3, BlurMaskFilter.Blur.NORMAL)
            .create()
    );
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:74,代码来源:SpannableActivity.java

示例14: onWidgetClick

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
@Override
public void onWidgetClick(View view) {
    switch (view.getId()) {
        case R.id.btn_toggle_location:
            if (isDefaultLocation) {
                ToastUtils.setGravity(Gravity.CENTER, 0, 0);
            } else {
                ToastUtils.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, getResources().getDimensionPixelSize(R.dimen.offset_64));
            }
            isDefaultLocation = !isDefaultLocation;
            break;
        case R.id.btn_toggle_view:
            if (isDefaultView) {
                ToastUtils.setView(R.layout.toast_custom);
            } else {
                ToastUtils.setView(null);
            }
            isDefaultView = !isDefaultView;
            break;
        case R.id.btn_show_short_toast_safe:
            new Thread(new Runnable() {
                @Override
                public void run() {
                    ToastUtils.showShortSafe(R.string.toast_short_safe);
                }
            }).start();
            break;
        case R.id.btn_show_long_toast_safe:
            new Thread(new Runnable() {
                @Override
                public void run() {
                    ToastUtils.showLongSafe(R.string.toast_long_safe);
                }
            }).start();
            break;
        case R.id.btn_show_short_toast:
            ToastUtils.showShort(R.string.toast_short);
            break;
        case R.id.btn_show_long_toast:
            ToastUtils.showShort(R.string.toast_long);
            break;
        case R.id.btn_cancel_toast:
            ToastUtils.cancel();
            break;
    }
    tvAboutToast.setText("is default location: " + isDefaultLocation
            + "\nis default view: " + isDefaultView
    );
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:50,代码来源:ToastActivity.java

示例15: showToast

import com.blankj.utilcode.util.ToastUtils; //导入方法依赖的package包/类
protected void showToast(String msg) {
    ToastUtils.showShort(msg);
}
 
开发者ID:wang2016215,项目名称:Bing,代码行数:4,代码来源:BingBaseAcitivity.java


注:本文中的com.blankj.utilcode.util.ToastUtils.showShort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。