summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/dialpad/DialpadFragment.java
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-01-30 14:42:53 -0800
committerYorke Lee <yorkelee@google.com>2015-02-02 16:26:19 -0800
commitd5c512afca0341039e494e4df976b18ff07d146a (patch)
tree72b2ac43eb8c215361c08a81939cbed5c4b3a87f /src/com/android/dialer/dialpad/DialpadFragment.java
parentf5554ceb3c152949b4b6278b7f5e1522148a574c (diff)
Add DialpadFragment on-demand instead at on startup
Add the DialpadFragment dynamically instead of everything at startup. Once added, it is then shown/hidden instead of removed for performance reasons. Reduces startup time on a N5 from 603ms to 440ms. Bug: 18431193 Change-Id: I0482bd8277896ed8a6956fc03b6afaf44b442eb3
Diffstat (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java')
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 71b9ae822..87501fbcb 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -45,13 +45,10 @@ import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.PhoneNumberUtils;
-import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.text.Editable;
-import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
-import android.text.style.RelativeSizeSpan;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
@@ -318,7 +315,9 @@ public class DialpadFragment extends Fragment
public void onCreate(Bundle state) {
Trace.beginSection(TAG + " onCreate");
super.onCreate(state);
- mFirstLaunch = true;
+
+ mFirstLaunch = state == null;
+
mCurrentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
try {
@@ -358,7 +357,6 @@ public class DialpadFragment extends Fragment
Trace.endSection();
Trace.beginSection(TAG + " setup views");
- Resources r = getResources();
mDialpadView = (DialpadView) fragmentView.findViewById(R.id.dialpad_view);
mDialpadView.setCanDigitsBeEdited(true);
@@ -654,8 +652,6 @@ public class DialpadFragment extends Fragment
showDialpadChooser(false);
}
- mFirstLaunch = false;
-
stopWatch.lap("hnt");
updateDeleteButtonEnabledState();
@@ -674,6 +670,14 @@ public class DialpadFragment extends Fragment
mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener());
mOverflowMenuButton.setOnClickListener(this);
mOverflowMenuButton.setVisibility(isDigitsEmpty() ? View.INVISIBLE : View.VISIBLE);
+
+ if (mFirstLaunch) {
+ // The onHiddenChanged callback does not get called the first time the fragment is
+ // attached, so call it ourselves here.
+ onHiddenChanged(false);
+ }
+
+ mFirstLaunch = false;
Trace.endSection();
}