Java Code Examples for com.blankj.utilcode.util.ActivityUtils#startActivity()

The following examples show how to use com.blankj.utilcode.util.ActivityUtils#startActivity() . 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: SplashPagerActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void initView() {
    if(SPUtils.getInstance(Constant.SP_NAME).getBoolean(Constant.KEY_FIRST_SPLASH,true)){
        initGetImage();
        initBanner();
    } else {
        ActivityUtils.startActivity(GuideActivity.class);
        finish();
    }
}
 
Example 2
Source File: MainActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.fl_search:
            ActivityUtils.startActivity(SearchMusicActivity.class);
            break;
        case R.id.fl_play_bar:
            showPlayingFragment();
            break;
        case R.id.iv_play_bar_list:
            showListDialog();
            break;
        case R.id.iv_play_bar_play:
            if(getPlayService().isDefault()){
                if(BaseAppHelper.get().getMusicList().size()>0){
                    int mPlayPosition;
                    if (getPlayService().getPlayingMusic() != null &&
                            getPlayService().getPlayingMusic().getType() == AudioBean.Type.LOCAL) {
                        mPlayPosition = getPlayService().getPlayingPosition();
                    } else {
                        mPlayPosition = 0;
                    }
                    getPlayService().play(BaseAppHelper.get().getMusicList().get(mPlayPosition));
                }else {
                    ToastUtils.showToast("请检查是否有音乐");
                }
            }else {
                getPlayService().playPause();
            }
            break;
        case R.id.iv_play_bar_next:
            getPlayService().next();
            break;
        default:
            break;
    }
}
 
Example 3
Source File: MeFragment.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.rl_me_collect:
            ShareDetailBean shareDetailBean = new ShareDetailBean();
            shareDetailBean.setShareType(ShareComment.ShareType.SHARE_GOODS);
            shareDetailBean.setContent("商品详情页分享");
            shareDetailBean.setTitle("分享");
            shareDetailBean.setImage("https://upload-images.jianshu.io/upload_images/4432347-fb25131b5629346a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240");
            ShareDialog shareDialog = new ShareDialog(activity,shareDetailBean);
            shareDialog.show(getChildFragmentManager());
            break;
        case R.id.rl_me_question:

            break;
        case R.id.rl_me_setting:
            ActivityUtils.startActivity(MeSettingActivity.class);
            break;
        case R.id.ll_timer:
            timerDialog(activity);
            break;
        case R.id.rl_me_feed_back:

            break;
        case R.id.rl_me_phone:

            break;
        case R.id.btn_exit:
            exit();
            break;
        default:
            break;
    }
}
 
Example 4
Source File: ButtonViewHolder.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
public void bindData(List<String> mButtonList, Context mContext) {
    if(mButtonList!=null && mButtonList.size()>0){
        tv_home_first.setText(mButtonList.get(0));
        tv_home_second.setText(mButtonList.get(1));
        tv_home_third.setText(mButtonList.get(2));
        tv_home_four.setText(mButtonList.get(3));
        tv_home_five.setText(mButtonList.get(4));


        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.tv_home_first:
                        ActivityUtils.startActivity(AndroidActivity.class);
                        break;
                }
            }
        };

        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
    }
}
 
Example 5
Source File: ActivityActivity.java    From Android-UtilCode with Apache License 2.0 5 votes vote down vote up
@Override
public void onWidgetClick(View view) {
    switch (view.getId()) {
        case R.id.btn_launch_image_activity:
            ActivityUtils.startActivity(Config.PKG, imageActivityClassName);
            break;
        default:
            break;
    }
}
 
Example 6
Source File: SchemeSecondActivity.java    From YCAudioPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * 协议部分,随便设置 yc://app/?page=main
 */

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Uri uri = getIntent().getData();
    if (uri != null) {
        //解析一个url
        // 完整的url信息
        String urlStr = uri.toString();
        Log.e( "UrlUtils","url: " + urlStr);
        // scheme部分
        String scheme = uri.getScheme();
        Log.e( "UrlUtils","scheme: " + scheme);
        // host部分
        String host = uri.getHost();
        Log.e( "UrlUtils","host: " + host);
        //port部分
        int port = uri.getPort();
        Log.e( "UrlUtils","port: " + port);
        // 访问路劲
        String path = uri.getPath();
        Log.e( "UrlUtils","path: " + path);
        List<String> pathSegments = uri.getPathSegments();
        Log.e( "UrlUtils","pathSegments: " + pathSegments.toString());
        // Query部分
        String query = uri.getQuery();
        Log.e( "UrlUtils","query: " + query);
        //获取此URI的解码权限部分。对于服务器地址,权限的结构如下:Examples: "google.com", "[email protected]:80"
        String authority = uri.getAuthority();
        Log.e( "UrlUtils","authority: " + authority);
        //从权限获取已解码的用户信息。例如,如果权限为“任何人@google.com”,此方法将返回“任何人”。
        String userInfo = uri.getUserInfo();
        Log.e( "UrlUtils","userInfo: " + userInfo);
        //获取指定参数值
        String page = uri.getQueryParameter("page");
        Log.e( "UrlUtils","main: " + page);
        //UrlUtils: url: https://m.dev.haowumc.com/app/financialManagement
        //UrlUtils: scheme: https
        //UrlUtils: host: m.dev.haowumc.com
        //UrlUtils: port: -1
        //UrlUtils: path: /app/financialManagement
        //UrlUtils: pathSegments: [app, financialManagement]
        //UrlUtils: query: null
        //UrlUtils: authority: m.dev.haowumc.com
        //UrlUtils: userInfo: null

        switch (page){
            //yc://app/?page=yangchong
            case "yangchong":
                ActivityUtils.startActivity(GuideActivity.class);
                break;
            //yc://app/?page=main
            case "main":
                readGoActivity(new Intent(this,MainActivity.class),this);
                break;
            //yc://app/?page=setting
            case "setting":
                readGoActivity(new Intent(this, MeSettingActivity.class),this);
                break;
        }
    }
    finish();
}
 
Example 7
Source File: SchemeFirstActivity.java    From YCAudioPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * 协议部分,随便设置 yc://ycbjie.cn:8888/from?type=yangchong
 * 如果携带参数,则:yc://ycbjie.cn:8888/from?type=yangchong&level=20
 */

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Uri uri = getIntent().getData();
    if (uri != null) {
        //解析一个url
        // 完整的url信息
        String urlStr = uri.toString();
        Log.e( "UrlUtils","url: " + urlStr);
        // scheme部分
        String scheme = uri.getScheme();
        Log.e( "UrlUtils","scheme: " + scheme);
        // host部分
        String host = uri.getHost();
        Log.e( "UrlUtils","host: " + host);
        //port部分
        int port = uri.getPort();
        Log.e( "UrlUtils","port: " + port);
        // 访问路劲
        String path = uri.getPath();
        Log.e( "UrlUtils","path: " + path);
        List<String> pathSegments = uri.getPathSegments();
        Log.e( "UrlUtils","pathSegments: " + pathSegments.toString());
        // Query部分
        String query = uri.getQuery();
        Log.e( "UrlUtils","query: " + query);
        //获取此URI的解码权限部分。对于服务器地址,权限的结构如下:Examples: "google.com", "[email protected]:80"
        String authority = uri.getAuthority();
        Log.e( "UrlUtils","authority: " + authority);
        //从权限获取已解码的用户信息。例如,如果权限为“任何人@google.com”,此方法将返回“任何人”。
        String userInfo = uri.getUserInfo();
        Log.e( "UrlUtils","userInfo: " + userInfo);
        //获取指定参数值
        String type = uri.getQueryParameter("type");
        Log.e( "UrlUtils","type: " + type);

        //获取指定参数值,该方法获取值一直是空
        //String level = uri.getQueryParameter("level");
        ///Log.e( "UrlUtils","level: " + level);

        String level = getValueByName(urlStr, "level");
        Log.e( "UrlUtils","level: " + level);


        switch (type){
            //yc://ycbjie.cn:8888/from?type=yangchong
            case "yangchong":
                ActivityUtils.startActivity(GuideActivity.class);
                break;
            //yc://ycbjie.cn:8888/from?type=main
            case "main":
                readGoActivity(new Intent(this,MainActivity.class),this);
                break;
            //yc://ycbjie.cn:8888/from?type=setting
            case "setting":
                readGoActivity(new Intent(this, MeSettingActivity.class),this);
                break;
        }
    }
    finish();
}
 
Example 8
Source File: CommonActivityDrawerView.java    From AndroidUtilCode with Apache License 2.0 4 votes vote down vote up
private boolean goWeb(@StringRes int id) {
    return ActivityUtils.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(StringUtils.getString(id))));
}