mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
Merge remote-tracking branch 'upstream/dev' into libsession-integration
This commit is contained in:
commit
1f8fa4a904
@ -1,5 +1,6 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static org.session.libsession.utilities.TextSecurePreferences.SELECTED_ACCENT_COLOR;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
@ -18,6 +19,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsession.utilities.dynamiclanguage.DynamicLanguageActivityHelper;
|
||||
import org.session.libsession.utilities.dynamiclanguage.DynamicLanguageContextWrapper;
|
||||
import org.thoughtcrime.securesms.conversation.v2.WindowUtil;
|
||||
import org.thoughtcrime.securesms.util.ActivityUtilitiesKt;
|
||||
import org.thoughtcrime.securesms.util.ThemeState;
|
||||
import org.thoughtcrime.securesms.util.UiModeUtilities;
|
||||
@ -92,6 +94,11 @@ public abstract class BaseActionBarActivity extends AppCompatActivity {
|
||||
if (!currentThemeState.equals(ActivityUtilitiesKt.themeState(getPreferences()))) {
|
||||
recreate();
|
||||
}
|
||||
|
||||
// apply lightStatusBar manually as API 26 does not update properly via applyTheme
|
||||
// https://issuetracker.google.com/issues/65883460?pli=1
|
||||
if (SDK_INT >= 26 && SDK_INT <= 27) WindowUtil.setLightStatusBarFromTheme(this);
|
||||
if (SDK_INT == 27) WindowUtil.setLightNavigationBarFromTheme(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,30 @@
|
||||
package org.thoughtcrime.securesms.components
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
|
||||
/**
|
||||
* An extension of ViewPager to swallow erroneous multi-touch exceptions.
|
||||
*
|
||||
* @see https://stackoverflow.com/questions/6919292/pointerindex-out-of-range-android-multitouch
|
||||
*/
|
||||
class SafeViewPager @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
) : ViewPager(context, attrs) {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean = try {
|
||||
super.onTouchEvent(event)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
false
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean = try {
|
||||
super.onInterceptTouchEvent(event)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
false
|
||||
}
|
||||
}
|
@ -38,14 +38,10 @@ public final class WindowUtil {
|
||||
}
|
||||
|
||||
public static void setNavigationBarColor(@NonNull Window window, @ColorInt int color) {
|
||||
if (Build.VERSION.SDK_INT < 21) return;
|
||||
|
||||
window.setNavigationBarColor(color);
|
||||
}
|
||||
|
||||
public static void setLightStatusBarFromTheme(@NonNull Activity activity) {
|
||||
if (Build.VERSION.SDK_INT < 23) return;
|
||||
|
||||
final boolean isLightStatusBar = ThemeUtil.getThemedBoolean(activity, android.R.attr.windowLightStatusBar);
|
||||
|
||||
if (isLightStatusBar) setLightStatusBar(activity.getWindow());
|
||||
@ -53,20 +49,14 @@ public final class WindowUtil {
|
||||
}
|
||||
|
||||
public static void clearLightStatusBar(@NonNull Window window) {
|
||||
if (Build.VERSION.SDK_INT < 23) return;
|
||||
|
||||
clearSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
|
||||
public static void setLightStatusBar(@NonNull Window window) {
|
||||
if (Build.VERSION.SDK_INT < 23) return;
|
||||
|
||||
setSystemUiFlags(window, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
|
||||
public static void setStatusBarColor(@NonNull Window window, @ColorInt int color) {
|
||||
if (Build.VERSION.SDK_INT < 21) return;
|
||||
|
||||
window.setStatusBarColor(color);
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,8 @@ import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.URLSpan
|
||||
import android.text.util.Linkify
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
@ -22,6 +20,7 @@ import androidx.core.graphics.BlendModeColorFilterCompat
|
||||
import androidx.core.graphics.BlendModeCompat
|
||||
import androidx.core.text.getSpans
|
||||
import androidx.core.text.toSpannable
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.isVisible
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.databinding.ViewVisibleMessageContentBinding
|
||||
@ -223,6 +222,7 @@ class VisibleMessageContentView : ConstraintLayout {
|
||||
}
|
||||
|
||||
binding.bodyTextView.isVisible = message.body.isNotEmpty() && !hideBody
|
||||
binding.contentParent.apply { isVisible = children.any { it.isVisible } }
|
||||
|
||||
if (message.body.isNotEmpty() && !hideBody) {
|
||||
val color = getTextColor(context, message)
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
<org.thoughtcrime.securesms.components.SafeViewPager
|
||||
android:id="@+id/media_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
5
app/src/main/res/values-v27/colors.xml
Normal file
5
app/src/main/res/values-v27/colors.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="classic_light_navigation_bar">@color/classic_light_6</color>
|
||||
<color name="ocean_light_navigation_bar">@color/ocean_light_7</color>
|
||||
</resources>
|
@ -60,6 +60,9 @@
|
||||
<color name="transparent_white_40">#40ffffff</color>
|
||||
<color name="transparent_white_aa">#aaffffff</color>
|
||||
|
||||
<color name="navigation_bar">@color/compose_view_background</color>
|
||||
<color name="classic_light_navigation_bar">@color/navigation_bar</color>
|
||||
<color name="ocean_light_navigation_bar">@color/navigation_bar</color>
|
||||
<color name="action_mode_status_bar">@color/gray65</color>
|
||||
<color name="touch_highlight">#22000000</color>
|
||||
|
||||
|
@ -228,11 +228,13 @@
|
||||
<style name="FakeChatViewMessageBubble.Incoming">
|
||||
<item name="android:background">@drawable/fake_chat_view_incoming_message_background</item>
|
||||
<item name="android:elevation">10dp</item>
|
||||
<item name="android:textColor">?message_received_text_color</item>
|
||||
</style>
|
||||
|
||||
<style name="FakeChatViewMessageBubble.Outgoing">
|
||||
<item name="android:background">@drawable/fake_chat_view_outgoing_message_background</item>
|
||||
<item name="android:elevation">10dp</item>
|
||||
<item name="android:textColor">?message_sent_text_color</item>
|
||||
</style>
|
||||
<!-- Session -->
|
||||
|
||||
|
@ -326,7 +326,7 @@
|
||||
<item name="android:textColor">?android:textColorPrimary</item>
|
||||
<item name="android:textColorHint">@color/gray27</item>
|
||||
<item name="android:windowBackground">?colorPrimary</item>
|
||||
<item name="android:navigationBarColor">@color/compose_view_background</item>
|
||||
<item name="android:navigationBarColor">@color/navigation_bar</item>
|
||||
<item name="dialog_background_color">@color/classic_dark_1</item>
|
||||
<item name="bottomSheetDialogTheme">@style/Classic.Dark.BottomSheet</item>
|
||||
<item name="actionMenuTextColor">?android:textColorPrimary</item>
|
||||
@ -404,7 +404,7 @@
|
||||
<item name="android:textColor">?android:textColorPrimary</item>
|
||||
<item name="android:textColorHint">@color/gray27</item>
|
||||
<item name="android:windowBackground">?colorPrimary</item>
|
||||
<item name="android:navigationBarColor">?colorPrimary</item>
|
||||
<item name="android:navigationBarColor">@color/classic_light_navigation_bar</item>
|
||||
<item name="colorCellBackground">@color/classic_light_6</item>
|
||||
<item name="colorSettingsBackground">@color/classic_light_5</item>
|
||||
<item name="colorDividerBackground">@color/classic_light_3</item>
|
||||
@ -490,7 +490,7 @@
|
||||
<item name="android:textColorHint">@color/ocean_dark_5</item>
|
||||
<item name="android:windowBackground">?colorPrimary</item>
|
||||
<item name="android:colorBackground">@color/default_background_start</item>
|
||||
<item name="android:navigationBarColor">@color/compose_view_background</item>
|
||||
<item name="android:navigationBarColor">@color/navigation_bar</item>
|
||||
<item name="default_background_end">?colorPrimary</item>
|
||||
<item name="default_background_start">?colorPrimaryDark</item>
|
||||
<item name="colorCellBackground">@color/ocean_dark_3</item>
|
||||
@ -570,7 +570,7 @@
|
||||
<item name="android:textColorTertiary">@color/ocean_light_2</item>
|
||||
<item name="android:textColor">?android:textColorPrimary</item>
|
||||
<item name="android:textColorHint">@color/ocean_light_6</item>
|
||||
<item name="android:navigationBarColor">@color/ocean_light_7</item>
|
||||
<item name="android:navigationBarColor">@color/ocean_light_navigation_bar</item>
|
||||
<item name="android:windowBackground">?colorPrimary</item>
|
||||
<item name="android:colorBackground">@color/default_background_start</item>
|
||||
<item name="default_background_end">@color/ocean_light_7</item>
|
||||
|
Loading…
Reference in New Issue
Block a user