diff options
author | keyboardr <keyboardr@google.com> | 2017-06-26 15:16:26 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2017-06-30 14:33:17 -0700 |
commit | a60579e8f6abff88814d940f9da51e22788d6007 (patch) | |
tree | 188bdb9ec664a2d572efef0f87841958fa966c9d /java/com/android/dialer/app/list | |
parent | 4b499669dde98f485199fd38883ad0dc26d1f0f3 (diff) |
All Fragments are now support library Fragments.
Switch a bunch of imports to support library Fragments (and Loaders) instead of framework Fragments (and Loaders). This was needed to use FragmentManager.isStateSaved() instead of manually tracking that state. This should reduce errors around committing after state is saved.
Also adds METADATA presubmit to prevent new usages of framework Fragments or Loaders.
Bug: 38241305
Test: Covered by existing tests.
PiperOrigin-RevId: 160202511
Change-Id: I5dc0b467da984ca571e49b4dfa0deea44eb372b2
Diffstat (limited to 'java/com/android/dialer/app/list')
7 files changed, 19 insertions, 30 deletions
diff --git a/java/com/android/dialer/app/list/AllContactsFragment.java b/java/com/android/dialer/app/list/AllContactsFragment.java index 32a99e795..19c24521a 100644 --- a/java/com/android/dialer/app/list/AllContactsFragment.java +++ b/java/com/android/dialer/app/list/AllContactsFragment.java @@ -22,13 +22,12 @@ import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.content.Loader; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.QuickContact; -import android.support.v13.app.FragmentCompat; +import android.support.v4.content.Loader; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -51,8 +50,7 @@ import java.util.Arrays; /** Fragments to show all contacts with phone numbers. */ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryListAdapter> - implements OnEmptyViewActionButtonClickedListener, - FragmentCompat.OnRequestPermissionsResultCallback { + implements OnEmptyViewActionButtonClickedListener { private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; @@ -182,8 +180,7 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi LogUtil.i( "AllContactsFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions( - this, deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); + requestPermissions(deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); } else { // Add new contact DialerUtils.startActivityWithErrorToast( diff --git a/java/com/android/dialer/app/list/DialtactsPagerAdapter.java b/java/com/android/dialer/app/list/DialtactsPagerAdapter.java index 822aa789f..52519f8d1 100644 --- a/java/com/android/dialer/app/list/DialtactsPagerAdapter.java +++ b/java/com/android/dialer/app/list/DialtactsPagerAdapter.java @@ -16,11 +16,11 @@ package com.android.dialer.app.list; -import android.app.Fragment; -import android.app.FragmentManager; import android.content.Context; import android.support.annotation.IntDef; -import android.support.v13.app.FragmentPagerAdapter; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentPagerAdapter; import android.view.ViewGroup; import com.android.dialer.app.calllog.CallLogFragment; import com.android.dialer.app.calllog.VisualVoicemailCallLogFragment; diff --git a/java/com/android/dialer/app/list/ListsFragment.java b/java/com/android/dialer/app/list/ListsFragment.java index 3f03db1e8..8e9438573 100644 --- a/java/com/android/dialer/app/list/ListsFragment.java +++ b/java/com/android/dialer/app/list/ListsFragment.java @@ -22,7 +22,6 @@ import static com.android.dialer.app.list.DialtactsPagerAdapter.TAB_INDEX_HISTOR import static com.android.dialer.app.list.DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL; import static com.android.dialer.app.list.DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL; -import android.app.Fragment; import android.content.SharedPreferences; import android.database.ContentObserver; import android.database.Cursor; @@ -31,6 +30,7 @@ import android.os.Handler; import android.os.Trace; import android.preference.PreferenceManager; import android.provider.VoicemailContract; +import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.LayoutInflater; import android.view.View; diff --git a/java/com/android/dialer/app/list/OldSpeedDialFragment.java b/java/com/android/dialer/app/list/OldSpeedDialFragment.java index 05d017b28..986c51cfd 100644 --- a/java/com/android/dialer/app/list/OldSpeedDialFragment.java +++ b/java/com/android/dialer/app/list/OldSpeedDialFragment.java @@ -21,17 +21,16 @@ import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; -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; import android.os.Bundle; import android.os.Trace; -import android.support.v13.app.FragmentCompat; +import android.support.v4.app.Fragment; +import android.support.v4.app.LoaderManager; +import android.support.v4.content.CursorLoader; +import android.support.v4.content.Loader; import android.support.v4.util.LongSparseArray; import android.view.LayoutInflater; import android.view.View; @@ -62,8 +61,7 @@ import java.util.Arrays; public class OldSpeedDialFragment extends Fragment implements OnItemClickListener, PhoneFavoritesTileAdapter.OnDataSetChangedForAnimationListener, - EmptyContentView.OnEmptyViewActionButtonClickedListener, - FragmentCompat.OnRequestPermissionsResultCallback { + EmptyContentView.OnEmptyViewActionButtonClickedListener { private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1; @@ -411,8 +409,7 @@ public class OldSpeedDialFragment extends Fragment LogUtil.i( "OldSpeedDialFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions( - this, deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); + requestPermissions(deniedPermissions, READ_CONTACTS_PERMISSION_REQUEST_CODE); } else { // Switch tabs ((HostInterface) activity).showAllContactsTab(); diff --git a/java/com/android/dialer/app/list/RegularSearchFragment.java b/java/com/android/dialer/app/list/RegularSearchFragment.java index 728948bfc..c45f78390 100644 --- a/java/com/android/dialer/app/list/RegularSearchFragment.java +++ b/java/com/android/dialer/app/list/RegularSearchFragment.java @@ -19,7 +19,6 @@ import static android.Manifest.permission.READ_CONTACTS; import android.app.Activity; import android.content.pm.PackageManager; -import android.support.v13.app.FragmentCompat; import android.view.LayoutInflater; import android.view.ViewGroup; import com.android.contacts.common.list.ContactEntryListAdapter; @@ -35,8 +34,7 @@ import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClicked import java.util.Arrays; public class RegularSearchFragment extends SearchFragment - implements OnEmptyViewActionButtonClickedListener, - FragmentCompat.OnRequestPermissionsResultCallback { + implements OnEmptyViewActionButtonClickedListener { public static final int PERMISSION_REQUEST_CODE = 1; @@ -123,7 +121,7 @@ public class RegularSearchFragment extends SearchFragment LogUtil.i( "RegularSearchFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions(this, deniedPermissions, PERMISSION_REQUEST_CODE); + requestPermissions(deniedPermissions, PERMISSION_REQUEST_CODE); } } } diff --git a/java/com/android/dialer/app/list/SearchFragment.java b/java/com/android/dialer/app/list/SearchFragment.java index 00a2708a1..a8a7347ae 100644 --- a/java/com/android/dialer/app/list/SearchFragment.java +++ b/java/com/android/dialer/app/list/SearchFragment.java @@ -19,10 +19,10 @@ import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; import android.app.Activity; -import android.app.DialogFragment; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; +import android.support.v4.app.DialogFragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; diff --git a/java/com/android/dialer/app/list/SmartDialSearchFragment.java b/java/com/android/dialer/app/list/SmartDialSearchFragment.java index 2ebc06bc3..f2969cf57 100644 --- a/java/com/android/dialer/app/list/SmartDialSearchFragment.java +++ b/java/com/android/dialer/app/list/SmartDialSearchFragment.java @@ -22,10 +22,9 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.Loader; import android.database.Cursor; import android.os.Bundle; -import android.support.v13.app.FragmentCompat; +import android.support.v4.content.Loader; import com.android.contacts.common.list.ContactEntryListAdapter; import com.android.dialer.app.R; import com.android.dialer.app.dialpad.SmartDialCursorLoader; @@ -38,8 +37,7 @@ import java.util.Arrays; /** Implements a fragment to load and display SmartDial search results. */ public class SmartDialSearchFragment extends SearchFragment - implements EmptyContentView.OnEmptyViewActionButtonClickedListener, - FragmentCompat.OnRequestPermissionsResultCallback { + implements EmptyContentView.OnEmptyViewActionButtonClickedListener { private static final int CALL_PHONE_PERMISSION_REQUEST_CODE = 1; @@ -136,8 +134,7 @@ public class SmartDialSearchFragment extends SearchFragment LogUtil.i( "SmartDialSearchFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions( - this, deniedPermissions, CALL_PHONE_PERMISSION_REQUEST_CODE); + requestPermissions(deniedPermissions, CALL_PHONE_PERMISSION_REQUEST_CODE); } } |