涉及到用户操作的加上登录验证, 把评论点赞抽离成工具方法
This commit is contained in:
34
app/src/main/java/com/gh/common/util/CheckLoginUtils.java
Normal file
34
app/src/main/java/com/gh/common/util/CheckLoginUtils.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.gh.gamecenter.LoginActivity;
|
||||
|
||||
/**
|
||||
* Created by khy on 28/06/17.
|
||||
*/
|
||||
|
||||
public class CheckLoginUtils {
|
||||
|
||||
public static void checkLogin(final Context context, OnLoggenInListener listener) {
|
||||
String token = null;
|
||||
if (token == null) {
|
||||
DialogUtils.showWarningDialog(context, "登录提示", "需要登录才能使用该功能喔!", "取消", "快速登录",
|
||||
new DialogUtils.ConfirmListener() {
|
||||
@Override
|
||||
public void onConfirm() {
|
||||
Intent intent = LoginActivity.getIntent(context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}, null);
|
||||
} else {
|
||||
listener.onLoggedIn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface OnLoggenInListener {
|
||||
void onLoggedIn();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user