Skip to content

Commit

Permalink
Merge pull request #4985 from delta1513/delta-issue-4225
Browse files Browse the repository at this point in the history
Moved the About dialog to an activity
  • Loading branch information
AenBleidd authored Oct 23, 2022
2 parents be4371d + 46de7df commit 213028b
Show file tree
Hide file tree
Showing 45 changed files with 194 additions and 194 deletions.
15 changes: 15 additions & 0 deletions android/BOINC/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ def validateTranslations() {
}
}

new File('app/src/main/AndroidManifest.xml').each {
def source = it
mainStringsMap.each {
if (!it.value) {
def string = it
source.eachLine {
if (it.contains(string.key)) {
string.setValue(true)
return
}
}
}
}
}

def mainStringsContainsRedundantKeys = false
mainStringsMap.each {
if (!it.value) {
Expand Down
37 changes: 26 additions & 11 deletions android/BOINC/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?><!--
This file is part of BOINC.
http://boinc.berkeley.edu
Copyright (C) 2021 University of California
Copyright (C) 2022 University of California
BOINC is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
Expand Down Expand Up @@ -29,7 +29,7 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -51,7 +51,7 @@
android:required="false" />
<uses-feature
android:name="android.hardware.type.television"
android:required="false" /> <!-- Effectively a hint for the Google Play store only -->
android:required="false" />

<application
android:name=".BOINCApplication"
Expand All @@ -61,6 +61,14 @@
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity
android:name=".attach.AboutActivity"
android:label="@string/about_title"
android:exported="false">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="edu.berkeley.boinc.BOINCActivity" />
</activity>
<activity
android:name=".ui.eventlog.EventLogActivity"
android:label="@string/menu_eventlog">
Expand All @@ -71,10 +79,10 @@
<activity
android:name=".SplashActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="@string/app_name"
android:noHistory="true"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down Expand Up @@ -125,27 +133,34 @@
android:process=":remote" />
<service android:name=".attach.ProjectAttachService" />

<receiver android:name=".receiver.BootReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:exported="true">
<receiver
android:name=".receiver.BootReceiver"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.PowerConnectedReceiver"
<receiver
android:name=".receiver.PowerConnectedReceiver"
android:exported="true">
<intent-filter>
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.PackageReplacedReceiver"
<receiver
android:name=".receiver.PackageReplacedReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />

<category android:name="android.intent.category.DEFAULT" />

<data
android:path="edu.berkeley.boinc"
android:scheme="package" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import androidx.fragment.app.replace
import androidx.lifecycle.lifecycleScope
import edu.berkeley.boinc.adapter.NavDrawerListAdapter
import edu.berkeley.boinc.adapter.NavDrawerListAdapter.NavDrawerItem
import edu.berkeley.boinc.attach.AboutActivity
import edu.berkeley.boinc.attach.AttachAccountManagerActivity
import edu.berkeley.boinc.attach.SelectionListActivity
import edu.berkeley.boinc.client.ClientStatus
Expand Down Expand Up @@ -271,27 +272,7 @@ class BOINCActivity : AppCompatActivity() {
}
R.string.menu_help -> startActivity(Intent(Intent.ACTION_VIEW, "https://boinc.berkeley.edu/wiki/BOINC_Help".toUri()))
R.string.menu_report_issue -> startActivity(Intent(Intent.ACTION_VIEW, "https://boinc.berkeley.edu/trac/wiki/ReportBugs".toUri()))
R.string.menu_about -> {
val dialog = Dialog(this).apply {
requestWindowFeature(Window.FEATURE_NO_TITLE)
setContentView(R.layout.dialog_about)
}
val returnB = dialog.findViewById<Button>(R.id.returnB)
val tvVersion = dialog.findViewById<TextView>(R.id.version)
try {
val packageInfo = if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
packageManager.getPackageInfo(packageName, PackageInfoFlags.of(0))
} else {
@Suppress("DEPRECATION")
packageManager.getPackageInfo(packageName, 0)
}
tvVersion.text = getString(R.string.about_version, packageInfo.versionName)
} catch (e: PackageManager.NameNotFoundException) {
Logging.logWarning(Logging.Category.USER_ACTION, "version name not found.")
}
returnB.setOnClickListener { dialog.dismiss() }
dialog.show()
}
R.string.menu_about -> startActivity(Intent(this, AboutActivity::class.java))
R.string.menu_eventlog -> startActivity(Intent(this, EventLogActivity::class.java))
R.string.projects_add -> startActivity(Intent(this, SelectionListActivity::class.java))
R.string.attachproject_acctmgr_header -> startActivity(Intent(this, AttachAccountManagerActivity::class.java))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* This file is part of BOINC.
* http://boinc.berkeley.edu
* Copyright (C) 2022 University of California
*
* BOINC is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* BOINC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BOINC. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.berkeley.boinc.attach

import android.content.pm.PackageManager
import android.content.pm.PackageManager.PackageInfoFlags
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import edu.berkeley.boinc.R
import edu.berkeley.boinc.utils.Logging

class AboutActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about)

val tvVersion = findViewById<TextView>(R.id.BOINCVersionTextView)

try {
val packageInfo = if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
packageManager.getPackageInfo(packageName, PackageInfoFlags.of(0))
} else {
@Suppress("DEPRECATION")
packageManager.getPackageInfo(packageName, 0)
}
tvVersion.text = getString(R.string.about_version, packageInfo.versionName)
} catch (e: PackageManager.NameNotFoundException) {
Logging.logWarning(Logging.Category.USER_ACTION, "version name not found.")
}
}
}
76 changes: 76 additions & 0 deletions android/BOINC/app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?><!--
This file is part of BOINC.
http://boinc.berkeley.edu
Copyright (C) 2022 University of California
BOINC is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
BOINC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BOINC. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".attach.AboutActivity">

<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingTop="16px"
android:text="@string/about_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold" />

<TextView
android:id="@+id/BOINCVersionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />

<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/about_copyright"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />

<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/about_copyright_reserved"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />

<TextView
android:id="@+id/textView8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="@string/about_credits"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>
99 changes: 0 additions & 99 deletions android/BOINC/app/src/main/res/layout/dialog_about.xml

This file was deleted.

1 change: 0 additions & 1 deletion android/BOINC/app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
<string name="menu_about">عن</string>
<string name="menu_help">مساعدة</string>
<!--about dialog-->
<string name="about_button">العودة</string>
<string name="about_title">عن</string>
<string name="about_name">BOINC</string>
<string name="about_version">اصدار %1$s</string>
Expand Down
1 change: 0 additions & 1 deletion android/BOINC/app/src/main/res/values-az/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
<string name="menu_about">Haqqında</string>
<string name="menu_help">Yardım</string>
<!--about dialog-->
<string name="about_button">Qayıt</string>
<string name="about_title">Haqqında</string>
<string name="about_name">BOINC</string>
<string name="about_version">Versiya %1$s</string>
Expand Down
Loading

0 comments on commit 213028b

Please sign in to comment.