1
0
Fork 1

colored every button

This commit is contained in:
Aman9das 2021-09-29 07:41:08 +05:30
parent 33f8c6221e
commit ddb69b9c9c
3 changed files with 40 additions and 17 deletions

View file

@ -15,6 +15,7 @@ import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -55,10 +56,12 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuPopupHelper;
import androidx.appcompat.widget.PopupMenu;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.databinding.DataBindingUtil;
@ -1233,7 +1236,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} else {
binding.recordVoiceButton.setVisibility(View.GONE);
}
binding.recordVoiceButton.setImageResource(activity.getThemeResource(R.attr.ic_send_voice_offline, R.drawable.ic_send_voice_offline));
Drawable unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_voice_offline_white);
Drawable wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
binding.recordVoiceButton.setImageResource(R.drawable.ic_send_voice_offline_white);
}
private void quoteMessage(Message message, @Nullable String user) {

View file

@ -116,7 +116,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_text_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_text_offline, R.drawable.ic_send_text_offline);
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_text_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_text_offline_white;
}
case RECORD_VIDEO:
switch (status) {
@ -132,8 +135,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_videocam_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_videocam_offline, R.drawable.ic_send_videocam_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_videocam_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_videocam_offline_white; }
case TAKE_PHOTO:
switch (status) {
case CHAT:
@ -148,8 +153,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_photo_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_photo_offline, R.drawable.ic_send_photo_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_photo_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_photo_offline_white; }
case RECORD_VOICE:
switch (status) {
case CHAT:
@ -164,8 +171,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_voice_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_voice_offline, R.drawable.ic_send_voice_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_voice_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_voice_offline_white; }
case SEND_LOCATION:
switch (status) {
case CHAT:
@ -180,8 +189,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_location_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_location_offline, R.drawable.ic_send_location_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_location_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_location_offline_white; }
case CANCEL:
switch (status) {
case CHAT:
@ -196,8 +207,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_cancel_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_cancel_offline, R.drawable.ic_send_cancel_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_cancel_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_cancel_offline_white; }
case CHOOSE_PICTURE:
switch (status) {
case CHAT:
@ -212,8 +225,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_picture_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_picture_offline, R.drawable.ic_send_picture_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_picture_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_picture_offline_white; }
case CHOOSE_ATTACHMENT:
switch (status) {
@ -229,8 +244,10 @@ public class SendButtonTool {
case DND:
return R.drawable.ic_send_attachment_dnd;
default:
return getThemeResource(activity, R.attr.ic_send_attachment_offline, R.drawable.ic_send_attachment_offline);
}
unwrappedDrawable = AppCompatResources.getDrawable(activity.getBaseContext(), R.drawable.ic_send_attachment_offline_white);
wrappedDrawable = DrawableCompat.wrap(unwrappedDrawable);
DrawableCompat.setTint(wrappedDrawable, StyledAttributes.getColor(activity, R.attr.colorAccent));
return R.drawable.ic_send_attachment_offline_white; }
}
return getThemeResource(activity, R.attr.ic_send_text_offline, R.drawable.ic_send_text_offline);
}

View file

@ -26,7 +26,7 @@
android:text="01.01.2017"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:textStyle="bold"
android:textColor="@color/white"/>
android:textColor="@color/realwhite"/>
</LinearLayout>
</RelativeLayout>