summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/list/SpeedDialFragment.java
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-07-17 15:24:26 -0700
committerYorke Lee <yorkelee@google.com>2015-07-17 15:24:26 -0700
commit7e1a68556c419c4b9b1eda9247e80262615fa809 (patch)
treec7e323999268a258d22c334e92254d1b7b4354fa /src/com/android/dialer/list/SpeedDialFragment.java
parent91ecb13620df69c3865754290cfcdcf20b2968d5 (diff)
downloadandroid_packages_apps_Dialer-7e1a68556c419c4b9b1eda9247e80262615fa809.tar.gz
android_packages_apps_Dialer-7e1a68556c419c4b9b1eda9247e80262615fa809.tar.bz2
android_packages_apps_Dialer-7e1a68556c419c4b9b1eda9247e80262615fa809.zip
Refresh all contacts fragment when permission granted
Bug: 22174668 Change-Id: I6d23fb76c6b67093ee1193fba45bd20baa50a68f
Diffstat (limited to 'src/com/android/dialer/list/SpeedDialFragment.java')
-rw-r--r--src/com/android/dialer/list/SpeedDialFragment.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java
index ebfc72da0..324caefb6 100644
--- a/src/com/android/dialer/list/SpeedDialFragment.java
+++ b/src/com/android/dialer/list/SpeedDialFragment.java
@@ -25,6 +25,7 @@ import android.app.Fragment;
import android.app.LoaderManager;
import android.content.CursorLoader;
import android.content.Loader;
+import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Rect;
import android.net.Uri;
@@ -64,6 +65,8 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener,
PhoneFavoritesTileAdapter.OnDataSetChangedForAnimationListener,
EmptyContentView.OnEmptyViewActionButtonClickedListener {
+ private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1;
+
/**
* By default, the animation code assumes that all items in a list view are of the same height
* when animating new list items into view (e.g. from the bottom of the screen into view).
@@ -470,10 +473,20 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener,
}
if (!PermissionsUtil.hasPermission(activity, READ_CONTACTS)) {
- requestPermissions(new String[] {READ_CONTACTS}, 0);
+ requestPermissions(new String[] {READ_CONTACTS}, READ_CONTACTS_PERMISSION_REQUEST_CODE);
} else {
// Switch tabs
((HostInterface) activity).showAllContactsTab();
}
}
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+ if (requestCode == READ_CONTACTS_PERMISSION_REQUEST_CODE) {
+ if (grantResults.length == 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) {
+ PermissionsUtil.notifyPermissionGranted(getActivity(), READ_CONTACTS);
+ }
+ }
+ }
}