Some fixes

This commit is contained in:
Thomas 2022-12-03 18:40:00 +01:00
parent 77b6c478d1
commit d66c257370
5 changed files with 60 additions and 25 deletions

View File

@ -13,8 +13,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 32
versionCode 436
versionName "3.9.1"
versionCode 437
versionName "3.9.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "default"

View File

@ -1,4 +1,9 @@
[
{
"version": "3.9.2",
"code": "437",
"note": "Added:\n- New design with 5 themes\n\nChanged:\n- Remove built-in browser support\n- Fit preview image displays images vertically\n- Add counters next to images\n\nFixed:\n- Jumps in timelines\n- Replies to wrong messages with followed instances\n- Bug with delete&redraft with a media\n- Some crashes"
},
{
"version": "3.9.1",
"code": "436",

View File

@ -24,6 +24,7 @@ import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -154,7 +155,17 @@ public class Pinned implements Serializable {
}
try {
Cursor c = db.query(Sqlite.TABLE_PINNED_TIMELINES, null, Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND " + Sqlite.COL_USER_ID + " = '" + account.user_id + "'", null, null, null, Sqlite.COL_UPDATED_AT + " DESC", "1");
return cursorToPined(c);
Pinned pinned = cursorToPined(c);
List<PinnedTimeline> pinnedTimelines = new ArrayList<>();
if (pinned != null) {
for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) {
if (pinnedTimeline.displayed) {
pinnedTimelines.add(pinnedTimeline);
}
}
pinned.pinnedTimelines = pinnedTimelines;
}
return pinned;
} catch (Exception e) {
return null;
}

View File

@ -274,31 +274,37 @@ public class PinnedTimelineHelper {
for (MastodonList mastodonList : mastodonLists) {
boolean present = false;
for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) {
if (pinnedTimeline.mastodonList != null && mastodonList.id.compareTo(pinnedTimeline.mastodonList.id) == 0) {
present = true;
break;
}
}
//Needs to be added
if (!present) {
needRedraw = true; //Something changed, redraw must be done
PinnedTimeline pinnedTimeline = new PinnedTimeline();
pinnedTimeline.type = Timeline.TimeLineEnum.LIST;
pinnedTimeline.position = pinned.pinnedTimelines.size();
pinnedTimeline.mastodonList = mastodonList;
pinned.pinnedTimelines.add(pinnedTimeline);
try {
boolean exist = new Pinned(activity).pinnedExist(pinned);
if (exist) {
new Pinned(activity).updatePinned(pinned);
} else {
new Pinned(activity).insertPinned(pinned);
try {
Pinned pinnedAll = new Pinned(activity).getAllPinned(currentAccount);
for (PinnedTimeline pinnedTimeline : pinnedAll.pinnedTimelines) {
if (pinnedTimeline.mastodonList != null && mastodonList.id.compareTo(pinnedTimeline.mastodonList.id) == 0) {
present = true;
break;
}
} catch (DBException e) {
e.printStackTrace();
}
//Needs to be added
if (!present) {
needRedraw = true; //Something changed, redraw must be done
PinnedTimeline pinnedTimeline = new PinnedTimeline();
pinnedTimeline.type = Timeline.TimeLineEnum.LIST;
pinnedTimeline.position = pinnedAll.pinnedTimelines.size();
pinnedTimeline.mastodonList = mastodonList;
pinnedAll.pinnedTimelines.add(pinnedTimeline);
try {
boolean exist = new Pinned(activity).pinnedExist(pinnedAll);
if (exist) {
new Pinned(activity).updatePinned(pinnedAll);
} else {
new Pinned(activity).insertPinned(pinnedAll);
}
} catch (DBException e) {
e.printStackTrace();
}
}
} catch (DBException e) {
e.printStackTrace();
}
}
}
if (!needRedraw) { //if there were no changes with list, no need to update tabs

View File

@ -0,0 +1,13 @@
Added:
- New design with 5 themes
Changed:
- Remove built-in browser support
- Fit preview image displays images vertically
- Add counters next to images
Fixed:
- Jumps in timelines
- Replies to wrong messages with followed instances
- Bug with delete&redraft with a media
- Some crashes