billyyoyo лет назад: 6
Родитель
Сommit
446ebfefad

+ 1 - 25
app/src/main/java/cn/finalteam/rxgalleryfinal/utils/CameraUtil.java

@@ -122,29 +122,5 @@ public class CameraUtil {
         }
         return true;
     }
-
-    public static boolean hasBackFacingCamera() {
-        final int CAMERA_FACING_BACK = 0;
-        return checkCameraFacing(CAMERA_FACING_BACK);
-    }
-
-    public static boolean hasFrontFacingCamera() {
-        final int CAMERA_FACING_BACK = 1;
-        return checkCameraFacing(CAMERA_FACING_BACK);
-    }
-
-    public static boolean isCameraCanUse() {
-        boolean canUse = true;
-        Camera mCamera = null;
-        try {
-            mCamera = Camera.open();
-        } catch (Exception e) {
-            canUse = false;
-        }
-        if (canUse) {
-            mCamera.release();
-            mCamera = null;
-        }
-        return canUse;
-    }
+    
 }

+ 15 - 5
app/src/main/java/com/sheep/gamegroup/module/guide/NewbieGuideHelper.java

@@ -74,10 +74,13 @@ public class NewbieGuideHelper {
         exitAnimation.setFillAfter(true);
     }
 
+    private String getLabelPrex(int type){
+        return DataUtil.getInstance().getUserId()+ "_page_" + type;
+    }
+
     public void show(int type) {
-        String label = DataUtil.getInstance().getUserId()+ "_page_" + type;
-        if (isShowed(label)) return;
-        showed(label);
+        if (isShowed(getLabelPrex(type))) return;
+        showed(getLabelPrex(type));
         List<GuidePage> pages = null;
         if (type == GUIDE_HOME) {
             pages = Arrays.asList(getPage1(), getPage2(), getPage3(), getPage4());
@@ -91,7 +94,7 @@ public class NewbieGuideHelper {
             return;
         }
         Builder builder = NewbieGuide.with(mActivity)
-                .setLabel(label)//设置引导层标示区分不同引导层,必传!否则报错
+                .setLabel(getLabelPrex(type))//设置引导层标示区分不同引导层,必传!否则报错
                 .setOnGuideChangedListener(new OnGuideChangedListener() {
                     @Override
                     public void onShowed(Controller controller) {
@@ -298,8 +301,15 @@ public class NewbieGuideHelper {
     private void showed(String page) {
         SharedPreferences sp = mActivity.getSharedPreferences("newbie_guide", Context.MODE_PRIVATE);
         SharedPreferences.Editor editor = sp.edit();
-        editor.putBoolean("page", true);
+        editor.putBoolean(page, true);
         editor.commit();
     }
 
+    public void disableAll(){
+        showed(getLabelPrex(0));
+        showed(getLabelPrex(1));
+        showed(getLabelPrex(2));
+        showed(getLabelPrex(3));
+    }
+
 }

+ 24 - 0
app/src/main/java/com/sheep/gamegroup/module/qrcode/QRCodeCaptureHelper.java

@@ -4,7 +4,9 @@ import android.app.Activity;
 import android.net.Uri;
 import android.text.TextUtils;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baidu.idl.face.platform.FaceSDKManager;
+import com.bumptech.glide.Glide;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.QRCode;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -63,4 +65,26 @@ public class QRCodeCaptureHelper {
         }
     }
 
+    public static void submitQRCodeResult(Activity activity, String code, String result){
+        JSONObject json = new JSONObject();
+        json.put("action_content", result);
+        json.put("status", 1);
+        json.put("code", code);
+        SheepApp.getInstance().getNetComponent().getApiService().submitQRCodeResult(SpUtils.getToken(activity), json)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        G.showToast("扫码成功");
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        G.showToast("扫码失败");
+                    }
+                });
+    }
+
 }

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -15,6 +15,8 @@ import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.absBase.IHomePageSearch;
 import com.sheep.gamegroup.absBase.IJumpWeb;
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.event.EventTypes;
 import com.sheep.gamegroup.greendao.DDProviderHelper;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
@@ -62,6 +64,7 @@ import com.sheep.gamegroup.module.game.activity.ActGameGroupOrGameDetail;
 import com.sheep.gamegroup.module.game.activity.ActGameRank;
 import com.sheep.gamegroup.module.game.activity.ActGitBagList;
 import com.sheep.gamegroup.module.game.activity.ActMyGameList;
+import com.sheep.gamegroup.module.guide.NewbieGuideHelper;
 import com.sheep.gamegroup.module.qrcode.FaceWithQRActivity;
 import com.sheep.gamegroup.module.search.ActSearch;
 import com.sheep.gamegroup.module.game.activity.ActWelfareSpecialArea;
@@ -1672,6 +1675,8 @@ public class Jump2View {
         CommonUtil.getInstance().callActionWithUserInfo(userEntity ->
                 Observable.create((ObservableOnSubscribe<Object>) emitter -> {
                     if (userEntity.alreadyFinishAllNewTask()) {//已经完成所有新手任务
+                        //关闭新手引导
+                        new NewbieGuideHelper(activity).disableAll();
                         //没有兑换过优惠券时,显示商城优惠券
                         SheepApp.getInstance().getNetComponent().getApiService().getYfShopReceiveCouponsCheck(ReceiveCouponsResp.TYPE_NEW_TASK)
                                 .subscribeOn(Schedulers.io())
@@ -1715,6 +1720,7 @@ public class Jump2View {
 
                                             @Override
                                             public void onError(BaseMessage baseMessage) {
+                                                EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.GUIDE_NEXT));
                                                 tryShowYfShopAskDialog(activity);
                                             }
                                         });

+ 6 - 6
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -548,18 +548,18 @@ public class ActMain extends BaseActYmPermissionCheck {
     }
 
     @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
+    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        super.onActivityResult(requestCode, resultCode, intent);
         if (resultCode == RESULT_OK) {
             if(requestCode == Constant.INTENT_CAPTURE_QRCODE){
-                QRCodeCaptureHelper.handle(this, data.getStringExtra(CodeUtils.RESULT_STRING));
+                QRCodeCaptureHelper.handle(this, intent.getStringExtra(CodeUtils.RESULT_STRING));
             } else if(requestCode == Constant.INTENT_DETECT_FACE) {
-                UpFileUtils.upImage(new File(data.getStringExtra("bestPath")), new UpFileListener() {
+                UpFileUtils.upImage(new File(intent.getStringExtra("bestPath")), new UpFileListener() {
                     @Override
                     public void Success(String msg, int index) {
                         JSONObject json = JSONObject.parseObject(msg);
-                        JSONObject d = json.getJSONObject("data");
-
+                        JSONObject data = json.getJSONObject("data");
+                        QRCodeCaptureHelper.submitQRCodeResult(ActMain.this, intent.getStringExtra("extra"), data.getString("url"));
                     }
 
                     @Override