Merge "Import translations. DO NOT MERGE"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c576cd7..8c97265 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -183,6 +183,14 @@
android:theme="@style/NewDialtactsTheme"
android:screenOrientation="portrait"
android:icon="@mipmap/ic_launcher_phone">
+ <!--
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:mimeType="vnd.android.cursor.dir/calls" />
+ </intent-filter>
+ -->
</activity>
<activity android:name="com.android.dialer.CallDetailActivity"
diff --git a/res/layout/dialpad_key.xml b/res/layout/dialpad_key.xml
new file mode 100644
index 0000000..eef12a1
--- /dev/null
+++ b/res/layout/dialpad_key.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- A layout representing a single key in the dialpad -->
+<com.android.dialer.dialpad.DialpadKeyButton
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/dialpad_key"
+ style="@style/DialtactsDialpadButtonStyle"
+ android:clickable="true" >
+ <TextView
+ android:id="@+id/dialpad_key_number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#33b5e5"
+ android:textSize="40dp"
+ android:fontFamily="sans-serif-light"
+ android:layout_centerInParent="true"
+ />
+ <TextView
+ android:id="@+id/dialpad_key_letters"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="#aaaaaa"
+ android:textSize="11dp"
+ android:paddingRight="11dp"
+ android:layout_alignBaseline="@id/dialpad_key_number"
+ android:fontFamily="sans-serif-light"
+ android:layout_alignParentRight="true"
+ />
+</com.android.dialer.dialpad.DialpadKeyButton>
\ No newline at end of file
diff --git a/res/layout/new_dialpad.xml b/res/layout/new_dialpad.xml
index 29f9cf0..e71d4ed 100644
--- a/res/layout/new_dialpad.xml
+++ b/res/layout/new_dialpad.xml
@@ -26,73 +26,38 @@
android:paddingStart="5dip"
android:paddingEnd="5dip"
android:paddingBottom="10dip"
+ android:stretchColumns="0,1,2"
android:layoutDirection="ltr" >
<TableRow
android:layout_height="0px"
android:layout_weight="1">
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/one" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_1_wht"
- android:contentDescription="@string/description_image_button_one" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/two" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_2_wht"
- android:contentDescription="@string/description_image_button_two" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/three" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_3_wht"
- android:contentDescription="@string/description_image_button_three" />
+ <include layout="@layout/dialpad_key" android:id="@+id/one"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/two"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/three"/>
</TableRow>
<TableRow
android:layout_height="0px"
android:layout_weight="1">
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/four" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_4_wht"
- android:contentDescription="@string/description_image_button_four" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/five" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_5_wht"
- android:contentDescription="@string/description_image_button_five" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/six" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_6_wht"
- android:contentDescription="@string/description_image_button_six" />
+ <include layout="@layout/dialpad_key" android:id="@+id/four"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/five"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/six"/>
</TableRow>
<TableRow
android:layout_height="0px"
android:layout_weight="1">
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/seven" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_7_wht"
- android:contentDescription="@string/description_image_button_seven" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/eight" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_8_wht"
- android:contentDescription="@string/description_image_button_eight" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/nine" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_9_wht"
- android:contentDescription="@string/description_image_button_nine" />
+ <include layout="@layout/dialpad_key" android:id="@+id/seven"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/eight"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/nine"/>
</TableRow>
<TableRow
android:layout_height="0px"
android:layout_weight="1">
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/star" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_star_wht"
- android:contentDescription="@string/description_image_button_star" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/zero" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_0_wht"
- android:contentDescription="@string/description_image_button_zero" />
- <com.android.dialer.dialpad.DialpadImageButton
- android:id="@+id/pound" style="@style/DialtactsDialpadButtonStyle"
- android:src="@drawable/dial_num_pound_wht"
- android:contentDescription="@string/description_image_button_pound" />
+ <include layout="@layout/dialpad_key" android:id="@+id/star"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/zero"/>
+ <include layout="@layout/dialpad_key" android:id="@+id/pound"/>
</TableRow>
</TableLayout>
diff --git a/res/layout/new_dialpad_fragment.xml b/res/layout/new_dialpad_fragment.xml
index 2026781..c357d47 100644
--- a/res/layout/new_dialpad_fragment.xml
+++ b/res/layout/new_dialpad_fragment.xml
@@ -19,7 +19,7 @@
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- spacer view -->
- <View
+ <Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
@@ -119,4 +119,4 @@
/>
</LinearLayout>
-</view>
\ No newline at end of file
+</view>
diff --git a/res/layout/new_phone_favorites_fragment.xml b/res/layout/new_phone_favorites_fragment.xml
index 9974adf..cc11ea1 100644
--- a/res/layout/new_phone_favorites_fragment.xml
+++ b/res/layout/new_phone_favorites_fragment.xml
@@ -22,7 +22,8 @@
android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="end"
- android:clipChildren="false">
+ android:clipChildren="false"
+ android:background="@color/background_dialer_light">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e9f2ce0..452bb31 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -34,7 +34,7 @@
<dimen name="call_log_call_action_width">48dip</dimen>
<dimen name="call_log_icon_margin">4dip</dimen>
<dimen name="call_log_inner_margin">8dip</dimen>
- <dimen name="call_log_outer_margin">16dip</dimen>
+ <dimen name="call_log_outer_margin">8dip</dimen>
<dimen name="call_log_indent_margin">24dip</dimen>
<dimen name="call_log_list_item_height">56dip</dimen>
<dimen name="call_log_list_contact_photo_size">64dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c7e1b86..7d4a4d9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -527,6 +527,10 @@
[CHAR LIMIT=15] -->
<string name="call_log_missed_title">Missed</string>
+ <!-- String resource for the font-family to use for the call log activity's title
+ Do not translate. -->
+ <string name="call_log_activity_title_font_family">sans-serif-light</string>
+
<!-- Text displayed when the list of missed calls is empty -->
<string name="recentMissed_empty">No recent missed calls.</string>
@@ -541,4 +545,53 @@
<!-- Title of activity that displays a list of all calls -->
<string name="call_log_activity_title">History</string>
+
+ <!-- Do not translate. -->
+ <string name="dialpad_0_number">0</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_0_letters">+</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_1_number">1</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_1_letters"></string>
+ <!-- Do not translate. -->
+ <string name="dialpad_2_number">2</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_2_letters">ABC</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_3_number">3</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_3_letters">DEF</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_4_number">4</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_4_letters">GHI</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_5_number">5</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_5_letters">JKL</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_6_number">6</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_6_letters">MNO</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_7_number">7</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_7_letters">PQRS</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_8_number">8</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_8_letters">TUV</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_9_number">9</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_9_letters">WXYZ</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_star_number">*</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_star_letters"></string>
+ <!-- Do not translate. -->
+ <string name="dialpad_pound_number">#</string>
+ <!-- Do not translate. -->
+ <string name="dialpad_pound_letters"></string>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0cdf223..86df4ae 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -73,7 +73,6 @@
<item name="android:actionBarStyle">@style/DialtactsActionBarStyleNew</item>
<item name="android:actionBarTabStyle">@style/DialtactsActionBarTabStyle</item>
<item name="android:windowContentOverlay">@null</item>
- <item name="android:windowBackground">@color/background_dialer_light</item>
<!-- Searchbox Style -->
<item name="android:editTextStyle">@style/DialtactsSearchboxStyle</item>
<item name="android:listViewStyle">@style/ListViewStyle</item>
@@ -81,9 +80,9 @@
<item name="section_header_background">@drawable/list_title_holo</item>
<item name="list_section_header_height">32dip</item>
<item name="list_item_divider">?android:attr/listDivider</item>
- <item name="list_item_padding_top">0dip</item>
+ <item name="list_item_padding_top">8dip</item>
<item name="list_item_padding_right">0dip</item>
- <item name="list_item_padding_bottom">0dip</item>
+ <item name="list_item_padding_bottom">8dip</item>
<item name="list_item_padding_left">0dip</item>
<item name="list_item_gap_between_image_and_text">8dip</item>
<item name="list_item_gap_between_label_and_data">5dip</item>
@@ -100,7 +99,7 @@
<item name="list_item_header_underline_color">@color/people_app_theme_color</item>
<item name="list_item_data_width_weight">5</item>
<item name="list_item_label_width_weight">3</item>
- <item name="contact_browser_list_padding_left">16dip</item>
+ <item name="contact_browser_list_padding_left">8dip</item>
<item name="contact_browser_list_padding_right">0dip</item>
<item name="contact_browser_background">@android:color/transparent</item>
<item name="list_item_text_indent">@dimen/contact_browser_list_item_text_indent</item>
diff --git a/src/com/android/dialer/NewDialtactsActivity.java b/src/com/android/dialer/NewDialtactsActivity.java
index 4b9a82d..6d2bb3f 100644
--- a/src/com/android/dialer/NewDialtactsActivity.java
+++ b/src/com/android/dialer/NewDialtactsActivity.java
@@ -38,6 +38,7 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents.UI;
import android.provider.Settings;
+import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -107,14 +108,6 @@
*/
private static final String ACTION_TOUCH_DIALER = "com.android.phone.action.TOUCH_DIALER";
- private SharedPreferences mPrefs;
-
- public static final String SHARED_PREFS_NAME = "com.android.dialer_preferences";
-
- /** Last manually selected tab index */
- private static final String PREF_LAST_MANUALLY_SELECTED_TAB =
- "DialtactsActivity_last_manually_selected_tab";
-
private static final int SUBACTIVITY_ACCOUNT_FILTER = 1;
private String mFilterText;
@@ -156,12 +149,6 @@
private EditText mSearchView;
/**
- * The index of the Fragment (or, the tab) that has last been manually selected.
- * This value does not keep track of programmatically set Tabs (e.g. Call Log after a Call)
- */
- private int mLastManuallySelectedFragment;
-
- /**
* Listener used when one of phone numbers in search UI is selected. This will initiate a
* phone call using the phone number.
*/
@@ -196,7 +183,13 @@
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
- final boolean smartDialSearch = isDialpadShowing();
+ // TODO krelease: populate the search fragments with the correct
+ // search query at the correct point in time of the fragment lifecycle.
+ // The current behavior is to simply return to the favorites screen
+ // (when docked), or returning to the Dialer after it has been
+ // swapped out of memory.
+ if (mDialpadFragment == null) return;
+ final boolean smartDialSearch = isDialpadShowing();
final String newText = s.toString();
// Show search result with non-empty text. Show a bare list otherwise.
if (TextUtils.isEmpty(newText) && mInSearchUi) {
@@ -207,7 +200,7 @@
enterSearchUi(smartDialSearch);
}
- if (isDialpadShowing()) {
+ if (smartDialSearch) {
mSmartDialSearchFragment.setQueryString(newText, false);
} else {
mRegularSearchFragment.setQueryString(newText, false);
@@ -222,7 +215,7 @@
};
private boolean isDialpadShowing() {
- return mDialpadFragment.isVisible();
+ return mDialpadFragment != null && mDialpadFragment.isVisible();
}
@Override
@@ -236,37 +229,29 @@
getActionBar().hide();
- mPhoneFavoriteFragment = new NewPhoneFavoriteFragment();
- mPhoneFavoriteFragment.setListener(mPhoneFavoriteListener);
+ if (savedInstanceState == null) {
+ mPhoneFavoriteFragment = new NewPhoneFavoriteFragment();
+ mPhoneFavoriteFragment.setRetainInstance(true);
+ mPhoneFavoriteFragment.setListener(mPhoneFavoriteListener);
- mRegularSearchFragment = new NewSearchFragment();
- mSmartDialSearchFragment = new SmartDialSearchFragment();
- mDialpadFragment = new NewDialpadFragment();
+ mRegularSearchFragment = new NewSearchFragment();
+ mSmartDialSearchFragment = new SmartDialSearchFragment();
+ mDialpadFragment = new NewDialpadFragment();
- // TODO krelease: load fragments on demand instead of creating all of them at run time
- final FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.add(R.id.dialtacts_frame, mPhoneFavoriteFragment, TAG_FAVORITES_FRAGMENT);
- ft.add(R.id.dialtacts_frame, mRegularSearchFragment, TAG_REGULAR_SEARCH_FRAGMENT);
- ft.add(R.id.dialtacts_frame, mSmartDialSearchFragment, TAG_SMARTDIAL_SEARCH_FRAGMENT);
- ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
- ft.hide(mRegularSearchFragment);
- ft.hide(mDialpadFragment);
- ft.hide(mSmartDialSearchFragment);
- ft.commit();
+ // TODO krelease: load fragments on demand instead of creating all of them at run time
+ final FragmentTransaction ft = getFragmentManager().beginTransaction();
+ ft.add(R.id.dialtacts_frame, mPhoneFavoriteFragment, TAG_FAVORITES_FRAGMENT);
+ ft.add(R.id.dialtacts_frame, mRegularSearchFragment, TAG_REGULAR_SEARCH_FRAGMENT);
+ ft.add(R.id.dialtacts_frame, mSmartDialSearchFragment, TAG_SMARTDIAL_SEARCH_FRAGMENT);
+ ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
+ // Fragments will be hidden as necessary in onAttachFragment
+ ft.commit();
+ }
mBottomPaddingView = findViewById(R.id.dialtacts_bottom_padding);
prepareSearchView();
- // Load the last manually loaded tab
- mPrefs = this.getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE);
-
- /*
- * TODO krelease : Remember which fragment was last displayed, and then redisplay it as
- * necessary. mLastManuallySelectedFragment = mPrefs.getInt(PREF_LAST_MANUALLY_SELECTED_TAB,
- * PREF_LAST_MANUALLY_SELECTED_TAB_DEFAULT); if (mLastManuallySelectedFragment >=
- * TAB_INDEX_COUNT) { // Stored value may have exceeded the number of current tabs. Reset
- * it. mLastManuallySelectedFragment = PREF_LAST_MANUALLY_SELECTED_TAB_DEFAULT; }
- */
+ displayFragment(intent);
if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())
&& savedInstanceState == null) {
@@ -286,21 +271,23 @@
TAG_REGULAR_SEARCH_FRAGMENT);
mRegularSearchFragment.setOnPhoneNumberPickerActionListener(
mPhoneNumberPickerActionListener);
- if (!mRegularSearchFragment.isHidden()) {
- final FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.hide(mRegularSearchFragment);
- transaction.commit();
- }
mSmartDialSearchFragment = (SmartDialSearchFragment) fm.findFragmentByTag(
TAG_SMARTDIAL_SEARCH_FRAGMENT);
mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(
mPhoneNumberPickerActionListener);
- if (!mSmartDialSearchFragment.isHidden()) {
+ }
+
+ @Override
+ public void onAttachFragment(Fragment fragment) {
+ if (fragment instanceof NewDialpadFragment || fragment instanceof NewSearchFragment
+ || fragment instanceof SmartDialSearchFragment) {
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.hide(mSmartDialSearchFragment);
+ transaction.hide(fragment);
transaction.commit();
}
+ // TODO krelease: Save some kind of state here to show the appropriate fragment
+ // based on the state of the dialer when it was last paused
}
@Override
@@ -346,10 +333,13 @@
break;
}
case R.id.dialpad_button:
- showDialpadFragment();
+ showDialpadFragment(true);
break;
case R.id.call_history_on_dialpad_button:
case R.id.call_history_button:
+ // TODO krelease: This should start an intent with content type
+ // CallLog.Calls.CONTENT_TYPE, once the intent filters for the call log activity
+ // is enabled
final Intent intent = new Intent(this, NewCallLogActivity.class);
startActivity(intent);
break;
@@ -366,16 +356,20 @@
}
}
- private void showDialpadFragment() {
+ private void showDialpadFragment(boolean animate) {
final FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.setCustomAnimations(R.anim.slide_in, 0);
+ if (animate) {
+ ft.setCustomAnimations(R.anim.slide_in, 0);
+ }
ft.show(mDialpadFragment);
ft.commit();
}
- private void hideDialpadFragment() {
+ private void hideDialpadFragment(boolean animate) {
final FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.setCustomAnimations(0, R.anim.slide_out);
+ if (animate) {
+ ft.setCustomAnimations(0, R.anim.slide_out);
+ }
ft.hide(mDialpadFragment);
ft.commit();
}
@@ -400,7 +394,7 @@
private void hideDialpadFragmentIfNecessary() {
if (mDialpadFragment.isVisible()) {
- hideDialpadFragment();
+ hideDialpadFragment(true);
}
}
@@ -412,6 +406,11 @@
};
public void hideSearchBar() {
+ // If the favorites fragment hasn't been fully created before the dialpad fragment
+ // is hidden (i.e. onResume), don't bother animating
+ if (mPhoneFavoriteFragment == null || mPhoneFavoriteFragment.getView() == null) {
+ return;
+ }
mSearchViewContainer.animate().cancel();
mSearchViewContainer.setAlpha(1);
mSearchViewContainer.setTranslationY(0);
@@ -430,6 +429,11 @@
}
public void showSearchBar() {
+ // If the favorites fragment hasn't been fully created before the dialpad fragment
+ // is hidden (i.e. onResume), don't bother animating
+ if (mPhoneFavoriteFragment == null || mPhoneFavoriteFragment.getView() == null) {
+ return;
+ }
mSearchViewContainer.animate().cancel();
mSearchViewContainer.setAlpha(0);
mSearchViewContainer.setTranslationY(-mSearchViewContainer.getHeight());
@@ -481,19 +485,6 @@
callhistoryButton.setOnClickListener(this);
}
- @Override
- protected void onPause() {
- super.onPause();
- mPrefs.edit().putInt(PREF_LAST_MANUALLY_SELECTED_TAB, mLastManuallySelectedFragment)
- .apply();
- requestBackup();
- }
-
- private void requestBackup() {
- final BackupManager bm = new BackupManager(this);
- bm.dataChanged();
- }
-
private void fixIntent(Intent intent) {
// This should be cleaned up: the call key used to send an Intent
// that just said to go to the recent calls list. It now sends this
@@ -547,6 +538,14 @@
finish();
return;
}
+
+ if ((mDialpadFragment != null && phoneIsInUse())
+ || isDialIntent(intent)) {
+ mDialpadFragment.setStartedFromNewIntent(true);
+ // TODO krelease: This should use showDialpadFragment(false) to avoid animating
+ // the dialpad in. Need to fix the onPreDrawListener in NewDialpadFragment first.
+ showDialpadFragment(true);
+ }
}
@Override
@@ -555,9 +554,7 @@
fixIntent(newIntent);
displayFragment(newIntent);
final String action = newIntent.getAction();
- if (UI.FILTER_CONTACTS_ACTION.equals(action)) {
- setupFilterText(newIntent);
- }
+
if (mInSearchUi || (mRegularSearchFragment != null && mRegularSearchFragment.isVisible())) {
exitSearchUi();
}
@@ -724,7 +721,7 @@
@Override
public void onBackPressed() {
if (mDialpadFragment.isVisible()) {
- hideDialpadFragment();
+ hideDialpadFragment(true);
} else if (mInSearchUi) {
mSearchView.setText(null);
} else if (isTaskRoot()) {
@@ -765,5 +762,9 @@
setupFakeActionBarItemsForDialpadFragment();
}
-
+ private boolean phoneIsInUse() {
+ final TelephonyManager tm = (TelephonyManager) getSystemService(
+ Context.TELEPHONY_SERVICE);
+ return tm.getCallState() != TelephonyManager.CALL_STATE_IDLE;
+ }
}
diff --git a/src/com/android/dialer/NewSearchFragment.java b/src/com/android/dialer/NewSearchFragment.java
index c428db2..0ddee42 100644
--- a/src/com/android/dialer/NewSearchFragment.java
+++ b/src/com/android/dialer/NewSearchFragment.java
@@ -16,16 +16,12 @@
package com.android.dialer;
import android.app.Activity;
-import android.os.Bundle;
import android.view.LayoutInflater;
-import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
-import android.widget.ListView;
import com.android.contacts.common.list.ContactListItemView;
-import com.android.contacts.common.list.PhoneNumberListAdapter;
import com.android.contacts.common.list.PhoneNumberPickerFragment;
import com.android.dialer.list.OnListFragmentScrolledListener;
diff --git a/src/com/android/dialer/calllog/NewCallLogActivity.java b/src/com/android/dialer/calllog/NewCallLogActivity.java
index a25729a..d8724cf 100644
--- a/src/com/android/dialer/calllog/NewCallLogActivity.java
+++ b/src/com/android/dialer/calllog/NewCallLogActivity.java
@@ -29,6 +29,9 @@
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.TypefaceSpan;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -119,6 +122,11 @@
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
+ final SpannableString s = new SpannableString(getString(R.string.call_log_activity_title));
+ s.setSpan(new TypefaceSpan(getString(R.string.call_log_activity_title_font_family)), 0,
+ s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ actionBar.setTitle(s);
+
final Tab allTab = actionBar.newTab();
final String allTitle = getString(R.string.call_log_all_title);
allTab.setContentDescription(allTitle);
diff --git a/src/com/android/dialer/dialpad/DialpadKeyButton.java b/src/com/android/dialer/dialpad/DialpadKeyButton.java
new file mode 100644
index 0000000..9aae631
--- /dev/null
+++ b/src/com/android/dialer/dialpad/DialpadKeyButton.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.dialpad;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityManager;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.RelativeLayout;
+
+/**
+ * Custom class for dialpad buttons.
+ * <p>
+ * This class implements lift-to-type interaction when touch exploration is
+ * enabled.
+ */
+public class DialpadKeyButton extends RelativeLayout {
+ /** Accessibility manager instance used to check touch exploration state. */
+ private AccessibilityManager mAccessibilityManager;
+
+ /** Bounds used to filter HOVER_EXIT events. */
+ private Rect mHoverBounds = new Rect();
+
+ public interface OnPressedListener {
+ public void onPressed(View view, boolean pressed);
+ }
+
+ private OnPressedListener mOnPressedListener;
+
+ public void setOnPressedListener(OnPressedListener onPressedListener) {
+ mOnPressedListener = onPressedListener;
+ }
+
+ public DialpadKeyButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ initForAccessibility(context);
+ }
+
+ public DialpadKeyButton(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ initForAccessibility(context);
+ }
+
+ private void initForAccessibility(Context context) {
+ mAccessibilityManager = (AccessibilityManager) context.getSystemService(
+ Context.ACCESSIBILITY_SERVICE);
+ }
+
+ @Override
+ public void setPressed(boolean pressed) {
+ super.setPressed(pressed);
+ if (mOnPressedListener != null) {
+ mOnPressedListener.onPressed(this, pressed);
+ }
+ }
+
+ @Override
+ 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();
+ }
+
+ @Override
+ public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (action == AccessibilityNodeInfo.ACTION_CLICK) {
+ simulateClickForAccessibility();
+ return true;
+ }
+
+ return super.performAccessibilityAction(action, arguments);
+ }
+
+ @Override
+ 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()) {
+ switch (event.getActionMasked()) {
+ case MotionEvent.ACTION_HOVER_ENTER:
+ // Lift-to-type temporarily disables double-tap activation.
+ setClickable(false);
+ break;
+ case MotionEvent.ACTION_HOVER_EXIT:
+ if (mHoverBounds.contains((int) event.getX(), (int) event.getY())) {
+ simulateClickForAccessibility();
+ }
+ setClickable(true);
+ break;
+ }
+ }
+
+ return super.onHoverEvent(event);
+ }
+
+ /**
+ * When accessibility is on, simulate press and release to preserve the
+ * semantic meaning of performClick(). Required for Braille support.
+ */
+ private void simulateClickForAccessibility() {
+ // Checking the press state prevents double activation.
+ if (isPressed()) {
+ return;
+ }
+
+ setPressed(true);
+
+ // Stay consistent with performClick() by sending the event after
+ // setting the pressed state but before performing the action.
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
+
+ setPressed(false);
+ }
+}
diff --git a/src/com/android/dialer/dialpad/NewDialpadFragment.java b/src/com/android/dialer/dialpad/NewDialpadFragment.java
index d7bc3f9..659c608 100644
--- a/src/com/android/dialer/dialpad/NewDialpadFragment.java
+++ b/src/com/android/dialer/dialpad/NewDialpadFragment.java
@@ -69,6 +69,7 @@
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupMenu;
+import android.widget.TableRow;
import android.widget.TextView;
import com.android.contacts.common.CallUtil;
@@ -98,7 +99,7 @@
View.OnLongClickListener, View.OnKeyListener,
AdapterView.OnItemClickListener, TextWatcher,
PopupMenu.OnMenuItemClickListener,
- DialpadImageButton.OnPressedListener {
+ DialpadKeyButton.OnPressedListener {
private static final String TAG = NewDialpadFragment.class.getSimpleName();
public interface OnDialpadFragmentStartedListener {
@@ -158,8 +159,6 @@
private OnDialpadQueryChangedListener mDialpadQueryListener;
- private View mFragmentView;
-
/**
* View (usually FrameLayout) containing mDigits field. This can be null, in which mDigits
* isn't enclosed by the container.
@@ -343,22 +342,22 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
- View fragmentView = inflater.inflate(R.layout.new_dialpad_fragment, container, false);
- mFragmentView = fragmentView;
- mFragmentView.buildLayer();
+ final View fragmentView = inflater.inflate(R.layout.new_dialpad_fragment, container,
+ false);
+ fragmentView.buildLayer();
// TODO krelease: Get rid of this ugly hack which is to prevent the first frame of the
// animation from drawing the fragment at translationY = 0
- final ViewTreeObserver vto = mFragmentView.getViewTreeObserver();
+ final ViewTreeObserver vto = fragmentView.getViewTreeObserver();
final OnPreDrawListener preDrawListener = new OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (isHidden()) return true;
- if (mFragmentView.getTranslationY() == 0) {
- ((DialpadSlidingLinearLayout) mFragmentView).setYFraction(0.67f);
+ if (fragmentView.getTranslationY() == 0) {
+ ((DialpadSlidingLinearLayout) fragmentView).setYFraction(0.67f);
}
- final ViewTreeObserver vto = mFragmentView.getViewTreeObserver();
+ final ViewTreeObserver vto = fragmentView.getViewTreeObserver();
vto.removeOnPreDrawListener(this);
return true;
}
@@ -510,11 +509,10 @@
*/
private void configureScreenFromIntent(Activity parent) {
// If we were not invoked with a DIAL intent,
- if (!(parent instanceof DialtactsActivity)) {
+ if (!(parent instanceof NewDialtactsActivity)) {
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();
@@ -580,10 +578,34 @@
}
private void setupKeypad(View fragmentView) {
- int[] buttonIds = new int[] { R.id.one, R.id.two, R.id.three, R.id.four, R.id.five,
- R.id.six, R.id.seven, R.id.eight, R.id.nine, R.id.zero, R.id.star, R.id.pound};
- for (int id : buttonIds) {
- ((DialpadImageButton) fragmentView.findViewById(id)).setOnPressedListener(this);
+ final int[] buttonIds = new int[] {R.id.zero, R.id.one, R.id.two, R.id.three, R.id.four,
+ R.id.five, R.id.six, R.id.seven, R.id.eight, R.id.nine, R.id.star, R.id.pound};
+
+ final int[] numberIds = new int[] {R.string.dialpad_0_number, R.string.dialpad_1_number,
+ R.string.dialpad_2_number, R.string.dialpad_3_number, R.string.dialpad_4_number,
+ R.string.dialpad_5_number, R.string.dialpad_6_number, R.string.dialpad_7_number,
+ R.string.dialpad_8_number, R.string.dialpad_9_number, R.string.dialpad_star_number,
+ R.string.dialpad_pound_number};
+
+ final int[] letterIds = new int[] {R.string.dialpad_0_letters, R.string.dialpad_1_letters,
+ R.string.dialpad_2_letters, R.string.dialpad_3_letters, R.string.dialpad_4_letters,
+ R.string.dialpad_5_letters, R.string.dialpad_6_letters, R.string.dialpad_7_letters,
+ R.string.dialpad_8_letters, R.string.dialpad_9_letters,
+ R.string.dialpad_star_letters, R.string.dialpad_pound_letters};
+
+ DialpadKeyButton dialpadKey;
+ TextView numberView;
+ TextView lettersView;
+ final Resources resources = getResources();
+ for (int i = 0; i < buttonIds.length; i++) {
+ dialpadKey = (DialpadKeyButton) fragmentView.findViewById(buttonIds[i]);
+ dialpadKey.setLayoutParams(new TableRow.LayoutParams(
+ TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT));
+ dialpadKey.setOnPressedListener(this);
+ numberView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_number);
+ lettersView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_letters);
+ numberView.setText(resources.getString(numberIds[i]));
+ lettersView.setText(resources.getString(letterIds[i]));
}
// Long-pressing one button will initiate Voicemail.