summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/dialpadview
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2017-12-27 17:02:37 -0800
committerCopybara-Service <copybara-piper@google.com>2017-12-27 17:03:47 -0800
commit183cb71663320f16149d83eeebaff7795a4b55f2 (patch)
treebc8bfcce809257b3ddbb423a9808082292b9f6a3 /java/com/android/dialer/dialpadview
parentfc81a030a7b4f6d4a497f71aed593d398795e7da (diff)
Remove field prefixes.
Test: Existing tests PiperOrigin-RevId: 180230450 Change-Id: I0b2589cfeeaef81e42a04efa48af24b4e4d0e95f
Diffstat (limited to 'java/com/android/dialer/dialpadview')
-rw-r--r--java/com/android/dialer/dialpadview/DialpadFragment.java405
-rw-r--r--java/com/android/dialer/dialpadview/DialpadKeyButton.java80
-rw-r--r--java/com/android/dialer/dialpadview/DialpadTextView.java14
-rw-r--r--java/com/android/dialer/dialpadview/DialpadView.java120
-rw-r--r--java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java40
-rw-r--r--java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java58
6 files changed, 358 insertions, 359 deletions
diff --git a/java/com/android/dialer/dialpadview/DialpadFragment.java b/java/com/android/dialer/dialpadview/DialpadFragment.java
index 4673d9eca..0418009d7 100644
--- a/java/com/android/dialer/dialpadview/DialpadFragment.java
+++ b/java/com/android/dialer/dialpadview/DialpadFragment.java
@@ -137,45 +137,45 @@ public class DialpadFragment extends Fragment
private static Optional<String> currentCountryIsoForTesting = Optional.absent();
- private final Object mToneGeneratorLock = new Object();
+ private final Object toneGeneratorLock = new Object();
/** Set of dialpad keys that are currently being pressed */
- private final HashSet<View> mPressedDialpadKeys = new HashSet<>(12);
+ private final HashSet<View> pressedDialpadKeys = new HashSet<>(12);
- private OnDialpadQueryChangedListener mDialpadQueryListener;
- private DialpadView mDialpadView;
- private EditText mDigits;
- private int mDialpadSlideInDuration;
+ private OnDialpadQueryChangedListener dialpadQueryListener;
+ private DialpadView dialpadView;
+ private EditText digits;
+ private int dialpadSlideInDuration;
/** Remembers if we need to clear digits field when the screen is completely gone. */
- private boolean mClearDigitsOnStop;
-
- private View mOverflowMenuButton;
- private PopupMenu mOverflowPopupMenu;
- private View mDelete;
- private ToneGenerator mToneGenerator;
- private FloatingActionButtonController mFloatingActionButtonController;
- private FloatingActionButton mFloatingActionButton;
- private ListView mDialpadChooser;
- private DialpadChooserAdapter mDialpadChooserAdapter;
+ private boolean clearDigitsOnStop;
+
+ private View overflowMenuButton;
+ private PopupMenu overflowPopupMenu;
+ private View delete;
+ private ToneGenerator toneGenerator;
+ private FloatingActionButtonController floatingActionButtonController;
+ private FloatingActionButton floatingActionButton;
+ private ListView dialpadChooser;
+ private DialpadChooserAdapter dialpadChooserAdapter;
/** Regular expression prohibiting manual phone call. Can be empty, which means "no rule". */
- private String mProhibitedPhoneNumberRegexp;
+ private String prohibitedPhoneNumberRegexp;
- private PseudoEmergencyAnimator mPseudoEmergencyAnimator;
- private String mLastNumberDialed = EMPTY_NUMBER;
+ private PseudoEmergencyAnimator pseudoEmergencyAnimator;
+ private String lastNumberDialed = EMPTY_NUMBER;
// determines if we want to playback local DTMF tones.
- private boolean mDTMFToneEnabled;
- private CallStateReceiver mCallStateReceiver;
- private boolean mWasEmptyBeforeTextChange;
+ private boolean dTMFToneEnabled;
+ private CallStateReceiver callStateReceiver;
+ private boolean wasEmptyBeforeTextChange;
/**
* This field is set to true while processing an incoming DIAL intent, in order to make sure that
* SpecialCharSequenceMgr actions can be triggered by user input but *not* by a tel: URI passed by
* some other app. It will be set to false when all digits are cleared.
*/
- private boolean mDigitsFilledByIntent;
+ private boolean digitsFilledByIntent;
- private boolean mStartedFromNewIntent = false;
- private boolean mFirstLaunch = false;
- private boolean mAnimate = false;
+ private boolean startedFromNewIntent = false;
+ private boolean firstLaunch = false;
+ private boolean animate = false;
private DialerExecutor<String> initPhoneNumberFormattingTextWatcherExecutor;
@@ -283,16 +283,16 @@ public class DialpadFragment extends Fragment
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- mWasEmptyBeforeTextChange = TextUtils.isEmpty(s);
+ wasEmptyBeforeTextChange = TextUtils.isEmpty(s);
}
@Override
public void onTextChanged(CharSequence input, int start, int before, int changeCount) {
- if (mWasEmptyBeforeTextChange != TextUtils.isEmpty(input)) {
+ if (wasEmptyBeforeTextChange != TextUtils.isEmpty(input)) {
final Activity activity = getActivity();
if (activity != null) {
activity.invalidateOptionsMenu();
- updateMenuOverflowButton(mWasEmptyBeforeTextChange);
+ updateMenuOverflowButton(wasEmptyBeforeTextChange);
}
}
@@ -305,19 +305,19 @@ public class DialpadFragment extends Fragment
// When DTMF dialpad buttons are being pressed, we delay SpecialCharSequenceMgr sequence,
// since some of SpecialCharSequenceMgr's behavior is too abrupt for the "touch-down"
// behavior.
- if (!mDigitsFilledByIntent
- && SpecialCharSequenceMgr.handleChars(getActivity(), input.toString(), mDigits)) {
+ if (!digitsFilledByIntent
+ && SpecialCharSequenceMgr.handleChars(getActivity(), input.toString(), digits)) {
// A special sequence was entered, clear the digits
- mDigits.getText().clear();
+ digits.getText().clear();
}
if (isDigitsEmpty()) {
- mDigitsFilledByIntent = false;
- mDigits.setCursorVisible(false);
+ digitsFilledByIntent = false;
+ digits.setCursorVisible(false);
}
- if (mDialpadQueryListener != null) {
- mDialpadQueryListener.onDialpadQueryChanged(mDigits.getText().toString());
+ if (dialpadQueryListener != null) {
+ dialpadQueryListener.onDialpadQueryChanged(digits.getText().toString());
}
updateDeleteButtonEnabledState();
@@ -329,22 +329,22 @@ public class DialpadFragment extends Fragment
LogUtil.enterBlock("DialpadFragment.onCreate");
super.onCreate(state);
- mFirstLaunch = state == null;
+ firstLaunch = state == null;
- mProhibitedPhoneNumberRegexp =
+ prohibitedPhoneNumberRegexp =
getResources().getString(R.string.config_prohibited_phone_number_regexp);
if (state != null) {
- mDigitsFilledByIntent = state.getBoolean(PREF_DIGITS_FILLED_BY_INTENT);
+ digitsFilledByIntent = state.getBoolean(PREF_DIGITS_FILLED_BY_INTENT);
}
- mDialpadSlideInDuration = getResources().getInteger(R.integer.dialpad_slide_in_duration);
+ dialpadSlideInDuration = getResources().getInteger(R.integer.dialpad_slide_in_duration);
- if (mCallStateReceiver == null) {
+ if (callStateReceiver == null) {
IntentFilter callStateIntentFilter =
new IntentFilter(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
- mCallStateReceiver = new CallStateReceiver();
- getActivity().registerReceiver(mCallStateReceiver, callStateIntentFilter);
+ callStateReceiver = new CallStateReceiver();
+ getActivity().registerReceiver(callStateReceiver, callStateIntentFilter);
}
initPhoneNumberFormattingTextWatcherExecutor =
@@ -354,7 +354,7 @@ public class DialpadFragment extends Fragment
getFragmentManager(),
"DialpadFragment.initPhoneNumberFormattingTextWatcher",
new InitPhoneNumberFormattingTextWatcherWorker())
- .onSuccess(watcher -> mDialpadView.getDigits().addTextChangedListener(watcher))
+ .onSuccess(watcher -> dialpadView.getDigits().addTextChangedListener(watcher))
.build();
Trace.endSection();
}
@@ -372,15 +372,15 @@ public class DialpadFragment extends Fragment
Trace.beginSection(TAG + " setup views");
- mDialpadView = fragmentView.findViewById(R.id.dialpad_view);
- mDialpadView.setCanDigitsBeEdited(true);
- mDigits = mDialpadView.getDigits();
- mDigits.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
- mDigits.setOnClickListener(this);
- mDigits.setOnKeyListener(this);
- mDigits.setOnLongClickListener(this);
- mDigits.addTextChangedListener(this);
- mDigits.setElegantTextHeight(false);
+ dialpadView = fragmentView.findViewById(R.id.dialpad_view);
+ dialpadView.setCanDigitsBeEdited(true);
+ digits = dialpadView.getDigits();
+ digits.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
+ digits.setOnClickListener(this);
+ digits.setOnKeyListener(this);
+ digits.setOnLongClickListener(this);
+ digits.addTextChangedListener(this);
+ digits.setElegantTextHeight(false);
initPhoneNumberFormattingTextWatcherExecutor.executeSerial(getCurrentCountryIso());
@@ -390,11 +390,11 @@ public class DialpadFragment extends Fragment
configureKeypadListeners(fragmentView);
}
- mDelete = mDialpadView.getDeleteButton();
+ delete = dialpadView.getDeleteButton();
- if (mDelete != null) {
- mDelete.setOnClickListener(this);
- mDelete.setOnLongClickListener(this);
+ if (delete != null) {
+ delete.setOnClickListener(this);
+ delete.setOnLongClickListener(this);
}
fragmentView
@@ -411,16 +411,16 @@ public class DialpadFragment extends Fragment
return false;
});
- mDigits.setCursorVisible(false);
+ digits.setCursorVisible(false);
// Set up the "dialpad chooser" UI; see showDialpadChooser().
- mDialpadChooser = fragmentView.findViewById(R.id.dialpadChooser);
- mDialpadChooser.setOnItemClickListener(this);
+ dialpadChooser = fragmentView.findViewById(R.id.dialpadChooser);
+ dialpadChooser.setOnItemClickListener(this);
- mFloatingActionButton = fragmentView.findViewById(R.id.dialpad_floating_action_button);
- mFloatingActionButton.setOnClickListener(this);
- mFloatingActionButtonController =
- new FloatingActionButtonController(getActivity(), mFloatingActionButton);
+ floatingActionButton = fragmentView.findViewById(R.id.dialpad_floating_action_button);
+ floatingActionButton.setOnClickListener(this);
+ floatingActionButtonController =
+ new FloatingActionButtonController(getActivity(), floatingActionButton);
Trace.endSection();
Trace.endSection();
return fragmentView;
@@ -440,18 +440,18 @@ public class DialpadFragment extends Fragment
}
private boolean isLayoutReady() {
- return mDigits != null;
+ return digits != null;
}
public EditText getDigitsWidget() {
- return mDigits;
+ return digits;
}
- /** @return true when {@link #mDigits} is actually filled by the Intent. */
+ /** @return true when {@link #digits} 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) {
+ if (!firstLaunch && !startedFromNewIntent) {
return false;
}
@@ -463,7 +463,7 @@ public class DialpadFragment extends Fragment
// Put the requested number into the input area
String data = uri.getSchemeSpecificPart();
// Remember it is filled via Intent.
- mDigitsFilledByIntent = true;
+ digitsFilledByIntent = true;
final String converted =
PhoneNumberUtils.convertKeypadLettersToDigits(
PhoneNumberUtils.replaceUnicodeDigits(data));
@@ -489,7 +489,7 @@ public class DialpadFragment extends Fragment
try {
if (c.moveToFirst()) {
// Remember it is filled via Intent.
- mDigitsFilledByIntent = true;
+ digitsFilledByIntent = true;
// Put the number into the input area
setFormattedDigits(c.getString(0), c.getString(1));
return true;
@@ -550,7 +550,7 @@ public class DialpadFragment extends Fragment
// i.e. User clicks a telephone link from gmail for example.
// In this case, we want to show the dialpad with the phone number.
boolean digitsFilled = fillDigitsIfNecessary(intent);
- if (!(mStartedFromNewIntent && digitsFilled) && isPhoneInUse()) {
+ if (!(startedFromNewIntent && digitsFilled) && isPhoneInUse()) {
// If there's already an active call, bring up an intermediate UI to
// make the user confirm what they really want to do.
LogUtil.i("DialpadFragment.configureScreenFromIntent", "Dialpad chooser mode");
@@ -565,7 +565,7 @@ public class DialpadFragment extends Fragment
}
public void setStartedFromNewIntent(boolean value) {
- mStartedFromNewIntent = value;
+ startedFromNewIntent = value;
}
public void clearCallRateInformation() {
@@ -573,14 +573,14 @@ public class DialpadFragment extends Fragment
}
public void setCallRateInformation(String countryName, String displayRate) {
- mDialpadView.setCallRateInformation(countryName, displayRate);
+ dialpadView.setCallRateInformation(countryName, displayRate);
}
/** Sets formatted digits to digits field. */
private void setFormattedDigits(String data, String normalizedNumber) {
final String formatted = getFormattedDigits(data, normalizedNumber, getCurrentCountryIso());
if (!TextUtils.isEmpty(formatted)) {
- Editable digits = mDigits.getText();
+ Editable digits = this.digits.getText();
digits.replace(0, digits.length(), formatted);
// for some reason this isn't getting called in the digits.replace call above..
// but in any case, this will make sure the background drawable looks right
@@ -623,21 +623,21 @@ public class DialpadFragment extends Fragment
@Override
public void onStart() {
- LogUtil.i("DialpadFragment.onStart", "first launch: %b", mFirstLaunch);
+ LogUtil.i("DialpadFragment.onStart", "first launch: %b", firstLaunch);
Trace.beginSection(TAG + " onStart");
super.onStart();
// if the mToneGenerator creation fails, just continue without it. It is
// a local audio signal, and is not as important as the dtmf tone itself.
final long start = System.currentTimeMillis();
- synchronized (mToneGeneratorLock) {
- if (mToneGenerator == null) {
+ synchronized (toneGeneratorLock) {
+ if (toneGenerator == null) {
try {
- mToneGenerator = new ToneGenerator(DIAL_TONE_STREAM_TYPE, TONE_RELATIVE_VOLUME);
+ toneGenerator = new ToneGenerator(DIAL_TONE_STREAM_TYPE, TONE_RELATIVE_VOLUME);
} catch (RuntimeException e) {
LogUtil.e(
"DialpadFragment.onStart",
"Exception caught while creating local tone generator: " + e);
- mToneGenerator = null;
+ toneGenerator = null;
}
}
}
@@ -659,11 +659,10 @@ public class DialpadFragment extends Fragment
if (MotorolaUtils.isWifiCallingAvailable(getContext())) {
iconId = R.drawable.ic_wifi_calling;
}
- mFloatingActionButtonController.changeIcon(
+ floatingActionButtonController.changeIcon(
getContext(), iconId, res.getString(R.string.description_dial_button));
- mDialpadQueryListener =
- FragmentUtils.getParentUnsafe(this, OnDialpadQueryChangedListener.class);
+ dialpadQueryListener = FragmentUtils.getParentUnsafe(this, OnDialpadQueryChangedListener.class);
final StopWatch stopWatch = StopWatch.start("Dialpad.onResume");
@@ -676,14 +675,14 @@ public class DialpadFragment extends Fragment
final ContentResolver contentResolver = getActivity().getContentResolver();
// retrieve the DTMF tone play back setting.
- mDTMFToneEnabled =
+ dTMFToneEnabled =
Settings.System.getInt(contentResolver, Settings.System.DTMF_TONE_WHEN_DIALING, 1) == 1;
stopWatch.lap("dtwd");
stopWatch.lap("hptc");
- mPressedDialpadKeys.clear();
+ pressedDialpadKeys.clear();
configureScreenFromIntent(getActivity().getIntent());
@@ -706,19 +705,19 @@ public class DialpadFragment extends Fragment
// Populate the overflow menu in onResume instead of onCreate, so that if the SMS activity
// is disabled while Dialer is paused, the "Send a text message" option can be correctly
// removed when resumed.
- mOverflowMenuButton = mDialpadView.getOverflowMenuButton();
- mOverflowPopupMenu = buildOptionsMenu(mOverflowMenuButton);
- mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener());
- mOverflowMenuButton.setOnClickListener(this);
- mOverflowMenuButton.setVisibility(isDigitsEmpty() ? View.INVISIBLE : View.VISIBLE);
+ overflowMenuButton = dialpadView.getOverflowMenuButton();
+ overflowPopupMenu = buildOptionsMenu(overflowMenuButton);
+ overflowMenuButton.setOnTouchListener(overflowPopupMenu.getDragToOpenListener());
+ overflowMenuButton.setOnClickListener(this);
+ overflowMenuButton.setVisibility(isDigitsEmpty() ? View.INVISIBLE : View.VISIBLE);
- if (mFirstLaunch) {
+ if (firstLaunch) {
// The onHiddenChanged callback does not get called the first time the fragment is
// attached, so call it ourselves here.
onHiddenChanged(false);
}
- mFirstLaunch = false;
+ firstLaunch = false;
Trace.endSection();
}
@@ -728,14 +727,14 @@ public class DialpadFragment extends Fragment
// Make sure we don't leave this activity with a tone still playing.
stopTone();
- mPressedDialpadKeys.clear();
+ pressedDialpadKeys.clear();
// TODO: I wonder if we should not check if the AsyncTask that
// lookup the last dialed number has completed.
- mLastNumberDialed = EMPTY_NUMBER; // Since we are going to query again, free stale number.
+ lastNumberDialed = EMPTY_NUMBER; // Since we are going to query again, free stale number.
SpecialCharSequenceMgr.cleanup();
- mOverflowPopupMenu.dismiss();
+ overflowPopupMenu.dismiss();
}
@Override
@@ -743,15 +742,15 @@ public class DialpadFragment extends Fragment
LogUtil.enterBlock("DialpadFragment.onStop");
super.onStop();
- synchronized (mToneGeneratorLock) {
- if (mToneGenerator != null) {
- mToneGenerator.release();
- mToneGenerator = null;
+ synchronized (toneGeneratorLock) {
+ if (toneGenerator != null) {
+ toneGenerator.release();
+ toneGenerator = null;
}
}
- if (mClearDigitsOnStop) {
- mClearDigitsOnStop = false;
+ if (clearDigitsOnStop) {
+ clearDigitsOnStop = false;
clearDialpad();
}
}
@@ -759,17 +758,17 @@ public class DialpadFragment extends Fragment
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putBoolean(PREF_DIGITS_FILLED_BY_INTENT, mDigitsFilledByIntent);
+ outState.putBoolean(PREF_DIGITS_FILLED_BY_INTENT, digitsFilledByIntent);
}
@Override
public void onDestroy() {
super.onDestroy();
- if (mPseudoEmergencyAnimator != null) {
- mPseudoEmergencyAnimator.destroy();
- mPseudoEmergencyAnimator = null;
+ if (pseudoEmergencyAnimator != null) {
+ pseudoEmergencyAnimator.destroy();
+ pseudoEmergencyAnimator = null;
}
- getActivity().unregisterReceiver(mCallStateReceiver);
+ getActivity().unregisterReceiver(callStateReceiver);
}
private void keyPressed(int keyCode) {
@@ -819,12 +818,12 @@ public class DialpadFragment extends Fragment
getView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);
- mDigits.onKeyDown(keyCode, event);
+ digits.onKeyDown(keyCode, event);
// If the cursor is at the end of the text we hide it.
- final int length = mDigits.length();
- if (length == mDigits.getSelectionStart() && length == mDigits.getSelectionEnd()) {
- mDigits.setCursorVisible(false);
+ final int length = digits.length();
+ if (length == digits.getSelectionStart() && length == digits.getSelectionEnd()) {
+ digits.setCursorVisible(false);
}
}
@@ -877,10 +876,10 @@ public class DialpadFragment extends Fragment
LogUtil.e(
"DialpadFragment.onPressed", "Unexpected onTouch(ACTION_DOWN) event from: " + view);
}
- mPressedDialpadKeys.add(view);
+ pressedDialpadKeys.add(view);
} else {
- mPressedDialpadKeys.remove(view);
- if (mPressedDialpadKeys.isEmpty()) {
+ pressedDialpadKeys.remove(view);
+ if (pressedDialpadKeys.isEmpty()) {
stopTone();
}
}
@@ -925,10 +924,10 @@ public class DialpadFragment extends Fragment
keyPressed(KeyEvent.KEYCODE_DEL);
} else if (resId == R.id.digits) {
if (!isDigitsEmpty()) {
- mDigits.setCursorVisible(true);
+ digits.setCursorVisible(true);
}
} else if (resId == R.id.dialpad_overflow) {
- mOverflowPopupMenu.show();
+ overflowPopupMenu.show();
} else {
LogUtil.w("DialpadFragment.onClick", "Unexpected event from: " + view);
}
@@ -936,13 +935,13 @@ public class DialpadFragment extends Fragment
@Override
public boolean onLongClick(View view) {
- final Editable digits = mDigits.getText();
+ final Editable digits = this.digits.getText();
final int id = view.getId();
if (id == R.id.deleteButton) {
digits.clear();
return true;
} else if (id == R.id.one) {
- if (isDigitsEmpty() || TextUtils.equals(mDigits.getText(), "1")) {
+ if (isDigitsEmpty() || TextUtils.equals(this.digits.getText(), "1")) {
// We'll try to initiate voicemail and thus we want to remove irrelevant string.
removePreviousDigitIfPossible('1');
@@ -981,7 +980,7 @@ public class DialpadFragment extends Fragment
}
return false;
} else if (id == R.id.zero) {
- if (mPressedDialpadKeys.contains(view)) {
+ if (pressedDialpadKeys.contains(view)) {
// If the zero key is currently pressed, then the long press occurred by touch
// (and not via other means like certain accessibility input methods).
// Remove the '0' that was input when the key was first pressed.
@@ -989,10 +988,10 @@ public class DialpadFragment extends Fragment
}
keyPressed(KeyEvent.KEYCODE_PLUS);
stopTone();
- mPressedDialpadKeys.remove(view);
+ pressedDialpadKeys.remove(view);
return true;
} else if (id == R.id.digits) {
- mDigits.setCursorVisible(true);
+ this.digits.setCursorVisible(true);
return false;
}
return false;
@@ -1006,10 +1005,10 @@ public class DialpadFragment extends Fragment
* @param digit to remove from the digits view.
*/
private void removePreviousDigitIfPossible(char digit) {
- final int currentPosition = mDigits.getSelectionStart();
- if (currentPosition > 0 && digit == mDigits.getText().charAt(currentPosition - 1)) {
- mDigits.setSelection(currentPosition);
- mDigits.getText().delete(currentPosition - 1, currentPosition);
+ final int currentPosition = digits.getSelectionStart();
+ if (currentPosition > 0 && digit == digits.getText().charAt(currentPosition - 1)) {
+ digits.setSelection(currentPosition);
+ digits.getText().delete(currentPosition - 1, currentPosition);
}
}
@@ -1044,14 +1043,14 @@ public class DialpadFragment extends Fragment
PerformanceReport.recordClick(UiAction.Type.PRESS_CALL_BUTTON_WITHOUT_CALLING);
handleDialButtonClickWithEmptyDigits();
} else {
- final String number = mDigits.getText().toString();
+ final String number = digits.getText().toString();
// "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated
// test equipment.
// TODO: clean it up.
if (number != null
- && !TextUtils.isEmpty(mProhibitedPhoneNumberRegexp)
- && number.matches(mProhibitedPhoneNumberRegexp)) {
+ && !TextUtils.isEmpty(prohibitedPhoneNumberRegexp)
+ && number.matches(prohibitedPhoneNumberRegexp)) {
PerformanceReport.recordClick(UiAction.Type.PRESS_CALL_BUTTON_WITHOUT_CALLING);
LogUtil.i(
"DialpadFragment.handleDialButtonPressed",
@@ -1072,8 +1071,8 @@ public class DialpadFragment extends Fragment
}
public void clearDialpad() {
- if (mDigits != null) {
- mDigits.getText().clear();
+ if (digits != null) {
+ digits.getText().clear();
}
}
@@ -1086,13 +1085,13 @@ public class DialpadFragment extends Fragment
// the redial feature.
startActivity(newFlashIntent());
} else {
- if (!TextUtils.isEmpty(mLastNumberDialed)) {
+ if (!TextUtils.isEmpty(lastNumberDialed)) {
// Dialpad will be filled with last called number,
// but we don't want to record it as user action
PerformanceReport.setIgnoreActionOnce(UiAction.Type.TEXT_CHANGE_WITH_INPUT);
// Recall the last number dialed.
- mDigits.setText(mLastNumberDialed);
+ digits.setText(lastNumberDialed);
// ...and move the cursor to the end of the digits string,
// so you'll be able to delete digits using the Delete
@@ -1102,7 +1101,7 @@ public class DialpadFragment extends Fragment
// mLastNumberDialed.length(), since the EditText widget now
// contains a *formatted* version of mLastNumberDialed (due to
// mTextWatcher) and its length may have changed.
- mDigits.setSelection(mDigits.getText().length());
+ digits.setSelection(digits.getText().length());
} else {
// There's no "last number dialed" or the
// background query is still running. There's
@@ -1135,7 +1134,7 @@ public class DialpadFragment extends Fragment
*/
private void playTone(int tone, int durationMs) {
// if local tone playback is disabled, just return.
- if (!mDTMFToneEnabled) {
+ if (!dTMFToneEnabled) {
return;
}
@@ -1152,29 +1151,29 @@ public class DialpadFragment extends Fragment
return;
}
- synchronized (mToneGeneratorLock) {
- if (mToneGenerator == null) {
+ synchronized (toneGeneratorLock) {
+ if (toneGenerator == null) {
LogUtil.w("DialpadFragment.playTone", "mToneGenerator == null, tone: " + tone);
return;
}
// Start the new tone (will stop any playing tone)
- mToneGenerator.startTone(tone, durationMs);
+ toneGenerator.startTone(tone, durationMs);
}
}
/** Stop the tone if it is played. */
private void stopTone() {
// if local tone playback is disabled, just return.
- if (!mDTMFToneEnabled) {
+ if (!dTMFToneEnabled) {
return;
}
- synchronized (mToneGeneratorLock) {
- if (mToneGenerator == null) {
+ synchronized (toneGeneratorLock) {
+ if (toneGenerator == null) {
LogUtil.w("DialpadFragment.stopTone", "mToneGenerator == null");
return;
}
- mToneGenerator.stopTone();
+ toneGenerator.stopTone();
}
}
@@ -1202,48 +1201,48 @@ public class DialpadFragment extends Fragment
if (enabled) {
LogUtil.i("DialpadFragment.showDialpadChooser", "Showing dialpad chooser!");
- if (mDialpadView != null) {
- mDialpadView.setVisibility(View.GONE);
+ if (dialpadView != null) {
+ dialpadView.setVisibility(View.GONE);
}
- if (mOverflowPopupMenu != null) {
- mOverflowPopupMenu.dismiss();
+ if (overflowPopupMenu != null) {
+ overflowPopupMenu.dismiss();
}
- mFloatingActionButtonController.scaleOut();
- mDialpadChooser.setVisibility(View.VISIBLE);
+ floatingActionButtonController.scaleOut();
+ dialpadChooser.setVisibility(View.VISIBLE);
// Instantiate the DialpadChooserAdapter and hook it up to the
// ListView. We do this only once.
- if (mDialpadChooserAdapter == null) {
- mDialpadChooserAdapter = new DialpadChooserAdapter(getActivity());
+ if (dialpadChooserAdapter == null) {
+ dialpadChooserAdapter = new DialpadChooserAdapter(getActivity());
}
- mDialpadChooser.setAdapter(mDialpadChooserAdapter);
+ dialpadChooser.setAdapter(dialpadChooserAdapter);
} else {
LogUtil.i("DialpadFragment.showDialpadChooser", "Displaying normal Dialer UI.");
- if (mDialpadView != null) {
+ if (dialpadView != null) {
LogUtil.i("DialpadFragment.showDialpadChooser", "mDialpadView not null");
- mDialpadView.setVisibility(View.VISIBLE);
- mFloatingActionButtonController.scaleIn();
+ dialpadView.setVisibility(View.VISIBLE);
+ floatingActionButtonController.scaleIn();
} else {
LogUtil.i("DialpadFragment.showDialpadChooser", "mDialpadView null");
- mDigits.setVisibility(View.VISIBLE);
+ digits.setVisibility(View.VISIBLE);
}
// mFloatingActionButtonController must also be 'scaled in', in order to be visible after
// 'scaleOut()' hidden method.
- if (!mFloatingActionButtonController.isVisible()) {
+ if (!floatingActionButtonController.isVisible()) {
// Just call 'scaleIn()' method if the mFloatingActionButtonController was not already
// previously visible.
- mFloatingActionButtonController.scaleIn();
+ floatingActionButtonController.scaleIn();
}
- mDialpadChooser.setVisibility(View.GONE);
+ dialpadChooser.setVisibility(View.GONE);
}
}
/** @return true if we're currently showing the "dialpad chooser" UI. */
private boolean isDialpadChooserVisible() {
- return mDialpadChooser.getVisibility() == View.VISIBLE;
+ return dialpadChooser.getVisibility() == View.VISIBLE;
}
/** Handle clicks from the dialpad chooser. */
@@ -1310,7 +1309,7 @@ public class DialpadFragment extends Fragment
updateDialString(WAIT);
return true;
} else if (resId == R.id.menu_call_with_note) {
- CallSubjectDialog.start(getActivity(), mDigits.getText().toString());
+ CallSubjectDialog.start(getActivity(), digits.getText().toString());
hideAndClearDialpad();
return true;
} else {
@@ -1330,24 +1329,24 @@ public class DialpadFragment extends Fragment
int selectionEnd;
// SpannableStringBuilder editable_text = new SpannableStringBuilder(mDigits.getText());
- int anchor = mDigits.getSelectionStart();
- int point = mDigits.getSelectionEnd();
+ int anchor = this.digits.getSelectionStart();
+ int point = this.digits.getSelectionEnd();
selectionStart = Math.min(anchor, point);
selectionEnd = Math.max(anchor, point);
if (selectionStart == -1) {
- selectionStart = selectionEnd = mDigits.length();
+ selectionStart = selectionEnd = this.digits.length();
}
- Editable digits = mDigits.getText();
+ Editable digits = this.digits.getText();
if (canAddDigit(digits, selectionStart, selectionEnd, newDigit)) {
digits.replace(selectionStart, selectionEnd, Character.toString(newDigit));
if (selectionStart != selectionEnd) {
// Unselect: back to a regular cursor, just pass the character inserted.
- mDigits.setSelection(selectionStart + 1);
+ this.digits.setSelection(selectionStart + 1);
}
}
}
@@ -1358,7 +1357,7 @@ public class DialpadFragment extends Fragment
return;
}
final boolean digitsNotEmpty = !isDigitsEmpty();
- mDelete.setEnabled(digitsNotEmpty);
+ delete.setEnabled(digitsNotEmpty);
}
/**
@@ -1369,11 +1368,11 @@ public class DialpadFragment extends Fragment
* @param transitionIn True if transitioning in, False if transitioning out
*/
private void updateMenuOverflowButton(boolean transitionIn) {
- mOverflowMenuButton = mDialpadView.getOverflowMenuButton();
+ overflowMenuButton = dialpadView.getOverflowMenuButton();
if (transitionIn) {
- AnimUtils.fadeIn(mOverflowMenuButton, AnimUtils.DEFAULT_DURATION);
+ AnimUtils.fadeIn(overflowMenuButton, AnimUtils.DEFAULT_DURATION);
} else {
- AnimUtils.fadeOut(mOverflowMenuButton, AnimUtils.DEFAULT_DURATION);
+ AnimUtils.fadeOut(overflowMenuButton, AnimUtils.DEFAULT_DURATION);
}
}
@@ -1406,7 +1405,7 @@ public class DialpadFragment extends Fragment
/** @return true if the widget with the phone number digits is empty. */
private boolean isDigitsEmpty() {
- return mDigits.length() == 0;
+ return digits.length() == 0;
}
/**
@@ -1415,7 +1414,7 @@ public class DialpadFragment extends Fragment
* yet.
*/
private void queryLastOutgoingCall() {
- mLastNumberDialed = EMPTY_NUMBER;
+ lastNumberDialed = EMPTY_NUMBER;
if (!PermissionsUtil.hasCallLogReadPermissions(getContext())) {
return;
}
@@ -1429,7 +1428,7 @@ public class DialpadFragment extends Fragment
if (getActivity() == null) {
return;
}
- mLastNumberDialed = number;
+ lastNumberDialed = number;
updateDeleteButtonEnabledState();
});
}
@@ -1447,30 +1446,30 @@ public class DialpadFragment extends Fragment
return;
}
if (!hidden && !isDialpadChooserVisible()) {
- if (mAnimate) {
- mDialpadView.animateShow();
+ if (animate) {
+ dialpadView.animateShow();
}
ThreadUtil.getUiThreadHandler()
.postDelayed(
() -> {
if (!isDialpadChooserVisible()) {
- mFloatingActionButtonController.scaleIn();
+ floatingActionButtonController.scaleIn();
}
},
- mAnimate ? mDialpadSlideInDuration : 0);
+ animate ? dialpadSlideInDuration : 0);
FragmentUtils.getParentUnsafe(this, DialpadListener.class).onDialpadShown();
- mDigits.requestFocus();
+ digits.requestFocus();
} else if (hidden) {
- mFloatingActionButtonController.scaleOut();
+ floatingActionButtonController.scaleOut();
}
}
public boolean getAnimate() {
- return mAnimate;
+ return animate;
}
public void setAnimate(boolean value) {
- mAnimate = value;
+ animate = value;
}
public void setYFraction(float yFraction) {
@@ -1478,21 +1477,21 @@ public class DialpadFragment extends Fragment
}
public int getDialpadHeight() {
- if (mDialpadView == null) {
+ if (dialpadView == null) {
return 0;
}
- return mDialpadView.getHeight();
+ return dialpadView.getHeight();
}
public void process_quote_emergency_unquote(String query) {
if (PseudoEmergencyAnimator.PSEUDO_EMERGENCY_NUMBER.equals(query)) {
- if (mPseudoEmergencyAnimator == null) {
- mPseudoEmergencyAnimator =
+ if (pseudoEmergencyAnimator == null) {
+ pseudoEmergencyAnimator =
new PseudoEmergencyAnimator(
new PseudoEmergencyAnimator.ViewProvider() {
@Override
public View getFab() {
- return mFloatingActionButton;
+ return floatingActionButton;
}
@Override
@@ -1501,10 +1500,10 @@ public class DialpadFragment extends Fragment
}
});
}
- mPseudoEmergencyAnimator.start();
+ pseudoEmergencyAnimator.start();
} else {
- if (mPseudoEmergencyAnimator != null) {
- mPseudoEmergencyAnimator.end();
+ if (pseudoEmergencyAnimator != null) {
+ pseudoEmergencyAnimator.end();
}
}
}
@@ -1561,8 +1560,8 @@ public class DialpadFragment extends Fragment
private static final String ARG_TITLE_RES_ID = "argTitleResId";
private static final String ARG_MESSAGE_RES_ID = "argMessageResId";
- private int mTitleResId;
- private int mMessageResId;
+ private int titleResId;
+ private int messageResId;
public static ErrorDialogFragment newInstance(int messageResId) {
return newInstance(0, messageResId);
@@ -1580,18 +1579,18 @@ public class DialpadFragment extends Fragment
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mTitleResId = getArguments().getInt(ARG_TITLE_RES_ID);
- mMessageResId = getArguments().getInt(ARG_MESSAGE_RES_ID);
+ titleResId = getArguments().getInt(ARG_TITLE_RES_ID);
+ messageResId = getArguments().getInt(ARG_MESSAGE_RES_ID);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- if (mTitleResId != 0) {
- builder.setTitle(mTitleResId);
+ if (titleResId != 0) {
+ builder.setTitle(titleResId);
}
- if (mMessageResId != 0) {
- builder.setMessage(mMessageResId);
+ if (messageResId != 0) {
+ builder.setMessage(messageResId);
}
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> dismiss());
return builder.create();
@@ -1609,18 +1608,18 @@ public class DialpadFragment extends Fragment
static final int DIALPAD_CHOICE_RETURN_TO_CALL = 102;
static final int DIALPAD_CHOICE_ADD_NEW_CALL = 103;
private static final int NUM_ITEMS = 3;
- private LayoutInflater mInflater;
- private ChoiceItem[] mChoiceItems = new ChoiceItem[NUM_ITEMS];
+ private LayoutInflater inflater;
+ private ChoiceItem[] choiceItems = new ChoiceItem[NUM_ITEMS];
DialpadChooserAdapter(Context context) {
// Cache the LayoutInflate to avoid asking for a new one each time.
- mInflater = LayoutInflater.from(context);
+ inflater = LayoutInflater.from(context);
// Initialize the possible choices.
// TODO: could this be specified entirely in XML?
// - "Use touch tone keypad"
- mChoiceItems[0] =
+ choiceItems[0] =
new ChoiceItem(
context.getString(R.string.dialer_useDtmfDialpad),
BitmapFactory.decodeResource(
@@ -1628,7 +1627,7 @@ public class DialpadFragment extends Fragment
DIALPAD_CHOICE_USE_DTMF_DIALPAD);
// - "Return to call in progress"
- mChoiceItems[1] =
+ choiceItems[1] =
new ChoiceItem(
context.getString(R.string.dialer_returnToInCallScreen),
BitmapFactory.decodeResource(
@@ -1636,7 +1635,7 @@ public class DialpadFragment extends Fragment
DIALPAD_CHOICE_RETURN_TO_CALL);
// - "Add call"
- mChoiceItems[2] =
+ choiceItems[2] =
new ChoiceItem(
context.getString(R.string.dialer_addAnotherCall),
BitmapFactory.decodeResource(
@@ -1652,7 +1651,7 @@ public class DialpadFragment extends Fragment
/** Return the ChoiceItem for a given position. */
@Override
public Object getItem(int position) {
- return mChoiceItems[position];
+ return choiceItems[position];
}
/** Return a unique ID for each possible choice. */
@@ -1667,14 +1666,14 @@ public class DialpadFragment extends Fragment
// When convertView is non-null, we can reuse it (there's no need
// to reinflate it.)
if (convertView == null) {
- convertView = mInflater.inflate(R.layout.dialpad_chooser_list_item, null);
+ convertView = inflater.inflate(R.layout.dialpad_chooser_list_item, null);
}
TextView text = convertView.findViewById(R.id.text);
- text.setText(mChoiceItems[position].text);
+ text.setText(choiceItems[position].text);
ImageView icon = convertView.findViewById(R.id.icon);
- icon.setImageBitmap(mChoiceItems[position].icon);
+ icon.setImageBitmap(choiceItems[position].icon);
return convertView;
}
diff --git a/java/com/android/dialer/dialpadview/DialpadKeyButton.java b/java/com/android/dialer/dialpadview/DialpadKeyButton.java
index 0c842ebb5..84aca14f2 100644
--- a/java/com/android/dialer/dialpadview/DialpadKeyButton.java
+++ b/java/com/android/dialer/dialpadview/DialpadKeyButton.java
@@ -49,30 +49,30 @@ public class DialpadKeyButton extends FrameLayout {
private static final int LONG_HOVER_TIMEOUT = ViewConfiguration.getLongPressTimeout() * 2;
/** Accessibility manager instance used to check touch exploration state. */
- private AccessibilityManager mAccessibilityManager;
+ private AccessibilityManager accessibilityManager;
/** Bounds used to filter HOVER_EXIT events. */
- private RectF mHoverBounds = new RectF();
+ private RectF hoverBounds = new RectF();
/** Whether this view is currently in the long-hover state. */
- private boolean mLongHovered;
+ private boolean longHovered;
/** Alternate content description for long-hover state. */
- private CharSequence mLongHoverContentDesc;
+ private CharSequence longHoverContentDesc;
/** Backup of standard content description. Used for accessibility. */
- private CharSequence mBackupContentDesc;
+ private CharSequence backupContentDesc;
/** Backup of clickable property. Used for accessibility. */
- private boolean mWasClickable;
+ private boolean wasClickable;
/** Backup of long-clickable property. Used for accessibility. */
- private boolean mWasLongClickable;
+ private boolean wasLongClickable;
/** Runnable used to trigger long-click mode for accessibility. */
- private Runnable mLongHoverRunnable;
+ private Runnable longHoverRunnable;
- private OnPressedListener mOnPressedListener;
+ private OnPressedListener onPressedListener;
public DialpadKeyButton(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -85,26 +85,26 @@ public class DialpadKeyButton extends FrameLayout {
}
public void setOnPressedListener(OnPressedListener onPressedListener) {
- mOnPressedListener = onPressedListener;
+ this.onPressedListener = onPressedListener;
}
private void initForAccessibility(Context context) {
- mAccessibilityManager =
+ accessibilityManager =
(AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
}
public void setLongHoverContentDescription(CharSequence contentDescription) {
- mLongHoverContentDesc = contentDescription;
+ longHoverContentDesc = contentDescription;
- if (mLongHovered) {
- super.setContentDescription(mLongHoverContentDesc);
+ if (longHovered) {
+ super.setContentDescription(longHoverContentDesc);
}
}
@Override
public void setContentDescription(CharSequence contentDescription) {
- if (mLongHovered) {
- mBackupContentDesc = contentDescription;
+ if (longHovered) {
+ backupContentDesc = contentDescription;
} else {
super.setContentDescription(contentDescription);
}
@@ -113,8 +113,8 @@ public class DialpadKeyButton extends FrameLayout {
@Override
public void setPressed(boolean pressed) {
super.setPressed(pressed);
- if (mOnPressedListener != null) {
- mOnPressedListener.onPressed(this, pressed);
+ if (onPressedListener != null) {
+ onPressedListener.onPressed(this, pressed);
}
}
@@ -122,10 +122,10 @@ public class DialpadKeyButton extends FrameLayout {
public void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
- mHoverBounds.left = getPaddingLeft();
- mHoverBounds.right = w - getPaddingRight();
- mHoverBounds.top = getPaddingTop();
- mHoverBounds.bottom = h - getPaddingBottom();
+ hoverBounds.left = getPaddingLeft();
+ hoverBounds.right = w - getPaddingRight();
+ hoverBounds.top = getPaddingTop();
+ hoverBounds.bottom = h - getPaddingBottom();
}
@Override
@@ -142,37 +142,37 @@ public class DialpadKeyButton extends FrameLayout {
public boolean onHoverEvent(MotionEvent event) {
// When touch exploration is turned on, lifting a finger while inside
// the button's hover target bounds should perform a click action.
- if (mAccessibilityManager.isEnabled() && mAccessibilityManager.isTouchExplorationEnabled()) {
+ if (accessibilityManager.isEnabled() && accessibilityManager.isTouchExplorationEnabled()) {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_HOVER_ENTER:
// Lift-to-type temporarily disables double-tap activation.
- mWasClickable = isClickable();
- mWasLongClickable = isLongClickable();
- if (mWasLongClickable && mLongHoverContentDesc != null) {
- if (mLongHoverRunnable == null) {
- mLongHoverRunnable =
+ wasClickable = isClickable();
+ wasLongClickable = isLongClickable();
+ if (wasLongClickable && longHoverContentDesc != null) {
+ if (longHoverRunnable == null) {
+ longHoverRunnable =
new Runnable() {
@Override
public void run() {
setLongHovered(true);
- announceForAccessibility(mLongHoverContentDesc);
+ announceForAccessibility(longHoverContentDesc);
}
};
}
- postDelayed(mLongHoverRunnable, LONG_HOVER_TIMEOUT);
+ postDelayed(longHoverRunnable, LONG_HOVER_TIMEOUT);
}
setClickable(false);
setLongClickable(false);
break;
case MotionEvent.ACTION_HOVER_EXIT:
- if (mHoverBounds.contains(event.getX(), event.getY())) {
+ if (hoverBounds.contains(event.getX(), event.getY())) {
simulateClickForAccessibility();
}
cancelLongHover();
- setClickable(mWasClickable);
- setLongClickable(mWasLongClickable);
+ setClickable(wasClickable);
+ setLongClickable(wasLongClickable);
break;
default: // No-op
break;
@@ -202,22 +202,22 @@ public class DialpadKeyButton extends FrameLayout {
}
private void setLongHovered(boolean enabled) {
- if (mLongHovered != enabled) {
- mLongHovered = enabled;
+ if (longHovered != enabled) {
+ longHovered = enabled;
// Switch between normal and alternate description, if available.
if (enabled) {
- mBackupContentDesc = getContentDescription();
- super.setContentDescription(mLongHoverContentDesc);
+ backupContentDesc = getContentDescription();
+ super.setContentDescription(longHoverContentDesc);
} else {
- super.setContentDescription(mBackupContentDesc);
+ super.setContentDescription(backupContentDesc);
}
}
}
private void cancelLongHover() {
- if (mLongHoverRunnable != null) {
- removeCallbacks(mLongHoverRunnable);
+ if (longHoverRunnable != null) {
+ removeCallbacks(longHoverRunnable);
}
setLongHovered(false);
}
diff --git a/java/com/android/dialer/dialpadview/DialpadTextView.java b/java/com/android/dialer/dialpadview/DialpadTextView.java
index b1eee4b9c..9607195cd 100644
--- a/java/com/android/dialer/dialpadview/DialpadTextView.java
+++ b/java/com/android/dialer/dialpadview/DialpadTextView.java
@@ -33,8 +33,8 @@ import android.widget.TextView;
*/
public class DialpadTextView extends TextView {
- private Rect mTextBounds = new Rect();
- private String mTextStr;
+ private Rect textBounds = new Rect();
+ private String textStr;
public DialpadTextView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -51,7 +51,7 @@ public class DialpadTextView extends TextView {
// The text bounds values are relative and can be negative,, so rather than specifying a
// standard origin such as 0, 0, we need to use negative of the left/top bounds.
// For example, the bounds may be: Left: 11, Right: 37, Top: -77, Bottom: 0
- canvas.drawText(mTextStr, -mTextBounds.left, -mTextBounds.top, paint);
+ canvas.drawText(textStr, -textBounds.left, -textBounds.top, paint);
}
/**
@@ -61,11 +61,11 @@ public class DialpadTextView extends TextView {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- mTextStr = getText().toString();
- getPaint().getTextBounds(mTextStr, 0, mTextStr.length(), mTextBounds);
+ textStr = getText().toString();
+ getPaint().getTextBounds(textStr, 0, textStr.length(), textBounds);
- int width = resolveSize(mTextBounds.width(), widthMeasureSpec);
- int height = resolveSize(mTextBounds.height(), heightMeasureSpec);
+ int width = resolveSize(textBounds.width(), widthMeasureSpec);
+ int height = resolveSize(textBounds.height(), heightMeasureSpec);
setMeasuredDimension(width, height);
}
}
diff --git a/java/com/android/dialer/dialpadview/DialpadView.java b/java/com/android/dialer/dialpadview/DialpadView.java
index 7b95ba7ea..58ba233bd 100644
--- a/java/com/android/dialer/dialpadview/DialpadView.java
+++ b/java/com/android/dialer/dialpadview/DialpadView.java
@@ -73,21 +73,21 @@ public class DialpadView extends LinearLayout {
R.id.pound
};
- private final AttributeSet mAttributeSet;
- private final ColorStateList mRippleColor;
- private final OnPreDrawListenerForKeyLayoutAdjust mOnPreDrawListenerForKeyLayoutAdjust;
- private final String[] mPrimaryLettersMapping;
- private final String[] mSecondaryLettersMapping;
- private final boolean mIsRtl; // whether the dialpad is shown in a right-to-left locale
- private final int mTranslateDistance;
-
- private EditText mDigits;
- private ImageButton mDelete;
- private View mOverflowMenuButton;
- private ViewGroup mRateContainer;
- private TextView mIldCountry;
- private TextView mIldRate;
- private boolean mIsLandscapeMode;
+ private final AttributeSet attributeSet;
+ private final ColorStateList rippleColor;
+ private final OnPreDrawListenerForKeyLayoutAdjust onPreDrawListenerForKeyLayoutAdjust;
+ private final String[] primaryLettersMapping;
+ private final String[] secondaryLettersMapping;
+ private final boolean isRtl; // whether the dialpad is shown in a right-to-left locale
+ private final int translateDistance;
+
+ private EditText digits;
+ private ImageButton delete;
+ private View overflowMenuButton;
+ private ViewGroup rateContainer;
+ private TextView ildCountry;
+ private TextView ildRate;
+ private boolean isLandscapeMode;
public DialpadView(Context context) {
this(context, null);
@@ -99,27 +99,27 @@ public class DialpadView extends LinearLayout {
public DialpadView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mAttributeSet = attrs;
+ attributeSet = attrs;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Dialpad);
- mRippleColor = a.getColorStateList(R.styleable.Dialpad_dialpad_key_button_touch_tint);
+ rippleColor = a.getColorStateList(R.styleable.Dialpad_dialpad_key_button_touch_tint);
a.recycle();
- mTranslateDistance =
+ translateDistance =
getResources().getDimensionPixelSize(R.dimen.dialpad_key_button_translate_y);
- mIsRtl =
+ isRtl =
TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
- mPrimaryLettersMapping = DialpadCharMappings.getDefaultKeyToCharsMap();
- mSecondaryLettersMapping = DialpadCharMappings.getKeyToCharsMap(context);
+ primaryLettersMapping = DialpadCharMappings.getDefaultKeyToCharsMap();
+ secondaryLettersMapping = DialpadCharMappings.getKeyToCharsMap(context);
- mOnPreDrawListenerForKeyLayoutAdjust = new OnPreDrawListenerForKeyLayoutAdjust();
+ onPreDrawListenerForKeyLayoutAdjust = new OnPreDrawListenerForKeyLayoutAdjust();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- getViewTreeObserver().removeOnPreDrawListener(mOnPreDrawListenerForKeyLayoutAdjust);
+ getViewTreeObserver().removeOnPreDrawListener(onPreDrawListenerForKeyLayoutAdjust);
}
@Override
@@ -129,28 +129,28 @@ public class DialpadView extends LinearLayout {
// The orientation obtained at this point should be used as the only truth for DialpadView as we
// observed inconsistency between configurations obtained here and in
// OnPreDrawListenerForKeyLayoutAdjust under rare circumstances.
- mIsLandscapeMode =
+ isLandscapeMode =
(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
setupKeypad();
- mDigits = (EditText) findViewById(R.id.digits);
- mDelete = (ImageButton) findViewById(R.id.deleteButton);
- mOverflowMenuButton = findViewById(R.id.dialpad_overflow);
- mRateContainer = (ViewGroup) findViewById(R.id.rate_container);
- mIldCountry = (TextView) mRateContainer.findViewById(R.id.ild_country);
- mIldRate = (TextView) mRateContainer.findViewById(R.id.ild_rate);
+ digits = (EditText) findViewById(R.id.digits);
+ delete = (ImageButton) findViewById(R.id.deleteButton);
+ overflowMenuButton = findViewById(R.id.dialpad_overflow);
+ rateContainer = (ViewGroup) findViewById(R.id.rate_container);
+ ildCountry = (TextView) rateContainer.findViewById(R.id.ild_country);
+ ildRate = (TextView) rateContainer.findViewById(R.id.ild_rate);
AccessibilityManager accessibilityManager =
(AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isEnabled()) {
// The text view must be selected to send accessibility events.
- mDigits.setSelected(true);
+ digits.setSelected(true);
}
// As OnPreDrawListenerForKeyLayoutAdjust makes changes to LayoutParams, it is added here to
// ensure it can only be triggered after the layout is inflated.
- getViewTreeObserver().removeOnPreDrawListener(mOnPreDrawListenerForKeyLayoutAdjust);
- getViewTreeObserver().addOnPreDrawListener(mOnPreDrawListenerForKeyLayoutAdjust);
+ getViewTreeObserver().removeOnPreDrawListener(onPreDrawListenerForKeyLayoutAdjust);
+ getViewTreeObserver().addOnPreDrawListener(onPreDrawListenerForKeyLayoutAdjust);
}
private void setupKeypad() {
@@ -174,7 +174,7 @@ public class DialpadView extends LinearLayout {
// The content description is used for Talkback key presses. The number is
// separated by a "," to introduce a slight delay. Convert letters into a verbatim
// span so that they are read as letters instead of as one word.
- String letters = mPrimaryLettersMapping[i];
+ String letters = primaryLettersMapping[i];
Spannable spannable =
Spannable.Factory.getInstance().newSpannable(numberString + "," + letters);
spannable.setSpan(
@@ -187,8 +187,8 @@ public class DialpadView extends LinearLayout {
final RippleDrawable rippleBackground =
(RippleDrawable) getContext().getDrawable(R.drawable.btn_dialpad_key);
- if (mRippleColor != null) {
- rippleBackground.setColor(mRippleColor);
+ if (rippleColor != null) {
+ rippleBackground.setColor(rippleColor);
}
numberView.setText(numberString);
@@ -200,20 +200,20 @@ public class DialpadView extends LinearLayout {
TextView secondaryLettersView =
(TextView) dialpadKey.findViewById(R.id.dialpad_key_secondary_letters);
if (primaryLettersView != null) {
- primaryLettersView.setText(mPrimaryLettersMapping[i]);
+ primaryLettersView.setText(primaryLettersMapping[i]);
}
if (primaryLettersView != null && secondaryLettersView != null) {
- if (mSecondaryLettersMapping == null) {
+ if (secondaryLettersMapping == null) {
secondaryLettersView.setVisibility(View.GONE);
} else {
secondaryLettersView.setVisibility(View.VISIBLE);
- secondaryLettersView.setText(mSecondaryLettersMapping[i]);
+ secondaryLettersView.setText(secondaryLettersMapping[i]);
// Adjust the font size of the letters if a secondary alphabet is available.
TypedArray a =
getContext()
.getTheme()
- .obtainStyledAttributes(mAttributeSet, R.styleable.Dialpad, 0, 0);
+ .obtainStyledAttributes(attributeSet, R.styleable.Dialpad, 0, 0);
int textSize =
a.getDimensionPixelSize(
R.styleable.Dialpad_dialpad_key_letters_size_for_dual_alphabets, 0);
@@ -260,12 +260,12 @@ public class DialpadView extends LinearLayout {
public void setCallRateInformation(String countryName, String displayRate) {
if (TextUtils.isEmpty(countryName) && TextUtils.isEmpty(displayRate)) {
- mRateContainer.setVisibility(View.GONE);
+ rateContainer.setVisibility(View.GONE);
return;
}
- mRateContainer.setVisibility(View.VISIBLE);
- mIldCountry.setText(countryName);
- mIldRate.setText(displayRate);
+ rateContainer.setVisibility(View.VISIBLE);
+ ildCountry.setText(countryName);
+ ildRate.setText(displayRate);
}
/**
@@ -288,14 +288,14 @@ public class DialpadView extends LinearLayout {
final DialpadKeyButton dialpadKey = (DialpadKeyButton) findViewById(BUTTON_IDS[i]);
ViewPropertyAnimator animator = dialpadKey.animate();
- if (mIsLandscapeMode) {
+ if (isLandscapeMode) {
// Landscape orientation requires translation along the X axis.
// For RTL locales, ensure we translate negative on the X axis.
- dialpadKey.setTranslationX((mIsRtl ? -1 : 1) * mTranslateDistance);
+ dialpadKey.setTranslationX((isRtl ? -1 : 1) * translateDistance);
animator.translationX(0);
} else {
// Portrait orientation requires translation along the Y axis.
- dialpadKey.setTranslationY(mTranslateDistance);
+ dialpadKey.setTranslationY(translateDistance);
animator.translationY(0);
}
animator
@@ -308,15 +308,15 @@ public class DialpadView extends LinearLayout {
}
public EditText getDigits() {
- return mDigits;
+ return digits;
}
public ImageButton getDeleteButton() {
- return mDelete;
+ return delete;
}
public View getOverflowMenuButton() {
- return mOverflowMenuButton;
+ return overflowMenuButton;
}
/**
@@ -327,8 +327,8 @@ public class DialpadView extends LinearLayout {
* @return The animation delay.
*/
private int getKeyButtonAnimationDelay(int buttonId) {
- if (mIsLandscapeMode) {
- if (mIsRtl) {
+ if (isLandscapeMode) {
+ if (isRtl) {
if (buttonId == R.id.three) {
return KEY_FRAME_DURATION * 1;
} else if (buttonId == R.id.six) {
@@ -415,8 +415,8 @@ public class DialpadView extends LinearLayout {
* @return The animation duration.
*/
private int getKeyButtonAnimationDuration(int buttonId) {
- if (mIsLandscapeMode) {
- if (mIsRtl) {
+ if (isLandscapeMode) {
+ if (isRtl) {
if (buttonId == R.id.one
|| buttonId == R.id.four
|| buttonId == R.id.seven
@@ -528,7 +528,7 @@ public class DialpadView extends LinearLayout {
}
private boolean shouldAdjustKeySizes() {
- return mIsLandscapeMode ? shouldAdjustKeyWidths() : shouldAdjustDigitKeyHeights();
+ return isLandscapeMode ? shouldAdjustKeyWidths() : shouldAdjustDigitKeyHeights();
}
/**
@@ -536,7 +536,7 @@ public class DialpadView extends LinearLayout {
* device is in landscape mode.
*/
private boolean shouldAdjustKeyWidths() {
- Assert.checkState(mIsLandscapeMode);
+ Assert.checkState(isLandscapeMode);
DialpadKeyButton dialpadKeyButton = (DialpadKeyButton) findViewById(BUTTON_IDS[0]);
LinearLayout keyLayout =
@@ -559,7 +559,7 @@ public class DialpadView extends LinearLayout {
* called when the device is in portrait mode.
*/
private boolean shouldAdjustDigitKeyHeights() {
- Assert.checkState(!mIsLandscapeMode);
+ Assert.checkState(!isLandscapeMode);
DialpadKeyButton dialpadKey = (DialpadKeyButton) findViewById(BUTTON_IDS[0]);
LinearLayout keyLayout = (LinearLayout) dialpadKey.findViewById(R.id.dialpad_key_layout);
@@ -579,7 +579,7 @@ public class DialpadView extends LinearLayout {
}
private void adjustKeySizes() {
- if (mIsLandscapeMode) {
+ if (isLandscapeMode) {
adjustKeyWidths();
} else {
adjustDigitKeyHeights();
@@ -597,7 +597,7 @@ public class DialpadView extends LinearLayout {
* LinearLayout#setLayoutParams(ViewGroup.LayoutParams)}.
*/
private void adjustDigitKeyHeights() {
- Assert.checkState(!mIsLandscapeMode);
+ Assert.checkState(!isLandscapeMode);
int maxHeight = 0;
@@ -641,7 +641,7 @@ public class DialpadView extends LinearLayout {
* View#setLayoutParams(ViewGroup.LayoutParams)}.
*/
private void adjustKeyWidths() {
- Assert.checkState(mIsLandscapeMode);
+ Assert.checkState(isLandscapeMode);
int maxWidth = 0;
for (int buttonId : BUTTON_IDS) {
diff --git a/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java b/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java
index 16bdd24c1..f3442e6e3 100644
--- a/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java
+++ b/java/com/android/dialer/dialpadview/PseudoEmergencyAnimator.java
@@ -35,40 +35,40 @@ public class PseudoEmergencyAnimator {
private static final int VIBRATE_LENGTH_MILLIS = 200;
private static final int ITERATION_LENGTH_MILLIS = 1000;
private static final int ANIMATION_ITERATION_COUNT = 6;
- private ViewProvider mViewProvider;
- private ValueAnimator mPseudoEmergencyColorAnimator;
+ private ViewProvider viewProvider;
+ private ValueAnimator pseudoEmergencyColorAnimator;
PseudoEmergencyAnimator(ViewProvider viewProvider) {
- mViewProvider = viewProvider;
+ this.viewProvider = viewProvider;
}
public void destroy() {
end();
- mViewProvider = null;
+ viewProvider = null;
}
public void start() {
- if (mPseudoEmergencyColorAnimator == null) {
+ if (pseudoEmergencyColorAnimator == null) {
Integer colorFrom = Color.BLUE;
Integer colorTo = Color.RED;
- mPseudoEmergencyColorAnimator =
+ pseudoEmergencyColorAnimator =
ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
- mPseudoEmergencyColorAnimator.addUpdateListener(
+ pseudoEmergencyColorAnimator.addUpdateListener(
animator -> {
try {
int color = (int) animator.getAnimatedValue();
ColorFilter colorFilter = new LightingColorFilter(Color.BLACK, color);
- if (mViewProvider.getFab() != null) {
- mViewProvider.getFab().getBackground().setColorFilter(colorFilter);
+ if (viewProvider.getFab() != null) {
+ viewProvider.getFab().getBackground().setColorFilter(colorFilter);
}
} catch (Exception e) {
animator.cancel();
}
});
- mPseudoEmergencyColorAnimator.addListener(
+ pseudoEmergencyColorAnimator.addListener(
new AnimatorListener() {
@Override
public void onAnimationCancel(Animator animation) {}
@@ -88,8 +88,8 @@ public class PseudoEmergencyAnimator {
@Override
public void onAnimationEnd(Animator animation) {
try {
- if (mViewProvider.getFab() != null) {
- mViewProvider.getFab().getBackground().clearColorFilter();
+ if (viewProvider.getFab() != null) {
+ viewProvider.getFab().getBackground().clearColorFilter();
}
new Handler()
@@ -108,23 +108,23 @@ public class PseudoEmergencyAnimator {
}
});
- mPseudoEmergencyColorAnimator.setDuration(VIBRATE_LENGTH_MILLIS);
- mPseudoEmergencyColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
- mPseudoEmergencyColorAnimator.setRepeatCount(ANIMATION_ITERATION_COUNT);
+ pseudoEmergencyColorAnimator.setDuration(VIBRATE_LENGTH_MILLIS);
+ pseudoEmergencyColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
+ pseudoEmergencyColorAnimator.setRepeatCount(ANIMATION_ITERATION_COUNT);
}
- if (!mPseudoEmergencyColorAnimator.isStarted()) {
- mPseudoEmergencyColorAnimator.start();
+ if (!pseudoEmergencyColorAnimator.isStarted()) {
+ pseudoEmergencyColorAnimator.start();
}
}
public void end() {
- if (mPseudoEmergencyColorAnimator != null && mPseudoEmergencyColorAnimator.isStarted()) {
- mPseudoEmergencyColorAnimator.end();
+ if (pseudoEmergencyColorAnimator != null && pseudoEmergencyColorAnimator.isStarted()) {
+ pseudoEmergencyColorAnimator.end();
}
}
private void vibrate(long milliseconds) {
- Context context = mViewProvider.getContext();
+ Context context = viewProvider.getContext();
if (context != null) {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator != null) {
diff --git a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java
index 7ff0d084a..e6d405ccf 100644
--- a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java
+++ b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java
@@ -92,7 +92,7 @@ public class SpecialCharSequenceMgr {
* Phone side doesn't have this functionality. Fundamental fix would be to have one shared
* implementation and resolve this corner case more gracefully.
*/
- private static QueryHandler sPreviousAdnQueryHandler;
+ private static QueryHandler previousAdnQueryHandler;
/** This class is never instantiated. */
private SpecialCharSequenceMgr() {}
@@ -124,9 +124,9 @@ public class SpecialCharSequenceMgr {
public static void cleanup() {
Assert.isMainThread();
- if (sPreviousAdnQueryHandler != null) {
- sPreviousAdnQueryHandler.cancel();
- sPreviousAdnQueryHandler = null;
+ if (previousAdnQueryHandler != null) {
+ previousAdnQueryHandler.cancel();
+ previousAdnQueryHandler = null;
}
}
@@ -255,11 +255,11 @@ public class SpecialCharSequenceMgr {
null,
null);
- if (sPreviousAdnQueryHandler != null) {
+ if (previousAdnQueryHandler != null) {
// It is harmless to call cancel() even after the handler's gone.
- sPreviousAdnQueryHandler.cancel();
+ previousAdnQueryHandler.cancel();
}
- sPreviousAdnQueryHandler = handler;
+ previousAdnQueryHandler = handler;
}
static boolean handlePinEntry(final Context context, final String input) {
@@ -343,40 +343,40 @@ public class SpecialCharSequenceMgr {
public static class HandleAdnEntryAccountSelectedCallback extends SelectPhoneAccountListener {
- private final Context mContext;
- private final QueryHandler mQueryHandler;
- private final SimContactQueryCookie mCookie;
+ private final Context context;
+ private final QueryHandler queryHandler;
+ private final SimContactQueryCookie cookie;
public HandleAdnEntryAccountSelectedCallback(
Context context, QueryHandler queryHandler, SimContactQueryCookie cookie) {
- mContext = context;
- mQueryHandler = queryHandler;
- mCookie = cookie;
+ this.context = context;
+ this.queryHandler = queryHandler;
+ this.cookie = cookie;
}
@Override
public void onPhoneAccountSelected(
PhoneAccountHandle selectedAccountHandle, boolean setDefault, @Nullable String callId) {
- Uri uri = TelecomUtil.getAdnUriForPhoneAccount(mContext, selectedAccountHandle);
- handleAdnQuery(mQueryHandler, mCookie, uri);
+ Uri uri = TelecomUtil.getAdnUriForPhoneAccount(context, selectedAccountHandle);
+ handleAdnQuery(queryHandler, cookie, uri);
// TODO: Show error dialog if result isn't valid.
}
}
public static class HandleMmiAccountSelectedCallback extends SelectPhoneAccountListener {
- private final Context mContext;
- private final String mInput;
+ private final Context context;
+ private final String input;
public HandleMmiAccountSelectedCallback(Context context, String input) {
- mContext = context.getApplicationContext();
- mInput = input;
+ this.context = context.getApplicationContext();
+ this.input = input;
}
@Override
public void onPhoneAccountSelected(
PhoneAccountHandle selectedAccountHandle, boolean setDefault, @Nullable String callId) {
- TelecomUtil.handleMmi(mContext, mInput, selectedAccountHandle);
+ TelecomUtil.handleMmi(context, input, selectedAccountHandle);
}
}
@@ -393,16 +393,16 @@ public class SpecialCharSequenceMgr {
public int contactNum;
// Used to identify the query request.
- private int mToken;
- private QueryHandler mHandler;
+ private int token;
+ private QueryHandler handler;
// The text field we're going to update
private EditText textField;
public SimContactQueryCookie(int number, QueryHandler handler, int token) {
contactNum = number;
- mHandler = handler;
- mToken = token;
+ this.handler = handler;
+ this.token = token;
}
/** Synchronized getter for the EditText. */
@@ -431,7 +431,7 @@ public class SpecialCharSequenceMgr {
textField = null;
// Cancel the operation if possible.
- mHandler.cancelOperation(mToken);
+ handler.cancelOperation(token);
}
}
@@ -442,7 +442,7 @@ public class SpecialCharSequenceMgr {
*/
private static class QueryHandler extends NoNullCursorAsyncQueryHandler {
- private boolean mCanceled;
+ private boolean canceled;
public QueryHandler(ContentResolver cr) {
super(cr);
@@ -452,8 +452,8 @@ public class SpecialCharSequenceMgr {
@Override
protected void onNotNullableQueryComplete(int token, Object cookie, Cursor c) {
try {
- sPreviousAdnQueryHandler = null;
- if (mCanceled) {
+ previousAdnQueryHandler = null;
+ if (canceled) {
return;
}
@@ -488,7 +488,7 @@ public class SpecialCharSequenceMgr {
}
public void cancel() {
- mCanceled = true;
+ canceled = true;
// Ask AsyncQueryHandler to cancel the whole request. This will fail when the query is
// already started.
cancelOperation(ADN_QUERY_TOKEN);