Skip to content

Commit 213028b

Browse files
authored
Merge pull request #4985 from delta1513/delta-issue-4225
Moved the About dialog to an activity
2 parents be4371d + 46de7df commit 213028b

File tree

45 files changed

+194
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+194
-194
lines changed

android/BOINC/app/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,21 @@ def validateTranslations() {
219219
}
220220
}
221221

222+
new File('app/src/main/AndroidManifest.xml').each {
223+
def source = it
224+
mainStringsMap.each {
225+
if (!it.value) {
226+
def string = it
227+
source.eachLine {
228+
if (it.contains(string.key)) {
229+
string.setValue(true)
230+
return
231+
}
232+
}
233+
}
234+
}
235+
}
236+
222237
def mainStringsContainsRedundantKeys = false
223238
mainStringsMap.each {
224239
if (!it.value) {

android/BOINC/app/src/main/AndroidManifest.xml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?><!--
22
This file is part of BOINC.
33
http://boinc.berkeley.edu
4-
Copyright (C) 2021 University of California
4+
Copyright (C) 2022 University of California
55
66
BOINC is free software; you can redistribute it and/or modify it
77
under the terms of the GNU Lesser General Public License
@@ -29,7 +29,7 @@
2929
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
3030
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
3131
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
32-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
32+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
3333
<uses-permission android:name="android.permission.INTERNET" />
3434
<uses-permission android:name="android.permission.WAKE_LOCK" />
3535
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -51,7 +51,7 @@
5151
android:required="false" />
5252
<uses-feature
5353
android:name="android.hardware.type.television"
54-
android:required="false" /> <!-- Effectively a hint for the Google Play store only -->
54+
android:required="false" />
5555

5656
<application
5757
android:name=".BOINCApplication"
@@ -61,6 +61,14 @@
6161
android:label="@string/app_name"
6262
android:largeHeap="true"
6363
android:theme="@style/AppTheme">
64+
<activity
65+
android:name=".attach.AboutActivity"
66+
android:label="@string/about_title"
67+
android:exported="false">
68+
<meta-data
69+
android:name="android.support.PARENT_ACTIVITY"
70+
android:value="edu.berkeley.boinc.BOINCActivity" />
71+
</activity>
6472
<activity
6573
android:name=".ui.eventlog.EventLogActivity"
6674
android:label="@string/menu_eventlog">
@@ -71,10 +79,10 @@
7179
<activity
7280
android:name=".SplashActivity"
7381
android:configChanges="orientation|keyboardHidden|screenSize"
82+
android:exported="true"
7483
android:label="@string/app_name"
7584
android:noHistory="true"
76-
android:theme="@style/AppTheme.NoActionBar"
77-
android:exported="true">
85+
android:theme="@style/AppTheme.NoActionBar">
7886
<intent-filter>
7987
<action android:name="android.intent.action.MAIN" />
8088

@@ -125,27 +133,34 @@
125133
android:process=":remote" />
126134
<service android:name=".attach.ProjectAttachService" />
127135

128-
<receiver android:name=".receiver.BootReceiver"
129-
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
130-
android:exported="true">
136+
<receiver
137+
android:name=".receiver.BootReceiver"
138+
android:exported="true"
139+
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
131140
<intent-filter>
132141
<action android:name="android.intent.action.BOOT_COMPLETED" />
133142
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
143+
134144
<category android:name="android.intent.category.DEFAULT" />
135145
</intent-filter>
136146
</receiver>
137-
<receiver android:name=".receiver.PowerConnectedReceiver"
147+
<receiver
148+
android:name=".receiver.PowerConnectedReceiver"
138149
android:exported="true">
139-
<intent-filter>
150+
<intent-filter>
140151
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
152+
141153
<category android:name="android.intent.category.DEFAULT" />
142154
</intent-filter>
143155
</receiver>
144-
<receiver android:name=".receiver.PackageReplacedReceiver"
156+
<receiver
157+
android:name=".receiver.PackageReplacedReceiver"
145158
android:exported="true">
146159
<intent-filter>
147160
<action android:name="android.intent.action.PACKAGE_REPLACED" />
161+
148162
<category android:name="android.intent.category.DEFAULT" />
163+
149164
<data
150165
android:path="edu.berkeley.boinc"
151166
android:scheme="package" />

android/BOINC/app/src/main/java/edu/berkeley/boinc/BOINCActivity.kt

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import androidx.fragment.app.replace
5151
import androidx.lifecycle.lifecycleScope
5252
import edu.berkeley.boinc.adapter.NavDrawerListAdapter
5353
import edu.berkeley.boinc.adapter.NavDrawerListAdapter.NavDrawerItem
54+
import edu.berkeley.boinc.attach.AboutActivity
5455
import edu.berkeley.boinc.attach.AttachAccountManagerActivity
5556
import edu.berkeley.boinc.attach.SelectionListActivity
5657
import edu.berkeley.boinc.client.ClientStatus
@@ -271,27 +272,7 @@ class BOINCActivity : AppCompatActivity() {
271272
}
272273
R.string.menu_help -> startActivity(Intent(Intent.ACTION_VIEW, "https://boinc.berkeley.edu/wiki/BOINC_Help".toUri()))
273274
R.string.menu_report_issue -> startActivity(Intent(Intent.ACTION_VIEW, "https://boinc.berkeley.edu/trac/wiki/ReportBugs".toUri()))
274-
R.string.menu_about -> {
275-
val dialog = Dialog(this).apply {
276-
requestWindowFeature(Window.FEATURE_NO_TITLE)
277-
setContentView(R.layout.dialog_about)
278-
}
279-
val returnB = dialog.findViewById<Button>(R.id.returnB)
280-
val tvVersion = dialog.findViewById<TextView>(R.id.version)
281-
try {
282-
val packageInfo = if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
283-
packageManager.getPackageInfo(packageName, PackageInfoFlags.of(0))
284-
} else {
285-
@Suppress("DEPRECATION")
286-
packageManager.getPackageInfo(packageName, 0)
287-
}
288-
tvVersion.text = getString(R.string.about_version, packageInfo.versionName)
289-
} catch (e: PackageManager.NameNotFoundException) {
290-
Logging.logWarning(Logging.Category.USER_ACTION, "version name not found.")
291-
}
292-
returnB.setOnClickListener { dialog.dismiss() }
293-
dialog.show()
294-
}
275+
R.string.menu_about -> startActivity(Intent(this, AboutActivity::class.java))
295276
R.string.menu_eventlog -> startActivity(Intent(this, EventLogActivity::class.java))
296277
R.string.projects_add -> startActivity(Intent(this, SelectionListActivity::class.java))
297278
R.string.attachproject_acctmgr_header -> startActivity(Intent(this, AttachAccountManagerActivity::class.java))
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* This file is part of BOINC.
3+
* http://boinc.berkeley.edu
4+
* Copyright (C) 2022 University of California
5+
*
6+
* BOINC is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU Lesser General Public License
8+
* as published by the Free Software Foundation,
9+
* either version 3 of the License, or (at your option) any later version.
10+
*
11+
* BOINC is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
* See the GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
package edu.berkeley.boinc.attach
20+
21+
import android.content.pm.PackageManager
22+
import android.content.pm.PackageManager.PackageInfoFlags
23+
import android.os.Build.VERSION
24+
import android.os.Build.VERSION_CODES
25+
import androidx.appcompat.app.AppCompatActivity
26+
import android.os.Bundle
27+
import android.widget.TextView
28+
import edu.berkeley.boinc.R
29+
import edu.berkeley.boinc.utils.Logging
30+
31+
class AboutActivity : AppCompatActivity() {
32+
override fun onCreate(savedInstanceState: Bundle?) {
33+
super.onCreate(savedInstanceState)
34+
setContentView(R.layout.activity_about)
35+
36+
val tvVersion = findViewById<TextView>(R.id.BOINCVersionTextView)
37+
38+
try {
39+
val packageInfo = if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
40+
packageManager.getPackageInfo(packageName, PackageInfoFlags.of(0))
41+
} else {
42+
@Suppress("DEPRECATION")
43+
packageManager.getPackageInfo(packageName, 0)
44+
}
45+
tvVersion.text = getString(R.string.about_version, packageInfo.versionName)
46+
} catch (e: PackageManager.NameNotFoundException) {
47+
Logging.logWarning(Logging.Category.USER_ACTION, "version name not found.")
48+
}
49+
}
50+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
This file is part of BOINC.
3+
http://boinc.berkeley.edu
4+
Copyright (C) 2022 University of California
5+
6+
BOINC is free software; you can redistribute it and/or modify it
7+
under the terms of the GNU Lesser General Public License
8+
as published by the Free Software Foundation,
9+
either version 3 of the License, or (at your option) any later version.
10+
11+
BOINC is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
See the GNU Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public License
17+
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
18+
-->
19+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
20+
xmlns:app="http://schemas.android.com/apk/res-auto"
21+
xmlns:tools="http://schemas.android.com/tools"
22+
android:layout_width="match_parent"
23+
android:layout_height="match_parent"
24+
android:orientation="vertical"
25+
tools:context=".attach.AboutActivity">
26+
27+
<TextView
28+
android:id="@+id/textView5"
29+
android:layout_width="match_parent"
30+
android:layout_height="wrap_content"
31+
android:gravity="center_horizontal"
32+
android:paddingTop="16px"
33+
android:text="@string/about_name"
34+
android:textAppearance="?android:attr/textAppearanceLarge"
35+
android:textColor="?android:attr/textColorPrimary"
36+
android:textStyle="bold" />
37+
38+
<TextView
39+
android:id="@+id/BOINCVersionTextView"
40+
android:layout_width="match_parent"
41+
android:layout_height="wrap_content"
42+
android:gravity="center_horizontal"
43+
android:padding="10dp"
44+
android:textAppearance="?android:attr/textAppearanceSmall"
45+
android:textColor="?android:attr/textColorPrimary" />
46+
47+
<TextView
48+
android:id="@+id/textView6"
49+
android:layout_width="match_parent"
50+
android:layout_height="wrap_content"
51+
android:gravity="center_horizontal"
52+
android:paddingLeft="10dp"
53+
android:paddingRight="10dp"
54+
android:text="@string/about_copyright"
55+
android:textAppearance="?android:attr/textAppearanceSmall"
56+
android:textColor="?android:attr/textColorPrimary" />
57+
58+
<TextView
59+
android:id="@+id/textView7"
60+
android:layout_width="match_parent"
61+
android:layout_height="wrap_content"
62+
android:gravity="center_horizontal"
63+
android:text="@string/about_copyright_reserved"
64+
android:textAppearance="?android:attr/textAppearanceSmall"
65+
android:textColor="?android:attr/textColorPrimary" />
66+
67+
<TextView
68+
android:id="@+id/textView8"
69+
android:layout_width="match_parent"
70+
android:layout_height="wrap_content"
71+
android:layout_margin="10dp"
72+
android:gravity="center_horizontal"
73+
android:text="@string/about_credits"
74+
android:textAppearance="?android:attr/textAppearanceSmall"
75+
android:textColor="?android:attr/textColorPrimary" />
76+
</LinearLayout>

android/BOINC/app/src/main/res/layout/dialog_about.xml

Lines changed: 0 additions & 99 deletions
This file was deleted.

android/BOINC/app/src/main/res/values-ar/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@
245245
<string name="menu_about">عن</string>
246246
<string name="menu_help">مساعدة</string>
247247
<!--about dialog-->
248-
<string name="about_button">العودة</string>
249248
<string name="about_title">عن</string>
250249
<string name="about_name">BOINC</string>
251250
<string name="about_version">اصدار %1$s</string>

android/BOINC/app/src/main/res/values-az/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@
245245
<string name="menu_about">Haqqında</string>
246246
<string name="menu_help">Yardım</string>
247247
<!--about dialog-->
248-
<string name="about_button">Qayıt</string>
249248
<string name="about_title">Haqqında</string>
250249
<string name="about_name">BOINC</string>
251250
<string name="about_version">Versiya %1$s</string>

0 commit comments

Comments
 (0)