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/calllog | |
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/calllog')
6 files changed, 22 insertions, 25 deletions
diff --git a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java index 28082df2b..7c324ffb2 100644 --- a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java +++ b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java @@ -16,11 +16,11 @@ package com.android.dialer.app.calllog; -import android.app.FragmentManager; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import android.support.annotation.NonNull; +import android.support.v4.app.FragmentManager; import android.support.v7.widget.RecyclerView; import com.android.dialer.blocking.BlockReportSpamDialogs; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java index 35e05bc39..449e45742 100644 --- a/java/com/android/dialer/app/calllog/CallLogActivity.java +++ b/java/com/android/dialer/app/calllog/CallLogActivity.java @@ -15,14 +15,14 @@ */ package com.android.dialer.app.calllog; -import android.app.Fragment; -import android.app.FragmentManager; import android.content.Intent; import android.os.Bundle; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.support.design.widget.Snackbar; -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.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.view.Menu; @@ -84,14 +84,14 @@ public class CallLogActivity extends TransactionSafeActivity mTabTitles[0] = getString(R.string.call_log_all_title); mTabTitles[1] = getString(R.string.call_log_missed_title); - mViewPager = (ViewPager) findViewById(R.id.call_log_pager); + mViewPager = findViewById(R.id.call_log_pager); - mViewPagerAdapter = new ViewPagerAdapter(getFragmentManager()); + mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); mViewPager.setOffscreenPageLimit(1); mViewPager.setOnPageChangeListener(this); - mViewPagerTabs = (ViewPagerTabs) findViewById(R.id.viewpager_header); + mViewPagerTabs = findViewById(R.id.viewpager_header); mViewPagerTabs.setViewPager(mViewPager); mViewPager.setCurrentItem(startingTab); @@ -148,7 +148,7 @@ public class CallLogActivity extends TransactionSafeActivity startActivity(intent); return true; } else if (item.getItemId() == R.id.delete_all) { - ClearCallLogDialog.show(getFragmentManager(), this); + ClearCallLogDialog.show(getSupportFragmentManager(), this); return true; } return super.onOptionsItemSelected(item); diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index b1edd064d..f2db13480 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -35,6 +35,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.annotation.WorkerThread; +import android.support.v4.app.FragmentActivity; import android.support.v7.app.AlertDialog; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; @@ -497,7 +498,7 @@ public class CallLogAdapter extends GroupingListAdapter mBlockReportSpamListener = new BlockReportSpamListener( mActivity, - ((Activity) mActivity).getFragmentManager(), + ((FragmentActivity) mActivity).getSupportFragmentManager(), this, mFilteredNumberAsyncQueryHandler); setHasStableIds(true); 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(); diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 5cf33cab2..d0ba31f40 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -30,6 +30,7 @@ import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; +import android.support.v4.app.FragmentActivity; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.telecom.PhoneAccount; @@ -991,7 +992,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder private void maybeShowBlockNumberMigrationDialog(BlockedNumbersMigrator.Listener listener) { if (!FilteredNumberCompat.maybeShowBlockNumberMigrationDialog( - mContext, ((Activity) mContext).getFragmentManager(), listener)) { + mContext, ((FragmentActivity) mContext).getSupportFragmentManager(), listener)) { listener.onComplete(); } } diff --git a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java index 5c3d4d9fa..c100fa0e0 100644 --- a/java/com/android/dialer/app/calllog/ClearCallLogDialog.java +++ b/java/com/android/dialer/app/calllog/ClearCallLogDialog.java @@ -19,8 +19,6 @@ package com.android.dialer.app.calllog; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; -import android.app.DialogFragment; -import android.app.FragmentManager; import android.app.ProgressDialog; import android.content.ContentResolver; import android.content.Context; @@ -30,6 +28,8 @@ import android.os.AsyncTask; import android.os.Bundle; import android.provider.CallLog.Calls; import android.support.annotation.NonNull; +import android.support.v4.app.DialogFragment; +import android.support.v4.app.FragmentManager; import com.android.dialer.app.R; import com.android.dialer.common.Assert; import com.android.dialer.phonenumbercache.CachedNumberLookupService; |