mirror of
https://github.com/bilde2910/Hauk.git
synced 2026-01-23 02:24:09 +00:00
Allow logo to be toggled; see #146
This commit is contained in:
parent
148d64b0bc
commit
f3b94ce567
6 changed files with 33 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ public enum Constants {
|
|||
public static final Preference<Boolean> PREF_ALLOW_ADOPTION = new Preference.Boolean("allowAdoption", true);
|
||||
public static final Preference<NightModeStyle> PREF_NIGHT_MODE = new Preference.Enum<>("nightMode", NightModeStyle.FOLLOW_SYSTEM);
|
||||
public static final Preference<Boolean> PREF_CONFIRM_STOP = new Preference.Boolean("confirmStop", true);
|
||||
public static final Preference<Boolean> PREF_HIDE_LOGO = new Preference.Boolean("hideLogo", false);
|
||||
|
||||
@Deprecated // Use PREF_SERVER_ENCRYPTED instead
|
||||
public static final Preference<String> PREF_SERVER = new Preference.String("server", "");
|
||||
|
|
|
|||
|
|
@ -163,6 +163,15 @@ public final class MainActivity extends AppCompatActivity {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// Set app logo visibility.
|
||||
PreferenceManager prefs = new PreferenceManager(this);
|
||||
findViewById(R.id.imgLogo).setVisibility(prefs.get(Constants.PREF_HIDE_LOGO) ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* On-tap handler for the "start sharing" and "stop sharing" button.
|
||||
*/
|
||||
|
|
@ -332,6 +341,8 @@ public final class MainActivity extends AppCompatActivity {
|
|||
|
||||
// Set night mode preference.
|
||||
AppCompatDelegate.setDefaultNightMode(prefs.get(Constants.PREF_NIGHT_MODE).resolve());
|
||||
// Set app logo visibility.
|
||||
findViewById(R.id.imgLogo).setVisibility(prefs.get(Constants.PREF_HIDE_LOGO) ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
10
android/app/src/main/res/drawable/ic_image.xml
Normal file
10
android/app/src/main/res/drawable/ic_image.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?attr/colorControlNormal"
|
||||
android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
|
||||
</vector>
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
<!-- Logo displayed at the top of the activity. -->
|
||||
<ImageView
|
||||
android:id="@+id/imgLogo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="143dp"
|
||||
android:contentDescription="@string/img_alt_logo"
|
||||
|
|
|
|||
|
|
@ -165,6 +165,9 @@
|
|||
<string name="pref_confirmStop_title">Confirm before stopping shares</string>
|
||||
<string name="pref_confirmStop_on">Prompt for confirmation when stopping shares in the app</string>
|
||||
<string name="pref_confirmStop_off">Do not prompt for confirmation when stopping shares in the app</string>
|
||||
<string name="prefs_hideLogo_title">Hide logo on main screen</string>
|
||||
<string name="pref_hideLogo_on">Hide the Hauk logo from the app\'s main screen</string>
|
||||
<string name="pref_hideLogo_off">Show the Hauk logo at the top of the app\'s main screen</string>
|
||||
|
||||
<!-- About section -->
|
||||
<string name="prefs_header_about">About Hauk</string>
|
||||
|
|
|
|||
|
|
@ -122,6 +122,13 @@
|
|||
app:summaryOff="@string/pref_confirmStop_off"
|
||||
app:summaryOn="@string/pref_confirmStop_on" />
|
||||
|
||||
<SwitchPreference
|
||||
app:key="hideLogo"
|
||||
app:icon="@drawable/ic_image"
|
||||
app:title="@string/prefs_hideLogo_title"
|
||||
app:summaryOff="@string/pref_hideLogo_off"
|
||||
app:summaryOn="@string/pref_hideLogo_on" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/prefs_header_about">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue