fix emoji & toot size limit caching

This commit is contained in:
Konrad Pozniak 2018-04-23 09:26:03 +02:00
parent 23f7f04aa8
commit 20033f844a
2 changed files with 13 additions and 8 deletions

View File

@ -286,7 +286,7 @@ public final class ComposeActivity
@Override
public void onResponse(@NonNull Call<List<Emoji>> call, @NonNull Response<List<Emoji>> response) {
emojiList = response.body();
enableButton(emojiButton, true, emojiList.size() > 0);
setEmojiList(emojiList);
cacheInstanceMetadata(activeAccount);
}
@ -1447,15 +1447,19 @@ public final class ComposeActivity
Integer max = instanceEntity.getMaximumTootCharacters();
maximumTootCharacters = (max == null ? STATUS_CHARACTER_LIMIT : max);
emojiList = instanceEntity.getEmojiList();
if (emojiList != null) {
emojiView.setAdapter(new EmojiAdapter(emojiList, ComposeActivity.this));
enableButton(emojiButton, true, emojiList.size() > 0);
}
setEmojiList(emojiList);
updateVisibleCharactersLeft();
}
}
private void cacheInstanceMetadata(@NotNull AccountEntity activeAccount)
{
private void setEmojiList(@Nullable List<Emoji> emojiList) {
if (emojiList != null) {
emojiView.setAdapter(new EmojiAdapter(emojiList, ComposeActivity.this));
enableButton(emojiButton, true, emojiList.size() > 0);
}
}
private void cacheInstanceMetadata(@NotNull AccountEntity activeAccount) {
InstanceEntity instanceEntity = new InstanceEntity(activeAccount.getDomain(), emojiList, maximumTootCharacters);
TuskyApplication.getDB().instanceDao().insertOrReplace(instanceEntity);
}

View File

@ -275,7 +275,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorTertiary"
android:textSize="?attr/status_text_medium" />
android:textSize="?attr/status_text_medium"
tools:text="500"/>
<com.keylesspalace.tusky.view.TootButton
android:id="@+id/composeTootButton"