Java Code Examples for com.pedaily.yc.ycdialoglib.toast.ToastUtils#showRoundRectToast()

The following examples show how to use com.pedaily.yc.ycdialoglib.toast.ToastUtils#showRoundRectToast() . 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: MainActivity.java    From YCAudioPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * 是当某个按键被按下是触发。所以也有人在点击返回键的时候去执行该方法来做判断
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    LogUtils.e("触摸监听", "onKeyDown");
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (mPlayFragment != null && isPlayFragmentShow) {
            hidePlayingFragment();
        }else {
            //双击返回桌面
            if ((System.currentTimeMillis() - time > 1000)) {
                ToastUtils.showRoundRectToast("再按一次返回桌面");
                time = System.currentTimeMillis();
            } else {
                moveTaskToBack(true);
            }
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
Example 2
Source File: MainActivity.java    From YCDialog with Apache License 2.0 6 votes vote down vote up
/**
 * 处理弹出显示内容、点击事件等逻辑
 * @param contentView           view
 */
private void handleLogic(View contentView){
    View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(popWindow!=null){
                popWindow.dismiss();
            }
            String showContent = "";
            switch (v.getId()){
                case R.id.menu1:
                    showContent = "点击 Item菜单1";
                    break;
                case R.id.menu2:
                    showContent = "点击 Item菜单2";
                    break;
                default:
                    break;
            }
            ToastUtils.showRoundRectToast(showContent);
        }
    };
    contentView.findViewById(R.id.menu1).setOnClickListener(listener);
    contentView.findViewById(R.id.menu2).setOnClickListener(listener);
}
 
Example 3
Source File: MusicInfoActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        finish();
        return true;
    } else if (item.getItemId() == R.id.action_save) {
        ToastUtils.showRoundRectToast("保存信息功能");
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 4
Source File: WebViewActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
    super.onReceivedError(view, request, error);
    LogUtils.e("WebViewActivity-----onReceivedError-------" + error.toString());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        LogUtils.e("服务器异常" + error.getDescription().toString());
    }
    ToastUtils.showRoundRectToast("服务器异常6.0之后");
    //当加载错误时,就让它加载本地错误网页文件
    //mWebView.loadUrl("file:///android_asset/errorpage/error.html");

    showErrorPage();//显示错误页面
}
 
Example 5
Source File: WebViewActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
    super.onReceivedError(view, errorCode, description, failingUrl);
    LogUtils.e("WebViewActivity-----onReceivedError-------" + failingUrl);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        LogUtils.e("服务器异常" + "----");
    }
    ToastUtils.showRoundRectToast("服务器异常6.0之前");
    //当加载错误时,就让它加载本地错误网页文件
    //mWebView.loadUrl("file:///android_asset/errorpage/error.html");

    showErrorPage();//显示错误页面
}
 
Example 6
Source File: AbsDownloadOnlineMusic.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
protected void download() {
    final String artist = mOnlineMusic.getArtist_name();
    final String title = mOnlineMusic.getTitle();

    // 下载歌词
    String lrcFileName = FileMusicUtils.getLrcFileName(artist, title);
    File lrcFile = new File(FileMusicUtils.getLrcDir() + lrcFileName);
    if (!TextUtils.isEmpty(mOnlineMusic.getLrclink()) && !lrcFile.exists()) {
        downloadLrc(mOnlineMusic.getLrclink(), FileMusicUtils.getLrcDir(), lrcFileName);
    }else {
        ToastUtils.showToast("无法下载歌词");
    }

    // 下载封面
    String albumFileName = FileMusicUtils.getAlbumFileName(artist, title);
    final File albumFile = new File(FileMusicUtils.getAlbumDir(), albumFileName);
    String picUrl = mOnlineMusic.getPic_big();
    if (TextUtils.isEmpty(picUrl)) {
        picUrl = mOnlineMusic.getPic_small();
    }
    if (!albumFile.exists() && !TextUtils.isEmpty(picUrl)) {
        downloadFile(picUrl, FileMusicUtils.getAlbumDir(), albumFileName);
    }else {
        ToastUtils.showRoundRectToast("无法下载封面");
    }

    // 获取歌曲下载链接
    getMusicDownloadInfo(mOnlineMusic.getSong_id(),artist,title,albumFile);
}
 
Example 7
Source File: TestActivity.java    From YCDialog with Apache License 2.0 5 votes vote down vote up
private void showToast() {
    ToastUtils.showRoundRectToast("潇湘剑雨-杨充");
    try {
        Thread.sleep(10000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

}
 
Example 8
Source File: LocalVideoFragment.java    From YCAudioPlayer with Apache License 2.0 4 votes vote down vote up
private void initVideoPlayer(VideoBean videoBean) {
    String path = videoBean.getPath();
    String title = videoBean.getTitle();
    if(path==null ||path.length()==0){
        ToastUtils.showRoundRectToast("视频地址不能为空");
        return;
    }
    //设置播放类型
    videoPlayer.setPlayerType(VideoPlayer.TYPE_IJK);
    //是否从上一次的位置继续播放
    videoPlayer.continueFromLastPosition(true);
    //设置播放速度
    videoPlayer.setSpeed(1.0f);
    //网络视频地址
    videoPlayer.setUp(path, null);
    //设置视频地址和请求头部
    //创建视频控制器
    VideoPlayerController controller = new VideoPlayerController(activity);
    //设置标题
    controller.setTitle(title);
    //隐藏top
    controller.setTopVisibility(false);
    //设置loading类型【共两种】
    controller.setLoadingType(1);
    //设置背景
    controller.imageView().setBackgroundResource(R.color.blackText);
    //设置10秒不操作隐藏top和bottom
    controller.setHideTime(10000);
    //播放完成监听
    controller.setOnCompletedListener(new OnCompletedListener() {
        @Override
        public void onCompleted() {

        }
    });
    controller.setOnVideoBackListener(new OnVideoBackListener() {
        @Override
        public void onBackClick() {

        }
    });
    //设置视频控制器
    videoPlayer.setController(controller);
}