Fixes last issues
This commit is contained in:
parent
f89692411c
commit
69b6ec73f0
|
@ -809,7 +809,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {refreshData();}
|
public void run() {refreshData();}
|
||||||
}, 500);
|
}, 1000);
|
||||||
}
|
}
|
||||||
//Proceeds to update of the authenticated account
|
//Proceeds to update of the authenticated account
|
||||||
if(Helper.isLoggedIn(getApplicationContext()))
|
if(Helper.isLoggedIn(getApplicationContext()))
|
||||||
|
@ -1011,9 +1011,9 @@ public class MainActivity extends AppCompatActivity
|
||||||
if( account != null){
|
if( account != null){
|
||||||
String last_refresh = sharedpreferences.getString(Helper.LAST_BUBBLE_REFRESH_NOTIF + account.getId(), null);
|
String last_refresh = sharedpreferences.getString(Helper.LAST_BUBBLE_REFRESH_NOTIF + account.getId(), null);
|
||||||
Date last_refresh_date = Helper.stringToDate(getApplicationContext(), last_refresh);
|
Date last_refresh_date = Helper.stringToDate(getApplicationContext(), last_refresh);
|
||||||
if (last_refresh_date == null || (new Date().getTime() - last_refresh_date.getTime()) >= TimeUnit.SECONDS.toMillis(60)) {
|
if (last_refresh_date == null || (new Date().getTime() - last_refresh_date.getTime()) >= TimeUnit.SECONDS.toMillis(5)) {
|
||||||
|
|
||||||
if( notificationsFragment != null && notificationsFragment.isAdded()){
|
if( notificationsFragment != null ){
|
||||||
notificationsFragment.update();
|
notificationsFragment.update();
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_BUBBLE_REFRESH_NOTIF+ account.getId(),Helper.dateToString(getApplicationContext(), new Date()));
|
editor.putString(Helper.LAST_BUBBLE_REFRESH_NOTIF+ account.getId(),Helper.dateToString(getApplicationContext(), new Date()));
|
||||||
|
@ -1023,9 +1023,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
last_refresh = sharedpreferences.getString(Helper.LAST_BUBBLE_REFRESH_HOME + account.getId(), null);
|
last_refresh = sharedpreferences.getString(Helper.LAST_BUBBLE_REFRESH_HOME + account.getId(), null);
|
||||||
last_refresh_date = Helper.stringToDate(getApplicationContext(), last_refresh);
|
last_refresh_date = Helper.stringToDate(getApplicationContext(), last_refresh);
|
||||||
if (last_refresh_date == null || (new Date().getTime() - last_refresh_date.getTime()) >= TimeUnit.SECONDS.toMillis(60)) {
|
if (last_refresh_date == null || (new Date().getTime() - last_refresh_date.getTime()) >= TimeUnit.SECONDS.toMillis(5)) {
|
||||||
|
if( homeFragment != null ){
|
||||||
if( homeFragment != null && homeFragment.isAdded()){
|
|
||||||
homeFragment.update();
|
homeFragment.update();
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_BUBBLE_REFRESH_HOME+ account.getId(),Helper.dateToString(getApplicationContext(), new Date()));
|
editor.putString(Helper.LAST_BUBBLE_REFRESH_HOME+ account.getId(),Helper.dateToString(getApplicationContext(), new Date()));
|
||||||
|
|
|
@ -239,11 +239,8 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
}
|
}
|
||||||
new_data.setVisibility(View.VISIBLE);
|
new_data.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void manageNotifications(List<Notification> notifications, String max_id){
|
private void manageNotifications(List<Notification> notifications, String max_id){
|
||||||
|
@ -275,7 +272,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
Account currentAccount = new AccountDAO(context, db).getAccountByID(userId);
|
Account currentAccount = new AccountDAO(context, db).getAccountByID(userId);
|
||||||
if( currentAccount != null && firstLoad){
|
if( currentAccount != null && firstLoad){
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + currentAccount.getId(), notifications.get(0).getId());
|
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + currentAccount.getId(), max_id);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
Account currentAccount = new AccountDAO(context, db).getAccountByID(userId);
|
Account currentAccount = new AccountDAO(context, db).getAccountByID(userId);
|
||||||
if( currentAccount != null && firstLoad){
|
if( currentAccount != null && firstLoad){
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + currentAccount.getId(), statuses.get(0).getId());
|
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + currentAccount.getId(), max_id);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import android.provider.DocumentsContract;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.widget.SwitchCompat;
|
import android.support.v7.widget.SwitchCompat;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
|
@ -154,11 +154,10 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
||||||
intent.putExtra(PREF_KEY_ID, userId);
|
intent.putExtra(PREF_KEY_ID, userId);
|
||||||
long notif_id = Long.parseLong(userId);
|
long notif_id = Long.parseLong(userId);
|
||||||
final int notificationId = ((notif_id + 2) > 2147483647) ? (int) (2147483647 - notif_id - 2) : (int) (notif_id + 2);
|
final int notificationId = ((notif_id + 2) > 2147483647) ? (int) (2147483647 - notif_id - 2) : (int) (notif_id + 2);
|
||||||
if( apiResponse.getMax_id() != null) {
|
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, apiResponse.getMax_id());
|
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, apiResponse.getMax_id());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
|
||||||
|
|
||||||
if( notificationUrl != null){
|
if( notificationUrl != null){
|
||||||
ImageLoader imageLoaderNoty = ImageLoader.getInstance();
|
ImageLoader imageLoaderNoty = ImageLoader.getInstance();
|
||||||
|
|
|
@ -257,11 +257,9 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(apiResponse.getMax_id() != null) {
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, apiResponse.getMax_id());
|
||||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, apiResponse.getMax_id());
|
editor.apply();
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue