Added back dark mode setting + improvements
This commit is contained in:
parent
7955f52182
commit
d560af675e
13 changed files with 53 additions and 46 deletions
|
@ -175,7 +175,7 @@ public class StatusFragment extends Fragment {
|
||||||
Window window = activity.getWindow();
|
Window window = activity.getWindow();
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
window.setStatusBarColor(ContextCompat.getColor(activity, R.color.colorADark));
|
window.setStatusBarColor(ContextCompat.getColor(activity, R.color.colorADark10));
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1432,17 +1433,17 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDarkModeEnabled() {
|
public boolean isDarkModeEnabled() {
|
||||||
return false; /*getConfig()
|
return getConfig()
|
||||||
.getBool(
|
.getBool(
|
||||||
"app",
|
"app",
|
||||||
"dark_mode",
|
"dark_mode",
|
||||||
AppCompatDelegate.getDefaultNightMode()
|
AppCompatDelegate.getDefaultNightMode()
|
||||||
== AppCompatDelegate.MODE_NIGHT_YES);*/
|
== AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void enableDarkMode(boolean enable) {
|
public void enableDarkMode(boolean enable) {
|
||||||
getConfig().setBool("app", "dark_mode", enable);
|
getConfig().setBool("app", "dark_mode", enable);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
public static class AccountBuilder {
|
public static class AccountBuilder {
|
||||||
private final Core lc;
|
private final Core lc;
|
||||||
|
|
|
@ -1689,8 +1689,8 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAdvancedSettings() {
|
private void initAdvancedSettings() {
|
||||||
/*((CheckBoxPreference) findPreference(getString(R.string.pref_dark_mode_key)))
|
((CheckBoxPreference) findPreference(getString(R.string.pref_dark_mode_key)))
|
||||||
.setChecked(mPrefs.isDarkModeEnabled());*/
|
.setChecked(mPrefs.isDarkModeEnabled());
|
||||||
((CheckBoxPreference) findPreference(getString(R.string.pref_friendlist_subscribe_key)))
|
((CheckBoxPreference) findPreference(getString(R.string.pref_friendlist_subscribe_key)))
|
||||||
.setChecked(mPrefs.isFriendlistsubscriptionEnabled());
|
.setChecked(mPrefs.isFriendlistsubscriptionEnabled());
|
||||||
((CheckBoxPreference) findPreference(getString(R.string.pref_debug_key)))
|
((CheckBoxPreference) findPreference(getString(R.string.pref_debug_key)))
|
||||||
|
@ -1712,7 +1712,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdvancedPreferencesListener() {
|
private void setAdvancedPreferencesListener() {
|
||||||
/*findPreference(getString(R.string.pref_dark_mode_key))
|
findPreference(getString(R.string.pref_dark_mode_key))
|
||||||
.setOnPreferenceChangeListener(
|
.setOnPreferenceChangeListener(
|
||||||
new OnPreferenceChangeListener() {
|
new OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1722,13 +1722,16 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
mPrefs.enableDarkMode(value);
|
mPrefs.enableDarkMode(value);
|
||||||
if (value) {
|
if (value) {
|
||||||
LinphoneActivity.instance().setTheme(R.style.LinphoneStyleDark);
|
LinphoneActivity.instance().setTheme(R.style.LinphoneStyleDark);
|
||||||
|
LinphoneActivity.instance()
|
||||||
|
.getTheme()
|
||||||
|
.applyStyle(R.style.LinphoneStyleDark, true);
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance()
|
LinphoneActivity.instance()
|
||||||
.setTheme(R.style.LinphoneStyleLight);
|
.setTheme(R.style.LinphoneStyleLight);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
|
|
||||||
findPreference(getString(R.string.pref_friendlist_subscribe_key))
|
findPreference(getString(R.string.pref_friendlist_subscribe_key))
|
||||||
.setOnPreferenceChangeListener(
|
.setOnPreferenceChangeListener(
|
||||||
|
|
|
@ -220,6 +220,7 @@ public class ContactAvatar {
|
||||||
holder.contactPicture.setImageResource(R.drawable.chat_group_avatar);
|
holder.contactPicture.setImageResource(R.drawable.chat_group_avatar);
|
||||||
holder.generatedAvatar.setVisibility(View.GONE);
|
holder.generatedAvatar.setVisibility(View.GONE);
|
||||||
holder.securityLevel.setVisibility(View.GONE);
|
holder.securityLevel.setVisibility(View.GONE);
|
||||||
|
holder.avatarBorder.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void displayGroupChatAvatar(ChatRoomSecurityLevel level, View v) {
|
public static void displayGroupChatAvatar(ChatRoomSecurityLevel level, View v) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:background="?attr/accentColor50"
|
android:background="?attr/accentColorLight30"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="5dp">
|
android:padding="5dp">
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:src="@drawable/avatar_mask" />
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:tint="?attr/backgroundColor" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/border"
|
android:id="@+id/border"
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:src="@drawable/avatar_mask" />
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:tint="?attr/backgroundColor" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/border"
|
android:id="@+id/border"
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:src="@drawable/avatar_mask" />
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:tint="?attr/backgroundColor" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/border"
|
android:id="@+id/border"
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:src="@drawable/avatar_mask"
|
android:src="@drawable/avatar_mask"
|
||||||
android:tint="?attr/accentColor50"/>
|
android:tint="?attr/accentColorLight30"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/border"
|
android:id="@+id/border"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<declare-styleable name="LinphoneAppTheme">
|
<declare-styleable name="LinphoneAppTheme">
|
||||||
<attr name="accentColor" format="color"/>
|
<attr name="accentColor" format="color"/>
|
||||||
<attr name="accentColor50" format="color"/>
|
<attr name="accentColorLight30" format="color"/>
|
||||||
|
|
||||||
<attr name="accentTextColor" format="color"/>
|
<attr name="accentTextColor" format="color"/>
|
||||||
<attr name="primaryTextColor" format="color"/>
|
<attr name="primaryTextColor" format="color"/>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorA">#ff5e00</color>
|
<color name="colorA">#ff5e00</color>
|
||||||
<!-- You can use https://material.io/design/color/#tools-for-picking-colors to get dark color value from primary -->
|
<!-- You can use https://material.io/design/color/#tools-for-picking-colors to get dark color value from primary -->
|
||||||
<color name="colorADark">#e65000</color>
|
<color name="colorADark10">#e65000</color>
|
||||||
<color name="colorA50">#80ff5e00</color>
|
<color name="colorALight30">#ffab4d</color>
|
||||||
<color name="colorB">#000000</color>
|
<color name="colorB">#000000</color>
|
||||||
<color name="colorC">#444444</color>
|
<color name="colorC">#444444</color>
|
||||||
<color name="colorD">#808080</color>
|
<color name="colorD">#808080</color>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<item name="android:textColorPrimaryInverse">@color/colorH</item>
|
<item name="android:textColorPrimaryInverse">@color/colorH</item>
|
||||||
|
|
||||||
<item name="accentColor">@color/colorA</item>
|
<item name="accentColor">@color/colorA</item>
|
||||||
<item name="accentColor50">@color/colorA50</item>
|
<item name="accentColorLight30">@color/colorALight30</item>
|
||||||
<item name="accentTextColor">@color/colorH</item>
|
<item name="accentTextColor">@color/colorH</item>
|
||||||
<item name="primaryTextColor">@color/colorC</item>
|
<item name="primaryTextColor">@color/colorC</item>
|
||||||
<item name="secondaryTextColor">@color/colorH</item>
|
<item name="secondaryTextColor">@color/colorH</item>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<item name="android:textColorPrimaryInverse">@color/colorC</item>
|
<item name="android:textColorPrimaryInverse">@color/colorC</item>
|
||||||
|
|
||||||
<item name="accentColor">@color/colorA</item>
|
<item name="accentColor">@color/colorA</item>
|
||||||
<item name="accentColor50">@color/colorA50</item>
|
<item name="accentColorLight30">@color/colorALight30</item>
|
||||||
<item name="accentTextColor">@color/colorH</item>
|
<item name="accentTextColor">@color/colorH</item>
|
||||||
<item name="primaryTextColor">@color/colorH</item>
|
<item name="primaryTextColor">@color/colorH</item>
|
||||||
<item name="secondaryTextColor">@color/colorC</item>
|
<item name="secondaryTextColor">@color/colorC</item>
|
||||||
|
@ -322,7 +322,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="dialog_title_font" parent="@android:style/TextAppearance.Medium">
|
<style name="dialog_title_font" parent="@android:style/TextAppearance.Medium">
|
||||||
<item name="android:textColor">?attr/secondaryTextColor</item>
|
<item name="android:textColor">@color/colorH</item>
|
||||||
<item name="android:textSize">21.7sp</item>
|
<item name="android:textSize">21.7sp</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
<item name="android:fontFamily">sans-serif</item>
|
<item name="android:fontFamily">sans-serif</item>
|
||||||
|
@ -355,7 +355,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="dialog_zrtp_white_font" parent="@android:style/TextAppearance.Medium">
|
<style name="dialog_zrtp_white_font" parent="@android:style/TextAppearance.Medium">
|
||||||
<item name="android:textColor">?attr/secondaryTextColor</item>
|
<item name="android:textColor">@color/colorH</item>
|
||||||
<item name="android:textSize">20sp</item>
|
<item name="android:textSize">20sp</item>
|
||||||
<item name="android:fontFamily">sans-serif</item>
|
<item name="android:fontFamily">sans-serif</item>
|
||||||
<item name="android:lineSpacingExtra">8.3sp</item>
|
<item name="android:lineSpacingExtra">8.3sp</item>
|
||||||
|
|
|
@ -379,12 +379,6 @@
|
||||||
android:key="@string/pref_advanced_key"
|
android:key="@string/pref_advanced_key"
|
||||||
android:title="@string/pref_advanced_title">
|
android:title="@string/pref_advanced_title">
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="@string/pref_dark_mode_key"
|
|
||||||
android:persistent="false"
|
|
||||||
android:layout="@layout/hidden"
|
|
||||||
android:title="@string/pref_dark_mode" />
|
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_debug_title">
|
<PreferenceCategory android:title="@string/pref_debug_title">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
|
@ -432,6 +426,11 @@
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/pref_android_app_settings_title" />
|
android:title="@string/pref_android_app_settings_title" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/pref_dark_mode_key"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/pref_dark_mode" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_primary_account_title">
|
<PreferenceCategory android:title="@string/pref_primary_account_title">
|
||||||
|
|
Loading…
Reference in a new issue