Fix some errors
This commit is contained in:
parent
ecb5c0d50c
commit
ef47c46171
|
@ -2040,20 +2040,20 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
public void onResume(){
|
||||
super.onResume();
|
||||
PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("isMainActivityRunning", true).apply();
|
||||
updateNotifCounter();
|
||||
updateHomeCounter();
|
||||
// updateNotifCounter();
|
||||
// updateHomeCounter();
|
||||
|
||||
|
||||
//Proceeds to update of the authenticated account
|
||||
if(Helper.isLoggedIn(getApplicationContext())) {
|
||||
new UpdateAccountInfoByIDAsyncTask(getApplicationContext(), social, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
if( lastHomeId != null && homeFragment != null){
|
||||
/*if( lastHomeId != null && homeFragment != null){
|
||||
homeFragment.retrieveMissingToots(lastHomeId);
|
||||
}
|
||||
if( lastNotificationId != null && tabLayoutNotificationsFragment != null){
|
||||
tabLayoutNotificationsFragment.retrieveMissingNotifications(lastNotificationId);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
private String userId, instance;
|
||||
private SharedPreferences sharedpreferences;
|
||||
LinearLayoutManager mLayoutManager;
|
||||
private static BroadcastReceiver receive_action;
|
||||
private BroadcastReceiver receive_action;
|
||||
private static BroadcastReceiver receive_data;
|
||||
|
||||
public DisplayNotificationsFragment(){
|
||||
|
@ -145,7 +145,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}
|
||||
});
|
||||
|
||||
if( type == Type.ALL) {
|
||||
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
|
||||
if (receive_action != null)
|
||||
|
@ -163,25 +163,25 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}
|
||||
};
|
||||
LocalBroadcastManager.getInstance(context).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_ACTION));
|
||||
|
||||
if (receive_data != null)
|
||||
LocalBroadcastManager.getInstance(context).unregisterReceiver(receive_data);
|
||||
receive_data = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Bundle b = intent.getExtras();
|
||||
assert b != null;
|
||||
String userIdService = b.getString("userIdService", null);
|
||||
if (userIdService != null && userIdService.equals(userId)) {
|
||||
Notification notification = b.getParcelable("data");
|
||||
refresh(notification);
|
||||
if (context instanceof MainActivity)
|
||||
((MainActivity) context).updateNotifCounter();
|
||||
if( type == Type.ALL) {
|
||||
if (receive_data != null)
|
||||
LocalBroadcastManager.getInstance(context).unregisterReceiver(receive_data);
|
||||
receive_data = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Bundle b = intent.getExtras();
|
||||
assert b != null;
|
||||
String userIdService = b.getString("userIdService", null);
|
||||
if (userIdService != null && userIdService.equals(userId)) {
|
||||
Notification notification = b.getParcelable("data");
|
||||
refresh(notification);
|
||||
if (context instanceof MainActivity)
|
||||
((MainActivity) context).updateNotifCounter();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
LocalBroadcastManager.getInstance(context).registerReceiver(receive_data, new IntentFilter(Helper.RECEIVE_DATA));
|
||||
}
|
||||
};
|
||||
LocalBroadcastManager.getInstance(context).registerReceiver(receive_data, new IntentFilter(Helper.RECEIVE_DATA));
|
||||
}
|
||||
}
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
|
|
|
@ -624,8 +624,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
context.startService(streamingHomeIntent);
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
if( statuses != null && statuses.size() > 0)
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
retrieveMissingToots(statuses.get(0).getId());
|
||||
}
|
||||
}
|
||||
} else if( type == RetrieveFeedsAsyncTask.Type.PUBLIC){
|
||||
if( getUserVisibleHint() ){
|
||||
|
@ -704,8 +705,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
int batteryProfile = sharedpreferences.getInt(Helper.SET_BATTERY_PROFILE, Helper.BATTERY_PROFILE_NORMAL);
|
||||
//Store last toot id for home timeline to avoid to notify for those that have been already seen
|
||||
if (type == RetrieveFeedsAsyncTask.Type.HOME ) {
|
||||
|
||||
if (visible) {
|
||||
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SHOULD_CONTINUE_STREAMING_HOME + userId + instance, true);
|
||||
editor.apply();
|
||||
|
@ -715,8 +716,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
context.startService(streamingHomeIntent);
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
if( statuses != null && statuses.size() > 0)
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
retrieveMissingToots(statuses.get(0).getId());
|
||||
}
|
||||
}else {
|
||||
if( streamingHomeIntent != null ){
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
|
@ -915,6 +917,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
|
||||
@Override
|
||||
public void onRetrieveFeedsAfterBookmark(APIResponse apiResponse) {
|
||||
if( statusListAdapter == null)
|
||||
return;
|
||||
if( apiResponse == null || (apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404) ){
|
||||
if( apiResponse == null)
|
||||
Toasty.error(context, context.getString(R.string.toast_error),Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -79,7 +79,6 @@ import android.text.TextPaint;
|
|||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
|
Loading…
Reference in New Issue