summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/add_speed_dial_dialog.xml95
-rw-r--r--res/values-zh-rCN/strings.xml6
-rw-r--r--res/values/strings.xml6
-rw-r--r--src/com/android/dialer/CallDetailActivity.java4
-rwxr-xr-xsrc/com/android/dialer/SpeedDialListActivity.java84
-rw-r--r--src/com/android/dialer/calllog/ContactInfoHelper.java4
-rw-r--r--src/com/android/dialer/callstats/CallStatsDetailActivity.java3
-rwxr-xr-xsrc/com/android/dialer/dialpad/DialpadFragment.java1
8 files changed, 198 insertions, 5 deletions
diff --git a/res/layout/add_speed_dial_dialog.xml b/res/layout/add_speed_dial_dialog.xml
new file mode 100644
index 000000000..104662620
--- /dev/null
+++ b/res/layout/add_speed_dial_dialog.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1.0"
+ android:gravity="center_vertical"
+ android:baselineAligned="false"
+ android:paddingStart="10dip"
+ android:paddingEnd="10dip">
+
+ <EditText
+ android:id="@+id/edit_container"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1.0"
+ android:orientation="vertical"
+ android:hint="@string/input_number"
+ android:inputType="phone"
+ android:singleLine="true" />
+
+ <ImageButton
+ android:id="@+id/select_contact"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="10dip"
+ android:src="@drawable/ic_contacts_holo_dark" />
+ </LinearLayout>
+
+ <View
+ android:background="?android:dividerHorizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="1dip" />
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" >
+
+ <Button
+ android:id="@+id/btn_cancel"
+ android:focusable="true"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1.0"
+ android:text="@string/speed_dial_cancel"
+ style="?android:attr/buttonBarButtonStyle" />
+
+ <View
+ android:background="?android:dividerHorizontal"
+ android:layout_width="1dip"
+ android:layout_height="fill_parent" />
+
+ <Button
+ android:id="@+id/btn_complete"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1.0"
+ android:text="@string/speed_dial_ok"
+ style="?android:attr/buttonBarButtonStyle" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 39921a83b..afc95ccf3 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
+ ~ Copyright (C) 2013-2014 The Linux Foundation. All Rights Reserved.
+ ~ Not a Contribution.
~ Copyright (C) 2012 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -226,4 +228,8 @@
<string name="video_call">视频电话</string>
<string name="menu_add_to_4g_conference_call">加入4G电话会议</string>
+ <string name="set_speed_dial">快速拨号设置</string>
+ <string name="input_number">"输入号码"</string>
+ <string name="speed_dial_cancel">"取消"</string>
+ <string name="speed_dial_ok">"确定"</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 616248d7c..cb6f85308 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
+ ~ Copyright (C) 2013-2014 The Linux Foundation. All Rights Reserved.
+ ~ Not a Contribution.
~ Copyright (C) 2012 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -847,4 +849,8 @@
<string name="firewall_save_success">Saved successfully</string>
<string name="firewall_add_blacklist_warning">if you add this number to blacklsit, you will not receive the messages and calls from it</string>
+ <string name="set_speed_dial">Speed dial settings</string>
+ <string name="input_number">Input Number</string>
+ <string name="speed_dial_cancel">Cancel</string>
+ <string name="speed_dial_ok">OK</string>
</resources>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 9c5ffcf38..7e9ca4cc2 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -76,6 +76,7 @@ import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
import com.android.dialerbind.analytics.AnalyticsActivity;
import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.util.BlacklistUtils;
import java.util.List;
@@ -638,6 +639,9 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
menu.findItem(R.id.menu_add_to_black_list).setVisible(mHasInstallFireWallOption);
menu.findItem(R.id.menu_add_to_white_list).setVisible(mHasInstallFireWallOption);
+ menu.findItem(R.id.menu_add_to_blacklist).setVisible(
+ BlacklistUtils.isBlacklistEnabled(this));
+
return super.onPrepareOptionsMenu(menu);
}
diff --git a/src/com/android/dialer/SpeedDialListActivity.java b/src/com/android/dialer/SpeedDialListActivity.java
index 1db524d9c..8156955c7 100755
--- a/src/com/android/dialer/SpeedDialListActivity.java
+++ b/src/com/android/dialer/SpeedDialListActivity.java
@@ -41,6 +41,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.Settings;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -54,6 +55,9 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.QuickContactBadge;
@@ -62,6 +66,8 @@ import android.widget.TextView;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.internal.telephony.PhoneConstants;
+import com.google.common.base.FinalizablePhantomReference;
+
import static com.android.internal.telephony.PhoneConstants.SUBSCRIPTION_KEY;
import java.util.List;
@@ -112,6 +118,9 @@ public class SpeedDialListActivity extends ListActivity implements
private int mPickNumber;
private int mInitialPickNumber;
private SpeedDialAdapter mAdapter;
+ private AlertDialog mAddSpeedDialDialog;
+ private EditText mEditNumber;
+ private Button mCompleteButton;
private static final int PICK_CONTACT_RESULT = 0;
@@ -202,6 +211,77 @@ public class SpeedDialListActivity extends ListActivity implements
return record;
}
+ private void showAddSpeedDialDialog(final int number) {
+ mPickNumber = number;
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.set_speed_dial);
+ View contentView = LayoutInflater.from(this).inflate(
+ R.layout.add_speed_dial_dialog, null);
+ builder.setView(contentView);
+ ImageButton pickContacts = (ImageButton) contentView
+ .findViewById(R.id.select_contact);
+ pickContacts.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ pickContact(number);
+ dismissDialog();
+ }
+ });
+ mEditNumber = (EditText) contentView.findViewById(R.id.edit_container);
+ if (null != mRecords.get(number)) {
+ mEditNumber.setText(SpeedDialUtils.getNumber(this, number));
+ }
+ Button cancelButton = (Button) contentView
+ .findViewById(R.id.btn_cancel);
+ cancelButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dismissDialog();
+ }
+ });
+ mCompleteButton = (Button) contentView.findViewById(R.id.btn_complete);
+ mCompleteButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mEditNumber.getText().toString().isEmpty()) {
+ dismissDialog();
+ return;
+ }
+ saveSpeedDial();
+ dismissDialog();
+ }
+ });
+ mAddSpeedDialDialog = builder.create();
+ mAddSpeedDialDialog.show();
+ }
+
+ private void saveSpeedDial() {
+ String number = mEditNumber.getText().toString();
+ Record record = null;
+ if (number != null) {
+ Uri uri = Uri.withAppendedPath(
+ ContactsContract.PhoneLookup.CONTENT_FILTER_URI,
+ Uri.encode(number));
+ record = getRecordFromQuery(uri, LOOKUP_PROJECTION);
+ if (record == null) {
+ record = new Record(number);
+ record.normalizedNumber = number;
+ }
+ }
+ if (record != null) {
+ SpeedDialUtils.saveNumber(this, mPickNumber,
+ record.normalizedNumber);
+ mRecords.put(mPickNumber, record);
+ mAdapter.notifyDataSetChanged();
+ }
+ }
+
+ private void dismissDialog() {
+ if (null != mAddSpeedDialDialog && mAddSpeedDialDialog.isShowing()) {
+ mAddSpeedDialDialog.dismiss();
+ }
+ }
+
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
@@ -224,7 +304,7 @@ public class SpeedDialListActivity extends ListActivity implements
int number = position + 1;
final Record record = mRecords.get(number);
if (record == null) {
- pickContact(number);
+ showAddSpeedDialDialog(number);
} else {
PopupMenu pm = new PopupMenu(this, view);
pm.getMenu().add(number, MENU_REPLACE, 0, R.string.speed_dial_replace);
@@ -312,7 +392,7 @@ public class SpeedDialListActivity extends ListActivity implements
switch (item.getItemId()) {
case MENU_REPLACE:
- pickContact(number);
+ showAddSpeedDialDialog(number);
return true;
case MENU_DELETE:
mRecords.put(number, null);
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 030de8c6e..51c2729ef 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -39,6 +39,7 @@ import com.android.dialer.R;
import com.android.dialer.service.CachedNumberLookupService;
import com.android.dialer.service.CachedNumberLookupService.CachedContactInfo;
import com.android.dialerbind.ObjectFactory;
+import com.android.internal.telephony.util.BlacklistUtils;
import org.json.JSONException;
import org.json.JSONObject;
@@ -341,8 +342,7 @@ public class ContactInfoHelper {
* phone blacklist is enabled
*/
public boolean canBlacklistCalls() {
- return Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.PHONE_BLACKLIST_ENABLED, 1) != 0;
+ return BlacklistUtils.isBlacklistEnabled(mContext);
}
/**
diff --git a/src/com/android/dialer/callstats/CallStatsDetailActivity.java b/src/com/android/dialer/callstats/CallStatsDetailActivity.java
index 165a5858a..128031f3e 100644
--- a/src/com/android/dialer/callstats/CallStatsDetailActivity.java
+++ b/src/com/android/dialer/callstats/CallStatsDetailActivity.java
@@ -42,6 +42,7 @@ import com.android.dialer.calllog.ContactInfoHelper;
import com.android.dialer.calllog.PhoneNumberDisplayHelper;
import com.android.dialer.calllog.PhoneNumberUtilsWrapper;
import com.android.dialer.widget.PieChartView;
+import com.android.internal.telephony.util.BlacklistUtils;
/**
* Activity to display detailed information about a callstat item
@@ -262,6 +263,8 @@ public class CallStatsDetailActivity extends Activity {
menu.findItem(R.id.menu_edit_number_before_call).setVisible(
mCallDetailHeader.canEditNumberBeforeCall());
*/
+ menu.findItem(R.id.menu_add_to_blacklist).setVisible(
+ BlacklistUtils.isBlacklistEnabled(this));
return super.onPrepareOptionsMenu(menu);
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 44ed7edc5..76ab82fed 100755
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -2012,7 +2012,6 @@ public class DialpadFragment extends AnalyticsFragment
public void onClick(DialogInterface dialog, int which) {
// go to speed dial setting screen to set speed dial number.
Intent intent = new Intent(getActivity(), SpeedDialListActivity.class);
- intent.putExtra(SpeedDialListActivity.EXTRA_INITIAL_PICK_NUMBER, number);
startActivity(intent);
}
})