chats: fix stickers and emojis

main
Alibek Omarov 4 years ago
parent d8ffcaec30
commit 92a659fea4
  1. 18
      app/src/main/java/com/keylesspalace/tusky/components/chat/ChatActivity.kt
  2. 4
      app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressImageView.java
  3. 4
      app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressTextView.java

@ -205,12 +205,17 @@ class ChatActivity: BottomSheetActivity(),
subscribeToUpdates()
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
viewModel.tryFetchStickers = preferences.getBoolean("stickers", false)
setupHeader()
setupChat()
setupAttachment()
setupComposeField(savedInstanceState?.getString(MESSAGE_KEY))
setupButtons()
viewModel.setup()
photoUploadUri = savedInstanceState?.getParcelable(PHOTO_UPLOAD_URI_KEY)
eventHub.events
@ -229,6 +234,7 @@ class ChatActivity: BottomSheetActivity(),
}
}
tryCache()
}
@ -354,7 +360,7 @@ class ChatActivity: BottomSheetActivity(),
stickerKeyboard.setupStickerKeyboard(this@ChatActivity, stickers)
}
}
viewModel.emoji.observe { emoji -> setEmojiList(emoji) }
viewModel.emoji.observe { setEmojiList(it) }
viewModel.media.observe {
if(it.isNotEmpty()) {
val media = it[0]
@ -467,9 +473,15 @@ class ChatActivity: BottomSheetActivity(),
attachmentButton.setOnClickListener { openPickDialog() }
emojiButton.setOnClickListener { showEmojis() }
stickerButton.setOnClickListener { showStickers() }
if(viewModel.tryFetchStickers) {
stickerButton.setOnClickListener { showStickers() }
stickerButton.visibility = View.VISIBLE
enableButton(stickerButton, false, false)
} else {
stickerButton.visibility = View.GONE
}
enableButton(stickerButton, false, false)
emojiView.layoutManager = GridLayoutManager(this, 3, GridLayoutManager.HORIZONTAL, false)
val textColor = ThemeUtils.getColor(this, android.R.attr.textColorTertiary)

@ -91,8 +91,8 @@ public final class ProgressImageView extends AppCompatImageView {
super.onDraw(canvas);
float angle = (progress / 100f) * 360 - 90;
float halfWidth = getWidth() / 2;
float halfHeight = getHeight() / 2;
float halfWidth = getWidth() / 2.0f;
float halfHeight = getHeight() / 2.0f;
progressRect.set(halfWidth * 0.75f, halfHeight * 0.75f, halfWidth * 1.25f, halfHeight * 1.25f);
biggerRect.set(progressRect);
int margin = 8;

@ -90,8 +90,8 @@ public final class ProgressTextView extends TextView {
canvas.translate(getScrollX(), 0);
float angle = (progress / 100f) * 360 - 90;
float halfWidth = getWidth() / 2;
float halfHeight = getHeight() / 2;
float halfWidth = getWidth() / 2.0f;
float halfHeight = getHeight() / 2.0f;
progressRect.set(halfWidth * 0.75f, halfHeight * 0.75f, halfWidth * 1.25f, halfHeight * 1.25f);
biggerRect.set(progressRect);
int margin = 8;

Loading…
Cancel
Save