Upgrade ktlint and add twitter compose rules.

This commit is contained in:
Alex Hart
2023-02-06 11:04:40 -04:00
committed by Greyson Parrelli
parent 52e9b31554
commit 605289aca4
174 changed files with 574 additions and 373 deletions

View File

@@ -18,14 +18,14 @@ import org.thoughtcrime.securesms.components.menu.ContextMenuList
class ConversationContextMenu(private val anchor: View, items: List<ActionItem>) : PopupWindow(
LayoutInflater.from(anchor.context).inflate(R.layout.signal_context_menu, null),
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) {
val context: Context = anchor.context
private val contextMenuList = ContextMenuList(
recyclerView = contentView.findViewById(R.id.signal_context_menu_list),
onItemClick = { dismiss() },
onItemClick = { dismiss() }
)
init {

View File

@@ -3,8 +3,10 @@ package org.thoughtcrime.securesms.conversation
enum class ConversationItemDisplayMode {
/** Normal rendering, used for normal bubbles in the conversation view */
STANDARD,
/** Smaller bubbles, often trimming text and shrinking images. Used for quote threads. */
CONDENSED,
/** Less length restrictions. Used to show more info in message details. */
DETAILED,
DETAILED
}

View File

@@ -20,7 +20,7 @@ object ConversationItemSelection {
conversationItem: ConversationItem,
list: RecyclerView,
messageRecord: MessageRecord,
videoBitmap: Bitmap?,
videoBitmap: Bitmap?
): Bitmap {
val isOutgoing = messageRecord.isOutgoing
val hasNoBubble = messageRecord.hasNoBubble(conversationItem.context)
@@ -30,7 +30,7 @@ object ConversationItemSelection {
list = list,
videoBitmap = videoBitmap,
drawConversationItem = !isOutgoing || hasNoBubble,
hasReaction = messageRecord.reactions.isNotEmpty(),
hasReaction = messageRecord.reactions.isNotEmpty()
)
}
@@ -39,7 +39,7 @@ object ConversationItemSelection {
list: RecyclerView,
videoBitmap: Bitmap?,
drawConversationItem: Boolean,
hasReaction: Boolean,
hasReaction: Boolean
): Bitmap {
val bodyBubble = conversationItem.bodyBubble
val reactionsView = conversationItem.reactionsView

View File

@@ -83,7 +83,7 @@ class ScheduleMessageTimePickerBottomSheet : FixedRoundedCornerBottomSheetDialog
text = getString(
R.string.ScheduleMessageTimePickerBottomSheet__timezone_disclaimer,
zoneOffsetFormatter.format(zonedDateTime),
zoneNameFormatter.format(zonedDateTime),
zoneNameFormatter.format(zonedDateTime)
)
}

View File

@@ -17,5 +17,5 @@ data class SelectedConversationModel(
val bubbleWidth: Int,
val audioUri: Uri? = null,
val isOutgoing: Boolean,
val focusedView: View?,
val focusedView: View?
)

View File

@@ -50,12 +50,14 @@ object ChatColorsPalette {
@JvmField
val TAUPE = ChatColors.forColor(
ChatColors.Id.BuiltIn, 0xFF8F616A.toInt()
ChatColors.Id.BuiltIn,
0xFF8F616A.toInt()
)
@JvmField
val STEEL = ChatColors.forColor(
ChatColors.Id.BuiltIn, 0xFF71717F.toInt()
ChatColors.Id.BuiltIn,
0xFF71717F.toInt()
)
// endregion
@@ -128,7 +130,8 @@ object ChatColorsPalette {
ChatColors.LinearGradient(
180f,
intArrayOf(
0xFF6281D5.toInt(), 0xFF974460.toInt()
0xFF6281D5.toInt(),
0xFF974460.toInt()
),
floatArrayOf(0f, 1f)
)
@@ -216,7 +219,7 @@ object ChatColorsPalette {
NameColor(lightColor = 0xFF5E6E0C.toInt(), darkColor = 0xFF8FAA09.toInt()),
NameColor(lightColor = 0xFF077288.toInt(), darkColor = 0xFF00AED1.toInt()),
NameColor(lightColor = 0xFFC20AA3.toInt(), darkColor = 0xFFF75FDD.toInt()),
NameColor(lightColor = 0xFF2D761E.toInt(), darkColor = 0xFF43B42D.toInt()),
NameColor(lightColor = 0xFF2D761E.toInt(), darkColor = 0xFF43B42D.toInt())
)
}

View File

@@ -137,11 +137,19 @@ class RecyclerViewColorizer(private val recyclerView: RecyclerView) {
outOfBoundsPaint.color = color
canvas.drawRect(
0f, -parent.height.toFloat(), parent.width.toFloat(), 0f, outOfBoundsPaint
0f,
-parent.height.toFloat(),
parent.width.toFloat(),
0f,
outOfBoundsPaint
)
canvas.drawRect(
0f, parent.height.toFloat(), parent.width.toFloat(), parent.height * 2f, outOfBoundsPaint
0f,
parent.height.toFloat(),
parent.width.toFloat(),
parent.height * 2f,
outOfBoundsPaint
)
}
}

View File

@@ -189,7 +189,7 @@ class CustomChatColorCreatorPageFragment :
state.degrees,
intArrayOf(topEdgeColor.getColor(), bottomEdgeColor.getColor()),
floatArrayOf(0f, 1f)
),
)
)
preview.setChatColors(chatColor)
gradientTool.setSelectedEdge(state.selectedEdge)
@@ -255,14 +255,15 @@ class CustomChatColorCreatorPageFragment :
return listOf(0f, 1f).map {
ColorUtils.HSLToColor(
floatArrayOf(
hue, it, level
hue,
it,
level
)
)
}.toIntArray()
}
private fun calculateLightness(hue: Float, valueFor60To80: Float = 0.3f): Float {
val point1 = PointF()
val point2 = PointF()

View File

@@ -149,7 +149,6 @@ class CustomChatColorGradientToolView @JvmOverloads constructor(
}
override fun onTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_CANCEL || event.action == MotionEvent.ACTION_UP) {
listener?.onGestureFinished()
} else if (event.action == MotionEvent.ACTION_DOWN) {
@@ -293,7 +292,6 @@ class CustomChatColorGradientToolView @JvmOverloads constructor(
distanceX: Float,
distanceY: Float
): Boolean {
val a = PointF(e2.getX(activePointerId) - center.x, e2.getY(activePointerId) - center.y)
val b = PointF(center.x, 0f)
val dot = a.dotProduct(b)

View File

@@ -17,7 +17,7 @@ data class DraftState(
val bodyRangesDraft: DraftTable.Draft? = null,
val quoteDraft: DraftTable.Draft? = null,
val locationDraft: DraftTable.Draft? = null,
val voiceNoteDraft: DraftTable.Draft? = null,
val voiceNoteDraft: DraftTable.Draft? = null
) {
fun copyAndClearDrafts(threadId: Long = this.threadId): DraftState {
@@ -41,7 +41,7 @@ data class DraftState(
bodyRangesDraft = drafts.getDraftOfType(DraftTable.Draft.BODY_RANGES),
quoteDraft = drafts.getDraftOfType(DraftTable.Draft.QUOTE),
locationDraft = drafts.getDraftOfType(DraftTable.Draft.LOCATION),
voiceNoteDraft = drafts.getDraftOfType(DraftTable.Draft.VOICE_NOTE),
voiceNoteDraft = drafts.getDraftOfType(DraftTable.Draft.VOICE_NOTE)
)
}
}

View File

@@ -100,7 +100,7 @@ class MultiselectForwardViewModel(
private val storySendRequirements: Stories.MediaTransform.SendRequirements,
private val records: List<MultiShareArgs>,
private val isSelectionOnly: Boolean,
private val repository: MultiselectForwardRepository,
private val repository: MultiselectForwardRepository
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return requireNotNull(modelClass.cast(MultiselectForwardViewModel(storySendRequirements, records, isSelectionOnly, repository)))