From a60579e8f6abff88814d940f9da51e22788d6007 Mon Sep 17 00:00:00 2001 From: keyboardr Date: Mon, 26 Jun 2017 15:16:26 -0700 Subject: 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 --- .../android/dialer/app/calllog/CallLogFragment.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'java/com/android/dialer/app/calllog/CallLogFragment.java') diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index aa765d90e..49ed31e3f 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -19,7 +19,6 @@ package com.android.dialer.app.calllog; import static android.Manifest.permission.READ_CALL_LOG; import android.app.Activity; -import android.app.Fragment; import android.app.KeyguardManager; import android.content.ContentResolver; import android.content.Context; @@ -34,9 +33,7 @@ import android.provider.CallLog.Calls; import android.provider.ContactsContract; import android.support.annotation.CallSuper; import android.support.annotation.Nullable; -import android.support.v13.app.FragmentCompat; -import android.support.v13.app.FragmentCompat.OnRequestPermissionsResultCallback; -import android.support.v7.app.AppCompatActivity; +import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -80,7 +77,6 @@ public class CallLogFragment extends Fragment CallFetcher, MultiSelectRemoveView, OnEmptyViewActionButtonClickedListener, - OnRequestPermissionsResultCallback, CallLogModalAlertManager.Listener, OnClickListener { private static final String KEY_FILTER_TYPE = "filter_type"; @@ -306,21 +302,21 @@ public class CallLogFragment extends Fragment } protected void setupView(View view) { - mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); + mRecyclerView = view.findViewById(R.id.recycler_view); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); PerformanceReport.logOnScrollStateChange(mRecyclerView); - mEmptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view); + mEmptyListView = view.findViewById(R.id.empty_list_view); mEmptyListView.setImage(R.drawable.empty_call_log); mEmptyListView.setActionClickedListener(this); - mModalAlertView = (ViewGroup) view.findViewById(R.id.modal_message_container); + mModalAlertView = view.findViewById(R.id.modal_message_container); mModalAlertManager = new CallLogModalAlertManager(LayoutInflater.from(getContext()), mModalAlertView, this); mMultiSelectUnSelectAllViewContent = view.findViewById(R.id.multi_select_select_all_view_content); - mSelectUnselectAllViewText = (TextView) view.findViewById(R.id.select_all_view_text); - mSelectUnselectAllIcon = (ImageView) view.findViewById(R.id.select_all_view_icon); + mSelectUnselectAllViewText = view.findViewById(R.id.select_all_view_text); + mSelectUnselectAllIcon = view.findViewById(R.id.select_all_view_icon); mMultiSelectUnSelectAllViewContent.setOnClickListener(null); mSelectUnselectAllIcon.setOnClickListener(this); mSelectUnselectAllViewText.setOnClickListener(this); @@ -335,8 +331,7 @@ public class CallLogFragment extends Fragment mContactInfoCache = new ContactInfoCache( - ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity()) - .getRetainedCache(), + ExpirableCacheHeadlessFragment.attach(this).getRetainedCache(), new ContactInfoHelper(getActivity(), currentCountryIso), mOnContactInfoChangedListener); mAdapter = @@ -575,7 +570,7 @@ public class CallLogFragment extends Fragment LogUtil.i( "CallLogFragment.onEmptyViewActionButtonClicked", "Requesting permissions: " + Arrays.toString(deniedPermissions)); - FragmentCompat.requestPermissions(this, deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); + requestPermissions(deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE); } else if (!mIsCallLogActivity) { // Show dialpad if we are not in the call log activity. ((HostInterface) activity).showDialpad(); -- cgit v1.2.3