Просмотр исходного кода

Merge remote-tracking branch 'origin/sheep2.0' into sheep2.0

zengjiebin лет назад: 8
Родитель
Сommit
b716e9ada9

+ 5 - 9
app/src/main/AndroidManifest.xml

@@ -173,11 +173,10 @@
         <activity
             android:name=".page.SplashActivity"
             android:screenOrientation="portrait">
-
-            <!--<intent-filter>-->
-                <!--<action android:name="android.intent.action.MAIN"/>-->
-                <!--<category android:name="android.intent.category.LAUNCHER"/>-->
-            <!--</intent-filter>-->
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
         </activity>
         <activity
             android:name="com.sheep.gamegroup.view.activity.AskRewardAct"
@@ -196,10 +195,7 @@
 
         <!--2.0-->
         <activity android:name="com.sheep.gamegroup.view.activity.LoginAct">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
-            </intent-filter>
+
             </activity>
 
         <activity android:name="com.sheep.gamegroup.view.activity.PhoneAct"/>

+ 1 - 1
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -126,7 +126,7 @@ public class FgtSmallSheep extends BaseCompatFragment  implements SmallSheepCont
                 Jump2View.getInstance().goTryplayView(activity, null);
                 break;
             case R.id.invitation_layout://邀请赚钱
-                Jump2View.getInstance().goInvitationView(activity, null);
+                Jump2View.getInstance().goAskGetMoney(activity, null);
                 break;
             case R.id.lying_layout://躺着赚钱
                 Jump2View.getInstance().goLyingView(activity, null);

+ 2 - 1
app/src/main/java/com/sheep/gamegroup/presenter/LoginPresenter.java

@@ -11,6 +11,7 @@ import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.LoginEntity;
 import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.util.ChannelContent;
 import com.sheep.gamegroup.util.FastJsonUtils;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -47,7 +48,7 @@ public class LoginPresenter implements LoginContract.Presenter {
         JSONObject j = new JSONObject();
         j.put("code",access_token);
         j.put("username",openid);
-        j.put("scope","");
+        j.put("scope",ChannelContent.getInstance().getChannel_name() );
         if(type==1){
             apiService.LoginByWX(j).subscribeOn(Schedulers.io())
                     .subscribe(new Observer<BaseMessage>() {

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/presenter/TaskDialogPresenter.java

@@ -48,6 +48,6 @@ public class TaskDialogPresenter implements TaskDialogContract.Presenter {
 
     @Override
     public void getTaskState(JSONObject o) {
-        
+
     }
 }

+ 116 - 0
app/src/main/java/com/sheep/gamegroup/util/ChannelContent.java

@@ -0,0 +1,116 @@
+package com.sheep.gamegroup.util;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.text.TextUtils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * <pre>
+ *     sinlov
+ *
+ *     /\__/\
+ *    /`    '\
+ *  ≈≈≈ 0  0 ≈≈≈ Hello world!
+ *    \  --  /
+ *   /        \
+ *  /          \
+ * |            |
+ *  \  ||  ||  /
+ *   \_oo__oo_/≡≡≡≡≡≡≡≡o
+ *
+ * </pre>
+ * Created by sinlov on 16/12/28.
+ */
+public class ChannelContent {
+
+    private static final String META_INF_FILE_START = "META-INF/pl_channel_";
+    private static final String CHANNEL_FILE_MARK = "pl_channel_";
+    private String channel_name;
+    private static ChannelContent instance;
+    private Properties properties;
+    private boolean hasChannelFile = false;
+
+    public static ChannelContent getInstance() {
+        if (null == instance) {
+            instance = new ChannelContent();
+        }
+        return instance;
+    }
+
+    private ChannelContent() {
+    }
+
+    public boolean initChannelContent(Context context) {
+        hasChannelFile = false;
+        ApplicationInfo appInfo = context.getApplicationInfo();
+        String sourceDir = appInfo.sourceDir;
+        ZipFile zipfile = null;
+        try {
+            zipfile = new ZipFile(sourceDir);
+            Enumeration<?> entries = zipfile.entries();
+            while (entries.hasMoreElements()) {
+                ZipEntry entry = ((ZipEntry) entries.nextElement());
+                String entryName = entry.getName();
+                if (entryName.contains("../")) {
+                    break;
+                }
+                if (entryName.startsWith(META_INF_FILE_START)) {
+                    if (entryName.contains(".")) {
+                        break;
+                    }
+                    String[] split = entryName.split(CHANNEL_FILE_MARK);
+                    channel_name = split[split.length - 1];
+                    hasChannelFile = true;
+                    long size = entry.getSize();
+                    if (size > 0) {
+                        BufferedReader br = new BufferedReader(new InputStreamReader(zipfile.getInputStream(entry)));
+                        properties = new Properties();
+                        properties.load(br);
+                        br.close();
+                    }
+                    break;
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (zipfile != null) {
+                try {
+                    zipfile.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return hasChannelFile;
+    }
+
+    public String getChannel_name() {
+        if (TextUtils.isEmpty(channel_name)) {
+            new ExceptionInInitializerError("has your initChannelContent() ?").printStackTrace();
+        }
+        return channel_name;
+    }
+
+    public Map<String, String> getChanelInfo(String... key) {
+        if (!hasChannelFile || properties == null || properties.isEmpty()) {
+            new ExceptionInInitializerError("has your initChannelContent() ?").printStackTrace();
+            return null;
+        }
+        HashMap<String, String> hashMap = new HashMap<String, String>();
+        for (String s : key) {
+            hashMap.put(s, properties.getProperty(s, ""));
+        }
+        return hashMap;
+    }
+}

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/HomePageAct.java

@@ -74,7 +74,6 @@ public class HomePageAct extends BaseActivity implements HomePageContract.View{
         @Override
         public void handleMessage(Message msg) {
             super.handleMessage(msg);
-
             myPrice.setText(userEntity.getBalance()+" 元");
             myAllPrice.setText("累计资产 "+userEntity.getTotal_asset()+" 元");
             nameTv.setText(userEntity.getNickname()+"");//绵羊号:123456789

+ 17 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/LoginAct.java

@@ -5,6 +5,7 @@ import android.content.Intent;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.v4.app.ActivityCompat;
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
@@ -15,9 +16,11 @@ import com.sheep.gamegroup.di.components.DaggerLoginComponent;
 import com.sheep.gamegroup.di.modules.LoginModule;
 import com.sheep.gamegroup.presenter.LoginContract;
 import com.sheep.gamegroup.presenter.LoginPresenter;
+import com.sheep.gamegroup.util.ChannelContent;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.umeng.socialize.UMAuthListener;
 import com.umeng.socialize.UMShareAPI;
 import com.umeng.socialize.bean.SHARE_MEDIA;
@@ -63,10 +66,10 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
 
 
     private void requestPremiss() {
-        if (Build.VERSION.SDK_INT >= 23) {
-            String[] mPermissionList = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CALL_PHONE, Manifest.permission.READ_LOGS, Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SET_DEBUG_APP, Manifest.permission.SYSTEM_ALERT_WINDOW, Manifest.permission.GET_ACCOUNTS, Manifest.permission.WRITE_APN_SETTINGS};
-            ActivityCompat.requestPermissions(this, mPermissionList, 123);
-        }
+//        if (Build.VERSION.SDK_INT >= 23) {
+//            String[] mPermissionList = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CALL_PHONE, Manifest.permission.READ_LOGS, Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SET_DEBUG_APP, Manifest.permission.SYSTEM_ALERT_WINDOW, Manifest.permission.GET_ACCOUNTS, Manifest.permission.WRITE_APN_SETTINGS};
+//            ActivityCompat.requestPermissions(this, mPermissionList, 123);
+//        }
     }
 
     @Override
@@ -85,13 +88,22 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
     @Override
     public void initData() {
         requestPremiss();
+        ChannelContent.getInstance().initChannelContent(this);
+
+
     }
 
 
 
 
     private void goTelLogin() {
-        Jump2View.getInstance().goPhoneLoginView(LoginAct.this, false);
+        String openId = SpUtils.getOpenId(getApplicationContext());
+        if (!TextUtils.isEmpty(openId)) {
+            Jump2View.getInstance().goHomePageView(this, null);
+            finish();
+        } else {
+            Jump2View.getInstance().goPhoneLoginView(LoginAct.this, false);
+        }
     }
 
     private void goWeixin() {

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

@@ -79,9 +79,9 @@ public class TryMakeMoneyact extends BaseActivity implements TryMakeMoneyContrac
                 .inject(this);
         recyclerview.setLayoutManager(new LinearLayoutManager(activity));
         tryMakeMoneyAdp = new TryMakeMoneyAdp(this);
-        for (int i = 0; i < 2; i++) {
-            tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
-        }
+//        for (int i = 0; i < 2; i++) {
+//            tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
+//        }
         recyclerview.setAdapter(tryMakeMoneyAdp);
     }
 
@@ -208,9 +208,7 @@ public class TryMakeMoneyact extends BaseActivity implements TryMakeMoneyContrac
         try{
             BaseMessage baseMessage = (BaseMessage) o;
             List<TaskReleaseEty> releaseEtyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), TaskReleaseEty.class);
-            for(TaskReleaseEty t: releaseEtyList){
-                presenter.giveUpTask(t.getId());
-            }
+
             tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RELEASE_TASK, releaseEtyList));
             mhandler.sendEmptyMessage(0);
         }catch (Exception e){