Adds filters
This commit is contained in:
parent
87d244be1b
commit
3ca1e3b402
|
@ -33,16 +33,17 @@ import android.support.v7.widget.DividerItemDecoration;
|
|||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
@ -59,6 +60,7 @@ import fr.gouv.etalab.mastodon.client.APIResponse;
|
|||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||
import fr.gouv.etalab.mastodon.helper.FilterToots;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
|
||||
import fr.gouv.etalab.mastodon.services.BackupStatusInDataBaseService;
|
||||
|
@ -91,6 +93,8 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
LinearLayoutManager mLayoutManager;
|
||||
private int style;
|
||||
private Button settings_time_from, settings_time_to;
|
||||
private FilterToots filterToots;
|
||||
private Date dateIni, dateEnd;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -105,6 +109,8 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
}
|
||||
setContentView(R.layout.activity_ower_status);
|
||||
|
||||
filterToots = new FilterToots();
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
|
@ -181,15 +187,18 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
isRefreshed = false;
|
||||
|
||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
|
||||
R.color.mastodonC2,
|
||||
R.color.mastodonC3);
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
isRefreshed = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -203,7 +212,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
if(firstVisibleItem + visibleItemCount == totalItemCount ) {
|
||||
if(!flag_loading ) {
|
||||
flag_loading = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, max_id, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, max_id, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
|
@ -229,6 +238,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
int monthOfYear, int dayOfMonth) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.set(year, monthOfYear, dayOfMonth, 0, 0);
|
||||
dateIni = new Date(c.getTimeInMillis());
|
||||
settings_time_from.setText(Helper.shortDateToString(new Date(c.getTimeInMillis())));
|
||||
}
|
||||
|
||||
|
@ -240,6 +250,8 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
int monthOfYear, int dayOfMonth) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.set(year, monthOfYear, dayOfMonth, 23, 59);
|
||||
|
||||
dateEnd = new Date(c.getTimeInMillis());
|
||||
settings_time_to.setText(Helper.shortDateToString(new Date(c.getTimeInMillis())));
|
||||
}
|
||||
|
||||
|
@ -259,36 +271,46 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
LayoutInflater inflater = this.getLayoutInflater();
|
||||
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.filter_owner_toots, null);
|
||||
dialogBuilder.setView(dialogView);
|
||||
dialogBuilder
|
||||
.setTitle(R.string.action_filter)
|
||||
.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
final AlertDialog alertDialog = dialogBuilder.create();
|
||||
|
||||
|
||||
SQLiteDatabase db = Sqlite.getInstance(OwnerStatusActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
Date dateInit = new StatusCacheDAO(OwnerStatusActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||
Date dateEnd = new StatusCacheDAO(OwnerStatusActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||
String dateInitString = Helper.shortDateToString(dateInit);
|
||||
dateIni = new StatusCacheDAO(OwnerStatusActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||
dateEnd = new StatusCacheDAO(OwnerStatusActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||
String dateInitString = Helper.shortDateToString(dateIni);
|
||||
String dateEndString = Helper.shortDateToString(dateEnd);
|
||||
|
||||
//Initializes settings for filter
|
||||
settings_time_from = dialogView.findViewById(R.id.settings_time_from);
|
||||
settings_time_to = dialogView.findViewById(R.id.settings_time_to);
|
||||
|
||||
final CheckBox filter_visibility_public = dialogView.findViewById(R.id.filter_visibility_public);
|
||||
final CheckBox filter_visibility_unlisted = dialogView.findViewById(R.id.filter_visibility_unlisted);
|
||||
final CheckBox filter_visibility_private = dialogView.findViewById(R.id.filter_visibility_private);
|
||||
CheckBox filter_visibility_direct = dialogView.findViewById(R.id.filter_visibility_direct);
|
||||
|
||||
filter_visibility_public.setChecked(filterToots.isV_public());
|
||||
filter_visibility_unlisted.setChecked(filterToots.isV_unlisted());
|
||||
filter_visibility_private.setChecked(filterToots.isV_private());
|
||||
filter_visibility_direct.setChecked(filterToots.isV_direct());
|
||||
|
||||
final Spinner filter_boost = dialogView.findViewById(R.id.filter_boost);
|
||||
final Spinner filter_replies = dialogView.findViewById(R.id.filter_replies);
|
||||
final Spinner filter_media = dialogView.findViewById(R.id.filter_media);
|
||||
final Spinner filter_pinned = dialogView.findViewById(R.id.filter_pinned);
|
||||
|
||||
filter_boost.setSelection(filterToots.getBoosts().ordinal());
|
||||
filter_replies.setSelection(filterToots.getReplies().ordinal());
|
||||
filter_media.setSelection(filterToots.getMedia().ordinal());
|
||||
filter_pinned.setSelection(filterToots.getPinned().ordinal());
|
||||
|
||||
final TextView filter_keywords = dialogView.findViewById(R.id.filter_keywords);
|
||||
|
||||
settings_time_from.setText(dateInitString);
|
||||
settings_time_to.setText(dateEndString);
|
||||
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(dateInit);
|
||||
c.setTime(dateIni);
|
||||
int yearIni = c.get(Calendar.YEAR);
|
||||
int monthIni = c.get(Calendar.MONTH);
|
||||
int dayIni = c.get(Calendar.DAY_OF_MONTH);
|
||||
|
@ -314,7 +336,41 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
dateEndPickerDialog.show();
|
||||
}
|
||||
});
|
||||
dialogBuilder
|
||||
.setTitle(R.string.action_filter)
|
||||
.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
filterToots.setBoosts(FilterToots.typeFilter.values()[filter_boost.getSelectedItemPosition()]);
|
||||
filterToots.setReplies(FilterToots.typeFilter.values()[filter_replies.getSelectedItemPosition()]);
|
||||
filterToots.setMedia(FilterToots.typeFilter.values()[filter_media.getSelectedItemPosition()]);
|
||||
filterToots.setPinned(FilterToots.typeFilter.values()[filter_pinned.getSelectedItemPosition()]);
|
||||
|
||||
filterToots.setV_public(filter_visibility_public.isChecked());
|
||||
filterToots.setV_unlisted(filter_visibility_unlisted.isChecked());
|
||||
filterToots.setV_private(filter_visibility_private.isChecked());
|
||||
filterToots.setV_direct(filter_visibility_public.isChecked());
|
||||
|
||||
filterToots.setDateIni(Helper.dateToString(OwnerStatusActivity.this,dateIni));
|
||||
filterToots.setDateEnd(Helper.dateToString(OwnerStatusActivity.this,dateEnd));
|
||||
|
||||
filterToots.setFilter(filter_keywords.getText().toString());
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
max_id = null;
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
swiped = true;
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
final AlertDialog alertDialog = dialogBuilder.create();
|
||||
|
||||
alertDialog.show();
|
||||
return true;
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.helper.FilterToots;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
|
||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||
import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
|
||||
|
@ -46,6 +47,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
private boolean showMediaOnly = false;
|
||||
private boolean showPinned = false;
|
||||
private WeakReference<Context> contextReference;
|
||||
private FilterToots filterToots;
|
||||
|
||||
public enum Type{
|
||||
HOME,
|
||||
|
@ -62,6 +64,15 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
CACHE_STATUS
|
||||
}
|
||||
|
||||
|
||||
public RetrieveFeedsAsyncTask(Context context, FilterToots filterToots, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.action = Type.CACHE_STATUS;
|
||||
this.max_id = max_id;
|
||||
this.listener = onRetrieveFeedsInterface;
|
||||
this.filterToots = filterToots;
|
||||
}
|
||||
|
||||
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.action = action;
|
||||
|
@ -127,7 +138,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
case CACHE_STATUS:
|
||||
apiResponse = new APIResponse();
|
||||
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, max_id);
|
||||
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
apiResponse.setStatuses(statuses);
|
||||
apiResponse.setMax_id(statuses.get(0).getId());
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
/* Copyright 2017 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Mastalab
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.helper;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 17/02/2018.
|
||||
* Helper class for filtering toots
|
||||
*/
|
||||
|
||||
public class FilterToots {
|
||||
|
||||
public enum typeFilter{
|
||||
NONE,
|
||||
ONLY,
|
||||
BOTH
|
||||
}
|
||||
|
||||
private typeFilter pinned = typeFilter.BOTH;
|
||||
private typeFilter boosts = typeFilter.BOTH;
|
||||
private typeFilter replies = typeFilter.BOTH;
|
||||
private typeFilter media = typeFilter.BOTH;
|
||||
|
||||
private boolean v_public = true;
|
||||
private boolean v_unlisted = true;
|
||||
private boolean v_direct = true;
|
||||
private boolean v_private = true;
|
||||
|
||||
private String filter = null;
|
||||
|
||||
|
||||
private String dateIni = null;
|
||||
private String dateEnd = null;
|
||||
|
||||
public typeFilter getPinned() {
|
||||
return pinned;
|
||||
}
|
||||
|
||||
public void setPinned(typeFilter pinned) {
|
||||
this.pinned = pinned;
|
||||
}
|
||||
|
||||
public typeFilter getBoosts() {
|
||||
return boosts;
|
||||
}
|
||||
|
||||
public void setBoosts(typeFilter boosts) {
|
||||
this.boosts = boosts;
|
||||
}
|
||||
|
||||
public typeFilter getReplies() {
|
||||
return replies;
|
||||
}
|
||||
|
||||
public void setReplies(typeFilter replies) {
|
||||
this.replies = replies;
|
||||
}
|
||||
|
||||
public typeFilter getMedia() {
|
||||
return media;
|
||||
}
|
||||
|
||||
public void setMedia(typeFilter media) {
|
||||
this.media = media;
|
||||
}
|
||||
|
||||
public boolean isV_public() {
|
||||
return v_public;
|
||||
}
|
||||
|
||||
public void setV_public(boolean v_public) {
|
||||
this.v_public = v_public;
|
||||
}
|
||||
|
||||
public boolean isV_unlisted() {
|
||||
return v_unlisted;
|
||||
}
|
||||
|
||||
public void setV_unlisted(boolean v_unlisted) {
|
||||
this.v_unlisted = v_unlisted;
|
||||
}
|
||||
|
||||
public boolean isV_direct() {
|
||||
return v_direct;
|
||||
}
|
||||
|
||||
public void setV_direct(boolean v_direct) {
|
||||
this.v_direct = v_direct;
|
||||
}
|
||||
|
||||
public boolean isV_private() {
|
||||
return v_private;
|
||||
}
|
||||
|
||||
public void setV_private(boolean v_private) {
|
||||
this.v_private = v_private;
|
||||
}
|
||||
|
||||
public String getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getDateIni() {
|
||||
return dateIni;
|
||||
}
|
||||
|
||||
public void setDateIni(String dateIni) {
|
||||
this.dateIni = dateIni;
|
||||
}
|
||||
|
||||
public String getDateEnd() {
|
||||
return dateEnd;
|
||||
}
|
||||
|
||||
public void setDateEnd(String dateEnd) {
|
||||
this.dateEnd = dateEnd;
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.helper.FilterToots;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
|
||||
|
||||
|
@ -164,18 +165,40 @@ public class StatusCacheDAO {
|
|||
* Returns all cached Statuses in db depending of their cache type
|
||||
* @return stored status List<StoredStatus>
|
||||
*/
|
||||
public List<Status> getStatusFromID(int cacheType, String max_id){
|
||||
public List<Status> getStatusFromID(int cacheType, FilterToots filterToots, String max_id){
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
String instance = Helper.getLiveInstance(context);
|
||||
//That the basic selection for all toots
|
||||
String selection = Sqlite.COL_CACHED_ACTION + " = '" + cacheType+ "' AND " + Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'";
|
||||
if( max_id != null)
|
||||
selection += " AND " + Sqlite.COL_STATUS_ID + " < '" + max_id+ "'";
|
||||
//BOOST
|
||||
if(filterToots.getBoosts() == FilterToots.typeFilter.NONE)
|
||||
selection += " AND (" + Sqlite.COL_REBLOG + " IS NULL OR "+ Sqlite.COL_REBLOG + " = 'null')";
|
||||
else if(filterToots.getBoosts() == FilterToots.typeFilter.ONLY)
|
||||
selection += " AND " + Sqlite.COL_REBLOG + " IS NOT NULL AND "+ Sqlite.COL_REBLOG + " <> 'null'";
|
||||
//REPLIES
|
||||
if(filterToots.getReplies() == FilterToots.typeFilter.NONE)
|
||||
selection += " AND (" + Sqlite.COL_IN_REPLY_TO_ID + " IS NULL OR "+ Sqlite.COL_IN_REPLY_TO_ID + " = 'null')";
|
||||
else if(filterToots.getReplies() == FilterToots.typeFilter.ONLY)
|
||||
selection += " AND " + Sqlite.COL_IN_REPLY_TO_ID + " IS NOT NULL AND "+ Sqlite.COL_IN_REPLY_TO_ID + " <> 'null'";
|
||||
//PINNED
|
||||
if(filterToots.getPinned() == FilterToots.typeFilter.NONE)
|
||||
selection += " AND " + Sqlite.COL_PINNED + " = 0";
|
||||
else if(filterToots.getPinned() == FilterToots.typeFilter.ONLY)
|
||||
selection += " AND " + Sqlite.COL_PINNED + " = 1";
|
||||
//PINNED
|
||||
if(filterToots.getMedia() == FilterToots.typeFilter.NONE)
|
||||
selection += " AND " + Sqlite.COL_MEDIA_ATTACHMENTS + " = '[]'";
|
||||
else if(filterToots.getMedia() == FilterToots.typeFilter.ONLY)
|
||||
selection += " AND " + Sqlite.COL_MEDIA_ATTACHMENTS + " <> '[]'";
|
||||
|
||||
try {
|
||||
Cursor c;
|
||||
if( max_id != null)
|
||||
c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, Sqlite.COL_CACHED_ACTION + " = '" + cacheType+ "' AND " + Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "' AND " + Sqlite.COL_STATUS_ID + " < '" + max_id+ "'", null, null, null, Sqlite.COL_CREATED_AT + " DESC", "80");
|
||||
else
|
||||
c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, Sqlite.COL_CACHED_ACTION + " = '" + cacheType+ "' AND " + Sqlite.COL_INSTANCE + " = '" + instance+ "' AND " + Sqlite.COL_USER_ID + " = '" + userId+ "'", null, null, null, Sqlite.COL_CREATED_AT + " DESC", "80");
|
||||
Cursor c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, selection, null, null, null, Sqlite.COL_CREATED_AT + " DESC", "80");
|
||||
return cursorToListStatuses(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,94 +15,161 @@
|
|||
You should have received a copy of the GNU General Public License along with Mastalab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingEnd="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
style="?attr/shapeBorder"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:text="@string/settings_time_from"
|
||||
android:paddingStart="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_vertical_margin"
|
||||
android:paddingEnd="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_vertical_margin"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
style="?attr/shapeBorder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:text="@string/settings_time_from"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:id="@+id/settings_time_from"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/settings_time_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
|
||||
android:id="@+id/settings_time_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_public"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_public"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
android:id="@+id/settings_time_from"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_unlisted"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_unlisted"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/settings_time_to"
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_private"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_private"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:focusableInTouchMode="false"
|
||||
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
|
||||
android:id="@+id/settings_time_to"
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_direct"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_direct"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- 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/show_boosts"/>
|
||||
<Spinner
|
||||
android:id="@+id/filter_boost"
|
||||
android:entries="@array/filter_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Show replies -->
|
||||
<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/show_replies"/>
|
||||
<Spinner
|
||||
android:id="@+id/filter_replies"
|
||||
android:entries="@array/filter_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Show media -->
|
||||
<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/media"/>
|
||||
<Spinner
|
||||
android:id="@+id/filter_media"
|
||||
android:entries="@array/filter_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<!-- Show pinned -->
|
||||
<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/pinned_toots"/>
|
||||
<Spinner
|
||||
android:id="@+id/filter_pinned"
|
||||
android:entries="@array/filter_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:inputType="text"
|
||||
android:id="@+id/filter_keywords"
|
||||
android:maxLines="2"
|
||||
android:hint="@string/v_keywords"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_public"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_public"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_unlisted"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_unlisted"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_private"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_private"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/filter_visibility_direct"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/v_direct"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/filter_boost"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/show_boosts"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<CheckBox
|
||||
android:id="@+id/filer_reply"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/show_replies"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:inputType="text"
|
||||
android:id="@+id/filter_keywords"
|
||||
android:maxLines="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -404,8 +404,13 @@
|
|||
<string name="v_public">Public</string>
|
||||
<string name="v_unlisted">Unlisted</string>
|
||||
<string name="v_private">Private</string>
|
||||
<string name="v_direct">Direct</string>
|
||||
|
||||
<string name="v_direct">Public</string>
|
||||
<string name="v_keywords">Some keywords…</string>
|
||||
<string-array name="filter_select">
|
||||
<item>No</item>
|
||||
<item>Only</item>
|
||||
<item>Both</item>
|
||||
</string-array>
|
||||
<string name="owner_cached_toots_empty">No toots were found in database. Please, use the synchronize button from the menu to retrieve them.</string>
|
||||
<!-- PRIVACY -->
|
||||
<string name="privacy_data_title">Recorded data</string>
|
||||
|
|
Loading…
Reference in New Issue