Sfoglia il codice sorgente

<增加长长按设置中的(IP地址及版本号)标题手动检查版本号升级>

weizhengliang 4 anni fa
parent
commit
592314a7db

+ 30 - 1
app/src/main/java/com/wdkl/callingbed2/ui/CallingBedActivity.java

@@ -392,6 +392,8 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
     TextView tvVolume;
     @Bind(R.id.rv_settings_version)
     RecyclerView rvSettings;
+    @Bind(R.id.tv_version)
+    TextView tvVersion;
 
     private ImageView ivWelcome;
     private MyTextView tvMessage;
@@ -651,6 +653,25 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                 }
             }
         });
+
+        tvVersion.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showHideRightView();
+            }
+        });
+
+        //app update check
+        tvVersion.setOnLongClickListener(new View.OnLongClickListener() {
+            @Override
+            public boolean onLongClick(View v) {
+                //重置回到主界面倒计时
+                timeOfBackMainPage = 0;
+                timeOut = callTimeOutBack;
+                appCheckUpdate();
+                return true;
+            }
+        });
     }
 
     @Override
@@ -1197,6 +1218,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                         @Override
                         public void onError(Call call, Exception e, int id) {
                             Constants.UPDATE_APP_FLAG = false;
+                            ToastUtil.showToast("检查APP版本失败,请检查网络或服务器配置");
                         }
 
                         @Override
@@ -1216,10 +1238,17 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                                             Intent intent = new Intent(CallingBedActivity.this, APPUpdateActivity.class);
                                             intent.putExtra("downLoadURL", Constants.URL + Constants.URL_END + "/" + downloadURL);
                                             startActivity(intent);
+                                        } else {
+                                            ToastUtil.showToast("APP下载地址为空,请检查服务器配置");
                                         }
+                                    } else {
+                                        ToastUtil.showToast("已是最新版本! 当前版本: " + APPVersion_Now + ", 服务器版本: " + APPVersion);
                                     }
+                                } else {
+                                    ToastUtil.showToast("获取APP版本失败,请检查服务器是否上传新版本");
                                 }
                             } catch (Exception e) {
+                                ToastUtil.showToast("检查APP版本失败,请检查网络或服务器配置");
                                 e.printStackTrace();
                                 Constants.UPDATE_APP_FLAG = false;
                             }
@@ -2327,7 +2356,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
         versionAdapter.upDateList(versionEntityList);
     }
 
-        @Override
+    @Override
     public void onClick(View v) {
         switch (v.getId()) {
             case R.id.right_ll_main_item:

+ 14 - 12
app/src/main/res/layout/view_settings_layout.xml

@@ -152,26 +152,28 @@
             android:textSize="32sp" />
     </RadioGroup>
 
+    <TextView
+        android:id="@+id/tv_version"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:padding="10dp"
+        android:text="IP地址及版本号:"
+        android:textColor="@color/white"
+        android:textSize="32sp"
+        android:textStyle="bold" />
+
     <LinearLayout
         android:id="@+id/ll_view_settings_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:orientation="vertical">
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="20dp"
-            android:text="IP地址及版本号:"
-            android:textColor="@color/white"
-            android:textSize="32sp"
-            android:textStyle="bold" />
+        android:orientation="vertical"
+        android:layout_marginTop="10dp">
 
         <View
             android:layout_width="match_parent"
             android:layout_height="1dp"
-            android:background="@color/white"
-            android:layout_marginTop="10dp" />
+            android:background="@color/white" />
 
         <android.support.v7.widget.RecyclerView
             android:id="@+id/rv_settings_version"