app/build.gradle
@@ -15,8 +15,9 @@ compileSdk 34 defaultConfig { applicationId "com.cloudroam.smsManager" // applicationId "com.example.firstapp" applicationId "net.sourceforge.simcpux" // applicationId "net.sourceforge.simcpux" minSdk 24 targetSdk 34 versionCode 1 @@ -25,11 +26,27 @@ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { release { storeFile file('../keystore/sms-manager2.jks') storePassword 'Cloudroam!@#123' keyAlias 'sm' keyPassword 'Cloudroam!@#123' } debug { storeFile file('../keystore/keystore.jks') storePassword 'android' keyAlias 'android' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.debug signingConfig signingConfigs.release } debug { minifyEnabled false @@ -52,53 +69,6 @@ } } //dependencies { // // implementation libs.androidx.core.ktx // implementation libs.androidx.appcompat // implementation libs.material // implementation libs.androidx.constraintlayout // implementation libs.androidx.lifecycle.livedata.ktx // implementation libs.androidx.lifecycle.viewmodel.ktx // implementation libs.androidx.navigation.fragment.ktx // implementation libs.androidx.navigation.ui.ktx // testImplementation libs.junit // androidTestImplementation libs.androidx.junit // androidTestImplementation libs.androidx.espresso.core // // // def work_version = '2.8.1' // //noinspection GradleDependency // api("androidx.work:work-multiprocess:$work_version") // //noinspection GradleDependency // api("androidx.work:work-runtime-ktx:$work_version") // // //Android Room // def room_version = '2.5.2' // //noinspection GradleDependency // implementation "androidx.room:room-ktx:$room_version" // //noinspection GradleDependency // implementation "androidx.room:room-runtime:$room_version" // //noinspection GradleDependency // implementation "androidx.room:room-paging:$room_version" // //noinspection GradleDependency // implementation "androidx.room:room-rxjava2:$room_version" // //noinspection KaptUsageInsteadOfKsp // kapt "androidx.room:room-compiler:$room_version" // // //基础功能的工具类 // implementation("com.github.xuexiangjys.XUtil:xutil-core:2.0.0") // //附加功能的工具类 // implementation("com.github.xuexiangjys.XUtil:xutil-sub:2.0.0") // // // //Android Keep Alive(安卓保活),Cactus 集成双进程前台服务,JobScheduler,onePix(一像素),WorkManager,无声音乐 // //https://github.com/gyf-dev/Cactus // implementation 'com.gyf.cactus:cactus:1.1.3-beta13' //// implementation 'com.gyf.cactus:cactus-support:1.1.3-beta13' // //} android { packagingOptions { //去除FrpcLib的so,用时下载并动态加载 @@ -117,21 +87,6 @@ pickFirst 'META-INF/NOTICE.md' excludes += ['META-INF/DEPENDENCIES.txt', 'META-INF/LICENSE.txt', 'META-INF/NOTICE.txt', 'META-INF/NOTICE', 'META-INF/LICENSE', 'META-INF/DEPENDENCIES', 'META-INF/notice.txt', 'META-INF/license.txt', 'META-INF/dependencies.txt', 'META-INF/LGPL2.1'] excludes += ["META-INF/*.kotlin_module", "META-INF/*.version", "kotlin/**", "DebugProbesKt.bin"] } } signingConfigs { release { storeFile file('../keystore/sms-manager.jks') storePassword 'Cloudroam!@#123' keyAlias 'sm' keyPassword 'Cloudroam!@#123' } debug { storeFile file('../keystore/keystore.jks') storePassword 'android' keyAlias 'android' } } app/src/main/AndroidManifest.xml
@@ -86,6 +86,9 @@ android:usesCleartextTraffic="true" tools:targetApi="31"> <activity android:name=".activity.AboutCompanyActivity" android:exported="false" /> <activity android:name=".activity.SettingActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" @@ -140,21 +143,18 @@ android:theme="@style/Theme.ContentDetail" /> <activity android:name=".ui.profile.EditProfileActivity" android:exported="false"/> android:exported="false" /> <activity android:name=".ui.invitation.InvitationActivity" android:exported="false"/> android:exported="false" /> <activity android:name=".activity.ReminderListActivity" android:exported="false" android:label="提醒列表" /> <activity android:name=".activity.ReminderSettingsActivity" android:exported="false" android:label="设置提醒" /> </application> </manifest> app/src/main/java/com/example/firstapp/App.kt
@@ -16,6 +16,7 @@ import com.example.firstapp.database.repository.CodeRepository import com.example.firstapp.database.repository.KeywordRepository import com.example.firstapp.database.repository.MsgRepository import com.example.firstapp.database.repository.ReminderRepository import com.example.firstapp.database.service.RetrofitClient import com.example.firstapp.receiver.CactusReceiver import com.example.firstapp.service.ReminderWorker @@ -47,6 +48,7 @@ val msgRepository by lazy { MsgRepository(database.msgDao()) } val codeRepository by lazy { CodeRepository(database.codeDao()) } val keywordRepository by lazy { KeywordRepository(RetrofitClient.apiService,database.keywordDao()) } val reminderRepository by lazy { ReminderRepository(this) } companion object { const val TAG: String = "SmsForwarder" app/src/main/java/com/example/firstapp/activity/AboutCompanyActivity.kt
对比新文件 @@ -0,0 +1,54 @@ package com.example.firstapp.activity import android.content.Intent import android.net.Uri import android.os.Bundle import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import com.example.firstapp.R import com.example.firstapp.databinding.ActivityAboutCompanyBinding import com.example.firstapp.databinding.ActivitySettingBinding class AboutCompanyActivity : AppCompatActivity() { private lateinit var binding: ActivityAboutCompanyBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // enableEdgeToEdge() // 使用 ViewBinding 绑定布局 binding = ActivityAboutCompanyBinding.inflate(layoutInflater) setContentView(binding.root) // 使用 binding.root 设置布局 val toolbar = binding.aboutCompanyToolbar // 获取 Toolbar 并设置为 ActionBar setSupportActionBar(toolbar) // 显示返回按钮 supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) // 设置标题(如果没有在 XML 中设置标题,可以在代码中动态设置) supportActionBar?.title = "" // 备案号跳转 goto() } private fun goto(){ binding.recordNumberText.setOnClickListener { // 跳转到关于我们的 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("http://beian.miit.gov.cn/publish/query/indexFirst.action")) startActivity(intent) } } } app/src/main/java/com/example/firstapp/activity/SettingActivity.kt
@@ -10,6 +10,7 @@ import android.widget.Button import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.example.firstapp.databinding.ActivitySettingBinding import com.example.firstapp.R import com.example.firstapp.core.Core @@ -66,14 +67,26 @@ // 退出登录 logout() // 账号注销 accountClose() // 关于我们 aboutCompany() } private fun aboutCompany(){ binding.aboutCompany.setOnClickListener { // 跳转到关于我们的 val intent = Intent(this, AboutCompanyActivity::class.java) startActivity(intent) } } private fun accountClose(){ app/src/main/java/com/example/firstapp/core/Core.kt
@@ -15,6 +15,7 @@ val msg: MsgRepository by lazy { (app as App).msgRepository } val code: CodeRepository by lazy { (app as App).codeRepository } val keyword: KeywordRepository by lazy { (app as App).keywordRepository } // val reminder: KeywordRepository by lazy { (app as App).reminderRepository } fun init(app: Application) { this.app = app app/src/main/java/com/example/firstapp/ui/dashboard/DashboardFragment.kt
@@ -23,6 +23,7 @@ import android.graphics.Color import android.widget.GridLayout import android.widget.Toast import androidx.cardview.widget.CardView import androidx.lifecycle.lifecycleScope import com.example.firstapp.database.response.UserInfo import com.example.firstapp.database.service.RetrofitClient @@ -39,11 +40,14 @@ private var currentDateType = DateType.DAY private lateinit var barChart: BarChart private lateinit var pieChart: PieChart private lateinit var chartCourierDistriBution:CardView private lateinit var heatmapView: View private var currentUserInfo: UserInfo? = null // 确保使用你的实际数据类 private var startDateCur:String = "" private var endDateCur:String = "" private lateinit var bar_title:TextView private lateinit var pie_title:TextView enum class DateType { @@ -113,8 +117,8 @@ private fun setupTabLayout() { val weekStatsView = binding.layoutWeekStats.root val bar_title:TextView = weekStatsView.findViewById(R.id.bar_title) val pie_title:TextView = weekStatsView.findViewById(R.id.pie_title) bar_title = weekStatsView.findViewById(R.id.bar_title) pie_title = weekStatsView.findViewById(R.id.pie_title) binding.tabDateRange.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab?) { @@ -221,6 +225,7 @@ val weekStatsView = binding.layoutWeekStats.root barChart = weekStatsView.findViewById(R.id.chart_daily_packages) chartCourierDistriBution=weekStatsView.findViewById(R.id.chart_courier_card_view) pieChart = weekStatsView.findViewById(R.id.chart_courier_distribution) heatmapView = weekStatsView.findViewById(R.id.heatmap_yearly) @@ -431,24 +436,84 @@ PieEntry(stat.count.toFloat(), "${stat.courierName}(${stat.count})") } val dataSet = PieDataSet(entries, "快递公司分布") dataSet.colors = listOf( resources.getColor(R.color.purple_500), resources.getColor(R.color.teal_200), resources.getColor(R.color.purple_200), resources.getColor(R.color.teal_700) ) dataSet.valueTextSize = 14f // 增大数值文字大小 if (entries.isNotEmpty()) { val dataSet = PieDataSet(entries, "快递公司分布") dataSet.colors = listOf( resources.getColor(R.color.light_blue_600_1), resources.getColor(R.color.sunflower), resources.getColor(R.color.light_blue), resources.getColor(R.color.vermillion), resources.getColor(R.color.fish_belly_white), resources.getColor(R.color.light_green), resources.getColor(R.color.crimson), resources.getColor(R.color.sky_blue), resources.getColor(R.color.gold), resources.getColor(R.color.light_purple), resources.getColor(R.color.yellow), resources.getColor(R.color.canary_yellow), resources.getColor(R.color.red_purple), resources.getColor(R.color.light_cyan), resources.getColor(R.color.orange), resources.getColor(R.color.magenta), resources.getColor(R.color.light_purple_2), resources.getColor(R.color.bright_yellow), resources.getColor(R.color.emerald_green), resources.getColor(R.color.turmeric), resources.getColor(R.color.red_gold), resources.getColor(R.color.off_white), resources.getColor(R.color.tangerine), resources.getColor(R.color.aqua_blue), resources.getColor(R.color.frost), resources.getColor(R.color.wisteria), resources.getColor(R.color.cyan) ) dataSet.valueTextSize = 14f // 增大数值文字大小 val pieData = PieData(dataSet) pieData.setValueFormatter(object : ValueFormatter() { override fun getFormattedValue(value: Float): String { return value.toInt().toString() } }) val pieData = PieData(dataSet) pieData.setValueFormatter(object : ValueFormatter() { override fun getFormattedValue(value: Float): String { return value.toInt().toString() } }) pieChart.data = pieData pieChart.invalidate() pieChart.data = pieData pieChart.invalidate() pieChart.visibility = View.VISIBLE // 例如:隐藏 PieChart pie_title.visibility = View.VISIBLE chartCourierDistriBution.visibility =View.VISIBLE } else { // 如果 entries 为空,可以选择隐藏图表或设置一个默认显示 pieChart.visibility = View.GONE // 例如:隐藏 PieChart pie_title.visibility = View.GONE chartCourierDistriBution.visibility =View.GONE } // val dataSet = PieDataSet(entries, "快递公司分布") // dataSet.colors = listOf( // resources.getColor(R.color.purple_500), // resources.getColor(R.color.teal_200), // resources.getColor(R.color.purple_200), // resources.getColor(R.color.teal_700) // ) // dataSet.valueTextSize = 14f // 增大数值文字大小 // // val pieData = PieData(dataSet) // pieData.setValueFormatter(object : ValueFormatter() { // override fun getFormattedValue(value: Float): String { // return value.toInt().toString() // } // }) // // pieChart.data = pieData // pieChart.invalidate() } } private fun getDayLabels(): Array<String> { app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt
@@ -312,7 +312,7 @@ val userInfo = response.data // 本地保存我的邀请码 //PreferencesManager.setInviteCode(userInfo.intervialcode); // PreferencesManager.setInviteCode(userInfo.intervialcode); // 设置头像 Glide.with(this) .load(userInfo.cover) app/src/main/java/com/example/firstapp/ui/vip/MemberInfoCardViewModel.kt
@@ -19,7 +19,7 @@ val memberStatus: StateFlow<String> = _memberStatus // 头像 private val _cover = MutableStateFlow("http://192.168.1.201:9000/sms/avatar/avatar_default.png") private val _cover = MutableStateFlow("https://smart-manager-new.tos-cn-beijing.volces.com/sms/avatar/avatar_default.png") val cover: StateFlow<String> = _cover // vip头像 @@ -66,14 +66,14 @@ } } // vip头像 _vipCover.value ="http://192.168.1.201:9000/sms/member/vip.png" _vipCover.value ="https://smart-manager-new.tos-cn-beijing.volces.com/sms/member/vip.png" _background.value = R.drawable.vip_black_background _phoneTextColor.value ="#F2F2F2" _memberStatusColor.value ="#AAAAAA" }else{ _memberStatus.value = "未开通" _vipCover.value ="http://192.168.1.201:9000/sms/member/vip_no.png" _vipCover.value ="https://smart-manager-new.tos-cn-beijing.volces.com/sms/member/vip_no.png" _background.value =R.drawable.vip_white_background _phoneTextColor.value ="#37393B" _memberStatusColor.value ="#37393B" app/src/main/res/layout/activity_about_company.xml
对比新文件 @@ -0,0 +1,111 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".activity.AboutCompanyActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" tools:ignore="MissingConstraints"> <!-- Toolbar (标题栏) --> <androidx.appcompat.widget.Toolbar android:id="@+id/about_company_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#F9F9F9" android:elevation="4dp" android:layout_gravity="center" android:gravity="center" tools:ignore="MissingConstraints"> <!-- 自定义标题 TextView --> <TextView android:id="@+id/about_company_toolbar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="关于我们" android:textColor="@android:color/black" android:textSize="18sp" android:layout_gravity="center" android:gravity="center" /> <!-- 确保标题居中 --> </androidx.appcompat.widget.Toolbar> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" tools:ignore="MissingConstraints"> <ImageView android:layout_width="200dp" android:layout_height="200dp" android:src="@mipmap/logo" > </ImageView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" tools:ignore="MissingConstraints"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="版本10.10.0(101000000)" > </TextView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="380dp"> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" app:layout_constraintBottom_toBottomOf="parent" tools:ignore="MissingConstraints"> <TextView android:id="@+id/record_number_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="苏ICP备16047984号-1" > </TextView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" tools:ignore="MissingConstraints"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="苏州云游四方信息科技有限公司" > </TextView> </LinearLayout> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/activity_setting.xml
@@ -35,6 +35,24 @@ </androidx.appcompat.widget.Toolbar> <LinearLayout android:id="@+id/about_company" android:layout_width="match_parent" android:layout_height="50dp" android:gravity="center" android:orientation="vertical" android:background="#F9F9F9" android:layout_marginTop="1dp" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" android:text="关于我们" android:textColor="#000000" /> </LinearLayout> <LinearLayout android:id="@+id/account_close" android:layout_width="match_parent" android:layout_height="50dp" app/src/main/res/layout/layout_week_stats.xml
@@ -76,6 +76,7 @@ <!-- 饼图容器 --> <androidx.cardview.widget.CardView android:id="@+id/chart_courier_card_view" android:layout_width="match_parent" android:layout_height="400dp" android:layout_marginHorizontal="16dp" app/src/main/res/mipmap/logo.png
app/src/main/res/values/colors.xml
@@ -17,5 +17,33 @@ <color name="tab_selected">#FF039BE5</color> <color name="light_blue_new">#02A7F0</color> <color name="light_grey">#F6F7FB</color> 灰色主题 <color name="light_blue_600_1">#85DBE1</color> <color name="sunflower">#FFC20E</color> <color name="light_blue">#258BBC</color> <color name="vermillion">#F15A22</color> <color name="fish_belly_white">#FCEFE8</color> <color name="light_green">#A6D598</color> <color name="crimson">#AA2116</color> <color name="sky_blue">#9FE6B8</color> <color name="gold">#EACD76</color> <color name="light_purple">#E7BCF3</color> <color name="yellow">#FFDB5C</color> <color name="canary_yellow">#EAFF56</color> <color name="red_purple">#F173AC</color> <color name="light_cyan">#00A6AC</color> <color name="orange">#FF9F7F</color> <color name="magenta">#FB7293</color> <color name="light_purple_2">#E7BCF3</color> <color name="bright_yellow">#FFFF66</color> <color name="emerald_green">#3DE1AD</color> <color name="turmeric">#FFC773</color> <color name="red_gold">#F2BE45</color> <color name="off_white">#FFF2DF</color> <color name="tangerine">#FF7500</color> <color name="aqua_blue">#C0EBD7</color> <color name="frost">#E9F1F6</color> <color name="wisteria">#9B95C9</color> <color name="cyan">#009AD6</color> </resources> build.gradle
@@ -25,21 +25,3 @@ alias(libs.plugins.jetbrains.kotlin.android) apply false } //allprojects { // repositories { //// google() //// mavenCentral() //// jcenter() //// maven { url 'https://maven.aliyun.com/repository/google' } //// maven { url 'https://maven.aliyun.com/repository/central' } //// maven { url 'https://maven.aliyun.com/repository/public' } //// maven { url 'https://repo1.maven.org/maven2/' } //// maven { url 'https://oss.sonatype.org/content/repositories/public' } //// maven { url "https://jitpack.io" } // } // // // 将构建文件统一输出到项目根目录下的 build 文件夹 // setBuildDir(new File(rootDir, "build/${path.replaceAll(':', '/')}")) //}