Commit bad8dd9705a18e1c06c3cb14aa3947b7fbca8233
1 parent
43f3f676
Exists in
master
no message
Showing
7 changed files
with
58 additions
and
5 deletions
Show diff stats
.idea/caches/build_file_checksums.ser
No preview for this file type
.idea/misc.xml
| ... | ... | @@ -5,11 +5,12 @@ |
| 5 | 5 | <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> |
| 6 | 6 | <option name="myNullables"> |
| 7 | 7 | <value> |
| 8 | - <list size="4"> | |
| 8 | + <list size="5"> | |
| 9 | 9 | <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> |
| 10 | 10 | <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> |
| 11 | - <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | |
| 12 | - <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | |
| 11 | + <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> | |
| 12 | + <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | |
| 13 | + <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | |
| 13 | 14 | </list> |
| 14 | 15 | </value> |
| 15 | 16 | </option> | ... | ... |
app/src/main/AndroidManifest.xml
| ... | ... | @@ -21,8 +21,21 @@ |
| 21 | 21 | <action android:name="android.intent.action.MAIN" /> |
| 22 | 22 | |
| 23 | 23 | <category android:name="android.intent.category.LAUNCHER" /> |
| 24 | + <category android:name="android.intent.category.HOME"/> | |
| 25 | + <category android:name="android.intent.category.HOME_FIRST"/> | |
| 26 | + <category android:name="android.intent.category.DEFAULT"/> | |
| 27 | + <category android:name="android.intent.category.HOME.SEADEE"/> | |
| 28 | + <category android:name="android.intent.category.MONKEY"/> | |
| 24 | 29 | </intent-filter> |
| 25 | 30 | </activity> |
| 31 | + <receiver android:name=".AppReceiver"> | |
| 32 | + <intent-filter> | |
| 33 | + <action android:name="android.intent.action.BOOT_COMPLETED" /> | |
| 34 | + <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | |
| 35 | + | |
| 36 | + <category android:name="android.intent.category.HOME" /> | |
| 37 | + </intent-filter> | |
| 38 | + </receiver> | |
| 26 | 39 | <activity |
| 27 | 40 | android:name=".base.BaseActivity" |
| 28 | 41 | android:label="@string/title_activity_base" | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/AppReceiver.java
0 → 100644
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +package com.shunzhi.expressscanner; | |
| 2 | + | |
| 3 | +import android.content.BroadcastReceiver; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.content.Intent; | |
| 6 | +import android.net.ConnectivityManager; | |
| 7 | +import android.net.NetworkInfo; | |
| 8 | +import android.util.Log; | |
| 9 | + | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by Ender on 2015/11/22. | |
| 13 | + */ | |
| 14 | +public class AppReceiver extends BroadcastReceiver { | |
| 15 | + private static final String TAG = "AppReceiver"; | |
| 16 | + @Override | |
| 17 | + public void onReceive(Context context, Intent intent) { | |
| 18 | + //判断进程/服务是否存在,否则启动 | |
| 19 | + Log.i(TAG, "onReceive"); | |
| 20 | + | |
| 21 | + if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { | |
| 22 | + | |
| 23 | + //AppManager.getAppManager().finishAllActivity(); | |
| 24 | + Intent mIntent = new Intent(context, MainActivity.class); | |
| 25 | + mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 26 | + context.startActivity(mIntent); | |
| 27 | + } | |
| 28 | + | |
| 29 | + } | |
| 30 | + | |
| 31 | +} | |
| 0 | 32 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/fragment/MainFragment.java
| ... | ... | @@ -136,8 +136,11 @@ public class MainFragment extends BaseMVPCompatFragment<MainContract.MainPresent |
| 136 | 136 | |
| 137 | 137 | @Override |
| 138 | 138 | public void afterTextChanged(Editable editable) { |
| 139 | - if (editable.length() >= 3 && tvCommint.getText().toString().equals("确定录入")&&editable.length()<11) | |
| 139 | + if (editable.length() >= 2 && tvCommint.getText().toString().equals("确定录入")&&editable.length()<11) | |
| 140 | 140 | mPresenter.SearchExpressPhone(editable.toString()); |
| 141 | + else { | |
| 142 | + if (myPopu!=null)myPopu.dismiss(); | |
| 143 | + } | |
| 141 | 144 | } |
| 142 | 145 | }); |
| 143 | 146 | } | ... | ... |
app/src/main/java/com/shunzhi/expressscanner/present/MainPresenter.java
| ... | ... | @@ -40,11 +40,12 @@ public class MainPresenter extends MainContract.MainPresenter { |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | @Override |
| 43 | - public void login(String loginName, String loginPwd) { | |
| 43 | + public void login(final String loginName, final String loginPwd) { | |
| 44 | 44 | |
| 45 | 45 | mRxManager.register(mIModel.login(loginName, loginPwd).subscribe(new Consumer<JsonObject>() { |
| 46 | 46 | @Override |
| 47 | 47 | public void accept(JsonObject jsonObject) throws Exception { |
| 48 | + Log.d("55555", "login=" + jsonObject.toString()); | |
| 48 | 49 | String access_token = jsonObject.get("access_token").getAsString(); |
| 49 | 50 | AppConfig.getAppConfig().set(AppConfig.ACCESS_TOKEN, access_token); |
| 50 | 51 | RetrofitCreateHelper.getInstance().setAuthorization(access_token); |
| ... | ... | @@ -54,6 +55,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
| 54 | 55 | @Override |
| 55 | 56 | public void accept(Throwable throwable) throws Exception { |
| 56 | 57 | try { |
| 58 | + login(loginName,loginPwd); | |
| 57 | 59 | OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); |
| 58 | 60 | } catch (Exception e) { |
| 59 | 61 | e.printStackTrace(); |
| ... | ... | @@ -68,6 +70,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
| 68 | 70 | mRxManager.register(mIModel.getCurrentInfo().subscribe(new Consumer<JsonObject>() { |
| 69 | 71 | @Override |
| 70 | 72 | public void accept(JsonObject jsonObject) throws Exception { |
| 73 | + Log.d("55555", "getCurrentInfo=" + jsonObject.toString()); | |
| 71 | 74 | if (jsonObject.get("status").getAsInt() == 1) { |
| 72 | 75 | JsonObject data = jsonObject.getAsJsonObject("data"); |
| 73 | 76 | AppConfig.getAppConfig().set(AppConfig.CURRENT_USERID, data.get("id").getAsString()); |
| ... | ... | @@ -114,6 +117,7 @@ public class MainPresenter extends MainContract.MainPresenter { |
| 114 | 117 | }, new Consumer<Throwable>() { |
| 115 | 118 | @Override |
| 116 | 119 | public void accept(Throwable throwable) throws Exception { |
| 120 | + Log.d("55555","getExpressInfo="+throwable.toString()); | |
| 117 | 121 | ToastUtils.showToast(throwable.toString()); |
| 118 | 122 | } |
| 119 | 123 | })); | ... | ... |
app/src/main/res/layout/fragment_main.xml
| ... | ... | @@ -101,6 +101,7 @@ |
| 101 | 101 | android:hint="请输入11位手机号" |
| 102 | 102 | android:maxLines="1" |
| 103 | 103 | android:singleLine="true" |
| 104 | + android:inputType="phone" | |
| 104 | 105 | android:textColor="@color/text_color_dark" |
| 105 | 106 | android:textColorHint="@color/gray" |
| 106 | 107 | android:textSize="@dimen/sp_14" /> | ... | ... |