添加访客管理框架

0515
panqihua 5 years ago
parent baea25e6dc
commit 2d59432be7
  1. 2
      app/build.gradle
  2. 15
      app/src/main/java/com/community/pocket/ui/main/ui/dashboard/DashboardFragment.java
  3. 18
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentFragment.java
  4. 7
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorAppointmentViewModel.java
  5. 53
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorFragment.java
  6. 18
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyFragment.java
  7. 7
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorMyViewModel.java
  8. 18
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationFragment.java
  9. 7
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorReservationViewModel.java
  10. 6
      app/src/main/java/com/community/pocket/ui/main/ui/visitor/VisitorViewModel.java
  11. 2
      app/src/main/res/layout/main/layout/activity_main_menu.xml
  12. 0
      app/src/main/res/layout/main/layout/forum/layout/form_titlebar.xml
  13. 2
      app/src/main/res/layout/main/layout/forum/layout/forum.xml
  14. 22
      app/src/main/res/layout/main/layout/fragment_dashboard.xml
  15. 28
      app/src/main/res/layout/main/layout/visitor/layout/visitor.xml
  16. 13
      app/src/main/res/layout/main/layout/visitor/layout/visitor_appointment_fragment.xml
  17. 13
      app/src/main/res/layout/main/layout/visitor/layout/visitor_my_fragment.xml
  18. 13
      app/src/main/res/layout/main/layout/visitor/layout/visitor_reservation_fragment.xml
  19. 43
      app/src/main/res/layout/main/layout/visitor/layout/visitor_titlebar.xml
  20. 4
      app/src/main/res/navigation/nav_mainmenu.xml
  21. 24
      app/src/main/res/navigation/visitor_navigation.xml
  22. 3
      app/src/main/res/values-en-rUS/strings.xml
  23. 3
      app/src/main/res/values-zh-rCN/strings.xml
  24. 3
      app/src/main/res/values/strings.xml

@ -23,7 +23,7 @@ android {
sourceSets { sourceSets {
main { main {
res { 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'
} }
} }
} }

@ -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;
}
}

@ -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;
}
}

@ -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
}

@ -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};
}
}

@ -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;
}
}

@ -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
}

@ -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;
}
}

@ -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
}

@ -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.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
public class DashboardViewModel extends ViewModel { public class VisitorViewModel extends ViewModel {
private MutableLiveData<String> mText; private MutableLiveData<String> mText;
public DashboardViewModel() { public VisitorViewModel() {
mText = new MutableLiveData<>(); mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment"); mText.setValue("This is dashboard fragment");
} }

@ -26,7 +26,7 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/titlebar" app:layout_constraintTop_toBottomOf="@id/titlebar"
app:navGraph="@navigation/mobile_navigation" app:navGraph="@navigation/nav_mainmenu"
tools:ignore="FragmentTagUsage" /> tools:ignore="FragmentTagUsage" />
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView

@ -8,7 +8,7 @@
<include <include
android:id="@+id/titlebar" android:id="@+id/titlebar"
layout="@layout/titlebar" layout="@layout/form_titlebar"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintEnd_toEndOf="parent" /> tools:layout_constraintEnd_toEndOf="parent" />

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.ui.dashboard.DashboardFragment">
<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.ui.forum.ForumFragment">
<include
android:id="@+id/titlebar"
layout="@layout/visitor_titlebar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintEnd_toEndOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorAccent"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titlebar"
app:navGraph="@navigation/visitor_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.ui.visitor.VisitorAppointmentFragment">
<TextView
android:id="@+id/text_apppointment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.ui.visitor.VisitorMyFragment">
<TextView
android:id="@+id/text_visitor"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.ui.visitor.VisitorReservationFragment">
<TextView
android:id="@+id/text_reservation"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/visitor_titlebar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/visitor_appointment"
style="?android:attr/buttonBarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorAccent"
android:text="@string/forum_hot"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/visitor_reservation"
style="?android:attr/buttonBarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/button_unchecked"
android:text="@string/forum_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/forum_hot"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/visitor_visitor"
style="?android:attr/buttonBarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/button_unchecked"
android:text="@string/forum_post"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/forum_new"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>

@ -13,9 +13,9 @@
<fragment <fragment
android:id="@+id/navigation_dashboard" android:id="@+id/navigation_dashboard"
android:name="com.community.pocket.ui.main.ui.dashboard.DashboardFragment" android:name="com.community.pocket.ui.main.ui.visitor.VisitorFragment"
android:label="@string/title_dashboard" android:label="@string/title_dashboard"
tools:layout="@layout/fragment_dashboard" /> tools:layout="@layout/visitor" />
<fragment <fragment
android:id="@+id/navigation_notifications" android:id="@+id/navigation_notifications"

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/visitor_navigation"
app:startDestination="@id/visitorAppointmentFragment"
tools:ignore="UnusedNavigation">
<fragment
android:id="@+id/visitorAppointmentFragment"
android:name="com.community.pocket.ui.main.ui.visitor.VisitorAppointmentFragment"
android:label="visitor_appointment_fragment"
tools:layout="@layout/visitor_appointment_fragment" />
<fragment
android:id="@+id/visitorReservationFragment"
android:name="com.community.pocket.ui.main.ui.visitor.VisitorReservationFragment"
android:label="visitor_reservation_fragment"
tools:layout="@layout/visitor_reservation_fragment" />
<fragment
android:id="@+id/visitorMyFragment"
android:name="com.community.pocket.ui.main.ui.visitor.VisitorMyFragment"
android:label="visitor_my_fragment"
tools:layout="@layout/visitor_my_fragment" />
</navigation>

@ -34,4 +34,7 @@
<string name="forum_new">new</string> <string name="forum_new">new</string>
<string name="forum_post">post</string> <string name="forum_post">post</string>
<string name="forum_my">my</string> <string name="forum_my">my</string>
<string name="visitor_appointment">Making an Appointment</string>
<string name="visitor_reservation">My Reservation</string>
<string name="visitor_visitor">My Visitor</string>
</resources> </resources>

@ -34,4 +34,7 @@
<string name="forum_new">最新</string> <string name="forum_new">最新</string>
<string name="forum_post">发表帖子</string> <string name="forum_post">发表帖子</string>
<string name="forum_my">我的帖子</string> <string name="forum_my">我的帖子</string>
<string name="visitor_appointment">访客预约</string>
<string name="visitor_reservation">我的预约</string>
<string name="visitor_visitor">我的访客</string>
</resources> </resources>

@ -35,6 +35,9 @@
<string name="forum_new">new</string> <string name="forum_new">new</string>
<string name="forum_post">post</string> <string name="forum_post">post</string>
<string name="forum_my">my</string> <string name="forum_my">my</string>
<string name="visitor_appointment">Making an Appointment</string>
<string name="visitor_reservation">My Reservation</string>
<string name="visitor_visitor">My Visitor</string>
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save