Last changes

This commit is contained in:
tom79 2017-08-28 19:12:40 +02:00
parent 3a366526b0
commit e3b031940d
3 changed files with 41 additions and 0 deletions

View File

@ -255,4 +255,21 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
}
new_data.setVisibility(View.VISIBLE);
}
public void refresh(){
if( notificationsTmp != null){
boolean isOnWifi = Helper.isOnWIFI(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
notifications = new ArrayList<>();
for(Notification notification: notificationsTmp){
notifications.add(notification);
}
notificationsListAdapter = new NotificationsListAdapter(context,isOnWifi, behaviorWithAttachments, notifications);
lv_notifications.setAdapter(notificationsListAdapter);
if( notificationsTmp.size() > 0 && textviewNoAction.getVisibility() == View.VISIBLE)
textviewNoAction.setVisibility(View.GONE);
}
new_data.setVisibility(View.GONE);
notificationsTmp = new ArrayList<>();
}
}

View File

@ -359,6 +359,24 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
new_data.setVisibility(View.VISIBLE);
}
public void refresh(){
if( statusesTmp != null){
boolean isOnWifi = Helper.isOnWIFI(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
statuses = new ArrayList<>();
for(Status status: statusesTmp){
statuses.add(status);
}
if( statusesTmp.size() > 0 && textviewNoAction.getVisibility() == View.VISIBLE)
textviewNoAction.setVisibility(View.GONE);
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
lv_status.setAdapter(statusListAdapter);
statusesTmp = new ArrayList<>();
}
new_data.setVisibility(View.GONE);
}
public void scrollToTop(){
if( lv_status != null)
lv_status.setAdapter(statusListAdapter);

View File

@ -156,6 +156,7 @@ public class MainActivity extends AppCompatActivity
}else{
newNotif++;
updateNotifCounter();
notificationsFragment.updateData(notification);
}
}else if(eventStreaming == StreamingUserAsyncTask.EventStreaming.UPDATE){
Status status = b.getParcelable("data");
@ -164,6 +165,7 @@ public class MainActivity extends AppCompatActivity
}else{
newHome++;
updateHomeCounter();
homeFragment.updateData(status);
}
}else if(eventStreaming == StreamingUserAsyncTask.EventStreaming.DELETE){
String id = b.getString("id");
@ -278,12 +280,16 @@ public class MainActivity extends AppCompatActivity
item = navigationView.getMenu().findItem(R.id.nav_home);
fragmentTag = "HOME_TIMELINE";
newHome = 0;
if( homeFragment != null)
homeFragment.refresh();
updateHomeCounter();
break;
case 1:
fragmentTag = "NOTIFICATIONS";
item = navigationView.getMenu().findItem(R.id.nav_notification);
newNotif = 0;
if( notificationsFragment != null)
notificationsFragment.refresh();
updateNotifCounter();
break;
case 2: