Update long message activity toolbar color.
This commit is contained in:
parent
2751076089
commit
cc9be7b61e
2 changed files with 26 additions and 24 deletions
|
@ -48,7 +48,7 @@ public class LongMessageActivity extends PassphraseRequiredActivity {
|
||||||
private static final int MAX_DISPLAY_LENGTH = 64 * 1024;
|
private static final int MAX_DISPLAY_LENGTH = 64 * 1024;
|
||||||
|
|
||||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||||
private final DynamicTheme dynamicTheme = new DynamicDarkActionBarTheme();
|
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||||
|
|
||||||
private Stub<ViewGroup> sentBubble;
|
private Stub<ViewGroup> sentBubble;
|
||||||
private Stub<ViewGroup> receivedBubble;
|
private Stub<ViewGroup> receivedBubble;
|
||||||
|
@ -80,10 +80,6 @@ public class LongMessageActivity extends PassphraseRequiredActivity {
|
||||||
|
|
||||||
initViewModel(getIntent().getLongExtra(KEY_MESSAGE_ID, -1), getIntent().getBooleanExtra(KEY_IS_MMS, false));
|
initViewModel(getIntent().getLongExtra(KEY_MESSAGE_ID, -1), getIntent().getBooleanExtra(KEY_IS_MMS, false));
|
||||||
|
|
||||||
LiveRecipient conversationRecipient = Recipient.live(getIntent().getParcelableExtra(KEY_CONVERSATION_RECIPIENT));
|
|
||||||
conversationRecipient.observe(this, recipient -> updateActionBarColor(recipient.getColor()));
|
|
||||||
updateActionBarColor(conversationRecipient.get().getColor());
|
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,11 +103,6 @@ public class LongMessageActivity extends PassphraseRequiredActivity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateActionBarColor(@NonNull MaterialColor color) {
|
|
||||||
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color.toActionBarColor(this)));
|
|
||||||
WindowUtil.setStatusBarColor(getWindow(), color.toStatusBarColor(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initViewModel(long messageId, boolean isMms) {
|
private void initViewModel(long messageId, boolean isMms) {
|
||||||
viewModel = ViewModelProviders.of(this, new LongMessageViewModel.Factory(getApplication(), new LongMessageRepository(this), messageId, isMms))
|
viewModel = ViewModelProviders.of(this, new LongMessageViewModel.Factory(getApplication(), new LongMessageRepository(this), messageId, isMms))
|
||||||
.get(LongMessageViewModel.class);
|
.get(LongMessageViewModel.class);
|
||||||
|
|
|
@ -1,26 +1,37 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<FrameLayout
|
<View
|
||||||
|
android:layout_height="5dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:background="@drawable/toolbar_shadow" />
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<ViewStub
|
<ScrollView
|
||||||
android:id="@+id/longmessage_sent_stub"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout="@layout/longmessage_bubble_sent"/>
|
android:padding="16dp">
|
||||||
|
|
||||||
<ViewStub
|
<ViewStub
|
||||||
android:id="@+id/longmessage_received_stub"
|
android:id="@+id/longmessage_sent_stub"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout="@layout/longmessage_bubble_received"/>
|
android:layout="@layout/longmessage_bubble_sent"/>
|
||||||
|
|
||||||
</FrameLayout>
|
<ViewStub
|
||||||
|
android:id="@+id/longmessage_received_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout="@layout/longmessage_bubble_received"/>
|
||||||
|
|
||||||
</ScrollView>
|
</FrameLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</FrameLayout>
|
Loading…
Add table
Reference in a new issue