Feature/lucide icons pt3 (#864)
* Starting to import Lucide icons and clean up * Removing unused icons * Lucide icons + removing unsued stuff Removed the whole EMoji/MediaKeyboard classes as they didn't seem used * More Lucide icons + ui tweaks + clean up * comment * Wrong tinting * delete icon * More icons * check icons * edit icon (ic_pencil) * edit icon * Search icon (ic_search) * settings icons (ic_settings) * back icon (ic_chevron_left) * icon forward arrow (ic_chevron_right) * icon circle dots (ic_circle_dots_custom) * icon read (ic_eye) * icon disappearing messages (ic_clock_x) * refresh icon (ic_refresh_cw) * globe icon * message icon (ic_message_square) * icon message request (ic_message_square_warning) * group and invite icons (ic_users_group_custom, ic_user_round_plus)) * icons: lock, unlock, audio/notification (ic_lock_keyhole, ic_lock_keyhole_open, ic_volume_2, ic_volume_off ) * icon mute / mic off (ic_mic_off) * icon appearance, recovery (ic_paintbrush_vertical, ic_recovery_password_custom) * icons: help, help circle, qr code * icon block/ban * close icon (ic_x) * pin/unpin icons * switch camera icon (ic_switch_camera) * warning icon (ic_triangle_alert) * phone icons * share icon + clean up unused files * mark as read icon + clean up * default video placeholder + clean up Removed the caption icon from the media rail Cleaned up logic for thumbnail error and placeholder * Clean uppull/1710/head
@ -1,68 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
public class ConversationItemAlertView extends LinearLayout {
|
||||
|
||||
private static final String TAG = ConversationItemAlertView.class.getSimpleName();
|
||||
|
||||
private ImageView approvalIndicator;
|
||||
private ImageView failedIndicator;
|
||||
|
||||
public ConversationItemAlertView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ConversationItemAlertView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialize(attrs);
|
||||
}
|
||||
|
||||
public ConversationItemAlertView(final Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
initialize(attrs);
|
||||
}
|
||||
|
||||
private void initialize(AttributeSet attrs) {
|
||||
inflate(getContext(), R.layout.alert_view, this);
|
||||
|
||||
approvalIndicator = findViewById(R.id.pending_approval_indicator);
|
||||
failedIndicator = findViewById(R.id.sms_failed_indicator);
|
||||
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.AlertView, 0, 0);
|
||||
boolean useSmallIcon = typedArray.getBoolean(R.styleable.AlertView_useSmallIcon, false);
|
||||
typedArray.recycle();
|
||||
|
||||
if (useSmallIcon) {
|
||||
int size = getResources().getDimensionPixelOffset(R.dimen.alertview_small_icon_size);
|
||||
failedIndicator.getLayoutParams().width = size;
|
||||
failedIndicator.getLayoutParams().height = size;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setNone() {
|
||||
this.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void setPendingApproval() {
|
||||
this.setVisibility(View.VISIBLE);
|
||||
approvalIndicator.setVisibility(View.VISIBLE);
|
||||
failedIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void setFailed() {
|
||||
this.setVisibility(View.VISIBLE);
|
||||
approvalIndicator.setVisibility(View.GONE);
|
||||
failedIndicator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
@ -1,182 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components
|
||||
|
||||
import android.animation.LayoutTransition
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.annimon.stream.Stream
|
||||
import com.pnikosis.materialishprogress.ProgressWheel
|
||||
import kotlin.math.max
|
||||
import network.loki.messenger.R
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentTransferProgress
|
||||
import org.session.libsession.utilities.StringSubstitutionConstants.COUNT_KEY
|
||||
import org.session.libsession.utilities.ViewUtil
|
||||
import org.thoughtcrime.securesms.events.PartProgressEvent
|
||||
import org.thoughtcrime.securesms.mms.Slide
|
||||
import org.thoughtcrime.securesms.ui.getSubbedString
|
||||
|
||||
class TransferControlView @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context!!, attrs, defStyleAttr) {
|
||||
private var slides: List<Slide>? = null
|
||||
private var current: View? = null
|
||||
|
||||
private val progressWheel: ProgressWheel
|
||||
private val downloadDetails: View
|
||||
private val downloadDetailsText: TextView
|
||||
private val downloadProgress: MutableMap<Attachment, Float>
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.transfer_controls_view, this)
|
||||
|
||||
isLongClickable = false
|
||||
ViewUtil.setBackground(this, ContextCompat.getDrawable(context!!, R.drawable.transfer_controls_background))
|
||||
visibility = GONE
|
||||
layoutTransition = LayoutTransition()
|
||||
|
||||
this.downloadProgress = HashMap()
|
||||
this.progressWheel = ViewUtil.findById(this, R.id.progress_wheel)
|
||||
this.downloadDetails = ViewUtil.findById(this, R.id.download_details)
|
||||
this.downloadDetailsText = ViewUtil.findById(this, R.id.download_details_text)
|
||||
}
|
||||
|
||||
override fun setFocusable(focusable: Boolean) {
|
||||
super.setFocusable(focusable)
|
||||
downloadDetails.isFocusable = focusable
|
||||
}
|
||||
|
||||
override fun setClickable(clickable: Boolean) {
|
||||
super.setClickable(clickable)
|
||||
downloadDetails.isClickable = clickable
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
private fun setSlides(slides: List<Slide>) {
|
||||
require(slides.isNotEmpty()) { "Must provide at least one slide." }
|
||||
|
||||
this.slides = slides
|
||||
|
||||
if (!isUpdateToExistingSet(slides)) {
|
||||
downloadProgress.clear()
|
||||
Stream.of(slides).forEach { s: Slide -> downloadProgress[s.asAttachment()] = 0f }
|
||||
}
|
||||
|
||||
for (slide in slides) {
|
||||
if (slide.asAttachment().transferState == AttachmentTransferProgress.TRANSFER_PROGRESS_DONE) {
|
||||
downloadProgress[slide.asAttachment()] = 1f
|
||||
}
|
||||
}
|
||||
|
||||
when (getTransferState(slides)) {
|
||||
AttachmentTransferProgress.TRANSFER_PROGRESS_STARTED -> showProgressSpinner(calculateProgress(downloadProgress))
|
||||
AttachmentTransferProgress.TRANSFER_PROGRESS_PENDING, AttachmentTransferProgress.TRANSFER_PROGRESS_FAILED -> {
|
||||
downloadDetailsText.text = getDownloadText(this.slides!!)
|
||||
display(downloadDetails)
|
||||
}
|
||||
|
||||
else -> display(null)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun showProgressSpinner(progress: Float = calculateProgress(downloadProgress)) {
|
||||
if (progress == 0f) {
|
||||
progressWheel.spin()
|
||||
} else {
|
||||
progressWheel.setInstantProgress(progress)
|
||||
}
|
||||
display(progressWheel)
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
clearAnimation()
|
||||
visibility = GONE
|
||||
if (current != null) {
|
||||
current!!.clearAnimation()
|
||||
current!!.visibility = GONE
|
||||
}
|
||||
current = null
|
||||
slides = null
|
||||
}
|
||||
|
||||
private fun isUpdateToExistingSet(slides: List<Slide>): Boolean {
|
||||
if (slides.size != downloadProgress.size) {
|
||||
return false
|
||||
}
|
||||
|
||||
for (slide in slides) {
|
||||
if (!downloadProgress.containsKey(slide.asAttachment())) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun getTransferState(slides: List<Slide>): Int {
|
||||
var transferState = AttachmentTransferProgress.TRANSFER_PROGRESS_DONE
|
||||
for (slide in slides) {
|
||||
transferState = if (slide.transferState == AttachmentTransferProgress.TRANSFER_PROGRESS_PENDING && transferState == AttachmentTransferProgress.TRANSFER_PROGRESS_DONE) {
|
||||
slide.transferState
|
||||
} else {
|
||||
max(transferState.toDouble(), slide.transferState.toDouble()).toInt()
|
||||
}
|
||||
}
|
||||
return transferState
|
||||
}
|
||||
|
||||
private fun getDownloadText(slides: List<Slide>): String {
|
||||
if (slides.size == 1) {
|
||||
return slides[0].contentDescription
|
||||
} else {
|
||||
val downloadCount = Stream.of(slides).reduce(0) { count: Int, slide: Slide ->
|
||||
if (slide.transferState != AttachmentTransferProgress.TRANSFER_PROGRESS_DONE) count + 1 else count
|
||||
}
|
||||
return context.getSubbedString(R.string.andMore, COUNT_KEY to downloadCount.toString())
|
||||
}
|
||||
}
|
||||
|
||||
private fun display(view: View?) {
|
||||
if (current != null) {
|
||||
current!!.visibility = GONE
|
||||
}
|
||||
|
||||
if (view != null) {
|
||||
view.visibility = VISIBLE
|
||||
} else {
|
||||
visibility = GONE
|
||||
}
|
||||
|
||||
current = view
|
||||
}
|
||||
|
||||
private fun calculateProgress(downloadProgress: Map<Attachment, Float>): Float {
|
||||
var totalProgress = 0f
|
||||
for (progress in downloadProgress.values) {
|
||||
totalProgress += progress / downloadProgress.size
|
||||
}
|
||||
return totalProgress
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||
fun onEventAsync(event: PartProgressEvent) {
|
||||
if (downloadProgress.containsKey(event.attachment)) {
|
||||
downloadProgress[event.attachment] = event.progress.toFloat() / event.total
|
||||
progressWheel.setInstantProgress(calculateProgress(downloadProgress))
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
|
||||
class DeleteMediaDialog {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun show(context: Context, recordCount: Int, doDelete: Runnable) = context.showSessionDialog {
|
||||
iconAttribute(R.attr.dialog_alert_icon)
|
||||
title(context.resources.getQuantityString(R.plurals.deleteMessage, recordCount, recordCount))
|
||||
text(context.resources.getString(R.string.deleteMessageDescriptionEveryone))
|
||||
dangerButton(R.string.delete) { doDelete.run() }
|
||||
cancelButton()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/call_action_foreground_highlighted" android:state_selected="true"/>
|
||||
<item android:color="@color/call_action_foreground"/>
|
||||
<item android:color="@color/white"/>
|
||||
</selector>
|
Before Width: | Height: | Size: 834 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 966 B |
Before Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 585 B |
Before Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 568 B |
Before Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 569 B |
Before Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 941 B |
Before Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 847 B |
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="50"
|
||||
android:viewportHeight="50">
|
||||
<path
|
||||
android:pathData="M34.425,36.527L19.159,24.147L34.753,11.491C34.947,11.342 35.111,11.152 35.236,10.933C35.361,10.714 35.443,10.471 35.479,10.217C35.515,9.963 35.504,9.704 35.446,9.455C35.387,9.206 35.284,8.972 35.14,8.767C34.996,8.562 34.816,8.39 34.61,8.261C34.404,8.132 34.176,8.049 33.939,8.016C33.702,7.983 33.462,8.001 33.232,8.07C33.002,8.139 32.787,8.256 32.6,8.416L15.545,22.254C15.363,22.406 15.208,22.592 15.09,22.804C15.007,22.888 14.93,22.978 14.86,23.074C14.574,23.482 14.451,23.995 14.517,24.501C14.584,25.006 14.834,25.463 15.212,25.77L32.268,39.609C32.455,39.762 32.668,39.873 32.896,39.937C33.123,40.001 33.36,40.016 33.593,39.982C33.826,39.947 34.05,39.863 34.252,39.735C34.455,39.607 34.632,39.437 34.773,39.235C34.916,39.032 35.02,38.802 35.079,38.556C35.139,38.311 35.153,38.055 35.121,37.803C35.089,37.552 35.011,37.31 34.891,37.091C34.772,36.872 34.614,36.68 34.425,36.527Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
Before Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 272 B |
Before Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 596 B |
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 811 B |
Before Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 750 B |
Before Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 302 B |
Before Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 426 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 610 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 675 B |