From 768f1d38c5357e214e6cff018e57ef7bcb64ee60 Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期四, 27 二月 2025 13:53:23 +0800 Subject: [PATCH] 1 --- app/src/main/res/values/styles.xml | 26 app/src/main/res/drawable/ic_add.xml | 10 app/src/main/res/values/themes.xml | 13 app/src/main/res/drawable/ic_anniversary.xml | 10 app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderOtherAddActivity2.kt | 164 ++++++ app/src/main/res/values/colors.xml | 5 app/src/main/res/layout/fragment_repeat_cycle_dialog_list_dialog.xml | 53 ++ app/src/main/res/values-night/themes.xml | 5 app/src/main/res/layout/item_countdown.xml | 65 ++ app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt | 10 app/src/main/res/drawable/button_pink.xml | 5 app/src/main/java/com/example/firstapp/ui/reminderOther/TimePickerBottomSheetFragment.kt | 72 ++ app/src/main/res/layout/activity_reminder_other_add2.xml | 194 +++++++ app/src/main/res/drawable/ic_delete.xml | 10 app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAdd.kt | 139 +++++ app/build.gradle | 9 app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAddViewModel.kt | 7 app/src/main/res/values/dimens.xml | 2 app/src/main/java/com/example/firstapp/ui/reminderOther/RepeatCycleDialogFragment.kt | 123 ++++ app/src/main/res/navigation/mobile_navigation.xml | 29 + app/src/main/res/values/attrs.xml | 6 app/src/main/res/drawable/button_blue.xml | 5 app/src/main/res/values/strings.xml | 45 + app/src/main/res/layout/date_record_layout.xml | 127 +++++ app/src/main/res/layout/fragment_time_picker_bottom_sheet_list_dialog.xml | 53 ++ app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOther.kt | 49 + app/src/main/res/layout/fragment_notifications.xml | 19 app/src/main/res/layout/fragment_reminder_settings_fragment_other.xml | 65 ++ app/src/main/java/com/example/firstapp/entity/Item.kt | 2 app/src/main/res/drawable/ic_edit.xml | 10 app/src/main/res/layout/fragment_reminder_settings_fragment_other_add.xml | 109 ++++ app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherViewModel.kt | 7 32 files changed, 1,438 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ccc635c..82e8b39 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -120,6 +120,8 @@ implementation libs.androidx.lifecycle.viewmodel.ktx implementation libs.androidx.navigation.fragment.ktx implementation libs.androidx.navigation.ui.ktx + implementation libs.androidx.legacy.support.v4 + implementation libs.androidx.recyclerview testImplementation libs.junit androidTestImplementation libs.androidx.junit androidTestImplementation libs.androidx.espresso.core @@ -262,5 +264,12 @@ //附加功能的工具类 implementation("com.github.xuexiangjys.XUtil:xutil-sub:2.0.0") + // 滑轮滚动控件 + implementation 'com.github.open-android:WheelPicker:v1.0.0' + + // 滚轮滑动控件级联 + implementation 'com.contrarywind:Android-PickerView:4.1.9' + + } \ No newline at end of file diff --git a/app/src/main/java/com/example/firstapp/entity/Item.kt b/app/src/main/java/com/example/firstapp/entity/Item.kt index 4f415da..6c6449c 100644 --- a/app/src/main/java/com/example/firstapp/entity/Item.kt +++ b/app/src/main/java/com/example/firstapp/entity/Item.kt @@ -3,5 +3,5 @@ data class Item( val id: Int, val title: String, - val description: String + val description: String ) diff --git a/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt b/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt index ef620d8..20eeaa1 100644 --- a/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt +++ b/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt @@ -16,6 +16,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.example.firstapp.R import com.example.firstapp.databinding.FragmentNotificationsBinding +import com.example.firstapp.ui.reminderOther.ReminderOtherAddActivity2 +import com.example.firstapp.ui.reminderOther.ReminderSettingsFragmentOther class NotificationsFragment : Fragment() { @@ -44,6 +46,14 @@ findNavController().navigate(R.id.action_navigation_notifications_to_reminderSettingsFragment) } +// 设置其他提醒 + binding.settingsReminderOther.setOnClickListener { + // 跳转到设置提醒页面 + findNavController().navigate(R.id.action_settings_to_reminderSettingsFragmentOther) + } + + + // 关于小红书 binding.aboutApp.setOnClickListener { // 跳转到小红书账号页面 diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderOtherAddActivity2.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderOtherAddActivity2.kt new file mode 100644 index 0000000..fef515c --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderOtherAddActivity2.kt @@ -0,0 +1,164 @@ +package com.example.firstapp.ui.reminderOther + +import androidx.appcompat.app.AppCompatActivity +import android.annotation.SuppressLint +import android.os.Build +import android.os.Bundle +import android.os.Handler +import android.os.Looper +import android.view.MotionEvent +import android.view.View +import android.view.WindowInsets +import android.widget.LinearLayout +import android.widget.TextView +import com.example.firstapp.databinding.ActivityReminderOtherAdd2Binding +import com.example.firstapp.R + +/** + * An example full-screen activity that shows and hides the system UI (i.e. + * status bar and navigation/system bar) with user interaction. + */ +class ReminderOtherAddActivity2 : AppCompatActivity() { + + private lateinit var binding: ActivityReminderOtherAdd2Binding + private lateinit var fullscreenContent: TextView + private lateinit var fullscreenContentControls: LinearLayout + private val hideHandler = Handler(Looper.myLooper()!!) + + @SuppressLint("InlinedApi") + private val hidePart2Runnable = Runnable { + // Delayed removal of status and navigation bar + if (Build.VERSION.SDK_INT >= 30) { + fullscreenContent.windowInsetsController?.hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars()) + } else { + // Note that some of these constants are new as of API 16 (Jelly Bean) + // and API 19 (KitKat). It is safe to use them, as they are inlined + // at compile-time and do nothing on earlier devices. + fullscreenContent.systemUiVisibility = + View.SYSTEM_UI_FLAG_LOW_PROFILE or + View.SYSTEM_UI_FLAG_FULLSCREEN or + View.SYSTEM_UI_FLAG_LAYOUT_STABLE or + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + } + } + private val showPart2Runnable = Runnable { + // Delayed display of UI elements + supportActionBar?.show() + fullscreenContentControls.visibility = View.VISIBLE + } + private var isFullscreen: Boolean = false + + private val hideRunnable = Runnable { hide() } + + /** + * Touch listener to use for in-layout UI controls to delay hiding the + * system UI. This is to prevent the jarring behavior of controls going away + * while interacting with activity UI. + */ + private val delayHideTouchListener = View.OnTouchListener { view, motionEvent -> + when (motionEvent.action) { + MotionEvent.ACTION_DOWN -> if (AUTO_HIDE) { + delayedHide(AUTO_HIDE_DELAY_MILLIS) + } + + MotionEvent.ACTION_UP -> view.performClick() + else -> { + } + } + false + } + + @SuppressLint("ClickableViewAccessibility") + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + binding = ActivityReminderOtherAdd2Binding.inflate(layoutInflater) + setContentView(binding.root) + + supportActionBar?.setDisplayHomeAsUpEnabled(true) + + isFullscreen = true + + + fullscreenContent = binding.fullscreenContent + fullscreenContent.setOnClickListener { toggle() } + + fullscreenContentControls = binding.fullscreenContentControls + binding.dummyButton.setOnTouchListener(delayHideTouchListener) + } + + override fun onPostCreate(savedInstanceState: Bundle?) { + super.onPostCreate(savedInstanceState) + + // Trigger the initial hide() shortly after the activity has been + // created, to briefly hint to the user that UI controls + // are available. + delayedHide(100) + } + + private fun toggle() { + if (isFullscreen) { + hide() + } else { + show() + } + } + + private fun hide() { + // Hide UI first + supportActionBar?.hide() + fullscreenContentControls.visibility = View.GONE + isFullscreen = false + + // Schedule a runnable to remove the status and navigation bar after a delay + hideHandler.removeCallbacks(showPart2Runnable) + hideHandler.postDelayed(hidePart2Runnable, UI_ANIMATION_DELAY.toLong()) + } + + private fun show() { + // Show the system bar + if (Build.VERSION.SDK_INT >= 30) { + fullscreenContent.windowInsetsController?.show(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars()) + } else { + fullscreenContent.systemUiVisibility = + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + } + isFullscreen = true + + // Schedule a runnable to display UI elements after a delay + hideHandler.removeCallbacks(hidePart2Runnable) + hideHandler.postDelayed(showPart2Runnable, UI_ANIMATION_DELAY.toLong()) + } + + /** + * Schedules a call to hide() in [delayMillis], canceling any + * previously scheduled calls. + */ + private fun delayedHide(delayMillis: Int) { + hideHandler.removeCallbacks(hideRunnable) + hideHandler.postDelayed(hideRunnable, delayMillis.toLong()) + } + + companion object { + /** + * Whether or not the system UI should be auto-hidden after + * [AUTO_HIDE_DELAY_MILLIS] milliseconds. + */ + private const val AUTO_HIDE = true + + /** + * If [AUTO_HIDE] is set, the number of milliseconds to wait after + * user interaction before hiding the system UI. + */ + private const val AUTO_HIDE_DELAY_MILLIS = 3000 + + /** + * Some older devices needs a small delay between UI widget updates + * and a change of the status and navigation bar. + */ + private const val UI_ANIMATION_DELAY = 300 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOther.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOther.kt new file mode 100644 index 0000000..d0e7cb0 --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOther.kt @@ -0,0 +1,49 @@ +package com.example.firstapp.ui.reminderOther + +import androidx.fragment.app.viewModels +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageButton +import com.example.firstapp.R +import androidx.navigation.fragment.findNavController +import android.content.Intent + +class ReminderSettingsFragmentOther : Fragment() { + + companion object { + fun newInstance() = ReminderSettingsFragmentOther() + } + + private val viewModel: ReminderSettingsFragmentOtherViewModel by viewModels() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // TODO: Use the ViewModel + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + val view= inflater.inflate( + R.layout.fragment_reminder_settings_fragment_other, + container, + false + ) + // 找到按钮并设置点击事件 + val button = view.findViewById<ImageButton>(R.id.btn_add) + button.setOnClickListener { + // 使用 Navigation Component 进行导航 + findNavController().navigate(R.id.action_reminderSettingsFragmentOther_to_reminderSettingsFragmentOtherAdd) +// val intent = Intent(requireContext(), ReminderOtherAddActivity2::class.java) +// startActivity(intent) + } + + + return view + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAdd.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAdd.kt new file mode 100644 index 0000000..e3efaaa --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAdd.kt @@ -0,0 +1,139 @@ +package com.example.firstapp.ui.reminderOther + +import android.app.DatePickerDialog +import android.app.TimePickerDialog +import androidx.fragment.app.viewModels +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ArrayAdapter +import android.widget.EditText +import android.widget.NumberPicker +import android.widget.Spinner +import android.widget.TextView +import android.widget.Toast +import com.bigkoo.pickerview.adapter.ArrayWheelAdapter +import com.contrarywind.view.WheelView +import com.example.firstapp.R +import com.example.firstapp.utils.Log +import com.itheima.wheelpicker.WheelPicker +import java.util.Calendar + +class ReminderSettingsFragmentOtherAdd : Fragment() { + + + private lateinit var etDate: EditText + private lateinit var etTime: EditText // 用于显示选择的时间 + + private lateinit var textViewSelected: TextView + + + companion object { + fun newInstance() = ReminderSettingsFragmentOtherAdd() + } + + private val viewModel: ReminderSettingsFragmentOtherAddViewModel by viewModels() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // TODO: Use the ViewModel + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + val rootView = inflater.inflate( + R.layout.fragment_reminder_settings_fragment_other_add, + container, + false + ) + // Initialize Spinner + val dayTypeSpinner: Spinner = rootView.findViewById(R.id.sp_day_type) + + // Set up ArrayAdapter for Spinner + val adapter = ArrayAdapter.createFromResource( + requireContext(), + R.array.day_types, // This should match the array in strings.xml + android.R.layout.simple_spinner_item + ) + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) + dayTypeSpinner.adapter = adapter + + + // 初始化日期控件 + etDate = rootView.findViewById(R.id.et_date) + // 设置点击事件来显示日期选择器 + etDate.setOnClickListener { + // 获取当前日期 + val calendar = Calendar.getInstance() + val year = calendar.get(Calendar.YEAR) + val month = calendar.get(Calendar.MONTH) + val dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH) + + // 创建 DatePickerDialog + val datePickerDialog = DatePickerDialog( + requireContext(), + DatePickerDialog.OnDateSetListener { view, selectedYear, selectedMonth, selectedDayOfMonth -> + // 设置选中的日期到 EditText + etDate.setText("$selectedYear-${selectedMonth + 1}-$selectedDayOfMonth") + }, + year, month, dayOfMonth + ) + + // 显示 DatePickerDialog + datePickerDialog.show() + } + + + // 添加重复周期按钮 + textViewSelected = rootView.findViewById(R.id.tv_selected_cycle) + val tvRepeatCycle: TextView = rootView.findViewById(R.id.tv_repeat_cycle) + tvRepeatCycle.setOnClickListener { + showRepeatCycleBottomSheet() + } + + // 初始化 etTime + etTime = rootView.findViewById(R.id.et_time) + // 设置点击事件来显示时间选择器 + etTime.setOnClickListener { + showTimePickerBottomSheet() + } + + return rootView; + } + + private fun showRepeatCycleBottomSheet() { + val repeatCycleBottomSheetFragment = RepeatCycleDialogFragment() + + // 显式实现 OnCycleSelectedListener 接口 + repeatCycleBottomSheetFragment.setOnCycleSelectedListener(object : RepeatCycleDialogFragment.OnCycleSelectedListener { + override fun onCycleSelected(every: String, interval: String, unit: String) { + val formattedCycle = "$every $interval $unit" + // 这里可以将选择的重复周期显示在某个 TextView 或其他控件中 + textViewSelected.text = "重复周期: $formattedCycle" + } + }) + + repeatCycleBottomSheetFragment.show(childFragmentManager, "RepeatCycleBottomSheetFragment") + } + + + private fun showTimePickerBottomSheet() { + val timePickerBottomSheetFragment = TimePickerBottomSheetFragment() + + // 显式实现 OnTimeSelectedListener 接口 + timePickerBottomSheetFragment.setOnTimeSelectedListener(object : TimePickerBottomSheetFragment.OnTimeSelectedListener { + override fun onTimeSelected(hour: Int, minute: Int, second: Int) { + val formattedTime = String.format("%02d:%02d:%02d", hour, minute, second) + etTime.setText(formattedTime) + } + }) + + timePickerBottomSheetFragment.show(childFragmentManager, "TimePickerBottomSheetFragment") + } + +} diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAddViewModel.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAddViewModel.kt new file mode 100644 index 0000000..791c559 --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherAddViewModel.kt @@ -0,0 +1,7 @@ +package com.example.firstapp.ui.reminderOther + +import androidx.lifecycle.ViewModel + +class ReminderSettingsFragmentOtherAddViewModel : ViewModel() { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherViewModel.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherViewModel.kt new file mode 100644 index 0000000..6e4c1dd --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/ReminderSettingsFragmentOtherViewModel.kt @@ -0,0 +1,7 @@ +package com.example.firstapp.ui.reminderOther + +import androidx.lifecycle.ViewModel + +class ReminderSettingsFragmentOtherViewModel : ViewModel() { + // TODO: Implement the ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/RepeatCycleDialogFragment.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/RepeatCycleDialogFragment.kt new file mode 100644 index 0000000..98ebb5e --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/RepeatCycleDialogFragment.kt @@ -0,0 +1,123 @@ +// RepeatCycleDialogFragment.kt +package com.example.firstapp.ui.reminderOther + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.bigkoo.pickerview.adapter.ArrayWheelAdapter +import com.contrarywind.view.WheelView +import com.example.firstapp.R +import com.google.android.material.bottomsheet.BottomSheetDialogFragment + +class RepeatCycleDialogFragment : BottomSheetDialogFragment() { + + private lateinit var wheelEvery: WheelView + private lateinit var wheelInterval: WheelView + private lateinit var wheelUnit: WheelView + + private var listener: OnCycleSelectedListener? = null + + interface OnCycleSelectedListener { + fun onCycleSelected(every: String, interval: String, unit: String) + } + + fun setOnCycleSelectedListener(listener: OnCycleSelectedListener) { + this.listener = listener + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view = inflater.inflate(R.layout.fragment_repeat_cycle_dialog_list_dialog, container, false) + + wheelEvery = view.findViewById(R.id.wheelEvery) + wheelInterval = view.findViewById(R.id.wheelInterval) + wheelUnit = view.findViewById(R.id.wheelUnit) + + // 设置 "每" 数据源 + val everyOptions = listOf("每") + val everyAdapter = ArrayWheelAdapter(everyOptions) + wheelEvery.setAdapter(everyAdapter) + wheelEvery.currentItem = 0 + + // 如果只有一个元素,禁止滚动 + if (everyOptions.size <= 1) { + wheelEvery.setCyclic(false) // 禁止循环 + wheelEvery.isEnabled = false // 禁止滚动 + } else { + wheelEvery.setCyclic(true) // 允许循环 + wheelEvery.isEnabled = true // 允许滚动 + } + + // 设置间隔数据源 + val intervalOptions = listOf("不重复") + (1..30).map { it.toString() } // 你可以根据需要调整范围 + val intervalAdapter = ArrayWheelAdapter(intervalOptions) + wheelInterval.setAdapter(intervalAdapter) + wheelInterval.currentItem = 0 + + // 设置单位数据源 + val unitOptions = listOf("天", "周", "月", "年") + val unitAdapter = ArrayWheelAdapter(unitOptions) + wheelUnit.setAdapter(unitAdapter) + + // 设置显示的项数,不要重复显示 +// wheelUnit.setItemsVisibleCount(4) // 设置可见项数,适当调整这个值 + + // 禁止循环滚动 + wheelUnit.setCyclic(false) + wheelUnit.currentItem = 0 + + // 初始状态:如果 "不重复" 被选中,隐藏 wheelEvery 和 wheelUnit + if (intervalOptions[wheelInterval.currentItem] == "不重复") { + wheelEvery.visibility = View.GONE + wheelUnit.visibility = View.GONE + } else { + wheelEvery.visibility = View.VISIBLE + wheelUnit.visibility = View.VISIBLE + } + + // 设置间隔选择监听器 + wheelInterval.setOnItemSelectedListener { index -> + val selectedInterval = intervalOptions[index] + if (selectedInterval == "不重复") { + wheelEvery.visibility = View.GONE + wheelUnit.visibility = View.GONE + } else { + wheelEvery.visibility = View.VISIBLE + wheelUnit.visibility = View.VISIBLE + } + } + + + + // 设置确认按钮 + view.findViewById<View>(R.id.repeat_cycle_btn_confirm).setOnClickListener { + val selectedEvery = everyOptions[wheelEvery.currentItem] + val selectedInterval = intervalOptions[wheelInterval.currentItem] + val selectedUnit = unitOptions[wheelUnit.currentItem] + listener?.onCycleSelected(selectedEvery, selectedInterval, selectedUnit) + dismiss() + } + + // 设置取消按钮 + view.findViewById<View>(R.id.repeat_cycle_btn_cancel).setOnClickListener { + dismiss() + } + + return view + } + + companion object { + + // TODO: Customize parameters + fun newInstance(): RepeatCycleDialogFragment = + RepeatCycleDialogFragment().apply { + arguments = Bundle().apply { + // 你可以在这里传递参数,但在这个例子中不需要 + } + } + + } +} diff --git a/app/src/main/java/com/example/firstapp/ui/reminderOther/TimePickerBottomSheetFragment.kt b/app/src/main/java/com/example/firstapp/ui/reminderOther/TimePickerBottomSheetFragment.kt new file mode 100644 index 0000000..1cdd986 --- /dev/null +++ b/app/src/main/java/com/example/firstapp/ui/reminderOther/TimePickerBottomSheetFragment.kt @@ -0,0 +1,72 @@ +package com.example.firstapp.ui.reminderOther + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.bigkoo.pickerview.adapter.ArrayWheelAdapter +import com.contrarywind.view.WheelView +import com.example.firstapp.R +import com.google.android.material.bottomsheet.BottomSheetDialogFragment + +class TimePickerBottomSheetFragment : BottomSheetDialogFragment() { + + private lateinit var wheelHour: WheelView + private lateinit var wheelMinute: WheelView + private lateinit var wheelSecond: WheelView + + private var listener: OnTimeSelectedListener? = null + + interface OnTimeSelectedListener { + fun onTimeSelected(hour: Int, minute: Int, second: Int) + } + + fun setOnTimeSelectedListener(listener: OnTimeSelectedListener) { + this.listener = listener + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view = inflater.inflate(R.layout.fragment_time_picker_bottom_sheet_list_dialog, container, false) + + wheelHour = view.findViewById(R.id.wheelHour2) + wheelMinute = view.findViewById(R.id.wheelMinute2) + wheelSecond = view.findViewById(R.id.wheelSecond2) + + // 设置小时数据源 + val hours = (0..23).map { it.toString() } + val hourAdapter = ArrayWheelAdapter(hours) + wheelHour.setAdapter(hourAdapter) + wheelHour.currentItem = 0 + + // 设置分钟数据源 + val minutes = (0..59).map { it.toString().padStart(2, '0') } + val minuteAdapter = ArrayWheelAdapter(minutes) + wheelMinute.setAdapter(minuteAdapter) + wheelMinute.currentItem = 0 + + // 设置秒数据源 + val seconds = (0..59).map { it.toString().padStart(2, '0') } + val secondAdapter = ArrayWheelAdapter(seconds) + wheelSecond.setAdapter(secondAdapter) + wheelSecond.currentItem = 0 + + // 设置确认按钮 + view.findViewById<View>(R.id.btn_confirm2).setOnClickListener { + val selectedHour = wheelHour.currentItem + val selectedMinute = wheelMinute.currentItem + val selectedSecond = wheelSecond.currentItem + listener?.onTimeSelected(selectedHour, selectedMinute, selectedSecond) + dismiss() + } + + // 设置取消按钮 + view.findViewById<View>(R.id.btn_cancel2).setOnClickListener { + dismiss() + } + + return view + } +} diff --git a/app/src/main/res/drawable/button_blue.xml b/app/src/main/res/drawable/button_blue.xml new file mode 100644 index 0000000..3a090f6 --- /dev/null +++ b/app/src/main/res/drawable/button_blue.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#2196F3"/> + <corners android:radius="4dp"/> +</shape> \ No newline at end of file diff --git a/app/src/main/res/drawable/button_pink.xml b/app/src/main/res/drawable/button_pink.xml new file mode 100644 index 0000000..e3254a3 --- /dev/null +++ b/app/src/main/res/drawable/button_pink.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#FF4081"/> + <corners android:radius="4dp"/> +</shape> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_add.xml b/app/src/main/res/drawable/ic_add.xml new file mode 100644 index 0000000..baf6816 --- /dev/null +++ b/app/src/main/res/drawable/ic_add.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#2196F3" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"/> +</vector> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_anniversary.xml b/app/src/main/res/drawable/ic_anniversary.xml new file mode 100644 index 0000000..1c04274 --- /dev/null +++ b/app/src/main/res/drawable/ic_anniversary.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FF4081" + android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/> +</vector> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_delete.xml b/app/src/main/res/drawable/ic_delete.xml new file mode 100644 index 0000000..dd53e48 --- /dev/null +++ b/app/src/main/res/drawable/ic_delete.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FF4081" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13H7v-2h10v2z"/> +</vector> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_edit.xml b/app/src/main/res/drawable/ic_edit.xml new file mode 100644 index 0000000..704b4e6 --- /dev/null +++ b/app/src/main/res/drawable/ic_edit.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#757575" + android:pathData="M3,17.46v3.04c0,0.28 0.22,0.5 0.5,0.5h3.04c0.13,0 0.26,-0.05 0.35,-0.15L17.81,9.94l-3.75,-3.75L3.15,17.1c-0.1,0.1 -0.15,0.22 -0.15,0.36zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/> +</vector> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_reminder_other_add2.xml b/app/src/main/res/layout/activity_reminder_other_add2.xml new file mode 100644 index 0000000..80bac0d --- /dev/null +++ b/app/src/main/res/layout/activity_reminder_other_add2.xml @@ -0,0 +1,194 @@ +<?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" + android:background="?attr/fullscreenBackgroundColor" + android:theme="@style/ThemeOverlay.FirstApp.FullscreenContainer" + tools:context=".ui.reminderOther.ReminderOtherAddActivity2"> + + <!-- The primary full-screen view. This can be replaced with whatever view + is needed to present your content, e.g. VideoView, SurfaceView, + TextureView, etc. --> + <TextView + android:id="@+id/fullscreen_content" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:keepScreenOn="true" + android:text="@string/dummy_content" + android:textColor="?attr/fullscreenTextColor" + android:textSize="50sp" + android:textStyle="bold" /> + + <!-- This FrameLayout insets its children based on system windows using + android:fitsSystemWindows. --> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fitsSystemWindows="true"> + + <LinearLayout + android:id="@+id/fullscreen_content_controls" + style="@style/Widget.Theme.FirstApp.ButtonBar.Fullscreen" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom|center_horizontal" + android:orientation="horizontal" + tools:ignore="UselessParent"> + + <EditText + android:id="@+id/et_special_day_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="请输入纪念日名称" + android:inputType="text" + android:ems="10" + android:background="?attr/editTextBackground"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="日子类型" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <RadioGroup + android:id="@+id/rg_day_type" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingBottom="16dp"> + + <RadioButton + android:id="@+id/rb_anniversary" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="纪念日"/> + + <!-- Add more RadioButton items as needed --> + + </RadioGroup> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="日期" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <DatePicker + android:id="@+id/dp_date" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="重复周期" + android:textSize="16sp" + android:paddingTop="16dp"/> + +<!-- <Spinner--> +<!-- android:id="@+id/sp_repeat_cycle"--> +<!-- android:layout_width="match_parent"--> +<!-- android:layout_height="wrap_content"--> +<!-- android:entries="@array/repeat_cycles"--> +<!-- android:layout_marginBottom="16dp"/>--> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="定期提醒" + android:textSize="16sp" + android:paddingTop="16dp"/> + +<!-- <Spinner--> +<!-- android:id="@+id/sp_regular_reminder"--> +<!-- android:layout_width="match_parent"--> +<!-- android:layout_height="wrap_content"--> +<!-- android:entries="@array/regular_reminders"--> +<!-- android:layout_marginBottom="16dp"/>--> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="每天提醒" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <Switch + android:id="@+id/sw_daily_reminder" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end" + android:checked="false" + android:layout_marginBottom="16dp"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="时间精确到秒" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <Switch + android:id="@+id/sw_time_to_second" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end" + android:checked="false" + android:layout_marginBottom="16dp"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="置于首页顶部" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <Switch + android:id="@+id/sw_top_of_homepage" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end" + android:checked="false" + android:layout_marginBottom="16dp"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="包含起始日 (+1天)" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <Switch + android:id="@+id/sw_include_start_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end" + android:checked="false" + android:layout_marginBottom="16dp"/> + + <Button + android:id="@+id/btn_save" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="保存" + android:layout_marginTop="16dp"/> + + + <Button + android:id="@+id/dummy_button" + style="?android:attr/buttonBarButtonStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/dummy_button" /> + + </LinearLayout> + </FrameLayout> + +</FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/date_record_layout.xml b/app/src/main/res/layout/date_record_layout.xml new file mode 100644 index 0000000..e833114 --- /dev/null +++ b/app/src/main/res/layout/date_record_layout.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="16dp"> + + <!-- 标题 --> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="请输入纪念日名称" + android:textSize="18sp" + android:textColor="#333333" + android:layout_marginBottom="16dp"/> + + <!-- 日期选项列表 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:background="#FFFFFF" + android:padding="16dp"> + + <!-- 日子类型 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="8dp"> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="日子类型" + android:textColor="#333333"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="纪念日 >" + android:textColor="#999999"/> + </LinearLayout> + + <!-- 日期 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="8dp"> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="日期" + android:textColor="#333333"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="乙巳(2025)七月初七周五 >" + android:textColor="#999999"/> + </LinearLayout> + + <!-- 重复周期 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="8dp"> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="重复周期" + android:textColor="#333333"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="每年重新倒数 >" + android:textColor="#999999"/> + </LinearLayout> + + <!-- 提前提醒 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="8dp"> + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="提前提醒" + android:textColor="#333333"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="一周 >" + android:textColor="#999999"/> + </LinearLayout> + </LinearLayout> + + <!-- 底部按钮 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginTop="32dp"> + + <Button + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="保存" + android:textColor="#FFFFFF" + android:background="@drawable/button_blue" + android:layout_marginEnd="8dp"/> + + <Button + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="重置" + android:textColor="#FFFFFF" + android:background="@drawable/button_pink" + android:layout_marginStart="8dp"/> + </LinearLayout> +</LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml index 2fdb54c..83e6427 100644 --- a/app/src/main/res/layout/fragment_notifications.xml +++ b/app/src/main/res/layout/fragment_notifications.xml @@ -49,6 +49,25 @@ android:src="@drawable/right_forward" /> </RelativeLayout> + <!-- 设置其他提醒 --> + <RelativeLayout + android:id="@+id/settings_reminder_other" + style="@style/SettingsItem"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:text="设置其他提醒" /> + + <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="match_parent" diff --git a/app/src/main/res/layout/fragment_reminder_settings_fragment_other.xml b/app/src/main/res/layout/fragment_reminder_settings_fragment_other.xml new file mode 100644 index 0000000..dba5751 --- /dev/null +++ b/app/src/main/res/layout/fragment_reminder_settings_fragment_other.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout 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.reminderOther.ReminderSettingsFragmentOther"> + + <!-- 主要内容区域 --> +<!-- <LinearLayout--> +<!-- android:layout_width="match_parent"--> +<!-- android:layout_height="match_parent"--> +<!-- android:layout_above="@+id/bottom_navigation"--> +<!-- android:orientation="vertical">--> + +<!-- <!– 倒数日列表 –>--> +<!-- <androidx.recyclerview.widget.RecyclerView--> +<!-- android:id="@+id/countdown_list"--> +<!-- android:layout_width="match_parent"--> +<!-- android:layout_height="match_parent"--> +<!-- android:padding="16dp" />--> + +<!-- </LinearLayout>--> + + <!-- 底部导航栏 --> + <LinearLayout + android:id="@+id/bottom_navigation" + android:layout_width="match_parent" + android:layout_height="56dp" + android:layout_alignParentBottom="true" + android:background="#FFFFFF" + android:orientation="horizontal" + android:elevation="8dp" + android:layout_marginTop="610dp" + > + + <ImageButton + android:id="@+id/btn_add" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:src="@drawable/ic_add" + android:contentDescription="添加"/> + + <ImageButton + android:id="@+id/btn_edit" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:src="@drawable/ic_edit" + android:contentDescription="编辑"/> + + <ImageButton + android:id="@+id/btn_delete" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:src="@drawable/ic_delete" + android:contentDescription="删除"/> + + </LinearLayout> + +</LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_reminder_settings_fragment_other_add.xml b/app/src/main/res/layout/fragment_reminder_settings_fragment_other_add.xml new file mode 100644 index 0000000..65fefa5 --- /dev/null +++ b/app/src/main/res/layout/fragment_reminder_settings_fragment_other_add.xml @@ -0,0 +1,109 @@ +<?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" + xmlns:app="http://schemas.android.com/apk/res-auto" + tools:context=".ui.reminderOther.ReminderSettingsFragmentOtherAdd"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="16dp"> + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="16dp"> + + <EditText + android:id="@+id/et_special_day_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="请输入纪念日名称" + android:inputType="text" + android:ems="10" + android:background="?attr/editTextBackground"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="日子类型" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <Spinner + android:id="@+id/sp_day_type" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="12dp" + android:background="@android:drawable/btn_dropdown" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="日期" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <EditText + android:id="@+id/et_date" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="选择日期" + android:focusable="false" + android:clickable="true" + android:padding="12dp" + android:background="@android:drawable/edit_text" + android:textSize="16sp" + android:layout_marginBottom="16dp"/> + + + <TextView + android:id="@+id/tv_repeat_cycle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="重复周期" + android:textSize="16sp" + android:paddingTop="16dp" + android:clickable="true" + android:focusable="true" + android:textColor="?attr/colorPrimary" /> + + <TextView + android:id="@+id/tv_selected_cycle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="选择的重复周期: " + android:textSize="16sp" + android:paddingTop="8dp"/> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="提前提醒" + android:textSize="16sp" + android:paddingTop="16dp"/> + + <!-- 时间选择按钮 --> + <EditText + android:id="@+id/et_time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:hint="选择时间" + android:focusable="false" + android:clickable="true" + android:textColor="@android:color/black" /> + + + + <Button + android:id="@+id/btn_save" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="保存" + android:layout_marginTop="16dp"/> + + </LinearLayout> + </ScrollView> +</FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_repeat_cycle_dialog_list_dialog.xml b/app/src/main/res/layout/fragment_repeat_cycle_dialog_list_dialog.xml new file mode 100644 index 0000000..1956de5 --- /dev/null +++ b/app/src/main/res/layout/fragment_repeat_cycle_dialog_list_dialog.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="16dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="16dp"> + + <com.contrarywind.view.WheelView + android:id="@+id/wheelEvery" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" /> + + <com.contrarywind.view.WheelView + android:id="@+id/wheelInterval" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" /> + + <com.contrarywind.view.WheelView + android:id="@+id/wheelUnit" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="end" + android:padding="16dp"> + + <Button + android:id="@+id/repeat_cycle_btn_cancel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="取消" /> + + <Button + android:id="@+id/repeat_cycle_btn_confirm" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="确定" + android:layout_marginStart="16dp" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/fragment_time_picker_bottom_sheet_list_dialog.xml b/app/src/main/res/layout/fragment_time_picker_bottom_sheet_list_dialog.xml new file mode 100644 index 0000000..a8c6b55 --- /dev/null +++ b/app/src/main/res/layout/fragment_time_picker_bottom_sheet_list_dialog.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="16dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="16dp"> + + <com.contrarywind.view.WheelView + android:id="@+id/wheelHour2" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" /> + + <com.contrarywind.view.WheelView + android:id="@+id/wheelMinute2" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" /> + + <com.contrarywind.view.WheelView + android:id="@+id/wheelSecond2" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="end" + android:padding="16dp"> + + <Button + android:id="@+id/btn_cancel2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="取消" /> + + <Button + android:id="@+id/btn_confirm2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="确定" + android:layout_marginStart="16dp" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/item_countdown.xml b/app/src/main/res/layout/item_countdown.xml new file mode 100644 index 0000000..3296cc2 --- /dev/null +++ b/app/src/main/res/layout/item_countdown.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.cardview.widget.CardView 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="wrap_content" + android:layout_marginBottom="8dp" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="16dp" + android:background="#FFF5F5"> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:orientation="vertical"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical"> + + <ImageView + android:id="@+id/icon_type" + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_marginEnd="8dp" + android:src="@drawable/ic_anniversary"/> + + <TextView + android:id="@+id/text_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="结婚一周年纪念日" + android:textColor="#333333" + android:textSize="16sp"/> + </LinearLayout> + + <TextView + android:id="@+id/text_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:text="起始日期 2025.01.14" + android:textColor="#999999" + android:textSize="12sp"/> + </LinearLayout> + + <TextView + android:id="@+id/text_days" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="265天后" + android:textColor="#333333" + android:textSize="16sp" + android:textStyle="bold"/> + </LinearLayout> + +</androidx.cardview.widget.CardView> \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 293c825..59c1e00 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -31,6 +31,16 @@ app:exitAnim="@anim/nav_default_exit_anim" app:popEnterAnim="@anim/nav_default_pop_enter_anim" app:popExitAnim="@anim/nav_default_pop_exit_anim" /> + + <!-- 新增的action,跳转到 ReminderSettingsFragmentOther --> + <action + android:id="@+id/action_settings_to_reminderSettingsFragmentOther" + app:destination="@id/reminderSettingsFragmentOther" + app:enterAnim="@anim/nav_default_enter_anim" + app:exitAnim="@anim/nav_default_exit_anim" + app:popEnterAnim="@anim/nav_default_pop_enter_anim" + app:popExitAnim="@anim/nav_default_pop_exit_anim" /> + </fragment> <fragment @@ -38,4 +48,23 @@ android:name="com.example.firstapp.ui.reminder.ReminderSettingsFragment" android:label="设置提醒" tools:layout="@layout/fragment_reminder_settings" /> + + + + <fragment + android:id="@+id/reminderSettingsFragmentOther" + android:name="com.example.firstapp.ui.reminderOther.ReminderSettingsFragmentOther" + android:label="设置其他提醒" + tools:layout="@layout/fragment_reminder_settings_fragment_other" > + + <action + android:id="@+id/action_reminderSettingsFragmentOther_to_reminderSettingsFragmentOtherAdd" + app:destination="@id/reminderSettingsFragmentOtherAdd" /> + </fragment> + + <fragment + android:id="@+id/reminderSettingsFragmentOtherAdd" + android:name="com.example.firstapp.ui.reminderOther.ReminderSettingsFragmentOtherAdd" + android:label="新增" /> + </navigation> \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 64e57ea..e992cf6 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -13,4 +13,9 @@ <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> </style> + + <style name="ThemeOverlay.FirstApp.FullscreenContainer" parent=""> + <item name="fullscreenBackgroundColor">@color/light_blue_900</item> + <item name="fullscreenTextColor">@color/light_blue_A400</item> + </style> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..e52391d --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,6 @@ +<resources> + <declare-styleable name="FullscreenAttrs"> + <attr name="fullscreenBackgroundColor" format="color" /> + <attr name="fullscreenTextColor" format="color" /> + </declare-styleable> +</resources> \ 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 f8c6127..426ac4e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -7,4 +7,9 @@ <color name="teal_700">#FF018786</color> <color name="black">#FF000000</color> <color name="white">#FFFFFFFF</color> + <color name="light_blue_600">#FF039BE5</color> + <color name="light_blue_900">#FF01579B</color> + <color name="light_blue_A200">#FF40C4FF</color> + <color name="light_blue_A400">#FF00B0FF</color> + <color name="black_overlay">#66000000</color> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index e00c2dd..d4ac5d6 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -2,4 +2,6 @@ <!-- Default screen margins, per the Android Design guidelines. --> <dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen> + <dimen name="list_item_spacing">16dp</dimen> + <dimen name="list_item_spacing_half">8dp</dimen> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b58df45..99924ef 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,5 +6,50 @@ <string name="notification_content">智信管家APP</string> + <string name="title_activity_reminder_other_add">ReminderOtherAddActivity</string> + <string name="dummy_button">Dummy Button</string> + <string name="dummy_content">DUMMY\nCONTENT</string> + <string name="title_activity_reminder_other_add2">添加纪念日</string> + + + + <string-array name="day_types"> + <item>纪念日</item> + <item>生日</item> + <item>节日</item> + <!-- 可以根据需要添加更多选项 --> + </string-array> + + <string-array name="day_month_year_options"> + <item>天</item> + <item>月</item> + <item>年</item> + </string-array> + + <!-- 第一级选择器选项 --> + <string-array name="level1_options"> + <item>不重复</item> + <item>每</item> + </string-array> + + <!-- 第二级选择器选项 (1到10000) --> + <string-array name="level2_options"> + <item>1</item> + <item>2</item> + <item>3</item> + <item>4</item> + <!-- 可继续添加更多数字 --> + </string-array> + + <!-- 第三级选择器选项 (天、周、月、年) --> + <string-array name="level3_options"> + <item>天</item> + <item>周</item> + <item>月</item> + <item>年</item> + </string-array> + + + </resources> \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 1e71de7..e08b4e9 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,10 +1,20 @@ <resources> -<style name="SettingsItem"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:padding">16dp</item> - <item name="android:background">?android:attr/selectableItemBackground</item> - <item name="android:clickable">true</item> - <item name="android:focusable">true</item> -</style> + + <style name="SettingsItem"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:padding">16dp</item> + <item name="android:background">?android:attr/selectableItemBackground</item> + <item name="android:clickable">true</item> + <item name="android:focusable">true</item> + </style> + + <style name="Widget.Theme.FirstApp.ActionBar.Fullscreen" parent="Widget.AppCompat.ActionBar"> + <item name="android:background">@color/black_overlay</item> + </style> + + <style name="Widget.Theme.FirstApp.ButtonBar.Fullscreen" parent=""> + <item name="android:background">@color/black_overlay</item> + <item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item> + </style> </resources> diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index d48f877..b91897b 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,6 +1,6 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> -<!-- <style name="Theme.FirstApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">--> + <!-- <style name="Theme.FirstApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">--> <style name="Theme.FirstApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <!-- Primary brand color. --> <item name="colorPrimary">@color/purple_500</item> @@ -14,4 +14,15 @@ <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> </style> + + <style name="Theme.FirstApp.Fullscreen" parent="Theme.FirstApp"> + <item name="android:actionBarStyle">@style/Widget.Theme.FirstApp.ActionBar.Fullscreen</item> + <item name="android:windowActionBarOverlay">true</item> + <item name="android:windowBackground">@null</item> + </style> + + <style name="ThemeOverlay.FirstApp.FullscreenContainer" parent=""> + <item name="fullscreenBackgroundColor">@color/light_blue_600</item> + <item name="fullscreenTextColor">@color/light_blue_A200</item> + </style> </resources> \ No newline at end of file -- Gitblit v1.9.3