Pinned toots are only accessible from authenticated account, so I changed the way they are displayed in ShowAccountActivity

This commit is contained in:
tom79 2017-09-15 19:51:41 +02:00
parent 03c09c8465
commit a84a478969
13 changed files with 50 additions and 83 deletions

View File

@ -20,7 +20,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
@ -49,7 +48,6 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -93,8 +91,6 @@ import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAccountInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsAccountInterface; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsAccountInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRelationshipInterface; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRelationshipInterface;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import mastodon.etalab.gouv.fr.mastodon.R; import mastodon.etalab.gouv.fr.mastodon.R;
import fr.gouv.etalab.mastodon.client.Entities.Relationship; import fr.gouv.etalab.mastodon.client.Entities.Relationship;
@ -115,7 +111,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
private StatusListAdapter statusListAdapter; private StatusListAdapter statusListAdapter;
private FloatingActionButton account_follow; private FloatingActionButton account_follow;
private static final int NUM_PAGES = 4; private static final int NUM_PAGES = 3;
private ViewPager mPager; private ViewPager mPager;
private String accountId; private String accountId;
private TabLayout tabLayout; private TabLayout tabLayout;
@ -123,7 +119,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
private String userId; private String userId;
private static int instanceValue = 0; private static int instanceValue = 0;
private Relationship relationship; private Relationship relationship;
private boolean showMediaOnly; private boolean showMediaOnly, showPinned;
private ImageView pp_actionBar; private ImageView pp_actionBar;
private BroadcastReceiver hide_header; private BroadcastReceiver hide_header;
private boolean isHiddingShowing = false; private boolean isHiddingShowing = false;
@ -166,13 +162,11 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
new RetrieveAccountAsyncTask(getApplicationContext(),accountId, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveAccountAsyncTask(getApplicationContext(),accountId, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
// Get the pins, as early as we can
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.PINS, userId, null, false,
ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}else{ }else{
Toast.makeText(this,R.string.toast_error_loading_account,Toast.LENGTH_LONG).show(); Toast.makeText(this,R.string.toast_error_loading_account,Toast.LENGTH_LONG).show();
} }
showMediaOnly = false; showMediaOnly = false;
showPinned = false;
imageLoader = ImageLoader.getInstance(); imageLoader = ImageLoader.getInstance();
File cacheDir = new File(getCacheDir(), getString(R.string.app_name)); File cacheDir = new File(getCacheDir(), getString(R.string.app_name));
ImageLoaderConfiguration configImg = new ImageLoaderConfiguration.Builder(this) ImageLoaderConfiguration configImg = new ImageLoaderConfiguration.Builder(this)
@ -202,7 +196,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following))); tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following)));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers))); tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers)));
mPager = (ViewPager) findViewById(R.id.account_viewpager); mPager = (ViewPager) findViewById(R.id.account_viewpager);
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter); mPager.setAdapter(mPagerAdapter);
@ -252,11 +245,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
if (displayAccountsFragment != null) if (displayAccountsFragment != null)
displayAccountsFragment.scrollToTop(); displayAccountsFragment.scrollToTop();
break; break;
case 3:
displayStatusFragment = ((DisplayStatusFragment) fragment);
if( displayStatusFragment != null )
displayStatusFragment.scrollToTop();
break;
} }
} }
}); });
@ -346,6 +334,9 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present. // Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_showaccount, menu); getMenuInflater().inflate(R.menu.main_showaccount, menu);
if( !Helper.canPin || !accountId.equals(userId)) {
menu.findItem(R.id.action_show_pinned).setVisible(false);
}
return true; return true;
} }
@ -355,6 +346,14 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
case android.R.id.home: case android.R.id.home:
finish(); finish();
return true; return true;
case R.id.action_show_pinned:
showPinned = !showPinned;
if( tabLayout.getTabAt(0) != null)
//noinspection ConstantConditions
tabLayout.getTabAt(0).select();
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
return true;
case R.id.action_show_media: case R.id.action_show_media:
showMediaOnly = !showMediaOnly; showMediaOnly = !showMediaOnly;
if( showMediaOnly ) if( showMediaOnly )
@ -364,7 +363,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
if( tabLayout.getTabAt(0) != null) if( tabLayout.getTabAt(0) != null)
//noinspection ConstantConditions //noinspection ConstantConditions
tabLayout.getTabAt(0).select(); tabLayout.getTabAt(0).select();
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter); mPager.setAdapter(mPagerAdapter);
return true; return true;
default: default:
@ -503,6 +502,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
tabLayout.getTabAt(1).setText(getString(R.string.following_cnt, account.getFollowing_count())); tabLayout.getTabAt(1).setText(getString(R.string.following_cnt, account.getFollowing_count()));
//noinspection ConstantConditions //noinspection ConstantConditions
tabLayout.getTabAt(2).setText(getString(R.string.followers_cnt, account.getFollowers_count())); tabLayout.getTabAt(2).setText(getString(R.string.followers_cnt, account.getFollowers_count()));
} }
imageLoader.displayImage(account.getAvatar(), account_pp, options); imageLoader.displayImage(account.getAvatar(), account_pp, options);
@ -528,11 +528,11 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show(); Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
return; return;
} }
pins = apiResponse.getStatuses(); pins = apiResponse.getStatuses();
if (pins != null && pins.size() > 0) { if (pins != null && pins.size() > 0) {
if( pins.get(0).isPinned()) { if( pins.get(0).isPinned()) {
tabLayout.addTab(tabLayout.newTab().setText(R.string.pinned_toots));
for (Status pin : pins) { for (Status pin : pins) {
this.statuses.add(pin); this.statuses.add(pin);
} }
@ -614,6 +614,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
bundle.putString("targetedId", accountId); bundle.putString("targetedId", accountId);
bundle.putBoolean("hideHeader",true); bundle.putBoolean("hideHeader",true);
bundle.putBoolean("showMediaOnly",showMediaOnly); bundle.putBoolean("showMediaOnly",showMediaOnly);
bundle.putBoolean("showPinned",showPinned);
bundle.putString("hideHeaderValue",String.valueOf(instanceValue)); bundle.putString("hideHeaderValue",String.valueOf(instanceValue));
displayStatusFragment.setArguments(bundle); displayStatusFragment.setArguments(bundle);
return displayStatusFragment; return displayStatusFragment;
@ -633,15 +634,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
bundle.putString("hideHeaderValue",String.valueOf(instanceValue)); bundle.putString("hideHeaderValue",String.valueOf(instanceValue));
displayAccountsFragment.setArguments(bundle); displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment; return displayAccountsFragment;
case 3:
displayStatusFragment = new DisplayStatusFragment();
bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.PINS);
bundle.putString("targetedId", userId);
bundle.putBoolean("hideHeader",true);
bundle.putBoolean("showMediaOnly",showMediaOnly);
bundle.putString("hideHeaderValue",String.valueOf(instanceValue));
displayStatusFragment.setArguments(bundle);
return displayStatusFragment;
} }
return null; return null;
} }

View File

@ -161,7 +161,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
isRefreshed = false; isRefreshed = false;
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeContainer); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if( theme == Helper.THEME_LIGHT) { if( theme == Helper.THEME_LIGHT) {
swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,
@ -176,7 +176,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
@Override @Override
public void onRefresh() { public void onRefresh() {
isRefreshed = true; isRefreshed = true;
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
}); });
lv_status = (ListView) findViewById(R.id.lv_status); lv_status = (ListView) findViewById(R.id.lv_status);
@ -193,7 +193,7 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
@Override @Override
public void run() { public void run() {
isRefreshed = true; isRefreshed = true;
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false, false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
}, 1000); }, 1000);

View File

@ -39,6 +39,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
private String targetedID; private String targetedID;
private String tag; private String tag;
private boolean showMediaOnly = false; private boolean showMediaOnly = false;
private boolean showPinned = false;
private boolean refreshData; private boolean refreshData;
public enum Type{ public enum Type{
@ -50,8 +51,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
FAVOURITES, FAVOURITES,
ONESTATUS, ONESTATUS,
CONTEXT, CONTEXT,
TAG, TAG
PINS
} }
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){ public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
@ -62,7 +62,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
this.refreshData = true; this.refreshData = true;
} }
public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, OnRetrieveFeedsInterface onRetrieveFeedsInterface){ public RetrieveFeedsAsyncTask(Context context, Type action, String targetedID, String max_id, boolean showMediaOnly, boolean showPinned, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
this.context = context; this.context = context;
this.action = action; this.action = action;
this.max_id = max_id; this.max_id = max_id;
@ -70,6 +70,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
this.targetedID = targetedID; this.targetedID = targetedID;
this.showMediaOnly = showMediaOnly; this.showMediaOnly = showMediaOnly;
this.refreshData = true; this.refreshData = true;
this.showPinned = showPinned;
} }
public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){ public RetrieveFeedsAsyncTask(Context context, Type action, String tag, String targetedID, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
this.context = context; this.context = context;
@ -99,10 +100,12 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
apiResponse = api.getFavourites(max_id); apiResponse = api.getFavourites(max_id);
break; break;
case USER: case USER:
if( !showMediaOnly) if( showMediaOnly)
apiResponse = api.getStatus(targetedID, max_id);
else
apiResponse = api.getStatusWithMedia(targetedID, max_id); apiResponse = api.getStatusWithMedia(targetedID, max_id);
else if (showPinned)
apiResponse = api.getPinnedStatuses(targetedID, max_id);
else
apiResponse = api.getStatus(targetedID, max_id);
break; break;
case ONESTATUS: case ONESTATUS:
apiResponse = api.getStatusbyId(targetedID); apiResponse = api.getStatusbyId(targetedID);
@ -110,9 +113,6 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
case TAG: case TAG:
apiResponse = api.getPublicTimelineTag(tag, false, max_id); apiResponse = api.getPublicTimelineTag(tag, false, max_id);
break; break;
case PINS:
apiResponse = api.getPinnedStatuses(targetedID); // Might need max_id later?
break;
case HASHTAG: case HASHTAG:
break; break;
} }

View File

@ -68,7 +68,6 @@ public class API {
private Attachment attachment; private Attachment attachment;
private List<Account> accounts; private List<Account> accounts;
private List<Status> statuses; private List<Status> statuses;
private List<Status> pins;
private List<Notification> notifications; private List<Notification> notifications;
private int tootPerPage, accountPerPage, notificationPerPage; private int tootPerPage, accountPerPage, notificationPerPage;
private int actionCode; private int actionCode;
@ -277,7 +276,7 @@ public class API {
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getStatus(String accountId) { public APIResponse getStatus(String accountId) {
return getStatus(accountId, false, false, null, null, tootPerPage); return getStatus(accountId, false, false, false, null, null, tootPerPage);
} }
/** /**
@ -288,7 +287,7 @@ public class API {
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getStatus(String accountId, String max_id) { public APIResponse getStatus(String accountId, String max_id) {
return getStatus(accountId, false, false, max_id, null, tootPerPage); return getStatus(accountId, false, false, false, max_id, null, tootPerPage);
} }
/** /**
@ -299,43 +298,20 @@ public class API {
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getStatusWithMedia(String accountId, String max_id) { public APIResponse getStatusWithMedia(String accountId, String max_id) {
return getStatus(accountId, true, false, max_id, null, tootPerPage); return getStatus(accountId, true, false, false, max_id, null, tootPerPage);
} }
/** /**
* Retrieves pinned status(es) *synchronously* * Retrieves pinned status(es) *synchronously*
* *
* @param accountId String Id of the account * @param accountId String Id of the account
* @param max_id String id max
* @return APIResponse * @return APIResponse
*/ */
public APIResponse getPinnedStatuses(String accountId) public APIResponse getPinnedStatuses(String accountId, String max_id) {
{ return getStatus(accountId, false, true, false, max_id, null, tootPerPage);
pins = new ArrayList<>();
RequestParams params = new RequestParams();
params.put("pinned", Boolean.toString(true));
get(String.format("/accounts/%s/statuses", accountId), params, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Status status = parseStatuses(context, response);
pins.add(status);
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
pins = parseStatuses(response);
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
setError(statusCode, error);
}
});
apiResponse.setStatuses(pins);
return apiResponse;
} }
/** /**
* Retrieves status for the account *synchronously* * Retrieves status for the account *synchronously*
* *
@ -347,7 +323,7 @@ public class API {
* @param limit int limit - max value 40 * @param limit int limit - max value 40
* @return APIResponse * @return APIResponse
*/ */
private APIResponse getStatus(String accountId, boolean onlyMedia, private APIResponse getStatus(String accountId, boolean onlyMedia, boolean pinned,
boolean exclude_replies, String max_id, String since_id, int limit) { boolean exclude_replies, String max_id, String since_id, int limit) {
RequestParams params = new RequestParams(); RequestParams params = new RequestParams();
@ -361,6 +337,8 @@ public class API {
limit = 40; limit = 40;
if( onlyMedia) if( onlyMedia)
params.put("only_media", Boolean.toString(true)); params.put("only_media", Boolean.toString(true));
if( pinned)
params.put("pinned", Boolean.toString(true));
params.put("limit", String.valueOf(limit)); params.put("limit", String.valueOf(limit));
statuses = new ArrayList<>(); statuses = new ArrayList<>();
get(String.format("/accounts/%s/statuses", accountId), params, new JsonHttpResponseHandler() { get(String.format("/accounts/%s/statuses", accountId), params, new JsonHttpResponseHandler() {

View File

@ -232,10 +232,6 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
// Get the pins, as early as we can
new RetrieveFeedsAsyncTask(context, RetrieveFeedsAsyncTask.Type.PINS, userId, null, false,
StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
//Display a preview for accounts that have replied *if enabled and only for home timeline* //Display a preview for accounts that have replied *if enabled and only for home timeline*
if( type == RetrieveFeedsAsyncTask.Type.HOME ) { if( type == RetrieveFeedsAsyncTask.Type.HOME ) {
boolean showPreview = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES, false); boolean showPreview = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES, false);

View File

@ -71,7 +71,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
private ListView lv_status; private ListView lv_status;
private boolean isOnWifi; private boolean isOnWifi;
private int behaviorWithAttachments; private int behaviorWithAttachments;
private boolean showMediaOnly; private boolean showMediaOnly, showPinned;
private int positionSpinnerTrans; private int positionSpinnerTrans;
private boolean hideHeader; private boolean hideHeader;
private String instanceValue; private String instanceValue;
@ -90,6 +90,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
boolean comesFromSearch = false; boolean comesFromSearch = false;
hideHeader = false; hideHeader = false;
showMediaOnly = false; showMediaOnly = false;
showPinned = false;
if (bundle != null) { if (bundle != null) {
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type"); type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
targetedId = bundle.getString("targetedId", null); targetedId = bundle.getString("targetedId", null);
@ -97,6 +98,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
instanceValue = bundle.getString("hideHeaderValue", null); instanceValue = bundle.getString("hideHeaderValue", null);
hideHeader = bundle.getBoolean("hideHeader", false); hideHeader = bundle.getBoolean("hideHeader", false);
showMediaOnly = bundle.getBoolean("showMediaOnly",false); showMediaOnly = bundle.getBoolean("showMediaOnly",false);
showPinned = bundle.getBoolean("showPinned",false);
if( bundle.containsKey("statuses")){ if( bundle.containsKey("statuses")){
ArrayList<Parcelable> statusesReceived = bundle.getParcelableArrayList("statuses"); ArrayList<Parcelable> statusesReceived = bundle.getParcelableArrayList("statuses");
assert statusesReceived != null; assert statusesReceived != null;
@ -162,11 +164,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if(!flag_loading ) { if(!flag_loading ) {
flag_loading = true; flag_loading = true;
if( type == RetrieveFeedsAsyncTask.Type.USER) if( type == RetrieveFeedsAsyncTask.Type.USER)
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, showPinned, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else if( type == RetrieveFeedsAsyncTask.Type.TAG) else if( type == RetrieveFeedsAsyncTask.Type.TAG)
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else if ( type == RetrieveFeedsAsyncTask.Type.PINS)
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, false, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else else
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -189,11 +189,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
swiped = true; swiped = true;
MainActivity.countNewStatus = 0; MainActivity.countNewStatus = 0;
if( type == RetrieveFeedsAsyncTask.Type.USER) if( type == RetrieveFeedsAsyncTask.Type.USER)
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, showPinned, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else if( type == RetrieveFeedsAsyncTask.Type.TAG) else if( type == RetrieveFeedsAsyncTask.Type.TAG)
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else if ( type == RetrieveFeedsAsyncTask.Type.PINS)
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, false, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else else
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@ -203,11 +201,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
R.color.mastodonC3); R.color.mastodonC3);
if( type == RetrieveFeedsAsyncTask.Type.USER) if( type == RetrieveFeedsAsyncTask.Type.USER)
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, showMediaOnly, showPinned, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else if( type == RetrieveFeedsAsyncTask.Type.TAG) else if( type == RetrieveFeedsAsyncTask.Type.TAG)
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else if ( type == RetrieveFeedsAsyncTask.Type.PINS)
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, false, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else else
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}else { }else {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_show_pinned"
android:title="@string/pinned_toots"
android:icon="@drawable/ic_action_pin"
app:showAsAction="always" />
<item <item
android:id="@+id/action_show_media" android:id="@+id/action_show_media"
android:title="@string/media" android:title="@string/media"