cs 9 сар өмнө
parent
commit
faa7f68bf4

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

@@ -12,9 +12,8 @@
     <application
         android:name="MyApp"
         android:allowBackup="true"
-        android:icon="@mipmap/ic_launcher"
+        android:icon="@mipmap/logo"
         android:label="@string/app_name"
-        android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:requestLegacyExternalStorage="true"
         android:theme="@style/AppTheme">

+ 8 - 3
app/src/main/java/org/las2mile/scrcpy/MainActivity.java

@@ -68,6 +68,7 @@ import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
 import org.las2mile.okio.message.req.LogFileMsgReq;
+import android.text.TextUtils;
 
 
 public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCallbacks, SensorEventListener {
@@ -317,7 +318,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
     }
 
     private void hideProgress(){
-        if(mainProgressDialog.isShowing()){
+        if(mainProgressDialog != null && mainProgressDialog.isShowing()){
             mainProgressDialog.dismiss();
         }
     }
@@ -342,7 +343,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
         startButton.setOnClickListener(v -> {
             local_ip = wifiIpAddress();
             getAttributes();
-            if (!serverAdr.isEmpty()) {
+            if ((!serverAdr.isEmpty())&& (!TextUtils.isEmpty(serverPort))) {
                 //原生逻辑
                 // if (sendCommands.SendAdbCommands(context, fileBase64, serverAdr, Integer.parseInt(serverPort), local_ip, videoBitrate, Math.max(screenHeight, screenWidth)) == 0) {
                 //     start_screen_copy_magic();
@@ -355,7 +356,7 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
                     mainHandler.sendEmptyMessage(ADB_CONNECT_START);
                 }
             } else {
-                Toast.makeText(context, "Server Address Empty", Toast.LENGTH_SHORT).show();
+                Toast.makeText(context, "Server Port Empty", Toast.LENGTH_SHORT).show();
             }
         });
         get_saved_preferences();
@@ -470,6 +471,10 @@ public class MainActivity extends FragmentActivity implements Scrcpy.ServiceCall
 
         final EditText editTextServerHost = findViewById(R.id.editText_server_host);
         serverAdr = editTextServerHost.getText().toString();
+        Log.e("Scrcpy1","getAttributes "+serverAdr);
+        if(TextUtils.isEmpty(serverAdr)){
+            serverAdr = "192.168.43.1";
+        }
 	final EditText editTextServerPort = findViewById(R.id.editText_server_port);
         serverPort = editTextServerPort.getText().toString();
 	context.getSharedPreferences(PREFERENCE_KEY, 0).edit().putString("Server Port", serverPort).apply();

+ 7 - 2
app/src/main/res/layout/activity_main.xml

@@ -10,7 +10,7 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="100dp"
+        android:layout_marginTop="10dp"
         android:orientation="vertical">
 
 
@@ -18,6 +18,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="20dp"
+            android:visibility="gone"
             android:text="@string/label_server_ip"
             android:textAppearance="@android:style/TextAppearance" />
 
@@ -26,6 +27,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:hint="192.168.43.1"
+            android:visibility="gone"
             android:maxLength="15"
             android:ems="7"
             android:inputType="text"
@@ -132,11 +134,14 @@
             android:text="@string/action_start"
             android:textSize="30sp" />
     </LinearLayout>
+    <View android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"/>
     <TextView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
-        android:text="恺恩公司郑重声明:本软件仅允许用于调试恺恩公司的硬件产品。它用后果自负。"/>
+        android:text="恺恩公司郑重声明:仅允许恺恩公司员工使用此软件调试本公司的硬件产品。它用后果自负。"/>
     <TextView
         android:id="@+id/app_ver_right"
         android:layout_width="match_parent"

+ 1 - 1
app/src/main/res/layout/float_layout.xml

@@ -6,5 +6,5 @@
         android:id="@+id/img_show_content"
         android:layout_width="48dp"
         android:layout_height="48dp"
-        android:src="@mipmap/ic_launcher"/>
+        android:src="@mipmap/logo"/>
 </LinearLayout>

BIN
app/src/main/res/mipmap-xxxhdpi/logo.png