From 440e47812c7eeb8f636e5b5a6c235ce31f8fbef9 Mon Sep 17 00:00:00 2001
From: panqihua <1029559041@qq.com>
Date: Thu, 23 Apr 2020 13:39:34 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=85=8D=E8=89=B2=E6=96=B9?=
=?UTF-8?q?=E6=A1=88=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pocket/ui/main/MainFragment.java | 21 ++++++-----
.../pocket/ui/main/ui/forum/ForumPost.java | 17 +++++----
.../layout/forum/layout/form_titlebar.xml | 12 +++----
.../layout/main/layout/forum/layout/forum.xml | 1 -
.../forum/layout/forum_data_content.xml | 11 ------
.../forum/layout/{post.xml => forum_list.xml} | 1 +
.../forum/layout/forum_post_fragment.xml | 1 +
.../main/layout/garbage/layout/garbage.xml | 1 -
.../garbage/layout/garbage_titlebar.xml | 6 ++--
.../main/layout/info/layout/info_fragment.xml | 8 ++---
.../main/layout/visitor/layout/visitor.xml | 1 -
.../layout/visitor_appointment_fragment.xml | 1 +
.../visitor/layout/visitor_titlebar.xml | 9 ++---
app/src/main/res/layout/titlebar_layout.xml | 2 +-
app/src/main/res/values/colors.xml | 6 ++++
app/src/main/res/values/styles.xml | 36 +++++++------------
16 files changed, 56 insertions(+), 78 deletions(-)
rename app/src/main/res/layout/main/layout/forum/layout/{post.xml => forum_list.xml} (97%)
diff --git a/app/src/main/java/com/community/pocket/ui/main/MainFragment.java b/app/src/main/java/com/community/pocket/ui/main/MainFragment.java
index 3e78a2a..354e61d 100644
--- a/app/src/main/java/com/community/pocket/ui/main/MainFragment.java
+++ b/app/src/main/java/com/community/pocket/ui/main/MainFragment.java
@@ -5,7 +5,6 @@ import android.view.View;
import android.widget.Button;
import androidx.annotation.RequiresApi;
-import androidx.core.content.ContextCompat;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
@@ -38,17 +37,17 @@ public abstract class MainFragment extends BaseFragment {
/**
* 点击按钮改变字体颜色
*/
- @RequiresApi(api = Build.VERSION_CODES.KITKAT)
protected void changeColor(View view) {
- int color = ContextCompat.getColor(requireContext(), R.color.button_unchecked);
- for (int id : buttonIds()) {
- View v = requireActivity().findViewById(id);
- v.setBackgroundColor(color);
- }
-
- if (view instanceof Button) {
- Button button = (Button) view;
- button.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.colorAccent));
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
+ for (int id : buttonIds()) {
+ Button button = requireActivity().findViewById(id);
+ button.setTextAppearance(R.style.Button_unselect);
+ }
+
+ if (view instanceof Button) {
+ Button button = (Button) view;
+ button.setTextAppearance(R.style.Button_select);
+ }
}
}
diff --git a/app/src/main/java/com/community/pocket/ui/main/ui/forum/ForumPost.java b/app/src/main/java/com/community/pocket/ui/main/ui/forum/ForumPost.java
index b1ef71c..aa7b105 100644
--- a/app/src/main/java/com/community/pocket/ui/main/ui/forum/ForumPost.java
+++ b/app/src/main/java/com/community/pocket/ui/main/ui/forum/ForumPost.java
@@ -20,6 +20,7 @@ import androidx.lifecycle.MutableLiveData;
import com.community.pocket.R;
import com.community.pocket.data.main.info.InfoRequest;
import com.community.pocket.data.model.Forum;
+import com.community.pocket.data.model.ForumStatus;
import com.community.pocket.data.model.Page;
import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.main.ui.forum.data.ForumDataActivity;
@@ -55,7 +56,7 @@ public abstract class ForumPost extends BaseFragment {
for (int i = 0; i < forumList.getList().size(); i++) {
final Forum forum = forumList.getList().get(i);
- View childView = View.inflate(getContext(), R.layout.post, null);
+ View childView = View.inflate(getContext(), R.layout.forum_list, null);
TextView status = childView.findViewById(R.id.check_status);
status.setVisibility(showStatus());
switch (forum.getStatus()) {
@@ -95,11 +96,15 @@ public abstract class ForumPost extends BaseFragment {
//打开帖子
Button button = childView.findViewById(R.id.showAll);
- button.setOnClickListener(v -> {
- Intent intent = new Intent(getContext(), ForumDataActivity.class);
- intent.putExtra(Param.forumId.name(), forum.getId());
- startActivityForResult(intent, 1);
- });
+ if (forum.getStatus() == ForumStatus.ok) {
+ button.setOnClickListener(v -> {
+ Intent intent = new Intent(getContext(), ForumDataActivity.class);
+ intent.putExtra(Param.forumId.name(), forum.getId());
+ startActivityForResult(intent, 1);
+ });
+ } else {
+ button.setVisibility(View.GONE);
+ }
layout.addView(childView);
diff --git a/app/src/main/res/layout/main/layout/forum/layout/form_titlebar.xml b/app/src/main/res/layout/main/layout/forum/layout/form_titlebar.xml
index 1f0cf71..14b2bb3 100644
--- a/app/src/main/res/layout/main/layout/forum/layout/form_titlebar.xml
+++ b/app/src/main/res/layout/main/layout/forum/layout/form_titlebar.xml
@@ -7,11 +7,10 @@
diff --git a/app/src/main/res/layout/main/layout/forum/layout/forum_data_content.xml b/app/src/main/res/layout/main/layout/forum/layout/forum_data_content.xml
index 55fad85..832c8a2 100644
--- a/app/src/main/res/layout/main/layout/forum/layout/forum_data_content.xml
+++ b/app/src/main/res/layout/main/layout/forum/layout/forum_data_content.xml
@@ -62,17 +62,6 @@
app:layout_constraintStart_toEndOf="@+id/headimg"
app:layout_constraintTop_toBottomOf="@id/time" />
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent">
+ android:layout_height="wrap_content">
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
index b9896ef..2bebabf 100644
--- a/app/src/main/res/layout/main/layout/visitor/layout/visitor.xml
+++ b/app/src/main/res/layout/main/layout/visitor/layout/visitor.xml
@@ -32,7 +32,6 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/colorAccent"
app:defaultNavHost="true"
app:navGraph="@navigation/visitor_navigation" />
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
index a727077..873b0b5 100644
--- 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
@@ -124,6 +124,7 @@
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 624d4a9..fbf0472 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -6,4 +6,10 @@
#000000
#00BCD4
#FFEB3B
+
+
+ #2d87d2
+
+
+ #FFFFFF
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index d6e55c5..1f3fe55 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,40 +1,28 @@
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-