diff --git a/app/src/main/java/com/xypower/mpapp/ChannelActivity.java b/app/src/main/java/com/xypower/mpapp/ChannelActivity.java index fe5c9206..7924e846 100644 --- a/app/src/main/java/com/xypower/mpapp/ChannelActivity.java +++ b/app/src/main/java/com/xypower/mpapp/ChannelActivity.java @@ -173,6 +173,21 @@ public class ChannelActivity extends AppCompatActivity { } else { binding.quality.setText(""); } + if (jsonObject.has("videoCX")) { + binding.videoCX.setText(Integer.toString(jsonObject.optInt("videoCX"))); + } else { + binding.videoCX.setText(""); + } + if (jsonObject.has("videoCY")) { + binding.videoCY.setText(Integer.toString(jsonObject.optInt("videoCY"))); + } else { + binding.videoCY.setText(""); + } + if (jsonObject.has("videoDuration")) { + binding.videoDuration.setText(Integer.toString(jsonObject.optInt("videoDuration"))); + } else { + binding.videoDuration.setText(""); + } JSONObject osdJsonObj = jsonObject.optJSONObject("osd"); if (osdJsonObj != null) { @@ -236,6 +251,22 @@ public class ChannelActivity extends AppCompatActivity { jsonObject.remove("quality"); } + if (!TextUtils.isEmpty(binding.videoCX.getText().toString())) { + jsonObject.put("videoCX", Integer.parseInt(binding.videoCX.getText().toString())); + } else { + jsonObject.remove("videoCX"); + } + if (!TextUtils.isEmpty(binding.videoCY.getText().toString())) { + jsonObject.put("videoCY", Integer.parseInt(binding.videoCY.getText().toString())); + } else { + jsonObject.remove("videoCY"); + } + if (!TextUtils.isEmpty(binding.videoDuration.getText().toString())) { + jsonObject.put("videoDuration", Integer.parseInt(binding.videoDuration.getText().toString())); + } else { + jsonObject.remove("videoDuration"); + } + JSONObject osdJsonObj = jsonObject.optJSONObject("osd"); if (osdJsonObj == null) { osdJsonObj = jsonObject.put("osd", new JSONObject()); diff --git a/app/src/main/res/layout/activity_channel.xml b/app/src/main/res/layout/activity_channel.xml index b0c606f2..e57dd154 100644 --- a/app/src/main/res/layout/activity_channel.xml +++ b/app/src/main/res/layout/activity_channel.xml @@ -12,8 +12,8 @@ android:layout_height="wrap_content" style="@style/Widget.AppCompat.Spinner.Underlined" android:entries="@array/channels" - android:layout_marginStart="12dp" - android:layout_marginTop="12dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -23,9 +23,9 @@ android:layout_height="wrap_content" android:ems="10" android:hint="@string/channel_cfg_camera_id" - android:inputType="numberDecimal" - android:layout_marginStart="6dp" - android:layout_marginTop="6dp" + android:inputType="none|numberDecimal" + android:layout_marginStart="@dimen/activity_horizontal_margin_small" + android:layout_marginTop="@dimen/activity_vertical_margin" app:layout_constraintStart_toEndOf="@+id/channels" app:layout_constraintTop_toTopOf="@+id/channels" app:layout_constraintBottom_toBottomOf="@+id/channels" /> @@ -34,8 +34,8 @@ android:id="@+id/btnUsbCamera" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="12dp" - android:layout_marginTop="6dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" android:text="@string/channel_cfg_usb_camera" app:layout_constraintStart_toEndOf="@+id/cameraId" app:layout_constraintTop_toTopOf="@+id/cameraId" /> @@ -44,33 +44,33 @@ android:id="@+id/btnSave" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="12dp" - android:layout_marginTop="6dp" + android:layout_marginEnd="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" android:text="@string/btn_save" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -80,18 +80,42 @@ android:layout_height="wrap_content" android:ems="10" android:hint="@string/channel_cfg_quality" - android:inputType="numberDecimal" - android:layout_marginStart="12dp" - android:layout_marginTop="12dp" + android:inputType="none|numberDecimal" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" app:layout_constraintStart_toEndOf="@+id/resolutionCY" app:layout_constraintTop_toBottomOf="@+id/btnSave" /> + + + + @@ -100,8 +124,8 @@ android:id="@+id/btnAutoFocus" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="12dp" - android:layout_marginTop="6dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:text="@string/channel_cfg_auto_focus" app:layout_constraintStart_toEndOf="@+id/btnAutoExplosure" app:layout_constraintTop_toBottomOf="@+id/resolutionCX" /> @@ -110,8 +134,8 @@ android:id="@+id/btnHdrMode" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="12dp" - android:layout_marginTop="6dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:text="HDR" app:layout_constraintStart_toEndOf="@+id/btnAutoFocus" app:layout_constraintTop_toBottomOf="@+id/resolutionCX" /> @@ -120,8 +144,8 @@ android:id="@+id/btnNightMode" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="12dp" - android:layout_marginTop="6dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:text="Night" app:layout_constraintStart_toEndOf="@+id/btnHdrMode" app:layout_constraintTop_toBottomOf="@+id/resolutionCX" /> @@ -131,7 +155,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="曝光时间(ms)" - android:layout_marginStart="12dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@+id/exposuretime" app:layout_constraintBottom_toBottomOf="@+id/exposuretime" /> @@ -141,9 +165,9 @@ android:layout_width="120dp" android:layout_height="wrap_content" android:ems="10" - android:inputType="numberDecimal" - android:layout_marginStart="6dp" - android:layout_marginTop="12dp" + android:inputType="none|numberDecimal" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" app:layout_constraintStart_toEndOf="@+id/textViewExplosure" app:layout_constraintTop_toBottomOf="@+id/btnAutoExplosure" /> @@ -152,7 +176,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ISO" - android:layout_marginStart="12dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" app:layout_constraintStart_toEndOf="@+id/exposuretime" app:layout_constraintTop_toTopOf="@+id/exposuretime" app:layout_constraintBottom_toBottomOf="@+id/exposuretime" /> @@ -162,18 +186,30 @@ android:layout_width="96dp" android:layout_height="wrap_content" android:ems="10" - android:inputType="numberDecimal" - android:layout_marginStart="4dp" + android:inputType="none|numberDecimal" + android:layout_marginStart="@dimen/activity_horizontal_margin" app:layout_constraintStart_toEndOf="@+id/textViewSensitivity" app:layout_constraintTop_toTopOf="@+id/exposuretime" app:layout_constraintBottom_toBottomOf="@+id/exposuretime" /> + + @@ -184,8 +220,8 @@ android:layout_height="wrap_content" style="@style/Widget.AppCompat.Spinner.Underlined" android:entries="@array/orientations" - android:layout_marginStart="6dp" - android:layout_marginTop="12dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" app:layout_constraintStart_toEndOf="@+id/textViewOrientations" app:layout_constraintTop_toBottomOf="@+id/exposuretime" /> @@ -195,7 +231,7 @@ android:layout_height="wrap_content" style="@style/Widget.AppCompat.Spinner.Underlined" android:entries="@array/recog_options" - android:layout_marginStart="6dp" + android:layout_marginStart="@dimen/activity_horizontal_margin" app:layout_constraintStart_toEndOf="@+id/orientations" app:layout_constraintTop_toTopOf="@+id/orientations" /> @@ -204,10 +240,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" - android:inputType="text" - android:layout_marginStart="12dp" - android:layout_marginEnd="12dp" - android:layout_marginTop="6dp" + android:inputType="none|text" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginEnd="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:hint="@string/osd_left_top" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -218,10 +254,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" - android:inputType="text" - android:layout_marginStart="12dp" - android:layout_marginEnd="12dp" - android:layout_marginTop="6dp" + android:inputType="none|text" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginEnd="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:hint="@string/osd_right_top" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -232,10 +268,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" - android:inputType="text" - android:layout_marginStart="12dp" - android:layout_marginEnd="12dp" - android:layout_marginTop="6dp" + android:inputType="none|text" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginEnd="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:hint="@string/osd_right_bottom" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -246,10 +282,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" - android:inputType="text" - android:layout_marginStart="12dp" - android:layout_marginEnd="12dp" - android:layout_marginTop="6dp" + android:inputType="none|text" + android:layout_marginStart="@dimen/activity_horizontal_margin" + android:layout_marginEnd="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin_small" android:hint="@string/osd_left_bottom" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6f9426a5..4d0baef7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,8 +35,11 @@ 自动对焦 照片宽 照片高 + 短视频宽 + 短视频高 压缩率(50-100) USB Camera + 短视频时长(分) Hello blank fragment Record