[Settings] Avoid from redraw UI when first time onResume am: 17ad56b3fc
Change-Id: I541b8e9003918d006f5c815673d2832532cabbaa
This commit is contained in:
@@ -73,7 +73,7 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
|
|||||||
private String mClickedPrefKey;
|
private String mClickedPrefKey;
|
||||||
|
|
||||||
private ActiveSubsciptionsListener mActiveSubsciptionsListener;
|
private ActiveSubsciptionsListener mActiveSubsciptionsListener;
|
||||||
private boolean mActiveSubsciptionsListenerStarting;
|
private boolean mDropFirstSubscriptionChangeNotify;
|
||||||
private int mActiveSubsciptionsListenerCount;
|
private int mActiveSubsciptionsListenerCount;
|
||||||
|
|
||||||
public MobileNetworkSettings() {
|
public MobileNetworkSettings() {
|
||||||
@@ -207,20 +207,20 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (mActiveSubsciptionsListener == null) {
|
if (mActiveSubsciptionsListener == null) {
|
||||||
mActiveSubsciptionsListenerStarting = true;
|
|
||||||
mActiveSubsciptionsListener = new ActiveSubsciptionsListener(
|
mActiveSubsciptionsListener = new ActiveSubsciptionsListener(
|
||||||
getContext().getMainLooper(), getContext(), mSubId) {
|
getContext().getMainLooper(), getContext(), mSubId) {
|
||||||
public void onChanged() {
|
public void onChanged() {
|
||||||
onSubscriptionDetailChanged();
|
onSubscriptionDetailChanged();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mActiveSubsciptionsListenerStarting = false;
|
mDropFirstSubscriptionChangeNotify = true;
|
||||||
}
|
}
|
||||||
mActiveSubsciptionsListener.start();
|
mActiveSubsciptionsListener.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSubscriptionDetailChanged() {
|
private void onSubscriptionDetailChanged() {
|
||||||
if (mActiveSubsciptionsListenerStarting) {
|
if (mDropFirstSubscriptionChangeNotify) {
|
||||||
|
mDropFirstSubscriptionChangeNotify = false;
|
||||||
Log.d(LOG_TAG, "Callback during onResume()");
|
Log.d(LOG_TAG, "Callback during onResume()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -235,6 +235,14 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
if (mActiveSubsciptionsListener != null) {
|
||||||
|
mActiveSubsciptionsListener.stop();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void onRestoreInstance(Bundle icicle) {
|
void onRestoreInstance(Bundle icicle) {
|
||||||
if (icicle != null) {
|
if (icicle != null) {
|
||||||
|
Reference in New Issue
Block a user