1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00

Set dm colors for Light themes. Also some dm fixes.

This commit is contained in:
Ammar Githam 2021-03-25 21:07:16 +09:00
parent 6bed9bf28c
commit 926ebca9e9
15 changed files with 68 additions and 13 deletions

View File

@ -18,7 +18,6 @@ import awais.instagrabber.adapters.DirectItemsAdapter.DirectItemCallback;
import awais.instagrabber.databinding.LayoutDmBaseBinding; import awais.instagrabber.databinding.LayoutDmBaseBinding;
import awais.instagrabber.databinding.LayoutDmProfileBinding; import awais.instagrabber.databinding.LayoutDmProfileBinding;
import awais.instagrabber.models.enums.DirectItemType; import awais.instagrabber.models.enums.DirectItemType;
import awais.instagrabber.repositories.responses.ImageVersions2;
import awais.instagrabber.repositories.responses.Location; import awais.instagrabber.repositories.responses.Location;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
import awais.instagrabber.repositories.responses.User; import awais.instagrabber.repositories.responses.User;
@ -97,7 +96,13 @@ public class DirectItemProfileViewHolder extends DirectItemViewHolder {
if (profile == null) return; if (profile == null) return;
binding.profilePic.setImageURI(profile.getProfilePicUrl()); binding.profilePic.setImageURI(profile.getProfilePicUrl());
binding.username.setText(profile.getUsername()); binding.username.setText(profile.getUsername());
binding.fullName.setText(profile.getFullName()); final String fullName = profile.getFullName();
if (!TextUtils.isEmpty(fullName)) {
binding.fullName.setVisibility(View.VISIBLE);
binding.fullName.setText(fullName);
} else {
binding.fullName.setVisibility(View.GONE);
}
binding.isVerified.setVisibility(profile.isVerified() ? View.VISIBLE : View.GONE); binding.isVerified.setVisibility(profile.isVerified() ? View.VISIBLE : View.GONE);
itemView.setOnClickListener(v -> openProfile(profile.getUsername())); itemView.setOnClickListener(v -> openProfile(profile.getUsername()));
} }

View File

@ -1,6 +1,7 @@
package awais.instagrabber.customviews.masoudss_waveform; package awais.instagrabber.customviews.masoudss_waveform;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapShader; import android.graphics.BitmapShader;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -50,8 +51,21 @@ public final class WaveformSeekBar extends View {
public WaveformSeekBar(final Context context, @Nullable final AttributeSet attrs, final int defStyleAttr) { public WaveformSeekBar(final Context context, @Nullable final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
this.waveBackgroundColor = context.getResources().getColor(R.color.white); final TypedArray a = context.getTheme().obtainStyledAttributes(
this.waveProgressColor = context.getResources().getColor(R.color.blue_800); attrs,
R.styleable.WaveformSeekBar,
0,
0);
final int backgroundColor;
final int progressColor;
try {
backgroundColor = a.getResourceId(R.styleable.WaveformSeekBar_waveformBackgroundColor, R.color.white);
progressColor = a.getResourceId(R.styleable.WaveformSeekBar_waveformProgressColor, R.color.blue_800);
} finally {
a.recycle();
}
this.waveBackgroundColor = context.getResources().getColor(backgroundColor);
this.waveProgressColor = context.getResources().getColor(progressColor);
} }
private float getSampleMax() { private float getSampleMax() {

View File

@ -140,6 +140,7 @@ public class DirectMessageSettingsFragment extends Fragment implements ConfirmDi
viewModel.isViewerAdmin().observe(getViewLifecycleOwner(), this::setApprovalRelatedUI); viewModel.isViewerAdmin().observe(getViewLifecycleOwner(), this::setApprovalRelatedUI);
viewModel.getApprovalRequiredToJoin().observe(getViewLifecycleOwner(), required -> binding.approvalRequired.setChecked(required)); viewModel.getApprovalRequiredToJoin().observe(getViewLifecycleOwner(), required -> binding.approvalRequired.setChecked(required));
viewModel.getPendingRequests().observe(getViewLifecycleOwner(), this::setPendingRequests); viewModel.getPendingRequests().observe(getViewLifecycleOwner(), this::setPendingRequests);
viewModel.isGroup().observe(getViewLifecycleOwner(), this::setupSettings);
final NavController navController = NavHostFragment.findNavController(this); final NavController navController = NavHostFragment.findNavController(this);
final NavBackStackEntry backStackEntry = navController.getCurrentBackStackEntry(); final NavBackStackEntry backStackEntry = navController.getCurrentBackStackEntry();
if (backStackEntry != null) { if (backStackEntry != null) {
@ -207,13 +208,11 @@ public class DirectMessageSettingsFragment extends Fragment implements ConfirmDi
} }
private void init() { private void init() {
setupSettings(); // setupSettings();
setupMembers(); setupMembers();
} }
private void setupSettings() { private void setupSettings(final boolean isGroup) {
Boolean isGroup = viewModel.isGroup().getValue();
if (isGroup == null) isGroup = false;
binding.groupSettings.setVisibility(isGroup ? View.VISIBLE : View.GONE); binding.groupSettings.setVisibility(isGroup ? View.VISIBLE : View.GONE);
binding.muteMessagesLabel.setOnClickListener(v -> binding.muteMessages.toggle()); binding.muteMessagesLabel.setOnClickListener(v -> binding.muteMessages.toggle());
binding.muteMessages.setOnCheckedChangeListener((buttonView, isChecked) -> { binding.muteMessages.setOnCheckedChangeListener((buttonView, isChecked) -> {

View File

@ -1227,7 +1227,10 @@ public class DirectMessageThreadFragment extends Fragment implements DirectReact
if (!isEmojiPickerShown) { if (!isEmojiPickerShown) {
binding.emojiPicker.setAlpha(0); binding.emojiPicker.setAlpha(0);
} }
imm.showSoftInput(binding.input, InputMethodManager.SHOW_IMPLICIT); final boolean shown = imm.showSoftInput(binding.input, InputMethodManager.SHOW_IMPLICIT);
if (!shown) {
Log.e(TAG, "showKeyboard: System did not display the keyboard");
}
if (!isEmojiPickerShown) { if (!isEmojiPickerShown) {
animatePan(keyboardHeight); animatePan(keyboardHeight);
} }

View File

@ -156,7 +156,7 @@
android:hint="@string/message" android:hint="@string/message"
android:paddingTop="12dp" android:paddingTop="12dp"
android:paddingBottom="12dp" android:paddingBottom="12dp"
android:textColor="@color/white" android:textColor="?dmInputTextColor"
android:textColorHint="@color/grey_500" android:textColorHint="@color/grey_500"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@ -113,6 +113,7 @@
android:paddingEnd="@dimen/dm_message_card_radius" android:paddingEnd="@dimen/dm_message_card_radius"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/white"
app:layout_constraintBottom_toTopOf="@id/chat_message_layout" app:layout_constraintBottom_toTopOf="@id/chat_message_layout"
app:layout_constraintEnd_toEndOf="@id/chat_message_layout" app:layout_constraintEnd_toEndOf="@id/chat_message_layout"
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"

View File

@ -15,6 +15,7 @@
android:paddingEnd="@dimen/dm_message_card_radius" android:paddingEnd="@dimen/dm_message_card_radius"
android:paddingBottom="@dimen/dm_message_card_radius_small" android:paddingBottom="@dimen/dm_message_card_radius_small"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textColor="@color/white"
tools:text="Some message" /> tools:text="Some message" />
<com.facebook.drawee.view.SimpleDraweeView <com.facebook.drawee.view.SimpleDraweeView
@ -35,6 +36,7 @@
android:paddingTop="@dimen/dm_message_card_radius_small" android:paddingTop="@dimen/dm_message_card_radius_small"
android:paddingEnd="@dimen/dm_message_card_radius" android:paddingEnd="@dimen/dm_message_card_radius"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2" android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@color/white"
tools:text="Title of the website" /> tools:text="Title of the website" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -46,6 +48,7 @@
android:paddingStart="@dimen/dm_message_card_radius" android:paddingStart="@dimen/dm_message_card_radius"
android:paddingTop="@dimen/dm_message_card_radius_small" android:paddingTop="@dimen/dm_message_card_radius_small"
android:paddingEnd="@dimen/dm_message_card_radius" android:paddingEnd="@dimen/dm_message_card_radius"
android:textColor="@color/white"
tools:text="Some summary of the website" /> tools:text="Some summary of the website" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -59,5 +62,6 @@
android:paddingEnd="@dimen/dm_message_card_radius" android:paddingEnd="@dimen/dm_message_card_radius"
android:paddingBottom="@dimen/dm_message_card_radius_small" android:paddingBottom="@dimen/dm_message_card_radius_small"
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption" android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
android:textColor="@color/white"
tools:text="test.com" /> tools:text="test.com" />
</LinearLayout> </LinearLayout>

View File

@ -86,6 +86,7 @@
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:paddingBottom="0dp" android:paddingBottom="0dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2" android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@color/white"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/caption" app:layout_constraintBottom_toTopOf="@id/caption"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -101,6 +102,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="8dp" android:padding="8dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2" android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -27,7 +27,7 @@
android:ellipsize="end" android:ellipsize="end"
android:gravity="bottom" android:gravity="bottom"
android:singleLine="true" android:singleLine="true"
android:textColor="?android:textColorPrimary" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
@ -62,12 +62,14 @@
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2" android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@color/white"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/barrier" app:layout_constraintBottom_toTopOf="@id/barrier"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/username" app:layout_constraintStart_toStartOf="@id/username"
app:layout_constraintTop_toBottomOf="@id/username" app:layout_constraintTop_toBottomOf="@id/username"
tools:text="Full name" /> tools:text="Full name"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier" android:id="@+id/barrier"

View File

@ -78,6 +78,7 @@
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:padding="8dp" android:padding="8dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2" android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/preview" app:layout_constraintTop_toBottomOf="@id/preview"

View File

@ -41,5 +41,6 @@
android:layout_gravity="start|fill_horizontal" android:layout_gravity="start|fill_horizontal"
android:padding="8dp" android:padding="8dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2" android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="@color/white"
tools:text="Some text " /> tools:text="Some text " />
</LinearLayout> </LinearLayout>

View File

@ -9,4 +9,5 @@
android:paddingEnd="@dimen/dm_message_card_radius" android:paddingEnd="@dimen/dm_message_card_radius"
android:paddingBottom="@dimen/dm_message_card_radius_small" android:paddingBottom="@dimen/dm_message_card_radius_small"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textColor="@color/white"
tools:text="Text message" /> tools:text="Text message" />

View File

@ -66,10 +66,12 @@
android:layout_height="54dp" android:layout_height="54dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
app:waveformBackgroundColor="?dmWaveformBgColor"
app:layout_constraintBottom_toTopOf="@id/duration" app:layout_constraintBottom_toTopOf="@id/duration"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/play_wrapper" app:layout_constraintStart_toEndOf="@id/play_wrapper"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:waveformProgressColor="?dmWaveformProgressColor" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/duration" android:id="@+id/duration"

View File

@ -16,6 +16,9 @@
<attr name="dmIncomingBgColor" format="reference" /> <attr name="dmIncomingBgColor" format="reference" />
<attr name="dmOutgoingBgColor" format="reference" /> <attr name="dmOutgoingBgColor" format="reference" />
<attr name="dmDateHeaderBgColor" format="reference" /> <attr name="dmDateHeaderBgColor" format="reference" />
<attr name="dmWaveformBgColor" format="reference" />
<attr name="dmWaveformProgressColor" format="reference" />
<attr name="dmInputTextColor" format="reference" />
<declare-styleable name="RecordView"> <declare-styleable name="RecordView">
<attr name="slide_to_cancel_text" format="string" /> <attr name="slide_to_cancel_text" format="string" />
@ -26,4 +29,9 @@
<attr name="slide_to_cancel_arrow_color" format="reference" /> <attr name="slide_to_cancel_arrow_color" format="reference" />
<attr name="counter_time_color" format="reference" /> <attr name="counter_time_color" format="reference" />
</declare-styleable> </declare-styleable>
<declare-styleable name="WaveformSeekBar">
<attr name="waveformBackgroundColor" format="reference" />
<attr name="waveformProgressColor" format="reference" />
</declare-styleable>
</resources> </resources>

View File

@ -20,6 +20,9 @@
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item> <item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item>
<!--<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Primary</item>--> <!--<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Primary</item>-->
<item name="materialAlertDialogTheme">@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog.Light</item> <item name="materialAlertDialogTheme">@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog.Light</item>
<item name="dmIncomingBgColor">@color/grey_600</item>
<item name="dmOutgoingBgColor">@color/deep_purple_400</item>
<item name="dmDateHeaderBgColor">@color/deep_purple_600</item>
</style> </style>
<style name="AppTheme.Light.White" parent="AppTheme.Light"> <style name="AppTheme.Light.White" parent="AppTheme.Light">
@ -39,6 +42,12 @@
<item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Light.White</item> <item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Light.White</item>
<item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.Light.White</item> <item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.Light.White</item>
<item name="textInputStyle">@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Light.White</item> <item name="textInputStyle">@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Light.White</item>
<item name="dmIncomingBgColor">@color/grey_600</item>
<item name="dmOutgoingBgColor">@color/deep_purple_400</item>
<item name="dmDateHeaderBgColor">@color/deep_purple_600</item>
<item name="dmWaveformBgColor">@color/grey_600</item>
<item name="dmWaveformProgressColor">@color/blue_800</item>
<item name="dmInputTextColor">@color/black</item>
</style> </style>
<style name="AppTheme.Light.Barinsta" parent="AppTheme.Light"> <style name="AppTheme.Light.Barinsta" parent="AppTheme.Light">
@ -89,6 +98,9 @@
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">false</item> <item name="android:windowLightNavigationBar" tools:ignore="NewApi">false</item>
<item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item> <item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
<!--<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Primary</item>--> <!--<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Primary</item>-->
<item name="dmWaveformBgColor">@color/white</item>
<item name="dmWaveformProgressColor">@color/blue_800</item>
<item name="dmInputTextColor">@color/white</item>
</style> </style>
<style name="AppTheme.Dark.Black" parent="AppTheme.Dark"> <style name="AppTheme.Dark.Black" parent="AppTheme.Dark">