cloudroam
2025-03-12 32b40371a31b3984e01f5a072e8e9c7a1e6acc2b
fix: 1
已修改4个文件
236 ■■■■ 文件已修改
app/src/main/java/com/example/firstapp/ui/dashboard/DashboardFragment.kt 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/fragment_notifications.xml 193 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/layout_week_stats.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/example/firstapp/ui/dashboard/DashboardFragment.kt
@@ -23,6 +23,7 @@
import android.graphics.Color
import android.widget.GridLayout
import com.example.firstapp.model.DailyStat
import com.github.mikephil.charting.components.YAxis
class DashboardFragment : Fragment() {
@@ -163,7 +164,8 @@
                setDrawGridLines(false)
                granularity = 1f
                labelRotationAngle = 0f
                textSize = 12f
                textSize = 10f  //标签字体
                setExtraLeftOffset(5f)  // 减少左侧留白
                setExtraBottomOffset(15f)
            }
@@ -188,6 +190,8 @@
            // 设置边距
            setExtraOffsets(10f, 10f, 10f, 20f)
        }
        updateBarChartData()
    }
@@ -512,6 +516,7 @@
                binding.layoutWeekStats.root.visibility = View.VISIBLE
                binding.layoutYearStats.root.visibility = View.GONE
                binding.layoutWeekStats.chartDailyPackages.visibility = View.VISIBLE
                (binding.layoutWeekStats.chartDailyPackages.parent as? View)?.visibility = View.VISIBLE
                binding.layoutWeekStats.heatmapYearly.visibility = View.GONE
                binding.cardPackageStats.visibility = View.VISIBLE
                updateBarChartData()
app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt
@@ -46,11 +46,11 @@
            findNavController().navigate(R.id.action_navigation_notifications_to_reminderSettingsFragment)
        }
//         设置其他提醒
        binding.settingsReminderOther.setOnClickListener {
            // 跳转到设置提醒页面
            findNavController().navigate(R.id.action_settings_to_reminderSettingsFragmentOther)
        }
//         设置其他提醒 暂时不需要
//        binding.settingsReminderOther.setOnClickListener {
//            // 跳转到设置提醒页面
//            findNavController().navigate(R.id.action_settings_to_reminderSettingsFragmentOther)
//        }
@@ -112,11 +112,25 @@
    private fun shareToWechat() {
        try {
            val intent = Intent()
            intent.setPackage("com.tencent.mm")
            intent.action = Intent.ACTION_SEND
            intent.type = "text/plain"
            intent.putExtra(Intent.EXTRA_TEXT, "推荐一个很棒的应用给你!")
            // 获取应用程序的包名
            //val packageName = requireContext().packageName
            // 创建分享文本
            val shareText = "推荐一个很棒的应用给你!\n" + "下载地址:https://oia.xiaohongshu.com/oia"
            // 创建分享意图
            val intent = Intent().apply {
                action = Intent.ACTION_SEND
                type = "text/plain"
                putExtra(Intent.EXTRA_TEXT, shareText)
                // 指定分享到微信
                setPackage("com.tencent.mm")
            }
//            intent.setPackage("com.tencent.mm")
//            intent.action = Intent.ACTION_SEND
//            intent.type = "text/plain"
//            intent.putExtra(Intent.EXTRA_TEXT, "推荐一个很棒的应用给你!")
            startActivity(Intent.createChooser(intent, "分享到微信"))
        } catch (e: Exception) {
            Toast.makeText(context, "请先安装微信", Toast.LENGTH_SHORT).show()
app/src/main/res/layout/fragment_notifications.xml
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
    android:orientation="vertical">
    <!-- 标题栏 -->
@@ -13,16 +18,21 @@
        android:gravity="center"
        android:padding="16dp"
        android:text="终身会员"
        android:textSize="18sp" />
            android:textColor="@android:color/black"
            android:textSize="20sp"
            android:textStyle="bold" />
    <!-- 功能区标题 -->
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="8dp"
            android:layout_marginTop="16dp"
            android:paddingHorizontal="16dp"
            android:paddingVertical="8dp"
        android:text="功能"
        android:textStyle="bold"
        android:textSize="14sp" />
            android:textColor="@android:color/darker_gray"
            android:textSize="14sp"
            android:textStyle="bold" />
    <!-- 设置选项 -->
    <LinearLayout
@@ -33,168 +43,240 @@
        <!-- 设置提醒 -->
        <RelativeLayout
            android:id="@+id/settings_reminder"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="设置提醒" />
                    android:text="设置提醒"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
        <!-- 设置其他提醒 -->
        <RelativeLayout
            android:id="@+id/settings_reminder_other"
            style="@style/SettingsItem">
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="设置其他提醒" />
            <!-- 设置其他提醒 暂时不需要 -->
<!--            <RelativeLayout-->
<!--                android:id="@+id/settings_reminder_other"-->
<!--                style="@style/SettingsItem"-->
<!--                android:padding="16dp">-->
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
<!--                <TextView-->
<!--                    android:layout_width="wrap_content"-->
<!--                    android:layout_height="wrap_content"-->
<!--                    android:layout_centerVertical="true"-->
<!--                    android:text="设置其他提醒"-->
<!--                    android:textColor="@android:color/black"-->
<!--                    android:textSize="16sp" />-->
<!--                <ImageView-->
<!--                    android:layout_width="24dp"-->
<!--                    android:layout_height="24dp"-->
<!--                    android:layout_alignParentEnd="true"-->
<!--                    android:layout_centerVertical="true"-->
<!--                    android:src="@drawable/right_forward" />-->
<!--            </RelativeLayout>-->
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
        <!-- 联系与反馈 -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="8dp"
                android:layout_marginTop="16dp"
                android:paddingHorizontal="16dp"
                android:paddingVertical="8dp"
            android:text="联系与反馈"
            android:textStyle="bold"
            android:textSize="14sp" />
                android:textColor="@android:color/darker_gray"
                android:textSize="14sp"
                android:textStyle="bold" />
        <!-- 关于小红书 -->
        <RelativeLayout
            android:id="@+id/about_app"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="关于小红书" />
                    android:text="关于小红书"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
        <!-- 邮件联系 -->
        <RelativeLayout
            android:id="@+id/email_contact"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="邮件联系" />
                    android:text="邮件联系"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
        <!-- 意见与反馈 -->
        <RelativeLayout
            android:id="@+id/feedback"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="意见与反馈" />
                    android:text="意见与反馈"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
        <!-- 分享给好友 -->
        <RelativeLayout
            android:id="@+id/share_to_friends"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="分享给好友" />
                    android:text="分享给好友"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
        <!-- 其他区域标题 -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="8dp"
                android:layout_marginTop="16dp"
                android:paddingHorizontal="16dp"
                android:paddingVertical="8dp"
            android:text="其他"
            android:textStyle="bold"
            android:textSize="14sp" />
                android:textColor="@android:color/darker_gray"
                android:textSize="14sp"
                android:textStyle="bold" />
        <!-- 隐私协议 -->
        <RelativeLayout
            android:id="@+id/privacy_policy"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="隐私协议" />
                    android:text="隐私协议"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
        </RelativeLayout>
            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_marginHorizontal="16dp"
                android:background="#E0E0E0" />
        <!-- 如何使用 -->
        <RelativeLayout
            android:id="@+id/how_to_use"
            style="@style/SettingsItem">
                style="@style/SettingsItem"
                android:padding="16dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="如何使用" />
                    android:text="如何使用"
                    android:textColor="@android:color/black"
                    android:textSize="16sp" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/right_forward" />
@@ -203,3 +285,4 @@
    </LinearLayout>
</LinearLayout>
</ScrollView>
app/src/main/res/layout/layout_week_stats.xml
@@ -4,7 +4,7 @@
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <!-- 柱状图容器 -->
    <!-- 柱状图容器,内边距16dp -->
    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="280dp"