Display app version

This commit is contained in:
Matéo Duparc 2021-05-09 20:41:13 +02:00
parent 26821632fd
commit 163637c710
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
8 changed files with 65 additions and 45 deletions

View File

@ -12,11 +12,15 @@ android {
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "0.1"
versionName "0.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
}
buildFeatures {
viewBinding true
}

View File

@ -1,14 +1,12 @@
package sushi.hardcore.aira
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.content.*
import android.os.Bundle
import android.os.IBinder
import android.view.MenuItem
import android.view.View
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.EditTextPreference
@ -97,6 +95,18 @@ class SettingsActivity: AppCompatActivity() {
}
false
}
findPreference<Preference>("fingerprint")?.let { fingerprintPreference ->
val fingerprint = StringUtils.beautifyFingerprint(AIRADatabase.getIdentityFingerprint())
fingerprintPreference.summary = fingerprint
fingerprintPreference.setOnPreferenceClickListener {
activity?.getSystemService(CLIPBOARD_SERVICE)?.let { service ->
val clipboardManager = service as ClipboardManager
clipboardManager.setPrimaryClip(ClipData.newPlainText("", fingerprint))
}
Toast.makeText(activity, R.string.fingerprint_copied, Toast.LENGTH_SHORT).show()
false
}
}
}
private fun changePassword(context: Context, isIdentityProtected: Boolean, oldPasswordEditText: EditText, newPassword: ByteArray?) {
@ -134,6 +144,5 @@ class SettingsActivity: AppCompatActivity() {
.replace(R.id.settings_container, MySettingsFragment())
.commit()
supportActionBar?.setDisplayHomeAsUpEnabled(true)
binding.textFingerprint.text = StringUtils.beautifyFingerprint(AIRADatabase.getIdentityFingerprint())
}
}

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M17.81,4.47c-0.08,0 -0.16,-0.02 -0.23,-0.06C15.66,3.42 14,3 12.01,3c-1.98,0 -3.86,0.47 -5.57,1.41 -0.24,0.13 -0.54,0.04 -0.68,-0.2 -0.13,-0.24 -0.04,-0.55 0.2,-0.68C7.82,2.52 9.86,2 12.01,2c2.13,0 3.99,0.47 6.03,1.52 0.25,0.13 0.34,0.43 0.21,0.67 -0.09,0.18 -0.26,0.28 -0.44,0.28zM3.5,9.72c-0.1,0 -0.2,-0.03 -0.29,-0.09 -0.23,-0.16 -0.28,-0.47 -0.12,-0.7 0.99,-1.4 2.25,-2.5 3.75,-3.27C9.98,4.04 14,4.03 17.15,5.65c1.5,0.77 2.76,1.86 3.75,3.25 0.16,0.22 0.11,0.54 -0.12,0.7 -0.23,0.16 -0.54,0.11 -0.7,-0.12 -0.9,-1.26 -2.04,-2.25 -3.39,-2.94 -2.87,-1.47 -6.54,-1.47 -9.4,0.01 -1.36,0.7 -2.5,1.7 -3.4,2.96 -0.08,0.14 -0.23,0.21 -0.39,0.21zM9.75,21.79c-0.13,0 -0.26,-0.05 -0.35,-0.15 -0.87,-0.87 -1.34,-1.43 -2.01,-2.64 -0.69,-1.23 -1.05,-2.73 -1.05,-4.34 0,-2.97 2.54,-5.39 5.66,-5.39s5.66,2.42 5.66,5.39c0,0.28 -0.22,0.5 -0.5,0.5s-0.5,-0.22 -0.5,-0.5c0,-2.42 -2.09,-4.39 -4.66,-4.39 -2.57,0 -4.66,1.97 -4.66,4.39 0,1.44 0.32,2.77 0.93,3.85 0.64,1.15 1.08,1.64 1.85,2.42 0.19,0.2 0.19,0.51 0,0.71 -0.11,0.1 -0.24,0.15 -0.37,0.15zM16.92,19.94c-1.19,0 -2.24,-0.3 -3.1,-0.89 -1.49,-1.01 -2.38,-2.65 -2.38,-4.39 0,-0.28 0.22,-0.5 0.5,-0.5s0.5,0.22 0.5,0.5c0,1.41 0.72,2.74 1.94,3.56 0.71,0.48 1.54,0.71 2.54,0.71 0.24,0 0.64,-0.03 1.04,-0.1 0.27,-0.05 0.53,0.13 0.58,0.41 0.05,0.27 -0.13,0.53 -0.41,0.58 -0.57,0.11 -1.07,0.12 -1.21,0.12zM14.91,22c-0.04,0 -0.09,-0.01 -0.13,-0.02 -1.59,-0.44 -2.63,-1.03 -3.72,-2.1 -1.4,-1.39 -2.17,-3.24 -2.17,-5.22 0,-1.62 1.38,-2.94 3.08,-2.94 1.7,0 3.08,1.32 3.08,2.94 0,1.07 0.93,1.94 2.08,1.94s2.08,-0.87 2.08,-1.94c0,-3.77 -3.25,-6.83 -7.25,-6.83 -2.84,0 -5.44,1.58 -6.61,4.03 -0.39,0.81 -0.59,1.76 -0.59,2.8 0,0.78 0.07,2.01 0.67,3.61 0.1,0.26 -0.03,0.55 -0.29,0.64 -0.26,0.1 -0.55,-0.04 -0.64,-0.29 -0.49,-1.31 -0.73,-2.61 -0.73,-3.96 0,-1.2 0.23,-2.29 0.68,-3.24 1.33,-2.79 4.28,-4.6 7.51,-4.6 4.55,0 8.25,3.51 8.25,7.83 0,1.62 -1.38,2.94 -3.08,2.94s-3.08,-1.32 -3.08,-2.94c0,-1.07 -0.93,-1.94 -2.08,-1.94s-2.08,0.87 -2.08,1.94c0,1.71 0.66,3.31 1.87,4.51 0.95,0.94 1.86,1.46 3.27,1.85 0.27,0.07 0.42,0.35 0.35,0.61 -0.05,0.23 -0.26,0.38 -0.47,0.38z"/>
</vector>

View File

@ -45,7 +45,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginHorizontal="20dp"
android:layout_marginHorizontal="10dp"
app:layout_constraintBottom_toBottomOf="parent">
<EditText

View File

@ -7,26 +7,5 @@
android:id="@+id/settings_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/identity_fingerprint_label"
style="@style/Label"
android:textStyle="bold"/>
<TextView
android:id="@+id/text_fingerprint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"/>
</LinearLayout>
</LinearLayout>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#262626</color>
<color name="secondary">#FF3C00</color>
<color name="secondary">#19a52c</color>
<color name="white">#FFFFFF</color>
<color name="backgroundColor">#111111</color>
<color name="sessionBackground">#1F1F1F</color>

View File

@ -60,7 +60,7 @@
<string name="ask_send_single_file">Send %s (%s) to %s ?</string>
<string name="ask_send_multiple_files">Send %d files to %s ?</string>
<string name="share_label">Send with AIRA</string>
<string name="identity_fingerprint_label">Your identity\'s fingerprint:</string>
<string name="identity_fingerprint">Your identity\'s fingerprint:</string>
<string name="fingerprint">Fingerprint:</string>
<string name="ip">IP:</string>
<string name="connection">Connection:</string>
@ -76,4 +76,8 @@
<string name="settings">Settings</string>
<string name="log_out">Log out</string>
<string name="loadFile_failed">File extraction failed</string>
<string name="fingerprint_copied">Fingerprint copied to clipboard</string>
<string name="identity">Identity</string>
<string name="about">About</string>
<string name="version">AIRA version</string>
</resources>

View File

@ -1,22 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference
android:key="identityName"
android:title="@string/identity_name"
android:summary="@string/summary_name"
android:icon="@drawable/ic_person"/>
<PreferenceCategory android:title="@string/identity">
<Preference
android:key="identityPassword"
android:title="@string/preference_password"
android:summary="@string/summary_password"
android:icon="@drawable/ic_lock"/>
<EditTextPreference
android:key="identityName"
android:title="@string/identity_name"
android:summary="@string/summary_name"
android:icon="@drawable/ic_person"/>
<Preference
android:key="deleteIdentity"
android:title="@string/delete_identity"
android:summary="@string/summary_delete_identity"
android:icon="@drawable/ic_delete_forever"/>
<Preference
android:key="identityPassword"
android:title="@string/preference_password"
android:summary="@string/summary_password"
android:icon="@drawable/ic_lock"/>
<Preference
android:key="deleteIdentity"
android:title="@string/delete_identity"
android:summary="@string/summary_delete_identity"
android:icon="@drawable/ic_delete_forever"/>
<Preference
android:key="fingerprint"
android:title="@string/identity_fingerprint"
android:icon="@drawable/ic_fingerprint"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/about">
<Preference
android:key="version"
android:icon="@drawable/ic_info"
android:title="@string/version"
android:summary="@string/versionName"/>
</PreferenceCategory>
</PreferenceScreen>