主题功能,nfc修复

This commit is contained in:
2025-05-24 02:43:47 +08:00
parent ac60d8181d
commit e6254b5ea4
12 changed files with 382 additions and 25 deletions

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
FindMaimaiUltra

2
.idea/compiler.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
<bytecodeTargetLevel target="21" />
</component>
</project>

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -18,7 +18,7 @@ import org.astral.findmaimaiultra.been.Place;
import java.util.List;
public class PlaceAdapter extends RecyclerView.Adapter<PlaceAdapter.PlaceViewHolder> {
private String theme;
private List<Place> placeList;
private OnItemClickListener listener;
@@ -26,9 +26,10 @@ public class PlaceAdapter extends RecyclerView.Adapter<PlaceAdapter.PlaceViewHol
void onItemClick(Place place);
}
public PlaceAdapter(List<Place> placeList, OnItemClickListener listener) {
public PlaceAdapter(List<Place> placeList,String theme, OnItemClickListener listener) {
this.placeList = placeList;
this.listener = listener;
this.theme = theme;
}
@NonNull
@@ -69,6 +70,40 @@ public class PlaceAdapter extends RecyclerView.Adapter<PlaceAdapter.PlaceViewHol
} else {
holder.imageView.setImageDrawable(ContextCompat.getDrawable(holder.itemView.getContext(), R.drawable.rank_a));
}
//通过theme设置textview颜色
if (theme.contains("Pink")) {
holder.nameTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary));
holder.provinceTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary));
holder.cityTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary));
holder.areaTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary));
holder.addressTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary));
} else if (theme.contains("Blue")) {
holder.nameTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary2));
holder.provinceTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary2));
holder.cityTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary2));
holder.areaTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary2));
holder.addressTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.textcolorPrimary2));
} else if (theme.contains("Green")) {
holder.nameTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.lineBaseGreen));
holder.provinceTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.lineBaseGreen));
holder.cityTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.lineBaseGreen));
holder.areaTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.lineBaseGreen));
holder.addressTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.lineBaseGreen));
}else if (theme.contains("White")) {
holder.nameTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.white));
holder.provinceTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.white));
holder.cityTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.white));
holder.areaTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.white));
holder.addressTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.white));
}else if (theme.contains("Gray")) {
holder.nameTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.black));
holder.provinceTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.black));
holder.cityTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.black));
holder.areaTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.black));
holder.addressTextView.setTextColor(ContextCompat.getColor(holder.itemView.getContext(), R.color.black));
}
Log.i("rating", rating + "|" + place.getName());
// 控制竖线的位置
controlVerticalLines(holder, place);

View File

@@ -61,12 +61,14 @@ public class MainActivity extends AppCompatActivity implements ImagePickerListen
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences preferences = getSharedPreferences("setting", MODE_PRIVATE);
String selectedTheme = preferences.getString("selected_theme", "Theme.FindMaimaiUltra");
nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (nfcAdapter == null) {
Toast.makeText(this, "NFC is not available on this device", Toast.LENGTH_SHORT).show();
finish();
return;
Snackbar.make(findViewById(R.id.nav_host_fragment_content_main), "NFC 不可用", Snackbar.LENGTH_LONG).show();
//finish();
//return;
}
pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_IMMUTABLE);

View File

@@ -8,7 +8,10 @@ import android.app.AlertDialog;
import android.content.*;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -16,6 +19,7 @@ import android.provider.Settings;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -39,6 +43,7 @@ import org.astral.findmaimaiultra.been.Market;
import org.astral.findmaimaiultra.been.Place;
import org.astral.findmaimaiultra.been.PlaceContent;
import org.astral.findmaimaiultra.message.ApiResponse;
import org.astral.findmaimaiultra.utill.FileUtils;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -121,6 +126,43 @@ public class PageActivity extends AppCompatActivity {
TextView textView5 = findViewById(R.id.areaTextView);
textView5.setText(area);
TextView t1 = findViewById(R.id.num5);
SharedPreferences preferences = getSharedPreferences("setting", MODE_PRIVATE);
String selectedTheme = preferences.getString("selected_theme", "Theme.FindMaimaiUltra");
if (selectedTheme.contains("Pink")) {
// 全部设置颜色
textView.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
textView2.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
textView3.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
textView4.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
textView5.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
} else if (selectedTheme.contains("Blue")) {
textView.setTextColor(ContextCompat.getColor(this, R.color.textcolorPrimary2));
textView2.setTextColor(ContextCompat.getColor(this, R.color.textcolorPrimary2));
textView3.setTextColor(ContextCompat.getColor(this, R.color.textcolorPrimary2));
textView4.setTextColor(ContextCompat.getColor(this, R.color.textcolorPrimary2));
textView5.setTextColor(ContextCompat.getColor(this, R.color.textcolorPrimary2));
} else if (selectedTheme.contains("Green")) {
textView.setTextColor(ContextCompat.getColor(this, R.color.lineBaseGreen));
textView2.setTextColor(ContextCompat.getColor(this, R.color.lineBaseGreen));
textView3.setTextColor(ContextCompat.getColor(this, R.color.lineBaseGreen));
textView4.setTextColor(ContextCompat.getColor(this, R.color.lineBaseGreen));
textView5.setTextColor(ContextCompat.getColor(this, R.color.lineBaseGreen));
}else if (selectedTheme.contains("White")) {
textView.setTextColor(ContextCompat.getColor(this, R.color.white));
textView2.setTextColor(ContextCompat.getColor(this, R.color.white));
textView3.setTextColor(ContextCompat.getColor(this, R.color.white));
textView4.setTextColor(ContextCompat.getColor(this, R.color.white));
textView5.setTextColor(ContextCompat.getColor(this, R.color.white));
}else if (selectedTheme.contains("Gray")) {
textView.setTextColor(ContextCompat.getColor(this, R.color.black));
textView2.setTextColor(ContextCompat.getColor(this, R.color.black));
textView3.setTextColor(ContextCompat.getColor(this, R.color.black));
textView4.setTextColor(ContextCompat.getColor(this, R.color.black));
textView5.setTextColor(ContextCompat.getColor(this, R.color.black));
}
adminIt = findViewById(R.id.admin);
t1.setText("舞萌总机台 " + (num + numJ));
if(getIntent().hasExtra("type")) {
@@ -397,9 +439,9 @@ public class PageActivity extends AppCompatActivity {
LatLng latLng = new LatLng(y, x); // 北京市经纬度
baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(latLng, 13)); // 缩放级别调整为
// 添加独特样式的标记
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.logo); // 自定义图标资源
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, 300, 130, true); // 缩放到 100x100 像素
BitmapDescriptor descriptor = BitmapDescriptorFactory.fromBitmap(scaledBitmap);
Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.logo); // 自定义图标资源
Bitmap scaledBitmap2 = Bitmap.createScaledBitmap(bitmap2, 300, 130, true); // 缩放到 100x100 像素
BitmapDescriptor descriptor = BitmapDescriptorFactory.fromBitmap(scaledBitmap2);
MarkerOptions markerOptions = new MarkerOptions()
.position(latLng)
.title("机厅位置")
@@ -408,6 +450,135 @@ public class PageActivity extends AppCompatActivity {
MaterialButton moveButton = findViewById(R.id.move);
moveButton.setOnClickListener(v -> showBaiduMapDialog());
LinearLayout background = findViewById(R.id.background);
if (preferences.getString("image_uri", null) != null ) {
try {
File backgroundFile = FileUtils.getBackground(this, "background.jpg");
if (!backgroundFile.exists()) {
Toast.makeText(this, "文件不存在,请先设置背景图片", Toast.LENGTH_SHORT).show();
}
Bitmap bitmap = BitmapFactory.decodeFile(backgroundFile.getAbsolutePath());
if (bitmap != null) {
// 获取RecyclerView的尺寸
int recyclerViewWidth = 0;
int recyclerViewHeight = 0;
recyclerViewWidth = background.getWidth();
recyclerViewHeight = background.getHeight();
if (recyclerViewWidth > 0 && recyclerViewHeight > 0) {
// 计算缩放比例
float scaleWidth = ((float) recyclerViewWidth) / bitmap.getWidth();
float scaleHeight = ((float) recyclerViewHeight) / bitmap.getHeight();
// 选择较大的缩放比例以保持图片的原始比例
float scaleFactor = Math.max(scaleWidth, scaleHeight);
// 计算新的宽度和高度
int newWidth = (int) (bitmap.getWidth() * scaleFactor);
int newHeight = (int) (bitmap.getHeight() * scaleFactor);
// 缩放图片
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true);
// 计算裁剪区域
int xT = (scaledBitmap.getWidth() - recyclerViewWidth) / 2;
int yT = (scaledBitmap.getHeight() - recyclerViewHeight) / 2;
// 处理x和y为负数的情况
xT = Math.max(xT, 0);
yT = Math.max(yT, 0);
// 裁剪图片
Bitmap croppedBitmap = Bitmap.createBitmap(scaledBitmap, xT, yT, recyclerViewWidth, recyclerViewHeight);
// 创建一个新的 Bitmap与裁剪后的 Bitmap 大小相同
Bitmap transparentBitmap = Bitmap.createBitmap(croppedBitmap.getWidth(), croppedBitmap.getHeight(), croppedBitmap.getConfig());
// 创建一个 Canvas 对象,用于在新的 Bitmap 上绘制
Canvas canvas = new Canvas(transparentBitmap);
// 创建一个 Paint 对象,并设置透明度
Paint paint = new Paint();
paint.setAlpha(128); // 设置透明度为 50% (255 * 0.5 = 128)
// 将裁剪后的 Bitmap 绘制到新的 Bitmap 上,并应用透明度
canvas.drawBitmap(croppedBitmap, 0, 0, paint);
// 创建BitmapDrawable并设置其边界为RecyclerView的尺寸
BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), transparentBitmap);
// 设置recyclerView的背景
background.setBackground(bitmapDrawable);
} else {
// 如果RecyclerView的尺寸未确定可以使用ViewTreeObserver来监听尺寸变化
background.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
background.getViewTreeObserver().removeOnGlobalLayoutListener(this);
int recyclerViewWidth = 0;
int recyclerViewHeight = 0;
recyclerViewWidth = background.getWidth();
recyclerViewHeight = background.getHeight();
// 计算缩放比例
float scaleWidth = ((float) recyclerViewWidth) / bitmap.getWidth();
float scaleHeight = ((float) recyclerViewHeight) / bitmap.getHeight();
// 选择较大的缩放比例以保持图片的原始比例
float scaleFactor = Math.max(scaleWidth, scaleHeight);
// 计算新的宽度和高度
int newWidth = (int) (bitmap.getWidth() * scaleFactor);
int newHeight = (int) (bitmap.getHeight() * scaleFactor);
// 缩放图片
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true);
// 计算裁剪区域
int x = (scaledBitmap.getWidth() - recyclerViewWidth) / 2;
int y = (scaledBitmap.getHeight() - recyclerViewHeight) / 2;
// 处理x和y为负数的情况
x = Math.max(x, 0);
y = Math.max(y, 0);
// 裁剪图片
Bitmap croppedBitmap = Bitmap.createBitmap(scaledBitmap, x, y, recyclerViewWidth, recyclerViewHeight);
// 创建一个新的 Bitmap与裁剪后的 Bitmap 大小相同
Bitmap transparentBitmap = Bitmap.createBitmap(croppedBitmap.getWidth(), croppedBitmap.getHeight(), croppedBitmap.getConfig());
// 创建一个 Canvas 对象,用于在新的 Bitmap 上绘制
Canvas canvas = new Canvas(transparentBitmap);
// 创建一个 Paint 对象,并设置透明度
Paint paint = new Paint();
paint.setAlpha(128); // 设置透明度为 50% (255 * 0.5 = 128)
// 将裁剪后的 Bitmap 绘制到新的 Bitmap 上,并应用透明度
canvas.drawBitmap(croppedBitmap, 0, 0, paint);
// 创建BitmapDrawable并设置其边界为RecyclerView的尺寸
BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), transparentBitmap);
background.setBackground(bitmapDrawable);
}
});
}
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "图片加载失败,权限出错!", Toast.LENGTH_SHORT).show();
}
}
}
private void showBaiduMapDialog() {
// 加载弹窗布局
@@ -477,6 +648,9 @@ public class PageActivity extends AppCompatActivity {
.setTitle("选择新位置")
.create();
mapDialog.show();
}
private void updateMapLocation() {
mapView.onDestroy();

View File

@@ -85,7 +85,7 @@ public class HomeFragment extends Fragment {
private SharedPreferences shoucang;
private SharedPreferences settingProperties;
private SharedPreferences settingProperties2;
private String selectedTheme;
private FragmentHomeBinding binding;
private SharedViewModel sharedViewModel;
@Override
@@ -120,7 +120,7 @@ public class HomeFragment extends Fragment {
List<Place> placeList = new ArrayList<>();
recyclerView.setAdapter(adapter);
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},0x123);
selectedTheme = settingProperties2.getString("selected_theme", "Theme.FindMaimaiUltra");
// 示例:读取 SharedPreferences 中的数据
if (shoucang != null) {
String savedData = shoucang.getString("key_name", "default_value");
@@ -372,7 +372,7 @@ public class HomeFragment extends Fragment {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
adapter = new PlaceAdapter(a, new PlaceAdapter.OnItemClickListener() {
adapter = new PlaceAdapter(a,selectedTheme, new PlaceAdapter.OnItemClickListener() {
@Override
public void onItemClick(Place place) {
Intent intent = new Intent(context, PageActivity.class);

View File

@@ -2,6 +2,7 @@ package org.astral.findmaimaiultra.ui.slideshow;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.UiModeManager;
import android.content.*;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -14,9 +15,11 @@ import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
@@ -24,8 +27,11 @@ import androidx.lifecycle.ViewModelProvider;
import com.bumptech.glide.Glide;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.radiobutton.MaterialRadioButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.google.android.material.textfield.TextInputEditText;
import org.astral.findmaimaiultra.R;
import org.astral.findmaimaiultra.been.Release;
import org.astral.findmaimaiultra.databinding.FragmentSlideshowBinding;
import org.astral.findmaimaiultra.service.GitHubApiService;
@@ -54,7 +60,7 @@ public class SlideshowFragment extends Fragment {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
private String theme;
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
@@ -76,6 +82,7 @@ public class SlideshowFragment extends Fragment {
} else {
requestPermissions();
}
theme = settingProperties.getString("selected_theme", "Theme.FindMaimaiUltra");
}
private void show(String text) {
@@ -101,6 +108,7 @@ public class SlideshowFragment extends Fragment {
);
}
@SuppressLint("ResourceAsColor")
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
@@ -178,9 +186,83 @@ public class SlideshowFragment extends Fragment {
.into(user_avatar);
TextView user_name = binding.username;
user_name.setText(username);
themeClick(root);
if (theme.contains("Pink")) {
// 全部设置颜色
user_name.setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimary));
binding.desc.setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimary));
binding.vits.setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimary));
binding.themeText.setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimary));
} else if (theme.contains("Blue")) {
user_name.setTextColor(ContextCompat.getColor(requireContext(), R.color.textcolorPrimary2));
binding.desc.setTextColor(ContextCompat.getColor(requireContext(), R.color.textcolorPrimary2));
binding.vits.setTextColor(ContextCompat.getColor(requireContext(), R.color.textcolorPrimary2));
binding.themeText.setTextColor(ContextCompat.getColor(requireContext(), R.color.textcolorPrimary2));
} else if (theme.contains("Green")) {
user_name.setTextColor(ContextCompat.getColor(requireContext(), R.color.lineBaseGreen));
binding.desc.setTextColor(ContextCompat.getColor(requireContext(), R.color.lineBaseGreen));
binding.vits.setTextColor(ContextCompat.getColor(requireContext(), R.color.lineBaseGreen));
binding.themeText.setTextColor(ContextCompat.getColor(requireContext(), R.color.lineBaseGreen));
}else if (theme.contains("White")) {
user_name.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
binding.desc.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
binding.vits.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
binding.themeText.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
}else if (theme.contains("Gray")) {
user_name.setTextColor(ContextCompat.getColor(requireContext(), R.color.black));
binding.desc.setTextColor(ContextCompat.getColor(requireContext(), R.color.black));
binding.vits.setTextColor(ContextCompat.getColor(requireContext(), R.color.black));
binding.themeText.setTextColor(ContextCompat.getColor(requireContext(), R.color.black));
}
binding.view2.setBackgroundColor(R.color.black);
binding.view3.setBackgroundColor(R.color.black);
return root;
}
public boolean isDarkMode(Context context) {
UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);
return uiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES;
}
private void themeClick(View root) {
CardView cardPink = root.findViewById(R.id.cardPink);
CardView cardGreen = root.findViewById(R.id.cardGreen);
CardView cardBlue = root.findViewById(R.id.cardBlue);
CardView cardWhite = root.findViewById(R.id.cardWhite);
CardView cardGray = root.findViewById(R.id.cardGray);
View.OnClickListener themeClickListener = v -> {
String selectedTheme = "Theme.FindMaimaiUltra";
int id = v.getId();
if (id == R.id.cardPink) {
selectedTheme = "Theme.FindMaimaiUltra.Pink";
} else if (id == R.id.cardGreen) {
selectedTheme = "Theme.FindMaimaiUltra.Green";
} else if (id == R.id.cardBlue) {
selectedTheme = "Theme.FindMaimaiUltra.Blue";
} else if (id == R.id.cardWhite) {
selectedTheme = "Theme.FindMaimaiUltra.White";
} else if (id == R.id.cardGray) {
selectedTheme = "Theme.FindMaimaiUltra.Gray";
}
SharedPreferences.Editor editor = settingProperties.edit();
editor.putString("selected_theme", selectedTheme);
editor.apply();
Snackbar .make(binding.getRoot(), "文本主题已更改", Snackbar.LENGTH_SHORT).show();
};
cardPink.setOnClickListener(themeClickListener);
cardGreen.setOnClickListener(themeClickListener);
cardBlue.setOnClickListener(themeClickListener);
cardWhite.setOnClickListener(themeClickListener);
cardGray.setOnClickListener(themeClickListener);
}
private String getAppVersionName() {
try {
PackageInfo packageInfo = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0);

View File

@@ -8,7 +8,7 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="13mm"
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
tools:ignore="MissingConstraints">
@@ -16,7 +16,7 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="7mm"
android:layout_height="11mm"
android:tooltipText="FindMaimai"
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"

View File

@@ -101,7 +101,8 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/dividerVertical"
android:id="@+id/view2"
android:background="?android:attr/dividerVertical"
android:layout_marginTop="16dp"/>
<com.google.android.material.textfield.TextInputLayout
@@ -169,7 +170,68 @@
android:backgroundTint="?attr/colorPrimary"
android:paddingTop="16dp"
android:paddingBottom="16dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/textcolorPrimary"
android:textSize="18sp"
android:id="@+id/themeText"
android:text="文字主题"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:id="@+id/themeCardContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp">
<androidx.cardview.widget.CardView
android:id="@+id/cardPink"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="8dp"
app:cardBackgroundColor="@color/primary"
app:cardCornerRadius="8dp" />
<androidx.cardview.widget.CardView
android:id="@+id/cardGreen"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="8dp"
app:cardBackgroundColor="@color/lineBaseGreen"
app:cardCornerRadius="8dp" />
<androidx.cardview.widget.CardView
android:id="@+id/cardBlue"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="8dp"
app:cardBackgroundColor="@color/colorPrimary2"
app:cardCornerRadius="8dp" />
<androidx.cardview.widget.CardView
android:id="@+id/cardWhite"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="8dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="8dp" />
<androidx.cardview.widget.CardView
android:id="@+id/cardGray"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="8dp"
app:cardBackgroundColor="@color/black"
app:cardCornerRadius="8dp" />
</LinearLayout>
</HorizontalScrollView>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/save_settings_button"
@@ -182,7 +244,9 @@
android:paddingBottom="16dp"/>
</LinearLayout>
<TextView android:layout_width="wrap_content" android:textColor="@color/textcolorPrimary"
<TextView android:layout_width="wrap_content"
android:textColor="@color/textcolorPrimary"
android:id="@+id/desc"
android:layout_height="wrap_content" android:text="@string/settin_body"/>
<TextView
android:layout_width="match_parent"
@@ -192,6 +256,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/view3"
android:background="?android:attr/dividerVertical"
android:layout_marginTop="16dp"/>
<TextView android:layout_width="wrap_content" android:textColor="@color/textcolorPrimary"

View File

@@ -28,6 +28,10 @@
<color name="lineBaseGreen">#1DF687</color>
<color name="VlineBaseGreen">#C2F6C4</color>
<color name="textcolorPrimary">#D5C4ED</color>
<color name="textcolorPrimary2">#2196F3</color>
<color name="colorPrimary2">#2196F3</color>
<color name="border_color">#000000</color> <!-- 黑色 -->
<color name="menu_background_color">#FFFFFF</color> <!-- 白色背景 -->

View File

@@ -22,7 +22,6 @@
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<color name="textcolorPrimary">#D5C4ED</color>
</style>
<!-- Green Theme -->
@@ -31,19 +30,16 @@
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<color name="textcolorPrimary">@color/lineBaseGreen</color>
</style>
<!-- Blue Theme -->
<style name="Theme.FindMaimaiUltra.Blue" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">#2196F3</item>
<item name="colorPrimary">@color/colorPrimary2</item>
<item name="colorPrimaryVariant">@color/teal_700</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<color name="textcolorPrimary">#2196F3</color>
</style>
<!-- White Theme -->
@@ -53,7 +49,6 @@
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/white</item>
<item name="colorOnSecondary">@color/black</item>
<color name="textcolorPrimary">@color/white</color>
</style>
<!-- Gray Theme -->
@@ -63,7 +58,6 @@
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/dividerColor</item>
<item name="colorOnSecondary">@color/black</item>
<color name="textcolorPrimary">@color/dividerColor</color>
</style>
<style name="Theme.FindMaimaiUltra.NoActionBar">
<item name="windowActionBar">false</item>