Some fixes
This commit is contained in:
parent
27e78391d1
commit
a36b57feb7
|
@ -126,7 +126,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
|
|||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
int positionSpinnerTrans = (sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX));
|
||||
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
setTitle(String.format("#%s", tag));
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -116,10 +117,8 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
|
|||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
boolean isOnWifi = Helper.isOnWIFI(ListActivity.this);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
|
||||
statusListAdapter = new StatusListAdapter(ListActivity.this, RetrieveFeedsAsyncTask.Type.LIST, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(ListActivity.this, RetrieveFeedsAsyncTask.Type.LIST, null, isOnWifi, this.statuses);
|
||||
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
mLayoutManager = new LinearLayoutManager(ListActivity.this);
|
||||
|
@ -139,7 +138,7 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
|
|||
|
||||
|
||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)
|
||||
{
|
||||
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||
if(dy > 0){
|
||||
|
|
|
@ -164,11 +164,9 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
firstLoad = true;
|
||||
swiped = false;
|
||||
boolean isOnWifi = Helper.isOnWIFI(OwnerStatusActivity.this);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
lv_status.addItemDecoration(new DividerItemDecoration(OwnerStatusActivity.this, DividerItemDecoration.VERTICAL));
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
statusListAdapter = new StatusListAdapter(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
mLayoutManager = new LinearLayoutManager(OwnerStatusActivity.this);
|
||||
lv_status.setLayoutManager(mLayoutManager);
|
||||
|
|
|
@ -398,10 +398,8 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
|||
}else {
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean isOnWifi = Helper.isOnWIFI(PeertubeActivity.this);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, statuses);
|
||||
RecyclerView lv_comments = findViewById(R.id.peertube_comments);
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||
lv_comments.setLayoutManager(mLayoutManager);
|
||||
|
|
|
@ -199,10 +199,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
|
||||
statuses = new ArrayList<>();
|
||||
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, this.statuses);
|
||||
|
||||
showMediaOnly = false;
|
||||
showPinned = false;
|
||||
|
|
|
@ -198,13 +198,11 @@ public class ShowConversationActivity extends BaseActivity implements OnRetriev
|
|||
|
||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
if( initialStatus != null)
|
||||
statuses.add(initialStatus);
|
||||
else
|
||||
statuses.add(detailsStatus);
|
||||
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, 0, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
|
||||
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, 0, null, isOnWifi, statuses);
|
||||
|
||||
final LinearLayoutManager mLayoutManager;
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
|
|
|
@ -118,7 +118,6 @@ import fr.gouv.etalab.mastodon.client.Entities.Results;
|
|||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.StoredStatus;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Version;
|
||||
import fr.gouv.etalab.mastodon.client.Glide.GlideApp;
|
||||
import fr.gouv.etalab.mastodon.client.HttpsConnection;
|
||||
import fr.gouv.etalab.mastodon.drawers.AccountsReplyAdapter;
|
||||
import fr.gouv.etalab.mastodon.drawers.AccountsSearchAdapter;
|
||||
|
@ -1477,7 +1476,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
|
|||
final EditText input = popup_media_description.findViewById(R.id.media_description);
|
||||
input.setFilters(new InputFilter[]{new InputFilter.LengthFilter(420)});
|
||||
final ImageView media_picture = popup_media_description.findViewById(R.id.media_picture);
|
||||
GlideApp.with(getApplicationContext())
|
||||
Glide.with(getApplicationContext())
|
||||
.asBitmap()
|
||||
.load(attachment.getUrl())
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
|
|
|
@ -140,61 +140,53 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
private List<Status> statuses;
|
||||
private LayoutInflater layoutInflater;
|
||||
private boolean isOnWifi;
|
||||
private int translator;
|
||||
private int behaviorWithAttachments;
|
||||
private StatusListAdapter statusListAdapter;
|
||||
private RetrieveFeedsAsyncTask.Type type;
|
||||
private String targetedId;
|
||||
private final int HIDDEN_STATUS = 0;
|
||||
public static final int DISPLAYED_STATUS = 1;
|
||||
public static final int FOCUSED_STATUS = 2;
|
||||
public static final int COMPACT_STATUS = 3;
|
||||
private static final int DISPLAYED_STATUS = 1;
|
||||
static final int FOCUSED_STATUS = 2;
|
||||
private static final int COMPACT_STATUS = 3;
|
||||
private int conversationPosition;
|
||||
private List<String> timedMute;
|
||||
private boolean redraft;
|
||||
private Status toot;
|
||||
private TagTimeline tagTimeline;
|
||||
|
||||
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
||||
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
super();
|
||||
this.context = context;
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
this.behaviorWithAttachments = behaviorWithAttachments;
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
statusListAdapter = this;
|
||||
this.type = type;
|
||||
this.targetedId = targetedId;
|
||||
this.translator = translator;
|
||||
redraft = false;
|
||||
}
|
||||
|
||||
public StatusListAdapter(Context context, TagTimeline tagTimeline, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
||||
public StatusListAdapter(Context context, TagTimeline tagTimeline, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
super();
|
||||
this.context = context;
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
this.behaviorWithAttachments = behaviorWithAttachments;
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
statusListAdapter = this;
|
||||
this.type = RetrieveFeedsAsyncTask.Type.TAG;
|
||||
this.targetedId = targetedId;
|
||||
this.translator = translator;
|
||||
redraft = false;
|
||||
this.tagTimeline = tagTimeline;
|
||||
}
|
||||
|
||||
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
||||
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
this.context = context;
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
this.behaviorWithAttachments = behaviorWithAttachments;
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
statusListAdapter = this;
|
||||
this.type = RetrieveFeedsAsyncTask.Type.CONTEXT;
|
||||
this.conversationPosition = position;
|
||||
this.targetedId = targetedId;
|
||||
this.translator = translator;
|
||||
redraft = false;
|
||||
}
|
||||
|
||||
|
@ -542,7 +534,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
|
||||
boolean confirmFav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
||||
boolean confirmBoost = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
|
||||
|
||||
int translator = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && !isCompactMode && displayBookmarkButton)
|
||||
holder.status_bookmark.setVisibility(View.VISIBLE);
|
||||
else
|
||||
|
|
|
@ -102,12 +102,10 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
|
|||
}catch (Exception ignored){}
|
||||
final boolean isOnWifi = Helper.isOnWIFI(context);
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
final int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
final int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
statuses = apiResponse.getStatuses();
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
|
||||
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
lv_status.setLayoutManager(mLayoutManager);
|
||||
}else {
|
||||
|
@ -138,7 +136,7 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
|
|||
new StatusCacheDAO(context, db).removeAllStatus(StatusCacheDAO.STATUS_CACHE);
|
||||
statuses = new ArrayList<>();
|
||||
statuses.clear();
|
||||
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
|
||||
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -146,9 +146,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
assert context != null;
|
||||
sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean isOnWifi = Helper.isOnWIFI(context);
|
||||
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
|
||||
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
lv_status = rootView.findViewById(R.id.lv_status);
|
||||
mainLoader = rootView.findViewById(R.id.loader);
|
||||
nextElementLoader = rootView.findViewById(R.id.loading_next_status);
|
||||
|
@ -165,12 +163,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
List<TagTimeline> tagTimelines = new SearchDAO(context, db).getTimelineInfo(tag);
|
||||
if( tagTimelines != null && tagTimelines.size() > 0) {
|
||||
tagTimeline = tagTimelines.get(0);
|
||||
statusListAdapter = new StatusListAdapter(context, tagTimeline, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(context, tagTimeline, targetedId, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
}
|
||||
}else if( search_peertube == null && (instanceType == null || instanceType.equals("MASTODON"))) {
|
||||
BaseMainActivity.displayPeertube = null;
|
||||
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
}else {
|
||||
BaseMainActivity.displayPeertube = remoteInstance;
|
||||
|
|
|
@ -341,6 +341,7 @@ public class Helper {
|
|||
public static final String SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE = "set_automatically_split_toots_size";
|
||||
public static final String SET_TRUNCATE_TOOTS_SIZE = "set_truncate_toots_size";
|
||||
public static final String SET_ART_WITH_NSFW = "set_art_with_nsfw";
|
||||
|
||||
//End points
|
||||
public static final String EP_AUTHORIZE = "/oauth/authorize";
|
||||
|
||||
|
@ -1050,15 +1051,7 @@ public class Helper {
|
|||
*/
|
||||
public static String getLiveInstance(Context context){
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
if( userId == null) //User not authenticated
|
||||
return null;
|
||||
Account account = new AccountDAO(context, db).getAccountByID(userId);
|
||||
if( account != null){
|
||||
return account.getInstance().trim();
|
||||
} //User not in db
|
||||
return null;
|
||||
return sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||
}
|
||||
|
||||
public static String getLiveInstanceWithProtocol(Context context) {
|
||||
|
|
Loading…
Reference in New Issue