Fixes pull to refresh bug
This commit is contained in:
parent
53d7b8f2e3
commit
5ce1e09957
|
@ -60,6 +60,8 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
private int accountPerPage;
|
||||
private String targetedId;
|
||||
private boolean swiped;
|
||||
private ListView lv_accounts;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -92,7 +94,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
accountPerPage = sharedpreferences.getInt(Helper.SET_ACCOUNTS_PER_PAGE, 40);
|
||||
final ListView lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
|
||||
lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
|
||||
|
||||
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
|
||||
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_accounts);
|
||||
|
@ -246,6 +248,11 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( swiped ){
|
||||
accountsListAdapter = new AccountsListAdapter(context, type, this.accounts);
|
||||
lv_accounts.setAdapter(accountsListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
if( accounts != null) {
|
||||
for(Account tmpAccount: accounts){
|
||||
this.accounts.add(tmpAccount);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
|||
private int accountPerPage;
|
||||
private TextView no_action_text;
|
||||
private boolean swiped;
|
||||
|
||||
private ListView lv_accounts;
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
|||
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
accountPerPage = sharedpreferences.getInt(Helper.SET_ACCOUNTS_PER_PAGE, 40);
|
||||
final ListView lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
|
||||
lv_accounts = (ListView) rootView.findViewById(R.id.lv_accounts);
|
||||
no_action_text = (TextView) rootView.findViewById(R.id.no_action_text);
|
||||
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
|
||||
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_accounts);
|
||||
|
@ -167,6 +167,11 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
|||
}else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( swiped ){
|
||||
accountsFollowRequestAdapter = new AccountsFollowRequestAdapter(context, this.accounts);
|
||||
lv_accounts.setAdapter(accountsFollowRequestAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
if( accounts != null) {
|
||||
for(Account tmpAccount: accounts){
|
||||
this.accounts.add(tmpAccount);
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.List;
|
|||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.drawers.NotificationsListAdapter;
|
||||
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||
|
@ -62,6 +63,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
private int notificationPerPage;
|
||||
private boolean swiped;
|
||||
private ListView lv_notifications;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -77,7 +79,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
notificationPerPage = sharedpreferences.getInt(Helper.SET_NOTIFICATIONS_PER_PAGE, 40);
|
||||
ListView lv_notifications = (ListView) rootView.findViewById(R.id.lv_notifications);
|
||||
lv_notifications = (ListView) rootView.findViewById(R.id.lv_notifications);
|
||||
|
||||
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
|
||||
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_notifications);
|
||||
|
@ -166,6 +168,11 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
if( swiped ){
|
||||
notificationsListAdapter = new NotificationsListAdapter(context, this.notifications);
|
||||
lv_notifications.setAdapter(notificationsListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
max_id = apiResponse.getMax_id();
|
||||
|
||||
if( notifications != null) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.os.Parcelable;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -65,6 +66,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
private String tag;
|
||||
private int tootsPerPage;
|
||||
private boolean swiped;
|
||||
private ListView lv_status;
|
||||
private boolean isOnWifi;
|
||||
private int behaviorWithAttachments;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -94,12 +98,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
firstLoad = true;
|
||||
swiped = false;
|
||||
|
||||
boolean isOnWifi = Helper.isOnWIFI(context);
|
||||
isOnWifi = Helper.isOnWIFI(context);
|
||||
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
|
||||
|
||||
final ListView lv_status = (ListView) rootView.findViewById(R.id.lv_status);
|
||||
lv_status = (ListView) rootView.findViewById(R.id.lv_status);
|
||||
tootsPerPage = sharedpreferences.getInt(Helper.SET_TOOTS_PER_PAGE, 40);
|
||||
mainLoader = (RelativeLayout) rootView.findViewById(R.id.loader);
|
||||
nextElementLoader = (RelativeLayout) rootView.findViewById(R.id.loading_next_status);
|
||||
|
@ -264,6 +268,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
if( swiped ){
|
||||
statusListAdapter = new StatusListAdapter(context, type, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( statuses != null) {
|
||||
for(Status tmpStatus: statuses){
|
||||
|
|
Loading…
Reference in New Issue