From 2d59432be777f704085b761d6c92384125ef9342 Mon Sep 17 00:00:00 2001 From: panqihua <1029559041@qq.com> Date: Wed, 25 Mar 2020 06:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BF=E5=AE=A2=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- .../main/ui/dashboard/DashboardFragment.java | 15 ------ .../visitor/VisitorAppointmentFragment.java | 18 +++++++ .../visitor/VisitorAppointmentViewModel.java | 7 +++ .../ui/main/ui/visitor/VisitorFragment.java | 53 +++++++++++++++++++ .../ui/main/ui/visitor/VisitorMyFragment.java | 18 +++++++ .../main/ui/visitor/VisitorMyViewModel.java | 7 +++ .../visitor/VisitorReservationFragment.java | 18 +++++++ .../visitor/VisitorReservationViewModel.java | 7 +++ .../VisitorViewModel.java} | 6 +-- .../layout/main/layout/activity_main_menu.xml | 2 +- .../{titlebar.xml => form_titlebar.xml} | 0 .../layout/main/layout/forum/layout/forum.xml | 2 +- .../layout/main/layout/fragment_dashboard.xml | 22 -------- .../main/layout/visitor/layout/visitor.xml | 28 ++++++++++ .../layout/visitor_appointment_fragment.xml | 13 +++++ .../visitor/layout/visitor_my_fragment.xml | 13 +++++ .../layout/visitor_reservation_fragment.xml | 13 +++++ .../visitor/layout/visitor_titlebar.xml | 43 +++++++++++++++ ...mobile_navigation.xml => nav_mainmenu.xml} | 4 +- .../res/navigation/visitor_navigation.xml | 24 +++++++++ app/src/main/res/values-en-rUS/strings.xml | 3 ++ app/src/main/res/values-zh-rCN/strings.xml | 3 ++ app/src/main/res/values/strings.xml | 3 ++ 24 files changed, 279 insertions(+), 45 deletions(-) delete mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardFragment.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentFragment.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentViewModel.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorFragment.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyFragment.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyViewModel.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationFragment.java create mode 100644 app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationViewModel.java rename app/src/main/java/com/community/pocket/ui/main/ui/{dashboard/DashboardViewModel.java => visitor/VisitorViewModel.java} (70%) rename app/src/main/res/layout/main/layout/forum/layout/{titlebar.xml => form_titlebar.xml} (100%) delete mode 100644 app/src/main/res/layout/main/layout/fragment_dashboard.xml create mode 100644 app/src/main/res/layout/main/layout/visitor/layout/visitor.xml create mode 100644 app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml create mode 100644 app/src/main/res/layout/main/layout/visitor/layout/visitor_my_fragment.xml create mode 100644 app/src/main/res/layout/main/layout/visitor/layout/visitor_reservation_fragment.xml create mode 100644 app/src/main/res/layout/main/layout/visitor/layout/visitor_titlebar.xml rename app/src/main/res/navigation/{mobile_navigation.xml => nav_mainmenu.xml} (88%) create mode 100644 app/src/main/res/navigation/visitor_navigation.xml diff --git a/app/build.gradle b/app/build.gradle index 535de31..a9b6039 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,7 +23,7 @@ android { sourceSets { main { res { - srcDirs 'src/main/res', 'src/main/res/layout/resetpwd', 'src/main/res/layout/resetpwd/layout', 'src/main/res/layout/main', 'src/main/res/layout/main/layout', 'src/main/res/layout/main/layout/forum', 'src/main/res/layout/main/layout/forum/layout' + srcDirs 'src/main/res', 'src/main/res/layout/resetpwd', 'src/main/res/layout/resetpwd/layout', 'src/main/res/layout/main', 'src/main/res/layout/main/layout', 'src/main/res/layout/main/layout/forum', 'src/main/res/layout/main/layout/forum/layout', 'src/main/res/layout/main/layout/visitor', 'src/main/res/layout/main/layout/visitor/layout' } } } diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardFragment.java b/app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardFragment.java deleted file mode 100644 index 9327501..0000000 --- a/app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardFragment.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.community.pocket.ui.main.ui.dashboard; - -import com.community.pocket.R; -import com.community.pocket.ui.main.TestMainFragment; - -import org.xutils.view.annotation.ContentView; - - -@ContentView(R.layout.fragment_dashboard) -public class DashboardFragment extends TestMainFragment { - @Override - protected int viewId() { - return R.id.text_dashboard; - } -} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentFragment.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentFragment.java new file mode 100644 index 0000000..cf705d0 --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentFragment.java @@ -0,0 +1,18 @@ +package com.community.pocket.ui.main.ui.visitor; + +import com.community.pocket.R; +import com.community.pocket.ui.main.TestMainFragment; + +import org.xutils.view.annotation.ContentView; + +/** + * 访客预约界面 + */ +@ContentView(R.layout.visitor_appointment_fragment) +public class VisitorAppointmentFragment extends TestMainFragment { + + @Override + protected int viewId() { + return R.id.text_apppointment; + } +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentViewModel.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentViewModel.java new file mode 100644 index 0000000..7115ab3 --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentViewModel.java @@ -0,0 +1,7 @@ +package com.community.pocket.ui.main.ui.visitor; + +import androidx.lifecycle.ViewModel; + +public class VisitorAppointmentViewModel extends ViewModel { + // TODO: Implement the ViewModel +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorFragment.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorFragment.java new file mode 100644 index 0000000..0810e3b --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorFragment.java @@ -0,0 +1,53 @@ +package com.community.pocket.ui.main.ui.visitor; + +import android.os.Build; +import android.view.View; + +import androidx.annotation.RequiresApi; + +import com.community.pocket.R; +import com.community.pocket.ui.main.MainFragment; + +import org.xutils.view.annotation.ContentView; +import org.xutils.view.annotation.Event; + +/** + * 访客框架 + */ +@ContentView(R.layout.visitor) +public class VisitorFragment extends MainFragment { + + //跳转到访客预约界面 + @RequiresApi(api = Build.VERSION_CODES.KITKAT) + @Event(value = R.id.visitor_appointment) + private void appointment(View view) { + ctrl().navigate(R.id.visitorAppointmentFragment); + changeColor(view); + } + + //跳转到我的预约界面 + @Event(value = R.id.visitor_reservation) + @RequiresApi(api = Build.VERSION_CODES.KITKAT) + private void reservation(View view) { + ctrl().navigate(R.id.visitorReservationFragment); + changeColor(view); + } + + //跳转到我的访客界面 + @RequiresApi(api = Build.VERSION_CODES.KITKAT) + @Event(value = R.id.visitor_visitor) + private void my(View view) { + ctrl().navigate(R.id.visitorMyFragment); + changeColor(view); + } + + @Override + protected int fragmentId() { + return R.id.fragment; + } + + @Override + protected int[] button_ids() { + return new int[]{R.id.visitor_appointment, R.id.visitor_reservation, R.id.visitor_visitor}; + } +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyFragment.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyFragment.java new file mode 100644 index 0000000..abe7d83 --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyFragment.java @@ -0,0 +1,18 @@ +package com.community.pocket.ui.main.ui.visitor; + +import com.community.pocket.R; +import com.community.pocket.ui.main.TestMainFragment; + +import org.xutils.view.annotation.ContentView; + +/** + * 我的访客界面 + */ +@ContentView(R.layout.visitor_my_fragment) +public class VisitorMyFragment extends TestMainFragment { + + @Override + protected int viewId() { + return R.id.text_visitor; + } +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyViewModel.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyViewModel.java new file mode 100644 index 0000000..7f5a618 --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyViewModel.java @@ -0,0 +1,7 @@ +package com.community.pocket.ui.main.ui.visitor; + +import androidx.lifecycle.ViewModel; + +public class VisitorMyViewModel extends ViewModel { + // TODO: Implement the ViewModel +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationFragment.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationFragment.java new file mode 100644 index 0000000..87a6145 --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationFragment.java @@ -0,0 +1,18 @@ +package com.community.pocket.ui.main.ui.visitor; + +import com.community.pocket.R; +import com.community.pocket.ui.main.TestMainFragment; + +import org.xutils.view.annotation.ContentView; + +/** + * 我的预约界面 + */ +@ContentView(R.layout.visitor_reservation_fragment) +public class VisitorReservationFragment extends TestMainFragment { + + @Override + protected int viewId() { + return R.id.text_reservation; + } +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationViewModel.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationViewModel.java new file mode 100644 index 0000000..0c337de --- /dev/null +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationViewModel.java @@ -0,0 +1,7 @@ +package com.community.pocket.ui.main.ui.visitor; + +import androidx.lifecycle.ViewModel; + +public class VisitorReservationViewModel extends ViewModel { + // TODO: Implement the ViewModel +} diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardViewModel.java b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorViewModel.java similarity index 70% rename from app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardViewModel.java rename to app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorViewModel.java index f644580..f6de588 100644 --- a/app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardViewModel.java +++ b/app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorViewModel.java @@ -1,14 +1,14 @@ -package com.community.pocket.ui.main.ui.dashboard; +package com.community.pocket.ui.main.ui.visitor; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; -public class DashboardViewModel extends ViewModel { +public class VisitorViewModel extends ViewModel { private MutableLiveData mText; - public DashboardViewModel() { + public VisitorViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is dashboard fragment"); } diff --git a/app/src/main/res/layout/main/layout/activity_main_menu.xml b/app/src/main/res/layout/main/layout/activity_main_menu.xml index 85ba01d..de5cba3 100644 --- a/app/src/main/res/layout/main/layout/activity_main_menu.xml +++ b/app/src/main/res/layout/main/layout/activity_main_menu.xml @@ -26,7 +26,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@id/titlebar" - app:navGraph="@navigation/mobile_navigation" + app:navGraph="@navigation/nav_mainmenu" tools:ignore="FragmentTagUsage" /> diff --git a/app/src/main/res/layout/main/layout/fragment_dashboard.xml b/app/src/main/res/layout/main/layout/fragment_dashboard.xml deleted file mode 100644 index 1bfbe37..0000000 --- a/app/src/main/res/layout/main/layout/fragment_dashboard.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/main/layout/visitor/layout/visitor.xml b/app/src/main/res/layout/main/layout/visitor/layout/visitor.xml new file mode 100644 index 0000000..256f641 --- /dev/null +++ b/app/src/main/res/layout/main/layout/visitor/layout/visitor.xml @@ -0,0 +1,28 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml b/app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml new file mode 100644 index 0000000..49f53b3 --- /dev/null +++ b/app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/main/layout/visitor/layout/visitor_my_fragment.xml b/app/src/main/res/layout/main/layout/visitor/layout/visitor_my_fragment.xml new file mode 100644 index 0000000..5c6c477 --- /dev/null +++ b/app/src/main/res/layout/main/layout/visitor/layout/visitor_my_fragment.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/main/layout/visitor/layout/visitor_reservation_fragment.xml b/app/src/main/res/layout/main/layout/visitor/layout/visitor_reservation_fragment.xml new file mode 100644 index 0000000..e4e6101 --- /dev/null +++ b/app/src/main/res/layout/main/layout/visitor/layout/visitor_reservation_fragment.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/main/layout/visitor/layout/visitor_titlebar.xml b/app/src/main/res/layout/main/layout/visitor/layout/visitor_titlebar.xml new file mode 100644 index 0000000..f12b57b --- /dev/null +++ b/app/src/main/res/layout/main/layout/visitor/layout/visitor_titlebar.xml @@ -0,0 +1,43 @@ + + + +