Splitting Dialtacts activity into two: Dialer and Contacts
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index ea157fc..e3d0065 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -73,12 +73,12 @@
AdapterView.OnItemClickListener, TextWatcher {
private static final String TAG = "TwelveKeyDialer";
-
+
private static final int STOP_TONE = 1;
/** The length of DTMF tones in milliseconds */
private static final int TONE_LENGTH_MS = 150;
-
+
/** The DTMF tone volume relative to other sounds in the stream */
private static final int TONE_RELATIVE_VOLUME = 50;
@@ -98,7 +98,7 @@
// determines if we want to playback local DTMF tones.
private boolean mDTMFToneEnabled;
-
+
/** Identifier for the "Add Call" intent extra. */
static final String ADD_CALL_MODE_KEY = "add_call_mode";
/** Indicates if we are opening this dialer to add a call from the InCallScreen. */
@@ -133,7 +133,7 @@
public void onTextChanged(CharSequence input, int start, int before, int changeCount) {
// Do nothing
- // DTMF Tones do not need to be played here any longer -
+ // DTMF Tones do not need to be played here any longer -
// the DTMF dialer handles that functionality now.
}
@@ -191,8 +191,8 @@
view.setOnLongClickListener(this);
mDelete = view;
- mDigitsAndBackspace = (View) findViewById(R.id.digitsAndBackspace);
- mDialpad = (View) findViewById(R.id.dialpad); // This is null in landscape mode
+ mDigitsAndBackspace = findViewById(R.id.digitsAndBackspace);
+ mDialpad = findViewById(R.id.dialpad); // This is null in landscape mode
// Set up the "dialpad chooser" UI; see showDialpadChooser().
mDialpadChooser = (ListView) findViewById(R.id.dialpadChooser);
@@ -207,7 +207,7 @@
synchronized (mToneGeneratorLock) {
if (mToneGenerator == null) {
try {
- mToneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL,
+ mToneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL,
TONE_RELATIVE_VOLUME);
} catch (RuntimeException e) {
Log.w(TAG, "Exception caught while creating local tone generator: " + e);
@@ -233,13 +233,13 @@
protected void onRestoreInstanceState(Bundle icicle) {
// Do nothing, state is restored in onCreate() if needed
}
-
+
protected void maybeAddNumberFormatting() {
mDigits.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
}
-
+
/**
- * Overridden by subclasses to control the resource used by the content view.
+ * Overridden by subclasses to control the resource used by the content view.
*/
protected int getContentViewResource() {
return R.layout.twelve_key_dialer;
@@ -252,7 +252,7 @@
final Intent intent;
if (isChild()) {
intent = getParent().getIntent();
- ignoreState = intent.getBooleanExtra(DialtactsActivity.EXTRA_IGNORE_STATE, false);
+ ignoreState = intent.getBooleanExtra(DialerActivity.EXTRA_IGNORE_STATE, false);
} else {
intent = getIntent();
}
@@ -333,7 +333,7 @@
setIntent(newIntent);
resolveIntent();
}
-
+
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
@@ -344,7 +344,7 @@
// will always happen after onRestoreSavedInstanceState().
mDigits.addTextChangedListener(this);
}
-
+
private void setupKeypad() {
// Setup the listeners for the buttons
View view = findViewById(R.id.one);
@@ -371,17 +371,17 @@
@Override
protected void onResume() {
super.onResume();
-
+
// retrieve the DTMF tone play back setting.
mDTMFToneEnabled = Settings.System.getInt(getContentResolver(),
Settings.System.DTMF_TONE_WHEN_DIALING, 1) == 1;
- // if the mToneGenerator creation fails, just continue without it. It is
+ // 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.
synchronized(mToneGeneratorLock) {
if (mToneGenerator == null) {
try {
- mToneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL,
+ mToneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL,
TONE_RELATIVE_VOLUME);
} catch (RuntimeException e) {
Log.w(TAG, "Exception caught while creating local tone generator: " + e);
@@ -389,12 +389,12 @@
}
}
}
-
+
Activity parent = getParent();
// See if we were invoked with a DIAL intent. If we were, fill in the appropriate
// digits in the dialer field.
- if (parent != null && parent instanceof DialtactsActivity) {
- Uri dialUri = ((DialtactsActivity) parent).getAndClearDialUri();
+ if (parent != null && parent instanceof DialerActivity) {
+ Uri dialUri = ((DialerActivity) parent).getAndClearDialUri();
if (dialUri != null) {
resolveIntent();
}
@@ -436,7 +436,7 @@
// have a window token yet in onCreate / onNewIntent
InputMethodManager inputMethodManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
- inputMethodManager.hideSoftInputFromWindow(mDigits.getWindowToken(), 0);
+ inputMethodManager.hideSoftInputFromWindow(mDigits.getWindowToken(), 0);
}
}
@@ -503,7 +503,7 @@
return true;
}
case KeyEvent.KEYCODE_1: {
- long timeDiff = SystemClock.uptimeMillis() - event.getDownTime();
+ long timeDiff = SystemClock.uptimeMillis() - event.getDownTime();
if (timeDiff >= ViewConfiguration.getLongPressTimeout()) {
// Long press detected, call voice mail
callVoicemail();
@@ -532,7 +532,7 @@
}
return super.onKeyUp(keyCode, event);
}
-
+
private void keyPressed(int keyCode) {
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);
mDigits.onKeyDown(keyCode, event);
@@ -689,7 +689,7 @@
/**
* Play a tone for TONE_LENGTH_MS milliseconds.
- *
+ *
* @param tone a tone code from {@link ToneGenerator}
*/
void playTone(int tone) {
@@ -697,16 +697,16 @@
if (!mDTMFToneEnabled) {
return;
}
-
+
synchronized(mToneGeneratorLock) {
if (mToneGenerator == null) {
Log.w(TAG, "playTone: mToneGenerator == null, tone: "+tone);
return;
}
-
+
// Remove pending STOP_TONE messages
mToneStopper.removeMessages(STOP_TONE);
-
+
// Start the new tone (will stop any playing tone)
mToneGenerator.startTone(tone);
mToneStopper.sendEmptyMessageDelayed(STOP_TONE, TONE_LENGTH_MS);