Fix #261 - Allow to order own toots by date asc or desc
This commit is contained in:
parent
b318a9b106
commit
1d00d489f5
|
@ -369,11 +369,13 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
||||||
final Spinner filter_replies = dialogView.findViewById(R.id.filter_replies);
|
final Spinner filter_replies = dialogView.findViewById(R.id.filter_replies);
|
||||||
final Spinner filter_media = dialogView.findViewById(R.id.filter_media);
|
final Spinner filter_media = dialogView.findViewById(R.id.filter_media);
|
||||||
final Spinner filter_pinned = dialogView.findViewById(R.id.filter_pinned);
|
final Spinner filter_pinned = dialogView.findViewById(R.id.filter_pinned);
|
||||||
|
final Spinner filter_order = dialogView.findViewById(R.id.filter_order);
|
||||||
|
|
||||||
filter_boost.setSelection(filterToots.getBoosts().ordinal());
|
filter_boost.setSelection(filterToots.getBoosts().ordinal());
|
||||||
filter_replies.setSelection(filterToots.getReplies().ordinal());
|
filter_replies.setSelection(filterToots.getReplies().ordinal());
|
||||||
filter_media.setSelection(filterToots.getMedia().ordinal());
|
filter_media.setSelection(filterToots.getMedia().ordinal());
|
||||||
filter_pinned.setSelection(filterToots.getPinned().ordinal());
|
filter_pinned.setSelection(filterToots.getPinned().ordinal());
|
||||||
|
filter_order.setSelection(filterToots.getOrder().ordinal());
|
||||||
|
|
||||||
final EditText filter_keywords = dialogView.findViewById(R.id.filter_keywords);
|
final EditText filter_keywords = dialogView.findViewById(R.id.filter_keywords);
|
||||||
|
|
||||||
|
@ -422,6 +424,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
||||||
filterToots.setReplies(FilterToots.typeFilter.values()[filter_replies.getSelectedItemPosition()]);
|
filterToots.setReplies(FilterToots.typeFilter.values()[filter_replies.getSelectedItemPosition()]);
|
||||||
filterToots.setMedia(FilterToots.typeFilter.values()[filter_media.getSelectedItemPosition()]);
|
filterToots.setMedia(FilterToots.typeFilter.values()[filter_media.getSelectedItemPosition()]);
|
||||||
filterToots.setPinned(FilterToots.typeFilter.values()[filter_pinned.getSelectedItemPosition()]);
|
filterToots.setPinned(FilterToots.typeFilter.values()[filter_pinned.getSelectedItemPosition()]);
|
||||||
|
filterToots.setOrder(FilterToots.typeOrder.values()[filter_order.getSelectedItemPosition()]);
|
||||||
|
|
||||||
filterToots.setV_public(filter_visibility_public.isChecked());
|
filterToots.setV_public(filter_visibility_public.isChecked());
|
||||||
filterToots.setV_unlisted(filter_visibility_unlisted.isChecked());
|
filterToots.setV_unlisted(filter_visibility_unlisted.isChecked());
|
||||||
|
|
|
@ -21,16 +21,30 @@ package app.fedilab.android.helper;
|
||||||
|
|
||||||
public class FilterToots {
|
public class FilterToots {
|
||||||
|
|
||||||
|
public typeOrder getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(typeOrder order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
public enum typeFilter {
|
public enum typeFilter {
|
||||||
NONE,
|
NONE,
|
||||||
ONLY,
|
ONLY,
|
||||||
BOTH
|
BOTH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum typeOrder {
|
||||||
|
DESC,
|
||||||
|
ASC,
|
||||||
|
}
|
||||||
|
|
||||||
private typeFilter pinned = typeFilter.BOTH;
|
private typeFilter pinned = typeFilter.BOTH;
|
||||||
private typeFilter boosts = typeFilter.BOTH;
|
private typeFilter boosts = typeFilter.BOTH;
|
||||||
private typeFilter replies = typeFilter.BOTH;
|
private typeFilter replies = typeFilter.BOTH;
|
||||||
private typeFilter media = typeFilter.BOTH;
|
private typeFilter media = typeFilter.BOTH;
|
||||||
|
private typeOrder order = typeOrder.DESC;
|
||||||
|
|
||||||
private boolean v_public = true;
|
private boolean v_public = true;
|
||||||
private boolean v_unlisted = true;
|
private boolean v_unlisted = true;
|
||||||
|
|
|
@ -329,9 +329,18 @@ public class StatusCacheDAO {
|
||||||
}
|
}
|
||||||
selection.append(")");
|
selection.append(")");
|
||||||
}
|
}
|
||||||
|
String order = Sqlite.COL_CREATED_AT + " DESC";
|
||||||
|
|
||||||
|
if (filterToots.getOrder() != null) {
|
||||||
|
if( filterToots.getOrder() == FilterToots.typeOrder.ASC ){
|
||||||
|
order = Sqlite.COL_CREATED_AT + " ASC";
|
||||||
|
}else if(filterToots.getOrder() == FilterToots.typeOrder.DESC) {
|
||||||
|
order = Sqlite.COL_CREATED_AT + " DESC";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Cursor c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, selection.toString(), null, null, null, Sqlite.COL_CREATED_AT + " DESC", "40");
|
Cursor c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, selection.toString(), null, null, null, order, "40");
|
||||||
return cursorToListStatuses(c);
|
return cursorToListStatuses(c);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -67,6 +67,28 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Show boosts -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/order_by" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/filter_order"
|
||||||
|
android:entries="@array/filter_order"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/filter_visibility_public"
|
android:id="@+id/filter_visibility_public"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -454,6 +454,12 @@
|
||||||
<string name="data_backup_notifications">Backup notifications for %1$s</string>
|
<string name="data_backup_notifications">Backup notifications for %1$s</string>
|
||||||
<string name="data_backup_success">%1$s new toots have been imported</string>
|
<string name="data_backup_success">%1$s new toots have been imported</string>
|
||||||
<string name="data_backup_notification_success">%1$s new notifications have been imported</string>
|
<string name="data_backup_notification_success">%1$s new notifications have been imported</string>
|
||||||
|
|
||||||
|
<string-array name="filter_order">
|
||||||
|
<item>Dates descending</item>
|
||||||
|
<item>Dates ascending</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="filter_select">
|
<string-array name="filter_select">
|
||||||
<item>No</item>
|
<item>No</item>
|
||||||
<item>Only</item>
|
<item>Only</item>
|
||||||
|
@ -1236,4 +1242,5 @@
|
||||||
<string name="message_preview">Message preview</string>
|
<string name="message_preview">Message preview</string>
|
||||||
<string name="report_mention">Add mentions in each message</string>
|
<string name="report_mention">Add mentions in each message</string>
|
||||||
<string name="fetch_conversation">Fetching conversation</string>
|
<string name="fetch_conversation">Fetching conversation</string>
|
||||||
|
<string name="order_by">Order by</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue