Pārlūkot izejas kodu

Merge branch 'd_f'

shanmulinxi 2 gadi atpakaļ
vecāks
revīzija
f71ba8cf95

+ 6 - 0
app/build.gradle

@@ -36,4 +36,10 @@ dependencies {
     testImplementation 'junit:junit:4.+'
     androidTestImplementation 'androidx.test.ext:junit:1.1.2'
     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+
+    implementation 'com.github.bumptech.glide:glide:4.11.0'
+    implementation 'org.greenrobot:eventbus:3.2.0'
+    implementation 'com.tencent:mmkv-static:1.2.12'
+    // Okhttp库
+    implementation 'com.google.code.gson:gson:2.8.5'
 }

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

@@ -33,6 +33,8 @@
         <activity android:name=".activity.VisitorRegActivity" />
         <activity android:name=".activity.IdcardRegActivity" />
         <activity android:name=".activity.HomeAc" />
+        <activity android:name=".activity.VisitorRegisterAc" />
+        <activity android:name=".activity.SettingAc" />
     </application>
 
 </manifest>

+ 3 - 2
app/src/main/java/com/sunwin/visitorapp/BaseActivity.java

@@ -1,10 +1,11 @@
 package com.sunwin.visitorapp;
 
-import android.app.Activity;
+import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.os.Bundle;
 
+
 import androidx.appcompat.app.AppCompatActivity;
 
 import com.sunwin.visitorapp.utils.AppManager;
@@ -13,7 +14,7 @@ import com.sunwin.visitorapp.view.LoadingDialog;
 public class BaseActivity extends AppCompatActivity {
 
     protected static String TAG = "";
-    protected Activity mContext;
+    protected AppCompatActivity mContext;
     protected LoadingDialog loadingDialog;
 
     @Override

+ 10 - 17
app/src/main/java/com/sunwin/visitorapp/activity/HomeAc.java

@@ -1,27 +1,15 @@
 package com.sunwin.visitorapp.activity;
 
-import android.app.AlertDialog;
-import android.app.FragmentManager;
-import android.app.FragmentTransaction;
-import android.content.DialogInterface;
 import android.content.Intent;
-import android.net.Uri;
 import android.os.Bundle;
-import android.provider.Settings;
 import android.view.View;
-import android.widget.LinearLayout;
 
-import androidx.fragment.app.FragmentContainerView;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
 
 import com.sunwin.visitorapp.BaseActivity;
 import com.sunwin.visitorapp.R;
 import com.sunwin.visitorapp.fragment.HomeFr;
-import com.sunwin.visitorapp.utils.PresentationManager;
-import com.sunwin.visitorapp.view.DisplayWelcome;
-
-import java.util.Timer;
-
-import timber.log.Timber;
 
 public class HomeAc extends BaseActivity {
 
@@ -30,13 +18,16 @@ public class HomeAc extends BaseActivity {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_home);
 
-        FragmentManager fragmentmanager=getFragmentManager();
-        FragmentTransaction fragmentTransaction =fragmentmanager.beginTransaction();
+
+        findViewById(R.id.ImageSetting).setOnClickListener(v -> startActivity(new Intent(mContext,SettingAc.class)));
+
+        FragmentManager fragmentManager = getSupportFragmentManager();
+        FragmentTransaction fragmentTransaction =fragmentManager.beginTransaction();
         //添加fragment
         fragmentTransaction.add(R.id.FragmentView, new HomeFr());
 
         fragmentTransaction.commit();
-        fragmentmanager.executePendingTransactions();
+        fragmentManager.executePendingTransactions();
 
         findViewById(R.id.MenuItemRegister).setOnClickListener(new View.OnClickListener() {
             @Override
@@ -47,6 +38,8 @@ public class HomeAc extends BaseActivity {
 
 
 
+
+
     }
 
     @Override

+ 61 - 0
app/src/main/java/com/sunwin/visitorapp/activity/SettingAc.java

@@ -0,0 +1,61 @@
+package com.sunwin.visitorapp.activity;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.RadioGroup;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+
+import com.sunwin.visitorapp.BaseActivity;
+import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.fragment.HomeFr;
+import com.sunwin.visitorapp.fragment.PageManageFr;
+import com.sunwin.visitorapp.view.UINav;
+
+import static androidx.fragment.app.FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT;
+
+public class SettingAc extends BaseActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.ac_setting);
+        UINav nav = findViewById(R.id.UINav);
+        nav.setData(this,"系统设置");
+
+
+        ViewPager viewPager = findViewById(R.id.ViewPagerSetting);
+        viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager(),BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
+            @NonNull
+            @Override
+            public Fragment getItem(int position) {
+                switch (position){
+                    default:{
+                        return new HomeFr();
+
+                    }
+                    case 5:{
+                        return new PageManageFr();
+                    }
+                }
+
+            }
+
+            @Override
+            public int getCount() {
+                return 6;
+            }
+        });
+        RadioGroup group = findViewById(R.id.RadioView);
+        group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(RadioGroup group, int checkedId) {
+                viewPager.setCurrentItem(group.indexOfChild(group.findViewById(checkedId)),false);
+            }
+        });
+
+    }
+}

+ 1 - 1
app/src/main/java/com/sunwin/visitorapp/fragment/HomeFr.java

@@ -1,6 +1,5 @@
 package com.sunwin.visitorapp.fragment;
 
-import android.app.Fragment;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -8,6 +7,7 @@ import android.view.ViewGroup;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
 
 import com.sunwin.visitorapp.R;
 

+ 24 - 0
app/src/main/java/com/sunwin/visitorapp/fragment/PageManageFr.java

@@ -0,0 +1,24 @@
+package com.sunwin.visitorapp.fragment;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+import com.sunwin.visitorapp.R;
+
+public class PageManageFr  extends Fragment {
+    private View root;
+    @Nullable
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+
+        if(root==null)root = inflater.inflate(R.layout.fr_page_manage,container,false);
+
+        return root;
+    }
+}

+ 17 - 0
app/src/main/res/drawable/card_gary.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <!--设置圆角-->
+    <!--  按顺序分别对应:左下角的角度、右下角的角度、左上角的角度、右上角的角度-->
+    <corners
+        android:bottomLeftRadius="@dimen/Normal_Card_Radius"
+        android:bottomRightRadius="@dimen/Normal_Card_Radius"
+        android:topLeftRadius="@dimen/Normal_Card_Radius"
+        android:topRightRadius="@dimen/Normal_Card_Radius" />
+    <!--设置圆角背景色-->
+    <solid android:color="@color/ColorGray" />
+    <!--  设置边框大小与背景色-->
+    <stroke
+        android:width="2dp"
+        android:color="@color/ColorGray" />
+
+</shape>

+ 41 - 0
app/src/main/res/drawable/card_primary.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_checked="true" android:state_enabled="true">
+        <shape >
+            <!--设置圆角-->
+            <!--  按顺序分别对应:左下角的角度、右下角的角度、左上角的角度、右上角的角度-->
+            <corners
+                android:bottomLeftRadius="@dimen/Normal_Card_Radius"
+                android:bottomRightRadius="@dimen/Normal_Card_Radius"
+                android:topLeftRadius="@dimen/Normal_Card_Radius"
+                android:topRightRadius="@dimen/Normal_Card_Radius" />
+            <!--设置圆角背景色-->
+            <solid android:color="@color/ColorPrimary" />
+            <!--  设置边框大小与背景色-->
+            <stroke
+                android:width="2dp"
+                android:color="@color/ColorPrimary" />
+
+        </shape>
+    </item>
+    <item android:state_checked="false" android:state_enabled="false">
+        <shape >
+            <!--设置圆角-->
+            <!--  按顺序分别对应:左下角的角度、右下角的角度、左上角的角度、右上角的角度-->
+            <corners
+                android:bottomLeftRadius="@dimen/Normal_Card_Radius"
+                android:bottomRightRadius="@dimen/Normal_Card_Radius"
+                android:topLeftRadius="@dimen/Normal_Card_Radius"
+                android:topRightRadius="@dimen/Normal_Card_Radius" />
+            <!--设置圆角背景色-->
+            <solid android:color="@color/ColorGray" />
+            <!--  设置边框大小与背景色-->
+            <stroke
+                android:width="2dp"
+                android:color="@color/ColorGray" />
+
+        </shape>
+    </item>
+</selector>
+

+ 72 - 0
app/src/main/res/layout/ac_setting.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@drawable/login_button_normal">
+
+    <com.sunwin.visitorapp.view.UINav
+        android:id="@+id/UINav"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        android:layout_marginVertical="20dp"
+        android:layout_marginHorizontal="30dp"
+        android:background="@drawable/card_white"
+        >
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:background="@drawable/card_gary"
+            >
+            <RadioGroup
+                android:id="@+id/RadioView"
+                android:orientation="vertical"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content">
+
+                <RadioButton
+                    android:id="@+id/RadioBlackList"
+                    android:text="黑名单库"
+                    style="@style/Setting_Tab_Item_View"/>
+                <RadioButton
+                    android:id="@+id/RadioUserManage"
+                    android:text="用户管理"
+                    style="@style/Setting_Tab_Item_View"/>
+                <RadioButton
+                    android:id="@+id/RadioRoleManage"
+                    android:text="角色管理"
+                    style="@style/Setting_Tab_Item_View"/>
+                <RadioButton
+                    android:id="@+id/RadioLogManage"
+                    android:text="日志管理"
+                    style="@style/Setting_Tab_Item_View"/>
+                <RadioButton
+                    android:id="@+id/RadioSystemManage"
+                    android:text="系统设置"
+                    style="@style/Setting_Tab_Item_View"/>
+                <RadioButton
+                    android:id="@+id/RadioPageManage"
+                    android:text="页面管理"
+                    style="@style/Setting_Tab_Item_View"/>
+            </RadioGroup>
+
+        </LinearLayout>
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1">
+            <androidx.viewpager.widget.ViewPager
+                android:id="@+id/ViewPagerSetting"
+                android:isScrollContainer="false"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"/>
+        </LinearLayout>
+    </LinearLayout>
+</LinearLayout>

+ 68 - 0
app/src/main/res/layout/fr_page_manage.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingHorizontal="20dp"
+    >
+
+    <LinearLayout
+        android:layout_marginVertical="10dp"
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:gravity="center_vertical"
+        android:layout_height="wrap_content">
+        <TextView
+            style="@style/StyleTextContent"
+            android:layout_width="200dp"
+            android:text="登录页面"
+            />
+        <EditText
+            android:layout_weight="1"
+            android:layout_width="0dp"
+            style="@style/StyleInputContent"
+            android:layout_height="wrap_content"/>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_marginVertical="10dp"
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:gravity="center_vertical"
+        android:layout_height="wrap_content">
+        <TextView
+            style="@style/StyleTextContent"
+            android:layout_width="200dp"
+            android:text="副屏页面"
+            />
+        <EditText
+            android:layout_weight="1"
+            android:layout_width="0dp"
+            style="@style/StyleInputContent"
+            android:layout_height="wrap_content"/>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_marginVertical="10dp"
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:gravity="center_vertical"
+        android:layout_height="wrap_content">
+        <TextView
+            style="@style/StyleTextContent"
+            android:layout_width="200dp"
+            android:text="待机图片"
+            />
+        <LinearLayout
+            android:layout_weight="1"
+            android:orientation="vertical"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content">
+            <Button
+                android:text="添加图片"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
+            <androidx.recyclerview.widget.RecyclerView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"/>
+        </LinearLayout>
+    </LinearLayout>
+</LinearLayout>

+ 10 - 0
app/src/main/res/values/style.xml

@@ -86,4 +86,14 @@
         <item name="android:textSize">25sp</item>
         <item name="android:textColor">@color/NormalTextColorBlack</item>
     </style>
+    <style name="Setting_Tab_Item_View" parent="StyleTextLarge">
+
+        <item name="android:button">@null</item>
+        <item name="android:background">@drawable/card_primary</item>
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:paddingVertical">12dp</item>
+        <item name="android:paddingHorizontal">25dp</item>
+
+    </style>
 </resources>