Explorar el Código

网络接口一些更改

liujiangyao hace 8 años
padre
commit
058df36f6c

+ 6 - 0
.idea/gradle.xml

@@ -5,6 +5,12 @@
       <GradleProjectSettings>
         <option name="distributionType" value="DEFAULT_WRAPPED" />
         <option name="externalProjectPath" value="$PROJECT_DIR$" />
+        <option name="modules">
+          <set>
+            <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/app" />
+          </set>
+        </option>
         <option name="resolveModulePerSourceSet" value="false" />
       </GradleProjectSettings>
     </option>

+ 5 - 1
app/build.gradle

@@ -73,7 +73,7 @@ dependencies {
     compile 'com.tencent.bugly:crashreport_upgrade:latest.release'//其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.0
     compile 'com.tencent.bugly:nativecrashreport:latest.release' //其中latest.release指代最
     compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
-    compile(name: 'utils', ext: 'aar')
+//    compile(name: 'utils', ext: 'aar')
     debugCompile 'com.readystatesoftware.chuck:library:1.1.0'
     compile 'de.hdodenhof:circleimageview:2.2.0'
     releaseCompile 'com.readystatesoftware.chuck:library-no-op:1.1.0'
@@ -82,6 +82,7 @@ dependencies {
     compile 'cn.yipianfengye.android:zxing-library:2.2'
     compile 'com.github.huburt-Hu:NewbieGuide:v1.2.0'
     compile 'com.android.support:multidex:1.0.1'
+    compile(name: 'com.kfzs.safe', ext: 'aar')
 
     //butterknife
     compile 'com.jakewharton:butterknife:+'
@@ -111,4 +112,7 @@ dependencies {
     compile 'com.umeng.sdk:common:latest.integration'
     compile 'com.umeng.sdk:analytics:latest.integration'
 
+    //fast json
+    compile 'com.alibaba:fastjson:+'
+
 }

BIN
app/libs/com.kfzs.safe.aar


+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -186,6 +186,7 @@
 
         <!--2.0-->
         <activity android:name="com.sheep.gamegroup.view.activity.LoginAct"/>
+        <activity android:name="com.sheep.gamegroup.view.activity.PhoneAct"/>
 
         <service android:name=".service.TopService"
                  android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"

+ 2 - 1
app/src/main/java/com/sheep/gamegroup/di/modules/NetModule.java

@@ -3,6 +3,7 @@ package com.sheep.gamegroup.di.modules;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.api.StringConverterFactory;
 import com.sheep.gamegroup.model.util.EntityUtils;
+import com.sheep.gamegroup.util.ConnectAddress;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 
 import java.util.concurrent.TimeUnit;
@@ -41,7 +42,7 @@ public class NetModule {
     public Retrofit provideRetrofit(OkHttpClient okhttpClient) {
         Retrofit retrofit = new Retrofit.Builder()
                 .client(okhttpClient)
-                .baseUrl("http://xxxx/")
+                .baseUrl(ConnectAddress.APP_URL)
                 .addConverterFactory(StringConverterFactory.create())
                 .addConverterFactory(GsonConverterFactory.create(EntityUtils.gson))//
                 .addCallAdapterFactory(RxJavaCallAdapterFactory.create())

+ 30 - 1
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -1,13 +1,29 @@
 package com.sheep.gamegroup.model.api;
 
+import android.app.DownloadManager;
+import android.support.annotation.StringRes;
+
+import com.alibaba.fastjson.annotation.JSONCreator;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.sheep.gamegroup.model.entity.BaseEntity;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+
+import org.json.JSONObject;
+import org.xutils.http.body.RequestBody;
+
 import java.util.Map;
 
-import io.reactivex.Observable;
 import retrofit2.Call;
+import retrofit2.http.Body;
+import retrofit2.http.Field;
 import retrofit2.http.FieldMap;
 import retrofit2.http.FormUrlEncoded;
 import retrofit2.http.GET;
 import retrofit2.http.POST;
+import retrofit2.http.Query;
+import retrofit2.http.QueryMap;
+import retrofit2.http.Streaming;
+import rx.Observable;
 
 /**
  * 暂时没接口
@@ -21,4 +37,17 @@ public interface ApiService {
     @FormUrlEncoded
     @POST("/")
     Call<Object> getTimeInfoPostForm(@FieldMap Map<String, String> map);
+
+    /**
+     *
+     * @param jsonObject
+     * @return
+     */
+    @Streaming
+    @POST("/v1/app/auth/sms_for_login/")
+    Observable<BaseMessage> getCaptcha(@Body String jsonObject);
+
+    @POST("/v1/app/auth/login_by_sms/")
+    Observable<BaseMessage> loginByCaptcha(@Body com.alibaba.fastjson.JSONObject jsonObject);
+
 }

+ 22 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/BaseEntity.java

@@ -0,0 +1,22 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by ljy on 2018/3/16.
+ */
+
+public class BaseEntity {
+
+    private String data;
+
+    public BaseEntity(String data) {
+        this.data = data;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+}

+ 77 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/BaseMessage.java

@@ -0,0 +1,77 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+/**
+ * Created by ljy on 2018/3/16.
+ */
+
+public class BaseMessage {
+
+    private String msg;
+    private Integer code = 0;
+    private Object object;
+
+    public String getMsg() {
+        return msg == null ?"":msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public Object getObject() {
+        if(object == null){
+            object = new Object();
+        }
+        return object;
+    }
+
+    public void setObject(Object object) {
+        this.object = object;
+    }
+
+    /**
+     * 失败返回null
+     *
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public <T> T getData(Class<T> clazz) {
+        if (object == null) {
+            return null;
+        }
+        return JSONObject.parseObject(JSONObject.toJSONString(object), clazz);
+    }
+
+    /**
+     * 如果data里是数组,直接这样获取
+     *
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public <T> List<T> getDatas(Class<T> clazz) {
+        if (object == null) {
+            return null;
+        }
+        return JSONArray.parseArray(JSONObject.toJSONString(object), clazz);
+    }
+
+    @Override
+    public String toString() {
+        return JSONObject.toJSONString(this);
+    }
+}

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/presenter/PhoneContract.java

@@ -1,5 +1,7 @@
 package com.sheep.gamegroup.presenter;
 
+import org.json.JSONException;
+
 /**
  * Created by ljy on 2018/3/15.
  */
@@ -8,9 +10,13 @@ public interface PhoneContract {
 
     interface Presenter{
 
+        void getCaptcha(String telphone) throws JSONException;
+        void loginByCaptcha(String telphone, String code);
     }
 
     interface View{
+        void returnGaptcha(Object o);
 
+        void returnLogindata(Object o);
     }
 }

+ 84 - 0
app/src/main/java/com/sheep/gamegroup/presenter/PhonePresenter.java

@@ -1,9 +1,29 @@
 package com.sheep.gamegroup.presenter;
 
+import android.util.Log;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.orhanobut.logger.Logger;
 import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseEntity;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.util.XXTEA;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.inject.Inject;
 
+import rx.Observable;
+import rx.Observer;
+import rx.functions.Func0;
+import rx.functions.Func1;
+import rx.schedulers.Schedulers;
+
 /**
  * Created by ljy on 2018/3/15.
  */
@@ -17,4 +37,68 @@ public class PhonePresenter implements PhoneContract.Presenter {
         this.view = view;
         this.apiService = apiService;
     }
+
+    @Override
+    public void getCaptcha(String telphone){
+        Map map = new HashMap();
+        map.put("account", telphone);
+        Log.e("hash-map", map.toString());
+        com.alibaba.fastjson.JSONObject j = new com.alibaba.fastjson.JSONObject();
+        j.put("account", telphone);
+        String encry = XXTEA.Encrypt(j.toString(),XXTEA.KEY);
+        Log.e("encry----", com.alibaba.fastjson.JSONObject.toJSONString(encry));
+        apiService.getCaptcha(encry)
+                .subscribeOn(Schedulers.io())
+                .subscribe(new Observer<BaseMessage>() {
+                    @Override
+                    public void onCompleted() {
+                        Log.e("onCompleted--------","onCompleted");
+
+                    }
+
+                    @Override
+                    public void onError(Throwable throwable) {
+                        throwable.printStackTrace();
+                        Logger.e(throwable,"load splash failed:");
+                        Log.e("onError--------","onError:"+throwable);
+
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage o) {
+                        Log.e("onNext--------","onNext:"+o.toString());
+                        view.returnGaptcha(o);
+                    }
+                });
+
+    }
+
+    @Override
+    public void loginByCaptcha(String telphone, String code) {
+        com.alibaba.fastjson.JSONObject m = new com.alibaba.fastjson.JSONObject();
+        m.put("account",telphone);
+        m.put("sec_code",code);
+        apiService.loginByCaptcha(m)
+                .subscribeOn(Schedulers.io())
+                .subscribe(new Observer<Object>() {
+                    @Override
+                    public void onCompleted() {
+                        Log.e("onCompleted--------","onCompleted");
+
+                    }
+
+                    @Override
+                    public void onError(Throwable throwable) {
+                        Log.e("onError--------","onError:"+throwable);
+
+                    }
+
+                    @Override
+                    public void onNext(Object o) {
+                        Log.e("onNext--------","onNext:"+o.toString());
+                        view.returnLogindata(o);
+                    }
+                });
+
+    }
 }

+ 17 - 0
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -0,0 +1,17 @@
+package com.sheep.gamegroup.util;
+
+/**
+ * Created by ljy on 2018/3/15.
+ */
+
+public class ConnectAddress {
+
+    public static final String BASE_HTTP = "http://10.8.220.6:8080/";
+
+    public static final String V1 = "/v1/";
+
+    /**
+     * 接口地址
+     */
+    public static final String APP_URL = BASE_HTTP;
+}

+ 188 - 0
app/src/main/java/com/sheep/gamegroup/util/XXTEA.java

@@ -0,0 +1,188 @@
+package com.sheep.gamegroup.util;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * XXTEA 加密算法
+ * Created by ljy on 2018/3/16.
+ */
+
+public class XXTEA {
+    public final static String KEY = "bbu423&(gBUjX#$s";
+
+    /**
+     * 加密
+     * @param data
+     * @param key
+     * @return
+     */
+    public static String Encrypt(String data, String key) {
+        return ToHexString(TEAEncrypt(
+                ToLongArray(PadRight(data, MIN_LENGTH).getBytes(
+                        Charset.forName("UTF8"))),
+                ToLongArray(PadRight(key, MIN_LENGTH).getBytes(
+                        Charset.forName("UTF8")))));
+    }
+
+    /**
+     * 解密
+     * @param data
+     * @param key
+     * @return
+     */
+    public static String Decrypt(String data, String key) {
+        if (data == null || data.length() < MIN_LENGTH) {
+            return data;
+        }
+        byte[] code = ToByteArray(TEADecrypt(
+                ToLongArray(data),
+                ToLongArray(PadRight(key, MIN_LENGTH).getBytes(
+                        Charset.forName("UTF8")))));
+        return new String(code, Charset.forName("UTF8"));
+    }
+
+    private static long[] TEAEncrypt(long[] data, long[] key) {
+        int n = data.length;
+        if (n < 1) {
+            return data;
+        }
+
+        long z = data[data.length - 1], y = data[0], sum = 0, e, p, q;
+        q = 6 + 52 / n;
+        while (q-- > 0) {
+            sum += DELTA;
+            e = (sum >> 2) & 3;
+            for (p = 0; p < n - 1; p++) {
+                y = data[(int) (p + 1)];
+                z = data[(int) p] += (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)
+                        ^ (sum ^ y) + (key[(int) (p & 3 ^ e)] ^ z);
+            }
+            y = data[0];
+            z = data[n - 1] += (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)
+                    ^ (sum ^ y) + (key[(int) (p & 3 ^ e)] ^ z);
+        }
+
+        return data;
+    }
+
+    private static long[] TEADecrypt(long[] data, long[] key) {
+        int n = data.length;
+        if (n < 1) {
+            return data;
+        }
+
+        long z = data[data.length - 1], y = data[0], sum = 0, e, p, q;
+        q = 6 + 52 / n;
+        sum = q * DELTA;
+        while (sum != 0) {
+            e = (sum >> 2) & 3;
+            for (p = n - 1; p > 0; p--) {
+                z = data[(int) (p - 1)];
+                y = data[(int) p] -= (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)
+                        ^ (sum ^ y) + (key[(int) (p & 3 ^ e)] ^ z);
+            }
+            z = data[n - 1];
+            y = data[0] -= (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y)
+                    + (key[(int) (p & 3 ^ e)] ^ z);
+            sum -= DELTA;
+        }
+
+        return data;
+    }
+
+    private static long[] ToLongArray(byte[] data) {
+        int n = (data.length % 8 == 0 ? 0 : 1) + data.length / 8;
+        long[] result = new long[n];
+
+        for (int i = 0; i < n - 1; i++) {
+            result[i] = bytes2long(data, i * 8);
+        }
+
+        byte[] buffer = new byte[8];
+        for (int i = 0, j = (n - 1) * 8; j < data.length; i++, j++) {
+            buffer[i] = data[j];
+        }
+        result[n - 1] = bytes2long(buffer, 0);
+
+        return result;
+    }
+
+    private static byte[] ToByteArray(long[] data) {
+        List<Byte> result = new ArrayList<Byte>();
+
+        for (int i = 0; i < data.length; i++) {
+            byte[] bs = long2bytes(data[i]);
+            for (int j = 0; j < 8; j++) {
+                result.add(bs[j]);
+            }
+        }
+
+        while (result.get(result.size() - 1) == SPECIAL_CHAR) {
+            result.remove(result.size() - 1);
+        }
+
+        byte[] ret = new byte[result.size()];
+        for (int i = 0; i < ret.length; i++) {
+            ret[i] = result.get(i);
+        }
+        return ret;
+    }
+
+    public static byte[] long2bytes(long num) {
+        ByteBuffer buffer = ByteBuffer.allocate(8).order(
+                ByteOrder.LITTLE_ENDIAN);
+        buffer.putLong(num);
+        return buffer.array();
+    }
+
+    public static long bytes2long(byte[] b, int index) {
+        ByteBuffer buffer = ByteBuffer.allocate(8).order(
+                ByteOrder.LITTLE_ENDIAN);
+        buffer.put(b, index, 8);
+        return buffer.getLong(0);
+    }
+
+    private static String ToHexString(long[] data) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < data.length; i++) {
+            sb.append(PadLeft(Long.toHexString(data[i]), 16));
+        }
+        return sb.toString();
+    }
+
+
+
+
+    private static long[] ToLongArray(String data) {
+        int len = data.length() / 16;
+        long[] result = new long[len];
+        for (int i = 0; i < len; i++) {
+            result[i] = new BigInteger(data.substring(i * 16, i * 16 + 16), 16)
+                    .longValue();
+        }
+        return result;
+    }
+
+    private static String PadRight(String source, int length) {
+        while (source.length() < length) {
+            source += SPECIAL_CHAR;
+        }
+        return source;
+    }
+
+    private static String PadLeft(String source, int length) {
+        while (source.length() < length) {
+            source = '0' + source;
+        }
+        return source;
+    }
+
+    private static long DELTA = 0x9E3779B9;
+    private static int MIN_LENGTH = 32;
+    private static char SPECIAL_CHAR = '\0';
+}

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/LoginAct.java

@@ -11,6 +11,7 @@ import com.sheep.gamegroup.di.components.DaggerLoginComponent;
 import com.sheep.gamegroup.di.components.LoginComponent;
 import com.sheep.gamegroup.di.modules.LoginModule;
 import com.sheep.gamegroup.presenter.LoginContract;
+import com.sheep.gamegroup.util.ActivityManager;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseActivity;
@@ -39,6 +40,7 @@ public class LoginAct extends BaseActivity implements LoginContract.View{
 
     @Override
     public void initView() {
+        ActivityManager.getInstance().pushActivity(this);
         activity = this;
         DaggerLoginComponent.builder()
                 .netComponent(SheepApp.get(this).getNetComponent())
@@ -75,7 +77,7 @@ public class LoginAct extends BaseActivity implements LoginContract.View{
     }
 
     private void goTelLogin() {
-        Intent intent = new Intent(activity, WXEntryActivity.class);
+        Intent intent = new Intent(activity, PhoneAct.class);
         startActivity(intent);
 //        finish();
     }

+ 97 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/PhoneAct.java

@@ -3,20 +3,28 @@ package com.sheep.gamegroup.view.activity;
 import android.app.Activity;
 import android.os.Bundle;
 import android.support.v7.widget.AppCompatEditText;
+import android.text.TextUtils;
+import android.util.Log;
 import android.view.View;
 import android.widget.TextView;
 
 import com.sheep.gamegroup.di.components.DaggerPhoneComponent;
 import com.sheep.gamegroup.di.modules.PhoneModule;
 import com.sheep.gamegroup.presenter.PhoneContract;
+import com.sheep.gamegroup.presenter.PhonePresenter;
 import com.sheep.gamegroup.util.SelfCountDownTimer;
+import com.sheep.gamegroup.util.XXTEA;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseActivity;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import javax.inject.Inject;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
 import butterknife.OnClick;
+import go.kfzssafe.Kfzssafe;
 
 /**
  * Created by ljy on 2018/3/15.
@@ -33,9 +41,15 @@ public class PhoneAct extends BaseActivity implements PhoneContract.View {
     @BindView(R.id.phone_sure_tv)
     TextView phoneSureTv;
 
+    @Inject
+    PhonePresenter phonePresenter;
+
     private SelfCountDownTimer selfCountDownTimer;
     private boolean canGetCaptchaPhone = true;
 
+    private String etPhone;
+    private String etCode;
+
     @Override
     protected int getLayoutId() {
         return R.layout.bind_phone_number_act_layout;
@@ -49,6 +63,7 @@ public class PhoneAct extends BaseActivity implements PhoneContract.View {
                 .phoneModule(new PhoneModule(this))
                 .build()
         .inject(this);
+        testData();
     }
 
     @Override
@@ -84,6 +99,7 @@ public class PhoneAct extends BaseActivity implements PhoneContract.View {
         super.onCreate(savedInstanceState);
         // TODO: add setContentView(...) invocation
         ButterKnife.bind(this);
+        phoneEtAccount.setText("13688480841");
     }
 
     @OnClick({R.id.phone_et_account, R.id.phone_et_code, R.id.phone_btn_code, R.id.phone_sure_tv})
@@ -94,9 +110,90 @@ public class PhoneAct extends BaseActivity implements PhoneContract.View {
             case R.id.phone_et_code:
                 break;
             case R.id.phone_btn_code:
+                etPhone = phoneEtAccount.getText().toString().trim();
+                getCaptcha();
                 break;
             case R.id.phone_sure_tv:
+                etPhone = phoneEtAccount.getText().toString().trim();
+                etCode = phoneEtCode.getText().toString().trim();
+                loginByPhoneGaptcha();
                 break;
         }
     }
+
+    private boolean checkPhoneInput() {
+        if (TextUtils.isEmpty(etPhone)) {
+            G.showToast(getString(R.string.input_your_phone));
+            return false;
+        }
+        if (etPhone.toString().length() != 11) {
+            G.showToast(getString(R.string.toast_warning_phone_number_size));
+            return false;
+        }
+        return true;
+    }
+    private boolean checkCodeInput() {
+        if (TextUtils.isEmpty(etCode)) {
+            G.showToast(getString(R.string.input_your_captcha));
+            return false;
+        }
+        if (etCode.toString().length() != 6) {
+            G.showToast(getString(R.string.toast_warning_phone_captcha_image_code_size));
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 获取验证码
+     */
+    private void getCaptcha(){
+
+        if (!canGetCaptchaPhone) {
+            return;
+        }
+        if(!checkPhoneInput()){
+            return;
+        }
+        selfCountDownTimer.reset();
+        phonePresenter.getCaptcha(etPhone);
+        canGetCaptchaPhone = false;
+        selfCountDownTimer.start();
+    }
+    /**
+     * 登录
+     */
+    private void loginByPhoneGaptcha(){
+        if(!checkPhoneInput()){
+            return;
+        }
+        if(!checkCodeInput()){
+            return;
+        }
+        phonePresenter.loginByCaptcha(etPhone, etCode);
+    }
+
+    @Override
+    public void returnGaptcha(Object o) {
+        Log.e("---Gaptcha-", o.toString());
+
+    }
+
+    @Override
+    public void returnLogindata(Object o) {
+        Log.e("---login_-", o.toString());
+    }
+
+    private void testData(){
+        String s1 = "523cbac3be1748ba65be01af9ca4412da011cc0196baf9fa54ce8d1f8b12b986";
+        String s2 = "2b08e160271fd9eeb8de2a7372782478425fe733e79b086fb4cb9353b793eaa6";
+
+        String e1 = "123123";
+        String d1 = "xxxx";
+//        String hexStr = HexUtils.bytes2HexStr(Kfzssafe.XByteEncode(e1.getBytes()));
+//        Log.e("j加密密1--", hexStr);
+//        Log.e("解密2--", XXTEA.Decrypt(hexStr, XXTEA.KEY));
+        Log.e("解密3--", XXTEA.Decrypt(s1, XXTEA.KEY));
+        Log.e("解密4--", XXTEA.Decrypt(s2, XXTEA.KEY));
+    }
 }

+ 2 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/page/SplashActivity.java

@@ -13,6 +13,7 @@ import android.widget.Toast;
 import com.mylhyl.acp.Acp;
 import com.mylhyl.acp.AcpListener;
 import com.mylhyl.acp.AcpOptions;
+import com.sheep.gamegroup.view.activity.LoginAct;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.base.BaseActivity;
 import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
@@ -89,7 +90,7 @@ public class SplashActivity extends BaseActivity {
             startActivity(intent);
             finish();
         } else {
-            Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
+            Intent intent = new Intent(SplashActivity.this, LoginAct.class);
             startActivity(intent);
             finish();
         }

+ 85 - 76
app/src/main/res/layout/bind_phone_number_act_layout.xml

@@ -6,94 +6,103 @@
 
     <include
         layout="@layout/title"/>
-
-    <ImageView
-        android:id="@+id/phone_iv"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginLeft="100dp"
-        android:layout_marginRight="100dp"
-        android:src="@drawable/icon"
-        android:layout_marginTop="35dp"
-        android:layout_marginBottom="5dp"/>
-
-    <TextView
-        android:id="@+id/phone_tip_tv"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="为了避免机器刷单,请绑定手机号后领取任务奖励"
-        android:textColor="@color/black_444444"
-        android:textSize="11dp"
-        android:layout_gravity="center_horizontal"/>
-
-    <LinearLayout
+    <ScrollView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="12dp"
-        android:layout_marginRight="12dp"
-        android:layout_marginTop="40dp"
-        android:background="@drawable/sp_rectangle_bg_white_radius"
-        android:orientation="vertical">
-        <android.support.v7.widget.AppCompatEditText
-            android:id="@+id/phone_et_account"
-            style="@style/edt_style"
-            android:inputType="phone"
-            android:layout_width="match_parent"
-            android:layout_height="@dimen/edt_heigh_default"
-            android:layout_centerVertical="true"
-            android:layout_margin="@dimen/content_padding_small"
-            android:hint="请输入要绑定的手机号"
-            android:paddingLeft="@dimen/content_padding_big"
-            android:maxLength="11"/>
-
+        android:scrollbars="none">
         <LinearLayout
-            android:id="@+id/ll_code"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_margin="@dimen/content_padding_small"
-            android:orientation="horizontal"
-            >
+            android:orientation="vertical">
+            <ImageView
+                android:id="@+id/phone_iv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_horizontal"
+                android:layout_marginLeft="100dp"
+                android:layout_marginRight="100dp"
+                android:src="@drawable/icon"
+                android:layout_marginTop="35dp"
+                android:layout_marginBottom="5dp"/>
 
-            <android.support.v7.widget.AppCompatEditText
-                android:id="@+id/phone_et_code"
-                style="@style/edt_style"
-                android:layout_width="0dp"
-                android:layout_height="@dimen/edt_heigh_default"
-                android:layout_weight="2"
-                android:hint="请输入验证码"
-                android:inputType="phone"
-                android:paddingLeft="@dimen/content_padding_big"
-                android:maxLength="6"
-                android:textSize="@dimen/text_size_3"/>
             <TextView
-                android:id="@+id/phone_btn_code"
-                android:layout_width="0dp"
+                android:id="@+id/phone_tip_tv"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_gravity="center|center_vertical"
-                android:layout_marginLeft="@dimen/content_padding"
-                android:layout_weight="1"
-                android:gravity="center"
-                android:text="@string/get_captcha"
-                android:textColor="@color/txt_bule"
-                />
+                android:text="为了避免机器刷单,请绑定手机号后领取任务奖励"
+                android:textColor="@color/black_444444"
+                android:textSize="11dp"
+                android:layout_gravity="center_horizontal"/>
 
-        </LinearLayout>
-    </LinearLayout>
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="12dp"
+                android:layout_marginRight="12dp"
+                android:layout_marginTop="40dp"
+                android:background="@drawable/sp_rectangle_bg_white_radius"
+                android:orientation="vertical">
+                <android.support.v7.widget.AppCompatEditText
+                    android:id="@+id/phone_et_account"
+                    style="@style/edt_style"
+                    android:inputType="phone"
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/edt_heigh_default"
+                    android:layout_centerVertical="true"
+                    android:layout_margin="@dimen/content_padding_small"
+                    android:hint="请输入手机号"
+                    android:paddingLeft="@dimen/content_padding_big"
+                    android:maxLength="11"/>
 
+                <LinearLayout
+                    android:id="@+id/ll_code"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="@dimen/content_padding_small"
+                    android:orientation="horizontal"
+                    >
 
+                    <android.support.v7.widget.AppCompatEditText
+                        android:id="@+id/phone_et_code"
+                        style="@style/edt_style"
+                        android:layout_width="0dp"
+                        android:layout_height="@dimen/edt_heigh_default"
+                        android:layout_weight="2"
+                        android:hint="请输入验证码"
+                        android:inputType="phone"
+                        android:paddingLeft="@dimen/content_padding_big"
+                        android:maxLength="6"
+                        android:textSize="@dimen/text_size_3"/>
+                    <TextView
+                        android:id="@+id/phone_btn_code"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center|center_vertical"
+                        android:layout_marginLeft="@dimen/content_padding"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:text="@string/get_captcha"
+                        android:textColor="@color/txt_bule"
+                        />
+
+                </LinearLayout>
+            </LinearLayout>
+
+
+
+            <TextView
+                android:id="@+id/phone_sure_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/layout_heigh_default"
+                android:gravity="center"
+                android:layout_gravity="center_horizontal"
+                android:text="确 定"
+                style="@style/txt_big_btn_style"/>
+
+        </LinearLayout>
+    </ScrollView>
 
-    <TextView
-        android:id="@+id/phone_sure_tv"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:minHeight="45dp"
-        android:minWidth="225dp"
-        android:layout_marginTop="@dimen/layout_heigh_default"
-        android:gravity="center"
-        android:layout_gravity="center_horizontal"
-        android:text="确 定"
-        style="@style/sure_btn_style"/>
 
 
 </LinearLayout>

+ 2 - 2
app/src/main/res/layout/login_act_layout.xml

@@ -25,8 +25,8 @@
             android:text="手机号登录"
             android:layout_alignParentBottom="true"
             style="@style/login_btn"
-            android:layout_marginBottom="100dp"
-            android:layout_marginTop="15dp"/>
+            android:layout_marginBottom="80dp"
+            android:layout_marginTop="@dimen/content_padding_10"/>
     </RelativeLayout>
 
 </RelativeLayout>

+ 7 - 0
app/src/main/res/values/strings.xml

@@ -7,4 +7,11 @@
     <string name="accessibility_service_description">开启观察权限</string>
     <string name="sprogress_string">当前进度%.1f%%</string>
     <string name="get_captcha">获取验证码</string>
+    <integer name="size_phone_captcha_image_code">6</integer>
+    <string name="input_your_phone">请输入你的手机号</string>
+    <string name="input_your_captcha">请输验证码</string>
+    <string name="toast_warning_phone_captcha_image_code_size">短信验证码为6位</string>
+    <integer name="size_phone_number">11</integer>
+    <string name="toast_warning_phone_number_size">手机号码为11位</string>
+    <string name="toast_warning_phone_number_error">手机号码为纯数字</string>
 </resources>