Skip to content

Commit dbbfe8a

Browse files
committed
Beta_1.3.0 Formal Edition
Added "update News" pop-up interface Added PlayStore evaluation built-in interface Modify part of the "about" clause
1 parent c6e226d commit dbbfe8a

13 files changed

Lines changed: 279 additions & 22 deletions

File tree

.idea/deploymentTargetDropDown.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
applicationId "com.pccu.pccu"
2222
minSdk 24
2323
targetSdk 32
24-
versionCode 3
25-
versionName "Beta_1.2.0"
24+
versionCode 4
25+
versionName "Beta_1.3.0"
2626

2727
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2828
buildConfigField("String", "API_KEY", API_KEY)
@@ -77,6 +77,10 @@ android {
7777

7878
dependencies {
7979

80+
implementation 'com.google.android.play:core:1.10.3'
81+
implementation 'com.google.android.play:core-ktx:1.8.1'
82+
83+
8084
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10'
8185
implementation 'androidx.core:core-ktx:1.8.0'
8286

app/src/main/AndroidManifest.xml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
<activity
1919
android:name=".appStart.MainActivity"
2020
android:exported="true"
21-
android:screenOrientation="portrait">
21+
android:screenOrientation="portrait"
22+
android:theme="@style/Theme.PCCU.NoActionBar">
2223
<intent-filter>
2324
<action android:name="android.intent.action.MAIN" />
2425

@@ -29,42 +30,50 @@
2930
<activity
3031
android:name=".page.liveImage.LiveImagePage"
3132
android:exported="true"
32-
android:screenOrientation="portrait"/>
33+
android:screenOrientation="portrait"
34+
android:theme="@style/Theme.PCCU.NoActionBar"/>
3335
<!-- 新分頁-公告內文-Activity -->
3436
<activity
3537
android:name=".page.announcement.AnnouncementContentPage"
3638
android:exported="true"
37-
android:screenOrientation="portrait"/>
39+
android:screenOrientation="portrait"
40+
android:theme="@style/Theme.PCCU.NoActionBar"/>
3841
<!-- 新分頁-即時氣象-Activity -->
3942
<activity
4043
android:name=".appStart.CwbMainActivity"
4144
android:exported="true"
42-
android:screenOrientation="portrait"/>
45+
android:screenOrientation="portrait"
46+
android:theme="@style/Theme.PCCU.NoActionBar"/>
4347
<!-- 新分頁-即時氣象-Activity -->
4448
<activity
4549
android:name=".page.bus.search.BusSearchActivity"
4650
android:exported="true"
47-
android:screenOrientation="portrait"/>
51+
android:screenOrientation="portrait"
52+
android:theme="@style/Theme.PCCU.NoActionBar"/>
4853
<!-- 新分頁-即時氣象-Activity -->
4954
<activity
5055
android:name=".page.bus.BusRoutePage"
5156
android:exported="true"
52-
android:screenOrientation="portrait"/>
57+
android:screenOrientation="portrait"
58+
android:theme="@style/Theme.PCCU.NoActionBar"/>
5359
<!-- 新分頁- -->
5460
<activity
5561
android:name=".page.courseEvaluate.CourseEvaluatePage"
5662
android:exported="true"
57-
android:screenOrientation="portrait"/>
63+
android:screenOrientation="portrait"
64+
android:theme="@style/Theme.PCCU.NoActionBar"/>
5865
<!-- 新分頁- -->
5966
<activity
6067
android:name=".page.courseEvaluate.CourseEvaluateDepartmentCoursesPage"
6168
android:exported="true"
62-
android:screenOrientation="portrait"/>
69+
android:screenOrientation="portrait"
70+
android:theme="@style/Theme.PCCU.NoActionBar"/>
6371
<!-- 新分頁- -->
6472
<activity
6573
android:name=".page.courseEvaluate.search.CourseEvaluateSearchActivity"
6674
android:exported="true"
67-
android:screenOrientation="portrait"/>
75+
android:screenOrientation="portrait"
76+
android:theme="@style/Theme.PCCU.NoActionBar"/>
6877

6978
</application>
7079

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.pccu.pccu.about
2+
3+
import android.app.Activity
4+
import android.os.Bundle
5+
import android.view.View
6+
import android.widget.Toast
7+
import androidx.fragment.app.DialogFragment
8+
import com.google.android.play.core.review.ReviewManagerFactory
9+
import com.pccu.pccu.R
10+
import com.pccu.pccu.sharedFunctions.Object_SharedPreferences
11+
import kotlinx.android.synthetic.main.update_news_dialog.*
12+
import kotlinx.coroutines.DelicateCoroutinesApi
13+
14+
15+
/**
16+
* App更新公告彈窗介面 建構類 : "DialogFragment"
17+
* @author KILNETA
18+
* @since Beta_1.3.0
19+
*/
20+
class UpdateNewsDialog : DialogFragment(R.layout.update_news_dialog) {
21+
22+
/**
23+
* 初始化關閉按鈕
24+
* @author KILNETA
25+
* @since Beta_1.3.0
26+
*/
27+
@DelicateCoroutinesApi
28+
private fun initCloseButton(){
29+
//當按鈕被按下
30+
close_Button.setOnClickListener {
31+
//關閉彈窗
32+
dismiss()
33+
}
34+
}
35+
36+
/**
37+
* 建構頁面
38+
* @param view [View] 該頁面的父類
39+
* @param savedInstanceState [Bundle] 傳遞的資料
40+
*
41+
* @author KILNETA
42+
* @since Beta_1.3.0
43+
*/
44+
@DelicateCoroutinesApi
45+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
46+
super.onViewCreated(view, savedInstanceState)
47+
//初始化關閉按鈕
48+
initCloseButton()
49+
50+
//開啟PlayStore 評價介面
51+
PlayStore_evaluate.setOnClickListener {
52+
val manager = ReviewManagerFactory.create(requireContext())
53+
val request = manager.requestReviewFlow()
54+
request.addOnCompleteListener { task ->
55+
if (task.isSuccessful) {
56+
val reviewInfo = task.result
57+
val flow = manager.launchReviewFlow(context as Activity, reviewInfo)
58+
flow.addOnCompleteListener { _ ->
59+
// The flow has finished. The API does not indicate whether the user
60+
// reviewed or not, or even whether the review dialog was shown. Thus, no
61+
// matter the result, we continue our app flow.
62+
}
63+
} else {
64+
Toast.makeText(
65+
context,
66+
"無法連接到 PlayStore",
67+
Toast.LENGTH_SHORT
68+
).show()
69+
}
70+
}
71+
}
72+
}
73+
74+
/**
75+
* 頁面關閉
76+
* @author KILNETA
77+
* @since Beta_1.3.0
78+
*/
79+
override fun dismiss() {
80+
super.dismiss()
81+
//確認公告已被已讀
82+
Object_SharedPreferences.save("News","update","true",requireContext())
83+
}
84+
}

app/src/main/java/com/pccu/pccu/appStart/MainActivity.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package com.pccu.pccu.appStart
22

33
import androidx.appcompat.app.AppCompatActivity
44
import android.os.Bundle
5+
import androidx.fragment.app.DialogFragment
56
import androidx.navigation.findNavController
67
import androidx.navigation.ui.setupWithNavController
78
import com.google.android.material.bottomnavigation.BottomNavigationView
89
import com.pccu.pccu.R
10+
import com.pccu.pccu.about.UpdateNewsDialog
11+
import com.pccu.pccu.sharedFunctions.Object_SharedPreferences
912

1013
/**
1114
* PCCU_APP主頁建構類 : "AppCompatActivity"
@@ -32,5 +35,19 @@ class MainActivity : AppCompatActivity(R.layout.activity_main){
3235
val navController = findNavController(R.id.nav_fragment)
3336
//底部導航視圖(bottom_navigation) 連結 導航控制器(nav_fragment)
3437
bottomNavigationView.setupWithNavController(navController)
38+
39+
//判斷公告是否已被已讀
40+
val updateNews = Object_SharedPreferences["News", "update", baseContext].toString()
41+
//若未被已讀 顯示公告介面
42+
if(updateNews != "true") {
43+
/**公告介面*/
44+
val news = UpdateNewsDialog()
45+
news.setStyle(
46+
DialogFragment.STYLE_NO_TITLE,
47+
android.R.style.Theme_Holo_Light_Dialog_MinWidth
48+
)
49+
//顯示介面
50+
news.show(supportFragmentManager, "UpdateNewsDialog")
51+
}
3552
}
3653
}

app/src/main/java/com/pccu/pccu/menu/FastLinksBottomMenu.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import android.net.Uri
1111
import android.widget.LinearLayout
1212
import androidx.fragment.app.DialogFragment
1313
import com.pccu.pccu.about.AboutUsDialog
14+
import com.pccu.pccu.about.UpdateNewsDialog
1415

1516
/**
1617
* 首頁快速連結彈窗介面 建構類 : "BottomSheetDialogFragment"
@@ -59,6 +60,18 @@ class FastLinksBottomMenu : BottomSheetDialogFragment() {
5960
/**Uri*/
6061
var uri: Uri
6162

63+
/**最 新 公 告*/
64+
view.findViewById<LinearLayout>(R.id.updateNews)
65+
.setOnClickListener{
66+
val updateNews = UpdateNewsDialog()
67+
updateNews.setStyle(
68+
DialogFragment.STYLE_NO_TITLE,
69+
android.R.style.Theme_Holo_Light_Dialog_MinWidth
70+
)
71+
//顯示介面
72+
updateNews.show(parentFragmentManager,"UpdateNewsDialog")
73+
}
74+
6275
/**關 於 我 們*/
6376
view.findViewById<LinearLayout>(R.id.aboutUs)
6477
.setOnClickListener{

app/src/main/java/com/pccu/pccu/page/courseEvaluate/CourseEvaluateDepartmentCoursesPage.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ package com.pccu.pccu.page.courseEvaluate
22

33
import android.content.IntentFilter
44
import android.os.Bundle
5-
import android.os.Handler
6-
import android.os.HandlerThread
7-
import android.os.Message
85
import android.view.View
96
import android.view.ViewGroup
107
import android.widget.LinearLayout
@@ -115,7 +112,6 @@ class CourseEvaluateDepartmentCoursesPage : AppCompatActivity(
115112
"聲明:",
116113
"  本程式之課程評價系統僅是提供便捷閱讀,無法保證評價之正確性,參考時請謹慎評估;" +
117114
"本程式亦無編輯課程評價數據之權限,數據由\"中國文化大學選課評價系統\"提供與管理。",
118-
"  (長按評價項可使用瀏覽器開啟)",
119115
"",
120116
"  評價條目、內文若出現部分無法顯示,或是內容出現問題,可聯繫程式負責方協助修正。",
121117
"",

app/src/main/java/com/pccu/pccu/page/courseEvaluate/CourseEvaluatePage.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ class CourseEvaluatePage : AppCompatActivity(R.layout.course_evaluate_page){
107107
"聲明:",
108108
"  本程式之課程評價系統僅是提供便捷閱讀,無法保證評價之正確性,參考時請謹慎評估;" +
109109
"本程式亦無編輯課程評價數據之權限,數據由\"中國文化大學選課評價系統\"提供與管理。",
110-
"  (長按評價項可使用瀏覽器開啟)",
111110
"",
112111
"  評價條目、內文若出現部分無法顯示,或是內容出現問題,可聯繫程式負責方協助修正。",
113112
"",

app/src/main/res/layout/fast_links.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,36 @@
99
android:paddingBottom="8dp"
1010
android:paddingTop="8dp">
1111

12+
<LinearLayout
13+
android:id="@+id/updateNews"
14+
android:gravity="center"
15+
android:layout_width="match_parent"
16+
android:layout_height="wrap_content"
17+
android:clickable="true"
18+
android:foreground="?attr/selectableItemBackground"
19+
android:orientation="horizontal"
20+
android:paddingBottom="8dp"
21+
android:paddingRight="20dp"
22+
android:paddingTop="8dp"
23+
android:focusable="true">
24+
25+
<ImageView
26+
android:layout_width="24dp"
27+
android:layout_height="24dp"
28+
android:layout_marginRight="24dp"
29+
android:src="@drawable/pccupage"
30+
app:tint="#737373" />
31+
32+
<TextView
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:layout_gravity="center_vertical"
36+
android:text="最 新 公 告"
37+
android:textColor="#737373"
38+
android:textSize="16sp" />
39+
40+
</LinearLayout>
41+
1242
<LinearLayout
1343
android:id="@+id/aboutUs"
1444
android:gravity="center"

0 commit comments

Comments
 (0)