|
|
@@ -15,6 +15,7 @@ import android.support.v7.app.AlertDialog;
|
|
|
import android.text.Html;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
+import android.util.TypedValue;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewTreeObserver;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -39,6 +40,8 @@ import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
|
import com.sheep.gamegroup.model.entity.FindApp;
|
|
|
import com.sheep.gamegroup.model.entity.GameAccountEntity;
|
|
|
import com.sheep.gamegroup.model.entity.HomeListEntity;
|
|
|
+import com.sheep.gamegroup.model.entity.NewbieTask;
|
|
|
+import com.sheep.gamegroup.model.entity.NewbieTaskRecord;
|
|
|
import com.sheep.gamegroup.model.entity.TaskChild;
|
|
|
import com.sheep.gamegroup.model.entity.TaskDescEntity;
|
|
|
import com.sheep.gamegroup.model.entity.TaskEty;
|
|
|
@@ -50,6 +53,9 @@ import com.sheep.gamegroup.model.util.AutoTaskListUtil;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.usage.AppUsageManager;
|
|
|
import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogNewbieTask1;
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogNewbieTaskRegistSuccess;
|
|
|
import com.sheep.gamegroup.view.dialog.DialogShare;
|
|
|
import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
@@ -68,15 +74,18 @@ import com.zhy.http.okhttp.callback.FileCallBack;
|
|
|
|
|
|
import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
+import org.xutils.ex.DbException;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
import java.security.MessageDigest;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
@@ -87,6 +96,7 @@ import rx.functions.Action1;
|
|
|
import rx.schedulers.Schedulers;
|
|
|
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.LINK_SHARE;
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.NEWBIE_TASK;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.QR_COPY;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.XIAOMI_GAME_RECEIVE;
|
|
|
import static com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST;
|
|
|
@@ -407,6 +417,11 @@ public class CommonUtil {
|
|
|
public void goNative(Context context, HomeListEntity entity, String from) {
|
|
|
|
|
|
switch (Integer.valueOf(entity.getJump())) {
|
|
|
+ case -1://试玩赚钱
|
|
|
+
|
|
|
+ DialogNewbieTaskList.tryShowDialog((Activity) context);
|
|
|
+ NEWBIE_TASK.onEvent();
|
|
|
+ break;
|
|
|
case 1://试玩赚钱
|
|
|
|
|
|
Jump2View.getInstance().goTryplayView(context, null);
|
|
|
@@ -1827,4 +1842,74 @@ public class CommonUtil {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否添加新手任务
|
|
|
+ */
|
|
|
+ public boolean addNewTask(final Activity activity, final UserEntity userEntity) {
|
|
|
+ if (userEntity == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (userEntity.getIs_new() == 2) { //1新用户 2老用户
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ NewbieTaskRecord newbie_task_record = null;
|
|
|
+ try {
|
|
|
+ newbie_task_record = MyDbManager.getInstance().dbFindNewbieTaskRecord(userEntity.getInvitation_code());
|
|
|
+ } catch (DbException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ boolean dontShowNewbieTaskDialog = newbie_task_record == null || newbie_task_record.isDontShowNewbieTaskDialog();//默认可以显示对话框
|
|
|
+ if (!userEntity.isNewRegistUser() || dontShowNewbieTaskDialog) {
|
|
|
+ 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) {
|
|
|
+ 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) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置游戏标识文本,如:现金,福利
|
|
|
+ * @param textView
|
|
|
+ * @param taskReleaseEty
|
|
|
+ */
|
|
|
+ public void setTaskTagText(TextView textView, TaskReleaseEty taskReleaseEty) {
|
|
|
+ textView.setVisibility(View.VISIBLE);
|
|
|
+ ViewUtil.setColorMapText(textView, String.format(Locale.CHINA, "%s", taskReleaseEty.getCashOrWelfare()), taskReleaseEty.getCashOrWelfare(), "#FD2D54");
|
|
|
+ textView.setBackgroundResource(R.drawable.shape_red_stroke_rectangle_no_lb);
|
|
|
+ textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 9);
|
|
|
+ int padding = textView.getContext().getResources().getDimensionPixelSize(R.dimen.content_padding_2);
|
|
|
+ textView.setPadding(4*padding, padding, 4*padding, padding);
|
|
|
+ }
|
|
|
}
|