summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/app')
-rw-r--r--java/com/android/dialer/app/DialtactsActivity.java660
-rw-r--r--java/com/android/dialer/app/calllog/BlockReportSpamListener.java52
-rw-r--r--java/com/android/dialer/app/calllog/CallLogActivity.java72
-rw-r--r--java/com/android/dialer/app/calllog/CallLogAdapter.java353
-rw-r--r--java/com/android/dialer/app/calllog/CallLogAsync.java6
-rw-r--r--java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java16
-rw-r--r--java/com/android/dialer/app/calllog/CallLogFragment.java290
-rw-r--r--java/com/android/dialer/app/calllog/CallLogGroupBuilder.java20
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemHelper.java44
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java257
-rw-r--r--java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java48
-rw-r--r--java/com/android/dialer/app/calllog/DialerQuickContactBadge.java8
-rw-r--r--java/com/android/dialer/app/calllog/GroupingListAdapter.java56
-rw-r--r--java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java107
-rw-r--r--java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java44
-rw-r--r--java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java58
-rw-r--r--java/com/android/dialer/app/contactinfo/ContactInfoCache.java98
-rw-r--r--java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java26
-rw-r--r--java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java52
-rw-r--r--java/com/android/dialer/app/filterednumber/NumbersAdapter.java36
-rw-r--r--java/com/android/dialer/app/filterednumber/ViewNumbersToImportFragment.java12
-rw-r--r--java/com/android/dialer/app/list/AllContactsFragment.java32
-rw-r--r--java/com/android/dialer/app/list/BlockedListSearchAdapter.java16
-rw-r--r--java/com/android/dialer/app/list/BlockedListSearchFragment.java24
-rw-r--r--java/com/android/dialer/app/list/ContentChangedFilter.java8
-rw-r--r--java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java34
-rw-r--r--java/com/android/dialer/app/list/DragDropController.java49
-rw-r--r--java/com/android/dialer/app/list/ListsFragment.java183
-rw-r--r--java/com/android/dialer/app/list/OldSpeedDialFragment.java180
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteListView.java162
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java18
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteTileView.java19
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java196
-rw-r--r--java/com/android/dialer/app/list/RegularSearchFragment.java18
-rw-r--r--java/com/android/dialer/app/list/RegularSearchListAdapter.java8
-rw-r--r--java/com/android/dialer/app/list/RemoveView.java40
-rw-r--r--java/com/android/dialer/app/list/SearchFragment.java106
-rw-r--r--java/com/android/dialer/app/list/SmartDialNumberListAdapter.java22
-rw-r--r--java/com/android/dialer/app/list/SmartDialSearchFragment.java24
-rw-r--r--java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java20
-rw-r--r--java/com/android/dialer/app/settings/DialerSettingsActivity.java4
-rw-r--r--java/com/android/dialer/app/settings/SoundSettingsFragment.java60
-rw-r--r--java/com/android/dialer/app/voicemail/VoicemailAudioManager.java88
-rw-r--r--java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java252
-rw-r--r--java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java460
-rw-r--r--java/com/android/dialer/app/voicemail/WiredHeadsetManager.java40
-rw-r--r--java/com/android/dialer/app/widget/ActionBarController.java107
-rw-r--r--java/com/android/dialer/app/widget/SearchEditTextLayout.java188
48 files changed, 2329 insertions, 2344 deletions
diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java
index bbb45943a..66e02b4d8 100644
--- a/java/com/android/dialer/app/DialtactsActivity.java
+++ b/java/com/android/dialer/app/DialtactsActivity.java
@@ -204,74 +204,74 @@ public class DialtactsActivity extends TransactionSafeActivity
*/
private static final long HISTORY_TAB_SEEN_TIMEOUT = TimeUnit.SECONDS.toMillis(3);
- private static Optional<Boolean> sVoiceSearchEnabledForTest = Optional.absent();
+ private static Optional<Boolean> voiceSearchEnabledForTest = Optional.absent();
/** Fragment containing the dialpad that slides into view */
- protected DialpadFragment mDialpadFragment;
+ protected DialpadFragment dialpadFragment;
/** Root layout of DialtactsActivity */
- private CoordinatorLayout mParentLayout;
+ private CoordinatorLayout parentLayout;
/** Fragment for searching phone numbers using the alphanumeric keyboard. */
- private RegularSearchFragment mRegularSearchFragment;
+ private RegularSearchFragment regularSearchFragment;
/** Fragment for searching phone numbers using the dialpad. */
- private SmartDialSearchFragment mSmartDialSearchFragment;
+ private SmartDialSearchFragment smartDialSearchFragment;
/** new Fragment for search phone numbers using the keyboard and the dialpad. */
- private NewSearchFragment mNewSearchFragment;
+ private NewSearchFragment newSearchFragment;
/** Animation that slides in. */
- private Animation mSlideIn;
+ private Animation slideIn;
/** Animation that slides out. */
- private Animation mSlideOut;
+ private Animation slideOut;
/** Fragment containing the speed dial list, call history list, and all contacts list. */
- private ListsFragment mListsFragment;
+ private ListsFragment listsFragment;
/**
* Tracks whether onSaveInstanceState has been called. If true, no fragment transactions can be
* commited.
*/
- private boolean mStateSaved;
-
- private boolean mIsKeyboardOpen;
- private boolean mInNewSearch;
- private boolean mIsRestarting;
- private boolean mInDialpadSearch;
- private boolean mInRegularSearch;
- private boolean mClearSearchOnPause;
- private boolean mIsDialpadShown;
+ private boolean stateSaved;
+
+ private boolean isKeyboardOpen;
+ private boolean inNewSearch;
+ private boolean isRestarting;
+ private boolean inDialpadSearch;
+ private boolean inRegularSearch;
+ private boolean clearSearchOnPause;
+ private boolean isDialpadShown;
/** Whether or not the device is in landscape orientation. */
- private boolean mIsLandscape;
+ private boolean isLandscape;
/** True if the dialpad is only temporarily showing due to being in call */
- private boolean mInCallDialpadUp;
+ private boolean inCallDialpadUp;
/** True when this activity has been launched for the first time. */
- private boolean mFirstLaunch;
+ private boolean firstLaunch;
/**
* Search query to be applied to the SearchView in the ActionBar once onCreateOptionsMenu has been
* called.
*/
- private String mPendingSearchViewQuery;
-
- private PopupMenu mOverflowMenu;
- private EditText mSearchView;
- private SearchEditTextLayout mSearchEditTextLayout;
- private View mVoiceSearchButton;
- private String mSearchQuery;
- private String mDialpadQuery;
- private DialerDatabaseHelper mDialerDatabaseHelper;
- private DragDropController mDragDropController;
- private ActionBarController mActionBarController;
- private FloatingActionButtonController mFloatingActionButtonController;
- private boolean mWasConfigurationChange;
+ private String pendingSearchViewQuery;
+
+ private PopupMenu overflowMenu;
+ private EditText searchView;
+ private SearchEditTextLayout searchEditTextLayout;
+ private View voiceSearchButton;
+ private String searchQuery;
+ private String dialpadQuery;
+ private DialerDatabaseHelper dialerDatabaseHelper;
+ private DragDropController dragDropController;
+ private ActionBarController actionBarController;
+ private FloatingActionButtonController floatingActionButtonController;
+ private boolean wasConfigurationChange;
private long timeTabSelected;
- private P13nLogger mP13nLogger;
- private P13nRanker mP13nRanker;
+ private P13nLogger p13nLogger;
+ private P13nRanker p13nRanker;
public boolean isMultiSelectModeEnabled;
private boolean isLastTabEnabled;
- AnimationListenerAdapter mSlideInListener =
+ AnimationListenerAdapter slideInListener =
new AnimationListenerAdapter() {
@Override
public void onAnimationEnd(Animation animation) {
@@ -279,7 +279,7 @@ public class DialtactsActivity extends TransactionSafeActivity
}
};
/** Listener for after slide out animation completes on dialer fragment. */
- AnimationListenerAdapter mSlideOutListener =
+ AnimationListenerAdapter slideOutListener =
new AnimationListenerAdapter() {
@Override
public void onAnimationEnd(Animation animation) {
@@ -287,7 +287,7 @@ public class DialtactsActivity extends TransactionSafeActivity
}
};
/** Listener used to send search queries to the phone search fragment. */
- private final TextWatcher mPhoneSearchQueryTextListener =
+ private final TextWatcher phoneSearchQueryTextListener =
new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@@ -295,7 +295,7 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
final String newText = s.toString();
- if (newText.equals(mSearchQuery)) {
+ if (newText.equals(searchQuery)) {
// If the query hasn't changed (perhaps due to activity being destroyed
// and restored, or user launching the same DIAL intent twice), then there is
// no need to do anything here.
@@ -307,8 +307,8 @@ public class DialtactsActivity extends TransactionSafeActivity
}
LogUtil.v("DialtactsActivity.onTextChanged", "called with new query: " + newText);
- LogUtil.v("DialtactsActivity.onTextChanged", "previous query: " + mSearchQuery);
- mSearchQuery = newText;
+ LogUtil.v("DialtactsActivity.onTextChanged", "previous query: " + searchQuery);
+ searchQuery = newText;
// TODO(calderwoodra): show p13n when newText is empty.
// Show search fragment only when the query string is changed to non-empty text.
@@ -316,18 +316,18 @@ public class DialtactsActivity extends TransactionSafeActivity
// Call enterSearchUi only if we are switching search modes, or showing a search
// fragment for the first time.
final boolean sameSearchMode =
- (mIsDialpadShown && mInDialpadSearch) || (!mIsDialpadShown && mInRegularSearch);
+ (isDialpadShown && inDialpadSearch) || (!isDialpadShown && inRegularSearch);
if (!sameSearchMode) {
- enterSearchUi(mIsDialpadShown, mSearchQuery, true /* animate */);
+ enterSearchUi(isDialpadShown, searchQuery, true /* animate */);
}
}
- if (mSmartDialSearchFragment != null && mSmartDialSearchFragment.isVisible()) {
- mSmartDialSearchFragment.setQueryString(mSearchQuery);
- } else if (mRegularSearchFragment != null && mRegularSearchFragment.isVisible()) {
- mRegularSearchFragment.setQueryString(mSearchQuery);
- } else if (mNewSearchFragment != null && mNewSearchFragment.isVisible()) {
- mNewSearchFragment.setQuery(mSearchQuery, getCallInitiationType());
+ if (smartDialSearchFragment != null && smartDialSearchFragment.isVisible()) {
+ smartDialSearchFragment.setQueryString(searchQuery);
+ } else if (regularSearchFragment != null && regularSearchFragment.isVisible()) {
+ regularSearchFragment.setQueryString(searchQuery);
+ } else if (newSearchFragment != null && newSearchFragment.isVisible()) {
+ newSearchFragment.setQuery(searchQuery, getCallInitiationType());
}
}
@@ -335,27 +335,27 @@ public class DialtactsActivity extends TransactionSafeActivity
public void afterTextChanged(Editable s) {}
};
/** Open the search UI when the user clicks on the search box. */
- private final View.OnClickListener mSearchViewOnClickListener =
+ private final View.OnClickListener searchViewOnClickListener =
new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isInSearchUi()) {
PerformanceReport.recordClick(UiAction.Type.OPEN_SEARCH);
- mActionBarController.onSearchBoxTapped();
+ actionBarController.onSearchBoxTapped();
enterSearchUi(
- false /* smartDialSearch */, mSearchView.getText().toString(), true /* animate */);
+ false /* smartDialSearch */, searchView.getText().toString(), true /* animate */);
}
}
};
- private int mActionBarHeight;
- private int mPreviouslySelectedTabIndex;
+ private int actionBarHeight;
+ private int previouslySelectedTabIndex;
/**
* The text returned from a voice search query. Set in {@link #onActivityResult} and used in
* {@link #onResume()} to populate the search box.
*/
- private String mVoiceSearchQuery;
+ private String voiceSearchQuery;
/**
* @param tab the TAB_INDEX_* constant in {@link ListsFragment}
@@ -391,11 +391,11 @@ public class DialtactsActivity extends TransactionSafeActivity
LogUtil.enterBlock("DialtactsActivity.onCreate");
super.onCreate(savedInstanceState);
- mFirstLaunch = true;
+ firstLaunch = true;
isLastTabEnabled = ConfigProviderBindings.get(this).getBoolean("last_tab_enabled", false);
final Resources resources = getResources();
- mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large);
+ actionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large);
Trace.beginSection(TAG + " setContentView");
setContentView(R.layout.dialtacts_activity);
@@ -408,35 +408,34 @@ public class DialtactsActivity extends TransactionSafeActivity
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setBackgroundDrawable(null);
- mSearchEditTextLayout = actionBar.getCustomView().findViewById(R.id.search_view_container);
+ searchEditTextLayout = actionBar.getCustomView().findViewById(R.id.search_view_container);
- mActionBarController = new ActionBarController(this, mSearchEditTextLayout);
+ actionBarController = new ActionBarController(this, searchEditTextLayout);
- mSearchView = mSearchEditTextLayout.findViewById(R.id.search_view);
- mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener);
- mSearchView.setHint(getSearchBoxHint());
+ searchView = searchEditTextLayout.findViewById(R.id.search_view);
+ searchView.addTextChangedListener(phoneSearchQueryTextListener);
+ searchView.setHint(getSearchBoxHint());
- mVoiceSearchButton = mSearchEditTextLayout.findViewById(R.id.voice_search_button);
- mSearchEditTextLayout
+ voiceSearchButton = searchEditTextLayout.findViewById(R.id.voice_search_button);
+ searchEditTextLayout
.findViewById(R.id.search_box_collapsed)
- .setOnClickListener(mSearchViewOnClickListener);
- mSearchEditTextLayout
+ .setOnClickListener(searchViewOnClickListener);
+ searchEditTextLayout
.findViewById(R.id.search_back_button)
.setOnClickListener(v -> exitSearchUi());
- mIsLandscape =
+ isLandscape =
getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
- mPreviouslySelectedTabIndex = DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL;
+ previouslySelectedTabIndex = DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL;
FloatingActionButton floatingActionButton = findViewById(R.id.floating_action_button);
floatingActionButton.setOnClickListener(this);
- mFloatingActionButtonController =
- new FloatingActionButtonController(this, floatingActionButton);
+ floatingActionButtonController = new FloatingActionButtonController(this, floatingActionButton);
ImageButton optionsMenuButton =
- mSearchEditTextLayout.findViewById(R.id.dialtacts_options_menu_button);
+ searchEditTextLayout.findViewById(R.id.dialtacts_options_menu_button);
optionsMenuButton.setOnClickListener(this);
- mOverflowMenu = buildOptionsMenu(optionsMenuButton);
- optionsMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
+ overflowMenu = buildOptionsMenu(optionsMenuButton);
+ optionsMenuButton.setOnTouchListener(overflowMenu.getDragToOpenListener());
// Add the favorites fragment but only if savedInstanceState is null. Otherwise the
// fragment manager is responsible for recreating it.
@@ -446,56 +445,56 @@ public class DialtactsActivity extends TransactionSafeActivity
.add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT)
.commit();
} else {
- mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
- mDialpadQuery = savedInstanceState.getString(KEY_DIALPAD_QUERY);
- mInRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI);
- mInDialpadSearch = savedInstanceState.getBoolean(KEY_IN_DIALPAD_SEARCH_UI);
- mInNewSearch = savedInstanceState.getBoolean(KEY_IN_NEW_SEARCH_UI);
- mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH);
- mWasConfigurationChange = savedInstanceState.getBoolean(KEY_WAS_CONFIGURATION_CHANGE);
- mIsDialpadShown = savedInstanceState.getBoolean(KEY_IS_DIALPAD_SHOWN);
- mFloatingActionButtonController.setVisible(savedInstanceState.getBoolean(KEY_FAB_VISIBLE));
- mActionBarController.restoreInstanceState(savedInstanceState);
+ searchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
+ dialpadQuery = savedInstanceState.getString(KEY_DIALPAD_QUERY);
+ inRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI);
+ inDialpadSearch = savedInstanceState.getBoolean(KEY_IN_DIALPAD_SEARCH_UI);
+ inNewSearch = savedInstanceState.getBoolean(KEY_IN_NEW_SEARCH_UI);
+ firstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH);
+ wasConfigurationChange = savedInstanceState.getBoolean(KEY_WAS_CONFIGURATION_CHANGE);
+ isDialpadShown = savedInstanceState.getBoolean(KEY_IS_DIALPAD_SHOWN);
+ floatingActionButtonController.setVisible(savedInstanceState.getBoolean(KEY_FAB_VISIBLE));
+ actionBarController.restoreInstanceState(savedInstanceState);
}
final boolean isLayoutRtl = ViewUtil.isRtl();
- if (mIsLandscape) {
- mSlideIn =
+ if (isLandscape) {
+ slideIn =
AnimationUtils.loadAnimation(
this, isLayoutRtl ? R.anim.dialpad_slide_in_left : R.anim.dialpad_slide_in_right);
- mSlideOut =
+ slideOut =
AnimationUtils.loadAnimation(
this, isLayoutRtl ? R.anim.dialpad_slide_out_left : R.anim.dialpad_slide_out_right);
} else {
- mSlideIn = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_in_bottom);
- mSlideOut = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_out_bottom);
+ slideIn = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_in_bottom);
+ slideOut = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_out_bottom);
}
- mSlideIn.setInterpolator(AnimUtils.EASE_IN);
- mSlideOut.setInterpolator(AnimUtils.EASE_OUT);
+ slideIn.setInterpolator(AnimUtils.EASE_IN);
+ slideOut.setInterpolator(AnimUtils.EASE_OUT);
- mSlideIn.setAnimationListener(mSlideInListener);
- mSlideOut.setAnimationListener(mSlideOutListener);
+ slideIn.setAnimationListener(slideInListener);
+ slideOut.setAnimationListener(slideOutListener);
- mParentLayout = (CoordinatorLayout) findViewById(R.id.dialtacts_mainlayout);
- mParentLayout.setOnDragListener(new LayoutOnDragListener());
+ parentLayout = (CoordinatorLayout) findViewById(R.id.dialtacts_mainlayout);
+ parentLayout.setOnDragListener(new LayoutOnDragListener());
ViewUtil.doOnGlobalLayout(
floatingActionButton,
view -> {
- int screenWidth = mParentLayout.getWidth();
- mFloatingActionButtonController.setScreenWidth(screenWidth);
- mFloatingActionButtonController.align(getFabAlignment(), false /* animate */);
+ int screenWidth = parentLayout.getWidth();
+ floatingActionButtonController.setScreenWidth(screenWidth);
+ floatingActionButtonController.align(getFabAlignment(), false /* animate */);
});
Trace.endSection();
Trace.beginSection(TAG + " initialize smart dialing");
- mDialerDatabaseHelper = Database.get(this).getDatabaseHelper(this);
+ dialerDatabaseHelper = Database.get(this).getDatabaseHelper(this);
SmartDialPrefix.initializeNanpSettings(this);
Trace.endSection();
- mP13nLogger = P13nLogging.get(getApplicationContext());
- mP13nRanker = P13nRanking.get(getApplicationContext());
+ p13nLogger = P13nLogging.get(getApplicationContext());
+ p13nRanker = P13nRanking.get(getApplicationContext());
Trace.endSection();
// Update the new search fragment to the correct position and the ActionBar's visibility.
@@ -522,78 +521,78 @@ public class DialtactsActivity extends TransactionSafeActivity
PerformanceReport.startRecording();
}
- mStateSaved = false;
- if (mFirstLaunch) {
+ stateSaved = false;
+ if (firstLaunch) {
LogUtil.i("DialtactsActivity.onResume", "mFirstLaunch true, displaying fragment");
displayFragment(getIntent());
- } else if (!phoneIsInUse() && mInCallDialpadUp) {
+ } else if (!phoneIsInUse() && inCallDialpadUp) {
LogUtil.i("DialtactsActivity.onResume", "phone not in use, hiding dialpad fragment");
hideDialpadFragment(false, true);
- mInCallDialpadUp = false;
- } else if (mIsDialpadShown) {
+ inCallDialpadUp = false;
+ } else if (isDialpadShown) {
LogUtil.i("DialtactsActivity.onResume", "showing dialpad on resume");
showDialpadFragment(false);
} else {
- PostCall.promptUserForMessageIfNecessary(this, mParentLayout);
+ PostCall.promptUserForMessageIfNecessary(this, parentLayout);
}
// On M the fragment manager does not restore the hidden state of a fragment from
// savedInstanceState so it must be hidden again.
- if (!mIsDialpadShown && mDialpadFragment != null && !mDialpadFragment.isHidden()) {
+ if (!isDialpadShown && dialpadFragment != null && !dialpadFragment.isHidden()) {
LogUtil.i(
"DialtactsActivity.onResume", "mDialpadFragment attached but not hidden, forcing hide");
- getFragmentManager().beginTransaction().hide(mDialpadFragment).commit();
+ getFragmentManager().beginTransaction().hide(dialpadFragment).commit();
}
// If there was a voice query result returned in the {@link #onActivityResult} callback, it
// will have been stashed in mVoiceSearchQuery since the search results fragment cannot be
// shown until onResume has completed. Active the search UI and set the search term now.
- if (!TextUtils.isEmpty(mVoiceSearchQuery)) {
- mActionBarController.onSearchBoxTapped();
- mSearchView.setText(mVoiceSearchQuery);
- mVoiceSearchQuery = null;
+ if (!TextUtils.isEmpty(voiceSearchQuery)) {
+ actionBarController.onSearchBoxTapped();
+ searchView.setText(voiceSearchQuery);
+ voiceSearchQuery = null;
}
- if (mIsRestarting) {
+ if (isRestarting) {
// This is only called when the activity goes from resumed -> paused -> resumed, so it
// will not cause an extra view to be sent out on rotation
- if (mIsDialpadShown) {
+ if (isDialpadShown) {
Logger.get(this).logScreenView(ScreenEvent.Type.DIALPAD, this);
}
- mIsRestarting = false;
+ isRestarting = false;
}
prepareVoiceSearchButton();
- if (!mWasConfigurationChange) {
- mDialerDatabaseHelper.startSmartDialUpdateThread();
+ if (!wasConfigurationChange) {
+ dialerDatabaseHelper.startSmartDialUpdateThread();
}
- if (mIsDialpadShown) {
- mFloatingActionButtonController.scaleOut();
+ if (isDialpadShown) {
+ floatingActionButtonController.scaleOut();
} else {
- mFloatingActionButtonController.align(getFabAlignment(), false /* animate */);
+ floatingActionButtonController.align(getFabAlignment(), false /* animate */);
}
- if (mFirstLaunch) {
+ if (firstLaunch) {
// Only process the Intent the first time onResume() is called after receiving it
if (Calls.CONTENT_TYPE.equals(getIntent().getType())) {
// Externally specified extras take precedence to EXTRA_SHOW_TAB, which is only
// used internally.
final Bundle extras = getIntent().getExtras();
if (extras != null && extras.getInt(Calls.EXTRA_CALL_TYPE_FILTER) == Calls.VOICEMAIL_TYPE) {
- mListsFragment.showTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
+ listsFragment.showTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
Logger.get(this).logImpression(DialerImpression.Type.VVM_NOTIFICATION_CLICKED);
} else {
- mListsFragment.showTab(DialtactsPagerAdapter.TAB_INDEX_HISTORY);
+ listsFragment.showTab(DialtactsPagerAdapter.TAB_INDEX_HISTORY);
}
} else if (getIntent().hasExtra(EXTRA_SHOW_TAB)) {
int index =
getIntent().getIntExtra(EXTRA_SHOW_TAB, DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL);
- if (index < mListsFragment.getTabCount()) {
+ if (index < listsFragment.getTabCount()) {
// Hide dialpad since this is an explicit intent to show a specific tab, which is coming
// from missed call or voicemail notification.
hideDialpadFragment(false, false);
exitSearchUi();
- mListsFragment.showTab(index);
+ listsFragment.showTab(index);
}
}
@@ -609,13 +608,13 @@ public class DialtactsActivity extends TransactionSafeActivity
1000);
}
- mFirstLaunch = false;
+ firstLaunch = false;
setSearchBoxHint();
timeTabSelected = SystemClock.elapsedRealtime();
- mP13nLogger.reset();
- mP13nRanker.refresh(
+ p13nLogger.reset();
+ p13nRanker.refresh(
new P13nRefreshCompleteListener() {
@Override
public void onP13nRefreshComplete() {
@@ -628,16 +627,16 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
protected void onRestart() {
super.onRestart();
- mIsRestarting = true;
+ isRestarting = true;
}
@Override
protected void onPause() {
- if (mClearSearchOnPause) {
+ if (clearSearchOnPause) {
hideDialpadAndSearchUi();
- mClearSearchOnPause = false;
+ clearSearchOnPause = false;
}
- if (mSlideOut.hasStarted() && !mSlideOut.hasEnded()) {
+ if (slideOut.hasStarted() && !slideOut.hasEnded()) {
commitDialpadFragmentHide();
}
super.onPause();
@@ -649,17 +648,17 @@ public class DialtactsActivity extends TransactionSafeActivity
boolean timeoutElapsed =
SystemClock.elapsedRealtime() - timeTabSelected >= HISTORY_TAB_SEEN_TIMEOUT;
boolean isOnHistoryTab =
- mListsFragment.getCurrentTabIndex() == DialtactsPagerAdapter.TAB_INDEX_HISTORY;
+ listsFragment.getCurrentTabIndex() == DialtactsPagerAdapter.TAB_INDEX_HISTORY;
if (isOnHistoryTab
&& timeoutElapsed
&& !isChangingConfigurations()
&& !getSystemService(KeyguardManager.class).isKeyguardLocked()) {
- mListsFragment.markMissedCallsAsReadAndRemoveNotifications();
+ listsFragment.markMissedCallsAsReadAndRemoveNotifications();
}
StorageComponent.get(this)
.unencryptedSharedPrefs()
.edit()
- .putInt(KEY_LAST_TAB, mListsFragment.getCurrentTabIndex())
+ .putInt(KEY_LAST_TAB, listsFragment.getCurrentTabIndex())
.apply();
}
@@ -667,38 +666,38 @@ public class DialtactsActivity extends TransactionSafeActivity
protected void onSaveInstanceState(Bundle outState) {
LogUtil.enterBlock("DialtactsActivity.onSaveInstanceState");
super.onSaveInstanceState(outState);
- outState.putString(KEY_SEARCH_QUERY, mSearchQuery);
- outState.putString(KEY_DIALPAD_QUERY, mDialpadQuery);
- outState.putBoolean(KEY_IN_REGULAR_SEARCH_UI, mInRegularSearch);
- outState.putBoolean(KEY_IN_DIALPAD_SEARCH_UI, mInDialpadSearch);
- outState.putBoolean(KEY_IN_NEW_SEARCH_UI, mInNewSearch);
- outState.putBoolean(KEY_FIRST_LAUNCH, mFirstLaunch);
- outState.putBoolean(KEY_IS_DIALPAD_SHOWN, mIsDialpadShown);
- outState.putBoolean(KEY_FAB_VISIBLE, mFloatingActionButtonController.isVisible());
+ outState.putString(KEY_SEARCH_QUERY, searchQuery);
+ outState.putString(KEY_DIALPAD_QUERY, dialpadQuery);
+ outState.putBoolean(KEY_IN_REGULAR_SEARCH_UI, inRegularSearch);
+ outState.putBoolean(KEY_IN_DIALPAD_SEARCH_UI, inDialpadSearch);
+ outState.putBoolean(KEY_IN_NEW_SEARCH_UI, inNewSearch);
+ outState.putBoolean(KEY_FIRST_LAUNCH, firstLaunch);
+ outState.putBoolean(KEY_IS_DIALPAD_SHOWN, isDialpadShown);
+ outState.putBoolean(KEY_FAB_VISIBLE, floatingActionButtonController.isVisible());
outState.putBoolean(KEY_WAS_CONFIGURATION_CHANGE, isChangingConfigurations());
- mActionBarController.saveInstanceState(outState);
- mStateSaved = true;
+ actionBarController.saveInstanceState(outState);
+ stateSaved = true;
}
@Override
public void onAttachFragment(final Fragment fragment) {
LogUtil.i("DialtactsActivity.onAttachFragment", "fragment: %s", fragment);
if (fragment instanceof DialpadFragment) {
- mDialpadFragment = (DialpadFragment) fragment;
+ dialpadFragment = (DialpadFragment) fragment;
} else if (fragment instanceof SmartDialSearchFragment) {
- mSmartDialSearchFragment = (SmartDialSearchFragment) fragment;
- mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(this);
- if (!TextUtils.isEmpty(mDialpadQuery)) {
- mSmartDialSearchFragment.setAddToContactNumber(mDialpadQuery);
+ smartDialSearchFragment = (SmartDialSearchFragment) fragment;
+ smartDialSearchFragment.setOnPhoneNumberPickerActionListener(this);
+ if (!TextUtils.isEmpty(dialpadQuery)) {
+ smartDialSearchFragment.setAddToContactNumber(dialpadQuery);
}
} else if (fragment instanceof SearchFragment) {
- mRegularSearchFragment = (RegularSearchFragment) fragment;
- mRegularSearchFragment.setOnPhoneNumberPickerActionListener(this);
+ regularSearchFragment = (RegularSearchFragment) fragment;
+ regularSearchFragment.setOnPhoneNumberPickerActionListener(this);
} else if (fragment instanceof ListsFragment) {
- mListsFragment = (ListsFragment) fragment;
- mListsFragment.addOnPageChangeListener(this);
+ listsFragment = (ListsFragment) fragment;
+ listsFragment.addOnPageChangeListener(this);
} else if (fragment instanceof NewSearchFragment) {
- mNewSearchFragment = (NewSearchFragment) fragment;
+ newSearchFragment = (NewSearchFragment) fragment;
updateSearchFragmentPosition();
}
if (fragment instanceof SearchFragment) {
@@ -710,14 +709,14 @@ public class DialtactsActivity extends TransactionSafeActivity
public Cursor rerankCursor(Cursor data) {
Assert.isMainThread();
String queryString = searchFragment.getQueryString();
- return mP13nRanker.rankCursor(data, queryString == null ? 0 : queryString.length());
+ return p13nRanker.rankCursor(data, queryString == null ? 0 : queryString.length());
}
});
searchFragment.addOnLoadFinishedListener(
new OnLoadFinishedListener() {
@Override
public void onLoadFinished() {
- mP13nLogger.onSearchQuery(
+ p13nLogger.onSearchQuery(
searchFragment.getQueryString(),
(PhoneNumberListAdapter) searchFragment.getAdapter());
}
@@ -731,18 +730,18 @@ public class DialtactsActivity extends TransactionSafeActivity
}
public boolean isListsFragmentVisible() {
- return mListsFragment.getUserVisibleHint();
+ return listsFragment.getUserVisibleHint();
}
@Override
public void onClick(View view) {
int resId = view.getId();
if (resId == R.id.floating_action_button) {
- if (!mIsDialpadShown) {
+ if (!isDialpadShown) {
LogUtil.i(
"DialtactsActivity.onClick", "floating action button clicked, going to show dialpad");
PerformanceReport.recordClick(UiAction.Type.OPEN_DIALPAD);
- mInCallDialpadUp = false;
+ inCallDialpadUp = false;
showDialpadFragment(true);
PostCall.closePrompt();
} else {
@@ -761,7 +760,7 @@ public class DialtactsActivity extends TransactionSafeActivity
.show();
}
} else if (resId == R.id.dialtacts_options_menu_button) {
- mOverflowMenu.show();
+ overflowMenu.show();
} else {
Assert.fail("Unexpected onClick event from " + view);
}
@@ -805,7 +804,7 @@ public class DialtactsActivity extends TransactionSafeActivity
final ArrayList<String> matches =
data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (matches.size() > 0) {
- mVoiceSearchQuery = matches.get(0);
+ voiceSearchQuery = matches.get(0);
} else {
LogUtil.i("DialtactsActivity.onActivityResult", "voice search - nothing heard");
}
@@ -820,7 +819,7 @@ public class DialtactsActivity extends TransactionSafeActivity
getString(
R.string.call_composer_connection_failed,
data.getStringExtra(CallComposerActivity.KEY_CONTACT_NAME));
- Snackbar.make(mParentLayout, message, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(parentLayout, message, Snackbar.LENGTH_LONG).show();
} else {
LogUtil.i("DialtactsActivity.onActivityResult", "returned from call composer, no error");
}
@@ -830,7 +829,7 @@ public class DialtactsActivity extends TransactionSafeActivity
&& data.getBooleanExtra(CallDetailsActivity.EXTRA_HAS_ENRICHED_CALL_DATA, false)) {
String number = data.getStringExtra(CallDetailsActivity.EXTRA_PHONE_NUMBER);
int snackbarDurationMillis = 5_000;
- Snackbar.make(mParentLayout, getString(R.string.ec_data_deleted), snackbarDurationMillis)
+ Snackbar.make(parentLayout, getString(R.string.ec_data_deleted), snackbarDurationMillis)
.setAction(
R.string.view_conversation,
v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this)))
@@ -849,7 +848,7 @@ public class DialtactsActivity extends TransactionSafeActivity
* Update the number of unread voicemails (potentially other tabs) displayed next to the tab icon.
*/
public void updateTabUnreadCounts() {
- mListsFragment.updateTabUnreadCounts();
+ listsFragment.updateTabUnreadCounts();
}
/**
@@ -860,40 +859,40 @@ public class DialtactsActivity extends TransactionSafeActivity
*/
private void showDialpadFragment(boolean animate) {
LogUtil.i("DialtactActivity.showDialpadFragment", "animate: %b", animate);
- if (mIsDialpadShown) {
+ if (isDialpadShown) {
LogUtil.i("DialtactsActivity.showDialpadFragment", "dialpad already shown");
return;
}
- if (mStateSaved) {
+ if (stateSaved) {
LogUtil.i("DialtactsActivity.showDialpadFragment", "state already saved");
return;
}
- mIsDialpadShown = true;
+ isDialpadShown = true;
- mListsFragment.setUserVisibleHint(false);
+ listsFragment.setUserVisibleHint(false);
final FragmentTransaction ft = getFragmentManager().beginTransaction();
- if (mDialpadFragment == null) {
- mDialpadFragment = new DialpadFragment();
- ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
+ if (dialpadFragment == null) {
+ dialpadFragment = new DialpadFragment();
+ ft.add(R.id.dialtacts_container, dialpadFragment, TAG_DIALPAD_FRAGMENT);
} else {
- ft.show(mDialpadFragment);
+ ft.show(dialpadFragment);
}
- mDialpadFragment.setAnimate(animate);
+ dialpadFragment.setAnimate(animate);
Logger.get(this).logScreenView(ScreenEvent.Type.DIALPAD, this);
ft.commit();
if (animate) {
- mFloatingActionButtonController.scaleOut();
+ floatingActionButtonController.scaleOut();
maybeEnterSearchUi();
} else {
- mFloatingActionButtonController.scaleOut();
+ floatingActionButtonController.scaleOut();
maybeEnterSearchUi();
}
- mActionBarController.onDialpadUp();
+ actionBarController.onDialpadUp();
- Assert.isNotNull(mListsFragment.getView()).animate().alpha(0).withLayer();
+ Assert.isNotNull(listsFragment.getView()).animate().alpha(0).withLayer();
// adjust the title, so the user will know where we're at when the activity start/resumes.
setTitle(R.string.launcherDialpadActivityLabel);
@@ -910,11 +909,11 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public void onDialpadShown() {
LogUtil.enterBlock("DialtactsActivity.onDialpadShown");
- Assert.isNotNull(mDialpadFragment);
- if (mDialpadFragment.getAnimate()) {
- Assert.isNotNull(mDialpadFragment.getView()).startAnimation(mSlideIn);
+ Assert.isNotNull(dialpadFragment);
+ if (dialpadFragment.getAnimate()) {
+ Assert.isNotNull(dialpadFragment.getView()).startAnimation(slideIn);
} else {
- mDialpadFragment.setYFraction(0);
+ dialpadFragment.setYFraction(0);
}
updateSearchFragmentPosition();
@@ -922,7 +921,7 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public void onCallPlacedFromDialpad() {
- mClearSearchOnPause = true;
+ clearSearchOnPause = true;
}
@Override
@@ -938,38 +937,38 @@ public class DialtactsActivity extends TransactionSafeActivity
*/
private void hideDialpadFragment(boolean animate, boolean clearDialpad) {
LogUtil.enterBlock("DialtactsActivity.hideDialpadFragment");
- if (mDialpadFragment == null || mDialpadFragment.getView() == null) {
+ if (dialpadFragment == null || dialpadFragment.getView() == null) {
return;
}
if (clearDialpad) {
// Temporarily disable accessibility when we clear the dialpad, since it should be
// invisible and should not announce anything.
- mDialpadFragment
+ dialpadFragment
.getDigitsWidget()
.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
- mDialpadFragment.clearDialpad();
- mDialpadFragment
+ dialpadFragment.clearDialpad();
+ dialpadFragment
.getDigitsWidget()
.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
}
- if (!mIsDialpadShown) {
+ if (!isDialpadShown) {
return;
}
- mIsDialpadShown = false;
- mDialpadFragment.setAnimate(animate);
- mListsFragment.setUserVisibleHint(true);
- mListsFragment.sendScreenViewForCurrentPosition();
+ isDialpadShown = false;
+ dialpadFragment.setAnimate(animate);
+ listsFragment.setUserVisibleHint(true);
+ listsFragment.sendScreenViewForCurrentPosition();
updateSearchFragmentPosition();
- mFloatingActionButtonController.align(getFabAlignment(), animate);
+ floatingActionButtonController.align(getFabAlignment(), animate);
if (animate) {
- mDialpadFragment.getView().startAnimation(mSlideOut);
+ dialpadFragment.getView().startAnimation(slideOut);
} else {
commitDialpadFragmentHide();
}
- mActionBarController.onDialpadDown();
+ actionBarController.onDialpadDown();
// reset the title to normal.
setTitle(R.string.launcherActivityLabel);
@@ -977,23 +976,20 @@ public class DialtactsActivity extends TransactionSafeActivity
/** Finishes hiding the dialpad fragment after any animations are completed. */
private void commitDialpadFragmentHide() {
- if (!mStateSaved
- && mDialpadFragment != null
- && !mDialpadFragment.isHidden()
- && !isDestroyed()) {
+ if (!stateSaved && dialpadFragment != null && !dialpadFragment.isHidden() && !isDestroyed()) {
final FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.hide(mDialpadFragment);
+ ft.hide(dialpadFragment);
ft.commit();
}
- mFloatingActionButtonController.scaleIn();
+ floatingActionButtonController.scaleIn();
}
private void updateSearchFragmentPosition() {
SearchFragment fragment = null;
- if (mSmartDialSearchFragment != null) {
- fragment = mSmartDialSearchFragment;
- } else if (mRegularSearchFragment != null) {
- fragment = mRegularSearchFragment;
+ if (smartDialSearchFragment != null) {
+ fragment = smartDialSearchFragment;
+ } else if (regularSearchFragment != null) {
+ fragment = regularSearchFragment;
}
LogUtil.d(
"DialtactsActivity.updateSearchFragmentPosition",
@@ -1006,47 +1002,47 @@ public class DialtactsActivity extends TransactionSafeActivity
// available immediately which is required to update position. By forcing an animation,
// position will be updated after a delay by when the dialpad height would be available.
fragment.updatePosition(true /* animate */);
- } else if (mNewSearchFragment != null) {
+ } else if (newSearchFragment != null) {
int animationDuration = getResources().getInteger(R.integer.dialpad_slide_in_duration);
int actionbarHeight = getResources().getDimensionPixelSize(R.dimen.action_bar_height_large);
int shadowHeight = getResources().getDrawable(R.drawable.search_shadow).getIntrinsicHeight();
int start = isDialpadShown() ? actionbarHeight - shadowHeight : 0;
int end = isDialpadShown() ? 0 : actionbarHeight - shadowHeight;
- mNewSearchFragment.animatePosition(start, end, animationDuration);
+ newSearchFragment.animatePosition(start, end, animationDuration);
}
}
@Override
public boolean isInSearchUi() {
- return mInDialpadSearch || mInRegularSearch || mInNewSearch;
+ return inDialpadSearch || inRegularSearch || inNewSearch;
}
@Override
public boolean hasSearchQuery() {
- return !TextUtils.isEmpty(mSearchQuery);
+ return !TextUtils.isEmpty(searchQuery);
}
private void setNotInSearchUi() {
- mInDialpadSearch = false;
- mInRegularSearch = false;
- mInNewSearch = false;
+ inDialpadSearch = false;
+ inRegularSearch = false;
+ inNewSearch = false;
}
private void hideDialpadAndSearchUi() {
- if (mIsDialpadShown) {
+ if (isDialpadShown) {
hideDialpadFragment(false, true);
}
exitSearchUi();
}
private void prepareVoiceSearchButton() {
- mSearchEditTextLayout.setVoiceSearchEnabled(isVoiceSearchEnabled());
- mVoiceSearchButton.setOnClickListener(this);
+ searchEditTextLayout.setVoiceSearchEnabled(isVoiceSearchEnabled());
+ voiceSearchButton.setOnClickListener(this);
}
private boolean isVoiceSearchEnabled() {
- if (sVoiceSearchEnabledForTest.isPresent()) {
- return sVoiceSearchEnabledForTest.get();
+ if (voiceSearchEnabledForTest.isPresent()) {
+ return voiceSearchEnabledForTest.get();
}
return canIntentBeHandled(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH));
}
@@ -1061,7 +1057,7 @@ public class DialtactsActivity extends TransactionSafeActivity
/** Sets the hint text for the contacts search box */
private void setSearchBoxHint() {
- ((TextView) mSearchEditTextLayout.findViewById(R.id.search_box_start_search))
+ ((TextView) searchEditTextLayout.findViewById(R.id.search_box_start_search))
.setHint(getSearchBoxHint());
}
@@ -1074,12 +1070,12 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- if (mPendingSearchViewQuery != null) {
- mSearchView.setText(mPendingSearchViewQuery);
- mPendingSearchViewQuery = null;
+ if (pendingSearchViewQuery != null) {
+ searchView.setText(pendingSearchViewQuery);
+ pendingSearchViewQuery = null;
}
- if (mActionBarController != null) {
- mActionBarController.restoreActionBarOffset();
+ if (actionBarController != null) {
+ actionBarController.restoreActionBarOffset();
}
return false;
}
@@ -1133,9 +1129,9 @@ public class DialtactsActivity extends TransactionSafeActivity
isDialIntent,
isAddCallIntent);
showDialpadFragment(false);
- mDialpadFragment.setStartedFromNewIntent(true);
- if (showDialpadChooser && !mDialpadFragment.isVisible()) {
- mInCallDialpadUp = true;
+ dialpadFragment.setStartedFromNewIntent(true);
+ if (showDialpadChooser && !dialpadFragment.isVisible()) {
+ inCallDialpadUp = true;
}
} else if (isLastTabEnabled) {
@TabIndex
@@ -1145,8 +1141,8 @@ public class DialtactsActivity extends TransactionSafeActivity
.getInt(KEY_LAST_TAB, DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL);
// If voicemail tab is saved and its availability changes, we still move to the voicemail tab
// but it is quickly removed and shown the contacts tab.
- if (mListsFragment != null) {
- mListsFragment.showTab(tabIndex);
+ if (listsFragment != null) {
+ listsFragment.showTab(tabIndex);
PerformanceReport.setStartingTabIndex(tabIndex);
} else {
PerformanceReport.setStartingTabIndex(DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL);
@@ -1158,9 +1154,9 @@ public class DialtactsActivity extends TransactionSafeActivity
public void onNewIntent(Intent newIntent) {
LogUtil.enterBlock("DialtactsActivity.onNewIntent");
setIntent(newIntent);
- mFirstLaunch = true;
+ firstLaunch = true;
- mStateSaved = false;
+ stateSaved = false;
displayFragment(newIntent);
invalidateOptionsMenu();
@@ -1184,43 +1180,43 @@ public class DialtactsActivity extends TransactionSafeActivity
/** Shows the search fragment */
private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) {
LogUtil.i("DialtactsActivity.enterSearchUi", "smart dial: %b", smartDialSearch);
- if (mStateSaved || getFragmentManager().isDestroyed()) {
+ if (stateSaved || getFragmentManager().isDestroyed()) {
// Weird race condition where fragment is doing work after the activity is destroyed
// due to talkback being on (a bug). Just return since we can't do any
// constructive here.
LogUtil.i(
"DialtactsActivity.enterSearchUi",
"not entering search UI (mStateSaved: %b, isDestroyed: %b)",
- mStateSaved,
+ stateSaved,
getFragmentManager().isDestroyed());
return;
}
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
- if (mInDialpadSearch && mSmartDialSearchFragment != null) {
- transaction.remove(mSmartDialSearchFragment);
- } else if (mInRegularSearch && mRegularSearchFragment != null) {
- transaction.remove(mRegularSearchFragment);
+ if (inDialpadSearch && smartDialSearchFragment != null) {
+ transaction.remove(smartDialSearchFragment);
+ } else if (inRegularSearch && regularSearchFragment != null) {
+ transaction.remove(regularSearchFragment);
}
final String tag;
- mInDialpadSearch = false;
- mInRegularSearch = false;
- mInNewSearch = false;
+ inDialpadSearch = false;
+ inRegularSearch = false;
+ inNewSearch = false;
boolean useNewSearch =
ConfigProviderBindings.get(this).getBoolean("enable_new_search_fragment", false);
if (useNewSearch) {
tag = TAG_NEW_SEARCH_FRAGMENT;
- mInNewSearch = true;
+ inNewSearch = true;
} else if (smartDialSearch) {
tag = TAG_SMARTDIAL_SEARCH_FRAGMENT;
- mInDialpadSearch = true;
+ inDialpadSearch = true;
} else {
tag = TAG_REGULAR_SEARCH_FRAGMENT;
- mInRegularSearch = true;
+ inRegularSearch = true;
}
- mFloatingActionButtonController.scaleOut();
+ floatingActionButtonController.scaleOut();
if (animate) {
transaction.setCustomAnimations(android.R.animator.fade_in, 0);
@@ -1259,7 +1255,7 @@ public class DialtactsActivity extends TransactionSafeActivity
// Will show empty list if P13nRanker is not enabled. Else, re-ranked list by the ranker.
if (!useNewSearch) {
((SearchFragment) fragment)
- .setShowEmptyListForNullQuery(mP13nRanker.shouldShowEmptyListForNullQuery());
+ .setShowEmptyListForNullQuery(p13nRanker.shouldShowEmptyListForNullQuery());
} else {
// TODO(calderwoodra): add p13n ranker to new search.
}
@@ -1272,9 +1268,9 @@ public class DialtactsActivity extends TransactionSafeActivity
transaction.commit();
if (animate) {
- Assert.isNotNull(mListsFragment.getView()).animate().alpha(0).withLayer();
+ Assert.isNotNull(listsFragment.getView()).animate().alpha(0).withLayer();
}
- mListsFragment.setUserVisibleHint(false);
+ listsFragment.setUserVisibleHint(false);
if (smartDialSearch) {
Logger.get(this).logScreenView(ScreenEvent.Type.SMART_DIAL_SEARCH, this);
@@ -1288,14 +1284,14 @@ public class DialtactsActivity extends TransactionSafeActivity
LogUtil.enterBlock("DialtactsActivity.exitSearchUi");
// See related bug in enterSearchUI();
- if (getFragmentManager().isDestroyed() || mStateSaved) {
+ if (getFragmentManager().isDestroyed() || stateSaved) {
return;
}
- mSearchView.setText(null);
+ searchView.setText(null);
- if (mDialpadFragment != null) {
- mDialpadFragment.clearDialpad();
+ if (dialpadFragment != null) {
+ dialpadFragment.clearDialpad();
}
setNotInSearchUi();
@@ -1305,65 +1301,65 @@ public class DialtactsActivity extends TransactionSafeActivity
// - Not visible (move then show the fab)
// - Visible, in the correct position (do nothing)
// - Visible, in the wrong position (hide, move, then show the fab)
- if (mFloatingActionButtonController.isVisible()
+ if (floatingActionButtonController.isVisible()
&& getFabAlignment() != FloatingActionButtonController.ALIGN_END) {
- mFloatingActionButtonController.scaleOut(
+ floatingActionButtonController.scaleOut(
new OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton floatingActionButton) {
super.onHidden(floatingActionButton);
onPageScrolled(
- mListsFragment.getCurrentTabIndex(), 0 /* offset */, 0 /* pixelOffset */);
- mFloatingActionButtonController.scaleIn();
+ listsFragment.getCurrentTabIndex(), 0 /* offset */, 0 /* pixelOffset */);
+ floatingActionButtonController.scaleIn();
}
});
- } else if (!mFloatingActionButtonController.isVisible() && mListsFragment.shouldShowFab()) {
- onPageScrolled(mListsFragment.getCurrentTabIndex(), 0 /* offset */, 0 /* pixelOffset */);
+ } else if (!floatingActionButtonController.isVisible() && listsFragment.shouldShowFab()) {
+ onPageScrolled(listsFragment.getCurrentTabIndex(), 0 /* offset */, 0 /* pixelOffset */);
ThreadUtil.getUiThreadHandler()
- .postDelayed(() -> mFloatingActionButtonController.scaleIn(), FAB_SCALE_IN_DELAY_MS);
+ .postDelayed(() -> floatingActionButtonController.scaleIn(), FAB_SCALE_IN_DELAY_MS);
}
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
- if (mSmartDialSearchFragment != null) {
- transaction.remove(mSmartDialSearchFragment);
+ if (smartDialSearchFragment != null) {
+ transaction.remove(smartDialSearchFragment);
}
- if (mRegularSearchFragment != null) {
- transaction.remove(mRegularSearchFragment);
+ if (regularSearchFragment != null) {
+ transaction.remove(regularSearchFragment);
}
- if (mNewSearchFragment != null) {
- transaction.remove(mNewSearchFragment);
+ if (newSearchFragment != null) {
+ transaction.remove(newSearchFragment);
}
transaction.commit();
- Assert.isNotNull(mListsFragment.getView()).animate().alpha(1).withLayer();
+ Assert.isNotNull(listsFragment.getView()).animate().alpha(1).withLayer();
- if (mDialpadFragment == null || !mDialpadFragment.isVisible()) {
+ if (dialpadFragment == null || !dialpadFragment.isVisible()) {
// If the dialpad fragment wasn't previously visible, then send a screen view because
// we are exiting regular search. Otherwise, the screen view will be sent by
// {@link #hideDialpadFragment}.
- mListsFragment.sendScreenViewForCurrentPosition();
- mListsFragment.setUserVisibleHint(true);
+ listsFragment.sendScreenViewForCurrentPosition();
+ listsFragment.setUserVisibleHint(true);
}
- onPageSelected(mListsFragment.getCurrentTabIndex());
+ onPageSelected(listsFragment.getCurrentTabIndex());
- mActionBarController.onSearchUiExited();
+ actionBarController.onSearchUiExited();
}
@Override
public void onBackPressed() {
PerformanceReport.recordClick(UiAction.Type.PRESS_ANDROID_BACK_BUTTON);
- if (mStateSaved) {
+ if (stateSaved) {
return;
}
- if (mIsDialpadShown) {
+ if (isDialpadShown) {
hideDialpadFragment(true, false);
- if (TextUtils.isEmpty(mDialpadQuery)) {
+ if (TextUtils.isEmpty(dialpadQuery)) {
exitSearchUi();
}
} else if (isInSearchUi()) {
- if (mIsKeyboardOpen) {
- DialerUtils.hideInputMethod(mParentLayout);
+ if (isKeyboardOpen) {
+ DialerUtils.hideInputMethod(parentLayout);
PerformanceReport.recordClick(UiAction.Type.HIDE_KEYBOARD_IN_SEARCH);
} else {
exitSearchUi();
@@ -1378,51 +1374,51 @@ public class DialtactsActivity extends TransactionSafeActivity
super.onConfigurationChanged(configuration);
// Checks whether a hardware keyboard is available
if (configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
- mIsKeyboardOpen = true;
+ isKeyboardOpen = true;
} else if (configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
- mIsKeyboardOpen = false;
+ isKeyboardOpen = false;
}
}
private void maybeEnterSearchUi() {
if (!isInSearchUi()) {
- enterSearchUi(true /* isSmartDial */, mSearchQuery, false);
+ enterSearchUi(true /* isSmartDial */, searchQuery, false);
}
}
@Override
public void onDialpadQueryChanged(String query) {
- mDialpadQuery = query;
- if (mSmartDialSearchFragment != null) {
- mSmartDialSearchFragment.setAddToContactNumber(query);
+ dialpadQuery = query;
+ if (smartDialSearchFragment != null) {
+ smartDialSearchFragment.setAddToContactNumber(query);
}
- if (mNewSearchFragment != null) {
- mNewSearchFragment.setRawNumber(query);
+ if (newSearchFragment != null) {
+ newSearchFragment.setRawNumber(query);
}
final String normalizedQuery =
SmartDialNameMatcher.normalizeNumber(/* context = */ this, query);
- if (!TextUtils.equals(mSearchView.getText(), normalizedQuery)) {
+ if (!TextUtils.equals(searchView.getText(), normalizedQuery)) {
if (DEBUG) {
LogUtil.v("DialtactsActivity.onDialpadQueryChanged", "new query: " + query);
}
- if (mDialpadFragment == null || !mDialpadFragment.isVisible()) {
+ if (dialpadFragment == null || !dialpadFragment.isVisible()) {
// This callback can happen if the dialpad fragment is recreated because of
// activity destruction. In that case, don't update the search view because
// that would bring the user back to the search fragment regardless of the
// previous state of the application. Instead, just return here and let the
// fragment manager correctly figure out whatever fragment was last displayed.
if (!TextUtils.isEmpty(normalizedQuery)) {
- mPendingSearchViewQuery = normalizedQuery;
+ pendingSearchViewQuery = normalizedQuery;
}
return;
}
- mSearchView.setText(normalizedQuery);
+ searchView.setText(normalizedQuery);
}
try {
- if (mDialpadFragment != null && mDialpadFragment.isVisible()) {
- mDialpadFragment.process_quote_emergency_unquote(normalizedQuery);
+ if (dialpadFragment != null && dialpadFragment.isVisible()) {
+ dialpadFragment.process_quote_emergency_unquote(normalizedQuery);
}
} catch (Exception ignored) {
// Skip any exceptions for this piece of code
@@ -1431,9 +1427,9 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public boolean onDialpadSpacerTouchWithEmptyQuery() {
- if (mInDialpadSearch
- && mSmartDialSearchFragment != null
- && !mSmartDialSearchFragment.isShowingPermissionRequest()) {
+ if (inDialpadSearch
+ && smartDialSearchFragment != null
+ && !smartDialSearchFragment.isShowingPermissionRequest()) {
PerformanceReport.recordClick(UiAction.Type.CLOSE_DIALPAD);
hideDialpadFragment(true /* animate */, true /* clearDialpad */);
return true;
@@ -1443,15 +1439,15 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public boolean onSearchListTouch(MotionEvent event) {
- if (mIsDialpadShown) {
+ if (isDialpadShown) {
PerformanceReport.recordClick(UiAction.Type.CLOSE_DIALPAD);
hideDialpadFragment(true, false);
- if (TextUtils.isEmpty(mDialpadQuery)) {
+ if (TextUtils.isEmpty(dialpadQuery)) {
exitSearchUi();
}
return true;
} else {
- UiUtil.hideKeyboardFrom(this, mSearchEditTextLayout);
+ UiUtil.hideKeyboardFrom(this, searchEditTextLayout);
}
return false;
}
@@ -1461,7 +1457,7 @@ public class DialtactsActivity extends TransactionSafeActivity
PerformanceReport.recordScrollStateChange(scrollState);
if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
hideDialpadFragment(true, false);
- DialerUtils.hideInputMethod(mParentLayout);
+ DialerUtils.hideInputMethod(parentLayout);
}
}
@@ -1485,7 +1481,7 @@ public class DialtactsActivity extends TransactionSafeActivity
/** Called when the user has long-pressed a contact tile to start a drag operation. */
@Override
public void onDragStarted(int x, int y, PhoneFavoriteSquareTileView view) {
- mListsFragment.showRemoveView(true);
+ listsFragment.showRemoveView(true);
}
@Override
@@ -1494,7 +1490,7 @@ public class DialtactsActivity extends TransactionSafeActivity
/** Called when the user has released a contact tile after long-pressing it. */
@Override
public void onDragFinished(int x, int y) {
- mListsFragment.showRemoveView(false);
+ listsFragment.showRemoveView(false);
}
@Override
@@ -1506,15 +1502,15 @@ public class DialtactsActivity extends TransactionSafeActivity
*/
@Override
public void setDragDropController(DragDropController dragController) {
- mDragDropController = dragController;
- mListsFragment.getRemoveView().setDragDropController(dragController);
+ dragDropController = dragController;
+ listsFragment.getRemoveView().setDragDropController(dragController);
}
/** Implemented to satisfy {@link OldSpeedDialFragment.HostInterface} */
@Override
public void showAllContactsTab() {
- if (mListsFragment != null) {
- mListsFragment.showTab(DialtactsPagerAdapter.TAB_INDEX_ALL_CONTACTS);
+ if (listsFragment != null) {
+ listsFragment.showTab(DialtactsPagerAdapter.TAB_INDEX_ALL_CONTACTS);
}
}
@@ -1529,14 +1525,14 @@ public class DialtactsActivity extends TransactionSafeActivity
LogUtil.d("DialtactsActivity.enableFloatingButton", "enable: %b", enabled);
// Floating button shouldn't be enabled when dialpad is shown.
if (!isDialpadShown() || !enabled) {
- mFloatingActionButtonController.setVisible(enabled);
+ floatingActionButtonController.setVisible(enabled);
}
}
@Override
public void onPickDataUri(
Uri dataUri, boolean isVideoCall, CallSpecificAppData callSpecificAppData) {
- mClearSearchOnPause = true;
+ clearSearchOnPause = true;
PhoneNumberInteraction.startInteractionForPhoneCall(
DialtactsActivity.this, dataUri, isVideoCall, callSpecificAppData);
}
@@ -1555,7 +1551,7 @@ public class DialtactsActivity extends TransactionSafeActivity
.setIsVideoCall(isVideoCall)
.setAllowAssistedDial(callSpecificAppData.getAllowAssistedDialing()));
- mClearSearchOnPause = true;
+ clearSearchOnPause = true;
}
@Override
@@ -1569,30 +1565,30 @@ public class DialtactsActivity extends TransactionSafeActivity
if (newFavoritesIsEnabled()) {
return;
}
- int tabIndex = mListsFragment.getCurrentTabIndex();
+ int tabIndex = listsFragment.getCurrentTabIndex();
// Scroll the button from center to end when moving from the Speed Dial to Call History tab.
// In RTL, scroll when the current tab is Call History instead, since the order of the tabs
// is reversed and the ViewPager returns the left tab position during scroll.
boolean isRtl = ViewUtil.isRtl();
- if (!isRtl && tabIndex == DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL && !mIsLandscape) {
- mFloatingActionButtonController.onPageScrolled(positionOffset);
- } else if (isRtl && tabIndex == DialtactsPagerAdapter.TAB_INDEX_HISTORY && !mIsLandscape) {
- mFloatingActionButtonController.onPageScrolled(1 - positionOffset);
+ if (!isRtl && tabIndex == DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL && !isLandscape) {
+ floatingActionButtonController.onPageScrolled(positionOffset);
+ } else if (isRtl && tabIndex == DialtactsPagerAdapter.TAB_INDEX_HISTORY && !isLandscape) {
+ floatingActionButtonController.onPageScrolled(1 - positionOffset);
} else if (tabIndex != DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL) {
- mFloatingActionButtonController.onPageScrolled(1);
+ floatingActionButtonController.onPageScrolled(1);
}
}
@Override
public void onPageSelected(int position) {
updateMissedCalls();
- int tabIndex = mListsFragment.getCurrentTabIndex();
- if (tabIndex != mPreviouslySelectedTabIndex) {
- mFloatingActionButtonController.scaleIn();
+ int tabIndex = listsFragment.getCurrentTabIndex();
+ if (tabIndex != previouslySelectedTabIndex) {
+ floatingActionButtonController.scaleIn();
}
LogUtil.i("DialtactsActivity.onPageSelected", "tabIndex: %d", tabIndex);
- mPreviouslySelectedTabIndex = tabIndex;
+ previouslySelectedTabIndex = tabIndex;
timeTabSelected = SystemClock.elapsedRealtime();
}
@@ -1601,18 +1597,18 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public boolean isActionBarShowing() {
- return mActionBarController.isActionBarShowing();
+ return actionBarController.isActionBarShowing();
}
@Override
public boolean isDialpadShown() {
- return mIsDialpadShown;
+ return isDialpadShown;
}
@Override
public int getDialpadHeight() {
- if (mDialpadFragment != null) {
- return mDialpadFragment.getDialpadHeight();
+ if (dialpadFragment != null) {
+ return dialpadFragment.getDialpadHeight();
}
return 0;
}
@@ -1624,23 +1620,23 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public int getActionBarHeight() {
- return mActionBarHeight;
+ return actionBarHeight;
}
@VisibleForTesting
public int getFabAlignment() {
if (!newFavoritesIsEnabled()
- && !mIsLandscape
+ && !isLandscape
&& !isInSearchUi()
- && mListsFragment.getCurrentTabIndex() == DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL) {
+ && listsFragment.getCurrentTabIndex() == DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL) {
return FloatingActionButtonController.ALIGN_MIDDLE;
}
return FloatingActionButtonController.ALIGN_END;
}
private void updateMissedCalls() {
- if (mPreviouslySelectedTabIndex == DialtactsPagerAdapter.TAB_INDEX_HISTORY) {
- mListsFragment.markMissedCallsAsReadAndRemoveNotifications();
+ if (previouslySelectedTabIndex == DialtactsPagerAdapter.TAB_INDEX_HISTORY) {
+ listsFragment.markMissedCallsAsReadAndRemoveNotifications();
}
}
@@ -1690,19 +1686,19 @@ public class DialtactsActivity extends TransactionSafeActivity
}
private CallInitiationType.Type getCallInitiationType() {
- return mIsDialpadShown
+ return isDialpadShown
? CallInitiationType.Type.DIALPAD
: CallInitiationType.Type.REGULAR_SEARCH;
}
@Override
public void onCallPlacedFromSearch() {
- DialerUtils.hideInputMethod(mParentLayout);
- mClearSearchOnPause = true;
+ DialerUtils.hideInputMethod(parentLayout);
+ clearSearchOnPause = true;
}
protected int getPreviouslySelectedTabIndex() {
- return mPreviouslySelectedTabIndex;
+ return previouslySelectedTabIndex;
}
@Override
@@ -1726,8 +1722,8 @@ public class DialtactsActivity extends TransactionSafeActivity
MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents);
clearFrequents.setVisible(
PermissionsUtil.hasContactsReadPermissions(DialtactsActivity.this)
- && mListsFragment != null
- && mListsFragment.hasFrequents());
+ && listsFragment != null
+ && listsFragment.hasFrequents());
menu.findItem(R.id.menu_history)
.setVisible(PermissionsUtil.hasPhonePermissions(DialtactsActivity.this));
@@ -1759,7 +1755,7 @@ public class DialtactsActivity extends TransactionSafeActivity
@Override
public boolean onDrag(View v, DragEvent event) {
if (event.getAction() == DragEvent.ACTION_DRAG_LOCATION) {
- mDragDropController.handleDragHovered(v, (int) event.getX(), (int) event.getY());
+ dragDropController.handleDragHovered(v, (int) event.getX(), (int) event.getY());
}
return true;
}
@@ -1767,7 +1763,7 @@ public class DialtactsActivity extends TransactionSafeActivity
@VisibleForTesting
static void setVoiceSearchEnabledForTest(Optional<Boolean> enabled) {
- sVoiceSearchEnabledForTest = enabled;
+ voiceSearchEnabledForTest = enabled;
}
private boolean newFavoritesIsEnabled() {
diff --git a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java
index 05fb2b345..092c0982e 100644
--- a/java/com/android/dialer/app/calllog/BlockReportSpamListener.java
+++ b/java/com/android/dialer/app/calllog/BlockReportSpamListener.java
@@ -33,10 +33,10 @@ import com.android.dialer.spam.SpamComponent;
/** Listener to show dialogs for block and report spam actions. */
public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClickListener {
- private final Context mContext;
- private final FragmentManager mFragmentManager;
- private final RecyclerView.Adapter mAdapter;
- private final FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler;
+ private final Context context;
+ private final FragmentManager fragmentManager;
+ private final RecyclerView.Adapter adapter;
+ private final FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler;
private final Spam spam;
public BlockReportSpamListener(
@@ -44,10 +44,10 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
FragmentManager fragmentManager,
RecyclerView.Adapter adapter,
FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler) {
- mContext = context;
- mFragmentManager = fragmentManager;
- mAdapter = adapter;
- mFilteredNumberAsyncQueryHandler = filteredNumberAsyncQueryHandler;
+ this.context = context;
+ this.fragmentManager = fragmentManager;
+ this.adapter = adapter;
+ this.filteredNumberAsyncQueryHandler = filteredNumberAsyncQueryHandler;
spam = SpamComponent.get(context).spam();
}
@@ -64,7 +64,7 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
isSpamChecked -> {
LogUtil.i("BlockReportSpamListener.onBlockReportSpam", "onClick");
if (isSpamChecked && spam.isSpamEnabled()) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(
DialerImpression.Type
.REPORT_CALL_AS_SPAM_VIA_CALL_LOG_BLOCK_REPORT_SPAM_SENT_VIA_BLOCK_NUMBER_DIALOG);
@@ -75,17 +75,17 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
ReportingLocation.Type.CALL_LOG_HISTORY,
contactSourceType);
}
- mFilteredNumberAsyncQueryHandler.blockNumber(
+ filteredNumberAsyncQueryHandler.blockNumber(
uri -> {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.USER_ACTION_BLOCKED_NUMBER);
- mAdapter.notifyDataSetChanged();
+ adapter.notifyDataSetChanged();
},
number,
countryIso);
},
null)
- .show(mFragmentManager, BlockReportSpamDialogs.BLOCK_REPORT_SPAM_DIALOG_TAG);
+ .show(fragmentManager, BlockReportSpamDialogs.BLOCK_REPORT_SPAM_DIALOG_TAG);
}
@Override
@@ -101,7 +101,7 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
() -> {
LogUtil.i("BlockReportSpamListener.onBlock", "onClick");
if (spam.isSpamEnabled()) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(
DialerImpression.Type
.DIALOG_ACTION_CONFIRM_NUMBER_SPAM_INDIRECTLY_VIA_BLOCK_NUMBER);
@@ -112,17 +112,17 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
ReportingLocation.Type.CALL_LOG_HISTORY,
contactSourceType);
}
- mFilteredNumberAsyncQueryHandler.blockNumber(
+ filteredNumberAsyncQueryHandler.blockNumber(
uri -> {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.USER_ACTION_BLOCKED_NUMBER);
- mAdapter.notifyDataSetChanged();
+ adapter.notifyDataSetChanged();
},
number,
countryIso);
},
null)
- .show(mFragmentManager, BlockReportSpamDialogs.BLOCK_DIALOG_TAG);
+ .show(fragmentManager, BlockReportSpamDialogs.BLOCK_DIALOG_TAG);
}
@Override
@@ -140,7 +140,7 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
() -> {
LogUtil.i("BlockReportSpamListener.onUnblock", "onClick");
if (isSpam && spam.isSpamEnabled()) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.REPORT_AS_NOT_SPAM_VIA_UNBLOCK_NUMBER);
spam.reportNotSpamFromCallHistory(
number,
@@ -149,16 +149,16 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
ReportingLocation.Type.CALL_LOG_HISTORY,
contactSourceType);
}
- mFilteredNumberAsyncQueryHandler.unblock(
+ filteredNumberAsyncQueryHandler.unblock(
(rows, values) -> {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.USER_ACTION_UNBLOCKED_NUMBER);
- mAdapter.notifyDataSetChanged();
+ adapter.notifyDataSetChanged();
},
blockId);
},
null)
- .show(mFragmentManager, BlockReportSpamDialogs.UNBLOCK_DIALOG_TAG);
+ .show(fragmentManager, BlockReportSpamDialogs.UNBLOCK_DIALOG_TAG);
}
@Override
@@ -173,7 +173,7 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
() -> {
LogUtil.i("BlockReportSpamListener.onReportNotSpam", "onClick");
if (spam.isSpamEnabled()) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.DIALOG_ACTION_CONFIRM_NUMBER_NOT_SPAM);
spam.reportNotSpamFromCallHistory(
number,
@@ -182,9 +182,9 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
ReportingLocation.Type.CALL_LOG_HISTORY,
contactSourceType);
}
- mAdapter.notifyDataSetChanged();
+ adapter.notifyDataSetChanged();
},
null)
- .show(mFragmentManager, BlockReportSpamDialogs.NOT_SPAM_DIALOG_TAG);
+ .show(fragmentManager, BlockReportSpamDialogs.NOT_SPAM_DIALOG_TAG);
}
}
diff --git a/java/com/android/dialer/app/calllog/CallLogActivity.java b/java/com/android/dialer/app/calllog/CallLogActivity.java
index 4b65ed934..99e11b06c 100644
--- a/java/com/android/dialer/app/calllog/CallLogActivity.java
+++ b/java/com/android/dialer/app/calllog/CallLogActivity.java
@@ -52,13 +52,13 @@ public class CallLogActivity extends TransactionSafeActivity
@VisibleForTesting static final int TAB_INDEX_ALL = 0;
@VisibleForTesting static final int TAB_INDEX_MISSED = 1;
private static final int TAB_INDEX_COUNT = 2;
- private ViewPager mViewPager;
- private ViewPagerTabs mViewPagerTabs;
- private ViewPagerAdapter mViewPagerAdapter;
- private CallLogFragment mAllCallsFragment;
- private CallLogFragment mMissedCallsFragment;
- private String[] mTabTitles;
- private boolean mIsResumed;
+ private ViewPager viewPager;
+ private ViewPagerTabs viewPagerTabs;
+ private ViewPagerAdapter viewPagerAdapter;
+ private CallLogFragment allCallsFragment;
+ private CallLogFragment missedCallsFragment;
+ private String[] tabTitles;
+ private boolean isResumed;
private int selectedPageIndex;
@Override
@@ -84,21 +84,21 @@ public class CallLogActivity extends TransactionSafeActivity
}
selectedPageIndex = startingTab;
- mTabTitles = new String[TAB_INDEX_COUNT];
- mTabTitles[0] = getString(R.string.call_log_all_title);
- mTabTitles[1] = getString(R.string.call_log_missed_title);
+ tabTitles = new String[TAB_INDEX_COUNT];
+ tabTitles[0] = getString(R.string.call_log_all_title);
+ tabTitles[1] = getString(R.string.call_log_missed_title);
- mViewPager = (ViewPager) findViewById(R.id.call_log_pager);
+ viewPager = (ViewPager) findViewById(R.id.call_log_pager);
- mViewPagerAdapter = new ViewPagerAdapter(getFragmentManager());
- mViewPager.setAdapter(mViewPagerAdapter);
- mViewPager.setOffscreenPageLimit(1);
- mViewPager.setOnPageChangeListener(this);
+ viewPagerAdapter = new ViewPagerAdapter(getFragmentManager());
+ viewPager.setAdapter(viewPagerAdapter);
+ viewPager.setOffscreenPageLimit(1);
+ viewPager.setOnPageChangeListener(this);
- mViewPagerTabs = (ViewPagerTabs) findViewById(R.id.viewpager_header);
+ viewPagerTabs = (ViewPagerTabs) findViewById(R.id.viewpager_header);
- mViewPagerTabs.setViewPager(mViewPager);
- mViewPager.setCurrentItem(startingTab);
+ viewPagerTabs.setViewPager(viewPager);
+ viewPager.setCurrentItem(startingTab);
}
@Override
@@ -110,23 +110,23 @@ public class CallLogActivity extends TransactionSafeActivity
PerformanceReport.startRecording();
}
- mIsResumed = true;
+ isResumed = true;
super.onResume();
sendScreenViewForChildFragment();
}
@Override
protected void onPause() {
- mIsResumed = false;
+ isResumed = false;
super.onPause();
}
@Override
protected void onStop() {
- if (!isChangingConfigurations() && mViewPager != null) {
+ if (!isChangingConfigurations() && viewPager != null) {
// Make sure current index != selectedPageIndex
selectedPageIndex = -1;
- updateMissedCalls(mViewPager.getCurrentItem());
+ updateMissedCalls(viewPager.getCurrentItem());
}
super.onStop();
}
@@ -141,9 +141,9 @@ public class CallLogActivity extends TransactionSafeActivity
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
final MenuItem itemDeleteAll = menu.findItem(R.id.delete_all);
- if (mAllCallsFragment != null && itemDeleteAll != null) {
+ if (allCallsFragment != null && itemDeleteAll != null) {
// If onPrepareOptionsMenu is called before fragments are loaded, don't do anything.
- final CallLogAdapter adapter = mAllCallsFragment.getAdapter();
+ final CallLogAdapter adapter = allCallsFragment.getAdapter();
itemDeleteAll.setVisible(adapter != null && !adapter.isEmpty());
}
return true;
@@ -170,22 +170,22 @@ public class CallLogActivity extends TransactionSafeActivity
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- mViewPagerTabs.onPageScrolled(position, positionOffset, positionOffsetPixels);
+ viewPagerTabs.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
@Override
public void onPageSelected(int position) {
updateMissedCalls(position);
selectedPageIndex = position;
- if (mIsResumed) {
+ if (isResumed) {
sendScreenViewForChildFragment();
}
- mViewPagerTabs.onPageSelected(position);
+ viewPagerTabs.onPageSelected(position);
}
@Override
public void onPageScrollStateChanged(int state) {
- mViewPagerTabs.onPageScrollStateChanged(state);
+ viewPagerTabs.onPageScrollStateChanged(state);
}
private void sendScreenViewForChildFragment() {
@@ -194,7 +194,7 @@ public class CallLogActivity extends TransactionSafeActivity
private int getRtlPosition(int position) {
if (ViewUtil.isRtl()) {
- return mViewPagerAdapter.getCount() - 1 - position;
+ return viewPagerAdapter.getCount() - 1 - position;
}
return position;
}
@@ -205,13 +205,13 @@ public class CallLogActivity extends TransactionSafeActivity
}
switch (getRtlPosition(position)) {
case TAB_INDEX_ALL:
- if (mAllCallsFragment != null) {
- mAllCallsFragment.markMissedCallsAsReadAndRemoveNotifications();
+ if (allCallsFragment != null) {
+ allCallsFragment.markMissedCallsAsReadAndRemoveNotifications();
}
break;
case TAB_INDEX_MISSED:
- if (mMissedCallsFragment != null) {
- mMissedCallsFragment.markMissedCallsAsReadAndRemoveNotifications();
+ if (missedCallsFragment != null) {
+ missedCallsFragment.markMissedCallsAsReadAndRemoveNotifications();
}
break;
default:
@@ -255,10 +255,10 @@ public class CallLogActivity extends TransactionSafeActivity
final CallLogFragment fragment = (CallLogFragment) super.instantiateItem(container, position);
switch (getRtlPosition(position)) {
case TAB_INDEX_ALL:
- mAllCallsFragment = fragment;
+ allCallsFragment = fragment;
break;
case TAB_INDEX_MISSED:
- mMissedCallsFragment = fragment;
+ missedCallsFragment = fragment;
break;
default:
throw Assert.createIllegalStateFailException("Invalid position: " + position);
@@ -268,7 +268,7 @@ public class CallLogActivity extends TransactionSafeActivity
@Override
public CharSequence getPageTitle(int position) {
- return mTabTitles[position];
+ return tabTitles[position];
}
@Override
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java
index f3d04d935..261b0ec94 100644
--- a/java/com/android/dialer/app/calllog/CallLogAdapter.java
+++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java
@@ -116,54 +116,54 @@ public class CallLogAdapter extends GroupingListAdapter
public static final String ENABLE_CALL_LOG_MULTI_SELECT = "enable_call_log_multiselect";
public static final boolean ENABLE_CALL_LOG_MULTI_SELECT_FLAG = true;
- protected final Activity mActivity;
- protected final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter;
+ protected final Activity activity;
+ protected final VoicemailPlaybackPresenter voicemailPlaybackPresenter;
/** Cache for repeated requests to Telecom/Telephony. */
- protected final CallLogCache mCallLogCache;
+ protected final CallLogCache callLogCache;
- private final CallFetcher mCallFetcher;
- private final OnActionModeStateChangedListener mActionModeStateChangedListener;
- private final MultiSelectRemoveView mMultiSelectRemoveView;
- @NonNull private final FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler;
- private final int mActivityType;
+ private final CallFetcher callFetcher;
+ private final OnActionModeStateChangedListener actionModeStateChangedListener;
+ private final MultiSelectRemoveView multiSelectRemoveView;
+ @NonNull private final FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler;
+ private final int activityType;
/** Instance of helper class for managing views. */
- private final CallLogListItemHelper mCallLogListItemHelper;
+ private final CallLogListItemHelper callLogListItemHelper;
/** Helper to group call log entries. */
- private final CallLogGroupBuilder mCallLogGroupBuilder;
+ private final CallLogGroupBuilder callLogGroupBuilder;
- private final AsyncTaskExecutor mAsyncTaskExecutor = AsyncTaskExecutors.createAsyncTaskExecutor();
- private ContactInfoCache mContactInfoCache;
+ private final AsyncTaskExecutor asyncTaskExecutor = AsyncTaskExecutors.createAsyncTaskExecutor();
+ private ContactInfoCache contactInfoCache;
// Tracks the position of the currently expanded list item.
- private int mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
+ private int currentlyExpandedPosition = RecyclerView.NO_POSITION;
// Tracks the rowId of the currently expanded list item, so the position can be updated if there
// are any changes to the call log entries, such as additions or removals.
- private long mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
+ private long currentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
- private final CallLogAlertManager mCallLogAlertManager;
+ private final CallLogAlertManager callLogAlertManager;
- public ActionMode mActionMode = null;
+ public ActionMode actionMode = null;
public boolean selectAllMode = false;
public boolean deselectAllMode = false;
private final SparseArray<String> selectedItems = new SparseArray<>();
- private final ActionMode.Callback mActionModeCallback =
+ private final ActionMode.Callback actionModeCallback =
new ActionMode.Callback() {
// Called when the action mode is created; startActionMode() was called
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- if (mActivity != null) {
+ if (activity != null) {
announceforAccessibility(
- mActivity.getCurrentFocus(),
- mActivity.getString(R.string.description_entering_bulk_action_mode));
+ activity.getCurrentFocus(),
+ activity.getString(R.string.description_entering_bulk_action_mode));
}
- mActionMode = mode;
+ actionMode = mode;
// Inflate a menu resource providing context menu items
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.actionbar_delete, menu);
- mMultiSelectRemoveView.showMultiSelectRemoveView(true);
- mActionModeStateChangedListener.onActionModeStateChanged(true);
+ multiSelectRemoveView.showMultiSelectRemoveView(true);
+ actionModeStateChangedListener.onActionModeStateChanged(true);
return true;
}
@@ -178,7 +178,7 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if (item.getItemId() == R.id.action_bar_delete_menu_item) {
- Logger.get(mActivity).logImpression(DialerImpression.Type.MULTISELECT_TAP_DELETE_ICON);
+ Logger.get(activity).logImpression(DialerImpression.Type.MULTISELECT_TAP_DELETE_ICON);
if (selectedItems.size() > 0) {
showDeleteSelectedItemsDialog();
}
@@ -191,27 +191,27 @@ public class CallLogAdapter extends GroupingListAdapter
// Called when the user exits the action mode
@Override
public void onDestroyActionMode(ActionMode mode) {
- if (mActivity != null) {
+ if (activity != null) {
announceforAccessibility(
- mActivity.getCurrentFocus(),
- mActivity.getString(R.string.description_leaving_bulk_action_mode));
+ activity.getCurrentFocus(),
+ activity.getString(R.string.description_leaving_bulk_action_mode));
}
selectedItems.clear();
- mActionMode = null;
+ actionMode = null;
selectAllMode = false;
deselectAllMode = false;
- mMultiSelectRemoveView.showMultiSelectRemoveView(false);
- mActionModeStateChangedListener.onActionModeStateChanged(false);
+ multiSelectRemoveView.showMultiSelectRemoveView(false);
+ actionModeStateChangedListener.onActionModeStateChanged(false);
notifyDataSetChanged();
}
};
private void showDeleteSelectedItemsDialog() {
SparseArray<String> voicemailsToDeleteOnConfirmation = selectedItems.clone();
- new AlertDialog.Builder(mActivity, R.style.AlertDialogCustom)
+ new AlertDialog.Builder(activity, R.style.AlertDialogCustom)
.setCancelable(true)
.setTitle(
- mActivity
+ activity
.getResources()
.getQuantityString(
R.plurals.delete_voicemails_confirmation_dialog_title, selectedItems.size()))
@@ -224,9 +224,9 @@ public class CallLogAdapter extends GroupingListAdapter
"CallLogAdapter.showDeleteSelectedItemsDialog",
"onClick, these items to delete " + voicemailsToDeleteOnConfirmation);
deleteSelectedItems(voicemailsToDeleteOnConfirmation);
- mActionMode.finish();
+ actionMode.finish();
dialog.cancel();
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(
DialerImpression.Type.MULTISELECT_DELETE_ENTRY_VIA_CONFIRMATION_DIALOG);
}
@@ -235,7 +235,7 @@ public class CallLogAdapter extends GroupingListAdapter
new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(
DialerImpression.Type
.MULTISELECT_CANCEL_CONFIRMATION_DIALOG_VIA_CANCEL_TOUCH);
@@ -247,7 +247,7 @@ public class CallLogAdapter extends GroupingListAdapter
new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int button) {
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(
DialerImpression.Type
.MULTISELECT_CANCEL_CONFIRMATION_DIALOG_VIA_CANCEL_BUTTON);
@@ -255,7 +255,7 @@ public class CallLogAdapter extends GroupingListAdapter
}
})
.show();
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(DialerImpression.Type.MULTISELECT_DISPLAY_DELETE_CONFIRMATION_DIALOG);
}
@@ -263,30 +263,30 @@ public class CallLogAdapter extends GroupingListAdapter
for (int i = 0; i < voicemailsToDelete.size(); i++) {
String voicemailUri = voicemailsToDelete.get(voicemailsToDelete.keyAt(i));
LogUtil.i("CallLogAdapter.deleteSelectedItems", "deleting uri:" + voicemailUri);
- CallLogAsyncTaskUtil.deleteVoicemail(mActivity, Uri.parse(voicemailUri), null);
+ CallLogAsyncTaskUtil.deleteVoicemail(activity, Uri.parse(voicemailUri), null);
}
}
- private final View.OnLongClickListener mLongPressListener =
+ private final View.OnLongClickListener longPressListener =
new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (ConfigProviderBindings.get(v.getContext())
.getBoolean(ENABLE_CALL_LOG_MULTI_SELECT, ENABLE_CALL_LOG_MULTI_SELECT_FLAG)
- && mVoicemailPlaybackPresenter != null) {
+ && voicemailPlaybackPresenter != null) {
if (v.getId() == R.id.primary_action_view || v.getId() == R.id.quick_contact_photo) {
- if (mActionMode == null) {
- Logger.get(mActivity)
+ if (actionMode == null) {
+ Logger.get(activity)
.logImpression(
DialerImpression.Type.MULTISELECT_LONG_PRESS_ENTER_MULTI_SELECT_MODE);
- mActionMode = v.startActionMode(mActionModeCallback);
+ actionMode = v.startActionMode(actionModeCallback);
}
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(DialerImpression.Type.MULTISELECT_LONG_PRESS_TAP_ENTRY);
CallLogListItemViewHolder viewHolder = (CallLogListItemViewHolder) v.getTag();
viewHolder.quickContactView.setVisibility(View.GONE);
viewHolder.checkBoxView.setVisibility(View.VISIBLE);
- mExpandCollapseListener.onClick(v);
+ expandCollapseListener.onClick(v);
return true;
}
}
@@ -296,11 +296,11 @@ public class CallLogAdapter extends GroupingListAdapter
@VisibleForTesting
public View.OnClickListener getExpandCollapseListener() {
- return mExpandCollapseListener;
+ return expandCollapseListener;
}
/** The OnClickListener used to expand or collapse the action buttons of a call log entry. */
- private final View.OnClickListener mExpandCollapseListener =
+ private final View.OnClickListener expandCollapseListener =
new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -310,17 +310,17 @@ public class CallLogAdapter extends GroupingListAdapter
if (viewHolder == null) {
return;
}
- if (mActionMode != null && viewHolder.voicemailUri != null) {
+ if (actionMode != null && viewHolder.voicemailUri != null) {
selectAllMode = false;
deselectAllMode = false;
- mMultiSelectRemoveView.setSelectAllModeToFalse();
+ multiSelectRemoveView.setSelectAllModeToFalse();
int id = getVoicemailId(viewHolder.voicemailUri);
if (selectedItems.get(id) != null) {
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(DialerImpression.Type.MULTISELECT_SINGLE_PRESS_UNSELECT_ENTRY);
uncheckMarkCallLogEntry(viewHolder, id);
} else {
- Logger.get(mActivity)
+ Logger.get(activity)
.logImpression(DialerImpression.Type.MULTISELECT_SINGLE_PRESS_SELECT_ENTRY);
checkMarkCallLogEntry(viewHolder);
// select all check box logic
@@ -330,15 +330,15 @@ public class CallLogAdapter extends GroupingListAdapter
"getitem count %d is equal to items select count %d, check select all box",
getItemCount(),
selectedItems.size());
- mMultiSelectRemoveView.tapSelectAll();
+ multiSelectRemoveView.tapSelectAll();
}
}
return;
}
- if (mVoicemailPlaybackPresenter != null) {
+ if (voicemailPlaybackPresenter != null) {
// Always reset the voicemail playback state on expand or collapse.
- mVoicemailPlaybackPresenter.resetAll();
+ voicemailPlaybackPresenter.resetAll();
}
// If enriched call capabilities were unknown on the initial load,
@@ -368,16 +368,16 @@ public class CallLogAdapter extends GroupingListAdapter
getEnrichedCallManager().requestCapabilities(viewHolder.number);
}
- if (viewHolder.rowId == mCurrentlyExpandedRowId) {
+ if (viewHolder.rowId == currentlyExpandedRowId) {
// Hide actions, if the clicked item is the expanded item.
viewHolder.showActions(false);
- mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
- mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
+ currentlyExpandedPosition = RecyclerView.NO_POSITION;
+ currentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
} else {
if (viewHolder.callType == CallLog.Calls.MISSED_TYPE) {
- CallLogAsyncTaskUtil.markCallAsRead(mActivity, viewHolder.callIds);
- if (mActivityType == ACTIVITY_TYPE_DIALTACTS) {
+ CallLogAsyncTaskUtil.markCallAsRead(activity, viewHolder.callIds);
+ if (activityType == ACTIVITY_TYPE_DIALTACTS) {
((DialtactsActivity) v.getContext()).updateTabUnreadCounts();
}
}
@@ -400,7 +400,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (intentProvider == null) {
return false;
}
- return DuoConstants.PACKAGE_NAME.equals(intentProvider.getIntent(mActivity).getPackage());
+ return DuoConstants.PACKAGE_NAME.equals(intentProvider.getIntent(activity).getPackage());
}
};
@@ -411,8 +411,8 @@ public class CallLogAdapter extends GroupingListAdapter
private void checkMarkCallLogEntry(CallLogListItemViewHolder viewHolder) {
announceforAccessibility(
- mActivity.getCurrentFocus(),
- mActivity.getString(
+ activity.getCurrentFocus(),
+ activity.getString(
R.string.description_selecting_bulk_action_mode, viewHolder.nameOrNumber));
viewHolder.quickContactView.setVisibility(View.GONE);
viewHolder.checkBoxView.setVisibility(View.VISIBLE);
@@ -427,14 +427,14 @@ public class CallLogAdapter extends GroupingListAdapter
}
private void updateActionBar() {
- if (mActionMode == null && selectedItems.size() > 0) {
- Logger.get(mActivity)
+ if (actionMode == null && selectedItems.size() > 0) {
+ Logger.get(activity)
.logImpression(DialerImpression.Type.MULTISELECT_ROTATE_AND_SHOW_ACTION_MODE);
- mActivity.startActionMode(mActionModeCallback);
+ activity.startActionMode(actionModeCallback);
}
- if (mActionMode != null) {
- mActionMode.setTitle(
- mActivity
+ if (actionMode != null) {
+ actionMode.setTitle(
+ activity
.getResources()
.getString(
R.string.voicemailMultiSelectActionBarTitle,
@@ -444,8 +444,8 @@ public class CallLogAdapter extends GroupingListAdapter
private void uncheckMarkCallLogEntry(CallLogListItemViewHolder viewHolder, int id) {
announceforAccessibility(
- mActivity.getCurrentFocus(),
- mActivity.getString(
+ activity.getCurrentFocus(),
+ activity.getString(
R.string.description_unselecting_bulk_action_mode, viewHolder.nameOrNumber));
selectedItems.delete(id);
viewHolder.checkBoxView.setVisibility(View.GONE);
@@ -464,7 +464,7 @@ public class CallLogAdapter extends GroupingListAdapter
* if removing an item, it will be shown as an invisible view. This simplifies the calculation of
* item position.
*/
- @NonNull private Set<Long> mHiddenRowIds = new ArraySet<>();
+ @NonNull private Set<Long> hiddenRowIds = new ArraySet<>();
/**
* Holds a list of URIs that are pending deletion or undo. If the activity ends before the undo
* timeout, all of the pending URIs will be deleted.
@@ -473,9 +473,9 @@ public class CallLogAdapter extends GroupingListAdapter
* VisualVoicemailCallLogFragment}. The CallLogAdapter does not need to know about what to do with
* hidden item or what to hide.
*/
- @NonNull private final Set<Uri> mHiddenItemUris = new ArraySet<>();
+ @NonNull private final Set<Uri> hiddenItemUris = new ArraySet<>();
- private CallLogListItemViewHolder.OnClickListener mBlockReportSpamListener;
+ private CallLogListItemViewHolder.OnClickListener blockReportSpamListener;
/**
* Map, keyed by call ID, used to track the callback action for a call. Calls associated with the
@@ -483,7 +483,7 @@ public class CallLogAdapter extends GroupingListAdapter
* com.android.dialer.app.calllog.CallLogGroupBuilder}. This information is used to set the
* callback icon and trigger the corresponding action.
*/
- private final Map<Long, Integer> mCallbackActions = new ArrayMap<>();
+ private final Map<Long, Integer> callbackActions = new ArrayMap<>();
/**
* Map, keyed by call ID, used to track the day group for a call. As call log entries are put into
@@ -497,12 +497,12 @@ public class CallLogAdapter extends GroupingListAdapter
* previous day group without having to reverse the cursor to the start of the previous day call
* log entry.
*/
- private final Map<Long, Integer> mDayGroups = new ArrayMap<>();
+ private final Map<Long, Integer> dayGroups = new ArrayMap<>();
- private boolean mLoading = true;
- private ContactsPreferences mContactsPreferences;
+ private boolean loading = true;
+ private ContactsPreferences contactsPreferences;
- private boolean mIsSpamEnabled;
+ private boolean isSpamEnabled;
public CallLogAdapter(
Activity activity,
@@ -517,58 +517,58 @@ public class CallLogAdapter extends GroupingListAdapter
int activityType) {
super();
- mActivity = activity;
- mCallFetcher = callFetcher;
- mActionModeStateChangedListener = actionModeStateChangedListener;
- mMultiSelectRemoveView = multiSelectRemoveView;
- mVoicemailPlaybackPresenter = voicemailPlaybackPresenter;
- if (mVoicemailPlaybackPresenter != null) {
- mVoicemailPlaybackPresenter.setOnVoicemailDeletedListener(this);
+ this.activity = activity;
+ this.callFetcher = callFetcher;
+ this.actionModeStateChangedListener = actionModeStateChangedListener;
+ this.multiSelectRemoveView = multiSelectRemoveView;
+ this.voicemailPlaybackPresenter = voicemailPlaybackPresenter;
+ if (this.voicemailPlaybackPresenter != null) {
+ this.voicemailPlaybackPresenter.setOnVoicemailDeletedListener(this);
}
- mActivityType = activityType;
+ this.activityType = activityType;
- mContactInfoCache = contactInfoCache;
+ this.contactInfoCache = contactInfoCache;
if (!PermissionsUtil.hasContactsReadPermissions(activity)) {
- mContactInfoCache.disableRequestProcessing();
+ this.contactInfoCache.disableRequestProcessing();
}
- Resources resources = mActivity.getResources();
+ Resources resources = this.activity.getResources();
- mCallLogCache = callLogCache;
+ this.callLogCache = callLogCache;
PhoneCallDetailsHelper phoneCallDetailsHelper =
- new PhoneCallDetailsHelper(mActivity, resources, mCallLogCache);
- mCallLogListItemHelper =
- new CallLogListItemHelper(phoneCallDetailsHelper, resources, mCallLogCache);
- mCallLogGroupBuilder = new CallLogGroupBuilder(this);
- mFilteredNumberAsyncQueryHandler = Assert.isNotNull(filteredNumberAsyncQueryHandler);
+ new PhoneCallDetailsHelper(this.activity, resources, this.callLogCache);
+ callLogListItemHelper =
+ new CallLogListItemHelper(phoneCallDetailsHelper, resources, this.callLogCache);
+ callLogGroupBuilder = new CallLogGroupBuilder(this);
+ this.filteredNumberAsyncQueryHandler = Assert.isNotNull(filteredNumberAsyncQueryHandler);
- mContactsPreferences = new ContactsPreferences(mActivity);
+ contactsPreferences = new ContactsPreferences(this.activity);
- mBlockReportSpamListener =
+ blockReportSpamListener =
new BlockReportSpamListener(
- mActivity,
- ((Activity) mActivity).getFragmentManager(),
+ this.activity,
+ ((Activity) this.activity).getFragmentManager(),
this,
- mFilteredNumberAsyncQueryHandler);
+ this.filteredNumberAsyncQueryHandler);
setHasStableIds(true);
- mCallLogAlertManager =
- new CallLogAlertManager(this, LayoutInflater.from(mActivity), alertContainer);
+ callLogAlertManager =
+ new CallLogAlertManager(this, LayoutInflater.from(this.activity), alertContainer);
}
private void expandViewHolderActions(CallLogListItemViewHolder viewHolder) {
if (!TextUtils.isEmpty(viewHolder.voicemailUri)) {
- Logger.get(mActivity).logImpression(DialerImpression.Type.VOICEMAIL_EXPAND_ENTRY);
+ Logger.get(activity).logImpression(DialerImpression.Type.VOICEMAIL_EXPAND_ENTRY);
}
- int lastExpandedPosition = mCurrentlyExpandedPosition;
+ int lastExpandedPosition = currentlyExpandedPosition;
// Show the actions for the clicked list item.
viewHolder.showActions(true);
- mCurrentlyExpandedPosition = viewHolder.getAdapterPosition();
- mCurrentlyExpandedRowId = viewHolder.rowId;
+ currentlyExpandedPosition = viewHolder.getAdapterPosition();
+ currentlyExpandedRowId = viewHolder.rowId;
// If another item is expanded, notify it that it has changed. Its actions will be
// hidden when it is re-binded because we change mCurrentlyExpandedRowId above.
@@ -578,8 +578,8 @@ public class CallLogAdapter extends GroupingListAdapter
}
public void onSaveInstanceState(Bundle outState) {
- outState.putInt(KEY_EXPANDED_POSITION, mCurrentlyExpandedPosition);
- outState.putLong(KEY_EXPANDED_ROW_ID, mCurrentlyExpandedRowId);
+ outState.putInt(KEY_EXPANDED_POSITION, currentlyExpandedPosition);
+ outState.putLong(KEY_EXPANDED_ROW_ID, currentlyExpandedRowId);
ArrayList<String> listOfSelectedItems = new ArrayList<>();
@@ -603,9 +603,9 @@ public class CallLogAdapter extends GroupingListAdapter
public void onRestoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
- mCurrentlyExpandedPosition =
+ currentlyExpandedPosition =
savedInstanceState.getInt(KEY_EXPANDED_POSITION, RecyclerView.NO_POSITION);
- mCurrentlyExpandedRowId =
+ currentlyExpandedRowId =
savedInstanceState.getLong(KEY_EXPANDED_ROW_ID, NO_EXPANDED_LIST_ITEM);
// Restoring multi selected entries
ArrayList<String> listOfSelectedItems =
@@ -642,15 +642,15 @@ public class CallLogAdapter extends GroupingListAdapter
/** Requery on background thread when {@link Cursor} changes. */
@Override
protected void onContentChanged() {
- mCallFetcher.fetchCalls();
+ callFetcher.fetchCalls();
}
public void setLoading(boolean loading) {
- mLoading = loading;
+ this.loading = loading;
}
public boolean isEmpty() {
- if (mLoading) {
+ if (loading) {
// We don't want the empty state to show when loading.
return false;
} else {
@@ -659,15 +659,15 @@ public class CallLogAdapter extends GroupingListAdapter
}
public void clearFilteredNumbersCache() {
- mFilteredNumberAsyncQueryHandler.clearCache();
+ filteredNumberAsyncQueryHandler.clearCache();
}
public void onResume() {
- if (PermissionsUtil.hasPermission(mActivity, android.Manifest.permission.READ_CONTACTS)) {
- mContactInfoCache.start();
+ if (PermissionsUtil.hasPermission(activity, android.Manifest.permission.READ_CONTACTS)) {
+ contactInfoCache.start();
}
- mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
- mIsSpamEnabled = SpamComponent.get(mActivity).spam().isSpamEnabled();
+ contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
+ isSpamEnabled = SpamComponent.get(activity).spam().isSpamEnabled();
getDuo().registerListener(this);
notifyDataSetChanged();
}
@@ -675,8 +675,8 @@ public class CallLogAdapter extends GroupingListAdapter
public void onPause() {
getDuo().unregisterListener(this);
pauseCache();
- for (Uri uri : mHiddenItemUris) {
- CallLogAsyncTaskUtil.deleteVoicemail(mActivity, uri, null);
+ for (Uri uri : hiddenItemUris) {
+ CallLogAsyncTaskUtil.deleteVoicemail(activity, uri, null);
}
}
@@ -685,24 +685,24 @@ public class CallLogAdapter extends GroupingListAdapter
}
public CallLogAlertManager getAlertManager() {
- return mCallLogAlertManager;
+ return callLogAlertManager;
}
@VisibleForTesting
/* package */ void pauseCache() {
- mContactInfoCache.stop();
- mCallLogCache.reset();
+ contactInfoCache.stop();
+ callLogCache.reset();
}
@Override
protected void addGroups(Cursor cursor) {
- mCallLogGroupBuilder.addGroups(cursor);
+ callLogGroupBuilder.addGroups(cursor);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == VIEW_TYPE_ALERT) {
- return mCallLogAlertManager.createViewHolder(parent);
+ return callLogAlertManager.createViewHolder(parent);
}
return createCallLogEntryViewHolder(parent);
}
@@ -714,19 +714,19 @@ public class CallLogAdapter extends GroupingListAdapter
* @return The {@link ViewHolder}.
*/
private ViewHolder createCallLogEntryViewHolder(ViewGroup parent) {
- LayoutInflater inflater = LayoutInflater.from(mActivity);
+ LayoutInflater inflater = LayoutInflater.from(activity);
View view = inflater.inflate(R.layout.call_log_list_item, parent, false);
CallLogListItemViewHolder viewHolder =
CallLogListItemViewHolder.create(
view,
- mActivity,
- mBlockReportSpamListener,
- mExpandCollapseListener,
- mLongPressListener,
- mActionModeStateChangedListener,
- mCallLogCache,
- mCallLogListItemHelper,
- mVoicemailPlaybackPresenter);
+ activity,
+ blockReportSpamListener,
+ expandCollapseListener,
+ longPressListener,
+ actionModeStateChangedListener,
+ callLogCache,
+ callLogListItemHelper,
+ voicemailPlaybackPresenter);
viewHolder.callLogEntryView.setTag(viewHolder);
@@ -802,7 +802,7 @@ public class CallLogAdapter extends GroupingListAdapter
int groupSize = getGroupSize(position);
CallDetailsEntries callDetailsEntries = createCallDetailsEntries(c, groupSize);
PhoneCallDetails details = createPhoneCallDetails(c, groupSize, views);
- if (mHiddenRowIds.contains(c.getLong(CallLogQuery.ID))) {
+ if (hiddenRowIds.contains(c.getLong(CallLogQuery.ID))) {
views.callLogEntryView.setVisibility(View.GONE);
views.dayGroupHeader.setVisibility(View.GONE);
return;
@@ -810,7 +810,7 @@ public class CallLogAdapter extends GroupingListAdapter
views.callLogEntryView.setVisibility(View.VISIBLE);
// dayGroupHeader will be restored after loadAndRender() if it is needed.
}
- if (mCurrentlyExpandedRowId == views.rowId) {
+ if (currentlyExpandedRowId == views.rowId) {
views.inflateActionViewStub();
}
loadAndRender(views, views.rowId, details, callDetailsEntries);
@@ -849,19 +849,19 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
protected Boolean doInBackground(Void... params) {
viewHolder.blockId =
- mFilteredNumberAsyncQueryHandler.getBlockedIdSynchronous(
+ filteredNumberAsyncQueryHandler.getBlockedIdSynchronous(
viewHolder.number, viewHolder.countryIso);
details.isBlocked = viewHolder.blockId != null;
if (isCancelled()) {
return false;
}
- if (mIsSpamEnabled) {
+ if (isSpamEnabled) {
viewHolder.isSpamFeatureEnabled = true;
// Only display the call as a spam call if there are incoming calls in the list.
// Call log cards with only outgoing calls should never be displayed as spam.
viewHolder.isSpam =
details.hasIncomingCalls()
- && SpamComponent.get(mActivity)
+ && SpamComponent.get(activity)
.spam()
.checkSpamStatusSynchronous(viewHolder.number, viewHolder.countryIso);
details.isSpam = viewHolder.isSpam;
@@ -887,7 +887,7 @@ public class CallLogAdapter extends GroupingListAdapter
};
viewHolder.asyncTask = loadDataTask;
- mAsyncTaskExecutor.submit(LOAD_DATA_TASK_IDENTIFIER, loadDataTask);
+ asyncTaskExecutor.submit(LOAD_DATA_TASK_IDENTIFIER, loadDataTask);
}
@MainThread
@@ -1011,8 +1011,7 @@ public class CallLogAdapter extends GroupingListAdapter
final PhoneAccountHandle accountHandle =
PhoneAccountUtils.getAccount(details.accountComponentName, details.accountId);
- final boolean isVoicemailNumber =
- mCallLogCache.isVoicemailNumber(accountHandle, details.number);
+ final boolean isVoicemailNumber = callLogCache.isVoicemailNumber(accountHandle, details.number);
// Note: Binding of the action buttons is done as required in configureActionViews when the
// user expands the actions ViewStub.
@@ -1024,19 +1023,19 @@ public class CallLogAdapter extends GroupingListAdapter
// Only do remote lookup in first 5 rows.
int position = views.getAdapterPosition();
info =
- mContactInfoCache.getValue(
+ contactInfoCache.getValue(
details.number + details.postDialDigits,
details.countryIso,
details.cachedContactInfo,
position
- < ConfigProviderBindings.get(mActivity)
+ < ConfigProviderBindings.get(activity)
.getLong("number_of_call_to_do_remote_lookup", 5L));
}
CharSequence formattedNumber =
info.formattedNumber == null
? null
: PhoneNumberUtilsCompat.createTtsSpannable(info.formattedNumber);
- details.updateDisplayNumber(mActivity, formattedNumber, isVoicemailNumber);
+ details.updateDisplayNumber(activity, formattedNumber, isVoicemailNumber);
views.displayNumber = details.displayNumber;
views.accountHandle = accountHandle;
@@ -1046,7 +1045,7 @@ public class CallLogAdapter extends GroupingListAdapter
details.contactUri = info.lookupUri;
details.namePrimary = info.name;
details.nameAlternative = info.nameAlternative;
- details.nameDisplayOrder = mContactsPreferences.getDisplayOrder();
+ details.nameDisplayOrder = contactsPreferences.getDisplayOrder();
details.numberType = info.type;
details.numberLabel = info.label;
details.photoUri = info.photoUri;
@@ -1067,9 +1066,9 @@ public class CallLogAdapter extends GroupingListAdapter
}
views.info = info;
- views.numberType = getNumberType(mActivity.getResources(), details);
+ views.numberType = getNumberType(activity.getResources(), details);
- mCallLogListItemHelper.updatePhoneCallDetails(details);
+ callLogListItemHelper.updatePhoneCallDetails(details);
return true;
}
@@ -1119,11 +1118,11 @@ public class CallLogAdapter extends GroupingListAdapter
views.checkBoxView.setVisibility(View.GONE);
views.quickContactView.setVisibility(View.VISIBLE);
}
- mCallLogListItemHelper.setPhoneCallDetails(views, details);
- if (mCurrentlyExpandedRowId == views.rowId) {
+ callLogListItemHelper.setPhoneCallDetails(views, details);
+ if (currentlyExpandedRowId == views.rowId) {
// In case ViewHolders were added/removed, update the expanded position if the rowIds
// match so that we can restore the correct expanded state on rebind.
- mCurrentlyExpandedPosition = views.getAdapterPosition();
+ currentlyExpandedPosition = views.getAdapterPosition();
views.showActions(true);
} else {
views.showActions(false);
@@ -1134,12 +1133,12 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
public int getItemCount() {
- return super.getItemCount() + (mCallLogAlertManager.isEmpty() ? 0 : 1);
+ return super.getItemCount() + (callLogAlertManager.isEmpty() ? 0 : 1);
}
@Override
public int getItemViewType(int position) {
- if (position == ALERT_POSITION && !mCallLogAlertManager.isEmpty()) {
+ if (position == ALERT_POSITION && !callLogAlertManager.isEmpty()) {
return VIEW_TYPE_ALERT;
}
return VIEW_TYPE_CALLLOG;
@@ -1153,7 +1152,7 @@ public class CallLogAdapter extends GroupingListAdapter
*/
@Override
public Object getItem(int position) {
- return super.getItem(position - (mCallLogAlertManager.isEmpty() ? 0 : 1));
+ return super.getItem(position - (callLogAlertManager.isEmpty() ? 0 : 1));
}
@Override
@@ -1168,11 +1167,11 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
public int getGroupSize(int position) {
- return super.getGroupSize(position - (mCallLogAlertManager.isEmpty() ? 0 : 1));
+ return super.getGroupSize(position - (callLogAlertManager.isEmpty() ? 0 : 1));
}
protected boolean isCallLogActivity() {
- return mActivityType == ACTIVITY_TYPE_CALL_LOG;
+ return activityType == ACTIVITY_TYPE_CALL_LOG;
}
/**
@@ -1183,9 +1182,9 @@ public class CallLogAdapter extends GroupingListAdapter
*/
@Override
public void onVoicemailDeleted(CallLogListItemViewHolder viewHolder, Uri uri) {
- mHiddenRowIds.add(viewHolder.rowId);
+ hiddenRowIds.add(viewHolder.rowId);
// Save the new hidden item uri in case the activity is suspend before the undo has timed out.
- mHiddenItemUris.add(uri);
+ hiddenItemUris.add(uri);
collapseExpandedCard();
notifyItemChanged(viewHolder.getAdapterPosition());
@@ -1194,20 +1193,20 @@ public class CallLogAdapter extends GroupingListAdapter
}
private void collapseExpandedCard() {
- mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
- mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
+ currentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
+ currentlyExpandedPosition = RecyclerView.NO_POSITION;
}
/** When the list is changing all stored position is no longer valid. */
public void invalidatePositions() {
- mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
+ currentlyExpandedPosition = RecyclerView.NO_POSITION;
}
/** When the user clicks "undo", the hidden item is unhidden. */
@Override
public void onVoicemailDeleteUndo(long rowId, int adapterPosition, Uri uri) {
- mHiddenItemUris.remove(uri);
- mHiddenRowIds.remove(rowId);
+ hiddenItemUris.remove(uri);
+ hiddenRowIds.remove(rowId);
notifyItemChanged(adapterPosition);
// The next item might have to update its day group label
notifyItemChanged(adapterPosition + 1);
@@ -1216,7 +1215,7 @@ public class CallLogAdapter extends GroupingListAdapter
/** This callback signifies that a database deletion has completed. */
@Override
public void onVoicemailDeletedInDatabase(long rowId, Uri uri) {
- mHiddenItemUris.remove(uri);
+ hiddenItemUris.remove(uri);
}
/**
@@ -1240,7 +1239,7 @@ public class CallLogAdapter extends GroupingListAdapter
}
private void moveToPreviousNonHiddenRow(Cursor cursor) {
- while (cursor.moveToPrevious() && mHiddenRowIds.contains(cursor.getLong(CallLogQuery.ID))) {}
+ while (cursor.moveToPrevious() && hiddenRowIds.contains(cursor.getLong(CallLogQuery.ID))) {}
}
/**
@@ -1252,7 +1251,7 @@ public class CallLogAdapter extends GroupingListAdapter
*/
@MainThread
private int getCallbackAction(long callId) {
- Integer result = mCallbackActions.get(callId);
+ Integer result = callbackActions.get(callId);
if (result != null) {
return result;
}
@@ -1268,7 +1267,7 @@ public class CallLogAdapter extends GroupingListAdapter
*/
@MainThread
private int getDayGroup(long callId) {
- Integer result = mDayGroups.get(callId);
+ Integer result = dayGroups.get(callId);
if (result != null) {
return result;
}
@@ -1320,13 +1319,13 @@ public class CallLogAdapter extends GroupingListAdapter
@VisibleForTesting
void disableRequestProcessingForTest() {
// TODO: Remove this and test the cache directly.
- mContactInfoCache.disableRequestProcessing();
+ contactInfoCache.disableRequestProcessing();
}
@VisibleForTesting
void injectContactInfoForTest(String number, String countryIso, ContactInfo contactInfo) {
// TODO: Remove this and test the cache directly.
- mContactInfoCache.injectContactInfoForTest(number, countryIso, contactInfo);
+ contactInfoCache.injectContactInfoForTest(number, countryIso, contactInfo);
}
/**
@@ -1338,7 +1337,7 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
@MainThread
public void setCallbackAction(long rowId, @CallbackAction int callbackAction) {
- mCallbackActions.put(rowId, callbackAction);
+ callbackActions.put(rowId, callbackAction);
}
/**
@@ -1350,14 +1349,14 @@ public class CallLogAdapter extends GroupingListAdapter
@Override
@MainThread
public void setDayGroup(long rowId, int dayGroup) {
- mDayGroups.put(rowId, dayGroup);
+ dayGroups.put(rowId, dayGroup);
}
/** Clears the day group associations on re-bind of the call log. */
@Override
@MainThread
public void clearDayGroups() {
- mDayGroups.clear();
+ dayGroups.clear();
}
/**
@@ -1388,22 +1387,22 @@ public class CallLogAdapter extends GroupingListAdapter
*/
private CharSequence getGroupDescription(int group) {
if (group == CallLogGroupBuilder.DAY_GROUP_TODAY) {
- return mActivity.getResources().getString(R.string.call_log_header_today);
+ return activity.getResources().getString(R.string.call_log_header_today);
} else if (group == CallLogGroupBuilder.DAY_GROUP_YESTERDAY) {
- return mActivity.getResources().getString(R.string.call_log_header_yesterday);
+ return activity.getResources().getString(R.string.call_log_header_yesterday);
} else {
- return mActivity.getResources().getString(R.string.call_log_header_other);
+ return activity.getResources().getString(R.string.call_log_header_other);
}
}
@NonNull
private EnrichedCallManager getEnrichedCallManager() {
- return EnrichedCallComponent.get(mActivity).getEnrichedCallManager();
+ return EnrichedCallComponent.get(activity).getEnrichedCallManager();
}
@NonNull
private Duo getDuo() {
- return DuoComponent.get(mActivity).getDuo();
+ return DuoComponent.get(activity).getDuo();
}
@Override
diff --git a/java/com/android/dialer/app/calllog/CallLogAsync.java b/java/com/android/dialer/app/calllog/CallLogAsync.java
index f62deca89..26435f311 100644
--- a/java/com/android/dialer/app/calllog/CallLogAsync.java
+++ b/java/com/android/dialer/app/calllog/CallLogAsync.java
@@ -65,10 +65,10 @@ public class CallLogAsync {
/** AsyncTask to get the last outgoing call from the DB. */
private class GetLastOutgoingCallTask extends AsyncTask<GetLastOutgoingCallArgs, Void, String> {
- private final OnLastOutgoingCallComplete mCallback;
+ private final OnLastOutgoingCallComplete callback;
public GetLastOutgoingCallTask(OnLastOutgoingCallComplete callback) {
- mCallback = callback;
+ this.callback = callback;
}
// Happens on a background thread. We cannot run the callback
@@ -90,7 +90,7 @@ public class CallLogAsync {
@Override
protected void onPostExecute(String number) {
Assert.isMainThread();
- mCallback.lastOutgoingCall(number);
+ callback.lastOutgoingCall(number);
}
}
}
diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java
index c0d30f53a..08f5585b0 100644
--- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java
+++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java
@@ -38,20 +38,20 @@ import com.android.voicemail.VoicemailClient;
public class CallLogAsyncTaskUtil {
private static final String TAG = "CallLogAsyncTaskUtil";
- private static AsyncTaskExecutor sAsyncTaskExecutor;
+ private static AsyncTaskExecutor asyncTaskExecutor;
private static void initTaskExecutor() {
- sAsyncTaskExecutor = AsyncTaskExecutors.createThreadPoolExecutor();
+ asyncTaskExecutor = AsyncTaskExecutors.createThreadPoolExecutor();
}
public static void markVoicemailAsRead(
@NonNull final Context context, @NonNull final Uri voicemailUri) {
LogUtil.enterBlock("CallLogAsyncTaskUtil.markVoicemailAsRead, voicemailUri: " + voicemailUri);
- if (sAsyncTaskExecutor == null) {
+ if (asyncTaskExecutor == null) {
initTaskExecutor();
}
- sAsyncTaskExecutor.submit(
+ asyncTaskExecutor.submit(
Tasks.MARK_VOICEMAIL_READ,
new AsyncTask<Void, Void, Void>() {
@Override
@@ -77,11 +77,11 @@ public class CallLogAsyncTaskUtil {
@NonNull final Context context,
final Uri voicemailUri,
@Nullable final CallLogAsyncTaskListener callLogAsyncTaskListener) {
- if (sAsyncTaskExecutor == null) {
+ if (asyncTaskExecutor == null) {
initTaskExecutor();
}
- sAsyncTaskExecutor.submit(
+ asyncTaskExecutor.submit(
Tasks.DELETE_VOICEMAIL,
new AsyncTask<Void, Void, Void>() {
@Override
@@ -113,11 +113,11 @@ public class CallLogAsyncTaskUtil {
|| !PermissionsUtil.hasCallLogWritePermissions(context)) {
return;
}
- if (sAsyncTaskExecutor == null) {
+ if (asyncTaskExecutor == null) {
initTaskExecutor();
}
- sAsyncTaskExecutor.submit(
+ asyncTaskExecutor.submit(
Tasks.MARK_CALL_READ,
new AsyncTask<Void, Void, Void>() {
@Override
diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java
index 6910f1918..4f5035fc6 100644
--- a/java/com/android/dialer/app/calllog/CallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/CallLogFragment.java
@@ -101,47 +101,47 @@ public class CallLogFragment extends Fragment
private static final int EVENT_UPDATE_DISPLAY = 1;
private static final long MILLIS_IN_MINUTE = 60 * 1000;
- private final Handler mHandler = new Handler();
+ private final Handler handler = new Handler();
// See issue 6363009
- private final ContentObserver mCallLogObserver = new CustomContentObserver();
- private final ContentObserver mContactsObserver = new CustomContentObserver();
- private View mMultiSelectUnSelectAllViewContent;
- private TextView mSelectUnselectAllViewText;
- private ImageView mSelectUnselectAllIcon;
- private RecyclerView mRecyclerView;
- private LinearLayoutManager mLayoutManager;
- private CallLogAdapter mAdapter;
- private CallLogQueryHandler mCallLogQueryHandler;
- private boolean mScrollToTop;
- private EmptyContentView mEmptyListView;
- private ContactInfoCache mContactInfoCache;
- private final OnContactInfoChangedListener mOnContactInfoChangedListener =
+ private final ContentObserver callLogObserver = new CustomContentObserver();
+ private final ContentObserver contactsObserver = new CustomContentObserver();
+ private View multiSelectUnSelectAllViewContent;
+ private TextView selectUnselectAllViewText;
+ private ImageView selectUnselectAllIcon;
+ private RecyclerView recyclerView;
+ private LinearLayoutManager layoutManager;
+ private CallLogAdapter adapter;
+ private CallLogQueryHandler callLogQueryHandler;
+ private boolean scrollToTop;
+ private EmptyContentView emptyListView;
+ private ContactInfoCache contactInfoCache;
+ private final OnContactInfoChangedListener onContactInfoChangedListener =
new OnContactInfoChangedListener() {
@Override
public void onContactInfoChanged() {
- if (mAdapter != null) {
- mAdapter.notifyDataSetChanged();
+ if (adapter != null) {
+ adapter.notifyDataSetChanged();
}
}
};
- private boolean mRefreshDataRequired;
- private boolean mHasReadCallLogPermission;
+ private boolean refreshDataRequired;
+ private boolean hasReadCallLogPermission;
// Exactly same variable is in Fragment as a package private.
- private boolean mMenuVisible = true;
+ private boolean menuVisible = true;
// Default to all calls.
- private int mCallTypeFilter = CallLogQueryHandler.CALL_TYPE_ALL;
+ private int callTypeFilter = CallLogQueryHandler.CALL_TYPE_ALL;
// Log limit - if no limit is specified, then the default in {@link CallLogQueryHandler}
// will be used.
- private int mLogLimit = NO_LOG_LIMIT;
+ private int logLimit = NO_LOG_LIMIT;
// Date limit (in millis since epoch) - when non-zero, only calls which occurred on or after
// the date filter are included. If zero, no date-based filtering occurs.
- private long mDateLimit = NO_DATE_LIMIT;
+ private long dateLimit = NO_DATE_LIMIT;
/*
* True if this instance of the CallLogFragment shown in the CallLogActivity.
*/
- private boolean mIsCallLogActivity = false;
+ private boolean isCallLogActivity = false;
private boolean selectAllMode;
- private final Handler mDisplayUpdateHandler =
+ private final Handler displayUpdateHandler =
new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -155,8 +155,8 @@ public class CallLogFragment extends Fragment
}
}
};
- protected CallLogModalAlertManager mModalAlertManager;
- private ViewGroup mModalAlertView;
+ protected CallLogModalAlertManager modalAlertManager;
+ private ViewGroup modalAlertView;
public CallLogFragment() {
this(CallLogQueryHandler.CALL_TYPE_ALL, NO_LOG_LIMIT);
@@ -168,7 +168,7 @@ public class CallLogFragment extends Fragment
public CallLogFragment(int filterType, boolean isCallLogActivity) {
this(filterType, NO_LOG_LIMIT);
- mIsCallLogActivity = isCallLogActivity;
+ this.isCallLogActivity = isCallLogActivity;
}
public CallLogFragment(int filterType, int logLimit) {
@@ -195,38 +195,38 @@ public class CallLogFragment extends Fragment
* @param dateLimit limits results to calls occurring on or after the specified date.
*/
public CallLogFragment(int filterType, int logLimit, long dateLimit) {
- mCallTypeFilter = filterType;
- mLogLimit = logLimit;
- mDateLimit = dateLimit;
+ callTypeFilter = filterType;
+ this.logLimit = logLimit;
+ this.dateLimit = dateLimit;
}
@Override
public void onCreate(Bundle state) {
LogUtil.enterBlock("CallLogFragment.onCreate");
super.onCreate(state);
- mRefreshDataRequired = true;
+ refreshDataRequired = true;
if (state != null) {
- mCallTypeFilter = state.getInt(KEY_FILTER_TYPE, mCallTypeFilter);
- mLogLimit = state.getInt(KEY_LOG_LIMIT, mLogLimit);
- mDateLimit = state.getLong(KEY_DATE_LIMIT, mDateLimit);
- mIsCallLogActivity = state.getBoolean(KEY_IS_CALL_LOG_ACTIVITY, mIsCallLogActivity);
- mHasReadCallLogPermission = state.getBoolean(KEY_HAS_READ_CALL_LOG_PERMISSION, false);
- mRefreshDataRequired = state.getBoolean(KEY_REFRESH_DATA_REQUIRED, mRefreshDataRequired);
+ callTypeFilter = state.getInt(KEY_FILTER_TYPE, callTypeFilter);
+ logLimit = state.getInt(KEY_LOG_LIMIT, logLimit);
+ dateLimit = state.getLong(KEY_DATE_LIMIT, dateLimit);
+ isCallLogActivity = state.getBoolean(KEY_IS_CALL_LOG_ACTIVITY, isCallLogActivity);
+ hasReadCallLogPermission = state.getBoolean(KEY_HAS_READ_CALL_LOG_PERMISSION, false);
+ refreshDataRequired = state.getBoolean(KEY_REFRESH_DATA_REQUIRED, refreshDataRequired);
selectAllMode = state.getBoolean(KEY_SELECT_ALL_MODE, false);
}
final Activity activity = getActivity();
final ContentResolver resolver = activity.getContentResolver();
- mCallLogQueryHandler = new CallLogQueryHandler(activity, resolver, this, mLogLimit);
+ callLogQueryHandler = new CallLogQueryHandler(activity, resolver, this, logLimit);
if (PermissionsUtil.hasCallLogReadPermissions(getContext())) {
- resolver.registerContentObserver(CallLog.CONTENT_URI, true, mCallLogObserver);
+ resolver.registerContentObserver(CallLog.CONTENT_URI, true, callLogObserver);
} else {
LogUtil.w("CallLogFragment.onCreate", "call log permission not available");
}
if (PermissionsUtil.hasContactsReadPermissions(getContext())) {
resolver.registerContentObserver(
- ContactsContract.Contacts.CONTENT_URI, true, mContactsObserver);
+ ContactsContract.Contacts.CONTENT_URI, true, contactsObserver);
} else {
LogUtil.w("CallLogFragment.onCreate", "contacts permission not available.");
}
@@ -240,49 +240,49 @@ public class CallLogFragment extends Fragment
// Return false; we did not take ownership of the cursor
return false;
}
- mAdapter.invalidatePositions();
- mAdapter.setLoading(false);
- mAdapter.changeCursor(cursor);
+ adapter.invalidatePositions();
+ adapter.setLoading(false);
+ adapter.changeCursor(cursor);
// This will update the state of the "Clear call log" menu item.
getActivity().invalidateOptionsMenu();
if (cursor != null && cursor.getCount() > 0) {
- mRecyclerView.setPaddingRelative(
- mRecyclerView.getPaddingStart(),
+ recyclerView.setPaddingRelative(
+ recyclerView.getPaddingStart(),
0,
- mRecyclerView.getPaddingEnd(),
+ recyclerView.getPaddingEnd(),
getResources().getDimensionPixelSize(R.dimen.floating_action_button_list_bottom_padding));
- mEmptyListView.setVisibility(View.GONE);
+ emptyListView.setVisibility(View.GONE);
} else {
- mRecyclerView.setPaddingRelative(
- mRecyclerView.getPaddingStart(), 0, mRecyclerView.getPaddingEnd(), 0);
- mEmptyListView.setVisibility(View.VISIBLE);
+ recyclerView.setPaddingRelative(
+ recyclerView.getPaddingStart(), 0, recyclerView.getPaddingEnd(), 0);
+ emptyListView.setVisibility(View.VISIBLE);
}
- if (mScrollToTop) {
+ if (scrollToTop) {
// The smooth-scroll animation happens over a fixed time period.
// As a result, if it scrolls through a large portion of the list,
// each frame will jump so far from the previous one that the user
// will not experience the illusion of downward motion. Instead,
// if we're not already near the top of the list, we instantly jump
// near the top, and animate from there.
- if (mLayoutManager.findFirstVisibleItemPosition() > 5) {
+ if (layoutManager.findFirstVisibleItemPosition() > 5) {
// TODO: Jump to near the top, then begin smooth scroll.
- mRecyclerView.smoothScrollToPosition(0);
+ recyclerView.smoothScrollToPosition(0);
}
// Workaround for framework issue: the smooth-scroll doesn't
// occur if setSelection() is called immediately before.
- mHandler.post(
+ handler.post(
new Runnable() {
@Override
public void run() {
if (getActivity() == null || getActivity().isFinishing()) {
return;
}
- mRecyclerView.smoothScrollToPosition(0);
+ recyclerView.smoothScrollToPosition(0);
}
});
- mScrollToTop = false;
+ scrollToTop = false;
}
return true;
}
@@ -304,57 +304,57 @@ public class CallLogFragment extends Fragment
}
protected void setupView(View view) {
- mRecyclerView = (RecyclerView) 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.setImage(R.drawable.empty_call_log);
- mEmptyListView.setActionClickedListener(this);
- mModalAlertView = (ViewGroup) view.findViewById(R.id.modal_message_container);
- mModalAlertManager =
- new CallLogModalAlertManager(LayoutInflater.from(getContext()), mModalAlertView, this);
- mMultiSelectUnSelectAllViewContent =
+ recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
+ recyclerView.setHasFixedSize(true);
+ layoutManager = new LinearLayoutManager(getActivity());
+ recyclerView.setLayoutManager(layoutManager);
+ PerformanceReport.logOnScrollStateChange(recyclerView);
+ emptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view);
+ emptyListView.setImage(R.drawable.empty_call_log);
+ emptyListView.setActionClickedListener(this);
+ modalAlertView = (ViewGroup) view.findViewById(R.id.modal_message_container);
+ modalAlertManager =
+ new CallLogModalAlertManager(LayoutInflater.from(getContext()), modalAlertView, this);
+ multiSelectUnSelectAllViewContent =
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);
- mMultiSelectUnSelectAllViewContent.setOnClickListener(null);
- mSelectUnselectAllIcon.setOnClickListener(this);
- mSelectUnselectAllViewText.setOnClickListener(this);
+ selectUnselectAllViewText = (TextView) view.findViewById(R.id.select_all_view_text);
+ selectUnselectAllIcon = (ImageView) view.findViewById(R.id.select_all_view_icon);
+ multiSelectUnSelectAllViewContent.setOnClickListener(null);
+ selectUnselectAllIcon.setOnClickListener(this);
+ selectUnselectAllViewText.setOnClickListener(this);
}
protected void setupData() {
int activityType =
- mIsCallLogActivity
+ isCallLogActivity
? CallLogAdapter.ACTIVITY_TYPE_CALL_LOG
: CallLogAdapter.ACTIVITY_TYPE_DIALTACTS;
String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
- mContactInfoCache =
+ contactInfoCache =
new ContactInfoCache(
ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity())
.getRetainedCache(),
new ContactInfoHelper(getActivity(), currentCountryIso),
- mOnContactInfoChangedListener);
- mAdapter =
+ onContactInfoChangedListener);
+ adapter =
Bindings.getLegacy(getActivity())
.newCallLogAdapter(
getActivity(),
- mRecyclerView,
+ recyclerView,
this,
this,
activityType == CallLogAdapter.ACTIVITY_TYPE_DIALTACTS
? (CallLogAdapter.OnActionModeStateChangedListener) getActivity()
: null,
new CallLogCache(getActivity()),
- mContactInfoCache,
+ contactInfoCache,
getVoicemailPlaybackPresenter(),
new FilteredNumberAsyncQueryHandler(getActivity()),
activityType);
- mRecyclerView.setAdapter(mAdapter);
- if (mAdapter.getOnScrollListener() != null) {
- mRecyclerView.addOnScrollListener(mAdapter.getOnScrollListener());
+ recyclerView.setAdapter(adapter);
+ if (adapter.getOnScrollListener() != null) {
+ recyclerView.addOnScrollListener(adapter.getOnScrollListener());
}
fetchCalls();
}
@@ -370,7 +370,7 @@ public class CallLogFragment extends Fragment
super.onActivityCreated(savedInstanceState);
setupData();
updateSelectAllState(savedInstanceState);
- mAdapter.onRestoreInstanceState(savedInstanceState);
+ adapter.onRestoreInstanceState(savedInstanceState);
}
private void updateSelectAllState(Bundle savedInstanceState) {
@@ -384,7 +384,7 @@ public class CallLogFragment extends Fragment
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- updateEmptyMessage(mCallTypeFilter);
+ updateEmptyMessage(callTypeFilter);
}
@Override
@@ -393,23 +393,23 @@ public class CallLogFragment extends Fragment
super.onResume();
final boolean hasReadCallLogPermission =
PermissionsUtil.hasPermission(getActivity(), READ_CALL_LOG);
- if (!mHasReadCallLogPermission && hasReadCallLogPermission) {
+ if (!this.hasReadCallLogPermission && hasReadCallLogPermission) {
// We didn't have the permission before, and now we do. Force a refresh of the call log.
// Note that this code path always happens on a fresh start, but mRefreshDataRequired
// is already true in that case anyway.
- mRefreshDataRequired = true;
- updateEmptyMessage(mCallTypeFilter);
+ refreshDataRequired = true;
+ updateEmptyMessage(callTypeFilter);
}
- mHasReadCallLogPermission = hasReadCallLogPermission;
+ this.hasReadCallLogPermission = hasReadCallLogPermission;
/*
* Always clear the filtered numbers cache since users could have blocked/unblocked numbers
* from the settings page
*/
- mAdapter.clearFilteredNumbersCache();
+ adapter.clearFilteredNumbersCache();
refreshData();
- mAdapter.onResume();
+ adapter.onResume();
rescheduleDisplayUpdate();
// onResume() may also be called as a "side" page on the ViewPager, which is not visible.
@@ -425,7 +425,7 @@ public class CallLogFragment extends Fragment
onNotVisible();
}
cancelDisplayUpdate();
- mAdapter.onPause();
+ adapter.onPause();
super.onPause();
}
@@ -437,48 +437,48 @@ public class CallLogFragment extends Fragment
if (CequintCallerIdManager.isCequintCallerIdEnabled(getContext())) {
cequintCallerIdManager = CequintCallerIdManager.createInstanceForCallLog();
}
- mContactInfoCache.setCequintCallerIdManager(cequintCallerIdManager);
+ contactInfoCache.setCequintCallerIdManager(cequintCallerIdManager);
}
@Override
public void onStop() {
LogUtil.enterBlock("CallLogFragment.onStop");
super.onStop();
- mAdapter.onStop();
- mContactInfoCache.stop();
+ adapter.onStop();
+ contactInfoCache.stop();
}
@Override
public void onDestroy() {
LogUtil.enterBlock("CallLogFragment.onDestroy");
- if (mAdapter != null) {
- mAdapter.changeCursor(null);
+ if (adapter != null) {
+ adapter.changeCursor(null);
}
- getActivity().getContentResolver().unregisterContentObserver(mCallLogObserver);
- getActivity().getContentResolver().unregisterContentObserver(mContactsObserver);
+ getActivity().getContentResolver().unregisterContentObserver(callLogObserver);
+ getActivity().getContentResolver().unregisterContentObserver(contactsObserver);
super.onDestroy();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putInt(KEY_FILTER_TYPE, mCallTypeFilter);
- outState.putInt(KEY_LOG_LIMIT, mLogLimit);
- outState.putLong(KEY_DATE_LIMIT, mDateLimit);
- outState.putBoolean(KEY_IS_CALL_LOG_ACTIVITY, mIsCallLogActivity);
- outState.putBoolean(KEY_HAS_READ_CALL_LOG_PERMISSION, mHasReadCallLogPermission);
- outState.putBoolean(KEY_REFRESH_DATA_REQUIRED, mRefreshDataRequired);
+ outState.putInt(KEY_FILTER_TYPE, callTypeFilter);
+ outState.putInt(KEY_LOG_LIMIT, logLimit);
+ outState.putLong(KEY_DATE_LIMIT, dateLimit);
+ outState.putBoolean(KEY_IS_CALL_LOG_ACTIVITY, isCallLogActivity);
+ outState.putBoolean(KEY_HAS_READ_CALL_LOG_PERMISSION, hasReadCallLogPermission);
+ outState.putBoolean(KEY_REFRESH_DATA_REQUIRED, refreshDataRequired);
outState.putBoolean(KEY_SELECT_ALL_MODE, selectAllMode);
- if (mAdapter != null) {
- mAdapter.onSaveInstanceState(outState);
+ if (adapter != null) {
+ adapter.onSaveInstanceState(outState);
}
}
@Override
public void fetchCalls() {
- mCallLogQueryHandler.fetchCalls(mCallTypeFilter, mDateLimit);
- if (!mIsCallLogActivity) {
+ callLogQueryHandler.fetchCalls(callTypeFilter, dateLimit);
+ if (!isCallLogActivity) {
((ListsFragment) getParentFragment()).updateTabUnreadCounts();
}
}
@@ -490,8 +490,8 @@ public class CallLogFragment extends Fragment
}
if (!PermissionsUtil.hasPermission(context, READ_CALL_LOG)) {
- mEmptyListView.setDescription(R.string.permission_no_calllog);
- mEmptyListView.setActionLabel(R.string.permission_single_turn_on);
+ emptyListView.setDescription(R.string.permission_no_calllog);
+ emptyListView.setActionLabel(R.string.permission_single_turn_on);
return;
}
@@ -510,25 +510,25 @@ public class CallLogFragment extends Fragment
throw new IllegalArgumentException(
"Unexpected filter type in CallLogFragment: " + filterType);
}
- mEmptyListView.setDescription(messageId);
- if (mIsCallLogActivity) {
- mEmptyListView.setActionLabel(EmptyContentView.NO_LABEL);
+ emptyListView.setDescription(messageId);
+ if (isCallLogActivity) {
+ emptyListView.setActionLabel(EmptyContentView.NO_LABEL);
} else if (filterType == CallLogQueryHandler.CALL_TYPE_ALL) {
- mEmptyListView.setActionLabel(R.string.call_log_all_empty_action);
+ emptyListView.setActionLabel(R.string.call_log_all_empty_action);
} else {
- mEmptyListView.setActionLabel(EmptyContentView.NO_LABEL);
+ emptyListView.setActionLabel(EmptyContentView.NO_LABEL);
}
}
public CallLogAdapter getAdapter() {
- return mAdapter;
+ return adapter;
}
@Override
public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible);
- if (mMenuVisible != menuVisible) {
- mMenuVisible = menuVisible;
+ if (this.menuVisible != menuVisible) {
+ this.menuVisible = menuVisible;
if (menuVisible && isResumed()) {
refreshData();
}
@@ -538,19 +538,19 @@ public class CallLogFragment extends Fragment
/** Requests updates to the data to be shown. */
private void refreshData() {
// Prevent unnecessary refresh.
- if (mRefreshDataRequired) {
+ if (refreshDataRequired) {
// Mark all entries in the contact info cache as out of date, so they will be looked up
// again once being shown.
- mContactInfoCache.invalidate();
- mAdapter.setLoading(true);
+ contactInfoCache.invalidate();
+ adapter.setLoading(true);
fetchCalls();
- mCallLogQueryHandler.fetchVoicemailStatus();
- mCallLogQueryHandler.fetchMissedCallsUnreadCount();
- mRefreshDataRequired = false;
+ callLogQueryHandler.fetchVoicemailStatus();
+ callLogQueryHandler.fetchMissedCallsUnreadCount();
+ refreshDataRequired = false;
} else {
// Refresh the display of the existing data to update the timestamp text descriptions.
- mAdapter.notifyDataSetChanged();
+ adapter.notifyDataSetChanged();
}
}
@@ -569,7 +569,7 @@ public class CallLogFragment extends Fragment
"CallLogFragment.onEmptyViewActionButtonClicked",
"Requesting permissions: " + Arrays.toString(deniedPermissions));
FragmentCompat.requestPermissions(this, deniedPermissions, PHONE_PERMISSIONS_REQUEST_CODE);
- } else if (!mIsCallLogActivity) {
+ } else if (!isCallLogActivity) {
LogUtil.i("CallLogFragment.onEmptyViewActionButtonClicked", "showing dialpad");
// Show dialpad if we are not in the call log activity.
((HostInterface) activity).showDialpad();
@@ -582,32 +582,32 @@ public class CallLogFragment extends Fragment
if (requestCode == PHONE_PERMISSIONS_REQUEST_CODE) {
if (grantResults.length >= 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) {
// Force a refresh of the data since we were missing the permission before this.
- mRefreshDataRequired = true;
+ refreshDataRequired = true;
}
}
}
/** Schedules an update to the relative call times (X mins ago). */
private void rescheduleDisplayUpdate() {
- if (!mDisplayUpdateHandler.hasMessages(EVENT_UPDATE_DISPLAY)) {
+ if (!displayUpdateHandler.hasMessages(EVENT_UPDATE_DISPLAY)) {
long time = System.currentTimeMillis();
// This value allows us to change the display relatively close to when the time changes
// from one minute to the next.
long millisUtilNextMinute = MILLIS_IN_MINUTE - (time % MILLIS_IN_MINUTE);
- mDisplayUpdateHandler.sendEmptyMessageDelayed(EVENT_UPDATE_DISPLAY, millisUtilNextMinute);
+ displayUpdateHandler.sendEmptyMessageDelayed(EVENT_UPDATE_DISPLAY, millisUtilNextMinute);
}
}
/** Cancels any pending update requests to update the relative call times (X mins ago). */
private void cancelDisplayUpdate() {
- mDisplayUpdateHandler.removeMessages(EVENT_UPDATE_DISPLAY);
+ displayUpdateHandler.removeMessages(EVENT_UPDATE_DISPLAY);
}
/** Mark all missed calls as read if Keyguard not locked and possible. */
void markMissedCallsAsReadAndRemoveNotifications() {
- if (mCallLogQueryHandler != null
+ if (callLogQueryHandler != null
&& !getContext().getSystemService(KeyguardManager.class).isKeyguardLocked()) {
- mCallLogQueryHandler.markMissedCallsAsRead();
+ callLogQueryHandler.markMissedCallsAsRead();
CallLogNotificationsService.cancelAllMissedCalls(getContext());
}
}
@@ -621,7 +621,7 @@ public class CallLogFragment extends Fragment
}
public boolean isModalAlertVisible() {
- return mModalAlertManager != null && !mModalAlertManager.isEmpty();
+ return modalAlertManager != null && !modalAlertManager.isEmpty();
}
@CallSuper
@@ -640,14 +640,14 @@ public class CallLogFragment extends Fragment
getAdapter().notifyDataSetChanged();
HostInterface hostInterface = (HostInterface) getActivity();
if (show) {
- mRecyclerView.setVisibility(View.GONE);
- mModalAlertView.setVisibility(View.VISIBLE);
+ recyclerView.setVisibility(View.GONE);
+ modalAlertView.setVisibility(View.VISIBLE);
if (hostInterface != null && getUserVisibleHint()) {
hostInterface.enableFloatingButton(false);
}
} else {
- mRecyclerView.setVisibility(View.VISIBLE);
- mModalAlertView.setVisibility(View.GONE);
+ recyclerView.setVisibility(View.VISIBLE);
+ modalAlertView.setVisibility(View.GONE);
if (hostInterface != null && getUserVisibleHint()) {
hostInterface.enableFloatingButton(true);
}
@@ -656,16 +656,16 @@ public class CallLogFragment extends Fragment
@Override
public void showMultiSelectRemoveView(boolean show) {
- mMultiSelectUnSelectAllViewContent.setVisibility(show ? View.VISIBLE : View.GONE);
- mMultiSelectUnSelectAllViewContent.setAlpha(show ? 0 : 1);
- mMultiSelectUnSelectAllViewContent.animate().alpha(show ? 1 : 0).start();
+ multiSelectUnSelectAllViewContent.setVisibility(show ? View.VISIBLE : View.GONE);
+ multiSelectUnSelectAllViewContent.setAlpha(show ? 0 : 1);
+ multiSelectUnSelectAllViewContent.animate().alpha(show ? 1 : 0).start();
((ListsFragment) getParentFragment()).showMultiSelectRemoveView(show);
}
@Override
public void setSelectAllModeToFalse() {
selectAllMode = false;
- mSelectUnselectAllIcon.setImageDrawable(
+ selectUnselectAllIcon.setImageDrawable(
getContext().getDrawable(R.drawable.ic_empty_check_mark_white_24dp));
}
@@ -689,11 +689,11 @@ public class CallLogFragment extends Fragment
private void updateSelectAllIcon() {
if (selectAllMode) {
- mSelectUnselectAllIcon.setImageDrawable(
+ selectUnselectAllIcon.setImageDrawable(
getContext().getDrawable(R.drawable.ic_check_mark_blue_24dp));
getAdapter().onAllSelected();
} else {
- mSelectUnselectAllIcon.setImageDrawable(
+ selectUnselectAllIcon.setImageDrawable(
getContext().getDrawable(R.drawable.ic_empty_check_mark_white_24dp));
getAdapter().onAllDeselected();
}
@@ -709,12 +709,12 @@ public class CallLogFragment extends Fragment
protected class CustomContentObserver extends ContentObserver {
public CustomContentObserver() {
- super(mHandler);
+ super(handler);
}
@Override
public void onChange(boolean selfChange) {
- mRefreshDataRequired = true;
+ refreshDataRequired = true;
}
}
}
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
index a48de0f51..4c0c63408 100644
--- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
+++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java
@@ -57,15 +57,15 @@ public class CallLogGroupBuilder {
/** Instance of the time object used for time calculations. */
private static final Time TIME = new Time();
/** The object on which the groups are created. */
- private final GroupCreator mGroupCreator;
+ private final GroupCreator groupCreator;
public CallLogGroupBuilder(GroupCreator groupCreator) {
- mGroupCreator = groupCreator;
+ this.groupCreator = groupCreator;
}
/**
* Finds all groups of adjacent entries in the call log which should be grouped together and calls
- * {@link GroupCreator#addGroup(int, int)} on {@link #mGroupCreator} for each of them.
+ * {@link GroupCreator#addGroup(int, int)} on {@link #groupCreator} for each of them.
*
* <p>For entries that are not grouped with others, we do not need to create a group of size one.
*
@@ -80,7 +80,7 @@ public class CallLogGroupBuilder {
}
// Clear any previous day grouping information.
- mGroupCreator.clearDayGroups();
+ groupCreator.clearDayGroups();
// Get current system time, used for calculating which day group calls belong to.
long currentTime = System.currentTimeMillis();
@@ -90,7 +90,7 @@ public class CallLogGroupBuilder {
final long firstDate = cursor.getLong(CallLogQuery.DATE);
final long firstRowId = cursor.getLong(CallLogQuery.ID);
int groupDayGroup = getDayGroup(firstDate, currentTime);
- mGroupCreator.setDayGroup(firstRowId, groupDayGroup);
+ groupCreator.setDayGroup(firstRowId, groupDayGroup);
// Determine the callback action for the first call in the cursor.
String groupNumber = cursor.getString(CallLogQuery.NUMBER);
@@ -99,7 +99,7 @@ public class CallLogGroupBuilder {
int groupCallbackAction =
CallbackActionHelper.getCallbackAction(
groupNumber, groupFeatures, groupAccountComponentName);
- mGroupCreator.setCallbackAction(firstRowId, groupCallbackAction);
+ groupCreator.setCallbackAction(firstRowId, groupCallbackAction);
// Instantiate other group values to those of the first call in the cursor.
String groupAccountId = cursor.getString(CallLogQuery.ACCOUNT_ID);
@@ -164,7 +164,7 @@ public class CallLogGroupBuilder {
// Create a group for the previous group of calls, which does not include the
// current call.
- mGroupCreator.addGroup(cursor.getPosition() - groupSize, groupSize);
+ groupCreator.addGroup(cursor.getPosition() - groupSize, groupSize);
// Start a new group; it will include at least the current call.
groupSize = 1;
@@ -181,12 +181,12 @@ public class CallLogGroupBuilder {
// Save the callback action and the day group associated with the current call.
final long currentCallId = cursor.getLong(CallLogQuery.ID);
- mGroupCreator.setCallbackAction(currentCallId, groupCallbackAction);
- mGroupCreator.setDayGroup(currentCallId, groupDayGroup);
+ groupCreator.setCallbackAction(currentCallId, groupCallbackAction);
+ groupCreator.setDayGroup(currentCallId, groupDayGroup);
}
// Create a group for the last set of calls.
- mGroupCreator.addGroup(count - groupSize, groupSize);
+ groupCreator.addGroup(count - groupSize, groupSize);
}
/**
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
index ac43b9ea7..13ee9a41f 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemHelper.java
@@ -32,11 +32,11 @@ import com.android.dialer.compat.AppCompatConstants;
/* package */ class CallLogListItemHelper {
/** Helper for populating the details of a phone call. */
- private final PhoneCallDetailsHelper mPhoneCallDetailsHelper;
+ private final PhoneCallDetailsHelper phoneCallDetailsHelper;
/** Resources to look up strings. */
- private final Resources mResources;
+ private final Resources resources;
- private final CallLogCache mCallLogCache;
+ private final CallLogCache callLogCache;
/**
* Creates a new helper instance.
@@ -49,9 +49,9 @@ import com.android.dialer.compat.AppCompatConstants;
PhoneCallDetailsHelper phoneCallDetailsHelper,
Resources resources,
CallLogCache callLogCache) {
- mPhoneCallDetailsHelper = phoneCallDetailsHelper;
- mResources = resources;
- mCallLogCache = callLogCache;
+ this.phoneCallDetailsHelper = phoneCallDetailsHelper;
+ this.resources = resources;
+ this.callLogCache = callLogCache;
}
/**
@@ -63,7 +63,7 @@ import com.android.dialer.compat.AppCompatConstants;
@WorkerThread
public void updatePhoneCallDetails(PhoneCallDetails details) {
Assert.isWorkerThread();
- details.callLocationAndDate = mPhoneCallDetailsHelper.getCallLocationAndDate(details);
+ details.callLocationAndDate = phoneCallDetailsHelper.getCallLocationAndDate(details);
details.callDescription = getCallDescription(details);
}
@@ -74,7 +74,7 @@ import com.android.dialer.compat.AppCompatConstants;
* @param details the details of a phone call needed to fill in the data
*/
public void setPhoneCallDetails(CallLogListItemViewHolder views, PhoneCallDetails details) {
- mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details);
+ phoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details);
// Set the accessibility text for the contact badge
views.quickContactView.setContentDescription(getContactBadgeDescription(details));
@@ -88,7 +88,7 @@ import com.android.dialer.compat.AppCompatConstants;
// The call type or Location associated with the call. Use when setting text for a
// voicemail log's call button
- views.callTypeOrLocation = mPhoneCallDetailsHelper.getCallTypeOrLocation(details);
+ views.callTypeOrLocation = phoneCallDetailsHelper.getCallTypeOrLocation(details);
// Cache country iso. Used for number filtering.
views.countryIso = details.countryIso;
@@ -114,20 +114,20 @@ import com.android.dialer.compat.AppCompatConstants;
views.videoCallButtonView.setContentDescription(
TextUtils.expandTemplate(
- mResources.getString(R.string.description_video_call_action), nameOrNumber));
+ resources.getString(R.string.description_video_call_action), nameOrNumber));
views.createNewContactButtonView.setContentDescription(
TextUtils.expandTemplate(
- mResources.getString(R.string.description_create_new_contact_action), nameOrNumber));
+ resources.getString(R.string.description_create_new_contact_action), nameOrNumber));
views.addToExistingContactButtonView.setContentDescription(
TextUtils.expandTemplate(
- mResources.getString(R.string.description_add_to_existing_contact_action),
+ resources.getString(R.string.description_add_to_existing_contact_action),
nameOrNumber));
views.detailsButtonView.setContentDescription(
TextUtils.expandTemplate(
- mResources.getString(R.string.description_details_action), nameOrNumber));
+ resources.getString(R.string.description_details_action), nameOrNumber));
}
/**
@@ -138,10 +138,10 @@ import com.android.dialer.compat.AppCompatConstants;
*/
private CharSequence getContactBadgeDescription(PhoneCallDetails details) {
if (details.isSpam) {
- return mResources.getString(
+ return resources.getString(
R.string.description_spam_contact_details, getNameOrNumber(details));
}
- return mResources.getString(R.string.description_contact_details, getNameOrNumber(details));
+ return resources.getString(R.string.description_contact_details, getNameOrNumber(details));
}
/**
@@ -178,32 +178,32 @@ import com.android.dialer.compat.AppCompatConstants;
final CharSequence nameOrNumber = getNameOrNumber(details);
// Get the call type or location of the caller; null if not applicable
- final CharSequence typeOrLocation = mPhoneCallDetailsHelper.getCallTypeOrLocation(details);
+ final CharSequence typeOrLocation = phoneCallDetailsHelper.getCallTypeOrLocation(details);
// Get the time/date of the call
- final CharSequence timeOfCall = mPhoneCallDetailsHelper.getCallDate(details);
+ final CharSequence timeOfCall = phoneCallDetailsHelper.getCallDate(details);
SpannableStringBuilder callDescription = new SpannableStringBuilder();
// Add number of calls if more than one.
if (details.callTypes.length > 1) {
callDescription.append(
- mResources.getString(R.string.description_num_calls, details.callTypes.length));
+ resources.getString(R.string.description_num_calls, details.callTypes.length));
}
// If call had video capabilities, add the "Video Call" string.
if ((details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) {
- callDescription.append(mResources.getString(R.string.description_video_call));
+ callDescription.append(resources.getString(R.string.description_video_call));
}
- String accountLabel = mCallLogCache.getAccountLabel(details.accountHandle);
+ String accountLabel = callLogCache.getAccountLabel(details.accountHandle);
CharSequence onAccountLabel =
- PhoneCallDetails.createAccountLabelDescription(mResources, details.viaNumber, accountLabel);
+ PhoneCallDetails.createAccountLabelDescription(resources, details.viaNumber, accountLabel);
int stringID = getCallDescriptionStringID(details.callTypes, details.isRead);
callDescription.append(
TextUtils.expandTemplate(
- mResources.getString(stringID),
+ resources.getString(stringID),
nameOrNumber,
typeOrLocation == null ? "" : typeOrLocation,
timeOfCall,
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 15c4b5850..f8d3a4cd8 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -132,13 +132,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
/** The actionable view which places a call to the number corresponding to the call log row. */
public final ImageView primaryActionButtonView;
- private final Context mContext;
- @Nullable private final PhoneAccountHandle mDefaultPhoneAccountHandle;
- private final CallLogCache mCallLogCache;
- private final CallLogListItemHelper mCallLogListItemHelper;
- private final CachedNumberLookupService mCachedNumberLookupService;
- private final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter;
- private final OnClickListener mBlockReportListener;
+ private final Context context;
+ @Nullable private final PhoneAccountHandle defaultPhoneAccountHandle;
+ private final CallLogCache callLogCache;
+ private final CallLogListItemHelper callLogListItemHelper;
+ private final CachedNumberLookupService cachedNumberLookupService;
+ private final VoicemailPlaybackPresenter voicemailPlaybackPresenter;
+ private final OnClickListener blockReportListener;
@HostUi private final int hostUi;
/** Whether the data fields are populated by the worker thread, ready to be shown. */
public boolean isLoaded;
@@ -233,10 +233,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
public boolean isCallComposerCapable;
- private View.OnClickListener mExpandCollapseListener;
+ private View.OnClickListener expandCollapseListener;
private final OnActionModeStateChangedListener onActionModeStateChangedListener;
private final View.OnLongClickListener longPressListener;
- private boolean mVoicemailPrimaryActionButtonClicked;
+ private boolean voicemailPrimaryActionButtonClicked;
public int callbackAction;
public int dayGroupHeaderVisibility;
@@ -264,18 +264,18 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
ImageView primaryActionButtonView) {
super(rootView);
- mContext = context;
- mExpandCollapseListener = expandCollapseListener;
+ this.context = context;
+ this.expandCollapseListener = expandCollapseListener;
onActionModeStateChangedListener = actionModeStateChangedListener;
longPressListener = longClickListener;
- mCallLogCache = callLogCache;
- mCallLogListItemHelper = callLogListItemHelper;
- mVoicemailPlaybackPresenter = voicemailPlaybackPresenter;
- mBlockReportListener = blockReportListener;
- mCachedNumberLookupService = PhoneNumberCache.get(mContext).getCachedNumberLookupService();
+ this.callLogCache = callLogCache;
+ this.callLogListItemHelper = callLogListItemHelper;
+ this.voicemailPlaybackPresenter = voicemailPlaybackPresenter;
+ this.blockReportListener = blockReportListener;
+ cachedNumberLookupService = PhoneNumberCache.get(this.context).getCachedNumberLookupService();
// Cache this to avoid having to look it up each time we bind to a call log entry
- mDefaultPhoneAccountHandle =
+ defaultPhoneAccountHandle =
TelecomUtil.getDefaultOutgoingPhoneAccount(context, PhoneAccount.SCHEME_TEL);
this.rootView = rootView;
@@ -292,19 +292,19 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
phoneCallDetailsViews.nameView.setElegantTextHeight(false);
phoneCallDetailsViews.callLocationAndDate.setElegantTextHeight(false);
- if (mContext instanceof CallLogActivity) {
+ if (this.context instanceof CallLogActivity) {
hostUi = HostUi.CALL_HISTORY;
- Logger.get(mContext)
+ Logger.get(this.context)
.logQuickContactOnTouch(
quickContactView, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_CALL_HISTORY, true);
- } else if (mVoicemailPlaybackPresenter == null) {
+ } else if (this.voicemailPlaybackPresenter == null) {
hostUi = HostUi.CALL_LOG;
- Logger.get(mContext)
+ Logger.get(this.context)
.logQuickContactOnTouch(
quickContactView, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_CALL_LOG, true);
} else {
hostUi = HostUi.VOICEMAIL;
- Logger.get(mContext)
+ Logger.get(this.context)
.logQuickContactOnTouch(
quickContactView, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_VOICEMAIL, false);
}
@@ -314,16 +314,16 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
}
primaryActionButtonView.setOnClickListener(this);
- primaryActionView.setOnClickListener(mExpandCollapseListener);
- if (mVoicemailPlaybackPresenter != null
- && ConfigProviderBindings.get(mContext)
+ primaryActionView.setOnClickListener(this.expandCollapseListener);
+ if (this.voicemailPlaybackPresenter != null
+ && ConfigProviderBindings.get(this.context)
.getBoolean(
CallLogAdapter.ENABLE_CALL_LOG_MULTI_SELECT,
CallLogAdapter.ENABLE_CALL_LOG_MULTI_SELECT_FLAG)) {
primaryActionView.setOnLongClickListener(longPressListener);
quickContactView.setOnLongClickListener(longPressListener);
quickContactView.setMulitSelectListeners(
- mExpandCollapseListener, onActionModeStateChangedListener);
+ this.expandCollapseListener, onActionModeStateChangedListener);
} else {
primaryActionView.setOnCreateContextMenuListener(this);
}
@@ -400,51 +400,50 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
public boolean onMenuItemClick(MenuItem item) {
int resId = item.getItemId();
if (resId == R.id.context_menu_copy_to_clipboard) {
- ClipboardUtils.copyText(mContext, null, number, true);
+ ClipboardUtils.copyText(context, null, number, true);
return true;
} else if (resId == R.id.context_menu_copy_transcript_to_clipboard) {
ClipboardUtils.copyText(
- mContext, null, phoneCallDetailsViews.voicemailTranscriptionView.getText(), true);
+ context, null, phoneCallDetailsViews.voicemailTranscriptionView.getText(), true);
return true;
} else if (resId == R.id.context_menu_edit_before_call) {
final Intent intent = new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(number));
- intent.setClass(mContext, DialtactsActivity.class);
- DialerUtils.startActivityWithErrorToast(mContext, intent);
+ intent.setClass(context, DialtactsActivity.class);
+ DialerUtils.startActivityWithErrorToast(context, intent);
return true;
} else if (resId == R.id.context_menu_block_report_spam) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_BLOCK_REPORT_SPAM);
maybeShowBlockNumberMigrationDialog(
new BlockedNumbersMigrator.Listener() {
@Override
public void onComplete() {
- mBlockReportListener.onBlockReportSpam(
+ blockReportListener.onBlockReportSpam(
displayNumber, number, countryIso, callType, info.sourceType);
}
});
} else if (resId == R.id.context_menu_block) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_BLOCK_NUMBER);
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_BLOCK_NUMBER);
maybeShowBlockNumberMigrationDialog(
new BlockedNumbersMigrator.Listener() {
@Override
public void onComplete() {
- mBlockReportListener.onBlock(
+ blockReportListener.onBlock(
displayNumber, number, countryIso, callType, info.sourceType);
}
});
} else if (resId == R.id.context_menu_unblock) {
- Logger.get(mContext)
- .logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_UNBLOCK_NUMBER);
- mBlockReportListener.onUnblock(
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_UNBLOCK_NUMBER);
+ blockReportListener.onUnblock(
displayNumber, number, countryIso, callType, info.sourceType, isSpam, blockId);
} else if (resId == R.id.context_menu_report_not_spam) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_REPORT_AS_NOT_SPAM);
- mBlockReportListener.onReportNotSpam(
+ blockReportListener.onReportNotSpam(
displayNumber, number, countryIso, callType, info.sourceType);
} else if (resId == R.id.context_menu_delete) {
AsyncTaskExecutors.createAsyncTaskExecutor()
- .submit(TASK_DELETE, new DeleteCallTask(mContext, callIds));
+ .submit(TASK_DELETE, new DeleteCallTask(context, callIds));
}
return false;
}
@@ -526,7 +525,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
primaryActionButtonView.setImageResource(R.drawable.quantum_ic_play_arrow_white_24);
primaryActionButtonView.setContentDescription(
TextUtils.expandTemplate(
- mContext.getString(R.string.description_voicemail_action), validNameOrNumber));
+ context.getString(R.string.description_voicemail_action), validNameOrNumber));
primaryActionButtonView.setVisibility(View.VISIBLE);
} else {
primaryActionButtonView.setVisibility(View.GONE);
@@ -547,7 +546,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
IntentProvider.getReturnVideoCallIntentProvider(number, accountHandle));
primaryActionButtonView.setContentDescription(
TextUtils.expandTemplate(
- mContext.getString(R.string.description_video_call_action), validNameOrNumber));
+ context.getString(R.string.description_video_call_action), validNameOrNumber));
primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24);
primaryActionButtonView.setVisibility(View.VISIBLE);
break;
@@ -560,20 +559,20 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
primaryActionButtonView.setContentDescription(
TextUtils.expandTemplate(
- mContext.getString(R.string.description_video_call_action), validNameOrNumber));
+ context.getString(R.string.description_video_call_action), validNameOrNumber));
primaryActionButtonView.setImageResource(R.drawable.quantum_ic_videocam_vd_theme_24);
primaryActionButtonView.setVisibility(View.VISIBLE);
break;
case CallbackAction.VOICE:
- if (mCallLogCache.isVoicemailNumber(accountHandle, number)) {
+ if (callLogCache.isVoicemailNumber(accountHandle, number)) {
// Call to generic voicemail number, in case there are multiple accounts
primaryActionButtonView.setTag(IntentProvider.getReturnVoicemailCallIntentProvider(null));
} else if (canSupportAssistedDialing()) {
primaryActionButtonView.setTag(
IntentProvider.getAssistedDialIntentProvider(
number + postDialDigits,
- mContext,
- mContext.getSystemService(TelephonyManager.class)));
+ context,
+ context.getSystemService(TelephonyManager.class)));
} else {
primaryActionButtonView.setTag(
IntentProvider.getReturnCallIntentProvider(number + postDialDigits));
@@ -581,7 +580,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
primaryActionButtonView.setContentDescription(
TextUtils.expandTemplate(
- mContext.getString(R.string.description_call_action), validNameOrNumber));
+ context.getString(R.string.description_call_action), validNameOrNumber));
primaryActionButtonView.setImageResource(R.drawable.quantum_ic_call_vd_theme_24);
primaryActionButtonView.setVisibility(View.VISIBLE);
break;
@@ -622,14 +621,14 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
voicemailPlaybackView.setVisibility(View.VISIBLE);
Uri uri = Uri.parse(voicemailUri);
- mVoicemailPlaybackPresenter.setPlaybackView(
+ voicemailPlaybackPresenter.setPlaybackView(
voicemailPlaybackView,
rowId,
uri,
- mVoicemailPrimaryActionButtonClicked,
+ voicemailPrimaryActionButtonClicked,
sendVoicemailButtonView);
- mVoicemailPrimaryActionButtonClicked = false;
- CallLogAsyncTaskUtil.markVoicemailAsRead(mContext, uri);
+ voicemailPrimaryActionButtonClicked = false;
+ CallLogAsyncTaskUtil.markVoicemailAsRead(context, uri);
return;
}
@@ -640,7 +639,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
if (canSupportAssistedDialing()) {
callButtonView.setTag(
IntentProvider.getAssistedDialIntentProvider(
- number, mContext, mContext.getSystemService(TelephonyManager.class)));
+ number, context, context.getSystemService(TelephonyManager.class)));
} else {
callButtonView.setTag(IntentProvider.getReturnCallIntentProvider(number));
}
@@ -651,7 +650,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
((TextView) callButtonView.findViewById(R.id.call_action_text))
.setText(
TextUtils.expandTemplate(
- mContext.getString(R.string.call_log_action_call),
+ context.getString(R.string.call_log_action_call),
nameOrNumber == null ? "" : nameOrNumber));
if (callType == Calls.VOICEMAIL_TYPE && !TextUtils.isEmpty(callTypeOrLocation)) {
@@ -661,7 +660,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
callButtonView.setVisibility(View.VISIBLE);
}
- boolean isVoicemailNumber = mCallLogCache.isVoicemailNumber(accountHandle, number);
+ boolean isVoicemailNumber = callLogCache.isVoicemailNumber(accountHandle, number);
switch (callbackAction) {
case CallbackAction.IMS_VIDEO:
@@ -672,10 +671,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
videoCallButtonView.setVisibility(View.GONE);
break;
case CallbackAction.VOICE:
- Duo duo = DuoComponent.get(mContext).getDuo();
+ Duo duo = DuoComponent.get(context).getDuo();
// For a voice call, set the secondary callback action to be an IMS video call if it is
// available. Otherwise try to set it as a Duo call.
- if (CallUtil.isVideoEnabled(mContext)
+ if (CallUtil.isVideoEnabled(context)
&& (hasPlacedCarrierVideoCall() || canSupportCarrierVideoCall())) {
videoCallButtonView.setTag(IntentProvider.getReturnVideoCallIntentProvider(number));
videoCallButtonView.setVisibility(View.VISIBLE);
@@ -687,24 +686,24 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
boolean identifiedSpamCall = isSpamFeatureEnabled && isSpam;
- if (duo.isReachable(mContext, number)) {
+ if (duo.isReachable(context, number)) {
videoCallButtonView.setTag(IntentProvider.getDuoVideoIntentProvider(number));
videoCallButtonView.setVisibility(View.VISIBLE);
- } else if (duo.isActivated(mContext) && !identifiedSpamCall) {
- if (ConfigProviderBindings.get(mContext)
+ } else if (duo.isActivated(context) && !identifiedSpamCall) {
+ if (ConfigProviderBindings.get(context)
.getBoolean("enable_call_log_duo_invite_button", false)) {
inviteVideoButtonView.setTag(IntentProvider.getDuoInviteIntentProvider(number));
inviteVideoButtonView.setVisibility(View.VISIBLE);
}
- } else if (duo.isEnabled(mContext) && !identifiedSpamCall) {
- if (!duo.isInstalled(mContext)) {
- if (ConfigProviderBindings.get(mContext)
+ } else if (duo.isEnabled(context) && !identifiedSpamCall) {
+ if (!duo.isInstalled(context)) {
+ if (ConfigProviderBindings.get(context)
.getBoolean("enable_call_log_install_duo_button", false)) {
setUpVideoButtonView.setTag(IntentProvider.getInstallDuoIntentProvider());
setUpVideoButtonView.setVisibility(View.VISIBLE);
}
} else {
- if (ConfigProviderBindings.get(mContext)
+ if (ConfigProviderBindings.get(context)
.getBoolean("enable_call_log_activate_duo_button", false)) {
setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider());
setUpVideoButtonView.setVisibility(View.VISIBLE);
@@ -719,19 +718,19 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
// For voicemail calls, show the voicemail playback layout; hide otherwise.
if (callType == Calls.VOICEMAIL_TYPE
- && mVoicemailPlaybackPresenter != null
+ && voicemailPlaybackPresenter != null
&& !TextUtils.isEmpty(voicemailUri)) {
voicemailPlaybackView.setVisibility(View.VISIBLE);
Uri uri = Uri.parse(voicemailUri);
- mVoicemailPlaybackPresenter.setPlaybackView(
+ voicemailPlaybackPresenter.setPlaybackView(
voicemailPlaybackView,
rowId,
uri,
- mVoicemailPrimaryActionButtonClicked,
+ voicemailPrimaryActionButtonClicked,
sendVoicemailButtonView);
- mVoicemailPrimaryActionButtonClicked = false;
- CallLogAsyncTaskUtil.markVoicemailAsRead(mContext, uri);
+ voicemailPrimaryActionButtonClicked = false;
+ CallLogAsyncTaskUtil.markVoicemailAsRead(context, uri);
} else {
voicemailPlaybackView.setVisibility(View.GONE);
sendVoicemailButtonView.setVisibility(View.GONE);
@@ -742,8 +741,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
} else {
detailsButtonView.setVisibility(View.VISIBLE);
boolean canReportCallerId =
- mCachedNumberLookupService != null
- && mCachedNumberLookupService.canReportAsInvalid(info.sourceType, info.objectId);
+ cachedNumberLookupService != null
+ && cachedNumberLookupService.canReportAsInvalid(info.sourceType, info.objectId);
detailsButtonView.setTag(
IntentProvider.getCallDetailIntentProvider(
callDetailsEntries, buildContact(), canReportCallerId, canSupportAssistedDialing()));
@@ -773,9 +772,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
sendMessageView.setVisibility(View.GONE);
}
- mCallLogListItemHelper.setActionContentDescriptions(this);
+ callLogListItemHelper.setActionContentDescriptions(this);
- boolean supportsCallSubject = mCallLogCache.doesAccountSupportCallSubject(accountHandle);
+ boolean supportsCallSubject = callLogCache.doesAccountSupportCallSubject(accountHandle);
callWithNoteButtonView.setVisibility(
supportsCallSubject && !isVoicemailNumber && info != null ? View.VISIBLE : View.GONE);
@@ -796,7 +795,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
private boolean showDuoPrimaryButton() {
return accountHandle != null
&& accountHandle.getComponentName().equals(DuoConstants.PHONE_ACCOUNT_COMPONENT_NAME)
- && DuoComponent.get(mContext).getDuo().isReachable(mContext, number);
+ && DuoComponent.get(context).getDuo().isReachable(context, number);
}
private static boolean hasDialableChar(CharSequence number) {
@@ -818,10 +817,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
if (accountHandle == null) {
return false;
}
- if (mDefaultPhoneAccountHandle == null) {
+ if (defaultPhoneAccountHandle == null) {
return false;
}
- return accountHandle.getComponentName().equals(mDefaultPhoneAccountHandle.getComponentName());
+ return accountHandle.getComponentName().equals(defaultPhoneAccountHandle.getComponentName());
}
private boolean canSupportAssistedDialing() {
@@ -829,7 +828,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
private boolean canSupportCarrierVideoCall() {
- return mCallLogCache.canRelyOnVideoPresence()
+ return callLogCache.canRelyOnVideoPresence()
&& info != null
&& (info.carrierPresence & Phone.CARRIER_PRESENCE_VT_CAPABLE) != 0;
}
@@ -907,12 +906,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
quickContactView.assignContactUri(info.lookupUri);
if (isSpamFeatureEnabled && isSpam) {
- quickContactView.setImageDrawable(mContext.getDrawable(R.drawable.blocked_contact));
+ quickContactView.setImageDrawable(context.getDrawable(R.drawable.blocked_contact));
return;
}
final String displayName = TextUtils.isEmpty(info.name) ? displayNumber : info.name;
- ContactPhotoManager.getInstance(mContext)
+ ContactPhotoManager.getInstance(context)
.loadDialerThumbnailOrPhoto(
quickContactView,
info.lookupUri,
@@ -924,10 +923,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
private @ContactType int getContactType() {
return LetterTileDrawable.getContactTypeFromPrimitives(
- mCallLogCache.isVoicemailNumber(accountHandle, number),
+ callLogCache.isVoicemailNumber(accountHandle, number),
isSpam,
- mCachedNumberLookupService != null
- && mCachedNumberLookupService.isBusiness(info.sourceType),
+ cachedNumberLookupService != null && cachedNumberLookupService.isBusiness(info.sourceType),
numberPresentation,
false);
}
@@ -935,19 +933,19 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
@Override
public void onClick(View view) {
if (view.getId() == R.id.primary_action_button) {
- CallLogAsyncTaskUtil.markCallAsRead(mContext, callIds);
+ CallLogAsyncTaskUtil.markCallAsRead(context, callIds);
}
if (view.getId() == R.id.primary_action_button && !TextUtils.isEmpty(voicemailUri)) {
- Logger.get(mContext).logImpression(DialerImpression.Type.VOICEMAIL_PLAY_AUDIO_DIRECTLY);
- mVoicemailPrimaryActionButtonClicked = true;
- mExpandCollapseListener.onClick(primaryActionView);
+ Logger.get(context).logImpression(DialerImpression.Type.VOICEMAIL_PLAY_AUDIO_DIRECTLY);
+ voicemailPrimaryActionButtonClicked = true;
+ expandCollapseListener.onClick(primaryActionView);
return;
}
if (view.getId() == R.id.call_with_note_action) {
CallSubjectDialog.start(
- (Activity) mContext,
+ (Activity) context,
info.photoId,
info.photoUri,
info.lookupUri,
@@ -962,12 +960,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (view.getId() == R.id.block_report_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_REPORT_SPAM);
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_REPORT_SPAM);
maybeShowBlockNumberMigrationDialog(
new BlockedNumbersMigrator.Listener() {
@Override
public void onComplete() {
- mBlockReportListener.onBlockReportSpam(
+ blockReportListener.onBlockReportSpam(
displayNumber, number, countryIso, callType, info.sourceType);
}
});
@@ -975,12 +973,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (view.getId() == R.id.block_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_NUMBER);
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_BLOCK_NUMBER);
maybeShowBlockNumberMigrationDialog(
new BlockedNumbersMigrator.Listener() {
@Override
public void onComplete() {
- mBlockReportListener.onBlock(
+ blockReportListener.onBlock(
displayNumber, number, countryIso, callType, info.sourceType);
}
});
@@ -988,23 +986,23 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (view.getId() == R.id.unblock_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_UNBLOCK_NUMBER);
- mBlockReportListener.onUnblock(
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_UNBLOCK_NUMBER);
+ blockReportListener.onUnblock(
displayNumber, number, countryIso, callType, info.sourceType, isSpam, blockId);
return;
}
if (view.getId() == R.id.report_not_spam_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_REPORT_AS_NOT_SPAM);
- mBlockReportListener.onReportNotSpam(
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_REPORT_AS_NOT_SPAM);
+ blockReportListener.onReportNotSpam(
displayNumber, number, countryIso, callType, info.sourceType);
return;
}
if (view.getId() == R.id.call_compose_action) {
LogUtil.i("CallLogListItemViewHolder.onClick", "share and call pressed");
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_SHARE_AND_CALL);
- Activity activity = (Activity) mContext;
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_SHARE_AND_CALL);
+ Activity activity = (Activity) context;
activity.startActivityForResult(
CallComposerActivity.newIntent(activity, buildContact()),
ActivityRequestCodes.DIALTACTS_CALL_COMPOSER);
@@ -1012,8 +1010,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (view.getId() == R.id.share_voicemail) {
- Logger.get(mContext).logImpression(DialerImpression.Type.VVM_SHARE_PRESSED);
- mVoicemailPlaybackPresenter.shareVoicemail();
+ Logger.get(context).logImpression(DialerImpression.Type.VVM_SHARE_PRESSED);
+ voicemailPlaybackPresenter.shareVoicemail();
return;
}
@@ -1024,7 +1022,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
return;
}
- final Intent intent = intentProvider.getIntent(mContext);
+ final Intent intent = intentProvider.getIntent(context);
// See IntentProvider.getCallDetailIntentProvider() for why this may be null.
if (intent == null) {
return;
@@ -1037,19 +1035,19 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
startDuoActivity(intent);
} else if (CallDetailsActivity.isLaunchIntent(intent)) {
PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL);
- ((Activity) mContext)
+ ((Activity) context)
.startActivityForResult(intent, ActivityRequestCodes.DIALTACTS_CALL_DETAILS);
} else {
if (Intent.ACTION_CALL.equals(intent.getAction())
&& intent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, -1)
== VideoProfile.STATE_BIDIRECTIONAL) {
- Logger.get(mContext).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG);
+ Logger.get(context).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG);
} else if (intent.getDataString() != null
&& intent.getDataString().contains(DuoConstants.PACKAGE_NAME)) {
- Logger.get(mContext).logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_INSTALL);
+ Logger.get(context).logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_INSTALL);
}
- DialerUtils.startActivityWithErrorToast(mContext, intent);
+ DialerUtils.startActivityWithErrorToast(context, intent);
}
}
@@ -1062,14 +1060,14 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
private void startDuoActivity(Intent intent) {
if (DuoConstants.DUO_ACTIVATE_ACTION.equals(intent.getAction())) {
- Logger.get(mContext).logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_ACTIVATE);
+ Logger.get(context).logImpression(DialerImpression.Type.DUO_CALL_LOG_SET_UP_ACTIVATE);
} else if (DuoConstants.DUO_INVITE_ACTION.equals(intent.getAction())) {
- Logger.get(mContext).logImpression(DialerImpression.Type.DUO_CALL_LOG_INVITE);
+ Logger.get(context).logImpression(DialerImpression.Type.DUO_CALL_LOG_INVITE);
} else if (DuoConstants.DUO_CALL_ACTION.equals(intent.getAction())) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG);
if (isNonContactEntry(info)) {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(
DialerImpression.Type.LIGHTBRINGER_NON_CONTACT_VIDEO_REQUESTED_FROM_CALL_LOG);
}
@@ -1079,10 +1077,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
try {
- Activity activity = (Activity) mContext;
+ Activity activity = (Activity) context;
activity.startActivityForResult(intent, ActivityRequestCodes.DIALTACTS_DUO);
} catch (ActivityNotFoundException e) {
- Toast.makeText(mContext, R.string.activity_not_available, Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, R.string.activity_not_available, Toast.LENGTH_SHORT).show();
}
}
@@ -1115,10 +1113,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
contact.setNumberLabel(numberType);
/* third line of contact view. */
- String accountLabel = mCallLogCache.getAccountLabel(accountHandle);
+ String accountLabel = callLogCache.getAccountLabel(accountHandle);
if (!TextUtils.isEmpty(accountLabel)) {
SimDetails.Builder simDetails = SimDetails.newBuilder().setNetwork(accountLabel);
- simDetails.setColor(mCallLogCache.getAccountColor(accountHandle));
+ simDetails.setColor(callLogCache.getAccountColor(accountHandle));
contact.setSimDetails(simDetails.build());
}
return contact.build();
@@ -1126,36 +1124,35 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
private void logCallLogAction(int id) {
if (id == R.id.send_message_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_SEND_MESSAGE);
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_SEND_MESSAGE);
} else if (id == R.id.add_to_existing_contact_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_ADD_TO_CONTACT);
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_ADD_TO_CONTACT);
switch (hostUi) {
case HostUi.CALL_HISTORY:
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_CALL_HISTORY);
break;
case HostUi.CALL_LOG:
- Logger.get(mContext).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_CALL_LOG);
+ Logger.get(context).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_CALL_LOG);
break;
case HostUi.VOICEMAIL:
- Logger.get(mContext).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_VOICEMAIL);
+ Logger.get(context).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_VOICEMAIL);
break;
default:
throw Assert.createIllegalStateFailException();
}
} else if (id == R.id.create_new_contact_action) {
- Logger.get(mContext).logImpression(DialerImpression.Type.CALL_LOG_CREATE_NEW_CONTACT);
+ Logger.get(context).logImpression(DialerImpression.Type.CALL_LOG_CREATE_NEW_CONTACT);
switch (hostUi) {
case HostUi.CALL_HISTORY:
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_CALL_HISTORY);
break;
case HostUi.CALL_LOG:
- Logger.get(mContext)
- .logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_CALL_LOG);
+ Logger.get(context).logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_CALL_LOG);
break;
case HostUi.VOICEMAIL:
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_VOICEMAIL);
break;
default:
@@ -1166,7 +1163,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
private void maybeShowBlockNumberMigrationDialog(BlockedNumbersMigrator.Listener listener) {
if (!FilteredNumberCompat.maybeShowBlockNumberMigrationDialog(
- mContext, ((Activity) mContext).getFragmentManager(), listener)) {
+ context, ((Activity) context).getFragmentManager(), listener)) {
listener.onComplete();
}
}
@@ -1179,8 +1176,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
reportNotSpamView.setVisibility(View.GONE);
String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
if (isVoicemailNumber
- || !FilteredNumbersUtil.canBlockNumber(mContext, e164Number, number)
- || !FilteredNumberCompat.canAttemptBlockOperations(mContext)) {
+ || !FilteredNumbersUtil.canBlockNumber(context, e164Number, number)
+ || !FilteredNumberCompat.canAttemptBlockOperations(context)) {
return;
}
boolean isBlocked = blockId != null;
@@ -1217,7 +1214,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
if (callType == CallLog.Calls.VOICEMAIL_TYPE) {
- menu.setHeaderTitle(mContext.getResources().getText(R.string.voicemail));
+ menu.setHeaderTitle(context.getResources().getText(R.string.voicemail));
} else {
menu.setHeaderTitle(
PhoneNumberUtilsCompat.createTtsSpannable(
@@ -1237,7 +1234,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
// 3) Number is a SIP address
if (PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation)
- && !mCallLogCache.isVoicemailNumber(accountHandle, number)
+ && !callLogCache.isVoicemailNumber(accountHandle, number)
&& !PhoneNumberHelper.isSipNumber(number)) {
menu.add(
ContextMenu.NONE,
@@ -1258,10 +1255,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
- boolean isVoicemailNumber = mCallLogCache.isVoicemailNumber(accountHandle, number);
+ boolean isVoicemailNumber = callLogCache.isVoicemailNumber(accountHandle, number);
if (!isVoicemailNumber
- && FilteredNumbersUtil.canBlockNumber(mContext, e164Number, number)
- && FilteredNumberCompat.canAttemptBlockOperations(mContext)) {
+ && FilteredNumbersUtil.canBlockNumber(context, e164Number, number)
+ && FilteredNumberCompat.canAttemptBlockOperations(context)) {
boolean isBlocked = blockId != null;
if (isBlocked) {
menu.add(
@@ -1309,7 +1306,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
.setOnMenuItemClickListener(this);
}
- Logger.get(mContext).logScreenView(ScreenEvent.Type.CALL_LOG_CONTEXT_MENU, (Activity) mContext);
+ Logger.get(context).logScreenView(ScreenEvent.Type.CALL_LOG_CONTEXT_MENU, (Activity) context);
}
/** Specifies where the view holder belongs. */
diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java
index 3a4bf8766..d20ddd0e5 100644
--- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java
+++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java
@@ -57,20 +57,20 @@ public class CallLogNotificationsQueryHelper {
static final String CONFIG_NEW_VOICEMAIL_NOTIFICATION_THRESHOLD_OFFSET =
"new_voicemail_notification_threshold";
- private final Context mContext;
- private final NewCallsQuery mNewCallsQuery;
- private final ContactInfoHelper mContactInfoHelper;
- private final String mCurrentCountryIso;
+ private final Context context;
+ private final NewCallsQuery newCallsQuery;
+ private final ContactInfoHelper contactInfoHelper;
+ private final String currentCountryIso;
CallLogNotificationsQueryHelper(
Context context,
NewCallsQuery newCallsQuery,
ContactInfoHelper contactInfoHelper,
String countryIso) {
- mContext = context;
- mNewCallsQuery = newCallsQuery;
- mContactInfoHelper = contactInfoHelper;
- mCurrentCountryIso = countryIso;
+ this.context = context;
+ this.newCallsQuery = newCallsQuery;
+ this.contactInfoHelper = contactInfoHelper;
+ currentCountryIso = countryIso;
}
/** Returns an instance of {@link CallLogNotificationsQueryHelper}. */
@@ -146,7 +146,7 @@ public class CallLogNotificationsQueryHelper {
}
NewCallsQuery getNewCallsQuery() {
- return mNewCallsQuery;
+ return newCallsQuery;
}
/**
@@ -156,10 +156,10 @@ public class CallLogNotificationsQueryHelper {
*/
@Nullable
public List<NewCall> getNewVoicemails() {
- return mNewCallsQuery.query(
+ return newCallsQuery.query(
Calls.VOICEMAIL_TYPE,
System.currentTimeMillis()
- - ConfigProviderBindings.get(mContext)
+ - ConfigProviderBindings.get(context)
.getLong(
CONFIG_NEW_VOICEMAIL_NOTIFICATION_THRESHOLD_OFFSET, TimeUnit.DAYS.toMillis(7)));
}
@@ -171,7 +171,7 @@ public class CallLogNotificationsQueryHelper {
*/
@Nullable
public List<NewCall> getNewMissedCalls() {
- return mNewCallsQuery.query(Calls.MISSED_TYPE);
+ return newCallsQuery.query(Calls.MISSED_TYPE);
}
/**
@@ -193,7 +193,7 @@ public class CallLogNotificationsQueryHelper {
public ContactInfo getContactInfo(
@Nullable String number, int numberPresentation, @Nullable String countryIso) {
if (countryIso == null) {
- countryIso = mCurrentCountryIso;
+ countryIso = currentCountryIso;
}
number = (number == null) ? "" : number;
@@ -205,14 +205,14 @@ public class CallLogNotificationsQueryHelper {
// 1. Special number representation.
contactInfo.name =
- PhoneNumberDisplayUtil.getDisplayName(mContext, number, numberPresentation, false)
+ PhoneNumberDisplayUtil.getDisplayName(context, number, numberPresentation, false)
.toString();
if (!TextUtils.isEmpty(contactInfo.name)) {
return contactInfo;
}
// 2. Look it up in the cache.
- ContactInfo cachedContactInfo = mContactInfoHelper.lookupNumber(number, countryIso);
+ ContactInfo cachedContactInfo = contactInfoHelper.lookupNumber(number, countryIso);
if (cachedContactInfo != null && !TextUtils.isEmpty(cachedContactInfo.name)) {
return cachedContactInfo;
@@ -226,7 +226,7 @@ public class CallLogNotificationsQueryHelper {
contactInfo.name = number;
} else {
// 5. Otherwise, it's unknown number.
- contactInfo.name = mContext.getResources().getString(R.string.unknown);
+ contactInfo.name = context.getResources().getString(R.string.unknown);
}
return contactInfo;
}
@@ -330,12 +330,12 @@ public class CallLogNotificationsQueryHelper {
private static final int DATE_COLUMN_INDEX = 8;
private static final int TRANSCRIPTION_STATE_COLUMN_INDEX = 9;
- private final ContentResolver mContentResolver;
- private final Context mContext;
+ private final ContentResolver contentResolver;
+ private final Context context;
private DefaultNewCallsQuery(Context context, ContentResolver contentResolver) {
- mContext = context;
- mContentResolver = contentResolver;
+ this.context = context;
+ this.contentResolver = contentResolver;
}
@Override
@@ -350,7 +350,7 @@ public class CallLogNotificationsQueryHelper {
@TargetApi(Build.VERSION_CODES.M)
@SuppressWarnings("MissingPermission")
public List<NewCall> query(int type, long thresholdMillis) {
- if (!PermissionsUtil.hasPermission(mContext, Manifest.permission.READ_CALL_LOG)) {
+ if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_CALL_LOG)) {
LogUtil.w(
"CallLogNotificationsQueryHelper.DefaultNewCallsQuery.query",
"no READ_CALL_LOG permission, returning null for calls lookup.");
@@ -382,7 +382,7 @@ public class CallLogNotificationsQueryHelper {
}
Selection selection = selectionBuilder.build();
try (Cursor cursor =
- mContentResolver.query(
+ contentResolver.query(
Calls.CONTENT_URI_WITH_VOICEMAIL,
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) ? PROJECTION_O : PROJECTION,
selection.getSelection(),
@@ -407,7 +407,7 @@ public class CallLogNotificationsQueryHelper {
@Nullable
@Override
public NewCall query(Uri callsUri) {
- if (!PermissionsUtil.hasPermission(mContext, Manifest.permission.READ_CALL_LOG)) {
+ if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_CALL_LOG)) {
LogUtil.w(
"CallLogNotificationsQueryHelper.DefaultNewCallsQuery.query",
"No READ_CALL_LOG permission, returning null for calls lookup.");
@@ -415,7 +415,7 @@ public class CallLogNotificationsQueryHelper {
}
final String selection = String.format("%s = '%s'", Calls.VOICEMAIL_URI, callsUri.toString());
try (Cursor cursor =
- mContentResolver.query(
+ contentResolver.query(
Calls.CONTENT_URI_WITH_VOICEMAIL,
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) ? PROJECTION_O : PROJECTION,
selection,
diff --git a/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java b/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java
index a3aac41fa..81aed8baa 100644
--- a/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java
+++ b/java/com/android/dialer/app/calllog/DialerQuickContactBadge.java
@@ -27,7 +27,7 @@ import com.android.dialer.logging.Logger;
/** Allows us to click the contact badge for non multi select mode. */
class DialerQuickContactBadge extends QuickContactBadge {
- private View.OnClickListener mExtraOnClickListener;
+ private View.OnClickListener extraOnClickListener;
private OnActionModeStateChangedListener onActionModeStateChangeListener;
public DialerQuickContactBadge(Context context) {
@@ -44,11 +44,11 @@ class DialerQuickContactBadge extends QuickContactBadge {
@Override
public void onClick(View v) {
- if (mExtraOnClickListener != null
+ if (extraOnClickListener != null
&& onActionModeStateChangeListener.isActionModeStateEnabled()) {
Logger.get(v.getContext())
.logImpression(DialerImpression.Type.MULTISELECT_SINGLE_PRESS_TAP_VIA_CONTACT_BADGE);
- mExtraOnClickListener.onClick(v);
+ extraOnClickListener.onClick(v);
} else {
super.onClick(v);
}
@@ -57,7 +57,7 @@ class DialerQuickContactBadge extends QuickContactBadge {
public void setMulitSelectListeners(
View.OnClickListener extraOnClickListener,
OnActionModeStateChangedListener actionModeStateChangeListener) {
- mExtraOnClickListener = extraOnClickListener;
+ this.extraOnClickListener = extraOnClickListener;
onActionModeStateChangeListener = actionModeStateChangeListener;
}
}
diff --git a/java/com/android/dialer/app/calllog/GroupingListAdapter.java b/java/com/android/dialer/app/calllog/GroupingListAdapter.java
index d1157206f..29a4d4e4a 100644
--- a/java/com/android/dialer/app/calllog/GroupingListAdapter.java
+++ b/java/com/android/dialer/app/calllog/GroupingListAdapter.java
@@ -32,7 +32,7 @@ import android.util.SparseIntArray;
*/
abstract class GroupingListAdapter extends RecyclerView.Adapter {
- protected ContentObserver mChangeObserver =
+ protected ContentObserver changeObserver =
new ContentObserver(new Handler()) {
@Override
public boolean deliverSelfNotifications() {
@@ -44,21 +44,21 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter {
onContentChanged();
}
};
- protected DataSetObserver mDataSetObserver =
+ protected DataSetObserver dataSetObserver =
new DataSetObserver() {
@Override
public void onChanged() {
notifyDataSetChanged();
}
};
- private Cursor mCursor;
+ private Cursor cursor;
/**
* SparseIntArray, which maps the cursor position of the first element of a group to the size of
* the group. The index of a key in this map corresponds to the list position of that group.
*/
- private SparseIntArray mGroupMetadata;
+ private SparseIntArray groupMetadata;
- private int mItemCount;
+ private int itemCount;
public GroupingListAdapter() {
reset();
@@ -72,28 +72,28 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter {
protected abstract void onContentChanged();
public void changeCursor(Cursor cursor) {
- if (cursor == mCursor) {
+ if (cursor == this.cursor) {
return;
}
- if (mCursor != null) {
- mCursor.unregisterContentObserver(mChangeObserver);
- mCursor.unregisterDataSetObserver(mDataSetObserver);
- mCursor.close();
+ if (this.cursor != null) {
+ this.cursor.unregisterContentObserver(changeObserver);
+ this.cursor.unregisterDataSetObserver(dataSetObserver);
+ this.cursor.close();
}
// Reset whenever the cursor is changed.
reset();
- mCursor = cursor;
+ this.cursor = cursor;
if (cursor != null) {
- addGroups(mCursor);
+ addGroups(this.cursor);
// Calculate the item count by subtracting group child counts from the cursor count.
- mItemCount = mGroupMetadata.size();
+ itemCount = groupMetadata.size();
- cursor.registerContentObserver(mChangeObserver);
- cursor.registerDataSetObserver(mDataSetObserver);
+ cursor.registerContentObserver(changeObserver);
+ cursor.registerDataSetObserver(dataSetObserver);
notifyDataSetChanged();
}
}
@@ -103,18 +103,18 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter {
* #addGroups} method.
*/
public void addGroup(int cursorPosition, int groupSize) {
- int lastIndex = mGroupMetadata.size() - 1;
- if (lastIndex < 0 || cursorPosition <= mGroupMetadata.keyAt(lastIndex)) {
- mGroupMetadata.put(cursorPosition, groupSize);
+ int lastIndex = groupMetadata.size() - 1;
+ if (lastIndex < 0 || cursorPosition <= groupMetadata.keyAt(lastIndex)) {
+ groupMetadata.put(cursorPosition, groupSize);
} else {
// Optimization to avoid binary search if adding groups in ascending cursor position.
- mGroupMetadata.append(cursorPosition, groupSize);
+ groupMetadata.append(cursorPosition, groupSize);
}
}
@Override
public int getItemCount() {
- return mItemCount;
+ return itemCount;
}
/**
@@ -122,11 +122,11 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter {
* position.
*/
public int getGroupSize(int listPosition) {
- if (listPosition < 0 || listPosition >= mGroupMetadata.size()) {
+ if (listPosition < 0 || listPosition >= groupMetadata.size()) {
return 0;
}
- return mGroupMetadata.valueAt(listPosition);
+ return groupMetadata.valueAt(listPosition);
}
/**
@@ -134,20 +134,20 @@ abstract class GroupingListAdapter extends RecyclerView.Adapter {
* corresponding to that position.
*/
public Object getItem(int listPosition) {
- if (mCursor == null || listPosition < 0 || listPosition >= mGroupMetadata.size()) {
+ if (cursor == null || listPosition < 0 || listPosition >= groupMetadata.size()) {
return null;
}
- int cursorPosition = mGroupMetadata.keyAt(listPosition);
- if (mCursor.moveToPosition(cursorPosition)) {
- return mCursor;
+ int cursorPosition = groupMetadata.keyAt(listPosition);
+ if (cursor.moveToPosition(cursorPosition)) {
+ return cursor;
} else {
return null;
}
}
private void reset() {
- mItemCount = 0;
- mGroupMetadata = new SparseIntArray();
+ itemCount = 0;
+ groupMetadata = new SparseIntArray();
}
}
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
index 794b759f2..fa1f7ab2c 100644
--- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
+++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
@@ -55,17 +55,17 @@ public class PhoneCallDetailsHelper
/** The maximum number of icons will be shown to represent the call types in a group. */
private static final int MAX_CALL_TYPE_ICONS = 3;
- private final Context mContext;
- private final Resources mResources;
- private final CallLogCache mCallLogCache;
+ private final Context context;
+ private final Resources resources;
+ private final CallLogCache callLogCache;
/** Calendar used to construct dates */
- private final Calendar mCalendar;
+ private final Calendar calendar;
/** The injected current time in milliseconds since the epoch. Used only by tests. */
- private Long mCurrentTimeMillisForTest;
+ private Long currentTimeMillisForTest;
- private CharSequence mPhoneTypeLabelForTest;
+ private CharSequence phoneTypeLabelForTest;
/** List of items to be concatenated together for accessibility descriptions */
- private ArrayList<CharSequence> mDescriptionItems = new ArrayList<>();
+ private ArrayList<CharSequence> descriptionItems = new ArrayList<>();
/**
* Creates a new instance of the helper.
@@ -75,10 +75,10 @@ public class PhoneCallDetailsHelper
* @param resources used to look up strings
*/
public PhoneCallDetailsHelper(Context context, Resources resources, CallLogCache callLogCache) {
- mContext = context;
- mResources = resources;
- mCallLogCache = callLogCache;
- mCalendar = Calendar.getInstance();
+ this.context = context;
+ this.resources = resources;
+ this.callLogCache = callLogCache;
+ calendar = Calendar.getInstance();
}
/** Fills the call details views with content. */
@@ -100,7 +100,7 @@ public class PhoneCallDetailsHelper
views.callTypeIcons.setShowHd(
(details.features & Calls.FEATURES_HD_CALL) == Calls.FEATURES_HD_CALL);
views.callTypeIcons.setShowWifi(
- MotorolaUtils.shouldShowWifiIconInCallLog(mContext, details.features));
+ MotorolaUtils.shouldShowWifiIconInCallLog(context, details.features));
views.callTypeIcons.requestLayout();
views.callTypeIcons.setVisibility(View.VISIBLE);
@@ -116,23 +116,23 @@ public class PhoneCallDetailsHelper
setDetailText(views, callCount, details);
// Set the account label if it exists.
- String accountLabel = mCallLogCache.getAccountLabel(details.accountHandle);
+ String accountLabel = callLogCache.getAccountLabel(details.accountHandle);
if (!TextUtils.isEmpty(details.viaNumber)) {
if (!TextUtils.isEmpty(accountLabel)) {
accountLabel =
- mResources.getString(
+ resources.getString(
R.string.call_log_via_number_phone_account, accountLabel, details.viaNumber);
} else {
- accountLabel = mResources.getString(R.string.call_log_via_number, details.viaNumber);
+ accountLabel = resources.getString(R.string.call_log_via_number, details.viaNumber);
}
}
if (!TextUtils.isEmpty(accountLabel)) {
views.callAccountLabel.setVisibility(View.VISIBLE);
views.callAccountLabel.setText(accountLabel);
- int color = mCallLogCache.getAccountColor(details.accountHandle);
+ int color = callLogCache.getAccountColor(details.accountHandle);
if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) {
int defaultColor = R.color.dialer_secondary_text_color;
- views.callAccountLabel.setTextColor(mContext.getResources().getColor(defaultColor));
+ views.callAccountLabel.setTextColor(context.getResources().getColor(defaultColor));
} else {
views.callAccountLabel.setTextColor(color);
}
@@ -171,23 +171,22 @@ public class PhoneCallDetailsHelper
showRatingPrompt = true;
} else if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE
|| details.transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE_AND_RATED) {
- branding = mResources.getString(R.string.voicemail_transcription_branding_text);
+ branding = resources.getString(R.string.voicemail_transcription_branding_text);
}
} else {
switch (details.transcriptionState) {
case VoicemailCompat.TRANSCRIPTION_IN_PROGRESS:
- branding = mResources.getString(R.string.voicemail_transcription_in_progress);
+ branding = resources.getString(R.string.voicemail_transcription_in_progress);
break;
case VoicemailCompat.TRANSCRIPTION_FAILED_NO_SPEECH_DETECTED:
- branding = mResources.getString(R.string.voicemail_transcription_failed_no_speech);
+ branding = resources.getString(R.string.voicemail_transcription_failed_no_speech);
break;
case VoicemailCompat.TRANSCRIPTION_FAILED_LANGUAGE_NOT_SUPPORTED:
branding =
- mResources.getString(
- R.string.voicemail_transcription_failed_language_not_supported);
+ resources.getString(R.string.voicemail_transcription_failed_language_not_supported);
break;
case VoicemailCompat.TRANSCRIPTION_FAILED:
- branding = mResources.getString(R.string.voicemail_transcription_failed);
+ branding = resources.getString(R.string.voicemail_transcription_failed);
break;
default:
break; // Fall through
@@ -228,7 +227,7 @@ public class PhoneCallDetailsHelper
views.callLocationAndDate.setTypeface(typeface);
views.callLocationAndDate.setTextColor(
ContextCompat.getColor(
- mContext,
+ context,
details.isRead ? R.color.call_log_detail_color : R.color.call_log_unread_text_color));
}
@@ -236,16 +235,16 @@ public class PhoneCallDetailsHelper
int transcriptionState, PhoneAccountHandle account) {
// TODO(mdooley): add a configurable random element here?
return transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE
- && VoicemailComponent.get(mContext)
+ && VoicemailComponent.get(context)
.getVoicemailClient()
- .isVoicemailDonationEnabled(mContext, account);
+ .isVoicemailDonationEnabled(context, account);
}
private void recordTranscriptionRating(
TranscriptionRatingValue ratingValue, PhoneCallDetails details) {
LogUtil.enterBlock("PhoneCallDetailsHelper.recordTranscriptionRating");
TranscriptionRatingHelper.sendRating(
- mContext,
+ context,
ratingValue,
Uri.parse(details.voicemailUri),
this::onRatingSuccess,
@@ -256,7 +255,7 @@ public class PhoneCallDetailsHelper
public void onRatingSuccess(Uri voicemailUri) {
LogUtil.enterBlock("PhoneCallDetailsHelper.onRatingSuccess");
Toast toast =
- Toast.makeText(mContext, R.string.voicemail_transcription_rating_thanks, Toast.LENGTH_LONG);
+ Toast.makeText(context, R.string.voicemail_transcription_rating_thanks, Toast.LENGTH_LONG);
toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 50);
toast.show();
}
@@ -274,7 +273,7 @@ public class PhoneCallDetailsHelper
* @return The call location and date string.
*/
public CharSequence getCallLocationAndDate(PhoneCallDetails details) {
- mDescriptionItems.clear();
+ descriptionItems.clear();
if (details.callTypes[0] != Calls.VOICEMAIL_TYPE) {
// Get type of call (ie mobile, home, etc) if known, or the caller's location.
@@ -283,15 +282,15 @@ public class PhoneCallDetailsHelper
// Only add the call type or location if its not empty. It will be empty for unknown
// callers.
if (!TextUtils.isEmpty(callTypeOrLocation)) {
- mDescriptionItems.add(callTypeOrLocation);
+ descriptionItems.add(callTypeOrLocation);
}
}
// The date of this call
- mDescriptionItems.add(getCallDate(details));
+ descriptionItems.add(getCallDate(details));
// Create a comma separated list from the call type or location, and call date.
- return DialerUtils.join(mDescriptionItems);
+ return DialerUtils.join(descriptionItems);
}
/**
@@ -304,16 +303,16 @@ public class PhoneCallDetailsHelper
*/
public CharSequence getCallTypeOrLocation(PhoneCallDetails details) {
if (details.isSpam) {
- return mResources.getString(R.string.spam_number_call_log_label);
+ return resources.getString(R.string.spam_number_call_log_label);
} else if (details.isBlocked) {
- return mResources.getString(R.string.blocked_number_call_log_label);
+ return resources.getString(R.string.blocked_number_call_log_label);
}
CharSequence numberFormattedLabel = null;
// Only show a label if the number is shown and it is not a SIP address.
if (!TextUtils.isEmpty(details.number)
&& !PhoneNumberHelper.isUriNumber(details.number.toString())
- && !mCallLogCache.isVoicemailNumber(details.accountHandle, details.number)) {
+ && !callLogCache.isVoicemailNumber(details.accountHandle, details.number)) {
if (shouldShowLocation(details)) {
numberFormattedLabel = details.geocode;
@@ -321,9 +320,9 @@ public class PhoneCallDetailsHelper
&& TextUtils.isEmpty(details.numberLabel))) {
// Get type label only if it will not be "Custom" because of an empty number label.
numberFormattedLabel =
- mPhoneTypeLabelForTest != null
- ? mPhoneTypeLabelForTest
- : Phone.getTypeLabel(mResources, details.numberType, details.numberLabel);
+ phoneTypeLabelForTest != null
+ ? phoneTypeLabelForTest
+ : Phone.getTypeLabel(resources, details.numberType, details.numberLabel);
}
}
@@ -350,7 +349,7 @@ public class PhoneCallDetailsHelper
}
public void setPhoneTypeLabelForTest(CharSequence phoneTypeLabel) {
- this.mPhoneTypeLabelForTest = phoneTypeLabel;
+ this.phoneTypeLabelForTest = phoneTypeLabel;
}
/**
@@ -385,10 +384,10 @@ public class PhoneCallDetailsHelper
* @return String representing when the call occurred
*/
public CharSequence getGranularDateTime(PhoneCallDetails details) {
- return mResources.getString(
+ return resources.getString(
R.string.voicemailCallLogDateTimeFormat,
getGranularDate(details.date),
- DateUtils.formatDateTime(mContext, details.date, DateUtils.FORMAT_SHOW_TIME));
+ DateUtils.formatDateTime(context, details.date, DateUtils.FORMAT_SHOW_TIME));
}
/**
@@ -396,10 +395,10 @@ public class PhoneCallDetailsHelper
*/
private String getGranularDate(long date) {
if (DateUtils.isToday(date)) {
- return mResources.getString(R.string.voicemailCallLogToday);
+ return resources.getString(R.string.voicemailCallLogToday);
}
return DateUtils.formatDateTime(
- mContext,
+ context,
date,
DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_ABBREV_MONTH
@@ -412,10 +411,10 @@ public class PhoneCallDetailsHelper
* @return {@code true} if date is within the current year, {@code false} otherwise
*/
private boolean shouldShowYear(long date) {
- mCalendar.setTimeInMillis(getCurrentTimeMillis());
- int currentYear = mCalendar.get(Calendar.YEAR);
- mCalendar.setTimeInMillis(date);
- return currentYear != mCalendar.get(Calendar.YEAR);
+ calendar.setTimeInMillis(getCurrentTimeMillis());
+ int currentYear = calendar.get(Calendar.YEAR);
+ calendar.setTimeInMillis(date);
+ return currentYear != calendar.get(Calendar.YEAR);
}
/** Sets the text of the header view for the details page of a phone call. */
@@ -426,14 +425,14 @@ public class PhoneCallDetailsHelper
} else if (!TextUtils.isEmpty(details.displayNumber)) {
nameText = details.displayNumber;
} else {
- nameText = mResources.getString(R.string.unknown);
+ nameText = resources.getString(R.string.unknown);
}
nameView.setText(nameText);
}
public void setCurrentTimeForTest(long currentTimeMillis) {
- mCurrentTimeMillisForTest = currentTimeMillis;
+ currentTimeMillisForTest = currentTimeMillis;
}
/**
@@ -442,10 +441,10 @@ public class PhoneCallDetailsHelper
* <p>It can be injected in tests using {@link #setCurrentTimeForTest(long)}.
*/
private long getCurrentTimeMillis() {
- if (mCurrentTimeMillisForTest == null) {
+ if (currentTimeMillisForTest == null) {
return System.currentTimeMillis();
} else {
- return mCurrentTimeMillisForTest;
+ return currentTimeMillisForTest;
}
}
@@ -456,14 +455,14 @@ public class PhoneCallDetailsHelper
CharSequence dateText = details.callLocationAndDate;
final CharSequence text;
if (callCount != null) {
- text = mResources.getString(R.string.call_log_item_count_and_date, callCount, dateText);
+ text = resources.getString(R.string.call_log_item_count_and_date, callCount, dateText);
} else {
text = dateText;
}
if (details.callTypes[0] == Calls.VOICEMAIL_TYPE && details.duration > 0) {
views.callLocationAndDate.setText(
- mResources.getString(
+ resources.getString(
R.string.voicemailCallLogDateTimeFormatWithDuration,
text,
getVoicemailDuration(details)));
@@ -478,6 +477,6 @@ public class PhoneCallDetailsHelper
if (minutes > 99) {
minutes = 99;
}
- return mResources.getString(R.string.voicemailDurationFormat, minutes, seconds);
+ return resources.getString(R.string.voicemailDurationFormat, minutes, seconds);
}
}
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
index 33fcba002..d38ec57a4 100644
--- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
@@ -46,11 +46,11 @@ import java.util.List;
public class VisualVoicemailCallLogFragment extends CallLogFragment {
- private final ContentObserver mVoicemailStatusObserver = new CustomContentObserver();
- private VoicemailPlaybackPresenter mVoicemailPlaybackPresenter;
- private DialerExecutor<Context> mPreSyncVoicemailStatusCheckExecutor;
+ private final ContentObserver voicemailStatusObserver = new CustomContentObserver();
+ private VoicemailPlaybackPresenter voicemailPlaybackPresenter;
+ private DialerExecutor<Context> preSyncVoicemailStatusCheckExecutor;
- private VoicemailErrorManager mVoicemailErrorManager;
+ private VoicemailErrorManager voicemailErrorManager;
public VisualVoicemailCallLogFragment() {
super(CallLog.Calls.VOICEMAIL_TYPE);
@@ -58,19 +58,19 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
@Override
protected VoicemailPlaybackPresenter getVoicemailPlaybackPresenter() {
- return mVoicemailPlaybackPresenter;
+ return voicemailPlaybackPresenter;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
- mVoicemailPlaybackPresenter =
+ voicemailPlaybackPresenter =
VoicemailPlaybackPresenter.getInstance(getActivity(), savedInstanceState);
if (PermissionsUtil.hasReadVoicemailPermissions(getContext())
&& PermissionsUtil.hasAddVoicemailPermissions(getContext())) {
getActivity()
.getContentResolver()
.registerContentObserver(
- VoicemailContract.Status.CONTENT_URI, true, mVoicemailStatusObserver);
+ VoicemailContract.Status.CONTENT_URI, true, voicemailStatusObserver);
} else {
LogUtil.w(
"VisualVoicemailCallLogFragment.onActivityCreated",
@@ -78,7 +78,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
}
super.onActivityCreated(savedInstanceState);
- mPreSyncVoicemailStatusCheckExecutor =
+ preSyncVoicemailStatusCheckExecutor =
DialerExecutorComponent.get(getContext())
.dialerExecutorFactory()
.createUiTaskBuilder(
@@ -88,8 +88,8 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
.onSuccess(this::onPreSyncVoicemailStatusChecked)
.build();
- mVoicemailErrorManager =
- new VoicemailErrorManager(getContext(), getAdapter().getAlertManager(), mModalAlertManager);
+ voicemailErrorManager =
+ new VoicemailErrorManager(getContext(), getAdapter().getAlertManager(), modalAlertManager);
if (PermissionsUtil.hasReadVoicemailPermissions(getContext())
&& PermissionsUtil.hasAddVoicemailPermissions(getContext())) {
@@ -98,7 +98,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
.registerContentObserver(
VoicemailContract.Status.CONTENT_URI,
true,
- mVoicemailErrorManager.getContentObserver());
+ voicemailErrorManager.getContentObserver());
} else {
LogUtil.w(
"VisualVoicemailCallLogFragment.onActivityCreated",
@@ -116,14 +116,14 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
@Override
public void onResume() {
super.onResume();
- mVoicemailPlaybackPresenter.onResume();
- mVoicemailErrorManager.onResume();
+ voicemailPlaybackPresenter.onResume();
+ voicemailErrorManager.onResume();
}
@Override
public void onPause() {
- mVoicemailPlaybackPresenter.onPause();
- mVoicemailErrorManager.onPause();
+ voicemailPlaybackPresenter.onPause();
+ voicemailErrorManager.onPause();
super.onPause();
}
@@ -132,10 +132,10 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
if (isAdded()) {
getActivity()
.getContentResolver()
- .unregisterContentObserver(mVoicemailErrorManager.getContentObserver());
- mVoicemailPlaybackPresenter.onDestroy();
- mVoicemailErrorManager.onDestroy();
- getActivity().getContentResolver().unregisterContentObserver(mVoicemailStatusObserver);
+ .unregisterContentObserver(voicemailErrorManager.getContentObserver());
+ voicemailPlaybackPresenter.onDestroy();
+ voicemailErrorManager.onDestroy();
+ getActivity().getContentResolver().unregisterContentObserver(voicemailStatusObserver);
}
super.onDestroy();
}
@@ -143,8 +143,8 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- if (mVoicemailPlaybackPresenter != null) {
- mVoicemailPlaybackPresenter.onSaveInstanceState(outState);
+ if (voicemailPlaybackPresenter != null) {
+ voicemailPlaybackPresenter.onSaveInstanceState(outState);
}
}
@@ -159,7 +159,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
LogUtil.enterBlock("VisualVoicemailCallLogFragment.onVisible");
super.onVisible();
if (getActivity() != null) {
- mPreSyncVoicemailStatusCheckExecutor.executeParallel(getActivity());
+ preSyncVoicemailStatusCheckExecutor.executeParallel(getActivity());
Logger.get(getActivity()).logImpression(DialerImpression.Type.VVM_TAB_VIEWED);
getActivity().setVolumeControlStream(VoicemailAudioManager.PLAYBACK_STREAM);
}
diff --git a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
index 15de14318..f45537ca8 100644
--- a/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
+++ b/java/com/android/dialer/app/calllog/calllogcache/CallLogCache.java
@@ -42,24 +42,24 @@ public class CallLogCache {
// TODO: Dialer should be fixed so as not to check isVoicemail() so often but at the time of
// this writing, that was a much larger undertaking than creating this cache.
- protected final Context mContext;
+ protected final Context context;
- private boolean mHasCheckedForVideoAvailability;
- private int mVideoAvailability;
- private final Map<PhoneAccountHandle, String> mPhoneAccountLabelCache = new ArrayMap<>();
- private final Map<PhoneAccountHandle, Integer> mPhoneAccountColorCache = new ArrayMap<>();
- private final Map<PhoneAccountHandle, Boolean> mPhoneAccountCallWithNoteCache = new ArrayMap<>();
+ private boolean hasCheckedForVideoAvailability;
+ private int videoAvailability;
+ private final Map<PhoneAccountHandle, String> phoneAccountLabelCache = new ArrayMap<>();
+ private final Map<PhoneAccountHandle, Integer> phoneAccountColorCache = new ArrayMap<>();
+ private final Map<PhoneAccountHandle, Boolean> phoneAccountCallWithNoteCache = new ArrayMap<>();
public CallLogCache(Context context) {
- mContext = context;
+ this.context = context;
}
public synchronized void reset() {
- mPhoneAccountLabelCache.clear();
- mPhoneAccountColorCache.clear();
- mPhoneAccountCallWithNoteCache.clear();
- mHasCheckedForVideoAvailability = false;
- mVideoAvailability = 0;
+ phoneAccountLabelCache.clear();
+ phoneAccountColorCache.clear();
+ phoneAccountCallWithNoteCache.clear();
+ hasCheckedForVideoAvailability = false;
+ videoAvailability = 0;
}
/**
@@ -71,7 +71,7 @@ public class CallLogCache {
if (TextUtils.isEmpty(number)) {
return false;
}
- return TelecomUtil.isVoicemailNumber(mContext, accountHandle, number.toString());
+ return TelecomUtil.isVoicemailNumber(context, accountHandle, number.toString());
}
/**
@@ -79,31 +79,31 @@ public class CallLogCache {
* {@link android.provider.ContactsContract.CommonDataKinds.Phone#CARRIER_PRESENCE} column.
*/
public boolean canRelyOnVideoPresence() {
- if (!mHasCheckedForVideoAvailability) {
- mVideoAvailability = CallUtil.getVideoCallingAvailability(mContext);
- mHasCheckedForVideoAvailability = true;
+ if (!hasCheckedForVideoAvailability) {
+ videoAvailability = CallUtil.getVideoCallingAvailability(context);
+ hasCheckedForVideoAvailability = true;
}
- return (mVideoAvailability & CallUtil.VIDEO_CALLING_PRESENCE) != 0;
+ return (videoAvailability & CallUtil.VIDEO_CALLING_PRESENCE) != 0;
}
/** Extract account label from PhoneAccount object. */
public synchronized String getAccountLabel(PhoneAccountHandle accountHandle) {
- if (mPhoneAccountLabelCache.containsKey(accountHandle)) {
- return mPhoneAccountLabelCache.get(accountHandle);
+ if (phoneAccountLabelCache.containsKey(accountHandle)) {
+ return phoneAccountLabelCache.get(accountHandle);
} else {
- String label = PhoneAccountUtils.getAccountLabel(mContext, accountHandle);
- mPhoneAccountLabelCache.put(accountHandle, label);
+ String label = PhoneAccountUtils.getAccountLabel(context, accountHandle);
+ phoneAccountLabelCache.put(accountHandle, label);
return label;
}
}
/** Extract account color from PhoneAccount object. */
public synchronized int getAccountColor(PhoneAccountHandle accountHandle) {
- if (mPhoneAccountColorCache.containsKey(accountHandle)) {
- return mPhoneAccountColorCache.get(accountHandle);
+ if (phoneAccountColorCache.containsKey(accountHandle)) {
+ return phoneAccountColorCache.get(accountHandle);
} else {
- Integer color = PhoneAccountUtils.getAccountColor(mContext, accountHandle);
- mPhoneAccountColorCache.put(accountHandle, color);
+ Integer color = PhoneAccountUtils.getAccountColor(context, accountHandle);
+ phoneAccountColorCache.put(accountHandle, color);
return color;
}
}
@@ -116,12 +116,12 @@ public class CallLogCache {
* @return {@code true} if calling with a note is supported, {@code false} otherwise.
*/
public synchronized boolean doesAccountSupportCallSubject(PhoneAccountHandle accountHandle) {
- if (mPhoneAccountCallWithNoteCache.containsKey(accountHandle)) {
- return mPhoneAccountCallWithNoteCache.get(accountHandle);
+ if (phoneAccountCallWithNoteCache.containsKey(accountHandle)) {
+ return phoneAccountCallWithNoteCache.get(accountHandle);
} else {
Boolean supportsCallWithNote =
- PhoneAccountUtils.getAccountSupportsCallSubject(mContext, accountHandle);
- mPhoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote);
+ PhoneAccountUtils.getAccountSupportsCallSubject(context, accountHandle);
+ phoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote);
return supportsCallWithNote;
}
}
diff --git a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
index 155a6a2eb..3fcf40c2a 100644
--- a/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
+++ b/java/com/android/dialer/app/contactinfo/ContactInfoCache.java
@@ -51,14 +51,14 @@ public class ContactInfoCache {
private static final int START_THREAD = 2;
private static final int START_PROCESSING_REQUESTS_DELAY_MS = 1000;
- private final ExpirableCache<NumberWithCountryIso, ContactInfo> mCache;
- private final ContactInfoHelper mContactInfoHelper;
- private final OnContactInfoChangedListener mOnContactInfoChangedListener;
- private final BlockingQueue<ContactInfoRequest> mUpdateRequests;
- private final Handler mHandler;
- private CequintCallerIdManager mCequintCallerIdManager;
- private QueryThread mContactInfoQueryThread;
- private volatile boolean mRequestProcessingDisabled = false;
+ private final ExpirableCache<NumberWithCountryIso, ContactInfo> cache;
+ private final ContactInfoHelper contactInfoHelper;
+ private final OnContactInfoChangedListener onContactInfoChangedListener;
+ private final BlockingQueue<ContactInfoRequest> updateRequests;
+ private final Handler handler;
+ private CequintCallerIdManager cequintCallerIdManager;
+ private QueryThread contactInfoQueryThread;
+ private volatile boolean requestProcessingDisabled = false;
private static class InnerHandler extends Handler {
@@ -76,7 +76,7 @@ public class ContactInfoCache {
}
switch (msg.what) {
case REDRAW:
- reference.mOnContactInfoChangedListener.onContactInfoChanged();
+ reference.onContactInfoChangedListener.onContactInfoChanged();
break;
case START_THREAD:
reference.startRequestProcessing();
@@ -90,15 +90,15 @@ public class ContactInfoCache {
@NonNull ExpirableCache<NumberWithCountryIso, ContactInfo> internalCache,
@NonNull ContactInfoHelper contactInfoHelper,
@NonNull OnContactInfoChangedListener listener) {
- mCache = internalCache;
- mContactInfoHelper = contactInfoHelper;
- mOnContactInfoChangedListener = listener;
- mUpdateRequests = new PriorityBlockingQueue<>();
- mHandler = new InnerHandler(new WeakReference<>(this));
+ cache = internalCache;
+ this.contactInfoHelper = contactInfoHelper;
+ onContactInfoChangedListener = listener;
+ updateRequests = new PriorityBlockingQueue<>();
+ handler = new InnerHandler(new WeakReference<>(this));
}
public void setCequintCallerIdManager(CequintCallerIdManager cequintCallerIdManager) {
- mCequintCallerIdManager = cequintCallerIdManager;
+ this.cequintCallerIdManager = cequintCallerIdManager;
}
public ContactInfo getValue(
@@ -107,14 +107,14 @@ public class ContactInfoCache {
ContactInfo callLogContactInfo,
boolean remoteLookupIfNotFoundLocally) {
NumberWithCountryIso numberCountryIso = new NumberWithCountryIso(number, countryIso);
- ExpirableCache.CachedValue<ContactInfo> cachedInfo = mCache.getCachedValue(numberCountryIso);
+ ExpirableCache.CachedValue<ContactInfo> cachedInfo = cache.getCachedValue(numberCountryIso);
ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue();
int requestType =
remoteLookupIfNotFoundLocally
? ContactInfoRequest.TYPE_LOCAL_AND_REMOTE
: ContactInfoRequest.TYPE_LOCAL;
if (cachedInfo == null) {
- mCache.put(numberCountryIso, ContactInfo.EMPTY);
+ cache.put(numberCountryIso, ContactInfo.EMPTY);
// Use the cached contact info from the call log.
info = callLogContactInfo;
// The db request should happen on a non-UI thread.
@@ -161,18 +161,18 @@ public class ContactInfoCache {
request.type);
ContactInfo info;
if (request.isLocalRequest()) {
- info = mContactInfoHelper.lookupNumber(request.number, request.countryIso);
+ info = contactInfoHelper.lookupNumber(request.number, request.countryIso);
if (info != null && !info.contactExists) {
// TODO(wangqi): Maybe skip look up if it's already available in cached number lookup
// service.
long start = SystemClock.elapsedRealtime();
- mContactInfoHelper.updateFromCequintCallerId(mCequintCallerIdManager, info, request.number);
+ contactInfoHelper.updateFromCequintCallerId(cequintCallerIdManager, info, request.number);
long time = SystemClock.elapsedRealtime() - start;
LogUtil.d(
"ContactInfoCache.queryContactInfo", "Cequint Caller Id look up takes %d ms", time);
}
if (request.type == ContactInfoRequest.TYPE_LOCAL_AND_REMOTE) {
- if (!mContactInfoHelper.hasName(info)) {
+ if (!contactInfoHelper.hasName(info)) {
enqueueRequest(
request.number,
request.countryIso,
@@ -183,7 +183,7 @@ public class ContactInfoCache {
}
}
} else {
- info = mContactInfoHelper.lookupNumberInRemoteDirectory(request.number, request.countryIso);
+ info = contactInfoHelper.lookupNumberInRemoteDirectory(request.number, request.countryIso);
}
if (info == null) {
@@ -195,7 +195,7 @@ public class ContactInfoCache {
// view.
NumberWithCountryIso numberCountryIso =
new NumberWithCountryIso(request.number, request.countryIso);
- ContactInfo existingInfo = mCache.getPossiblyExpired(numberCountryIso);
+ ContactInfo existingInfo = cache.getPossiblyExpired(numberCountryIso);
final boolean isRemoteSource = info.sourceType != Type.UNKNOWN_SOURCE_TYPE;
@@ -210,14 +210,14 @@ public class ContactInfoCache {
// Store the data in the cache so that the UI thread can use to display it. Store it
// even if it has not changed so that it is marked as not expired.
- mCache.put(numberCountryIso, info);
+ cache.put(numberCountryIso, info);
// Update the call log even if the cache it is up-to-date: it is possible that the cache
// contains the value from a different call log entry.
- mContactInfoHelper.updateCallLogContactInfo(
+ contactInfoHelper.updateCallLogContactInfo(
request.number, request.countryIso, info, request.callLogInfo);
if (!request.isLocalRequest()) {
- mContactInfoHelper.updateCachedNumberLookupService(info);
+ contactInfoHelper.updateCachedNumberLookupService(info);
}
return updated;
}
@@ -229,9 +229,9 @@ public class ContactInfoCache {
public void start() {
// Schedule a thread-creation message if the thread hasn't been created yet, as an
// optimization to queue fewer messages.
- if (mContactInfoQueryThread == null) {
+ if (contactInfoQueryThread == null) {
// TODO: Check whether this delay before starting to process is necessary.
- mHandler.sendEmptyMessageDelayed(START_THREAD, START_PROCESSING_REQUESTS_DELAY_MS);
+ handler.sendEmptyMessageDelayed(START_THREAD, START_PROCESSING_REQUESTS_DELAY_MS);
}
}
@@ -249,22 +249,22 @@ public class ContactInfoCache {
*/
private synchronized void startRequestProcessing() {
// For unit-testing.
- if (mRequestProcessingDisabled) {
+ if (requestProcessingDisabled) {
return;
}
// If a thread is already started, don't start another.
- if (mContactInfoQueryThread != null) {
+ if (contactInfoQueryThread != null) {
return;
}
- mContactInfoQueryThread = new QueryThread();
- mContactInfoQueryThread.setPriority(Thread.MIN_PRIORITY);
- mContactInfoQueryThread.start();
+ contactInfoQueryThread = new QueryThread();
+ contactInfoQueryThread.setPriority(Thread.MIN_PRIORITY);
+ contactInfoQueryThread.start();
}
public void invalidate() {
- mCache.expireAll();
+ cache.expireAll();
stopRequestProcessing();
}
@@ -274,12 +274,12 @@ public class ContactInfoCache {
*/
private synchronized void stopRequestProcessing() {
// Remove any pending requests to start the processing thread.
- mHandler.removeMessages(START_THREAD);
- if (mContactInfoQueryThread != null) {
+ handler.removeMessages(START_THREAD);
+ if (contactInfoQueryThread != null) {
// Stop the thread; we are finished with it.
- mContactInfoQueryThread.stopProcessing();
- mContactInfoQueryThread.interrupt();
- mContactInfoQueryThread = null;
+ contactInfoQueryThread.stopProcessing();
+ contactInfoQueryThread.interrupt();
+ contactInfoQueryThread = null;
}
}
@@ -299,8 +299,8 @@ public class ContactInfoCache {
boolean immediate,
@ContactInfoRequest.TYPE int type) {
ContactInfoRequest request = new ContactInfoRequest(number, countryIso, callLogInfo, type);
- if (!mUpdateRequests.contains(request)) {
- mUpdateRequests.offer(request);
+ if (!updateRequests.contains(request)) {
+ updateRequests.offer(request);
}
if (immediate) {
@@ -318,13 +318,13 @@ public class ContactInfoCache {
/** Sets whether processing of requests for contact details should be enabled. */
public void disableRequestProcessing() {
- mRequestProcessingDisabled = true;
+ requestProcessingDisabled = true;
}
@VisibleForTesting
public void injectContactInfoForTest(String number, String countryIso, ContactInfo contactInfo) {
NumberWithCountryIso numberCountryIso = new NumberWithCountryIso(number, countryIso);
- mCache.put(numberCountryIso, contactInfo);
+ cache.put(numberCountryIso, contactInfo);
}
public interface OnContactInfoChangedListener {
@@ -337,14 +337,14 @@ public class ContactInfoCache {
*/
private class QueryThread extends Thread {
- private volatile boolean mDone = false;
+ private volatile boolean done = false;
public QueryThread() {
super("ContactInfoCache.QueryThread");
}
public void stopProcessing() {
- mDone = true;
+ done = true;
}
@Override
@@ -352,18 +352,18 @@ public class ContactInfoCache {
boolean shouldRedraw = false;
while (true) {
// Check if thread is finished, and if so return immediately.
- if (mDone) {
+ if (done) {
return;
}
try {
- ContactInfoRequest request = mUpdateRequests.take();
+ ContactInfoRequest request = updateRequests.take();
shouldRedraw |= queryContactInfo(request);
if (shouldRedraw
- && (mUpdateRequests.isEmpty()
- || (request.isLocalRequest() && !mUpdateRequests.peek().isLocalRequest()))) {
+ && (updateRequests.isEmpty()
+ || (request.isLocalRequest() && !updateRequests.peek().isLocalRequest()))) {
shouldRedraw = false;
- mHandler.sendEmptyMessage(REDRAW);
+ handler.sendEmptyMessage(REDRAW);
}
} catch (InterruptedException e) {
// Ignore and attempt to continue processing requests
diff --git a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java
index 537acd060..be143bbca 100644
--- a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java
+++ b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java
@@ -43,12 +43,12 @@ import java.util.Objects;
*/
public class ContactPhotoLoader {
- private final Context mContext;
- private final ContactInfo mContactInfo;
+ private final Context context;
+ private final ContactInfo contactInfo;
public ContactPhotoLoader(Context context, ContactInfo contactInfo) {
- mContext = Objects.requireNonNull(context);
- mContactInfo = Objects.requireNonNull(contactInfo);
+ this.context = Objects.requireNonNull(context);
+ this.contactInfo = Objects.requireNonNull(contactInfo);
}
private static Bitmap drawableToBitmap(Drawable drawable, int width, int height) {
@@ -62,7 +62,7 @@ public class ContactPhotoLoader {
/** Create a contact photo icon bitmap appropriate for the ContactInfo. */
public Bitmap loadPhotoIcon() {
Assert.isWorkerThread();
- int photoSize = mContext.getResources().getDimensionPixelSize(R.dimen.contact_photo_size);
+ int photoSize = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_size);
return drawableToBitmap(getIcon(), photoSize, photoSize);
}
@@ -81,11 +81,11 @@ public class ContactPhotoLoader {
*/
@Nullable
private Drawable createPhotoIconDrawable() {
- if (mContactInfo.photoUri == null) {
+ if (contactInfo.photoUri == null) {
return null;
}
try {
- InputStream input = mContext.getContentResolver().openInputStream(mContactInfo.photoUri);
+ InputStream input = context.getContentResolver().openInputStream(contactInfo.photoUri);
if (input == null) {
LogUtil.w(
"ContactPhotoLoader.createPhotoIconDrawable",
@@ -102,7 +102,7 @@ public class ContactPhotoLoader {
return null;
}
final RoundedBitmapDrawable drawable =
- RoundedBitmapDrawableFactory.create(mContext.getResources(), bitmap);
+ RoundedBitmapDrawableFactory.create(context.getResources(), bitmap);
drawable.setAntiAlias(true);
drawable.setCircular(true);
return drawable;
@@ -115,13 +115,13 @@ public class ContactPhotoLoader {
/** @return a {@link LetterTileDrawable} based on the ContactInfo. */
private Drawable createLetterTileDrawable() {
ContactInfoHelper helper =
- new ContactInfoHelper(mContext, GeoUtil.getCurrentCountryIso(mContext));
- LetterTileDrawable drawable = new LetterTileDrawable(mContext.getResources());
+ new ContactInfoHelper(context, GeoUtil.getCurrentCountryIso(context));
+ LetterTileDrawable drawable = new LetterTileDrawable(context.getResources());
drawable.setCanonicalDialerLetterTileDetails(
- mContactInfo.name,
- mContactInfo.lookupKey,
+ contactInfo.name,
+ contactInfo.lookupKey,
LetterTileDrawable.SHAPE_CIRCLE,
- helper.isBusiness(mContactInfo.sourceType)
+ helper.isBusiness(contactInfo.sourceType)
? LetterTileDrawable.TYPE_BUSINESS
: LetterTileDrawable.TYPE_DEFAULT);
return drawable;
diff --git a/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java b/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java
index 36afe5429..cae35d5b6 100644
--- a/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java
+++ b/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java
@@ -53,11 +53,11 @@ public class BlockedNumbersFragment extends ListFragment
private BlockedNumbersMigrator blockedNumbersMigratorForTest;
private TextView blockedNumbersText;
private TextView footerText;
- private BlockedNumbersAdapter mAdapter;
- private VisualVoicemailEnabledChecker mVoicemailEnabledChecker;
- private View mImportSettings;
- private View mBlockedNumbersDisabledForEmergency;
- private View mBlockedNumberListDivider;
+ private BlockedNumbersAdapter adapter;
+ private VisualVoicemailEnabledChecker voicemailEnabledChecker;
+ private View importSettings;
+ private View blockedNumbersDisabledForEmergency;
+ private View blockedNumberListDivider;
@Override
public Context getContext() {
@@ -81,27 +81,27 @@ public class BlockedNumbersFragment extends ListFragment
drawable.setIsCircular(true);
addNumberIcon.setImageDrawable(drawable);
- if (mAdapter == null) {
- mAdapter =
+ if (adapter == null) {
+ adapter =
BlockedNumbersAdapter.newBlockedNumbersAdapter(
getContext(), getActivity().getFragmentManager());
}
- setListAdapter(mAdapter);
+ setListAdapter(adapter);
blockedNumbersText = (TextView) getListView().findViewById(R.id.blocked_number_text_view);
migratePromoView = getListView().findViewById(R.id.migrate_promo);
getListView().findViewById(R.id.migrate_promo_allow_button).setOnClickListener(this);
- mImportSettings = getListView().findViewById(R.id.import_settings);
- mBlockedNumbersDisabledForEmergency =
+ importSettings = getListView().findViewById(R.id.import_settings);
+ blockedNumbersDisabledForEmergency =
getListView().findViewById(R.id.blocked_numbers_disabled_for_emergency);
- mBlockedNumberListDivider = getActivity().findViewById(R.id.blocked_number_list_divider);
+ blockedNumberListDivider = getActivity().findViewById(R.id.blocked_number_list_divider);
getListView().findViewById(R.id.import_button).setOnClickListener(this);
getListView().findViewById(R.id.view_numbers_button).setOnClickListener(this);
getListView().findViewById(R.id.add_number_linear_layout).setOnClickListener(this);
footerText = (TextView) getActivity().findViewById(R.id.blocked_number_footer_textview);
- mVoicemailEnabledChecker = new VisualVoicemailEnabledChecker(getContext(), this);
- mVoicemailEnabledChecker.asyncUpdate();
+ voicemailEnabledChecker = new VisualVoicemailEnabledChecker(getContext(), this);
+ voicemailEnabledChecker.asyncUpdate();
updateActiveVoicemailProvider();
}
@@ -139,11 +139,11 @@ public class BlockedNumbersFragment extends ListFragment
blockedNumbersText.setVisibility(View.GONE);
getListView().findViewById(R.id.add_number_linear_layout).setVisibility(View.GONE);
getListView().findViewById(R.id.add_number_linear_layout).setOnClickListener(null);
- mBlockedNumberListDivider.setVisibility(View.GONE);
- mImportSettings.setVisibility(View.GONE);
+ blockedNumberListDivider.setVisibility(View.GONE);
+ importSettings.setVisibility(View.GONE);
getListView().findViewById(R.id.import_button).setOnClickListener(null);
getListView().findViewById(R.id.view_numbers_button).setOnClickListener(null);
- mBlockedNumbersDisabledForEmergency.setVisibility(View.GONE);
+ blockedNumbersDisabledForEmergency.setVisibility(View.GONE);
footerText.setVisibility(View.GONE);
} else {
FilteredNumbersUtil.checkForSendToVoicemailContact(
@@ -152,7 +152,7 @@ public class BlockedNumbersFragment extends ListFragment
@Override
public void onComplete(boolean hasSendToVoicemailContact) {
final int visibility = hasSendToVoicemailContact ? View.VISIBLE : View.GONE;
- mImportSettings.setVisibility(visibility);
+ importSettings.setVisibility(visibility);
}
});
}
@@ -160,12 +160,12 @@ public class BlockedNumbersFragment extends ListFragment
// All views except migrate and the block list are hidden when new filtering is available
if (!FilteredNumberCompat.canUseNewFiltering()
&& FilteredNumbersUtil.hasRecentEmergencyCall(getContext())) {
- mBlockedNumbersDisabledForEmergency.setVisibility(View.VISIBLE);
+ blockedNumbersDisabledForEmergency.setVisibility(View.VISIBLE);
} else {
- mBlockedNumbersDisabledForEmergency.setVisibility(View.GONE);
+ blockedNumbersDisabledForEmergency.setVisibility(View.GONE);
}
- mVoicemailEnabledChecker.asyncUpdate();
+ voicemailEnabledChecker.asyncUpdate();
}
@Override
@@ -197,17 +197,17 @@ public class BlockedNumbersFragment extends ListFragment
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
- mAdapter.swapCursor(data);
+ adapter.swapCursor(data);
if (FilteredNumberCompat.canUseNewFiltering() || data.getCount() == 0) {
- mBlockedNumberListDivider.setVisibility(View.INVISIBLE);
+ blockedNumberListDivider.setVisibility(View.INVISIBLE);
} else {
- mBlockedNumberListDivider.setVisibility(View.VISIBLE);
+ blockedNumberListDivider.setVisibility(View.VISIBLE);
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
- mAdapter.swapCursor(null);
+ adapter.swapCursor(null);
}
@Override
@@ -228,7 +228,7 @@ public class BlockedNumbersFragment extends ListFragment
new ImportSendToVoicemailContactsListener() {
@Override
public void onImportComplete() {
- mImportSettings.setVisibility(View.GONE);
+ importSettings.setVisibility(View.GONE);
}
});
} else if (resId == R.id.migrate_promo_allow_button) {
@@ -259,7 +259,7 @@ public class BlockedNumbersFragment extends ListFragment
if (getActivity() == null || getActivity().isFinishing()) {
return;
}
- if (mVoicemailEnabledChecker.isVisualVoicemailEnabled()) {
+ if (voicemailEnabledChecker.isVisualVoicemailEnabled()) {
footerText.setText(R.string.block_number_footer_message_vvm);
} else {
footerText.setText(R.string.block_number_footer_message_no_vvm);
diff --git a/java/com/android/dialer/app/filterednumber/NumbersAdapter.java b/java/com/android/dialer/app/filterednumber/NumbersAdapter.java
index bdd6dcee8..3acb204e0 100644
--- a/java/com/android/dialer/app/filterednumber/NumbersAdapter.java
+++ b/java/com/android/dialer/app/filterednumber/NumbersAdapter.java
@@ -39,11 +39,11 @@ import com.android.dialer.util.UriUtils;
/** TODO(calderwoodra): documentation */
public class NumbersAdapter extends SimpleCursorAdapter {
- private final Context mContext;
- private final FragmentManager mFragmentManager;
- private final ContactInfoHelper mContactInfoHelper;
- private final BidiFormatter mBidiFormatter = BidiFormatter.getInstance();
- private final ContactPhotoManager mContactPhotoManager;
+ private final Context context;
+ private final FragmentManager fragmentManager;
+ private final ContactInfoHelper contactInfoHelper;
+ private final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
+ private final ContactPhotoManager contactPhotoManager;
public NumbersAdapter(
Context context,
@@ -51,10 +51,10 @@ public class NumbersAdapter extends SimpleCursorAdapter {
ContactInfoHelper contactInfoHelper,
ContactPhotoManager contactPhotoManager) {
super(context, R.layout.blocked_number_item, null, new String[] {}, new int[] {}, 0);
- mContext = context;
- mFragmentManager = fragmentManager;
- mContactInfoHelper = contactInfoHelper;
- mContactPhotoManager = contactPhotoManager;
+ this.context = context;
+ this.fragmentManager = fragmentManager;
+ this.contactInfoHelper = contactInfoHelper;
+ this.contactPhotoManager = contactPhotoManager;
}
public void updateView(View view, String number, String countryIso) {
@@ -67,7 +67,7 @@ public class NumbersAdapter extends SimpleCursorAdapter {
quickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
}
- ContactInfo info = mContactInfoHelper.lookupNumber(number, countryIso);
+ ContactInfo info = contactInfoHelper.lookupNumber(number, countryIso);
if (info == null) {
info = new ContactInfo();
info.number = number;
@@ -75,7 +75,7 @@ public class NumbersAdapter extends SimpleCursorAdapter {
final CharSequence locationOrType = getNumberTypeOrLocation(info, countryIso);
final String displayNumber = getDisplayNumber(info);
final String displayNumberStr =
- mBidiFormatter.unicodeWrap(displayNumber, TextDirectionHeuristics.LTR);
+ bidiFormatter.unicodeWrap(displayNumber, TextDirectionHeuristics.LTR);
String nameForDefaultImage;
if (!TextUtils.isEmpty(info.name)) {
@@ -99,15 +99,15 @@ public class NumbersAdapter extends SimpleCursorAdapter {
final String lookupKey =
info.lookupUri == null ? null : UriUtils.getLookupKeyFromUri(info.lookupUri);
final int contactType =
- mContactInfoHelper.isBusiness(info.sourceType)
+ contactInfoHelper.isBusiness(info.sourceType)
? LetterTileDrawable.TYPE_BUSINESS
: LetterTileDrawable.TYPE_DEFAULT;
final DefaultImageRequest request =
new DefaultImageRequest(displayName, lookupKey, contactType, true /* isCircular */);
badge.assignContactUri(info.lookupUri);
badge.setContentDescription(
- mContext.getResources().getString(R.string.description_contact_details, displayName));
- mContactPhotoManager.loadDirectoryPhoto(
+ context.getResources().getString(R.string.description_contact_details, displayName));
+ contactPhotoManager.loadDirectoryPhoto(
badge, info.photoUri, false /* darkTheme */, true /* isCircular */, request);
}
@@ -124,17 +124,17 @@ public class NumbersAdapter extends SimpleCursorAdapter {
private CharSequence getNumberTypeOrLocation(ContactInfo info, String countryIso) {
if (!TextUtils.isEmpty(info.name)) {
return ContactsContract.CommonDataKinds.Phone.getTypeLabel(
- mContext.getResources(), info.type, info.label);
+ context.getResources(), info.type, info.label);
} else {
- return PhoneNumberHelper.getGeoDescription(mContext, info.number, countryIso);
+ return PhoneNumberHelper.getGeoDescription(context, info.number, countryIso);
}
}
protected Context getContext() {
- return mContext;
+ return context;
}
protected FragmentManager getFragmentManager() {
- return mFragmentManager;
+ return fragmentManager;
}
}
diff --git a/java/com/android/dialer/app/filterednumber/ViewNumbersToImportFragment.java b/java/com/android/dialer/app/filterednumber/ViewNumbersToImportFragment.java
index 1de768219..be3ae79f9 100644
--- a/java/com/android/dialer/app/filterednumber/ViewNumbersToImportFragment.java
+++ b/java/com/android/dialer/app/filterednumber/ViewNumbersToImportFragment.java
@@ -36,7 +36,7 @@ import com.android.dialer.blocking.FilteredNumbersUtil.ImportSendToVoicemailCont
public class ViewNumbersToImportFragment extends ListFragment
implements LoaderManager.LoaderCallbacks<Cursor>, View.OnClickListener {
- private ViewNumbersToImportAdapter mAdapter;
+ private ViewNumbersToImportAdapter adapter;
@Override
public Context getContext() {
@@ -47,12 +47,12 @@ public class ViewNumbersToImportFragment extends ListFragment
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- if (mAdapter == null) {
- mAdapter =
+ if (adapter == null) {
+ adapter =
ViewNumbersToImportAdapter.newViewNumbersToImportAdapter(
getContext(), getActivity().getFragmentManager());
}
- setListAdapter(mAdapter);
+ setListAdapter(adapter);
}
@Override
@@ -103,12 +103,12 @@ public class ViewNumbersToImportFragment extends ListFragment
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
- mAdapter.swapCursor(data);
+ adapter.swapCursor(data);
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
- mAdapter.swapCursor(null);
+ adapter.swapCursor(null);
}
@Override
diff --git a/java/com/android/dialer/app/list/AllContactsFragment.java b/java/com/android/dialer/app/list/AllContactsFragment.java
index 32a99e795..5076fd9cf 100644
--- a/java/com/android/dialer/app/list/AllContactsFragment.java
+++ b/java/com/android/dialer/app/list/AllContactsFragment.java
@@ -56,13 +56,13 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi
private static final int READ_CONTACTS_PERMISSION_REQUEST_CODE = 1;
- private EmptyContentView mEmptyListView;
+ private EmptyContentView emptyListView;
/**
* Listen to broadcast events about permissions in order to be notified if the READ_CONTACTS
* permission is granted via the UI in another fragment.
*/
- private BroadcastReceiver mReadContactsPermissionGrantedReceiver =
+ private BroadcastReceiver readContactsPermissionGrantedReceiver =
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -83,25 +83,25 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi
public void onViewCreated(View view, android.os.Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- mEmptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view);
- mEmptyListView.setImage(R.drawable.empty_contacts);
- mEmptyListView.setDescription(R.string.all_contacts_empty);
- mEmptyListView.setActionClickedListener(this);
- getListView().setEmptyView(mEmptyListView);
- mEmptyListView.setVisibility(View.GONE);
+ emptyListView = (EmptyContentView) view.findViewById(R.id.empty_list_view);
+ emptyListView.setImage(R.drawable.empty_contacts);
+ emptyListView.setDescription(R.string.all_contacts_empty);
+ emptyListView.setActionClickedListener(this);
+ getListView().setEmptyView(emptyListView);
+ emptyListView.setVisibility(View.GONE);
}
@Override
public void onStart() {
super.onStart();
PermissionsUtil.registerPermissionReceiver(
- getActivity(), mReadContactsPermissionGrantedReceiver, READ_CONTACTS);
+ getActivity(), readContactsPermissionGrantedReceiver, READ_CONTACTS);
}
@Override
public void onStop() {
PermissionsUtil.unregisterPermissionReceiver(
- getActivity(), mReadContactsPermissionGrantedReceiver);
+ getActivity(), readContactsPermissionGrantedReceiver);
super.onStop();
}
@@ -109,12 +109,12 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi
protected void startLoading() {
if (PermissionsUtil.hasPermission(getActivity(), READ_CONTACTS)) {
super.startLoading();
- mEmptyListView.setDescription(R.string.all_contacts_empty);
- mEmptyListView.setActionLabel(R.string.all_contacts_empty_add_contact_action);
+ emptyListView.setDescription(R.string.all_contacts_empty);
+ emptyListView.setActionLabel(R.string.all_contacts_empty_add_contact_action);
} else {
- mEmptyListView.setDescription(R.string.permission_no_contacts);
- mEmptyListView.setActionLabel(R.string.permission_single_turn_on);
- mEmptyListView.setVisibility(View.VISIBLE);
+ emptyListView.setDescription(R.string.permission_no_contacts);
+ emptyListView.setActionLabel(R.string.permission_single_turn_on);
+ emptyListView.setVisibility(View.VISIBLE);
}
}
@@ -123,7 +123,7 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi
super.onLoadFinished(loader, data);
if (data == null || data.getCount() == 0) {
- mEmptyListView.setVisibility(View.VISIBLE);
+ emptyListView.setVisibility(View.VISIBLE);
}
}
diff --git a/java/com/android/dialer/app/list/BlockedListSearchAdapter.java b/java/com/android/dialer/app/list/BlockedListSearchAdapter.java
index 96d02d7bf..575d6e63f 100644
--- a/java/com/android/dialer/app/list/BlockedListSearchAdapter.java
+++ b/java/com/android/dialer/app/list/BlockedListSearchAdapter.java
@@ -27,26 +27,26 @@ import com.android.dialer.location.GeoUtil;
/** List adapter to display search results for adding a blocked number. */
public class BlockedListSearchAdapter extends RegularSearchListAdapter {
- private Resources mResources;
- private FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler;
+ private Resources resources;
+ private FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler;
public BlockedListSearchAdapter(Context context) {
super(context);
- mResources = context.getResources();
+ resources = context.getResources();
disableAllShortcuts();
setShortcutEnabled(SHORTCUT_BLOCK_NUMBER, true);
- mFilteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(context);
+ filteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(context);
}
@Override
protected boolean isChanged(boolean showNumberShortcuts) {
- return setShortcutEnabled(SHORTCUT_BLOCK_NUMBER, showNumberShortcuts || mIsQuerySipAddress);
+ return setShortcutEnabled(SHORTCUT_BLOCK_NUMBER, showNumberShortcuts || isQuerySipAddress);
}
public void setViewBlocked(ContactListItemView view, Integer id) {
view.setTag(R.id.block_id, id);
- final int textColor = mResources.getColor(R.color.blocked_number_block_color);
+ final int textColor = resources.getColor(R.color.blocked_number_block_color);
view.getDataView().setTextColor(textColor);
view.getLabelView().setTextColor(textColor);
//TODO: Add icon
@@ -54,7 +54,7 @@ public class BlockedListSearchAdapter extends RegularSearchListAdapter {
public void setViewUnblocked(ContactListItemView view) {
view.setTag(R.id.block_id, null);
- final int textColor = mResources.getColor(R.color.dialer_secondary_text_color);
+ final int textColor = resources.getColor(R.color.dialer_secondary_text_color);
view.getDataView().setTextColor(textColor);
view.getLabelView().setTextColor(textColor);
//TODO: Remove icon
@@ -79,6 +79,6 @@ public class BlockedListSearchAdapter extends RegularSearchListAdapter {
}
}
};
- mFilteredNumberAsyncQueryHandler.isBlockedNumber(onCheckListener, number, countryIso);
+ filteredNumberAsyncQueryHandler.isBlockedNumber(onCheckListener, number, countryIso);
}
}
diff --git a/java/com/android/dialer/app/list/BlockedListSearchFragment.java b/java/com/android/dialer/app/list/BlockedListSearchFragment.java
index bef5af713..de9dbaee6 100644
--- a/java/com/android/dialer/app/list/BlockedListSearchFragment.java
+++ b/java/com/android/dialer/app/list/BlockedListSearchFragment.java
@@ -44,7 +44,7 @@ import com.android.dialer.logging.Logger;
public class BlockedListSearchFragment extends RegularSearchFragment
implements BlockNumberDialogFragment.Callback {
- private final TextWatcher mPhoneSearchQueryTextListener =
+ private final TextWatcher phoneSearchQueryTextListener =
new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@@ -57,7 +57,7 @@ public class BlockedListSearchFragment extends RegularSearchFragment
@Override
public void afterTextChanged(Editable s) {}
};
- private final SearchEditTextLayout.Callback mSearchLayoutCallback =
+ private final SearchEditTextLayout.Callback searchLayoutCallback =
new SearchEditTextLayout.Callback() {
@Override
public void onBackButtonClicked() {
@@ -67,8 +67,8 @@ public class BlockedListSearchFragment extends RegularSearchFragment
@Override
public void onSearchViewClicked() {}
};
- private FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler;
- private EditText mSearchView;
+ private FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler;
+ private EditText searchView;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -83,7 +83,7 @@ public class BlockedListSearchFragment extends RegularSearchFragment
* query, which results in showing an empty view
*/
setQueryString(getQueryString() == null ? "" : getQueryString());
- mFilteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(getContext());
+ filteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(getContext());
}
@Override
@@ -99,23 +99,23 @@ public class BlockedListSearchFragment extends RegularSearchFragment
final SearchEditTextLayout searchEditTextLayout =
(SearchEditTextLayout) actionBar.getCustomView().findViewById(R.id.search_view_container);
searchEditTextLayout.expand(false, true);
- searchEditTextLayout.setCallback(mSearchLayoutCallback);
+ searchEditTextLayout.setCallback(searchLayoutCallback);
searchEditTextLayout.setBackgroundDrawable(null);
- mSearchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view);
- mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener);
- mSearchView.setHint(R.string.block_number_search_hint);
+ searchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view);
+ searchView.addTextChangedListener(phoneSearchQueryTextListener);
+ searchView.setHint(R.string.block_number_search_hint);
searchEditTextLayout
.findViewById(R.id.search_box_expanded)
.setBackgroundColor(getContext().getResources().getColor(android.R.color.white));
if (!TextUtils.isEmpty(getQueryString())) {
- mSearchView.setText(getQueryString());
+ searchView.setText(getQueryString());
}
// TODO: Don't set custom text size; use default search text size.
- mSearchView.setTextSize(
+ searchView.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.blocked_number_search_text_size));
}
@@ -195,7 +195,7 @@ public class BlockedListSearchFragment extends RegularSearchFragment
}
}
};
- mFilteredNumberAsyncQueryHandler.isBlockedNumber(onCheckListener, number, countryIso);
+ filteredNumberAsyncQueryHandler.isBlockedNumber(onCheckListener, number, countryIso);
}
@Override
diff --git a/java/com/android/dialer/app/list/ContentChangedFilter.java b/java/com/android/dialer/app/list/ContentChangedFilter.java
index 663846da5..8c532badb 100644
--- a/java/com/android/dialer/app/list/ContentChangedFilter.java
+++ b/java/com/android/dialer/app/list/ContentChangedFilter.java
@@ -29,12 +29,12 @@ import android.view.accessibility.AccessibilityEvent;
*/
public class ContentChangedFilter extends AccessibilityDelegate {
- //the view we don't want TYPE_WINDOW_CONTENT_CHANGED to fire.
- private View mView;
+ // the view we don't want TYPE_WINDOW_CONTENT_CHANGED to fire.
+ private View view;
private ContentChangedFilter(View view) {
super();
- mView = view;
+ this.view = view;
}
/** Add this delegate to the parent of @param view to filter out TYPE_WINDOW_CONTENT_CHANGED */
@@ -46,7 +46,7 @@ public class ContentChangedFilter extends AccessibilityDelegate {
@Override
public boolean onRequestSendAccessibilityEvent(
ViewGroup host, View child, AccessibilityEvent event) {
- if (child == mView) {
+ if (child == view) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) {
return false;
}
diff --git a/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java b/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java
index fc0bd3ccf..3711e6e75 100644
--- a/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java
+++ b/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java
@@ -49,16 +49,16 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter {
public static final int SHORTCUT_BLOCK_NUMBER = 5;
public static final int SHORTCUT_COUNT = 6;
- private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT];
- private final BidiFormatter mBidiFormatter = BidiFormatter.getInstance();
- private final String mCountryIso;
+ private final boolean[] shortcutEnabled = new boolean[SHORTCUT_COUNT];
+ private final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
+ private final String countryIso;
- private String mFormattedQueryString;
+ private String formattedQueryString;
public DialerPhoneNumberListAdapter(Context context) {
super(context);
- mCountryIso = GeoUtil.getCurrentCountryIso(context);
+ countryIso = GeoUtil.getCurrentCountryIso(context);
}
@Override
@@ -69,8 +69,8 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter {
/** @return The number of enabled shortcuts. Ranges from 0 to a maximum of SHORTCUT_COUNT */
public int getShortcutCount() {
int count = 0;
- for (int i = 0; i < mShortcutEnabled.length; i++) {
- if (mShortcutEnabled[i]) {
+ for (int i = 0; i < shortcutEnabled.length; i++) {
+ if (shortcutEnabled[i]) {
count++;
}
}
@@ -78,8 +78,8 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter {
}
public void disableAllShortcuts() {
- for (int i = 0; i < mShortcutEnabled.length; i++) {
- mShortcutEnabled[i] = false;
+ for (int i = 0; i < shortcutEnabled.length; i++) {
+ shortcutEnabled[i] = false;
}
}
@@ -137,8 +137,8 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter {
if (shortcutCount >= 0) {
// Iterate through the array of shortcuts, looking only for shortcuts where
// mShortcutEnabled[i] is true
- for (int i = 0; shortcutCount >= 0 && i < mShortcutEnabled.length; i++) {
- if (mShortcutEnabled[i]) {
+ for (int i = 0; shortcutCount >= 0 && i < shortcutEnabled.length; i++) {
+ if (shortcutEnabled[i]) {
shortcutCount--;
if (shortcutCount < 0) {
return i;
@@ -177,7 +177,7 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter {
ContactDisplayUtils.getTtsSpannedPhoneNumber(
resources,
R.string.search_shortcut_call_number,
- mBidiFormatter.unicodeWrap(number, TextDirectionHeuristics.LTR));
+ bidiFormatter.unicodeWrap(number, TextDirectionHeuristics.LTR));
drawable = ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_call_vd_theme_24);
break;
case SHORTCUT_CREATE_NEW_CONTACT:
@@ -216,19 +216,19 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter {
/** @return True if the shortcut state (disabled vs enabled) was changed by this operation */
public boolean setShortcutEnabled(int shortcutType, boolean visible) {
- final boolean changed = mShortcutEnabled[shortcutType] != visible;
- mShortcutEnabled[shortcutType] = visible;
+ final boolean changed = shortcutEnabled[shortcutType] != visible;
+ shortcutEnabled[shortcutType] = visible;
return changed;
}
public String getFormattedQueryString() {
- return mFormattedQueryString;
+ return formattedQueryString;
}
@Override
public void setQueryString(String queryString) {
- mFormattedQueryString =
- PhoneNumberUtils.formatNumber(PhoneNumberUtils.normalizeNumber(queryString), mCountryIso);
+ formattedQueryString =
+ PhoneNumberUtils.formatNumber(PhoneNumberUtils.normalizeNumber(queryString), countryIso);
super.setQueryString(queryString);
}
}
diff --git a/java/com/android/dialer/app/list/DragDropController.java b/java/com/android/dialer/app/list/DragDropController.java
index c22dd1318..458e31e69 100644
--- a/java/com/android/dialer/app/list/DragDropController.java
+++ b/java/com/android/dialer/app/list/DragDropController.java
@@ -28,12 +28,12 @@ import java.util.List;
*/
public class DragDropController {
- private final List<OnDragDropListener> mOnDragDropListeners = new ArrayList<OnDragDropListener>();
- private final DragItemContainer mDragItemContainer;
- private final int[] mLocationOnScreen = new int[2];
+ private final List<OnDragDropListener> onDragDropListeners = new ArrayList<OnDragDropListener>();
+ private final DragItemContainer dragItemContainer;
+ private final int[] locationOnScreen = new int[2];
public DragDropController(DragItemContainer dragItemContainer) {
- mDragItemContainer = dragItemContainer;
+ this.dragItemContainer = dragItemContainer;
}
/** @return True if the drag is started, false if the drag is cancelled for some reason. */
@@ -43,54 +43,53 @@ public class DragDropController {
// The coordinates in dragEvent of DragEvent.ACTION_DRAG_STARTED before NYC is window-related.
// This is fixed in NYC.
if (VERSION.SDK_INT >= VERSION_CODES.N) {
- v.getLocationOnScreen(mLocationOnScreen);
- screenX = x + mLocationOnScreen[0];
- screenY = y + mLocationOnScreen[1];
+ v.getLocationOnScreen(locationOnScreen);
+ screenX = x + locationOnScreen[0];
+ screenY = y + locationOnScreen[1];
}
final PhoneFavoriteSquareTileView tileView =
- mDragItemContainer.getViewForLocation(screenX, screenY);
+ dragItemContainer.getViewForLocation(screenX, screenY);
if (tileView == null) {
return false;
}
- for (int i = 0; i < mOnDragDropListeners.size(); i++) {
- mOnDragDropListeners.get(i).onDragStarted(screenX, screenY, tileView);
+ for (int i = 0; i < onDragDropListeners.size(); i++) {
+ onDragDropListeners.get(i).onDragStarted(screenX, screenY, tileView);
}
return true;
}
public void handleDragHovered(View v, int x, int y) {
- v.getLocationOnScreen(mLocationOnScreen);
- final int screenX = x + mLocationOnScreen[0];
- final int screenY = y + mLocationOnScreen[1];
- final PhoneFavoriteSquareTileView view =
- mDragItemContainer.getViewForLocation(screenX, screenY);
- for (int i = 0; i < mOnDragDropListeners.size(); i++) {
- mOnDragDropListeners.get(i).onDragHovered(screenX, screenY, view);
+ v.getLocationOnScreen(locationOnScreen);
+ final int screenX = x + locationOnScreen[0];
+ final int screenY = y + locationOnScreen[1];
+ final PhoneFavoriteSquareTileView view = dragItemContainer.getViewForLocation(screenX, screenY);
+ for (int i = 0; i < onDragDropListeners.size(); i++) {
+ onDragDropListeners.get(i).onDragHovered(screenX, screenY, view);
}
}
public void handleDragFinished(int x, int y, boolean isRemoveView) {
if (isRemoveView) {
- for (int i = 0; i < mOnDragDropListeners.size(); i++) {
- mOnDragDropListeners.get(i).onDroppedOnRemove();
+ for (int i = 0; i < onDragDropListeners.size(); i++) {
+ onDragDropListeners.get(i).onDroppedOnRemove();
}
}
- for (int i = 0; i < mOnDragDropListeners.size(); i++) {
- mOnDragDropListeners.get(i).onDragFinished(x, y);
+ for (int i = 0; i < onDragDropListeners.size(); i++) {
+ onDragDropListeners.get(i).onDragFinished(x, y);
}
}
public void addOnDragDropListener(OnDragDropListener listener) {
- if (!mOnDragDropListeners.contains(listener)) {
- mOnDragDropListeners.add(listener);
+ if (!onDragDropListeners.contains(listener)) {
+ onDragDropListeners.add(listener);
}
}
public void removeOnDragDropListener(OnDragDropListener listener) {
- if (mOnDragDropListeners.contains(listener)) {
- mOnDragDropListeners.remove(listener);
+ if (onDragDropListeners.contains(listener)) {
+ onDragDropListeners.remove(listener);
}
}
diff --git a/java/com/android/dialer/app/list/ListsFragment.java b/java/com/android/dialer/app/list/ListsFragment.java
index 05c647aec..7c24cc0f0 100644
--- a/java/com/android/dialer/app/list/ListsFragment.java
+++ b/java/com/android/dialer/app/list/ListsFragment.java
@@ -63,21 +63,21 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
private static final String TAG = "ListsFragment";
- private DialerViewPager mViewPager;
- private ViewPagerTabs mViewPagerTabs;
- private DialtactsPagerAdapter mAdapter;
- private RemoveView mRemoveView;
- private View mRemoveViewContent;
- private Fragment mCurrentPage;
- private SharedPreferences mPrefs;
- private boolean mHasFetchedVoicemailStatus;
- private boolean mShowVoicemailTabAfterVoicemailStatusIsFetched;
- private final ArrayList<OnPageChangeListener> mOnPageChangeListeners = new ArrayList<>();
+ private DialerViewPager viewPager;
+ private ViewPagerTabs viewPagerTabs;
+ private DialtactsPagerAdapter adapter;
+ private RemoveView removeView;
+ private View removeViewContent;
+ private Fragment currentPage;
+ private SharedPreferences prefs;
+ private boolean hasFetchedVoicemailStatus;
+ private boolean showVoicemailTabAfterVoicemailStatusIsFetched;
+ private final ArrayList<OnPageChangeListener> onPageChangeListeners = new ArrayList<>();
/** The position of the currently selected tab. */
- private int mTabIndex = DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL;
+ private int tabIndex = DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL;
- private boolean mPaused;
- private CallLogQueryHandler mCallLogQueryHandler;
+ private boolean paused;
+ private CallLogQueryHandler callLogQueryHandler;
private UiAction.Type[] actionTypeList;
private final DialerImpression.Type[] swipeImpressionList =
@@ -88,12 +88,12 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
// Only for detecting page selected by swiping or clicking.
private boolean onPageScrolledBeforeScrollStateSettling;
- private final ContentObserver mVoicemailStatusObserver =
+ private final ContentObserver voicemailStatusObserver =
new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
- mCallLogQueryHandler.fetchVoicemailStatus();
+ callLogQueryHandler.fetchVoicemailStatus();
}
};
@@ -102,7 +102,7 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
LogUtil.d("ListsFragment.onCreate", null);
Trace.beginSection(TAG + " onCreate");
super.onCreate(savedInstanceState);
- mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
+ prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
Trace.endSection();
}
@@ -112,19 +112,19 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
Trace.beginSection(TAG + " onResume");
super.onResume();
- mPaused = false;
+ paused = false;
if (getUserVisibleHint()) {
sendScreenViewForCurrentPosition();
}
// Fetch voicemail status to determine if we should show the voicemail tab.
- mCallLogQueryHandler =
+ callLogQueryHandler =
new CallLogQueryHandler(getActivity(), getActivity().getContentResolver(), this);
- mCallLogQueryHandler.fetchVoicemailStatus();
- mCallLogQueryHandler.fetchMissedCallsUnreadCount();
+ callLogQueryHandler.fetchVoicemailStatus();
+ callLogQueryHandler.fetchMissedCallsUnreadCount();
Trace.endSection();
- mCurrentPage = mAdapter.getItem(mViewPager.getCurrentItem());
+ currentPage = adapter.getItem(viewPager.getCurrentItem());
}
@Override
@@ -132,13 +132,13 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
LogUtil.enterBlock("ListsFragment.onPause");
super.onPause();
- mPaused = true;
+ paused = true;
}
@Override
public void onDestroyView() {
super.onDestroyView();
- mViewPager.removeOnPageChangeListener(this);
+ viewPager.removeOnPageChangeListener(this);
}
@Override
@@ -194,36 +194,36 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
tabIcons[DialtactsPagerAdapter.TAB_INDEX_ALL_CONTACTS] = R.drawable.quantum_ic_people_white_24;
tabIcons[DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL] = R.drawable.quantum_ic_voicemail_white_24;
- mViewPager = (DialerViewPager) parentView.findViewById(R.id.lists_pager);
- mAdapter =
+ viewPager = (DialerViewPager) parentView.findViewById(R.id.lists_pager);
+ adapter =
new DialtactsPagerAdapter(
getContext(),
getChildFragmentManager(),
tabTitles,
- mPrefs.getBoolean(
+ prefs.getBoolean(
VisualVoicemailEnabledChecker.PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false));
- mViewPager.setAdapter(mAdapter);
+ viewPager.setAdapter(adapter);
// This is deliberate. See cl/172018946 for the app startup implications of using 1 here
// versus loading more fragments upfront.
- mViewPager.setOffscreenPageLimit(1);
+ viewPager.setOffscreenPageLimit(1);
- mViewPager.addOnPageChangeListener(this);
+ viewPager.addOnPageChangeListener(this);
showTab(DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL);
- mViewPagerTabs = (ViewPagerTabs) parentView.findViewById(R.id.lists_pager_header);
- mViewPagerTabs.configureTabIcons(tabIcons);
- mViewPagerTabs.setViewPager(mViewPager);
- addOnPageChangeListener(mViewPagerTabs);
- mRemoveView = (RemoveView) parentView.findViewById(R.id.remove_view);
- mRemoveViewContent = parentView.findViewById(R.id.remove_view_content);
+ viewPagerTabs = (ViewPagerTabs) parentView.findViewById(R.id.lists_pager_header);
+ viewPagerTabs.configureTabIcons(tabIcons);
+ viewPagerTabs.setViewPager(viewPager);
+ addOnPageChangeListener(viewPagerTabs);
+ removeView = (RemoveView) parentView.findViewById(R.id.remove_view);
+ removeViewContent = parentView.findViewById(R.id.remove_view_content);
if (PermissionsUtil.hasReadVoicemailPermissions(getContext())
&& PermissionsUtil.hasAddVoicemailPermissions(getContext())) {
getActivity()
.getContentResolver()
.registerContentObserver(
- VoicemailContract.Status.CONTENT_URI, true, mVoicemailStatusObserver);
+ VoicemailContract.Status.CONTENT_URI, true, voicemailStatusObserver);
} else {
LogUtil.w("ListsFragment.onCreateView", "no voicemail read permissions");
}
@@ -235,13 +235,13 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
@Override
public void onDestroy() {
- getActivity().getContentResolver().unregisterContentObserver(mVoicemailStatusObserver);
+ getActivity().getContentResolver().unregisterContentObserver(voicemailStatusObserver);
super.onDestroy();
}
public void addOnPageChangeListener(OnPageChangeListener onPageChangeListener) {
- if (!mOnPageChangeListeners.contains(onPageChangeListener)) {
- mOnPageChangeListeners.add(onPageChangeListener);
+ if (!onPageChangeListeners.contains(onPageChangeListener)) {
+ onPageChangeListeners.add(onPageChangeListener);
}
}
@@ -252,15 +252,14 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
*/
public void showTab(int index) {
if (index == DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL) {
- if (mAdapter.hasActiveVoicemailProvider()) {
- mViewPager.setCurrentItem(
- mAdapter.getRtlPosition(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL));
- } else if (!mHasFetchedVoicemailStatus) {
+ if (adapter.hasActiveVoicemailProvider()) {
+ viewPager.setCurrentItem(adapter.getRtlPosition(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL));
+ } else if (!hasFetchedVoicemailStatus) {
// Try to show the voicemail tab after the voicemail status returns.
- mShowVoicemailTabAfterVoicemailStatusIsFetched = true;
+ showVoicemailTabAfterVoicemailStatusIsFetched = true;
}
} else if (index < getTabCount()) {
- mViewPager.setCurrentItem(mAdapter.getRtlPosition(index));
+ viewPager.setCurrentItem(adapter.getRtlPosition(index));
}
}
@@ -271,11 +270,11 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
if (positionOffsetPixels != 0) {
onPageScrolledBeforeScrollStateSettling = true;
}
- mTabIndex = mAdapter.getRtlPosition(position);
+ tabIndex = adapter.getRtlPosition(position);
- final int count = mOnPageChangeListeners.size();
+ final int count = onPageChangeListeners.size();
for (int i = 0; i < count; i++) {
- mOnPageChangeListeners.get(i).onPageScrolled(position, positionOffset, positionOffsetPixels);
+ onPageChangeListeners.get(i).onPageScrolled(position, positionOffset, positionOffsetPixels);
}
}
@@ -294,23 +293,23 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
PerformanceReport.recordClick(actionTypeList[position]);
LogUtil.i("ListsFragment.onPageSelected", "position: %d", position);
- mTabIndex = mAdapter.getRtlPosition(position);
+ tabIndex = adapter.getRtlPosition(position);
// Show the tab which has been selected instead.
- mShowVoicemailTabAfterVoicemailStatusIsFetched = false;
+ showVoicemailTabAfterVoicemailStatusIsFetched = false;
- final int count = mOnPageChangeListeners.size();
+ final int count = onPageChangeListeners.size();
for (int i = 0; i < count; i++) {
- mOnPageChangeListeners.get(i).onPageSelected(position);
+ onPageChangeListeners.get(i).onPageSelected(position);
}
sendScreenViewForCurrentPosition();
- if (mCurrentPage instanceof CallLogFragment) {
- ((CallLogFragment) mCurrentPage).onNotVisible();
+ if (currentPage instanceof CallLogFragment) {
+ ((CallLogFragment) currentPage).onNotVisible();
}
- mCurrentPage = mAdapter.getItem(position);
- if (mCurrentPage instanceof CallLogFragment) {
- ((CallLogFragment) mCurrentPage).onVisible();
+ currentPage = adapter.getItem(position);
+ if (currentPage instanceof CallLogFragment) {
+ ((CallLogFragment) currentPage).onVisible();
}
}
@@ -320,17 +319,17 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
onPageScrolledBeforeScrollStateSettling = false;
}
- final int count = mOnPageChangeListeners.size();
+ final int count = onPageChangeListeners.size();
for (int i = 0; i < count; i++) {
- mOnPageChangeListeners.get(i).onPageScrollStateChanged(state);
+ onPageChangeListeners.get(i).onPageScrollStateChanged(state);
}
}
@Override
public void onVoicemailStatusFetched(Cursor statusCursor) {
- mHasFetchedVoicemailStatus = true;
+ hasFetchedVoicemailStatus = true;
- if (getActivity() == null || mPaused) {
+ if (getActivity() == null || paused) {
return;
}
@@ -340,19 +339,19 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
// Update hasActiveVoicemailProvider, which controls the number of tabs displayed.
boolean hasActiveVoicemailProvider =
VoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
- if (hasActiveVoicemailProvider != mAdapter.hasActiveVoicemailProvider()) {
- mAdapter.setHasActiveVoicemailProvider(hasActiveVoicemailProvider);
- mAdapter.notifyDataSetChanged();
+ if (hasActiveVoicemailProvider != adapter.hasActiveVoicemailProvider()) {
+ adapter.setHasActiveVoicemailProvider(hasActiveVoicemailProvider);
+ adapter.notifyDataSetChanged();
if (hasActiveVoicemailProvider) {
Logger.get(getContext()).logImpression(DialerImpression.Type.VVM_TAB_VISIBLE);
- mViewPagerTabs.updateTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
+ viewPagerTabs.updateTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
} else {
- mViewPagerTabs.removeTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
- mAdapter.removeVoicemailFragment(getChildFragmentManager());
+ viewPagerTabs.removeTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
+ adapter.removeVoicemailFragment(getChildFragmentManager());
}
- mPrefs
+ prefs
.edit()
.putBoolean(
VisualVoicemailEnabledChecker.PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER,
@@ -361,11 +360,11 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
}
if (hasActiveVoicemailProvider) {
- mCallLogQueryHandler.fetchVoicemailUnreadCount();
+ callLogQueryHandler.fetchVoicemailUnreadCount();
}
- if (mAdapter.hasActiveVoicemailProvider() && mShowVoicemailTabAfterVoicemailStatusIsFetched) {
- mShowVoicemailTabAfterVoicemailStatusIsFetched = false;
+ if (adapter.hasActiveVoicemailProvider() && showVoicemailTabAfterVoicemailStatusIsFetched) {
+ showVoicemailTabAfterVoicemailStatusIsFetched = false;
showTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
}
}
@@ -383,8 +382,8 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
cursor.close();
}
- mViewPagerTabs.setUnreadCount(count, DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
- mViewPagerTabs.updateTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
+ viewPagerTabs.setUnreadCount(count, DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
+ viewPagerTabs.updateTab(DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
}
@Override
@@ -400,8 +399,8 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
cursor.close();
}
- mViewPagerTabs.setUnreadCount(count, DialtactsPagerAdapter.TAB_INDEX_HISTORY);
- mViewPagerTabs.updateTab(DialtactsPagerAdapter.TAB_INDEX_HISTORY);
+ viewPagerTabs.setUnreadCount(count, DialtactsPagerAdapter.TAB_INDEX_HISTORY);
+ viewPagerTabs.updateTab(DialtactsPagerAdapter.TAB_INDEX_HISTORY);
}
@Override
@@ -411,13 +410,13 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
}
public int getCurrentTabIndex() {
- return mTabIndex;
+ return tabIndex;
}
public boolean shouldShowFab() {
// If the VVM TOS is visible, don't show the fab
- if (mCurrentPage instanceof VisualVoicemailCallLogFragment
- && ((VisualVoicemailCallLogFragment) mCurrentPage).isModalAlertVisible()) {
+ if (currentPage instanceof VisualVoicemailCallLogFragment
+ && ((VisualVoicemailCallLogFragment) currentPage).isModalAlertVisible()) {
return false;
}
@@ -429,47 +428,47 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis
* voicemail in the call log or when the user expands an unread call in the call history tab.
*/
public void updateTabUnreadCounts() {
- if (mCallLogQueryHandler != null) {
- mCallLogQueryHandler.fetchMissedCallsUnreadCount();
- if (mAdapter.hasActiveVoicemailProvider()) {
- mCallLogQueryHandler.fetchVoicemailUnreadCount();
+ if (callLogQueryHandler != null) {
+ callLogQueryHandler.fetchMissedCallsUnreadCount();
+ if (adapter.hasActiveVoicemailProvider()) {
+ callLogQueryHandler.fetchVoicemailUnreadCount();
}
}
}
/** External method to mark all missed calls as read. */
public void markMissedCallsAsReadAndRemoveNotifications() {
- if (mCallLogQueryHandler != null) {
- mCallLogQueryHandler.markMissedCallsAsRead();
+ if (callLogQueryHandler != null) {
+ callLogQueryHandler.markMissedCallsAsRead();
CallLogNotificationsService.cancelAllMissedCalls(getContext());
}
}
public void showRemoveView(boolean show) {
- mRemoveViewContent.setVisibility(show ? View.VISIBLE : View.GONE);
- mRemoveView.setAlpha(show ? 0 : 1);
- mRemoveView.animate().alpha(show ? 1 : 0).start();
+ removeViewContent.setVisibility(show ? View.VISIBLE : View.GONE);
+ removeView.setAlpha(show ? 0 : 1);
+ removeView.animate().alpha(show ? 1 : 0).start();
}
public void showMultiSelectRemoveView(boolean show) {
- mViewPagerTabs.setVisibility(show ? View.GONE : View.VISIBLE);
- mViewPager.setEnableSwipingPages(!show);
+ viewPagerTabs.setVisibility(show ? View.GONE : View.VISIBLE);
+ viewPager.setEnableSwipingPages(!show);
}
public boolean hasFrequents() {
Fragment page =
- mAdapter.getItem(mAdapter.getRtlPosition(DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL));
+ adapter.getItem(adapter.getRtlPosition(DialtactsPagerAdapter.TAB_INDEX_SPEED_DIAL));
return page instanceof OldSpeedDialFragment
? ((OldSpeedDialFragment) page).hasFrequents()
: ((SpeedDialFragment) page).hasFrequents();
}
public RemoveView getRemoveView() {
- return mRemoveView;
+ return removeView;
}
public int getTabCount() {
- return mAdapter.getCount();
+ return adapter.getCount();
}
public void sendScreenViewForCurrentPosition() {
diff --git a/java/com/android/dialer/app/list/OldSpeedDialFragment.java b/java/com/android/dialer/app/list/OldSpeedDialFragment.java
index afc7c133b..1b366c1ee 100644
--- a/java/com/android/dialer/app/list/OldSpeedDialFragment.java
+++ b/java/com/android/dialer/app/list/OldSpeedDialFragment.java
@@ -81,22 +81,22 @@ public class OldSpeedDialFragment extends Fragment
/** Used with LoaderManager. */
private static final int LOADER_ID_CONTACT_TILE = 1;
- private final LongSparseArray<Integer> mItemIdTopMap = new LongSparseArray<>();
- private final LongSparseArray<Integer> mItemIdLeftMap = new LongSparseArray<>();
- private final ContactTileView.Listener mContactTileAdapterListener =
+ private final LongSparseArray<Integer> itemIdTopMap = new LongSparseArray<>();
+ private final LongSparseArray<Integer> itemIdLeftMap = new LongSparseArray<>();
+ private final ContactTileView.Listener contactTileAdapterListener =
new ContactTileAdapterListener();
- private final LoaderManager.LoaderCallbacks<Cursor> mContactTileLoaderListener =
+ private final LoaderManager.LoaderCallbacks<Cursor> contactTileLoaderListener =
new ContactTileLoaderListener();
- private final ScrollListener mScrollListener = new ScrollListener();
- private int mAnimationDuration;
- private OnPhoneNumberPickerActionListener mPhoneNumberPickerActionListener;
- private OnListFragmentScrolledListener mActivityScrollListener;
- private PhoneFavoritesTileAdapter mContactTileAdapter;
- private View mParentView;
- private PhoneFavoriteListView mListView;
- private View mContactTileFrame;
+ private final ScrollListener scrollListener = new ScrollListener();
+ private int animationDuration;
+ private OnPhoneNumberPickerActionListener phoneNumberPickerActionListener;
+ private OnListFragmentScrolledListener activityScrollListener;
+ private PhoneFavoritesTileAdapter contactTileAdapter;
+ private View parentView;
+ private PhoneFavoriteListView listView;
+ private View contactTileFrame;
/** Layout used when there are no favorites. */
- private EmptyContentView mEmptyView;
+ private EmptyContentView emptyView;
@Override
public void onCreate(Bundle savedState) {
@@ -109,10 +109,10 @@ public class OldSpeedDialFragment extends Fragment
// Construct two base adapters which will become part of PhoneFavoriteMergedAdapter.
// We don't construct the resultant adapter at this moment since it requires LayoutInflater
// that will be available on onCreateView().
- mContactTileAdapter =
- new PhoneFavoritesTileAdapter(getActivity(), mContactTileAdapterListener, this);
- mContactTileAdapter.setPhotoLoader(ContactPhotoManager.getInstance(getActivity()));
- mAnimationDuration = getResources().getInteger(R.integer.fade_duration);
+ contactTileAdapter =
+ new PhoneFavoritesTileAdapter(getActivity(), contactTileAdapterListener, this);
+ contactTileAdapter.setPhotoLoader(ContactPhotoManager.getInstance(getActivity()));
+ animationDuration = getResources().getInteger(R.integer.fade_duration);
Trace.endSection();
}
@@ -120,22 +120,22 @@ public class OldSpeedDialFragment extends Fragment
public void onResume() {
Trace.beginSection(TAG + " onResume");
super.onResume();
- if (mContactTileAdapter != null) {
- mContactTileAdapter.refreshContactsPreferences();
+ if (contactTileAdapter != null) {
+ contactTileAdapter.refreshContactsPreferences();
}
if (PermissionsUtil.hasContactsReadPermissions(getActivity())) {
if (getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE) == null) {
- getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, mContactTileLoaderListener);
+ getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, contactTileLoaderListener);
} else {
getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE).forceLoad();
}
- mEmptyView.setDescription(R.string.speed_dial_empty);
- mEmptyView.setActionLabel(R.string.speed_dial_empty_add_favorite_action);
+ emptyView.setDescription(R.string.speed_dial_empty);
+ emptyView.setActionLabel(R.string.speed_dial_empty_add_favorite_action);
} else {
- mEmptyView.setDescription(R.string.permission_no_speeddial);
- mEmptyView.setActionLabel(R.string.permission_single_turn_on);
+ emptyView.setDescription(R.string.permission_no_speeddial);
+ emptyView.setActionLabel(R.string.permission_single_turn_on);
}
Trace.endSection();
}
@@ -144,62 +144,62 @@ public class OldSpeedDialFragment extends Fragment
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Trace.beginSection(TAG + " onCreateView");
- mParentView = inflater.inflate(R.layout.speed_dial_fragment, container, false);
+ parentView = inflater.inflate(R.layout.speed_dial_fragment, container, false);
- mListView = (PhoneFavoriteListView) mParentView.findViewById(R.id.contact_tile_list);
- mListView.setOnItemClickListener(this);
- mListView.setVerticalScrollBarEnabled(false);
- mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
- mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
- mListView.getDragDropController().addOnDragDropListener(mContactTileAdapter);
+ listView = (PhoneFavoriteListView) parentView.findViewById(R.id.contact_tile_list);
+ listView.setOnItemClickListener(this);
+ listView.setVerticalScrollBarEnabled(false);
+ listView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
+ listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
+ listView.getDragDropController().addOnDragDropListener(contactTileAdapter);
final ImageView dragShadowOverlay =
(ImageView) getActivity().findViewById(R.id.contact_tile_drag_shadow_overlay);
- mListView.setDragShadowOverlay(dragShadowOverlay);
+ listView.setDragShadowOverlay(dragShadowOverlay);
- mEmptyView = (EmptyContentView) mParentView.findViewById(R.id.empty_list_view);
- mEmptyView.setImage(R.drawable.empty_speed_dial);
- mEmptyView.setActionClickedListener(this);
+ emptyView = (EmptyContentView) parentView.findViewById(R.id.empty_list_view);
+ emptyView.setImage(R.drawable.empty_speed_dial);
+ emptyView.setActionClickedListener(this);
- mContactTileFrame = mParentView.findViewById(R.id.contact_tile_frame);
+ contactTileFrame = parentView.findViewById(R.id.contact_tile_frame);
final LayoutAnimationController controller =
new LayoutAnimationController(
AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
controller.setDelay(0);
- mListView.setLayoutAnimation(controller);
- mListView.setAdapter(mContactTileAdapter);
+ listView.setLayoutAnimation(controller);
+ listView.setAdapter(contactTileAdapter);
- mListView.setOnScrollListener(mScrollListener);
- mListView.setFastScrollEnabled(false);
- mListView.setFastScrollAlwaysVisible(false);
+ listView.setOnScrollListener(scrollListener);
+ listView.setFastScrollEnabled(false);
+ listView.setFastScrollAlwaysVisible(false);
- //prevent content changes of the list from firing accessibility events.
- mListView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
- ContentChangedFilter.addToParent(mListView);
+ // prevent content changes of the list from firing accessibility events.
+ listView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
+ ContentChangedFilter.addToParent(listView);
Trace.endSection();
- return mParentView;
+ return parentView;
}
public boolean hasFrequents() {
- if (mContactTileAdapter == null) {
+ if (contactTileAdapter == null) {
return false;
}
- return mContactTileAdapter.getNumFrequents() > 0;
+ return contactTileAdapter.getNumFrequents() > 0;
}
/* package */ void setEmptyViewVisibility(final boolean visible) {
- final int previousVisibility = mEmptyView.getVisibility();
+ final int previousVisibility = emptyView.getVisibility();
final int emptyViewVisibility = visible ? View.VISIBLE : View.GONE;
final int listViewVisibility = visible ? View.GONE : View.VISIBLE;
if (previousVisibility != emptyViewVisibility) {
- final FrameLayout.LayoutParams params = (LayoutParams) mContactTileFrame.getLayoutParams();
+ final FrameLayout.LayoutParams params = (LayoutParams) contactTileFrame.getLayoutParams();
params.height = visible ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT;
- mContactTileFrame.setLayoutParams(params);
- mEmptyView.setVisibility(emptyViewVisibility);
- mListView.setVisibility(listViewVisibility);
+ contactTileFrame.setLayoutParams(params);
+ emptyView.setVisibility(emptyViewVisibility);
+ listView.setVisibility(listViewVisibility);
}
}
@@ -210,7 +210,7 @@ public class OldSpeedDialFragment extends Fragment
final Activity activity = getActivity();
try {
- mActivityScrollListener = (OnListFragmentScrolledListener) activity;
+ activityScrollListener = (OnListFragmentScrolledListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(
activity.toString() + " must implement OnListFragmentScrolledListener");
@@ -218,15 +218,15 @@ public class OldSpeedDialFragment extends Fragment
try {
OnDragDropListener listener = (OnDragDropListener) activity;
- mListView.getDragDropController().addOnDragDropListener(listener);
- ((HostInterface) activity).setDragDropController(mListView.getDragDropController());
+ listView.getDragDropController().addOnDragDropListener(listener);
+ ((HostInterface) activity).setDragDropController(listView.getDragDropController());
} catch (ClassCastException e) {
throw new ClassCastException(
activity.toString() + " must implement OnDragDropListener and HostInterface");
}
try {
- mPhoneNumberPickerActionListener = (OnPhoneNumberPickerActionListener) activity;
+ phoneNumberPickerActionListener = (OnPhoneNumberPickerActionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(
activity.toString() + " must implement PhoneFavoritesFragment.listener");
@@ -236,7 +236,7 @@ public class OldSpeedDialFragment extends Fragment
// This method call implicitly assures ContactTileLoaderListener's onLoadFinished() will
// be called, on which we'll check if "all" contacts should be reloaded again or not.
if (PermissionsUtil.hasContactsReadPermissions(activity)) {
- getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, mContactTileLoaderListener);
+ getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, contactTileLoaderListener);
} else {
setEmptyViewVisibility(true);
}
@@ -245,12 +245,12 @@ public class OldSpeedDialFragment extends Fragment
/**
* {@inheritDoc}
*
- * <p>This is only effective for elements provided by {@link #mContactTileAdapter}. {@link
- * #mContactTileAdapter} has its own logic for click events.
+ * <p>This is only effective for elements provided by {@link #contactTileAdapter}. {@link
+ * #contactTileAdapter} has its own logic for click events.
*/
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- final int contactTileAdapterCount = mContactTileAdapter.getCount();
+ final int contactTileAdapterCount = contactTileAdapter.getCount();
if (position <= contactTileAdapterCount) {
LogUtil.e(
"OldSpeedDialFragment.onItemClick",
@@ -267,36 +267,36 @@ public class OldSpeedDialFragment extends Fragment
* are sliding into their new positions.
*/
private void saveOffsets(int removedItemHeight) {
- final int firstVisiblePosition = mListView.getFirstVisiblePosition();
+ final int firstVisiblePosition = listView.getFirstVisiblePosition();
if (DEBUG) {
- LogUtil.d("OldSpeedDialFragment.saveOffsets", "Child count : " + mListView.getChildCount());
+ LogUtil.d("OldSpeedDialFragment.saveOffsets", "Child count : " + listView.getChildCount());
}
- for (int i = 0; i < mListView.getChildCount(); i++) {
- final View child = mListView.getChildAt(i);
+ for (int i = 0; i < listView.getChildCount(); i++) {
+ final View child = listView.getChildAt(i);
final int position = firstVisiblePosition + i;
// Since we are getting the position from mListView and then querying
// mContactTileAdapter, its very possible that things are out of sync
// and we might index out of bounds. Let's make sure that this doesn't happen.
- if (!mContactTileAdapter.isIndexInBound(position)) {
+ if (!contactTileAdapter.isIndexInBound(position)) {
continue;
}
- final long itemId = mContactTileAdapter.getItemId(position);
+ final long itemId = contactTileAdapter.getItemId(position);
if (DEBUG) {
LogUtil.d(
"OldSpeedDialFragment.saveOffsets",
"Saving itemId: " + itemId + " for listview child " + i + " Top: " + child.getTop());
}
- mItemIdTopMap.put(itemId, child.getTop());
- mItemIdLeftMap.put(itemId, child.getLeft());
+ itemIdTopMap.put(itemId, child.getTop());
+ itemIdLeftMap.put(itemId, child.getLeft());
}
- mItemIdTopMap.put(KEY_REMOVED_ITEM_HEIGHT, removedItemHeight);
+ itemIdTopMap.put(KEY_REMOVED_ITEM_HEIGHT, removedItemHeight);
}
/*
* Performs animations for the gridView
*/
private void animateGridView(final long... idsInPlace) {
- if (mItemIdTopMap.size() == 0) {
+ if (itemIdTopMap.size() == 0) {
// Don't do animations if the database is being queried for the first time and
// the previous item offsets have not been cached, or the user hasn't done anything
// (dragging, swiping etc) that requires an animation.
@@ -304,34 +304,34 @@ public class OldSpeedDialFragment extends Fragment
}
ViewUtil.doOnPreDraw(
- mListView,
+ listView,
true,
new Runnable() {
@Override
public void run() {
- final int firstVisiblePosition = mListView.getFirstVisiblePosition();
+ final int firstVisiblePosition = listView.getFirstVisiblePosition();
final AnimatorSet animSet = new AnimatorSet();
final ArrayList<Animator> animators = new ArrayList<Animator>();
- for (int i = 0; i < mListView.getChildCount(); i++) {
- final View child = mListView.getChildAt(i);
+ for (int i = 0; i < listView.getChildCount(); i++) {
+ final View child = listView.getChildAt(i);
int position = firstVisiblePosition + i;
// Since we are getting the position from mListView and then querying
// mContactTileAdapter, its very possible that things are out of sync
// and we might index out of bounds. Let's make sure that this doesn't happen.
- if (!mContactTileAdapter.isIndexInBound(position)) {
+ if (!contactTileAdapter.isIndexInBound(position)) {
continue;
}
- final long itemId = mContactTileAdapter.getItemId(position);
+ final long itemId = contactTileAdapter.getItemId(position);
if (containsId(idsInPlace, itemId)) {
animators.add(ObjectAnimator.ofFloat(child, "alpha", 0.0f, 1.0f));
break;
} else {
- Integer startTop = mItemIdTopMap.get(itemId);
- Integer startLeft = mItemIdLeftMap.get(itemId);
+ Integer startTop = itemIdTopMap.get(itemId);
+ Integer startLeft = itemIdLeftMap.get(itemId);
final int top = child.getTop();
final int left = child.getLeft();
int deltaX = 0;
@@ -367,12 +367,12 @@ public class OldSpeedDialFragment extends Fragment
}
if (animators.size() > 0) {
- animSet.setDuration(mAnimationDuration).playTogether(animators);
+ animSet.setDuration(animationDuration).playTogether(animators);
animSet.start();
}
- mItemIdTopMap.clear();
- mItemIdLeftMap.clear();
+ itemIdTopMap.clear();
+ itemIdLeftMap.clear();
}
});
}
@@ -451,8 +451,8 @@ public class OldSpeedDialFragment extends Fragment
if (DEBUG) {
LogUtil.d("ContactTileLoaderListener.onLoadFinished", null);
}
- mContactTileAdapter.setContactCursor(data);
- setEmptyViewVisibility(mContactTileAdapter.getCount() == 0);
+ contactTileAdapter.setContactCursor(data);
+ setEmptyViewVisibility(contactTileAdapter.getCount() == 0);
}
@Override
@@ -468,16 +468,16 @@ public class OldSpeedDialFragment extends Fragment
@Override
public void onContactSelected(
Uri contactUri, Rect targetRect, CallSpecificAppData callSpecificAppData) {
- if (mPhoneNumberPickerActionListener != null) {
- mPhoneNumberPickerActionListener.onPickDataUri(
+ if (phoneNumberPickerActionListener != null) {
+ phoneNumberPickerActionListener.onPickDataUri(
contactUri, false /* isVideoCall */, callSpecificAppData);
}
}
@Override
public void onCallNumberDirectly(String phoneNumber, CallSpecificAppData callSpecificAppData) {
- if (mPhoneNumberPickerActionListener != null) {
- mPhoneNumberPickerActionListener.onPickPhoneNumber(
+ if (phoneNumberPickerActionListener != null) {
+ phoneNumberPickerActionListener.onPickPhoneNumber(
phoneNumber, false /* isVideoCall */, callSpecificAppData);
}
}
@@ -488,15 +488,15 @@ public class OldSpeedDialFragment extends Fragment
@Override
public void onScroll(
AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- if (mActivityScrollListener != null) {
- mActivityScrollListener.onListFragmentScroll(
+ if (activityScrollListener != null) {
+ activityScrollListener.onListFragmentScroll(
firstVisibleItem, visibleItemCount, totalItemCount);
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
- mActivityScrollListener.onListFragmentScrollStateChange(scrollState);
+ activityScrollListener.onListFragmentScrollStateChange(scrollState);
}
}
}
diff --git a/java/com/android/dialer/app/list/PhoneFavoriteListView.java b/java/com/android/dialer/app/list/PhoneFavoriteListView.java
index f4f395ff0..ff867f9c0 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteListView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteListView.java
@@ -38,58 +38,58 @@ public class PhoneFavoriteListView extends GridView
implements OnDragDropListener, DragItemContainer {
public static final String LOG_TAG = PhoneFavoriteListView.class.getSimpleName();
- final int[] mLocationOnScreen = new int[2];
+ final int[] locationOnScreen = new int[2];
private static final long SCROLL_HANDLER_DELAY_MILLIS = 5;
private static final int DRAG_SCROLL_PX_UNIT = 25;
private static final float DRAG_SHADOW_ALPHA = 0.7f;
/**
- * {@link #mTopScrollBound} and {@link mBottomScrollBound} will be offseted to the top / bottom by
+ * {@link #topScrollBound} and {@link bottomScrollBound} will be offseted to the top / bottom by
* {@link #getHeight} * {@link #BOUND_GAP_RATIO} pixels.
*/
private static final float BOUND_GAP_RATIO = 0.2f;
- private float mTouchSlop;
- private int mTopScrollBound;
- private int mBottomScrollBound;
- private int mLastDragY;
- private Handler mScrollHandler;
- private final Runnable mDragScroller =
+ private float touchSlop;
+ private int topScrollBound;
+ private int bottomScrollBound;
+ private int lastDragY;
+ private Handler scrollHandler;
+ private final Runnable dragScroller =
new Runnable() {
@Override
public void run() {
- if (mLastDragY <= mTopScrollBound) {
+ if (lastDragY <= topScrollBound) {
smoothScrollBy(-DRAG_SCROLL_PX_UNIT, (int) SCROLL_HANDLER_DELAY_MILLIS);
- } else if (mLastDragY >= mBottomScrollBound) {
+ } else if (lastDragY >= bottomScrollBound) {
smoothScrollBy(DRAG_SCROLL_PX_UNIT, (int) SCROLL_HANDLER_DELAY_MILLIS);
}
- mScrollHandler.postDelayed(this, SCROLL_HANDLER_DELAY_MILLIS);
+ scrollHandler.postDelayed(this, SCROLL_HANDLER_DELAY_MILLIS);
}
};
- private boolean mIsDragScrollerRunning = false;
- private int mTouchDownForDragStartY;
- private Bitmap mDragShadowBitmap;
- private ImageView mDragShadowOverlay;
- private final AnimatorListenerAdapter mDragShadowOverAnimatorListener =
+ private boolean isDragScrollerRunning = false;
+ private int touchDownForDragStartY;
+ private Bitmap dragShadowBitmap;
+ private ImageView dragShadowOverlay;
+ private final AnimatorListenerAdapter dragShadowOverAnimatorListener =
new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- if (mDragShadowBitmap != null) {
- mDragShadowBitmap.recycle();
- mDragShadowBitmap = null;
+ if (dragShadowBitmap != null) {
+ dragShadowBitmap.recycle();
+ dragShadowBitmap = null;
}
- mDragShadowOverlay.setVisibility(GONE);
- mDragShadowOverlay.setImageBitmap(null);
+ dragShadowOverlay.setVisibility(GONE);
+ dragShadowOverlay.setImageBitmap(null);
}
};
- private View mDragShadowParent;
- private int mAnimationDuration;
+ private View dragShadowParent;
+ private int animationDuration;
// X and Y offsets inside the item from where the user grabbed to the
// child's left coordinate. This is used to aid in the drawing of the drag shadow.
- private int mTouchOffsetToChildLeft;
- private int mTouchOffsetToChildTop;
- private int mDragShadowLeft;
- private int mDragShadowTop;
- private DragDropController mDragDropController = new DragDropController(this);
+ private int touchOffsetToChildLeft;
+ private int touchOffsetToChildTop;
+ private int dragShadowLeft;
+ private int dragShadowTop;
+ private DragDropController dragDropController = new DragDropController(this);
public PhoneFavoriteListView(Context context) {
this(context, null);
@@ -101,15 +101,15 @@ public class PhoneFavoriteListView extends GridView
public PhoneFavoriteListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mAnimationDuration = context.getResources().getInteger(R.integer.fade_duration);
- mTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop();
- mDragDropController.addOnDragDropListener(this);
+ animationDuration = context.getResources().getInteger(R.integer.fade_duration);
+ touchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop();
+ dragDropController.addOnDragDropListener(this);
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- mTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
+ touchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
}
/**
@@ -119,7 +119,7 @@ public class PhoneFavoriteListView extends GridView
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- mTouchDownForDragStartY = (int) ev.getY();
+ touchDownForDragStartY = (int) ev.getY();
}
return super.onInterceptTouchEvent(ev);
@@ -138,38 +138,38 @@ public class PhoneFavoriteListView extends GridView
// on a {@link PhoneFavoriteTileView}
return false;
}
- if (!mDragDropController.handleDragStarted(this, eX, eY)) {
+ if (!dragDropController.handleDragStarted(this, eX, eY)) {
return false;
}
break;
}
case DragEvent.ACTION_DRAG_LOCATION:
- mLastDragY = eY;
- mDragDropController.handleDragHovered(this, eX, eY);
+ lastDragY = eY;
+ dragDropController.handleDragHovered(this, eX, eY);
// Kick off {@link #mScrollHandler} if it's not started yet.
- if (!mIsDragScrollerRunning
+ if (!isDragScrollerRunning
&&
// And if the distance traveled while dragging exceeds the touch slop
- (Math.abs(mLastDragY - mTouchDownForDragStartY) >= 4 * mTouchSlop)) {
- mIsDragScrollerRunning = true;
+ (Math.abs(lastDragY - touchDownForDragStartY) >= 4 * touchSlop)) {
+ isDragScrollerRunning = true;
ensureScrollHandler();
- mScrollHandler.postDelayed(mDragScroller, SCROLL_HANDLER_DELAY_MILLIS);
+ scrollHandler.postDelayed(dragScroller, SCROLL_HANDLER_DELAY_MILLIS);
}
break;
case DragEvent.ACTION_DRAG_ENTERED:
final int boundGap = (int) (getHeight() * BOUND_GAP_RATIO);
- mTopScrollBound = (getTop() + boundGap);
- mBottomScrollBound = (getBottom() - boundGap);
+ topScrollBound = (getTop() + boundGap);
+ bottomScrollBound = (getBottom() - boundGap);
break;
case DragEvent.ACTION_DRAG_EXITED:
case DragEvent.ACTION_DRAG_ENDED:
case DragEvent.ACTION_DROP:
ensureScrollHandler();
- mScrollHandler.removeCallbacks(mDragScroller);
- mIsDragScrollerRunning = false;
+ scrollHandler.removeCallbacks(dragScroller);
+ isDragScrollerRunning = false;
// Either a successful drop or it's ended with out drop.
if (action == DragEvent.ACTION_DROP || action == DragEvent.ACTION_DRAG_ENDED) {
- mDragDropController.handleDragFinished(eX, eY, false);
+ dragDropController.handleDragFinished(eX, eY, false);
}
break;
default:
@@ -180,8 +180,8 @@ public class PhoneFavoriteListView extends GridView
}
public void setDragShadowOverlay(ImageView overlay) {
- mDragShadowOverlay = overlay;
- mDragShadowParent = (View) mDragShadowOverlay.getParent();
+ dragShadowOverlay = overlay;
+ dragShadowParent = (View) dragShadowOverlay.getParent();
}
/** Find the view under the pointer. */
@@ -201,73 +201,73 @@ public class PhoneFavoriteListView extends GridView
}
private void ensureScrollHandler() {
- if (mScrollHandler == null) {
- mScrollHandler = getHandler();
+ if (scrollHandler == null) {
+ scrollHandler = getHandler();
}
}
public DragDropController getDragDropController() {
- return mDragDropController;
+ return dragDropController;
}
@Override
public void onDragStarted(int x, int y, PhoneFavoriteSquareTileView tileView) {
- if (mDragShadowOverlay == null) {
+ if (dragShadowOverlay == null) {
return;
}
- mDragShadowOverlay.clearAnimation();
- mDragShadowBitmap = createDraggedChildBitmap(tileView);
- if (mDragShadowBitmap == null) {
+ dragShadowOverlay.clearAnimation();
+ dragShadowBitmap = createDraggedChildBitmap(tileView);
+ if (dragShadowBitmap == null) {
return;
}
- tileView.getLocationOnScreen(mLocationOnScreen);
- mDragShadowLeft = mLocationOnScreen[0];
- mDragShadowTop = mLocationOnScreen[1];
+ tileView.getLocationOnScreen(locationOnScreen);
+ dragShadowLeft = locationOnScreen[0];
+ dragShadowTop = locationOnScreen[1];
// x and y are the coordinates of the on-screen touch event. Using these
// and the on-screen location of the tileView, calculate the difference between
// the position of the user's finger and the position of the tileView. These will
// be used to offset the location of the drag shadow so that it appears that the
// tileView is positioned directly under the user's finger.
- mTouchOffsetToChildLeft = x - mDragShadowLeft;
- mTouchOffsetToChildTop = y - mDragShadowTop;
+ touchOffsetToChildLeft = x - dragShadowLeft;
+ touchOffsetToChildTop = y - dragShadowTop;
- mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
- mDragShadowLeft -= mLocationOnScreen[0];
- mDragShadowTop -= mLocationOnScreen[1];
+ dragShadowParent.getLocationOnScreen(locationOnScreen);
+ dragShadowLeft -= locationOnScreen[0];
+ dragShadowTop -= locationOnScreen[1];
- mDragShadowOverlay.setImageBitmap(mDragShadowBitmap);
- mDragShadowOverlay.setVisibility(VISIBLE);
- mDragShadowOverlay.setAlpha(DRAG_SHADOW_ALPHA);
+ dragShadowOverlay.setImageBitmap(dragShadowBitmap);
+ dragShadowOverlay.setVisibility(VISIBLE);
+ dragShadowOverlay.setAlpha(DRAG_SHADOW_ALPHA);
- mDragShadowOverlay.setX(mDragShadowLeft);
- mDragShadowOverlay.setY(mDragShadowTop);
+ dragShadowOverlay.setX(dragShadowLeft);
+ dragShadowOverlay.setY(dragShadowTop);
}
@Override
public void onDragHovered(int x, int y, PhoneFavoriteSquareTileView tileView) {
// Update the drag shadow location.
- mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
- mDragShadowLeft = x - mTouchOffsetToChildLeft - mLocationOnScreen[0];
- mDragShadowTop = y - mTouchOffsetToChildTop - mLocationOnScreen[1];
+ dragShadowParent.getLocationOnScreen(locationOnScreen);
+ dragShadowLeft = x - touchOffsetToChildLeft - locationOnScreen[0];
+ dragShadowTop = y - touchOffsetToChildTop - locationOnScreen[1];
// Draw the drag shadow at its last known location if the drag shadow exists.
- if (mDragShadowOverlay != null) {
- mDragShadowOverlay.setX(mDragShadowLeft);
- mDragShadowOverlay.setY(mDragShadowTop);
+ if (dragShadowOverlay != null) {
+ dragShadowOverlay.setX(dragShadowLeft);
+ dragShadowOverlay.setY(dragShadowTop);
}
}
@Override
public void onDragFinished(int x, int y) {
- if (mDragShadowOverlay != null) {
- mDragShadowOverlay.clearAnimation();
- mDragShadowOverlay
+ if (dragShadowOverlay != null) {
+ dragShadowOverlay.clearAnimation();
+ dragShadowOverlay
.animate()
.alpha(0.0f)
- .setDuration(mAnimationDuration)
- .setListener(mDragShadowOverAnimatorListener)
+ .setDuration(animationDuration)
+ .setListener(dragShadowOverAnimatorListener)
.start();
}
}
@@ -297,10 +297,10 @@ public class PhoneFavoriteListView extends GridView
@Override
public PhoneFavoriteSquareTileView getViewForLocation(int x, int y) {
- getLocationOnScreen(mLocationOnScreen);
+ getLocationOnScreen(locationOnScreen);
// Calculate the X and Y coordinates of the drag event relative to the view
- final int viewX = x - mLocationOnScreen[0];
- final int viewY = y - mLocationOnScreen[1];
+ final int viewX = x - locationOnScreen[0];
+ final int viewY = y - locationOnScreen[1];
final View child = getViewAtPosition(viewX, viewY);
if (!(child instanceof PhoneFavoriteSquareTileView)) {
diff --git a/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java
index 40f23ea6f..330a3614c 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteSquareTileView.java
@@ -34,16 +34,16 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
private static final String TAG = PhoneFavoriteSquareTileView.class.getSimpleName();
- private final float mHeightToWidthRatio;
+ private final float heightToWidthRatio;
- private ImageButton mSecondaryButton;
+ private ImageButton secondaryButton;
- private ContactEntry mContactEntry;
+ private ContactEntry contactEntry;
public PhoneFavoriteSquareTileView(Context context, AttributeSet attrs) {
super(context, attrs);
- mHeightToWidthRatio =
+ heightToWidthRatio =
getResources().getFraction(R.dimen.contact_tile_height_to_width_ratio, 1, 1);
}
@@ -54,7 +54,7 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
nameView.setElegantTextHeight(false);
final TextView phoneTypeView = (TextView) findViewById(R.id.contact_tile_phone_type);
phoneTypeView.setElegantTextHeight(false);
- mSecondaryButton = (ImageButton) findViewById(R.id.contact_tile_secondary_button);
+ secondaryButton = (ImageButton) findViewById(R.id.contact_tile_secondary_button);
}
@Override
@@ -85,7 +85,7 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
public void loadFromContact(ContactEntry entry) {
super.loadFromContact(entry);
if (entry != null) {
- mSecondaryButton.setOnClickListener(
+ secondaryButton.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
@@ -95,13 +95,13 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
}
});
}
- mContactEntry = entry;
+ contactEntry = entry;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec);
- final int height = (int) (mHeightToWidthRatio * width);
+ final int height = (int) (heightToWidthRatio * width);
final int count = getChildCount();
for (int i = 0; i < count; i++) {
getChildAt(i)
@@ -118,6 +118,6 @@ public class PhoneFavoriteSquareTileView extends PhoneFavoriteTileView {
}
public ContactEntry getContactEntry() {
- return mContactEntry;
+ return contactEntry;
}
}
diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
index e0961be4b..3b27d3118 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
@@ -60,9 +60,10 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
// don't crash with an NPE if the drag shadow is released in their bounds
private static final ClipData EMPTY_CLIP_DATA = ClipData.newPlainText("", "");
/** View that contains the transparent shadow that is overlaid on top of the contact image. */
- private View mShadowOverlay;
+ private View shadowOverlay;
/** Users' most frequent phone number. */
- private String mPhoneNumberString;
+ private String phoneNumberString;
+
private boolean isPinned;
private boolean isStarred;
private int position = -1;
@@ -74,7 +75,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mShadowOverlay = findViewById(R.id.shadow_overlay);
+ shadowOverlay = findViewById(R.id.shadow_overlay);
setOnLongClickListener(
new OnLongClickListener() {
@@ -93,13 +94,13 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
public void loadFromContact(ContactEntry entry) {
super.loadFromContact(entry);
// Set phone number to null in case we're reusing the view.
- mPhoneNumberString = null;
+ phoneNumberString = null;
isPinned = (entry.pinned != PinnedPositions.UNPINNED);
isStarred = entry.isFavorite;
if (entry != null) {
sendViewNotification(getContext(), entry.lookupUri);
// Grab the phone-number to call directly. See {@link onClick()}.
- mPhoneNumberString = entry.phoneNumber;
+ phoneNumberString = entry.phoneNumber;
// If this is a blank entry, don't show anything. For this to truly look like an empty row
// the entire ContactTileRow needs to be hidden.
@@ -141,7 +142,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.PINNED_CONTACT);
}
- if (TextUtils.isEmpty(mPhoneNumberString)) {
+ if (TextUtils.isEmpty(phoneNumberString)) {
// Don't set performance report now, since user may spend some time on picking a number
// Copy "superclass" implementation
@@ -156,7 +157,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
// call them at the number that you usually talk to them
// at (i.e. the one displayed in the UI), regardless of
// whether that's their default number.
- mListener.onCallNumberDirectly(mPhoneNumberString, callSpecificAppData.build());
+ mListener.onCallNumberDirectly(phoneNumberString, callSpecificAppData.build());
}
}
};
@@ -176,8 +177,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
@Override
protected void configureViewForImage(boolean isDefaultImage) {
// Hide the shadow overlay if the image is a default image (i.e. colored letter tile)
- if (mShadowOverlay != null) {
- mShadowOverlay.setVisibility(isDefaultImage ? View.GONE : View.VISIBLE);
+ if (shadowOverlay != null) {
+ shadowOverlay.setVisibility(isDefaultImage ? View.GONE : View.VISIBLE);
}
}
diff --git a/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java b/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java
index cd5843c85..ed64f7a52 100644
--- a/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java
+++ b/java/com/android/dialer/app/list/PhoneFavoritesTileAdapter.java
@@ -68,17 +68,17 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
*/
private static final int TILES_SOFT_LIMIT = 20;
/** Contact data stored in cache. This is used to populate the associated view. */
- private ArrayList<ContactEntry> mContactEntries = null;
+ private ArrayList<ContactEntry> contactEntries = null;
- private int mNumFrequents;
- private int mNumStarred;
+ private int numFrequents;
+ private int numStarred;
- private ContactTileView.Listener mListener;
- private OnDataSetChangedForAnimationListener mDataSetChangedListener;
- private Context mContext;
- private Resources mResources;
- private ContactsPreferences mContactsPreferences;
- private final Comparator<ContactEntry> mContactEntryComparator =
+ private ContactTileView.Listener listener;
+ private OnDataSetChangedForAnimationListener dataSetChangedListener;
+ private Context context;
+ private Resources resources;
+ private ContactsPreferences contactsPreferences;
+ private final Comparator<ContactEntry> contactEntryComparator =
new Comparator<ContactEntry>() {
@Override
public int compare(ContactEntry lhs, ContactEntry rhs) {
@@ -89,7 +89,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
}
private String getPreferredSortName(ContactEntry contactEntry) {
- if (mContactsPreferences.getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY
+ if (contactsPreferences.getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY
|| TextUtils.isEmpty(contactEntry.nameAlternative)) {
return contactEntry.namePrimary;
}
@@ -97,36 +97,36 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
}
};
/** Back up of the temporarily removed Contact during dragging. */
- private ContactEntry mDraggedEntry = null;
+ private ContactEntry draggedEntry = null;
/** Position of the temporarily removed contact in the cache. */
- private int mDraggedEntryIndex = -1;
+ private int draggedEntryIndex = -1;
/** New position of the temporarily removed contact in the cache. */
- private int mDropEntryIndex = -1;
+ private int dropEntryIndex = -1;
/** New position of the temporarily entered contact in the cache. */
- private int mDragEnteredEntryIndex = -1;
+ private int dragEnteredEntryIndex = -1;
- private boolean mAwaitingRemove = false;
- private boolean mDelayCursorUpdates = false;
- private ContactPhotoManager mPhotoManager;
+ private boolean awaitingRemove = false;
+ private boolean delayCursorUpdates = false;
+ private ContactPhotoManager photoManager;
/** Indicates whether a drag is in process. */
- private boolean mInDragging = false;
+ private boolean inDragging = false;
public PhoneFavoritesTileAdapter(
Context context,
ContactTileView.Listener listener,
OnDataSetChangedForAnimationListener dataSetChangedListener) {
- mDataSetChangedListener = dataSetChangedListener;
- mListener = listener;
- mContext = context;
- mResources = context.getResources();
- mContactsPreferences = new ContactsPreferences(mContext);
- mNumFrequents = 0;
- mContactEntries = new ArrayList<>();
+ this.dataSetChangedListener = dataSetChangedListener;
+ this.listener = listener;
+ this.context = context;
+ resources = context.getResources();
+ contactsPreferences = new ContactsPreferences(this.context);
+ numFrequents = 0;
+ contactEntries = new ArrayList<>();
}
void setPhotoLoader(ContactPhotoManager photoLoader) {
- mPhotoManager = photoLoader;
+ photoManager = photoLoader;
}
/**
@@ -135,13 +135,13 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
* @param inDragging Boolean variable indicating whether there is a drag in process.
*/
private void setInDragging(boolean inDragging) {
- mDelayCursorUpdates = inDragging;
- mInDragging = inDragging;
+ delayCursorUpdates = inDragging;
+ this.inDragging = inDragging;
}
void refreshContactsPreferences() {
- mContactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
- mContactsPreferences.refreshValue(ContactsPreferences.SORT_ORDER_KEY);
+ contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
+ contactsPreferences.refreshValue(ContactsPreferences.SORT_ORDER_KEY);
}
/**
@@ -152,7 +152,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
* @param cursor The cursor to get number of frequents from.
*/
private void saveNumFrequentsFromCursor(Cursor cursor) {
- mNumFrequents = cursor.getCount() - mNumStarred;
+ numFrequents = cursor.getCount() - numStarred;
}
/**
@@ -161,10 +161,10 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
* <p>Else use {@link ContactTileLoaderFactory}
*/
void setContactCursor(Cursor cursor) {
- if (!mDelayCursorUpdates && cursor != null && !cursor.isClosed()) {
- mNumStarred = getNumStarredContacts(cursor);
- if (mAwaitingRemove) {
- mDataSetChangedListener.cacheOffsetsForDatasetChange();
+ if (!delayCursorUpdates && cursor != null && !cursor.isClosed()) {
+ numStarred = getNumStarredContacts(cursor);
+ if (awaitingRemove) {
+ dataSetChangedListener.cacheOffsetsForDatasetChange();
}
saveNumFrequentsFromCursor(cursor);
@@ -172,7 +172,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
// cause a refresh of any views that rely on this data
notifyDataSetChanged();
// about to start redraw
- mDataSetChangedListener.onDataSetChangedForAnimation();
+ dataSetChangedListener.onDataSetChangedForAnimation();
}
}
@@ -183,7 +183,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
* view.
*/
private void saveCursorToCache(Cursor cursor) {
- mContactEntries.clear();
+ contactEntries.clear();
if (cursor == null) {
return;
@@ -250,12 +250,12 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
contact.id = id;
contact.namePrimary =
- (!TextUtils.isEmpty(name)) ? name : mResources.getString(R.string.missing_name);
+ (!TextUtils.isEmpty(name)) ? name : resources.getString(R.string.missing_name);
contact.nameAlternative =
(!TextUtils.isEmpty(nameAlternative))
? nameAlternative
- : mResources.getString(R.string.missing_name);
- contact.nameDisplayOrder = mContactsPreferences.getDisplayOrder();
+ : resources.getString(R.string.missing_name);
+ contact.nameDisplayOrder = contactsPreferences.getDisplayOrder();
contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null);
contact.lookupKey = lookupKey;
contact.lookupUri =
@@ -268,11 +268,11 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
final int phoneNumberType = cursor.getInt(phoneTypeColumn);
final String phoneNumberCustomLabel = cursor.getString(phoneLabelColumn);
contact.phoneLabel =
- (String) Phone.getTypeLabel(mResources, phoneNumberType, phoneNumberCustomLabel);
+ (String) Phone.getTypeLabel(resources, phoneNumberType, phoneNumberCustomLabel);
contact.phoneNumber = cursor.getString(phoneNumberColumn);
contact.pinned = pinned;
- mContactEntries.add(contact);
+ contactEntries.add(contact);
// Set counts for logging
if (isStarred) {
@@ -296,23 +296,23 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
} while (cursor.moveToNext());
}
- mAwaitingRemove = false;
+ awaitingRemove = false;
- arrangeContactsByPinnedPosition(mContactEntries);
+ arrangeContactsByPinnedPosition(contactEntries);
- ShortcutRefresher.refresh(mContext, mContactEntries);
+ ShortcutRefresher.refresh(context, contactEntries);
notifyDataSetChanged();
- Duo duo = DuoComponent.get(mContext).getDuo();
- for (ContactEntry contact : mContactEntries) {
+ Duo duo = DuoComponent.get(context).getDuo();
+ for (ContactEntry contact : contactEntries) {
if (contact.phoneNumber == null) {
multipleNumbersContactsCount++;
- } else if (duo.isReachable(mContext, contact.phoneNumber)) {
+ } else if (duo.isReachable(context, contact.phoneNumber)) {
lightbringerReachableContactsCount++;
}
}
- Logger.get(mContext)
+ Logger.get(context)
.logSpeedDialContactComposition(
counter,
starredContactsCount,
@@ -366,16 +366,16 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
/** Returns the number of frequents that will be displayed in the list. */
int getNumFrequents() {
- return mNumFrequents;
+ return numFrequents;
}
@Override
public int getCount() {
- if (mContactEntries == null) {
+ if (contactEntries == null) {
return 0;
}
- return mContactEntries.size();
+ return contactEntries.size();
}
/**
@@ -384,7 +384,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
*/
@Override
public ContactEntry getItem(int position) {
- return mContactEntries.get(position);
+ return contactEntries.get(position);
}
/**
@@ -435,10 +435,10 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
if (tileView == null) {
tileView =
- (PhoneFavoriteTileView) View.inflate(mContext, R.layout.phone_favorite_tile_view, null);
+ (PhoneFavoriteTileView) View.inflate(context, R.layout.phone_favorite_tile_view, null);
}
- tileView.setPhotoManager(mPhotoManager);
- tileView.setListener(mListener);
+ tileView.setPhotoManager(photoManager);
+ tileView.setListener(listener);
tileView.loadFromContact(getItem(position));
tileView.setPosition(position);
return tileView;
@@ -462,37 +462,37 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
*/
private void popContactEntry(int index) {
if (isIndexInBound(index)) {
- mDraggedEntry = mContactEntries.get(index);
- mDraggedEntryIndex = index;
- mDragEnteredEntryIndex = index;
- markDropArea(mDragEnteredEntryIndex);
+ draggedEntry = contactEntries.get(index);
+ draggedEntryIndex = index;
+ dragEnteredEntryIndex = index;
+ markDropArea(dragEnteredEntryIndex);
}
}
/**
- * @param itemIndex Position of the contact in {@link #mContactEntries}.
- * @return True if the given index is valid for {@link #mContactEntries}.
+ * @param itemIndex Position of the contact in {@link #contactEntries}.
+ * @return True if the given index is valid for {@link #contactEntries}.
*/
boolean isIndexInBound(int itemIndex) {
- return itemIndex >= 0 && itemIndex < mContactEntries.size();
+ return itemIndex >= 0 && itemIndex < contactEntries.size();
}
/**
- * Mark the tile as drop area by given the item index in {@link #mContactEntries}.
+ * Mark the tile as drop area by given the item index in {@link #contactEntries}.
*
- * @param itemIndex Position of the contact in {@link #mContactEntries}.
+ * @param itemIndex Position of the contact in {@link #contactEntries}.
*/
private void markDropArea(int itemIndex) {
- if (mDraggedEntry != null
- && isIndexInBound(mDragEnteredEntryIndex)
+ if (draggedEntry != null
+ && isIndexInBound(dragEnteredEntryIndex)
&& isIndexInBound(itemIndex)) {
- mDataSetChangedListener.cacheOffsetsForDatasetChange();
+ dataSetChangedListener.cacheOffsetsForDatasetChange();
// Remove the old placeholder item and place the new placeholder item.
- mContactEntries.remove(mDragEnteredEntryIndex);
- mDragEnteredEntryIndex = itemIndex;
- mContactEntries.add(mDragEnteredEntryIndex, ContactEntry.BLANK_ENTRY);
- ContactEntry.BLANK_ENTRY.id = mDraggedEntry.id;
- mDataSetChangedListener.onDataSetChangedForAnimation();
+ contactEntries.remove(dragEnteredEntryIndex);
+ dragEnteredEntryIndex = itemIndex;
+ contactEntries.add(dragEnteredEntryIndex, ContactEntry.BLANK_ENTRY);
+ ContactEntry.BLANK_ENTRY.id = draggedEntry.id;
+ dataSetChangedListener.onDataSetChangedForAnimation();
notifyDataSetChanged();
}
}
@@ -500,38 +500,38 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
/** Drops the temporarily removed contact to the desired location in the list. */
private void handleDrop() {
boolean changed = false;
- if (mDraggedEntry != null) {
- if (isIndexInBound(mDragEnteredEntryIndex) && mDragEnteredEntryIndex != mDraggedEntryIndex) {
+ if (draggedEntry != null) {
+ if (isIndexInBound(dragEnteredEntryIndex) && dragEnteredEntryIndex != draggedEntryIndex) {
// Don't add the ContactEntry here (to prevent a double animation from occuring).
// When we receive a new cursor the list of contact entries will automatically be
// populated with the dragged ContactEntry at the correct spot.
- mDropEntryIndex = mDragEnteredEntryIndex;
- mContactEntries.set(mDropEntryIndex, mDraggedEntry);
- mDataSetChangedListener.cacheOffsetsForDatasetChange();
+ dropEntryIndex = dragEnteredEntryIndex;
+ contactEntries.set(dropEntryIndex, draggedEntry);
+ dataSetChangedListener.cacheOffsetsForDatasetChange();
changed = true;
- } else if (isIndexInBound(mDraggedEntryIndex)) {
+ } else if (isIndexInBound(draggedEntryIndex)) {
// If {@link #mDragEnteredEntryIndex} is invalid,
// falls back to the original position of the contact.
- mContactEntries.remove(mDragEnteredEntryIndex);
- mContactEntries.add(mDraggedEntryIndex, mDraggedEntry);
- mDropEntryIndex = mDraggedEntryIndex;
+ contactEntries.remove(dragEnteredEntryIndex);
+ contactEntries.add(draggedEntryIndex, draggedEntry);
+ dropEntryIndex = draggedEntryIndex;
notifyDataSetChanged();
}
- if (changed && mDropEntryIndex < PIN_LIMIT) {
+ if (changed && dropEntryIndex < PIN_LIMIT) {
final ArrayList<ContentProviderOperation> operations =
- getReflowedPinningOperations(mContactEntries, mDraggedEntryIndex, mDropEntryIndex);
+ getReflowedPinningOperations(contactEntries, draggedEntryIndex, dropEntryIndex);
if (!operations.isEmpty()) {
// update the database here with the new pinned positions
try {
- mContext.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
- Logger.get(mContext).logInteraction(InteractionEvent.Type.SPEED_DIAL_PIN_CONTACT);
+ context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
+ Logger.get(context).logInteraction(InteractionEvent.Type.SPEED_DIAL_PIN_CONTACT);
} catch (RemoteException | OperationApplicationException e) {
LogUtil.e(TAG, "Exception thrown when pinning contacts", e);
}
}
}
- mDraggedEntry = null;
+ draggedEntry = null;
}
}
@@ -543,7 +543,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
final ContentValues values = new ContentValues(2);
values.put(Contacts.STARRED, false);
values.put(Contacts.PINNED, PinnedPositions.DEMOTED);
- mContext.getContentResolver().update(contactUri, values, null, null);
+ context.getContentResolver().update(contactUri, values, null, null);
}
/**
@@ -559,7 +559,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
@VisibleForTesting
private void arrangeContactsByPinnedPosition(ArrayList<ContactEntry> toArrange) {
final PriorityQueue<ContactEntry> pinnedQueue =
- new PriorityQueue<>(PIN_LIMIT, mContactEntryComparator);
+ new PriorityQueue<>(PIN_LIMIT, contactEntryComparator);
final List<ContactEntry> unpinnedContacts = new LinkedList<>();
@@ -643,7 +643,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
@Override
public void onDragStarted(int x, int y, PhoneFavoriteSquareTileView view) {
setInDragging(true);
- final int itemIndex = mContactEntries.indexOf(view.getContactEntry());
+ final int itemIndex = contactEntries.indexOf(view.getContactEntry());
popContactEntry(itemIndex);
}
@@ -654,9 +654,9 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
// anything here.
return;
}
- final int itemIndex = mContactEntries.indexOf(view.getContactEntry());
- if (mInDragging
- && mDragEnteredEntryIndex != itemIndex
+ final int itemIndex = contactEntries.indexOf(view.getContactEntry());
+ if (inDragging
+ && dragEnteredEntryIndex != itemIndex
&& isIndexInBound(itemIndex)
&& itemIndex < PIN_LIMIT
&& itemIndex >= 0) {
@@ -670,17 +670,17 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements OnDragDrop
// A contact has been dragged to the RemoveView in order to be unstarred, so simply wait
// for the new contact cursor which will cause the UI to be refreshed without the unstarred
// contact.
- if (!mAwaitingRemove) {
+ if (!awaitingRemove) {
handleDrop();
}
}
@Override
public void onDroppedOnRemove() {
- if (mDraggedEntry != null) {
- unstarAndUnpinContact(mDraggedEntry.lookupUri);
- mAwaitingRemove = true;
- Logger.get(mContext).logInteraction(InteractionEvent.Type.SPEED_DIAL_REMOVE_CONTACT);
+ if (draggedEntry != null) {
+ unstarAndUnpinContact(draggedEntry.lookupUri);
+ awaitingRemove = true;
+ Logger.get(context).logInteraction(InteractionEvent.Type.SPEED_DIAL_REMOVE_CONTACT);
}
}
diff --git a/java/com/android/dialer/app/list/RegularSearchFragment.java b/java/com/android/dialer/app/list/RegularSearchFragment.java
index 48f77dcdc..d1927f08a 100644
--- a/java/com/android/dialer/app/list/RegularSearchFragment.java
+++ b/java/com/android/dialer/app/list/RegularSearchFragment.java
@@ -48,7 +48,7 @@ public class RegularSearchFragment extends SearchFragment
public static final int PERMISSION_REQUEST_CODE = 1;
private static final int SEARCH_DIRECTORY_RESULT_LIMIT = 5;
- protected String mPermissionToRequest;
+ protected String permissionToRequest;
private DialerExecutor<CachedContactInfo> addContactTask;
@@ -104,7 +104,7 @@ public class RegularSearchFragment extends SearchFragment
@Override
protected void setupEmptyView() {
- if (mEmptyView != null && getActivity() != null) {
+ if (emptyView != null && getActivity() != null) {
final int imageResource;
final int actionLabelResource;
final int descriptionResource;
@@ -114,20 +114,20 @@ public class RegularSearchFragment extends SearchFragment
actionLabelResource = R.string.permission_single_turn_on;
descriptionResource = R.string.permission_no_search;
listener = this;
- mPermissionToRequest = READ_CONTACTS;
+ permissionToRequest = READ_CONTACTS;
} else {
imageResource = EmptyContentView.NO_IMAGE;
actionLabelResource = EmptyContentView.NO_LABEL;
descriptionResource = EmptyContentView.NO_LABEL;
listener = null;
- mPermissionToRequest = null;
+ permissionToRequest = null;
}
- mEmptyView.setImage(imageResource);
- mEmptyView.setActionLabel(actionLabelResource);
- mEmptyView.setDescription(descriptionResource);
+ emptyView.setImage(imageResource);
+ emptyView.setActionLabel(actionLabelResource);
+ emptyView.setDescription(descriptionResource);
if (listener != null) {
- mEmptyView.setActionClickedListener(listener);
+ emptyView.setActionClickedListener(listener);
}
}
}
@@ -139,7 +139,7 @@ public class RegularSearchFragment extends SearchFragment
return;
}
- if (READ_CONTACTS.equals(mPermissionToRequest)) {
+ if (READ_CONTACTS.equals(permissionToRequest)) {
String[] deniedPermissions =
PermissionsUtil.getPermissionsCurrentlyDenied(
getContext(), PermissionsUtil.allContactsGroupPermissionsUsedInDialer);
diff --git a/java/com/android/dialer/app/list/RegularSearchListAdapter.java b/java/com/android/dialer/app/list/RegularSearchListAdapter.java
index 94544d2db..aee68ae58 100644
--- a/java/com/android/dialer/app/list/RegularSearchListAdapter.java
+++ b/java/com/android/dialer/app/list/RegularSearchListAdapter.java
@@ -31,7 +31,7 @@ import com.android.dialer.util.CallUtil;
/** List adapter to display regular search results. */
public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter {
- protected boolean mIsQuerySipAddress;
+ protected boolean isQuerySipAddress;
public RegularSearchListAdapter(Context context) {
super(context);
@@ -82,7 +82,7 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter {
@Override
public String getFormattedQueryString() {
- if (mIsQuerySipAddress) {
+ if (isQuerySipAddress) {
// Return unnormalized SIP address
return getQueryString();
}
@@ -94,7 +94,7 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter {
// Don't show actions if the query string contains a letter.
final boolean showNumberShortcuts =
!TextUtils.isEmpty(getFormattedQueryString()) && hasDigitsInQueryString();
- mIsQuerySipAddress = PhoneNumberHelper.isUriNumber(queryString);
+ isQuerySipAddress = PhoneNumberHelper.isUriNumber(queryString);
if (isChanged(showNumberShortcuts)) {
notifyDataSetChanged();
@@ -104,7 +104,7 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter {
protected boolean isChanged(boolean showNumberShortcuts) {
boolean changed = false;
- changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts || mIsQuerySipAddress);
+ changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts || isQuerySipAddress);
changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts);
changed |=
setShortcutEnabled(
diff --git a/java/com/android/dialer/app/list/RemoveView.java b/java/com/android/dialer/app/list/RemoveView.java
index 244f2da24..ed133d45b 100644
--- a/java/com/android/dialer/app/list/RemoveView.java
+++ b/java/com/android/dialer/app/list/RemoveView.java
@@ -29,12 +29,12 @@ import com.android.dialer.app.R;
public class RemoveView extends FrameLayout {
- DragDropController mDragDropController;
- TextView mRemoveText;
- ImageView mRemoveIcon;
- int mUnhighlightedColor;
- int mHighlightedColor;
- Drawable mRemoveDrawable;
+ DragDropController dragDropController;
+ TextView removeText;
+ ImageView removeIcon;
+ int unhighlightedColor;
+ int highlightedColor;
+ Drawable removeDrawable;
public RemoveView(Context context) {
super(context);
@@ -50,16 +50,16 @@ public class RemoveView extends FrameLayout {
@Override
protected void onFinishInflate() {
- mRemoveText = (TextView) findViewById(R.id.remove_view_text);
- mRemoveIcon = (ImageView) findViewById(R.id.remove_view_icon);
+ removeText = (TextView) findViewById(R.id.remove_view_text);
+ removeIcon = (ImageView) findViewById(R.id.remove_view_icon);
final Resources r = getResources();
- mUnhighlightedColor = r.getColor(R.color.remove_text_color);
- mHighlightedColor = r.getColor(R.color.remove_highlighted_text_color);
- mRemoveDrawable = r.getDrawable(R.drawable.ic_remove);
+ unhighlightedColor = r.getColor(R.color.remove_text_color);
+ highlightedColor = r.getColor(R.color.remove_highlighted_text_color);
+ removeDrawable = r.getDrawable(R.drawable.ic_remove);
}
public void setDragDropController(DragDropController controller) {
- mDragDropController = controller;
+ dragDropController = controller;
}
@Override
@@ -76,14 +76,14 @@ public class RemoveView extends FrameLayout {
setAppearanceNormal();
break;
case DragEvent.ACTION_DRAG_LOCATION:
- if (mDragDropController != null) {
- mDragDropController.handleDragHovered(this, (int) event.getX(), (int) event.getY());
+ if (dragDropController != null) {
+ dragDropController.handleDragHovered(this, (int) event.getX(), (int) event.getY());
}
break;
case DragEvent.ACTION_DROP:
sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT);
- if (mDragDropController != null) {
- mDragDropController.handleDragFinished((int) event.getX(), (int) event.getY(), true);
+ if (dragDropController != null) {
+ dragDropController.handleDragFinished((int) event.getX(), (int) event.getY(), true);
}
setAppearanceNormal();
break;
@@ -92,14 +92,14 @@ public class RemoveView extends FrameLayout {
}
private void setAppearanceNormal() {
- mRemoveText.setTextColor(mUnhighlightedColor);
- mRemoveIcon.setColorFilter(mUnhighlightedColor);
+ removeText.setTextColor(unhighlightedColor);
+ removeIcon.setColorFilter(unhighlightedColor);
invalidate();
}
private void setAppearanceHighlighted() {
- mRemoveText.setTextColor(mHighlightedColor);
- mRemoveIcon.setColorFilter(mHighlightedColor);
+ removeText.setTextColor(highlightedColor);
+ removeIcon.setColorFilter(highlightedColor);
invalidate();
}
}
diff --git a/java/com/android/dialer/app/list/SearchFragment.java b/java/com/android/dialer/app/list/SearchFragment.java
index 9330fc8c7..afb678969 100644
--- a/java/com/android/dialer/app/list/SearchFragment.java
+++ b/java/com/android/dialer/app/list/SearchFragment.java
@@ -51,28 +51,28 @@ import com.android.dialer.widget.EmptyContentView;
public class SearchFragment extends PhoneNumberPickerFragment {
- protected EmptyContentView mEmptyView;
- private OnListFragmentScrolledListener mActivityScrollListener;
- private View.OnTouchListener mActivityOnTouchListener;
+ protected EmptyContentView emptyView;
+ private OnListFragmentScrolledListener activityScrollListener;
+ private View.OnTouchListener activityOnTouchListener;
/*
* Stores the untouched user-entered string that is used to populate the add to contacts
* intent.
*/
- private String mAddToContactNumber;
- private int mActionBarHeight;
- private int mShadowHeight;
- private int mPaddingTop;
- private int mShowDialpadDuration;
- private int mHideDialpadDuration;
+ private String addToContactNumber;
+ private int actionBarHeight;
+ private int shadowHeight;
+ private int paddingTop;
+ private int showDialpadDuration;
+ private int hideDialpadDuration;
/**
* Used to resize the list view containing search results so that it fits the available space
* above the dialpad. Does not have a user-visible effect in regular touch usage (since the
* dialpad hides that portion of the ListView anyway), but improves usability in accessibility
* mode.
*/
- private Space mSpacer;
+ private Space spacer;
- private HostInterface mActivity;
+ private HostInterface activity;
@Override
public void onAttach(Activity activity) {
@@ -84,7 +84,7 @@ public class SearchFragment extends PhoneNumberPickerFragment {
setUseCallableUri(true);
try {
- mActivityScrollListener = (OnListFragmentScrolledListener) activity;
+ activityScrollListener = (OnListFragmentScrolledListener) activity;
} catch (ClassCastException e) {
LogUtil.v(
"SearchFragment.onAttach",
@@ -99,25 +99,25 @@ public class SearchFragment extends PhoneNumberPickerFragment {
LogUtil.d("SearchFragment.onStart", "");
super.onStart();
- mActivity = (HostInterface) getActivity();
+ activity = (HostInterface) getActivity();
final Resources res = getResources();
- mActionBarHeight = mActivity.getActionBarHeight();
- mShadowHeight = res.getDrawable(R.drawable.search_shadow).getIntrinsicHeight();
- mPaddingTop = res.getDimensionPixelSize(R.dimen.search_list_padding_top);
- mShowDialpadDuration = res.getInteger(R.integer.dialpad_slide_in_duration);
- mHideDialpadDuration = res.getInteger(R.integer.dialpad_slide_out_duration);
+ actionBarHeight = activity.getActionBarHeight();
+ shadowHeight = res.getDrawable(R.drawable.search_shadow).getIntrinsicHeight();
+ paddingTop = res.getDimensionPixelSize(R.dimen.search_list_padding_top);
+ showDialpadDuration = res.getInteger(R.integer.dialpad_slide_in_duration);
+ hideDialpadDuration = res.getInteger(R.integer.dialpad_slide_out_duration);
final ListView listView = getListView();
- if (mEmptyView == null) {
+ if (emptyView == null) {
if (this instanceof SmartDialSearchFragment) {
- mEmptyView = new DialpadSearchEmptyContentView(getActivity());
+ emptyView = new DialpadSearchEmptyContentView(getActivity());
} else {
- mEmptyView = new EmptyContentView(getActivity());
+ emptyView = new EmptyContentView(getActivity());
}
- ((ViewGroup) getListView().getParent()).addView(mEmptyView);
- getListView().setEmptyView(mEmptyView);
+ ((ViewGroup) getListView().getParent()).addView(emptyView);
+ getListView().setEmptyView(emptyView);
setupEmptyView();
}
@@ -133,8 +133,8 @@ public class SearchFragment extends PhoneNumberPickerFragment {
new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
- if (mActivityScrollListener != null) {
- mActivityScrollListener.onListFragmentScrollStateChange(scrollState);
+ if (activityScrollListener != null) {
+ activityScrollListener.onListFragmentScrollStateChange(scrollState);
}
}
@@ -142,8 +142,8 @@ public class SearchFragment extends PhoneNumberPickerFragment {
public void onScroll(
AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}
});
- if (mActivityOnTouchListener != null) {
- listView.setOnTouchListener(mActivityOnTouchListener);
+ if (activityOnTouchListener != null) {
+ listView.setOnTouchListener(activityOnTouchListener);
}
updatePosition(false /* animate */);
@@ -170,7 +170,7 @@ public class SearchFragment extends PhoneNumberPickerFragment {
}
public void setAddToContactNumber(String addToContactNumber) {
- mAddToContactNumber = addToContactNumber;
+ this.addToContactNumber = addToContactNumber;
}
/**
@@ -241,9 +241,9 @@ public class SearchFragment extends PhoneNumberPickerFragment {
.logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_DIALPAD);
}
number =
- TextUtils.isEmpty(mAddToContactNumber)
+ TextUtils.isEmpty(addToContactNumber)
? adapter.getFormattedQueryString()
- : mAddToContactNumber;
+ : addToContactNumber;
intent = IntentUtil.getNewContactIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
break;
@@ -253,24 +253,24 @@ public class SearchFragment extends PhoneNumberPickerFragment {
.logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_DIALPAD);
}
number =
- TextUtils.isEmpty(mAddToContactNumber)
+ TextUtils.isEmpty(addToContactNumber)
? adapter.getFormattedQueryString()
- : mAddToContactNumber;
+ : addToContactNumber;
intent = IntentUtil.getAddToExistingContactIntent(number);
DialerUtils.startActivityWithErrorToast(
getActivity(), intent, R.string.add_contact_not_available);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_SEND_SMS_MESSAGE:
number =
- TextUtils.isEmpty(mAddToContactNumber)
+ TextUtils.isEmpty(addToContactNumber)
? adapter.getFormattedQueryString()
- : mAddToContactNumber;
+ : addToContactNumber;
intent = IntentUtil.getSendSmsIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_MAKE_VIDEO_CALL:
number =
- TextUtils.isEmpty(mAddToContactNumber) ? adapter.getQueryString() : mAddToContactNumber;
+ TextUtils.isEmpty(addToContactNumber) ? adapter.getQueryString() : addToContactNumber;
listener = getOnPhoneNumberPickerListener();
if (listener != null && !checkForProhibitedPhoneNumber(number)) {
CallSpecificAppData callSpecificAppData =
@@ -296,25 +296,25 @@ public class SearchFragment extends PhoneNumberPickerFragment {
*/
public void updatePosition(boolean animate) {
LogUtil.d("SearchFragment.updatePosition", "animate: %b", animate);
- if (mActivity == null) {
+ if (activity == null) {
// Activity will be set in onStart, and this method will be called again
return;
}
// Use negative shadow height instead of 0 to account for the 9-patch's shadow.
int startTranslationValue =
- mActivity.isDialpadShown() ? mActionBarHeight - mShadowHeight : -mShadowHeight;
+ activity.isDialpadShown() ? actionBarHeight - shadowHeight : -shadowHeight;
int endTranslationValue = 0;
// Prevents ListView from being translated down after a rotation when the ActionBar is up.
- if (animate || mActivity.isActionBarShowing()) {
- endTranslationValue = mActivity.isDialpadShown() ? 0 : mActionBarHeight - mShadowHeight;
+ if (animate || activity.isActionBarShowing()) {
+ endTranslationValue = activity.isDialpadShown() ? 0 : actionBarHeight - shadowHeight;
}
if (animate) {
// If the dialpad will be shown, then this animation involves sliding the list up.
- final boolean slideUp = mActivity.isDialpadShown();
+ final boolean slideUp = activity.isDialpadShown();
Interpolator interpolator = slideUp ? AnimUtils.EASE_IN : AnimUtils.EASE_OUT;
- int duration = slideUp ? mShowDialpadDuration : mHideDialpadDuration;
+ int duration = slideUp ? showDialpadDuration : hideDialpadDuration;
getView().setTranslationY(startTranslationValue);
getView()
.animate()
@@ -344,7 +344,7 @@ public class SearchFragment extends PhoneNumberPickerFragment {
}
// There is padding which should only be applied when the dialpad is not shown.
- int paddingTop = mActivity.isDialpadShown() ? 0 : mPaddingTop;
+ int paddingTop = activity.isDialpadShown() ? 0 : this.paddingTop;
final ListView listView = getListView();
listView.setPaddingRelative(
listView.getPaddingStart(),
@@ -354,21 +354,21 @@ public class SearchFragment extends PhoneNumberPickerFragment {
}
public void resizeListView() {
- if (mSpacer == null) {
+ if (spacer == null) {
return;
}
- int spacerHeight = mActivity.isDialpadShown() ? mActivity.getDialpadHeight() : 0;
+ int spacerHeight = activity.isDialpadShown() ? activity.getDialpadHeight() : 0;
LogUtil.d(
"SearchFragment.resizeListView",
"spacerHeight: %d -> %d, isDialpadShown: %b, dialpad height: %d",
- mSpacer.getHeight(),
+ spacer.getHeight(),
spacerHeight,
- mActivity.isDialpadShown(),
- mActivity.getDialpadHeight());
- if (spacerHeight != mSpacer.getHeight()) {
- final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mSpacer.getLayoutParams();
+ activity.isDialpadShown(),
+ activity.getDialpadHeight());
+ if (spacerHeight != spacer.getHeight()) {
+ final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) spacer.getLayoutParams();
lp.height = spacerHeight;
- mSpacer.setLayoutParams(lp);
+ spacer.setLayoutParams(lp);
}
}
@@ -395,7 +395,7 @@ public class SearchFragment extends PhoneNumberPickerFragment {
}
public void setOnTouchListener(View.OnTouchListener onTouchListener) {
- mActivityOnTouchListener = onTouchListener;
+ activityOnTouchListener = onTouchListener;
}
@Override
@@ -403,9 +403,9 @@ public class SearchFragment extends PhoneNumberPickerFragment {
final LinearLayout parent = (LinearLayout) super.inflateView(inflater, container);
final int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
- mSpacer = new Space(getActivity());
+ spacer = new Space(getActivity());
parent.addView(
- mSpacer, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0));
+ spacer, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0));
}
return parent;
}
diff --git a/java/com/android/dialer/app/list/SmartDialNumberListAdapter.java b/java/com/android/dialer/app/list/SmartDialNumberListAdapter.java
index 1d2cda3ea..c84bff7fc 100644
--- a/java/com/android/dialer/app/list/SmartDialNumberListAdapter.java
+++ b/java/com/android/dialer/app/list/SmartDialNumberListAdapter.java
@@ -34,13 +34,13 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
private static final String TAG = SmartDialNumberListAdapter.class.getSimpleName();
private static final boolean DEBUG = false;
- private final Context mContext;
- @NonNull private final SmartDialNameMatcher mNameMatcher;
+ private final Context context;
+ @NonNull private final SmartDialNameMatcher nameMatcher;
public SmartDialNumberListAdapter(Context context) {
super(context);
- mContext = context;
- mNameMatcher = new SmartDialNameMatcher("");
+ this.context = context;
+ nameMatcher = new SmartDialNameMatcher("");
setShortcutEnabled(SmartDialNumberListAdapter.SHORTCUT_DIRECT_CALL, false);
if (DEBUG) {
@@ -56,10 +56,10 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
if (getQueryString() == null) {
loader.configureQuery("");
- mNameMatcher.setQuery("");
+ nameMatcher.setQuery("");
} else {
loader.configureQuery(getQueryString());
- mNameMatcher.setQuery(PhoneNumberUtils.normalizeNumber(getQueryString()));
+ nameMatcher.setQuery(PhoneNumberUtils.normalizeNumber(getQueryString()));
}
}
@@ -73,8 +73,8 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
protected void setHighlight(ContactListItemView view, Cursor cursor) {
view.clearHighlightSequences();
- if (mNameMatcher.matches(mContext, cursor.getString(PhoneQuery.DISPLAY_NAME))) {
- final ArrayList<SmartDialMatchPosition> nameMatches = mNameMatcher.getMatchPositions();
+ if (nameMatcher.matches(context, cursor.getString(PhoneQuery.DISPLAY_NAME))) {
+ final ArrayList<SmartDialMatchPosition> nameMatches = nameMatcher.getMatchPositions();
for (SmartDialMatchPosition match : nameMatches) {
view.addNameHighlightSequence(match.start, match.end);
if (DEBUG) {
@@ -82,7 +82,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
TAG,
cursor.getString(PhoneQuery.DISPLAY_NAME)
+ " "
- + mNameMatcher.getQuery()
+ + nameMatcher.getQuery()
+ " "
+ String.valueOf(match.start));
}
@@ -90,7 +90,7 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
}
final SmartDialMatchPosition numberMatch =
- mNameMatcher.matchesNumber(mContext, cursor.getString(PhoneQuery.PHONE_NUMBER));
+ nameMatcher.matchesNumber(context, cursor.getString(PhoneQuery.PHONE_NUMBER));
if (numberMatch != null) {
view.addNumberHighlightSequence(numberMatch.start, numberMatch.end);
}
@@ -113,6 +113,6 @@ public class SmartDialNumberListAdapter extends DialerPhoneNumberListAdapter {
}
public void setShowEmptyListForNullQuery(boolean show) {
- mNameMatcher.setShouldMatchEmptyQuery(!show);
+ nameMatcher.setShouldMatchEmptyQuery(!show);
}
}
diff --git a/java/com/android/dialer/app/list/SmartDialSearchFragment.java b/java/com/android/dialer/app/list/SmartDialSearchFragment.java
index 1a7f19515..fdf0b5a56 100644
--- a/java/com/android/dialer/app/list/SmartDialSearchFragment.java
+++ b/java/com/android/dialer/app/list/SmartDialSearchFragment.java
@@ -43,7 +43,7 @@ public class SmartDialSearchFragment extends SearchFragment
private static final int CALL_PHONE_PERMISSION_REQUEST_CODE = 1;
- private final BroadcastReceiver mSmartDialUpdatedReceiver =
+ private final BroadcastReceiver smartDialUpdatedReceiver =
new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -87,16 +87,16 @@ public class SmartDialSearchFragment extends SearchFragment
@Override
protected void setupEmptyView() {
- if (mEmptyView != null && getActivity() != null) {
+ if (emptyView != null && getActivity() != null) {
if (!PermissionsUtil.hasPermission(getActivity(), CALL_PHONE)) {
- mEmptyView.setImage(R.drawable.empty_contacts);
- mEmptyView.setActionLabel(R.string.permission_single_turn_on);
- mEmptyView.setDescription(R.string.permission_place_call);
- mEmptyView.setActionClickedListener(this);
+ emptyView.setImage(R.drawable.empty_contacts);
+ emptyView.setActionLabel(R.string.permission_single_turn_on);
+ emptyView.setDescription(R.string.permission_place_call);
+ emptyView.setActionClickedListener(this);
} else {
- mEmptyView.setImage(EmptyContentView.NO_IMAGE);
- mEmptyView.setActionLabel(EmptyContentView.NO_LABEL);
- mEmptyView.setDescription(EmptyContentView.NO_LABEL);
+ emptyView.setImage(EmptyContentView.NO_IMAGE);
+ emptyView.setActionLabel(EmptyContentView.NO_LABEL);
+ emptyView.setDescription(EmptyContentView.NO_LABEL);
}
}
}
@@ -109,7 +109,7 @@ public class SmartDialSearchFragment extends SearchFragment
getActivity()
.registerReceiver(
- mSmartDialUpdatedReceiver,
+ smartDialUpdatedReceiver,
new IntentFilter(DialerDatabaseHelper.ACTION_SMART_DIAL_UPDATED));
}
@@ -119,7 +119,7 @@ public class SmartDialSearchFragment extends SearchFragment
LogUtil.i("SmartDialSearchFragment.onStop", "unregistering smart dial update receiver");
- getActivity().unregisterReceiver(mSmartDialUpdatedReceiver);
+ getActivity().unregisterReceiver(smartDialUpdatedReceiver);
}
@Override
@@ -155,7 +155,7 @@ public class SmartDialSearchFragment extends SearchFragment
}
public boolean isShowingPermissionRequest() {
- return mEmptyView != null && mEmptyView.isShowingContent();
+ return emptyView != null && emptyView.isShowingContent();
}
@Override
diff --git a/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java b/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java
index e8e425626..b2cb03ed3 100644
--- a/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java
+++ b/java/com/android/dialer/app/settings/AppCompatPreferenceActivity.java
@@ -30,16 +30,16 @@ import android.view.ViewGroup;
*/
public class AppCompatPreferenceActivity extends PreferenceActivity {
- private AppCompatDelegate mDelegate;
+ private AppCompatDelegate delegate;
- private boolean mIsSafeToCommitTransactions;
+ private boolean isSafeToCommitTransactions;
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
- mIsSafeToCommitTransactions = true;
+ isSafeToCommitTransactions = true;
}
@Override
@@ -113,28 +113,28 @@ public class AppCompatPreferenceActivity extends PreferenceActivity {
}
private AppCompatDelegate getDelegate() {
- if (mDelegate == null) {
- mDelegate = AppCompatDelegate.create(this, null);
+ if (delegate == null) {
+ delegate = AppCompatDelegate.create(this, null);
}
- return mDelegate;
+ return delegate;
}
@Override
protected void onStart() {
super.onStart();
- mIsSafeToCommitTransactions = true;
+ isSafeToCommitTransactions = true;
}
@Override
protected void onResume() {
super.onResume();
- mIsSafeToCommitTransactions = true;
+ isSafeToCommitTransactions = true;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- mIsSafeToCommitTransactions = false;
+ isSafeToCommitTransactions = false;
}
/**
@@ -145,6 +145,6 @@ public class AppCompatPreferenceActivity extends PreferenceActivity {
* outState)} (if that method is overridden), so the flag is properly set.
*/
public boolean isSafeToCommitTransactions() {
- return mIsSafeToCommitTransactions;
+ return isSafeToCommitTransactions;
}
}
diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
index fc56fa7e0..cbd9e7950 100644
--- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java
+++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
@@ -50,7 +50,7 @@ import java.util.List;
@UsedByReflection(value = "AndroidManifest-app.xml")
public class DialerSettingsActivity extends AppCompatPreferenceActivity {
- protected SharedPreferences mPreferences;
+ protected SharedPreferences preferences;
private boolean migrationStatusOnBuildHeaders;
private List<Header> headers;
@@ -58,7 +58,7 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
LogUtil.enterBlock("DialerSettingsActivity.onCreate");
super.onCreate(savedInstanceState);
- mPreferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
+ preferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
Intent intent = getIntent();
Uri data = intent.getData();
diff --git a/java/com/android/dialer/app/settings/SoundSettingsFragment.java b/java/com/android/dialer/app/settings/SoundSettingsFragment.java
index dcfb7a595..19cddbc4f 100644
--- a/java/com/android/dialer/app/settings/SoundSettingsFragment.java
+++ b/java/com/android/dialer/app/settings/SoundSettingsFragment.java
@@ -49,28 +49,28 @@ public class SoundSettingsFragment extends PreferenceFragment
private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
- private Preference mRingtonePreference;
- private final Handler mRingtoneLookupComplete =
+ private Preference ringtonePreference;
+ private final Handler ringtoneLookupComplete =
new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_UPDATE_RINGTONE_SUMMARY:
- mRingtonePreference.setSummary((CharSequence) msg.obj);
+ ringtonePreference.setSummary((CharSequence) msg.obj);
break;
}
}
};
- private final Runnable mRingtoneLookupRunnable =
+ private final Runnable ringtoneLookupRunnable =
new Runnable() {
@Override
public void run() {
updateRingtonePreferenceSummary();
}
};
- private SwitchPreference mVibrateWhenRinging;
- private SwitchPreference mPlayDtmfTone;
- private ListPreference mDtmfToneLength;
+ private SwitchPreference vibrateWhenRinging;
+ private SwitchPreference playDtmfTone;
+ private ListPreference dtmfToneLength;
@Override
public Context getContext() {
@@ -85,39 +85,39 @@ public class SoundSettingsFragment extends PreferenceFragment
Context context = getActivity();
- mRingtonePreference = findPreference(context.getString(R.string.ringtone_preference_key));
- mVibrateWhenRinging =
+ ringtonePreference = findPreference(context.getString(R.string.ringtone_preference_key));
+ vibrateWhenRinging =
(SwitchPreference) findPreference(context.getString(R.string.vibrate_on_preference_key));
- mPlayDtmfTone =
+ playDtmfTone =
(SwitchPreference) findPreference(context.getString(R.string.play_dtmf_preference_key));
- mDtmfToneLength =
+ dtmfToneLength =
(ListPreference)
findPreference(context.getString(R.string.dtmf_tone_length_preference_key));
if (hasVibrator()) {
- mVibrateWhenRinging.setOnPreferenceChangeListener(this);
+ vibrateWhenRinging.setOnPreferenceChangeListener(this);
} else {
- getPreferenceScreen().removePreference(mVibrateWhenRinging);
- mVibrateWhenRinging = null;
+ getPreferenceScreen().removePreference(vibrateWhenRinging);
+ vibrateWhenRinging = null;
}
- mPlayDtmfTone.setOnPreferenceChangeListener(this);
- mPlayDtmfTone.setChecked(shouldPlayDtmfTone());
+ playDtmfTone.setOnPreferenceChangeListener(this);
+ playDtmfTone.setChecked(shouldPlayDtmfTone());
TelephonyManager telephonyManager =
(TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
if (SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M
&& telephonyManager.canChangeDtmfToneLength()
&& (telephonyManager.isWorldPhone() || !shouldHideCarrierSettings())) {
- mDtmfToneLength.setOnPreferenceChangeListener(this);
- mDtmfToneLength.setValueIndex(
+ dtmfToneLength.setOnPreferenceChangeListener(this);
+ dtmfToneLength.setValueIndex(
Settings.System.getInt(
context.getContentResolver(),
Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,
DTMF_TONE_TYPE_NORMAL));
} else {
- getPreferenceScreen().removePreference(mDtmfToneLength);
- mDtmfToneLength = null;
+ getPreferenceScreen().removePreference(dtmfToneLength);
+ dtmfToneLength = null;
}
}
@@ -132,12 +132,12 @@ public class SoundSettingsFragment extends PreferenceFragment
return;
}
- if (mVibrateWhenRinging != null) {
- mVibrateWhenRinging.setChecked(shouldVibrateWhenRinging());
+ if (vibrateWhenRinging != null) {
+ vibrateWhenRinging.setChecked(shouldVibrateWhenRinging());
}
// Lookup the ringtone name asynchronously.
- new Thread(mRingtoneLookupRunnable).start();
+ new Thread(ringtoneLookupRunnable).start();
}
/**
@@ -157,14 +157,14 @@ public class SoundSettingsFragment extends PreferenceFragment
.show();
return true;
}
- if (preference == mVibrateWhenRinging) {
+ if (preference == vibrateWhenRinging) {
boolean doVibrate = (Boolean) objValue;
Settings.System.putInt(
getActivity().getContentResolver(),
Settings.System.VIBRATE_WHEN_RINGING,
doVibrate ? DO_VIBRATION_FOR_CALLS : NO_VIBRATION_FOR_CALLS);
- } else if (preference == mDtmfToneLength) {
- int index = mDtmfToneLength.findIndexOfValue((String) objValue);
+ } else if (preference == dtmfToneLength) {
+ int index = dtmfToneLength.findIndexOfValue((String) objValue);
Settings.System.putInt(
getActivity().getContentResolver(), Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, index);
}
@@ -182,11 +182,11 @@ public class SoundSettingsFragment extends PreferenceFragment
.show();
return true;
}
- if (preference == mPlayDtmfTone) {
+ if (preference == playDtmfTone) {
Settings.System.putInt(
getActivity().getContentResolver(),
Settings.System.DTMF_TONE_WHEN_DIALING,
- mPlayDtmfTone.isChecked() ? PLAY_DTMF_TONE : NO_DTMF_TONE);
+ playDtmfTone.isChecked() ? PLAY_DTMF_TONE : NO_DTMF_TONE);
}
return true;
}
@@ -195,9 +195,9 @@ public class SoundSettingsFragment extends PreferenceFragment
private void updateRingtonePreferenceSummary() {
SettingsUtil.updateRingtoneName(
getActivity(),
- mRingtoneLookupComplete,
+ ringtoneLookupComplete,
RingtoneManager.TYPE_RINGTONE,
- mRingtonePreference.getKey(),
+ ringtonePreference.getKey(),
MSG_UPDATE_RINGTONE_SUMMARY);
}
diff --git a/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java b/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java
index d3c3820d7..79716cb38 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailAudioManager.java
@@ -32,28 +32,28 @@ public final class VoicemailAudioManager
public static final int PLAYBACK_STREAM = AudioManager.STREAM_VOICE_CALL;
- private AudioManager mAudioManager;
- private VoicemailPlaybackPresenter mVoicemailPlaybackPresenter;
- private WiredHeadsetManager mWiredHeadsetManager;
- private boolean mWasSpeakerOn;
- private CallAudioState mCallAudioState;
- private boolean mBluetoothScoEnabled;
+ private AudioManager audioManager;
+ private VoicemailPlaybackPresenter voicemailPlaybackPresenter;
+ private WiredHeadsetManager wiredHeadsetManager;
+ private boolean wasSpeakerOn;
+ private CallAudioState callAudioState;
+ private boolean bluetoothScoEnabled;
public VoicemailAudioManager(
Context context, VoicemailPlaybackPresenter voicemailPlaybackPresenter) {
- mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
- mVoicemailPlaybackPresenter = voicemailPlaybackPresenter;
- mWiredHeadsetManager = new WiredHeadsetManager(context);
- mWiredHeadsetManager.setListener(this);
+ audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+ this.voicemailPlaybackPresenter = voicemailPlaybackPresenter;
+ wiredHeadsetManager = new WiredHeadsetManager(context);
+ wiredHeadsetManager.setListener(this);
- mCallAudioState = getInitialAudioState();
+ callAudioState = getInitialAudioState();
LogUtil.i(
- "VoicemailAudioManager.VoicemailAudioManager", "Initial audioState = " + mCallAudioState);
+ "VoicemailAudioManager.VoicemailAudioManager", "Initial audioState = " + callAudioState);
}
public void requestAudioFocus() {
int result =
- mAudioManager.requestAudioFocus(
+ audioManager.requestAudioFocus(
this, PLAYBACK_STREAM, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
throw new RejectedExecutionException("Could not capture audio focus.");
@@ -63,13 +63,13 @@ public final class VoicemailAudioManager
public void abandonAudioFocus() {
updateBluetoothScoState(false);
- mAudioManager.abandonAudioFocus(this);
+ audioManager.abandonAudioFocus(this);
}
@Override
public void onAudioFocusChange(int focusChange) {
LogUtil.d("VoicemailAudioManager.onAudioFocusChange", "focusChange=" + focusChange);
- mVoicemailPlaybackPresenter.onAudioFocusChange(focusChange == AudioManager.AUDIOFOCUS_GAIN);
+ voicemailPlaybackPresenter.onAudioFocusChange(focusChange == AudioManager.AUDIOFOCUS_GAIN);
}
@Override
@@ -82,19 +82,19 @@ public final class VoicemailAudioManager
return;
}
- int newRoute = mCallAudioState.getRoute(); // start out with existing route
+ int newRoute = callAudioState.getRoute(); // start out with existing route
if (newIsPluggedIn) {
newRoute = CallAudioState.ROUTE_WIRED_HEADSET;
} else {
- mVoicemailPlaybackPresenter.pausePlayback();
- if (mWasSpeakerOn) {
+ voicemailPlaybackPresenter.pausePlayback();
+ if (wasSpeakerOn) {
newRoute = CallAudioState.ROUTE_SPEAKER;
} else {
newRoute = CallAudioState.ROUTE_EARPIECE;
}
}
- mVoicemailPlaybackPresenter.setSpeakerphoneOn(newRoute == CallAudioState.ROUTE_SPEAKER);
+ voicemailPlaybackPresenter.setSpeakerphoneOn(newRoute == CallAudioState.ROUTE_SPEAKER);
// We need to call this every time even if we do not change the route because the supported
// routes changed either to include or not include WIRED_HEADSET.
@@ -107,16 +107,16 @@ public final class VoicemailAudioManager
}
public boolean isWiredHeadsetPluggedIn() {
- return mWiredHeadsetManager.isPluggedIn();
+ return wiredHeadsetManager.isPluggedIn();
}
public void registerReceivers() {
// Receivers is plural because we expect to add bluetooth support.
- mWiredHeadsetManager.registerReceiver();
+ wiredHeadsetManager.registerReceiver();
}
public void unregisterReceivers() {
- mWiredHeadsetManager.unregisterReceiver();
+ wiredHeadsetManager.unregisterReceiver();
}
/**
@@ -127,34 +127,34 @@ public final class VoicemailAudioManager
private void updateBluetoothScoState(boolean hasAudioFocus) {
if (hasAudioFocus) {
if (hasMediaAudioCapability()) {
- mBluetoothScoEnabled = false;
+ bluetoothScoEnabled = false;
} else {
- mBluetoothScoEnabled = true;
+ bluetoothScoEnabled = true;
LogUtil.i(
"VoicemailAudioManager.updateBluetoothScoState",
"bluetooth device doesn't support media, using SCO instead");
}
} else {
- mBluetoothScoEnabled = false;
+ bluetoothScoEnabled = false;
}
applyBluetoothScoState();
}
private void applyBluetoothScoState() {
- if (mBluetoothScoEnabled) {
- mAudioManager.startBluetoothSco();
+ if (bluetoothScoEnabled) {
+ audioManager.startBluetoothSco();
// The doc for startBluetoothSco() states it could take seconds to establish the SCO
// connection, so we should probably resume the playback after we've acquired SCO.
// In practice the delay is unnoticeable so this is ignored for simplicity.
- mAudioManager.setBluetoothScoOn(true);
+ audioManager.setBluetoothScoOn(true);
} else {
- mAudioManager.setBluetoothScoOn(false);
- mAudioManager.stopBluetoothSco();
+ audioManager.setBluetoothScoOn(false);
+ audioManager.stopBluetoothSco();
}
}
private boolean hasMediaAudioCapability() {
- for (AudioDeviceInfo info : mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)) {
+ for (AudioDeviceInfo info : audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)) {
if (info.getType() == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP) {
return true;
}
@@ -173,10 +173,10 @@ public final class VoicemailAudioManager
"route: " + CallAudioState.audioRouteToString(route));
// Change ROUTE_WIRED_OR_EARPIECE to a single entry.
- int newRoute = selectWiredOrEarpiece(route, mCallAudioState.getSupportedRouteMask());
+ int newRoute = selectWiredOrEarpiece(route, callAudioState.getSupportedRouteMask());
// If route is unsupported, do nothing.
- if ((mCallAudioState.getSupportedRouteMask() | newRoute) == 0) {
+ if ((callAudioState.getSupportedRouteMask() | newRoute) == 0) {
LogUtil.w(
"VoicemailAudioManager.setAudioRoute",
"Asking to set to a route that is unsupported: " + newRoute);
@@ -185,9 +185,9 @@ public final class VoicemailAudioManager
// Remember the new speaker state so it can be restored when the user plugs and unplugs
// a headset.
- mWasSpeakerOn = newRoute == CallAudioState.ROUTE_SPEAKER;
+ wasSpeakerOn = newRoute == CallAudioState.ROUTE_SPEAKER;
setSystemAudioState(
- new CallAudioState(false /* muted */, newRoute, mCallAudioState.getSupportedRouteMask()));
+ new CallAudioState(false /* muted */, newRoute, callAudioState.getSupportedRouteMask()));
}
private CallAudioState getInitialAudioState() {
@@ -198,7 +198,7 @@ public final class VoicemailAudioManager
private int calculateSupportedRoutes() {
int routeMask = CallAudioState.ROUTE_SPEAKER;
- if (mWiredHeadsetManager.isPluggedIn()) {
+ if (wiredHeadsetManager.isPluggedIn()) {
routeMask |= CallAudioState.ROUTE_WIRED_HEADSET;
} else {
routeMask |= CallAudioState.ROUTE_EARPIECE;
@@ -224,18 +224,18 @@ public final class VoicemailAudioManager
}
private void setSystemAudioState(CallAudioState callAudioState) {
- CallAudioState oldAudioState = mCallAudioState;
- mCallAudioState = callAudioState;
+ CallAudioState oldAudioState = this.callAudioState;
+ this.callAudioState = callAudioState;
LogUtil.i(
"VoicemailAudioManager.setSystemAudioState",
- "changing from " + oldAudioState + " to " + mCallAudioState);
+ "changing from " + oldAudioState + " to " + this.callAudioState);
// Audio route.
- if (mCallAudioState.getRoute() == CallAudioState.ROUTE_SPEAKER) {
+ if (this.callAudioState.getRoute() == CallAudioState.ROUTE_SPEAKER) {
turnOnSpeaker(true);
- } else if (mCallAudioState.getRoute() == CallAudioState.ROUTE_EARPIECE
- || mCallAudioState.getRoute() == CallAudioState.ROUTE_WIRED_HEADSET) {
+ } else if (this.callAudioState.getRoute() == CallAudioState.ROUTE_EARPIECE
+ || this.callAudioState.getRoute() == CallAudioState.ROUTE_WIRED_HEADSET) {
// Just handle turning off the speaker, the system will handle switching between wired
// headset and earpiece.
turnOnSpeaker(false);
@@ -245,9 +245,9 @@ public final class VoicemailAudioManager
}
private void turnOnSpeaker(boolean on) {
- if (mAudioManager.isSpeakerphoneOn() != on) {
+ if (audioManager.isSpeakerphoneOn() != on) {
LogUtil.i("VoicemailAudioManager.turnOnSpeaker", "turning speaker phone on: " + on);
- mAudioManager.setSpeakerphoneOn(on);
+ audioManager.setSpeakerphoneOn(on);
}
}
}
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java
index 9c1e446ab..010f55fa8 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java
@@ -58,27 +58,27 @@ public class VoicemailPlaybackLayout extends LinearLayout
private static final String TAG = VoicemailPlaybackLayout.class.getSimpleName();
private static final int VOICEMAIL_DELETE_DELAY_MS = 3000;
- private Context mContext;
- private CallLogListItemViewHolder mViewHolder;
- private VoicemailPlaybackPresenter mPresenter;
+ private Context context;
+ private CallLogListItemViewHolder viewHolder;
+ private VoicemailPlaybackPresenter presenter;
/** Click listener to toggle speakerphone. */
- private final View.OnClickListener mSpeakerphoneListener =
+ private final View.OnClickListener speakerphoneListener =
new View.OnClickListener() {
@Override
public void onClick(View v) {
- if (mPresenter != null) {
- mPresenter.toggleSpeakerphone();
+ if (presenter != null) {
+ presenter.toggleSpeakerphone();
}
}
};
- private Uri mVoicemailUri;
- private final View.OnClickListener mDeleteButtonListener =
+ private Uri voicemailUri;
+ private final View.OnClickListener deleteButtonListener =
new View.OnClickListener() {
@Override
public void onClick(View view) {
- Logger.get(mContext).logImpression(DialerImpression.Type.VOICEMAIL_DELETE_ENTRY);
- if (mPresenter == null) {
+ Logger.get(context).logImpression(DialerImpression.Type.VOICEMAIL_DELETE_ENTRY);
+ if (presenter == null) {
return;
}
@@ -86,19 +86,19 @@ public class VoicemailPlaybackLayout extends LinearLayout
// we hide the view it is binded to something else, and the layout is not updated for
// hidden items. copy the adapter position so we can update the view upon undo.
// TODO(twyen): refactor this so the view holder will always be valid.
- final int adapterPosition = mViewHolder.getAdapterPosition();
+ final int adapterPosition = viewHolder.getAdapterPosition();
- mPresenter.pausePlayback();
- mPresenter.onVoicemailDeleted(mViewHolder);
+ presenter.pausePlayback();
+ presenter.onVoicemailDeleted(viewHolder);
- final Uri deleteUri = mVoicemailUri;
+ final Uri deleteUri = voicemailUri;
final Runnable deleteCallback =
new Runnable() {
@Override
public void run() {
- if (Objects.equals(deleteUri, mVoicemailUri)) {
+ if (Objects.equals(deleteUri, voicemailUri)) {
CallLogAsyncTaskUtil.deleteVoicemail(
- mContext, deleteUri, VoicemailPlaybackLayout.this);
+ context, deleteUri, VoicemailPlaybackLayout.this);
}
}
};
@@ -118,56 +118,56 @@ public class VoicemailPlaybackLayout extends LinearLayout
new View.OnClickListener() {
@Override
public void onClick(View view) {
- mPresenter.onVoicemailDeleteUndo(adapterPosition);
+ presenter.onVoicemailDeleteUndo(adapterPosition);
handler.removeCallbacks(deleteCallback);
}
})
.setActionTextColor(
- mContext.getResources().getColor(R.color.dialer_snackbar_action_text_color))
+ context.getResources().getColor(R.color.dialer_snackbar_action_text_color))
.show();
}
};
- private boolean mIsPlaying = false;
+ private boolean isPlaying = false;
/** Click listener to play or pause voicemail playback. */
- private final View.OnClickListener mStartStopButtonListener =
+ private final View.OnClickListener startStopButtonListener =
new View.OnClickListener() {
@Override
public void onClick(View view) {
- if (mPresenter == null) {
+ if (presenter == null) {
return;
}
- if (mIsPlaying) {
- mPresenter.pausePlayback();
+ if (isPlaying) {
+ presenter.pausePlayback();
} else {
- Logger.get(mContext)
+ Logger.get(context)
.logImpression(DialerImpression.Type.VOICEMAIL_PLAY_AUDIO_AFTER_EXPANDING_ENTRY);
- mPresenter.resumePlayback();
+ presenter.resumePlayback();
}
}
};
- private SeekBar mPlaybackSeek;
- private ImageButton mStartStopButton;
- private ImageButton mPlaybackSpeakerphone;
- private ImageButton mDeleteButton;
- private TextView mStateText;
- private TextView mPositionText;
- private TextView mTotalDurationText;
+ private SeekBar playbackSeek;
+ private ImageButton startStopButton;
+ private ImageButton playbackSpeakerphone;
+ private ImageButton deleteButton;
+ private TextView stateText;
+ private TextView positionText;
+ private TextView totalDurationText;
/** Handle state changes when the user manipulates the seek bar. */
- private final OnSeekBarChangeListener mSeekBarChangeListener =
+ private final OnSeekBarChangeListener seekBarChangeListener =
new OnSeekBarChangeListener() {
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
- if (mPresenter != null) {
- mPresenter.pausePlaybackForSeeking();
+ if (presenter != null) {
+ presenter.pausePlaybackForSeeking();
}
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
- if (mPresenter != null) {
- mPresenter.resumePlaybackAfterSeeking(seekBar.getProgress());
+ if (presenter != null) {
+ presenter.resumePlaybackAfterSeeking(seekBar.getProgress());
}
}
@@ -177,14 +177,14 @@ public class VoicemailPlaybackLayout extends LinearLayout
// Update the seek position if user manually changed it. This makes sure position gets
// updated when user use volume button to seek playback in talkback mode.
if (fromUser) {
- mPresenter.seek(progress);
+ presenter.seek(progress);
}
}
};
- private PositionUpdater mPositionUpdater;
- private Drawable mVoicemailSeekHandleEnabled;
- private Drawable mVoicemailSeekHandleDisabled;
+ private PositionUpdater positionUpdater;
+ private Drawable voicemailSeekHandleEnabled;
+ private Drawable voicemailSeekHandleDisabled;
public VoicemailPlaybackLayout(Context context) {
this(context, null);
@@ -192,99 +192,97 @@ public class VoicemailPlaybackLayout extends LinearLayout
public VoicemailPlaybackLayout(Context context, AttributeSet attrs) {
super(context, attrs);
- mContext = context;
+ this.context = context;
LayoutInflater inflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.voicemail_playback_layout, this);
}
public void setViewHolder(CallLogListItemViewHolder mViewHolder) {
- this.mViewHolder = mViewHolder;
+ this.viewHolder = mViewHolder;
}
@Override
public void setPresenter(VoicemailPlaybackPresenter presenter, Uri voicemailUri) {
- mPresenter = presenter;
- mVoicemailUri = voicemailUri;
+ this.presenter = presenter;
+ this.voicemailUri = voicemailUri;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mPlaybackSeek = (SeekBar) findViewById(R.id.playback_seek);
- mStartStopButton = (ImageButton) findViewById(R.id.playback_start_stop);
- mPlaybackSpeakerphone = (ImageButton) findViewById(R.id.playback_speakerphone);
- mDeleteButton = (ImageButton) findViewById(R.id.delete_voicemail);
+ playbackSeek = (SeekBar) findViewById(R.id.playback_seek);
+ startStopButton = (ImageButton) findViewById(R.id.playback_start_stop);
+ playbackSpeakerphone = (ImageButton) findViewById(R.id.playback_speakerphone);
+ deleteButton = (ImageButton) findViewById(R.id.delete_voicemail);
- mStateText = (TextView) findViewById(R.id.playback_state_text);
- mStateText.setAccessibilityLiveRegion(ACCESSIBILITY_LIVE_REGION_POLITE);
- mPositionText = (TextView) findViewById(R.id.playback_position_text);
- mTotalDurationText = (TextView) findViewById(R.id.total_duration_text);
+ stateText = (TextView) findViewById(R.id.playback_state_text);
+ stateText.setAccessibilityLiveRegion(ACCESSIBILITY_LIVE_REGION_POLITE);
+ positionText = (TextView) findViewById(R.id.playback_position_text);
+ totalDurationText = (TextView) findViewById(R.id.total_duration_text);
- mPlaybackSeek.setOnSeekBarChangeListener(mSeekBarChangeListener);
- mStartStopButton.setOnClickListener(mStartStopButtonListener);
- mPlaybackSpeakerphone.setOnClickListener(mSpeakerphoneListener);
- mDeleteButton.setOnClickListener(mDeleteButtonListener);
+ playbackSeek.setOnSeekBarChangeListener(seekBarChangeListener);
+ startStopButton.setOnClickListener(startStopButtonListener);
+ playbackSpeakerphone.setOnClickListener(speakerphoneListener);
+ deleteButton.setOnClickListener(deleteButtonListener);
- mPositionText.setText(formatAsMinutesAndSeconds(0));
- mTotalDurationText.setText(formatAsMinutesAndSeconds(0));
+ positionText.setText(formatAsMinutesAndSeconds(0));
+ totalDurationText.setText(formatAsMinutesAndSeconds(0));
- mVoicemailSeekHandleEnabled =
- getResources().getDrawable(R.drawable.ic_voicemail_seek_handle, mContext.getTheme());
- mVoicemailSeekHandleDisabled =
+ voicemailSeekHandleEnabled =
+ getResources().getDrawable(R.drawable.ic_voicemail_seek_handle, context.getTheme());
+ voicemailSeekHandleDisabled =
getResources()
- .getDrawable(R.drawable.ic_voicemail_seek_handle_disabled, mContext.getTheme());
+ .getDrawable(R.drawable.ic_voicemail_seek_handle_disabled, context.getTheme());
}
@Override
public void onPlaybackStarted(int duration, ScheduledExecutorService executorService) {
- mIsPlaying = true;
+ isPlaying = true;
- mStartStopButton.setImageResource(R.drawable.ic_pause);
+ startStopButton.setImageResource(R.drawable.ic_pause);
- if (mPositionUpdater != null) {
- mPositionUpdater.stopUpdating();
- mPositionUpdater = null;
+ if (positionUpdater != null) {
+ positionUpdater.stopUpdating();
+ positionUpdater = null;
}
- mPositionUpdater = new PositionUpdater(duration, executorService);
- mPositionUpdater.startUpdating();
+ positionUpdater = new PositionUpdater(duration, executorService);
+ positionUpdater.startUpdating();
}
@Override
public void onPlaybackStopped() {
- mIsPlaying = false;
+ isPlaying = false;
- mStartStopButton.setImageResource(R.drawable.ic_play_arrow);
+ startStopButton.setImageResource(R.drawable.ic_play_arrow);
- if (mPositionUpdater != null) {
- mPositionUpdater.stopUpdating();
- mPositionUpdater = null;
+ if (positionUpdater != null) {
+ positionUpdater.stopUpdating();
+ positionUpdater = null;
}
}
@Override
public void onPlaybackError() {
- if (mPositionUpdater != null) {
- mPositionUpdater.stopUpdating();
+ if (positionUpdater != null) {
+ positionUpdater.stopUpdating();
}
disableUiElements();
- mStateText.setText(getString(R.string.voicemail_playback_error));
+ stateText.setText(getString(R.string.voicemail_playback_error));
}
@Override
public void onSpeakerphoneOn(boolean on) {
if (on) {
- mPlaybackSpeakerphone.setImageResource(R.drawable.quantum_ic_volume_up_white_24);
+ playbackSpeakerphone.setImageResource(R.drawable.quantum_ic_volume_up_white_24);
// Speaker is now on, tapping button will turn it off.
- mPlaybackSpeakerphone.setContentDescription(
- mContext.getString(R.string.voicemail_speaker_off));
+ playbackSpeakerphone.setContentDescription(context.getString(R.string.voicemail_speaker_off));
} else {
- mPlaybackSpeakerphone.setImageResource(R.drawable.quantum_ic_volume_down_white_24);
+ playbackSpeakerphone.setImageResource(R.drawable.quantum_ic_volume_down_white_24);
// Speaker is now off, tapping button will turn it on.
- mPlaybackSpeakerphone.setContentDescription(
- mContext.getString(R.string.voicemail_speaker_on));
+ playbackSpeakerphone.setContentDescription(context.getString(R.string.voicemail_speaker_on));
}
}
@@ -292,66 +290,66 @@ public class VoicemailPlaybackLayout extends LinearLayout
public void setClipPosition(int positionMs, int durationMs) {
int seekBarPositionMs = Math.max(0, positionMs);
int seekBarMax = Math.max(seekBarPositionMs, durationMs);
- if (mPlaybackSeek.getMax() != seekBarMax) {
- mPlaybackSeek.setMax(seekBarMax);
+ if (playbackSeek.getMax() != seekBarMax) {
+ playbackSeek.setMax(seekBarMax);
}
- mPlaybackSeek.setProgress(seekBarPositionMs);
+ playbackSeek.setProgress(seekBarPositionMs);
- mPositionText.setText(formatAsMinutesAndSeconds(seekBarPositionMs));
- mTotalDurationText.setText(formatAsMinutesAndSeconds(durationMs));
+ positionText.setText(formatAsMinutesAndSeconds(seekBarPositionMs));
+ totalDurationText.setText(formatAsMinutesAndSeconds(durationMs));
}
@Override
public void setSuccess() {
- mStateText.setText(null);
+ stateText.setText(null);
}
@Override
public void setIsFetchingContent() {
disableUiElements();
- mStateText.setText(getString(R.string.voicemail_fetching_content));
+ stateText.setText(getString(R.string.voicemail_fetching_content));
}
@Override
public void setFetchContentTimeout() {
- mStartStopButton.setEnabled(true);
- mStateText.setText(getString(R.string.voicemail_fetching_timout));
+ startStopButton.setEnabled(true);
+ stateText.setText(getString(R.string.voicemail_fetching_timout));
}
@Override
public int getDesiredClipPosition() {
- return mPlaybackSeek.getProgress();
+ return playbackSeek.getProgress();
}
@Override
public void disableUiElements() {
- mStartStopButton.setEnabled(false);
+ startStopButton.setEnabled(false);
resetSeekBar();
}
@Override
public void enableUiElements() {
- mDeleteButton.setEnabled(true);
- mStartStopButton.setEnabled(true);
- mPlaybackSeek.setEnabled(true);
- mPlaybackSeek.setThumb(mVoicemailSeekHandleEnabled);
+ deleteButton.setEnabled(true);
+ startStopButton.setEnabled(true);
+ playbackSeek.setEnabled(true);
+ playbackSeek.setThumb(voicemailSeekHandleEnabled);
}
@Override
public void resetSeekBar() {
- mPlaybackSeek.setProgress(0);
- mPlaybackSeek.setEnabled(false);
- mPlaybackSeek.setThumb(mVoicemailSeekHandleDisabled);
+ playbackSeek.setProgress(0);
+ playbackSeek.setEnabled(false);
+ playbackSeek.setThumb(voicemailSeekHandleDisabled);
}
@Override
public void onDeleteVoicemail() {
- mPresenter.onVoicemailDeletedInDatabase();
+ presenter.onVoicemailDeletedInDatabase();
}
private String getString(int resId) {
- return mContext.getString(resId);
+ return context.getString(resId);
}
/**
@@ -372,7 +370,7 @@ public class VoicemailPlaybackLayout extends LinearLayout
@VisibleForTesting
public String getStateText() {
- return mStateText.getText().toString();
+ return stateText.getText().toString();
}
/** Controls the animation of the playback slider. */
@@ -382,61 +380,61 @@ public class VoicemailPlaybackLayout extends LinearLayout
/** Update rate for the slider, 30fps. */
private static final int SLIDER_UPDATE_PERIOD_MILLIS = 1000 / 30;
- private final ScheduledExecutorService mExecutorService;
- private final Object mLock = new Object();
- private int mDurationMs;
+ private final ScheduledExecutorService executorService;
+ private final Object lock = new Object();
+ private int durationMs;
- @GuardedBy("mLock")
- private ScheduledFuture<?> mScheduledFuture;
+ @GuardedBy("lock")
+ private ScheduledFuture<?> scheduledFuture;
- private Runnable mUpdateClipPositionRunnable =
+ private Runnable updateClipPositionRunnable =
new Runnable() {
@Override
public void run() {
int currentPositionMs = 0;
- synchronized (mLock) {
- if (mScheduledFuture == null || mPresenter == null) {
+ synchronized (lock) {
+ if (scheduledFuture == null || presenter == null) {
// This task has been canceled. Just stop now.
return;
}
- currentPositionMs = mPresenter.getMediaPlayerPosition();
+ currentPositionMs = presenter.getMediaPlayerPosition();
}
- setClipPosition(currentPositionMs, mDurationMs);
+ setClipPosition(currentPositionMs, durationMs);
}
};
public PositionUpdater(int durationMs, ScheduledExecutorService executorService) {
- mDurationMs = durationMs;
- mExecutorService = executorService;
+ this.durationMs = durationMs;
+ this.executorService = executorService;
}
@Override
public void run() {
- post(mUpdateClipPositionRunnable);
+ post(updateClipPositionRunnable);
}
public void startUpdating() {
- synchronized (mLock) {
+ synchronized (lock) {
cancelPendingRunnables();
- mScheduledFuture =
- mExecutorService.scheduleAtFixedRate(
+ scheduledFuture =
+ executorService.scheduleAtFixedRate(
this, 0, SLIDER_UPDATE_PERIOD_MILLIS, TimeUnit.MILLISECONDS);
}
}
public void stopUpdating() {
- synchronized (mLock) {
+ synchronized (lock) {
cancelPendingRunnables();
}
}
- @GuardedBy("mLock")
+ @GuardedBy("lock")
private void cancelPendingRunnables() {
- if (mScheduledFuture != null) {
- mScheduledFuture.cancel(true);
- mScheduledFuture = null;
+ if (scheduledFuture != null) {
+ scheduledFuture.cancel(true);
+ scheduledFuture = null;
}
- removeCallbacks(mUpdateClipPositionRunnable);
+ removeCallbacks(updateClipPositionRunnable);
}
}
}
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
index 10afe479f..e9b64dfe3 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
@@ -113,41 +113,41 @@ public class VoicemailPlaybackPresenter
private static final String VOICEMAIL_SHARE_FILE_NAME_DATE_FORMAT = "MM-dd-yy_hhmmaa";
private static final String CONFIG_SHARE_VOICEMAIL_ALLOWED = "share_voicemail_allowed";
- private static VoicemailPlaybackPresenter sInstance;
- private static ScheduledExecutorService mScheduledExecutorService;
+ private static VoicemailPlaybackPresenter instance;
+ private static ScheduledExecutorService scheduledExecutorService;
/**
* The most recently cached duration. We cache this since we don't want to keep requesting it from
* the player, as this can easily lead to throwing {@link IllegalStateException} (any time the
* player is released, it's illegal to ask for the duration).
*/
- private final AtomicInteger mDuration = new AtomicInteger(0);
+ private final AtomicInteger duration = new AtomicInteger(0);
- protected Context mContext;
- private long mRowId;
- protected Uri mVoicemailUri;
- protected MediaPlayer mMediaPlayer;
+ protected Context context;
+ private long rowId;
+ protected Uri voicemailUri;
+ protected MediaPlayer mediaPlayer;
// Used to run async tasks that need to interact with the UI.
- protected AsyncTaskExecutor mAsyncTaskExecutor;
- private Activity mActivity;
- private PlaybackView mView;
- private int mPosition;
- private boolean mIsPlaying;
+ protected AsyncTaskExecutor asyncTaskExecutor;
+ private Activity activity;
+ private PlaybackView view;
+ private int position;
+ private boolean isPlaying;
// MediaPlayer crashes on some method calls if not prepared but does not have a method which
// exposes its prepared state. Store this locally, so we can check and prevent crashes.
- private boolean mIsPrepared;
- private boolean mIsSpeakerphoneOn;
+ private boolean isPrepared;
+ private boolean isSpeakerphoneOn;
- private boolean mShouldResumePlaybackAfterSeeking;
+ private boolean shouldResumePlaybackAfterSeeking;
/**
* Used to handle the result of a successful or time-out fetch result.
*
* <p>This variable is thread-contained, accessed only on the ui thread.
*/
- private FetchResultHandler mFetchResultHandler;
+ private FetchResultHandler fetchResultHandler;
- private PowerManager.WakeLock mProximityWakeLock;
- private VoicemailAudioManager mVoicemailAudioManager;
- private OnVoicemailDeletedListener mOnVoicemailDeletedListener;
+ private PowerManager.WakeLock proximityWakeLock;
+ private VoicemailAudioManager voicemailAudioManager;
+ private OnVoicemailDeletedListener onVoicemailDeletedListener;
private View shareVoicemailButtonView;
private DialerExecutor<Pair<Context, Uri>> shareVoicemailExecutor;
@@ -155,11 +155,11 @@ public class VoicemailPlaybackPresenter
/** Initialize variables which are activity-independent and state-independent. */
protected VoicemailPlaybackPresenter(Activity activity) {
Context context = activity.getApplicationContext();
- mAsyncTaskExecutor = AsyncTaskExecutors.createAsyncTaskExecutor();
- mVoicemailAudioManager = new VoicemailAudioManager(context, this);
+ asyncTaskExecutor = AsyncTaskExecutors.createAsyncTaskExecutor();
+ voicemailAudioManager = new VoicemailAudioManager(context, this);
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
if (powerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
- mProximityWakeLock =
+ proximityWakeLock =
powerManager.newWakeLock(
PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "VoicemailPlaybackPresenter");
}
@@ -177,63 +177,63 @@ public class VoicemailPlaybackPresenter
@MainThread
public static VoicemailPlaybackPresenter getInstance(
Activity activity, Bundle savedInstanceState) {
- if (sInstance == null) {
- sInstance = new VoicemailPlaybackPresenter(activity);
+ if (instance == null) {
+ instance = new VoicemailPlaybackPresenter(activity);
}
- sInstance.init(activity, savedInstanceState);
- return sInstance;
+ instance.init(activity, savedInstanceState);
+ return instance;
}
private static synchronized ScheduledExecutorService getScheduledExecutorServiceInstance() {
- if (mScheduledExecutorService == null) {
- mScheduledExecutorService = Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL);
+ if (scheduledExecutorService == null) {
+ scheduledExecutorService = Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL);
}
- return mScheduledExecutorService;
+ return scheduledExecutorService;
}
/** Update variables which are activity-dependent or state-dependent. */
@MainThread
protected void init(Activity activity, Bundle savedInstanceState) {
Assert.isMainThread();
- mActivity = activity;
- mContext = activity;
+ this.activity = activity;
+ context = activity;
if (savedInstanceState != null) {
// Restores playback state when activity is recreated, such as after rotation.
- mVoicemailUri = savedInstanceState.getParcelable(VOICEMAIL_URI_KEY);
- mIsPrepared = savedInstanceState.getBoolean(IS_PREPARED_KEY);
- mPosition = savedInstanceState.getInt(CLIP_POSITION_KEY, 0);
- mIsPlaying = savedInstanceState.getBoolean(IS_PLAYING_STATE_KEY, false);
- mIsSpeakerphoneOn = savedInstanceState.getBoolean(IS_SPEAKERPHONE_ON_KEY, false);
+ voicemailUri = savedInstanceState.getParcelable(VOICEMAIL_URI_KEY);
+ isPrepared = savedInstanceState.getBoolean(IS_PREPARED_KEY);
+ position = savedInstanceState.getInt(CLIP_POSITION_KEY, 0);
+ isPlaying = savedInstanceState.getBoolean(IS_PLAYING_STATE_KEY, false);
+ isSpeakerphoneOn = savedInstanceState.getBoolean(IS_SPEAKERPHONE_ON_KEY, false);
}
- if (mMediaPlayer == null) {
- mIsPrepared = false;
- mIsPlaying = false;
+ if (mediaPlayer == null) {
+ isPrepared = false;
+ isPlaying = false;
}
- if (mActivity != null) {
+ if (this.activity != null) {
if (isPlaying()) {
- mActivity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
+ this.activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
- mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
+ this.activity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
}
shareVoicemailExecutor =
- DialerExecutorComponent.get(mContext)
+ DialerExecutorComponent.get(context)
.dialerExecutorFactory()
.createUiTaskBuilder(
- mActivity.getFragmentManager(), "shareVoicemail", new ShareVoicemailWorker())
+ this.activity.getFragmentManager(), "shareVoicemail", new ShareVoicemailWorker())
.onSuccess(
output -> {
if (output == null) {
LogUtil.e("VoicemailAsyncTaskUtil.shareVoicemail", "failed to get voicemail");
return;
}
- mContext.startActivity(
+ context.startActivity(
Intent.createChooser(
- getShareIntent(mContext, output.first, output.second),
- mContext
+ getShareIntent(context, output.first, output.second),
+ context
.getResources()
.getText(R.string.call_log_action_share_voicemail)));
})
@@ -243,12 +243,12 @@ public class VoicemailPlaybackPresenter
/** Must be invoked when the parent Activity is saving it state. */
public void onSaveInstanceState(Bundle outState) {
- if (mView != null) {
- outState.putParcelable(VOICEMAIL_URI_KEY, mVoicemailUri);
- outState.putBoolean(IS_PREPARED_KEY, mIsPrepared);
- outState.putInt(CLIP_POSITION_KEY, mView.getDesiredClipPosition());
- outState.putBoolean(IS_PLAYING_STATE_KEY, mIsPlaying);
- outState.putBoolean(IS_SPEAKERPHONE_ON_KEY, mIsSpeakerphoneOn);
+ if (view != null) {
+ outState.putParcelable(VOICEMAIL_URI_KEY, voicemailUri);
+ outState.putBoolean(IS_PREPARED_KEY, isPrepared);
+ outState.putInt(CLIP_POSITION_KEY, view.getDesiredClipPosition());
+ outState.putBoolean(IS_PLAYING_STATE_KEY, isPlaying);
+ outState.putBoolean(IS_SPEAKERPHONE_ON_KEY, isSpeakerphoneOn);
}
}
@@ -259,26 +259,26 @@ public class VoicemailPlaybackPresenter
Uri voicemailUri,
final boolean startPlayingImmediately,
View shareVoicemailButtonView) {
- mRowId = rowId;
- mView = view;
- mView.setPresenter(this, voicemailUri);
- mView.onSpeakerphoneOn(mIsSpeakerphoneOn);
+ this.rowId = rowId;
+ this.view = view;
+ this.view.setPresenter(this, voicemailUri);
+ this.view.onSpeakerphoneOn(isSpeakerphoneOn);
this.shareVoicemailButtonView = shareVoicemailButtonView;
showShareVoicemailButton(false);
// Handles cases where the same entry is binded again when scrolling in list, or where
// the MediaPlayer was retained after an orientation change.
- if (mMediaPlayer != null && mIsPrepared && voicemailUri.equals(mVoicemailUri)) {
+ if (mediaPlayer != null && isPrepared && voicemailUri.equals(this.voicemailUri)) {
// If the voicemail card was rebinded, we need to set the position to the appropriate
// point. Since we retain the media player, we can just set it to the position of the
// media player.
- mPosition = mMediaPlayer.getCurrentPosition();
- onPrepared(mMediaPlayer);
+ position = mediaPlayer.getCurrentPosition();
+ onPrepared(mediaPlayer);
showShareVoicemailButton(true);
} else {
- if (!voicemailUri.equals(mVoicemailUri)) {
- mVoicemailUri = voicemailUri;
- mPosition = 0;
+ if (!voicemailUri.equals(this.voicemailUri)) {
+ this.voicemailUri = voicemailUri;
+ position = 0;
}
/*
* Check to see if the content field in the DB is set. If set, we proceed to
@@ -294,9 +294,9 @@ public class VoicemailPlaybackPresenter
if (startPlayingImmediately) {
requestContent(PLAYBACK_REQUEST);
}
- if (mView != null) {
- mView.resetSeekBar();
- mView.setClipPosition(0, mDuration.get());
+ if (this.view != null) {
+ this.view.resetSeekBar();
+ this.view.setClipPosition(0, duration.get());
}
}
});
@@ -305,7 +305,7 @@ public class VoicemailPlaybackPresenter
// Since setPlaybackView can get called during the view binding process, we don't
// want to reset mIsPlaying to false if the user is currently playing the
// voicemail and the view is rebound.
- mIsPlaying = startPlayingImmediately;
+ isPlaying = startPlayingImmediately;
}
}
}
@@ -314,8 +314,8 @@ public class VoicemailPlaybackPresenter
public void resetAll() {
pausePresenter(true);
- mView = null;
- mVoicemailUri = null;
+ view = null;
+ voicemailUri = null;
}
/**
@@ -327,41 +327,41 @@ public class VoicemailPlaybackPresenter
*/
public void pausePresenter(boolean reset) {
pausePlayback();
- if (mMediaPlayer != null) {
- mMediaPlayer.release();
- mMediaPlayer = null;
+ if (mediaPlayer != null) {
+ mediaPlayer.release();
+ mediaPlayer = null;
}
disableProximitySensor(false /* waitForFarState */);
- mIsPrepared = false;
- mIsPlaying = false;
+ isPrepared = false;
+ isPlaying = false;
if (reset) {
// We want to reset the position whether or not the view is valid.
- mPosition = 0;
+ position = 0;
}
- if (mView != null) {
- mView.onPlaybackStopped();
+ if (view != null) {
+ view.onPlaybackStopped();
if (reset) {
- mView.setClipPosition(0, mDuration.get());
+ view.setClipPosition(0, duration.get());
} else {
- mPosition = mView.getDesiredClipPosition();
+ position = view.getDesiredClipPosition();
}
}
}
/** Must be invoked when the parent activity is resumed. */
public void onResume() {
- mVoicemailAudioManager.registerReceivers();
+ voicemailAudioManager.registerReceivers();
}
/** Must be invoked when the parent activity is paused. */
public void onPause() {
- mVoicemailAudioManager.unregisterReceivers();
+ voicemailAudioManager.unregisterReceivers();
- if (mActivity != null && mIsPrepared && mActivity.isChangingConfigurations()) {
+ if (activity != null && isPrepared && activity.isChangingConfigurations()) {
// If an configuration change triggers the pause, retain the MediaPlayer.
LogUtil.d("VoicemailPlaybackPresenter.onPause", "configuration changed.");
return;
@@ -374,28 +374,28 @@ public class VoicemailPlaybackPresenter
/** Must be invoked when the parent activity is destroyed. */
public void onDestroy() {
// Clear references to avoid leaks from the singleton instance.
- mActivity = null;
- mContext = null;
+ activity = null;
+ context = null;
- if (mScheduledExecutorService != null) {
- mScheduledExecutorService.shutdown();
- mScheduledExecutorService = null;
+ if (scheduledExecutorService != null) {
+ scheduledExecutorService.shutdown();
+ scheduledExecutorService = null;
}
- if (mFetchResultHandler != null) {
- mFetchResultHandler.destroy();
- mFetchResultHandler = null;
+ if (fetchResultHandler != null) {
+ fetchResultHandler.destroy();
+ fetchResultHandler = null;
}
}
/** Checks to see if we have content available for this voicemail. */
protected void checkForContent(final OnContentCheckedListener callback) {
- mAsyncTaskExecutor.submit(
+ asyncTaskExecutor.submit(
Tasks.CHECK_FOR_CONTENT,
new AsyncTask<Void, Void, Boolean>() {
@Override
public Boolean doInBackground(Void... params) {
- return queryHasContent(mVoicemailUri);
+ return queryHasContent(voicemailUri);
}
@Override
@@ -406,17 +406,17 @@ public class VoicemailPlaybackPresenter
}
private boolean queryHasContent(Uri voicemailUri) {
- if (voicemailUri == null || mContext == null) {
+ if (voicemailUri == null || context == null) {
return false;
}
- ContentResolver contentResolver = mContext.getContentResolver();
+ ContentResolver contentResolver = context.getContentResolver();
Cursor cursor = contentResolver.query(voicemailUri, null, null, null, null);
try {
if (cursor != null && cursor.moveToNext()) {
int duration = cursor.getInt(cursor.getColumnIndex(VoicemailContract.Voicemails.DURATION));
// Convert database duration (seconds) into mDuration (milliseconds)
- mDuration.set(duration > 0 ? duration * 1000 : 0);
+ this.duration.set(duration > 0 ? duration * 1000 : 0);
return cursor.getInt(cursor.getColumnIndex(VoicemailContract.Voicemails.HAS_CONTENT)) == 1;
}
} finally {
@@ -440,38 +440,34 @@ public class VoicemailPlaybackPresenter
* @return whether issued request to fetch content
*/
protected boolean requestContent(int code) {
- if (mContext == null || mVoicemailUri == null) {
+ if (context == null || voicemailUri == null) {
return false;
}
FetchResultHandler tempFetchResultHandler =
- new FetchResultHandler(new Handler(), mVoicemailUri, code);
+ new FetchResultHandler(new Handler(), voicemailUri, code);
switch (code) {
default:
- if (mFetchResultHandler != null) {
- mFetchResultHandler.destroy();
+ if (fetchResultHandler != null) {
+ fetchResultHandler.destroy();
}
- mView.setIsFetchingContent();
- mFetchResultHandler = tempFetchResultHandler;
+ view.setIsFetchingContent();
+ fetchResultHandler = tempFetchResultHandler;
break;
}
- mAsyncTaskExecutor.submit(
+ asyncTaskExecutor.submit(
Tasks.SEND_FETCH_REQUEST,
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
try (Cursor cursor =
- mContext
+ context
.getContentResolver()
.query(
- mVoicemailUri,
- new String[] {Voicemails.SOURCE_PACKAGE},
- null,
- null,
- null)) {
+ voicemailUri, new String[] {Voicemails.SOURCE_PACKAGE}, null, null, null)) {
String sourcePackage;
if (!hasContent(cursor)) {
LogUtil.e(
@@ -482,12 +478,12 @@ public class VoicemailPlaybackPresenter
sourcePackage = cursor.getString(0);
}
// Send voicemail fetch request.
- Intent intent = new Intent(VoicemailContract.ACTION_FETCH_VOICEMAIL, mVoicemailUri);
+ Intent intent = new Intent(VoicemailContract.ACTION_FETCH_VOICEMAIL, voicemailUri);
intent.setPackage(sourcePackage);
LogUtil.i(
"VoicemailPlaybackPresenter.requestContent",
"Sending ACTION_FETCH_VOICEMAIL to " + sourcePackage);
- mContext.sendBroadcast(intent);
+ context.sendBroadcast(intent);
}
return null;
}
@@ -504,35 +500,35 @@ public class VoicemailPlaybackPresenter
* will call {@link #onError()} otherwise.
*/
protected void prepareContent() {
- if (mView == null || mContext == null) {
+ if (view == null || context == null) {
return;
}
LogUtil.d("VoicemailPlaybackPresenter.prepareContent", null);
// Release the previous media player, otherwise there may be failures.
- if (mMediaPlayer != null) {
- mMediaPlayer.release();
- mMediaPlayer = null;
+ if (mediaPlayer != null) {
+ mediaPlayer.release();
+ mediaPlayer = null;
}
- mView.disableUiElements();
- mIsPrepared = false;
+ view.disableUiElements();
+ isPrepared = false;
- if (mContext != null && TelecomUtil.isInManagedCall(mContext)) {
+ if (context != null && TelecomUtil.isInManagedCall(context)) {
handleError(new IllegalStateException("Cannot play voicemail when call is in progress"));
return;
}
try {
- mMediaPlayer = new MediaPlayer();
- mMediaPlayer.setOnPreparedListener(this);
- mMediaPlayer.setOnErrorListener(this);
- mMediaPlayer.setOnCompletionListener(this);
-
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(mContext, mVoicemailUri);
- mMediaPlayer.setAudioStreamType(VoicemailAudioManager.PLAYBACK_STREAM);
- mMediaPlayer.prepareAsync();
+ mediaPlayer = new MediaPlayer();
+ mediaPlayer.setOnPreparedListener(this);
+ mediaPlayer.setOnErrorListener(this);
+ mediaPlayer.setOnCompletionListener(this);
+
+ mediaPlayer.reset();
+ mediaPlayer.setDataSource(context, voicemailUri);
+ mediaPlayer.setAudioStreamType(VoicemailAudioManager.PLAYBACK_STREAM);
+ mediaPlayer.prepareAsync();
} catch (IOException e) {
handleError(e);
}
@@ -543,23 +539,23 @@ public class VoicemailPlaybackPresenter
*/
@Override
public void onPrepared(MediaPlayer mp) {
- if (mView == null || mContext == null) {
+ if (view == null || context == null) {
return;
}
LogUtil.d("VoicemailPlaybackPresenter.onPrepared", null);
- mIsPrepared = true;
+ isPrepared = true;
- mDuration.set(mMediaPlayer.getDuration());
+ duration.set(mediaPlayer.getDuration());
- LogUtil.d("VoicemailPlaybackPresenter.onPrepared", "mPosition=" + mPosition);
- mView.setClipPosition(mPosition, mDuration.get());
- mView.enableUiElements();
- mView.setSuccess();
+ LogUtil.d("VoicemailPlaybackPresenter.onPrepared", "mPosition=" + position);
+ view.setClipPosition(position, duration.get());
+ view.enableUiElements();
+ view.setSuccess();
if (!mp.isPlaying()) {
- mMediaPlayer.seekTo(mPosition);
+ mediaPlayer.seekTo(position);
}
- if (mIsPlaying) {
+ if (isPlaying) {
resumePlayback();
} else {
pausePlayback();
@@ -579,18 +575,18 @@ public class VoicemailPlaybackPresenter
protected void handleError(Exception e) {
LogUtil.e("VoicemailPlaybackPresenter.handlerError", "could not play voicemail", e);
- if (mIsPrepared) {
- mMediaPlayer.release();
- mMediaPlayer = null;
- mIsPrepared = false;
+ if (isPrepared) {
+ mediaPlayer.release();
+ mediaPlayer = null;
+ isPrepared = false;
}
- if (mView != null) {
- mView.onPlaybackError();
+ if (view != null) {
+ view.onPlaybackError();
}
- mPosition = 0;
- mIsPlaying = false;
+ position = 0;
+ isPlaying = false;
showShareVoicemailButton(false);
}
@@ -600,10 +596,10 @@ public class VoicemailPlaybackPresenter
pausePlayback();
// Reset the seekbar position to the beginning.
- mPosition = 0;
- if (mView != null) {
+ position = 0;
+ if (view != null) {
mediaPlayer.seekTo(0);
- mView.setClipPosition(0, mDuration.get());
+ view.setClipPosition(0, duration.get());
}
}
@@ -617,7 +613,7 @@ public class VoicemailPlaybackPresenter
* @param gainedFocus {@code true} if the audio focus was gained, {@code} false otherwise.
*/
public void onAudioFocusChange(boolean gainedFocus) {
- if (mIsPlaying == gainedFocus) {
+ if (isPlaying == gainedFocus) {
// Nothing new here, just exit.
return;
}
@@ -634,11 +630,11 @@ public class VoicemailPlaybackPresenter
* playing.
*/
public void resumePlayback() {
- if (mView == null) {
+ if (view == null) {
return;
}
- if (!mIsPrepared) {
+ if (!isPrepared) {
/*
* Check content before requesting content to avoid duplicated requests. It is possible
* that the UI doesn't know content has arrived if the fetch took too long causing a
@@ -649,41 +645,41 @@ public class VoicemailPlaybackPresenter
if (!hasContent) {
// No local content, download from server. Queue playing if the request was
// issued,
- mIsPlaying = requestContent(PLAYBACK_REQUEST);
+ isPlaying = requestContent(PLAYBACK_REQUEST);
} else {
showShareVoicemailButton(true);
// Queue playing once the media play loaded the content.
- mIsPlaying = true;
+ isPlaying = true;
prepareContent();
}
});
return;
}
- mIsPlaying = true;
+ isPlaying = true;
- mActivity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
+ activity.getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
- if (mMediaPlayer != null && !mMediaPlayer.isPlaying()) {
+ if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
// Clamp the start position between 0 and the duration.
- mPosition = Math.max(0, Math.min(mPosition, mDuration.get()));
+ position = Math.max(0, Math.min(position, duration.get()));
- mMediaPlayer.seekTo(mPosition);
+ mediaPlayer.seekTo(position);
try {
// Grab audio focus.
// Can throw RejectedExecutionException.
- mVoicemailAudioManager.requestAudioFocus();
- mMediaPlayer.start();
- setSpeakerphoneOn(mIsSpeakerphoneOn);
- mVoicemailAudioManager.setSpeakerphoneOn(mIsSpeakerphoneOn);
+ voicemailAudioManager.requestAudioFocus();
+ mediaPlayer.start();
+ setSpeakerphoneOn(isSpeakerphoneOn);
+ voicemailAudioManager.setSpeakerphoneOn(isSpeakerphoneOn);
} catch (RejectedExecutionException e) {
handleError(e);
}
}
- LogUtil.d("VoicemailPlaybackPresenter.resumePlayback", "resumed playback at %d.", mPosition);
- mView.onPlaybackStarted(mDuration.get(), getScheduledExecutorServiceInstance());
+ LogUtil.d("VoicemailPlaybackPresenter.resumePlayback", "resumed playback at %d.", position);
+ view.onPlaybackStarted(duration.get(), getScheduledExecutorServiceInstance());
}
/** Pauses voicemail playback at the current position. Null-op if already paused. */
@@ -692,29 +688,29 @@ public class VoicemailPlaybackPresenter
}
private void pausePlayback(boolean keepFocus) {
- if (!mIsPrepared) {
+ if (!isPrepared) {
return;
}
- mIsPlaying = false;
+ isPlaying = false;
- if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
- mMediaPlayer.pause();
+ if (mediaPlayer != null && mediaPlayer.isPlaying()) {
+ mediaPlayer.pause();
}
- mPosition = mMediaPlayer == null ? 0 : mMediaPlayer.getCurrentPosition();
+ position = mediaPlayer == null ? 0 : mediaPlayer.getCurrentPosition();
- LogUtil.d("VoicemailPlaybackPresenter.pausePlayback", "paused playback at %d.", mPosition);
+ LogUtil.d("VoicemailPlaybackPresenter.pausePlayback", "paused playback at %d.", position);
- if (mView != null) {
- mView.onPlaybackStopped();
+ if (view != null) {
+ view.onPlaybackStopped();
}
if (!keepFocus) {
- mVoicemailAudioManager.abandonAudioFocus();
+ voicemailAudioManager.abandonAudioFocus();
}
- if (mActivity != null) {
- mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
+ if (activity != null) {
+ activity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
}
disableProximitySensor(true /* waitForFarState */);
}
@@ -724,16 +720,16 @@ public class VoicemailPlaybackPresenter
* playing to know whether to resume playback once the user selects a new position.
*/
public void pausePlaybackForSeeking() {
- if (mMediaPlayer != null) {
- mShouldResumePlaybackAfterSeeking = mMediaPlayer.isPlaying();
+ if (mediaPlayer != null) {
+ shouldResumePlaybackAfterSeeking = mediaPlayer.isPlaying();
}
pausePlayback(true);
}
public void resumePlaybackAfterSeeking(int desiredPosition) {
- mPosition = desiredPosition;
- if (mShouldResumePlaybackAfterSeeking) {
- mShouldResumePlaybackAfterSeeking = false;
+ position = desiredPosition;
+ if (shouldResumePlaybackAfterSeeking) {
+ shouldResumePlaybackAfterSeeking = false;
resumePlayback();
}
}
@@ -743,23 +739,23 @@ public class VoicemailPlaybackPresenter
* touch or volume button while in talkback mode.
*/
public void seek(int position) {
- mPosition = position;
- mMediaPlayer.seekTo(mPosition);
+ this.position = position;
+ mediaPlayer.seekTo(this.position);
}
private void enableProximitySensor() {
- if (mProximityWakeLock == null
- || mIsSpeakerphoneOn
- || !mIsPrepared
- || mMediaPlayer == null
- || !mMediaPlayer.isPlaying()) {
+ if (proximityWakeLock == null
+ || isSpeakerphoneOn
+ || !isPrepared
+ || mediaPlayer == null
+ || !mediaPlayer.isPlaying()) {
return;
}
- if (!mProximityWakeLock.isHeld()) {
+ if (!proximityWakeLock.isHeld()) {
LogUtil.i(
"VoicemailPlaybackPresenter.enableProximitySensor", "acquiring proximity wake lock");
- mProximityWakeLock.acquire();
+ proximityWakeLock.acquire();
} else {
LogUtil.i(
"VoicemailPlaybackPresenter.enableProximitySensor",
@@ -768,14 +764,14 @@ public class VoicemailPlaybackPresenter
}
private void disableProximitySensor(boolean waitForFarState) {
- if (mProximityWakeLock == null) {
+ if (proximityWakeLock == null) {
return;
}
- if (mProximityWakeLock.isHeld()) {
+ if (proximityWakeLock.isHeld()) {
LogUtil.i(
"VoicemailPlaybackPresenter.disableProximitySensor", "releasing proximity wake lock");
int flags = waitForFarState ? PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY : 0;
- mProximityWakeLock.release(flags);
+ proximityWakeLock.release(flags);
} else {
LogUtil.i(
"VoicemailPlaybackPresenter.disableProximitySensor",
@@ -785,44 +781,44 @@ public class VoicemailPlaybackPresenter
/** This is for use by UI interactions only. It simplifies UI logic. */
public void toggleSpeakerphone() {
- mVoicemailAudioManager.setSpeakerphoneOn(!mIsSpeakerphoneOn);
- setSpeakerphoneOn(!mIsSpeakerphoneOn);
+ voicemailAudioManager.setSpeakerphoneOn(!isSpeakerphoneOn);
+ setSpeakerphoneOn(!isSpeakerphoneOn);
}
public void setOnVoicemailDeletedListener(OnVoicemailDeletedListener listener) {
- mOnVoicemailDeletedListener = listener;
+ onVoicemailDeletedListener = listener;
}
public int getMediaPlayerPosition() {
- return mIsPrepared && mMediaPlayer != null ? mMediaPlayer.getCurrentPosition() : 0;
+ return isPrepared && mediaPlayer != null ? mediaPlayer.getCurrentPosition() : 0;
}
void onVoicemailDeleted(CallLogListItemViewHolder viewHolder) {
- if (mOnVoicemailDeletedListener != null) {
- mOnVoicemailDeletedListener.onVoicemailDeleted(viewHolder, mVoicemailUri);
+ if (onVoicemailDeletedListener != null) {
+ onVoicemailDeletedListener.onVoicemailDeleted(viewHolder, voicemailUri);
}
}
void onVoicemailDeleteUndo(int adapterPosition) {
- if (mOnVoicemailDeletedListener != null) {
- mOnVoicemailDeletedListener.onVoicemailDeleteUndo(mRowId, adapterPosition, mVoicemailUri);
+ if (onVoicemailDeletedListener != null) {
+ onVoicemailDeletedListener.onVoicemailDeleteUndo(rowId, adapterPosition, voicemailUri);
}
}
void onVoicemailDeletedInDatabase() {
- if (mOnVoicemailDeletedListener != null) {
- mOnVoicemailDeletedListener.onVoicemailDeletedInDatabase(mRowId, mVoicemailUri);
+ if (onVoicemailDeletedListener != null) {
+ onVoicemailDeletedListener.onVoicemailDeletedInDatabase(rowId, voicemailUri);
}
}
@VisibleForTesting
public boolean isPlaying() {
- return mIsPlaying;
+ return isPlaying;
}
@VisibleForTesting
public boolean isSpeakerphoneOn() {
- return mIsSpeakerphoneOn;
+ return isSpeakerphoneOn;
}
/**
@@ -831,19 +827,19 @@ public class VoicemailPlaybackPresenter
* presenter without the presenter triggering the audio manager and duplicating actions.
*/
public void setSpeakerphoneOn(boolean on) {
- if (mView == null) {
+ if (view == null) {
return;
}
- mView.onSpeakerphoneOn(on);
+ view.onSpeakerphoneOn(on);
- mIsSpeakerphoneOn = on;
+ isSpeakerphoneOn = on;
// This should run even if speakerphone is not being toggled because we may be switching
// from earpiece to headphone and vise versa. Also upon initial setup the default audio
// source is the earpiece, so we want to trigger the proximity sensor.
- if (mIsPlaying) {
- if (on || mVoicemailAudioManager.isWiredHeadsetPluggedIn()) {
+ if (isPlaying) {
+ if (on || voicemailAudioManager.isWiredHeadsetPluggedIn()) {
disableProximitySensor(false /* waitForFarState */);
} else {
enableProximitySensor();
@@ -853,16 +849,16 @@ public class VoicemailPlaybackPresenter
@VisibleForTesting
public void clearInstance() {
- sInstance = null;
+ instance = null;
}
private void showShareVoicemailButton(boolean show) {
- if (mContext == null) {
+ if (context == null) {
return;
}
- if (isShareVoicemailAllowed(mContext) && shareVoicemailButtonView != null) {
+ if (isShareVoicemailAllowed(context) && shareVoicemailButtonView != null) {
if (show) {
- Logger.get(mContext).logImpression(DialerImpression.Type.VVM_SHARE_VISIBLE);
+ Logger.get(context).logImpression(DialerImpression.Type.VVM_SHARE_VISIBLE);
}
LogUtil.d("VoicemailPlaybackPresenter.showShareVoicemailButton", "show: %b", show);
shareVoicemailButtonView.setVisibility(show ? View.VISIBLE : View.GONE);
@@ -931,7 +927,7 @@ public class VoicemailPlaybackPresenter
* voicemail to a temporary file in background and launch a chooser intent to share it.
*/
public void shareVoicemail() {
- shareVoicemailExecutor.executeParallel(new Pair<>(mContext, mVoicemailUri));
+ shareVoicemailExecutor.executeParallel(new Pair<>(context, voicemailUri));
}
private static String getFileName(String cachedName, String number, String mimeType, long date) {
@@ -1052,55 +1048,55 @@ public class VoicemailPlaybackPresenter
@ThreadSafe
private class FetchResultHandler extends ContentObserver implements Runnable {
- private final Handler mFetchResultHandler;
- private final Uri mVoicemailUri;
- private AtomicBoolean mIsWaitingForResult = new AtomicBoolean(true);
+ private final Handler fetchResultHandler;
+ private final Uri voicemailUri;
+ private AtomicBoolean isWaitingForResult = new AtomicBoolean(true);
public FetchResultHandler(Handler handler, Uri uri, int code) {
super(handler);
- mFetchResultHandler = handler;
- mVoicemailUri = uri;
- if (mContext != null) {
- if (PermissionsUtil.hasReadVoicemailPermissions(mContext)) {
- mContext.getContentResolver().registerContentObserver(mVoicemailUri, false, this);
+ fetchResultHandler = handler;
+ voicemailUri = uri;
+ if (context != null) {
+ if (PermissionsUtil.hasReadVoicemailPermissions(context)) {
+ context.getContentResolver().registerContentObserver(voicemailUri, false, this);
}
- mFetchResultHandler.postDelayed(this, FETCH_CONTENT_TIMEOUT_MS);
+ fetchResultHandler.postDelayed(this, FETCH_CONTENT_TIMEOUT_MS);
}
}
/** Stop waiting for content and notify UI if {@link FETCH_CONTENT_TIMEOUT_MS} has elapsed. */
@Override
public void run() {
- if (mIsWaitingForResult.getAndSet(false) && mContext != null) {
- mContext.getContentResolver().unregisterContentObserver(this);
- if (mView != null) {
- mView.setFetchContentTimeout();
+ if (isWaitingForResult.getAndSet(false) && context != null) {
+ context.getContentResolver().unregisterContentObserver(this);
+ if (view != null) {
+ view.setFetchContentTimeout();
}
}
}
public void destroy() {
- if (mIsWaitingForResult.getAndSet(false) && mContext != null) {
- mContext.getContentResolver().unregisterContentObserver(this);
- mFetchResultHandler.removeCallbacks(this);
+ if (isWaitingForResult.getAndSet(false) && context != null) {
+ context.getContentResolver().unregisterContentObserver(this);
+ fetchResultHandler.removeCallbacks(this);
}
}
@Override
public void onChange(boolean selfChange) {
- mAsyncTaskExecutor.submit(
+ asyncTaskExecutor.submit(
Tasks.CHECK_CONTENT_AFTER_CHANGE,
new AsyncTask<Void, Void, Boolean>() {
@Override
public Boolean doInBackground(Void... params) {
- return queryHasContent(mVoicemailUri);
+ return queryHasContent(voicemailUri);
}
@Override
public void onPostExecute(Boolean hasContent) {
- if (hasContent && mContext != null && mIsWaitingForResult.getAndSet(false)) {
- mContext.getContentResolver().unregisterContentObserver(FetchResultHandler.this);
+ if (hasContent && context != null && isWaitingForResult.getAndSet(false)) {
+ context.getContentResolver().unregisterContentObserver(FetchResultHandler.this);
showShareVoicemailButton(true);
prepareContent();
}
diff --git a/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java b/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java
index 24d4c6ff7..2873f8d5e 100644
--- a/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java
+++ b/java/com/android/dialer/app/voicemail/WiredHeadsetManager.java
@@ -20,50 +20,52 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
-import android.util.Log;
+import com.android.dialer.common.LogUtil;
/** Listens for and caches headset state. */
class WiredHeadsetManager {
private static final String TAG = WiredHeadsetManager.class.getSimpleName();
- private final WiredHeadsetBroadcastReceiver mReceiver;
- private boolean mIsPluggedIn;
- private Listener mListener;
- private Context mContext;
+ private final WiredHeadsetBroadcastReceiver receiver;
+ private boolean isPluggedIn;
+ private Listener listener;
+ private Context context;
WiredHeadsetManager(Context context) {
- mContext = context;
- mReceiver = new WiredHeadsetBroadcastReceiver();
+ this.context = context;
+ receiver = new WiredHeadsetBroadcastReceiver();
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
- mIsPluggedIn = audioManager.isWiredHeadsetOn();
+ isPluggedIn = audioManager.isWiredHeadsetOn();
}
void setListener(Listener listener) {
- mListener = listener;
+ this.listener = listener;
}
boolean isPluggedIn() {
- return mIsPluggedIn;
+ return isPluggedIn;
}
void registerReceiver() {
// Register for misc other intent broadcasts.
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
- mContext.registerReceiver(mReceiver, intentFilter);
+ context.registerReceiver(receiver, intentFilter);
}
void unregisterReceiver() {
- mContext.unregisterReceiver(mReceiver);
+ context.unregisterReceiver(receiver);
}
private void onHeadsetPluggedInChanged(boolean isPluggedIn) {
- if (mIsPluggedIn != isPluggedIn) {
- Log.v(TAG, "onHeadsetPluggedInChanged, mIsPluggedIn: " + mIsPluggedIn + " -> " + isPluggedIn);
- boolean oldIsPluggedIn = mIsPluggedIn;
- mIsPluggedIn = isPluggedIn;
- if (mListener != null) {
- mListener.onWiredHeadsetPluggedInChanged(oldIsPluggedIn, mIsPluggedIn);
+ if (this.isPluggedIn != isPluggedIn) {
+ LogUtil.v(
+ TAG,
+ "onHeadsetPluggedInChanged, mIsPluggedIn: " + this.isPluggedIn + " -> " + isPluggedIn);
+ boolean oldIsPluggedIn = this.isPluggedIn;
+ this.isPluggedIn = isPluggedIn;
+ if (listener != null) {
+ listener.onWiredHeadsetPluggedInChanged(oldIsPluggedIn, this.isPluggedIn);
}
}
}
@@ -80,7 +82,7 @@ class WiredHeadsetManager {
public void onReceive(Context context, Intent intent) {
if (AudioManager.ACTION_HEADSET_PLUG.equals(intent.getAction())) {
boolean isPluggedIn = intent.getIntExtra("state", 0) == 1;
- Log.v(TAG, "ACTION_HEADSET_PLUG event, plugged in: " + isPluggedIn);
+ LogUtil.v(TAG, "ACTION_HEADSET_PLUG event, plugged in: " + isPluggedIn);
onHeadsetPluggedInChanged(isPluggedIn);
}
}
diff --git a/java/com/android/dialer/app/widget/ActionBarController.java b/java/com/android/dialer/app/widget/ActionBarController.java
index 3daa0e2d4..8ab57bcfb 100644
--- a/java/com/android/dialer/app/widget/ActionBarController.java
+++ b/java/com/android/dialer/app/widget/ActionBarController.java
@@ -31,12 +31,12 @@ public class ActionBarController {
private static final String KEY_IS_FADED_OUT = "key_actionbar_is_faded_out";
private static final String KEY_IS_EXPANDED = "key_actionbar_is_expanded";
- private ActivityUi mActivityUi;
- private SearchEditTextLayout mSearchBox;
+ private ActivityUi activityUi;
+ private SearchEditTextLayout searchBox;
- private boolean mIsActionBarSlidUp;
+ private boolean isActionBarSlidUp;
- private final AnimationCallback mFadeOutCallback =
+ private final AnimationCallback fadeOutCallback =
new AnimationCallback() {
@Override
public void onAnimationEnd() {
@@ -49,24 +49,23 @@ public class ActionBarController {
}
};
- private ValueAnimator mAnimator;
+ private ValueAnimator animator;
public ActionBarController(ActivityUi activityUi, SearchEditTextLayout searchBox) {
- mActivityUi = activityUi;
- mSearchBox = searchBox;
+ this.activityUi = activityUi;
+ this.searchBox = searchBox;
}
/** @return Whether or not the action bar is currently showing (both slid down and visible) */
public boolean isActionBarShowing() {
- return !mIsActionBarSlidUp && !mSearchBox.isFadedOut();
+ return !isActionBarSlidUp && !searchBox.isFadedOut();
}
/** Called when the user has tapped on the collapsed search box, to start a new search query. */
public void onSearchBoxTapped() {
- LogUtil.d(
- "ActionBarController.onSearchBoxTapped", "isInSearchUi " + mActivityUi.isInSearchUi());
- if (!mActivityUi.isInSearchUi()) {
- mSearchBox.expand(true /* animate */, true /* requestFocus */);
+ LogUtil.d("ActionBarController.onSearchBoxTapped", "isInSearchUi " + activityUi.isInSearchUi());
+ if (!activityUi.isInSearchUi()) {
+ searchBox.expand(true /* animate */, true /* requestFocus */);
}
}
@@ -75,13 +74,13 @@ public class ActionBarController {
LogUtil.d(
"ActionBarController.onSearchUIExited",
"isExpanded: %b, isFadedOut %b",
- mSearchBox.isExpanded(),
- mSearchBox.isFadedOut());
- if (mSearchBox.isExpanded()) {
- mSearchBox.collapse(true /* animate */);
+ searchBox.isExpanded(),
+ searchBox.isFadedOut());
+ if (searchBox.isExpanded()) {
+ searchBox.collapse(true /* animate */);
}
- if (mSearchBox.isFadedOut()) {
- mSearchBox.fadeIn();
+ if (searchBox.isFadedOut()) {
+ searchBox.fadeIn();
}
slideActionBar(false /* slideUp */, false /* animate */);
@@ -95,16 +94,16 @@ public class ActionBarController {
LogUtil.d(
"ActionBarController.onDialpadDown",
"isInSearchUi: %b, hasSearchQuery: %b, isFadedOut: %b, isExpanded: %b",
- mActivityUi.isInSearchUi(),
- mActivityUi.hasSearchQuery(),
- mSearchBox.isFadedOut(),
- mSearchBox.isExpanded());
- if (mActivityUi.isInSearchUi()) {
- if (mSearchBox.isFadedOut()) {
- mSearchBox.setVisible(true);
+ activityUi.isInSearchUi(),
+ activityUi.hasSearchQuery(),
+ searchBox.isFadedOut(),
+ searchBox.isExpanded());
+ if (activityUi.isInSearchUi()) {
+ if (searchBox.isFadedOut()) {
+ searchBox.setVisible(true);
}
- if (!mSearchBox.isExpanded()) {
- mSearchBox.expand(false /* animate */, false /* requestFocus */);
+ if (!searchBox.isExpanded()) {
+ searchBox.expand(false /* animate */, false /* requestFocus */);
}
slideActionBar(false /* slideUp */, true /* animate */);
}
@@ -115,71 +114,71 @@ public class ActionBarController {
* state changes have actually occurred.
*/
public void onDialpadUp() {
- LogUtil.d("ActionBarController.onDialpadUp", "isInSearchUi " + mActivityUi.isInSearchUi());
- if (mActivityUi.isInSearchUi()) {
+ LogUtil.d("ActionBarController.onDialpadUp", "isInSearchUi " + activityUi.isInSearchUi());
+ if (activityUi.isInSearchUi()) {
slideActionBar(true /* slideUp */, true /* animate */);
} else {
// From the lists fragment
- mSearchBox.fadeOut(mFadeOutCallback);
+ searchBox.fadeOut(fadeOutCallback);
}
}
public void slideActionBar(boolean slideUp, boolean animate) {
LogUtil.d("ActionBarController.slidingActionBar", "up: %b, animate: %b", slideUp, animate);
- if (mAnimator != null && mAnimator.isRunning()) {
- mAnimator.cancel();
- mAnimator.removeAllUpdateListeners();
+ if (animator != null && animator.isRunning()) {
+ animator.cancel();
+ animator.removeAllUpdateListeners();
}
if (animate) {
- mAnimator = slideUp ? ValueAnimator.ofFloat(0, 1) : ValueAnimator.ofFloat(1, 0);
- mAnimator.addUpdateListener(
+ animator = slideUp ? ValueAnimator.ofFloat(0, 1) : ValueAnimator.ofFloat(1, 0);
+ animator.addUpdateListener(
animation -> {
final float value = (float) animation.getAnimatedValue();
- setHideOffset((int) (mActivityUi.getActionBarHeight() * value));
+ setHideOffset((int) (activityUi.getActionBarHeight() * value));
});
- mAnimator.start();
+ animator.start();
} else {
- setHideOffset(slideUp ? mActivityUi.getActionBarHeight() : 0);
+ setHideOffset(slideUp ? activityUi.getActionBarHeight() : 0);
}
- mIsActionBarSlidUp = slideUp;
+ isActionBarSlidUp = slideUp;
}
public void setAlpha(float alphaValue) {
- mSearchBox.animate().alpha(alphaValue).start();
+ searchBox.animate().alpha(alphaValue).start();
}
private void setHideOffset(int offset) {
- mActivityUi.setActionBarHideOffset(offset);
+ activityUi.setActionBarHideOffset(offset);
}
/** Saves the current state of the action bar into a provided {@link Bundle} */
public void saveInstanceState(Bundle outState) {
- outState.putBoolean(KEY_IS_SLID_UP, mIsActionBarSlidUp);
- outState.putBoolean(KEY_IS_FADED_OUT, mSearchBox.isFadedOut());
- outState.putBoolean(KEY_IS_EXPANDED, mSearchBox.isExpanded());
+ outState.putBoolean(KEY_IS_SLID_UP, isActionBarSlidUp);
+ outState.putBoolean(KEY_IS_FADED_OUT, searchBox.isFadedOut());
+ outState.putBoolean(KEY_IS_EXPANDED, searchBox.isExpanded());
}
/** Restores the action bar state from a provided {@link Bundle}. */
public void restoreInstanceState(Bundle inState) {
- mIsActionBarSlidUp = inState.getBoolean(KEY_IS_SLID_UP);
+ isActionBarSlidUp = inState.getBoolean(KEY_IS_SLID_UP);
final boolean isSearchBoxFadedOut = inState.getBoolean(KEY_IS_FADED_OUT);
if (isSearchBoxFadedOut) {
- if (!mSearchBox.isFadedOut()) {
- mSearchBox.setVisible(false);
+ if (!searchBox.isFadedOut()) {
+ searchBox.setVisible(false);
}
- } else if (mSearchBox.isFadedOut()) {
- mSearchBox.setVisible(true);
+ } else if (searchBox.isFadedOut()) {
+ searchBox.setVisible(true);
}
final boolean isSearchBoxExpanded = inState.getBoolean(KEY_IS_EXPANDED);
if (isSearchBoxExpanded) {
- if (!mSearchBox.isExpanded()) {
- mSearchBox.expand(false, false);
+ if (!searchBox.isExpanded()) {
+ searchBox.expand(false, false);
}
- } else if (mSearchBox.isExpanded()) {
- mSearchBox.collapse(false);
+ } else if (searchBox.isExpanded()) {
+ searchBox.collapse(false);
}
}
@@ -188,7 +187,7 @@ public class ActionBarController {
* laid out and actually has a height.
*/
public void restoreActionBarOffset() {
- slideActionBar(mIsActionBarSlidUp /* slideUp */, false /* animate */);
+ slideActionBar(isActionBarSlidUp /* slideUp */, false /* animate */);
}
public interface ActivityUi {
diff --git a/java/com/android/dialer/app/widget/SearchEditTextLayout.java b/java/com/android/dialer/app/widget/SearchEditTextLayout.java
index ebd62080b..40189a873 100644
--- a/java/com/android/dialer/app/widget/SearchEditTextLayout.java
+++ b/java/com/android/dialer/app/widget/SearchEditTextLayout.java
@@ -36,83 +36,83 @@ public class SearchEditTextLayout extends FrameLayout {
private static final float EXPAND_MARGIN_FRACTION_START = 0.8f;
private static final int ANIMATION_DURATION = 200;
/* Subclass-visible for testing */
- protected boolean mIsExpanded = false;
- protected boolean mIsFadedOut = false;
- private OnKeyListener mPreImeKeyListener;
- private int mTopMargin;
- private int mBottomMargin;
- private int mLeftMargin;
- private int mRightMargin;
- private float mCollapsedElevation;
- private View mCollapsed;
- private View mExpanded;
- private EditText mSearchView;
- private View mSearchIcon;
- private View mCollapsedSearchBox;
- private View mVoiceSearchButtonView;
- private View mOverflowButtonView;
- private View mClearButtonView;
-
- private ValueAnimator mAnimator;
-
- private Callback mCallback;
-
- private boolean mVoiceSearchEnabled;
+ protected boolean isExpanded = false;
+ protected boolean isFadedOut = false;
+ private OnKeyListener preImeKeyListener;
+ private int topMargin;
+ private int bottomMargin;
+ private int leftMargin;
+ private int rightMargin;
+ private float collapsedElevation;
+ private View collapsed;
+ private View expanded;
+ private EditText searchView;
+ private View searchIcon;
+ private View collapsedSearchBox;
+ private View voiceSearchButtonView;
+ private View overflowButtonView;
+ private View clearButtonView;
+
+ private ValueAnimator animator;
+
+ private Callback callback;
+
+ private boolean voiceSearchEnabled;
public SearchEditTextLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setPreImeKeyListener(OnKeyListener listener) {
- mPreImeKeyListener = listener;
+ preImeKeyListener = listener;
}
public void setCallback(Callback listener) {
- mCallback = listener;
+ callback = listener;
}
public void setVoiceSearchEnabled(boolean enabled) {
- mVoiceSearchEnabled = enabled;
- updateVisibility(mIsExpanded);
+ voiceSearchEnabled = enabled;
+ updateVisibility(isExpanded);
}
@Override
protected void onFinishInflate() {
MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
- mTopMargin = params.topMargin;
- mBottomMargin = params.bottomMargin;
- mLeftMargin = params.leftMargin;
- mRightMargin = params.rightMargin;
+ topMargin = params.topMargin;
+ bottomMargin = params.bottomMargin;
+ leftMargin = params.leftMargin;
+ rightMargin = params.rightMargin;
- mCollapsedElevation = getElevation();
+ collapsedElevation = getElevation();
- mCollapsed = findViewById(R.id.search_box_collapsed);
- mExpanded = findViewById(R.id.search_box_expanded);
- mSearchView = (EditText) mExpanded.findViewById(R.id.search_view);
+ collapsed = findViewById(R.id.search_box_collapsed);
+ expanded = findViewById(R.id.search_box_expanded);
+ searchView = (EditText) expanded.findViewById(R.id.search_view);
- mSearchIcon = findViewById(R.id.search_magnifying_glass);
- mCollapsedSearchBox = findViewById(R.id.search_box_start_search);
- mVoiceSearchButtonView = findViewById(R.id.voice_search_button);
- mOverflowButtonView = findViewById(R.id.dialtacts_options_menu_button);
- mClearButtonView = findViewById(R.id.search_close_button);
+ searchIcon = findViewById(R.id.search_magnifying_glass);
+ collapsedSearchBox = findViewById(R.id.search_box_start_search);
+ voiceSearchButtonView = findViewById(R.id.voice_search_button);
+ overflowButtonView = findViewById(R.id.dialtacts_options_menu_button);
+ clearButtonView = findViewById(R.id.search_close_button);
// Convert a long click into a click to expand the search box. Touch events are also
// forwarded to the searchView. This accelerates the long-press scenario for copy/paste.
- mCollapsed.setOnLongClickListener(
+ collapsed.setOnLongClickListener(
new OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
- mCollapsed.performClick();
+ collapsed.performClick();
return false;
}
});
- mCollapsed.setOnTouchListener(
+ collapsed.setOnTouchListener(
(v, event) -> {
- mSearchView.onTouchEvent(event);
+ searchView.onTouchEvent(event);
return false;
});
- mSearchView.setOnFocusChangeListener(
+ searchView.setOnFocusChangeListener(
new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
@@ -124,24 +124,24 @@ public class SearchEditTextLayout extends FrameLayout {
}
});
- mSearchView.setOnClickListener(
+ searchView.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onSearchViewClicked();
+ if (callback != null) {
+ callback.onSearchViewClicked();
}
}
});
- mSearchView.addTextChangedListener(
+ searchView.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
- mClearButtonView.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
+ clearButtonView.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
}
@Override
@@ -153,7 +153,7 @@ public class SearchEditTextLayout extends FrameLayout {
new OnClickListener() {
@Override
public void onClick(View v) {
- mSearchView.setText(null);
+ searchView.setText(null);
}
});
@@ -162,8 +162,8 @@ public class SearchEditTextLayout extends FrameLayout {
new OnClickListener() {
@Override
public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onBackButtonClicked();
+ if (callback != null) {
+ callback.onBackButtonClicked();
}
}
});
@@ -173,8 +173,8 @@ public class SearchEditTextLayout extends FrameLayout {
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
- if (mPreImeKeyListener != null) {
- if (mPreImeKeyListener.onKey(this, event.getKeyCode(), event)) {
+ if (preImeKeyListener != null) {
+ if (preImeKeyListener.onKey(this, event.getKeyCode(), event)) {
return true;
}
}
@@ -187,28 +187,28 @@ public class SearchEditTextLayout extends FrameLayout {
public void fadeOut(AnimUtils.AnimationCallback callback) {
AnimUtils.fadeOut(this, ANIMATION_DURATION, callback);
- mIsFadedOut = true;
+ isFadedOut = true;
}
public void fadeIn() {
AnimUtils.fadeIn(this, ANIMATION_DURATION);
- mIsFadedOut = false;
+ isFadedOut = false;
}
public void fadeIn(AnimUtils.AnimationCallback callback) {
AnimUtils.fadeIn(this, ANIMATION_DURATION, AnimUtils.NO_DELAY, callback);
- mIsFadedOut = false;
+ isFadedOut = false;
}
public void setVisible(boolean visible) {
if (visible) {
setAlpha(1);
setVisibility(View.VISIBLE);
- mIsFadedOut = false;
+ isFadedOut = false;
} else {
setAlpha(0);
setVisibility(View.GONE);
- mIsFadedOut = true;
+ isFadedOut = true;
}
}
@@ -216,15 +216,15 @@ public class SearchEditTextLayout extends FrameLayout {
updateVisibility(true /* isExpand */);
if (animate) {
- AnimUtils.crossFadeViews(mExpanded, mCollapsed, ANIMATION_DURATION);
- mAnimator = ValueAnimator.ofFloat(EXPAND_MARGIN_FRACTION_START, 0f);
+ AnimUtils.crossFadeViews(expanded, collapsed, ANIMATION_DURATION);
+ animator = ValueAnimator.ofFloat(EXPAND_MARGIN_FRACTION_START, 0f);
setMargins(EXPAND_MARGIN_FRACTION_START);
prepareAnimator();
} else {
- mExpanded.setVisibility(View.VISIBLE);
- mExpanded.setAlpha(1);
+ expanded.setVisibility(View.VISIBLE);
+ expanded.setAlpha(1);
setMargins(0f);
- mCollapsed.setVisibility(View.GONE);
+ collapsed.setVisibility(View.GONE);
}
// Set 9-patch background. This owns the padding, so we need to restore the original values.
@@ -237,27 +237,27 @@ public class SearchEditTextLayout extends FrameLayout {
setPaddingRelative(paddingStart, paddingTop, paddingEnd, paddingBottom);
if (requestFocus) {
- mSearchView.requestFocus();
+ searchView.requestFocus();
}
- mIsExpanded = true;
+ isExpanded = true;
}
public void collapse(boolean animate) {
updateVisibility(false /* isExpand */);
if (animate) {
- AnimUtils.crossFadeViews(mCollapsed, mExpanded, ANIMATION_DURATION);
- mAnimator = ValueAnimator.ofFloat(0f, 1f);
+ AnimUtils.crossFadeViews(collapsed, expanded, ANIMATION_DURATION);
+ animator = ValueAnimator.ofFloat(0f, 1f);
prepareAnimator();
} else {
- mCollapsed.setVisibility(View.VISIBLE);
- mCollapsed.setAlpha(1);
+ collapsed.setVisibility(View.VISIBLE);
+ collapsed.setAlpha(1);
setMargins(1f);
- mExpanded.setVisibility(View.GONE);
+ expanded.setVisibility(View.GONE);
}
- mIsExpanded = false;
- setElevation(mCollapsedElevation);
+ isExpanded = false;
+ setElevation(collapsedElevation);
setBackgroundResource(R.drawable.rounded_corner);
}
@@ -271,30 +271,30 @@ public class SearchEditTextLayout extends FrameLayout {
int collapsedViewVisibility = isExpand ? View.GONE : View.VISIBLE;
int expandedViewVisibility = isExpand ? View.VISIBLE : View.GONE;
- mSearchIcon.setVisibility(collapsedViewVisibility);
- mCollapsedSearchBox.setVisibility(collapsedViewVisibility);
- if (mVoiceSearchEnabled) {
- mVoiceSearchButtonView.setVisibility(collapsedViewVisibility);
+ searchIcon.setVisibility(collapsedViewVisibility);
+ collapsedSearchBox.setVisibility(collapsedViewVisibility);
+ if (voiceSearchEnabled) {
+ voiceSearchButtonView.setVisibility(collapsedViewVisibility);
} else {
- mVoiceSearchButtonView.setVisibility(View.GONE);
+ voiceSearchButtonView.setVisibility(View.GONE);
}
- mOverflowButtonView.setVisibility(collapsedViewVisibility);
+ overflowButtonView.setVisibility(collapsedViewVisibility);
// TODO: Prevents keyboard from jumping up in landscape mode after exiting the
// SearchFragment when the query string is empty. More elegant fix?
- //mExpandedSearchBox.setVisibility(expandedViewVisibility);
- if (TextUtils.isEmpty(mSearchView.getText())) {
- mClearButtonView.setVisibility(View.GONE);
+ // mExpandedSearchBox.setVisibility(expandedViewVisibility);
+ if (TextUtils.isEmpty(searchView.getText())) {
+ clearButtonView.setVisibility(View.GONE);
} else {
- mClearButtonView.setVisibility(expandedViewVisibility);
+ clearButtonView.setVisibility(expandedViewVisibility);
}
}
private void prepareAnimator() {
- if (mAnimator != null) {
- mAnimator.cancel();
+ if (animator != null) {
+ animator.cancel();
}
- mAnimator.addUpdateListener(
+ animator.addUpdateListener(
new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
@@ -303,16 +303,16 @@ public class SearchEditTextLayout extends FrameLayout {
}
});
- mAnimator.setDuration(ANIMATION_DURATION);
- mAnimator.start();
+ animator.setDuration(ANIMATION_DURATION);
+ animator.start();
}
public boolean isExpanded() {
- return mIsExpanded;
+ return isExpanded;
}
public boolean isFadedOut() {
- return mIsFadedOut;
+ return isFadedOut;
}
/**
@@ -322,10 +322,10 @@ public class SearchEditTextLayout extends FrameLayout {
*/
private void setMargins(float fraction) {
MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
- params.topMargin = (int) (mTopMargin * fraction);
- params.bottomMargin = (int) (mBottomMargin * fraction);
- params.leftMargin = (int) (mLeftMargin * fraction);
- params.rightMargin = (int) (mRightMargin * fraction);
+ params.topMargin = (int) (topMargin * fraction);
+ params.bottomMargin = (int) (bottomMargin * fraction);
+ params.leftMargin = (int) (leftMargin * fraction);
+ params.rightMargin = (int) (rightMargin * fraction);
requestLayout();
}