Fixes an issue with bookmark

This commit is contained in:
stom79 2018-01-10 14:39:01 +01:00
parent e69e2cde1f
commit 521476eac6
2 changed files with 4 additions and 4 deletions

View File

@ -1628,6 +1628,8 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
toot_content.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if( position >= tags.size() )
return;
String tag = tags.get(position);
String deltaSearch = "";
if( currentCursorPosition-searchLength > 0 && currentCursorPosition < oldContent.length() )

View File

@ -78,7 +78,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
private Intent streamingFederatedIntent, streamingLocalIntent;
LinearLayoutManager mLayoutManager;
boolean firstTootsLoaded;
private String lastReadStatus;
private String userId, instance;
private SharedPreferences sharedpreferences;
@ -134,7 +133,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
mLayoutManager = new LinearLayoutManager(context);
lv_status.setLayoutManager(mLayoutManager);
lastReadStatus = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId + instance, null);
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, context!=null?Helper.getLiveInstance(context):null);
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
@ -160,7 +159,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
nextElementLoader.setVisibility(View.GONE);
}
}
if(statuses != null && statuses.size() > firstVisibleItem )
if(type == RetrieveFeedsAsyncTask.Type.HOME && statuses != null && statuses.size() > firstVisibleItem )
if( context instanceof BaseMainActivity){
SharedPreferences.Editor editor = sharedpreferences.edit();
Long bookmarkL = Long.parseLong(statuses.get(firstVisibleItem).getId()) + 1;
@ -588,7 +587,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
String lastNotif = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId + instance, null);
if( lastNotif == null || Long.parseLong(statusId) > Long.parseLong(lastNotif)){
this.lastReadStatus = statusId;
MainActivity.countNewStatus = 0;
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId + instance, statusId);