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