liuzhenxing 3 年之前
父节点
当前提交
eededf8afb

+ 3 - 0
.idea/misc.xml

@@ -7,10 +7,12 @@
         <entry key="app/src/main/res/drawable-xhdpi/button_shape.xml" value="0.124" />
         <entry key="app/src/main/res/drawable/view_shape.xml" value="0.112" />
         <entry key="app/src/main/res/drawable/xp_checkbox.xml" value="0.112" />
+        <entry key="app/src/main/res/layout/activity_apn_delete.xml" value="0.19300911854103345" />
         <entry key="app/src/main/res/layout/activity_change_progress.xml" value="0.1" />
         <entry key="app/src/main/res/layout/activity_display.xml" value="0.11610486891385768" />
         <entry key="app/src/main/res/layout/activity_list.xml" value="0.19300911854103345" />
         <entry key="app/src/main/res/layout/activity_main.xml" value="0.3546195652173913" />
+        <entry key="app/src/main/res/layout/activity_qr.xml" value="0.19300911854103345" />
         <entry key="app/src/main/res/layout/activity_wifi_login.xml" value="0.16236068895643363" />
         <entry key="app/src/main/res/layout/bright_activity.xml" value="0.1889564336372847" />
         <entry key="app/src/main/res/layout/display_activity.xml" value="0.20199275362318841" />
@@ -26,6 +28,7 @@
         <entry key="app/src/main/res/layout/item_progress_title.xml" value="0.17307692307692307" />
         <entry key="app/src/main/res/layout/item_progress_title_subtitle.xml" value="0.1331521739130435" />
         <entry key="app/src/main/res/layout/item_refresh.xml" value="0.1" />
+        <entry key="app/src/main/res/layout/item_sure.xml" value="0.1" />
         <entry key="app/src/main/res/layout/item_switch.xml" value="0.20199275362318841" />
         <entry key="app/src/main/res/layout/item_textfield.xml" value="0.16236068895643363" />
         <entry key="app/src/main/res/layout/item_title.xml" value="0.25769927536231885" />

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

@@ -143,6 +143,10 @@
             android:name=".Activity.ApnEditActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:launchMode="standard" />
+        <activity
+            android:name=".Activity.ApnDeleteActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:launchMode="standard" />
     </application>
 
 </manifest>

+ 81 - 0
app/src/main/java/com/xplora/xpsettings/Activity/ApnDeleteActivity.java

@@ -0,0 +1,81 @@
+package com.xplora.xpsettings.Activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+
+import com.xplora.xpsettings.Adapter.BaseListAdapter;
+import com.xplora.xpsettings.DataManager;
+import com.xplora.xpsettings.Model.ApnModel;
+import com.xplora.xpsettings.Model.BaseModel;
+import com.xplora.xpsettings.R;
+import com.xplora.xpsettings.Utils.Constant;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ApnDeleteActivity extends BaseActivity {
+    public int mIndex = 0;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_apn_delete);
+        initData();
+        initView();
+    }
+
+    private void initData() {
+        mIndex = getIntent().getIntExtra(Constant.INENT_LIST_INDEX, 0);
+    }
+
+    private void initView() {
+        TextView textView = findViewById(R.id.text_content);
+        Button cancelButton = findViewById(R.id.button_cancel);
+        Button sureButton = findViewById(R.id.button_sure);
+
+        if (textView != null) {
+            textView.setText(R.string.apn_delete_content);
+        }
+
+        if (cancelButton != null) {
+            cancelButton.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    clickCancelButton();
+                }
+            });
+        }
+        if (sureButton != null) {
+            sureButton.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    clickSureButton();
+                }
+            });
+        }
+    }
+
+    public void clickCancelButton() {
+        Intent intent = new Intent();
+        intent.setAction(Constant.INENT_RESULT_ACTION_CANCEL);
+        setResult(RESULT_OK, intent);
+        finish();
+    }
+
+    public void clickSureButton() {
+        Intent intent = new Intent();
+        intent.setAction(Constant.INENT_RESULT_ACTION_REMOVE);
+        intent.putExtra(Constant.INENT_RESULT_VALUE, mIndex);
+        setResult(RESULT_OK, intent);
+        finish();
+    }
+}

+ 11 - 2
app/src/main/java/com/xplora/xpsettings/Activity/ApnListActivity.java

@@ -85,8 +85,8 @@ public class ApnListActivity extends BaseActivity {
         listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                Intent intent = new Intent(ApnListActivity.this, CameraResolutionActivity.class);
-                intent.putExtra(Constant.INENT_VIEW_TYPE, position);
+                Intent intent = new Intent(ApnListActivity.this, ApnDeleteActivity.class);
+                intent.putExtra(Constant.INENT_LIST_INDEX, position);
                 startActivityForResult(intent, 0);
             }
         });
@@ -107,6 +107,15 @@ public class ApnListActivity extends BaseActivity {
             initView();
             mAdapter.setBaseObjects(mDataList);
             mAdapter.notifyDataSetInvalidated();
+        } else if (data.getAction().equals(Constant.INENT_RESULT_ACTION_REMOVE)) {
+            int index = data.getIntExtra(Constant.INENT_RESULT_VALUE, -1);
+            if (index >= 0 && index <= mApnList.size()-1) {
+                mApnList.remove(index);
+                mDataList.remove(index);
+                initView();
+                mAdapter.setBaseObjects(mDataList);
+                mAdapter.notifyDataSetInvalidated();
+            }
         }
     }
 }

+ 2 - 0
app/src/main/java/com/xplora/xpsettings/Utils/Constant.java

@@ -9,8 +9,10 @@ public class Constant {
 
     public static String PACKAGE_NAME = "com.xplora.xpsettings";
     public static String INENT_VIEW_TYPE = "inent_view_type";
+    public static String INENT_LIST_INDEX = "inent_list_index";
     public static String INENT_RESULT_ACTION = "inent_result_action";
     public static String INENT_RESULT_ACTION_CANCEL = "inent_result_action_cancel";
+    public static String INENT_RESULT_ACTION_REMOVE = "inent_result_action_remove";
     public static String INENT_RESULT_VALUE = "inent_result_value";
 
     public static final int MSG_SWITCHC_CHANGE = 0;

+ 56 - 0
app/src/main/res/layout/activity_apn_delete.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/text_content"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerHorizontal="true"
+        android:layout_marginTop="65dp"
+        android:textSize="12sp"
+        android:textFontWeight="400"
+        android:textColor="#FFFFFFFF"
+        android:fontFamily="Roboto"
+        android:textAlignment="center"
+        />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:layout_alignParentBottom="true"
+        android:layout_marginBottom="10dp"
+        >
+        <Button
+            android:id="@+id/button_cancel"
+            android:layout_width="85dp"
+            android:layout_height="28dp"
+            android:layout_alignParentStart="true"
+            android:layout_centerVertical="true"
+            android:text="@string/button_cancel"
+            android:textSize="12sp"
+            android:textFontWeight="700"
+            android:fontFamily="Roboto"
+            android:paddingRight="15dp"
+            android:backgroundTint="@color/xp_red"
+            style="@style/xp_style_button_right"
+            />
+
+        <Button
+            android:id="@+id/button_sure"
+            android:layout_width="85dp"
+            android:layout_height="28dp"
+            android:layout_alignParentEnd="true"
+            android:layout_centerVertical="true"
+            android:text="@string/button_yes"
+            android:textSize="12sp"
+            android:textFontWeight="700"
+            android:fontFamily="Roboto"
+            android:paddingLeft="15dp"
+            android:backgroundTint="@color/xp_green"
+            style="@style/xp_style_button_left"
+            />
+    </RelativeLayout>
+
+</RelativeLayout>

+ 27 - 0
app/src/main/res/layout/item_sure.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp">
+
+        <Button
+            android:id="@+id/button_sure"
+            android:layout_width="85dp"
+            android:layout_height="28dp"
+            android:layout_centerInParent="true"
+            android:text="@string/button_yes"
+            android:textSize="12sp"
+            android:textFontWeight="700"
+            android:fontFamily="Roboto"
+            android:paddingLeft="15dp"
+            android:backgroundTint="@color/xp_green"
+            style="@style/xp_style_button_left"
+            />
+
+    </RelativeLayout>
+
+</RelativeLayout>

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

@@ -36,4 +36,5 @@
     <string name="app_name_status_hint">When turned on, \n will display the watch app name</string>
 
     <string name="apn_hint">Please tap “+” to add \n new APN</string>
+    <string name="apn_delete_content">Really want to delete this APN?</string>
 </resources>