|
@@ -10,6 +10,7 @@ import android.os.Build;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
import android.provider.Settings;
|
|
import android.provider.Settings;
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
|
|
+import android.view.View;
|
|
|
import android.view.WindowManager;
|
|
import android.view.WindowManager;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -17,6 +18,7 @@ import com.kfzs.duanduan.ActMain;
|
|
|
import com.kfzs.duanduan.ActPicturesEnlarge;
|
|
import com.kfzs.duanduan.ActPicturesEnlarge;
|
|
|
import com.kfzs.duanduan.bean.KFIntentKeys;
|
|
import com.kfzs.duanduan.bean.KFIntentKeys;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.Agreement;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.CreditCard;
|
|
import com.sheep.gamegroup.model.entity.CreditCard;
|
|
|
import com.sheep.gamegroup.model.entity.DialogEntity;
|
|
import com.sheep.gamegroup.model.entity.DialogEntity;
|
|
@@ -24,7 +26,6 @@ import com.sheep.gamegroup.model.entity.NewbieTask;
|
|
|
import com.sheep.gamegroup.model.entity.NewbieTaskRecord;
|
|
import com.sheep.gamegroup.model.entity.NewbieTaskRecord;
|
|
|
import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
|
|
import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
|
|
|
import com.sheep.gamegroup.model.entity.TaskEty;
|
|
import com.sheep.gamegroup.model.entity.TaskEty;
|
|
|
-import com.sheep.gamegroup.model.entity.TaskReleaseEty;
|
|
|
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
import com.sheep.gamegroup.model.entity.WebviewEntity;
|
|
import com.sheep.gamegroup.model.entity.WebviewEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
@@ -67,6 +68,9 @@ import com.sheep.gamegroup.view.activity.WebviewAct;
|
|
|
import com.sheep.gamegroup.view.activity.WithdrawalAct;
|
|
import com.sheep.gamegroup.view.activity.WithdrawalAct;
|
|
|
import com.sheep.gamegroup.view.activity.WithdrawalListAct;
|
|
import com.sheep.gamegroup.view.activity.WithdrawalListAct;
|
|
|
import com.sheep.gamegroup.view.activity.WithdrawalResultAct;
|
|
import com.sheep.gamegroup.view.activity.WithdrawalResultAct;
|
|
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogAgreement;
|
|
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogNewbieTask1;
|
|
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogNewbieTaskRegistSuccess;
|
|
|
import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
@@ -78,6 +82,9 @@ import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
|
|
|
|
|
import org.xutils.ex.DbException;
|
|
import org.xutils.ex.DbException;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
|
import rx.functions.Action1;
|
|
import rx.functions.Action1;
|
|
|
import rx.schedulers.Schedulers;
|
|
import rx.schedulers.Schedulers;
|
|
@@ -803,4 +810,116 @@ public class Jump2View {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取协议列表,如果没有协议,则直接通过,否则显示协议对话框
|
|
|
|
|
+ * @param activity
|
|
|
|
|
+ * @param action1
|
|
|
|
|
+ */
|
|
|
|
|
+ public void tryShowAgreement(final Activity activity, final Action1<String> action1) {
|
|
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getAgreement()
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(activity) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
|
|
|
|
|
+ List<Agreement> agreementList = baseMessage.getDatas(Agreement.class);
|
|
|
|
|
+ if(agreementList.isEmpty()){
|
|
|
|
|
+ if(action1 != null)
|
|
|
|
|
+ action1.call(null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ DialogAgreement.showDialog(activity, agreementList, action1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
|
|
+ if(action1 != null){
|
|
|
|
|
+ action1.call(TextUtils.isEmpty(baseMessage.getMsg()) ? "服务器错误,请稍候再试" : baseMessage.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 先尝试显示用户协议与劳务协议等协议对话框,再尝试显示新手任务对话框,如果协议没有通过,直接退出,无论原因
|
|
|
|
|
+ * @param activity
|
|
|
|
|
+ * @param userEntity
|
|
|
|
|
+ * @param newbie_task
|
|
|
|
|
+ */
|
|
|
|
|
+ public void tryShowAgreementOrNewbieTask(final Activity activity, final UserEntity userEntity, final View newbie_task) {
|
|
|
|
|
+ tryShowAgreement(activity, new Action1<String>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void call(String msg) {
|
|
|
|
|
+ if(msg == null) {
|
|
|
|
|
+ tryShowNewbieTask(activity, userEntity, newbie_task);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ G.showToast(msg);
|
|
|
|
|
+ SheepApp.getInstance().quit();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void tryShowNewbieTask(final Activity activity, final UserEntity userEntity, final View newbie_task) {
|
|
|
|
|
+ if (userEntity.getIs_new() == 2) {//1新用户 2老用户
|
|
|
|
|
+ newbie_task.setVisibility(View.GONE);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ NewbieTaskRecord newbie_task_record = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ newbie_task_record = MyDbManager.getInstance().dbFindNewbieTaskRecord(userEntity.getInvitation_code());
|
|
|
|
|
+ } catch (DbException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (newbie_task_record == null) {
|
|
|
|
|
+ newbie_task_record = new NewbieTaskRecord();
|
|
|
|
|
+ newbie_task_record.setUser_id(userEntity.getInvitation_code());
|
|
|
|
|
+ MyDbManager.getInstance().saveOrUpdate(newbie_task_record);
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean dontShowNewbieTaskDialog = newbie_task_record.isDontShowNewbieTaskDialog();//默认可以显示对话框
|
|
|
|
|
+ if (
|
|
|
|
|
+// !BuildConfig.DEBUG &&
|
|
|
|
|
+ dontShowNewbieTaskDialog) {
|
|
|
|
|
+ newbie_task.setVisibility(View.VISIBLE);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ final NewbieTaskRecord finalNewbie_task_record = newbie_task_record;
|
|
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getNewbieTask()
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(activity) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ newbie_task.setVisibility(View.VISIBLE);
|
|
|
|
|
+ List<NewbieTask> newbieTaskList = baseMessage.getDatas(NewbieTask.class);
|
|
|
|
|
+ if (newbieTaskList != null && !newbieTaskList.isEmpty() && newbieTaskList.size() > 1 && !newbieTaskList.get(1).getFinished()) {//了解小绵羊任务未完成时
|
|
|
|
|
+ DialogNewbieTaskRegistSuccess.showDialog(activity, finalNewbie_task_record, newbieTaskList.get(0));
|
|
|
|
|
+ } else if (newbieTaskList != null && !newbieTaskList.isEmpty()) {
|
|
|
|
|
+ finalNewbie_task_record.setDontShowNewbieTaskDialog(true);
|
|
|
|
|
+ MyDbManager.getInstance().saveOrUpdate(finalNewbie_task_record);//设置为不再显示新手对话框
|
|
|
|
|
+ List<NewbieTask> taskList = new ArrayList<>();
|
|
|
|
|
+ NewbieTask task = null;
|
|
|
|
|
+ for (NewbieTask newbieTask : newbieTaskList) {
|
|
|
|
|
+ if (newbieTask.getFinished()) {//已经完成
|
|
|
|
|
+ task = newbieTask;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ taskList.add(newbieTask);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ DialogNewbieTask1.showDialog(activity, taskList, task);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (BuildConfig.DEBUG)
|
|
|
|
|
+ G.showToast("测试:服务器数据错误,新手任务数据为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ newbie_task.setVisibility(View.GONE);
|
|
|
|
|
+ System.out.println("baseMessage onError " + JSON.toJSONString(baseMessage));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|