未登录可先进入首页浏览、触发敏感功能再登录
This commit is contained in:
@@ -13,6 +13,9 @@ import android.widget.Toast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import cn.shangyu.gdxzExpert.activity.LoginNewActivity;
|
||||
import cn.shangyu.gdxzExpert.application.BaseApplication;
|
||||
/**
|
||||
*
|
||||
@@ -173,7 +176,28 @@ public class UIUtils {
|
||||
*/
|
||||
public static boolean isLogined() {
|
||||
// TODO Auto-generated method stub
|
||||
return SharePrefUtil.getBoolean(getContext(), Constant.IS_LOGIN, false);
|
||||
boolean isLogin = SharePrefUtil.getBoolean(getContext(), Constant.IS_LOGIN, false);
|
||||
String uuid = SharePrefUtil.getString(getContext(), Constant.uuid, "");
|
||||
return isLogin && !StringUtil.isEmpty(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否已登录,未登录则拉起登录页
|
||||
*
|
||||
* @param context 上下文
|
||||
* @return true 已登录;false 未登录(已跳转登录页)
|
||||
*/
|
||||
public static boolean checkLoginAndJump(Context context) {
|
||||
if (isLogined()) {
|
||||
return true;
|
||||
}
|
||||
Context targetContext = context != null ? context : getContext();
|
||||
Intent intent = new Intent(targetContext, LoginNewActivity.class);
|
||||
if (!(targetContext instanceof Activity)) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
targetContext.startActivity(intent);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isBackground() {
|
||||
|
||||
Reference in New Issue
Block a user