summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/dialpad/DialpadFragment.java
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-05-20 16:40:17 -0700
committerChristine Chen <christinech@google.com>2013-06-07 14:19:37 -0700
commitff43216e62d2ab2b6773466a06420081dc8900e5 (patch)
tree60efa5c9a2ed247594a9234e1bd5156b77e28022 /src/com/android/dialer/dialpad/DialpadFragment.java
parentf78d3444bd50cf3c4ddccff67b1d04422fa65f6d (diff)
Preserves changes in phone number on dialer.
Added check on whether the intent is new to decide when to fill in the number in dialer automatically. If the intent is not new, the dialer will be filled with previously used number, preserving any edits on that number. Bug: 8484457 Change-Id: I45f02d395ce402670b380485b5ba1e7190600ec3
Diffstat (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java')
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index fdcd14073..4034d9cbe 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -401,6 +401,12 @@ public class DialpadFragment extends Fragment
* @return true when {@link #mDigits} is actually filled by the Intent.
*/
private boolean fillDigitsIfNecessary(Intent intent) {
+ // Only fills digits from an intent if it is a new intent.
+ // Otherwise falls back to the previously used number.
+ if (!mFirstLaunch && !mStartedFromNewIntent) {
+ return false;
+ }
+
final String action = intent.getAction();
if (Intent.ACTION_DIAL.equals(action) || Intent.ACTION_VIEW.equals(action)) {
Uri uri = intent.getData();
@@ -439,7 +445,6 @@ public class DialpadFragment extends Fragment
}
}
}
-
return false;
}
@@ -463,7 +468,17 @@ public class DialpadFragment extends Fragment
* Checks the given Intent and changes dialpad's UI state. For example, if the Intent requires
* the screen to enter "Add Call" mode, this method will show correct UI for the mode.
*/
- private void configureScreenFromIntent(Intent intent) {
+ private void configureScreenFromIntent(Activity parent) {
+ // If we were not invoked with a DIAL intent,
+ if (!(parent instanceof DialtactsActivity)) {
+ setStartedFromNewIntent(false);
+ return;
+ }
+
+ // See if we were invoked with a DIAL intent. If we were, fill in the appropriate
+ // digits in the dialer field.
+ Intent intent = parent.getIntent();
+
if (!isLayoutReady()) {
// This happens typically when parent's Activity#onNewIntent() is called while
// Fragment#onCreateView() isn't called yet, and thus we cannot configure Views at
@@ -499,8 +514,8 @@ public class DialpadFragment extends Fragment
}
}
-
showDialpadChooser(needToShowDialpadChooser);
+ setStartedFromNewIntent(false);
}
public void setStartedFromNewIntent(boolean value) {
@@ -540,13 +555,6 @@ public class DialpadFragment extends Fragment
}
@Override
- public void onStart() {
- super.onStart();
- configureScreenFromIntent(getActivity().getIntent());
- setStartedFromNewIntent(false);
- }
-
- @Override
public void onResume() {
super.onResume();
@@ -595,12 +603,7 @@ public class DialpadFragment extends Fragment
// the dialpad edittext to prevent entries from being loaded from a null cache.
initializeSmartDialingState();
- Activity parent = getActivity();
- if (parent instanceof DialtactsActivity) {
- // See if we were invoked with a DIAL intent. If we were, fill in the appropriate
- // digits in the dialer field.
- fillDigitsIfNecessary(parent.getIntent());
- }
+ configureScreenFromIntent(getActivity());
stopWatch.lap("fdin");