添加点击头像跳转个人中心
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.utils.LaunchUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -57,6 +58,13 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
ARouter.getInstance().build( "/push/ui/message" ).navigation( getContext() );
|
||||
} );
|
||||
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
|
||||
mUserHeadImg.setOnClickListener(view ->{
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "打开个人中心Exception");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class LaunchUtils {
|
||||
|
||||
/**
|
||||
* 通过包名启动app
|
||||
*
|
||||
* @param context
|
||||
* @param pkg 包名
|
||||
*/
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception {
|
||||
Intent intent = getLaunchIntentForPackage( context, pkg );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage( Context context, String pkg ) {
|
||||
return context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user