Theme hierarchy refactoring.

Force dark theme for media send activity.
This commit is contained in:
Anton Chekulaev 2020-08-25 19:43:00 +10:00
parent b04028f629
commit 810afe8e7e
12 changed files with 102 additions and 70 deletions

View File

@ -69,7 +69,7 @@
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_configuration"
android:supportsRtl="true"
android:theme="@style/Session.DarkTheme"
android:theme="@style/Theme.Session.DayNight"
tools:replace="android:allowBackup">
<!-- Disable analytics -->
@ -115,7 +115,7 @@
android:name="org.thoughtcrime.securesms.loki.activities.HomeActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="@style/Session.DarkTheme.NoActionBar" />
android:theme="@style/Theme.Session.DayNight.NoActionBar" />
<activity
android:name="org.thoughtcrime.securesms.loki.activities.SettingsActivity"
android:screenOrientation="portrait"
@ -278,7 +278,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/TextSecure.DarkNoActionBar"
android:theme="@style/Theme.TextSecure.DayNight.NoActionBar"
android:parentActivityName="org.thoughtcrime.securesms.loki.activities.HomeActivity"
android:windowSoftInputMode="stateUnchanged">
<meta-data
@ -301,7 +301,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="Message Details"
android:screenOrientation="portrait"
android:theme="@style/Session.DarkTheme"
android:theme="@style/Theme.Session.DayNight"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" />
<activity
@ -355,7 +355,7 @@
android:name="org.thoughtcrime.securesms.mediasend.MediaSendActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:screenOrientation="portrait"
android:theme="@style/Theme.Session.ForceDark.NoActionBar"
android:theme="@style/Theme.TextSecure.DayNight.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="org.thoughtcrime.securesms.PassphraseChangeActivity"
@ -389,7 +389,7 @@
android:name="org.thoughtcrime.securesms.registration.CaptchaActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:theme="@style/TextSecure.DarkNoActionBar"
android:theme="@style/Theme.TextSecure.DayNight.NoActionBar"
android:windowSoftInputMode="stateUnchanged" />
<activity
android:name="org.thoughtcrime.securesms.DeviceActivity"
@ -411,7 +411,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="@string/AndroidManifest__media_preview"
android:screenOrientation="portrait"
android:theme="@style/Session.DarkTheme"
android:theme="@style/Theme.Session.DayNight"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" />
<activity
@ -419,7 +419,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/Session.DarkTheme.NoActionBar"
android:theme="@style/Theme.Session.DayNight.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="org.thoughtcrime.securesms.DummyActivity"
@ -478,11 +478,11 @@
<activity
android:name="org.thoughtcrime.securesms.scribbles.StickerSelectActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:theme="@style/TextSecure.DarkTheme" />
android:theme="@style/Theme.Session.ForceDark"/>
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:screenOrientation="portrait"
android:theme="@style/Session.DarkTheme" />
android:theme="@style/Theme.Session.DayNight" />
<activity
android:name="org.thoughtcrime.securesms.CreateProfileActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.thoughtcrime.securesms.loki.activities.SettingsActivity"
tools:theme="@style/Session.DarkTheme.NoActionBar"
tools:theme="@style/Theme.Session.DayNight.NoActionBar"
tools:menu="@menu/settings_general">
<ScrollView

View File

@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/core_black"
android:theme="@style/Theme.Session.ForceDark"
tools:context="org.thoughtcrime.securesms.mediasend.MediaSendActivity">
<org.thoughtcrime.securesms.components.ControllableViewPager
@ -121,9 +122,9 @@
<org.thoughtcrime.securesms.components.SendButton
android:id="@+id/mediasend_send_button"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:scaleType="fitXY"
android:contentDescription="@string/conversation_activity__send"
android:src="?conversation_transport_sms_indicator"
android:background="@drawable/circle_touch_highlight_background" />

View File

@ -9,7 +9,7 @@
android:id="@+id/camera_sticker_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="@color/core_grey_90"
app:tabBackground="?android:colorPrimary"
app:tabMode="fixed"/>
<androidx.viewpager.widget.ViewPager

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Session.DarkTheme" parent="Session.BaseDarkTheme">
<!-- TODO: AC These values should not be hardcoded here or use any "notnight" color resources.
The light theme should be defined in the main "themes.xml" file. -->
<style name="Theme.Session.DayNight">
<item name="android:navigationBarColor">@color/gray65</item>
<item name="android:statusBarColor">@color/accent</item>
<item name="android:textColorHint">@color/gray50</item>
@ -13,7 +15,7 @@
<item name="message_sent_background_color">?colorAccent</item>
</style>
<style name="TextSecure.DarkNoActionBar" parent="@style/TextSecure.BaseDarkNoActionBar">
<style name="Theme.TextSecure.DayNight">
<item name="android:navigationBarColor">@color/gray78</item>

View File

@ -5,7 +5,7 @@
<item name="android:statusBarColor">@color/core_grey_02</item>
</style>
<style name="TextSecure.DarkRegistrationTheme" parent="TextSecure.DarkNoActionBar">
<style name="TextSecure.DarkRegistrationTheme" parent="Theme.TextSecure.DayNight.NoActionBar">
<item name="android:windowLightStatusBar">false</item>
<item name="android:statusBarColor">@color/core_black</item>
</style>

View File

@ -357,7 +357,8 @@
<item name="android:background">@null</item>
<item name="android:maxLines">4</item>
<item name="android:maxLength">65536</item>
<item name="android:textColor">?conversation_item_sent_text_primary_color</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textColorHint">?android:textColorTertiary</item>
<item name="android:capitalize">sentences</item>
<item name="android:autoText">true</item>
<item name="android:gravity">center_vertical</item>

View File

@ -3,7 +3,7 @@
<resources>
<!-- Session -->
<style name="Session.BaseDarkTheme" parent="@style/Theme.AppCompat.DayNight.DarkActionBar">
<style name="Theme.Session" parent="@style/Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/action_bar_background</item>
<item name="colorPrimaryDark">@color/action_bar_background</item>
<item name="colorAccent">@color/accent</item>
@ -64,33 +64,37 @@
<item name="conversation_keyboard_toggle">@drawable/ic_baseline_keyboard_24</item>
</style>
<style name="Session.DarkTheme" parent="Session.BaseDarkTheme">
<!-- This should be the default theme for the application. -->
<style name="Theme.Session.DayNight">
<!-- leave empty to allow overriding -->
</style>
<style name="Session.DarkTheme.NoActionBar" parent="@style/Session.DarkTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<style name="Theme.Session.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Session.DarkTheme.SubtitleActionBar" parent="@style/Session.DarkTheme">
<item name="actionBarStyle">@style/Session.DarkSubtitleActionBar</item>
</style>
<!-- <style name="Session.DarkTheme.SubtitleActionBar" parent="@style/Theme.Session.DayNight">-->
<!-- <item name="actionBarStyle">@style/Session.DarkSubtitleActionBar</item>-->
<!-- </style>-->
<!-- TODO Refactor this -->
<style name="Theme.Session.ForceDark" parent="Session.BaseDarkTheme">
<!-- TODO Refactor this use color resources -->
<style name="Theme.Session.ForceDark" parent="Theme.Session.DayNight">
<!-- TODO Use a color resource -->
<item name="colorPrimary">@color/action_bar_background</item>
<item name="colorPrimary">#171717</item>
<item name="android:textColorPrimary">#FFFFFF</item>
<item name="android:textColorSecondary">#DFFFFFFF</item>
<item name="android:textColorTertiary">#90FFFFFF</item>
<item name="colorControlNormal">?android:textColorPrimary</item>
<item name="android:colorBackground">#121212</item>
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:navigationBarColor">?android:colorBackground</item>
<item name="android:statusBarColor">?android:colorBackground</item>
</style>
<style name="Theme.Session.ForceDark.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<!-- Session -->
<style name="TextSecure.LightNoActionBar" parent="@style/TextSecure.LightTheme">
@ -117,36 +121,6 @@
<item name="media_overview_document_secondary">#99FFFFFF</item>
</style>
<style name="TextSecure.DarkNoActionBar" parent="@style/TextSecure.BaseDarkNoActionBar">
<!-- <item name="android:navigationBarColor">@color/compose_view_background</item>-->
<item name="android:colorControlActivated">@color/signal_primary_dark</item>
</style>
<style name="TextSecure.BaseDarkNoActionBar" parent="@style/TextSecure.BaseDarkTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="theme_type">dark</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="colorPrimary">@color/action_bar_background</item>
<item name="colorPrimaryDark">@color/action_bar_background</item>
<!-- <item name="colorAccent">@color/signal_primary_dark</item>-->
<item name="android:navigationBarColor">@color/compose_view_background</item>
<item name="recipient_preference_blocked">#d00000</item>
<item name="contact_selection_label_text">#66eeeeee</item>
<item name="contact_selection_push_user">#ffeeeeee</item>
<item name="contact_selection_lay_user">#afeeeeee</item>
<item name="contact_selection_header_text">#66eeeeee</item>
<item name="media_overview_toolbar_background">@color/transparent</item>
<item name="media_overview_toolbar_foreground">@color/white</item>
<item name="media_overview_header_foreground">@color/text</item>
<item name="media_overview_document_primary">@color/core_grey_05</item>
<item name="media_overview_document_secondary">#99FFFFFF</item>
</style>
<style name="TextSecure.HighlightTheme" parent="@style/TextSecure.LightTheme">
<item name="actionBarStyle">@style/TextSecure.FlatLightActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
@ -394,11 +368,26 @@
<item name="android:statusBarColor">@color/action_bar_background</item>
</style>
<style name="TextSecure.DarkTheme" parent="@style/TextSecure.BaseDarkTheme">
<!-- leave empty to allow overriding -->
</style>
<!-- Original Signal dark theme -->
<style name="Theme.TextSecure" parent="@style/Theme.Session.DayNight">
<style name="TextSecure.BaseDarkTheme" parent="@style/Session.DarkTheme">
<item name="windowActionModeOverlay">true</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="colorPrimary">@color/action_bar_background</item>
<item name="colorPrimaryDark">@color/action_bar_background</item>
<item name="recipient_preference_blocked">#d00000</item>
<item name="contact_selection_label_text">#66eeeeee</item>
<item name="contact_selection_push_user">#ffeeeeee</item>
<item name="contact_selection_lay_user">#afeeeeee</item>
<item name="contact_selection_header_text">#66eeeeee</item>
<item name="media_overview_toolbar_background">@color/transparent</item>
<item name="media_overview_toolbar_foreground">@color/white</item>
<item name="media_overview_header_foreground">@color/text</item>
<item name="media_overview_document_primary">@color/core_grey_05</item>
<item name="media_overview_document_secondary">#99FFFFFF</item>
<item name="theme_type">dark</item>
<item name="actionBarTheme">@style/Session.DarkActionBar</item>
@ -568,6 +557,44 @@
<item name="shared_contact_details_titlebar">@color/grey_900</item>
<item name="shared_contact_item_button_color">@color/core_grey_85</item>
</style>
<style name="Theme.TextSecure.DayNight">
<!-- leave empty to allow overriding -->
</style>
<!-- <style name="Theme.TextSecure.DarkNoActionBar" parent="@style/Theme.TextSecure.BaseDarkNoActionBar">-->
<!--&lt;!&ndash; <item name="android:navigationBarColor">@color/compose_view_background</item>&ndash;&gt;-->
<!-- <item name="android:colorControlActivated">@color/signal_primary_dark</item>-->
<!-- </style>-->
<style name="Theme.TextSecure.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
<!-- TODO Should be moved elsewhere -->
<item name="android:colorControlActivated">@color/signal_primary_dark</item>
<!-- <item name="theme_type">dark</item>-->
<!-- <item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>-->
<!-- <item name="colorPrimary">@color/action_bar_background</item>-->
<!-- <item name="colorPrimaryDark">@color/action_bar_background</item>-->
<!--&lt;!&ndash; <item name="colorAccent">@color/signal_primary_dark</item>&ndash;&gt;-->
<!-- <item name="android:navigationBarColor">@color/compose_view_background</item>-->
<!-- <item name="recipient_preference_blocked">#d00000</item>-->
<!-- <item name="contact_selection_label_text">#66eeeeee</item>-->
<!-- <item name="contact_selection_push_user">#ffeeeeee</item>-->
<!-- <item name="contact_selection_lay_user">#afeeeeee</item>-->
<!-- <item name="contact_selection_header_text">#66eeeeee</item>-->
<!-- <item name="media_overview_toolbar_background">@color/transparent</item>-->
<!-- <item name="media_overview_toolbar_foreground">@color/white</item>-->
<!-- <item name="media_overview_header_foreground">@color/text</item>-->
<!-- <item name="media_overview_document_primary">@color/core_grey_05</item>-->
<!-- <item name="media_overview_document_secondary">#99FFFFFF</item>-->
</style>
<style name="RationaleDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert">
<!-- <item name="android:windowBackground">@drawable/permission_rationale_dialog_corners</item>-->
@ -583,7 +610,7 @@
<style name="TextSecure.LightRegistrationTheme" parent="TextSecure.LightNoActionBar">
</style>
<style name="TextSecure.DarkRegistrationTheme" parent="TextSecure.DarkNoActionBar">
<style name="TextSecure.DarkRegistrationTheme" parent="Theme.TextSecure.DayNight.NoActionBar">
</style>
</resources>

View File

@ -32,7 +32,6 @@ import java.util.Date;
import network.loki.messenger.R;
public abstract class BaseActionBarActivity extends AppCompatActivity {
private static final String TAG = BaseActionBarActivity.class.getSimpleName();
private BroadcastReceiver broadcastReceiver;

View File

@ -129,8 +129,9 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl
@Override
public @Nullable View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return ThemeUtil.getThemedInflater(requireActivity(), inflater, R.style.TextSecure_DarkTheme)
.inflate(R.layout.mediasend_fragment, container, false);
// return ThemeUtil.getThemedInflater(requireActivity(), inflater, R.style.TextSecure_DarkTheme)
// .inflate(R.layout.mediasend_fragment, container, false);
return inflater.inflate(R.layout.mediasend_fragment, container, false);
}
@Override

View File

@ -7,6 +7,6 @@ import network.loki.messenger.R;
public class DynamicNoActionBarTheme extends DynamicTheme {
@Override
protected int getSelectedTheme(Activity activity) {
return R.style.TextSecure_DarkNoActionBar;
return R.style.Theme_TextSecure_DayNight_NoActionBar;
}
}

View File

@ -28,7 +28,8 @@ public class DynamicTheme {
}
protected int getSelectedTheme(Activity activity) {
return R.style.TextSecure_DarkTheme;
// For all legacy (Signal) activities we lock on to the Signal dedicated theme.
return R.style.Theme_TextSecure_DayNight;
}
private static final class OverridePendingTransition {