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

View file

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