summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-06-11 17:19:41 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-11 17:19:43 +0000
commitd78fd115d8e0abddc0885ea33ff9f07790009d0c (patch)
tree37b50d46575d00909a06192b5dbf6a5f5bba91b5 /src
parent955eb1037f849b6431400668f9ac179fa7e5d70c (diff)
parent2f05af35af03de67c1c474cd148719b24fac3552 (diff)
Merge "Move "Report" to CallDetailActivity." into mnc-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/CallDetailActivity.java71
-rw-r--r--src/com/android/dialer/PhoneCallDetails.java4
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java22
-rw-r--r--src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java3
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java24
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemHelper.java4
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViewHolder.java32
-rw-r--r--src/com/android/dialer/calllog/DefaultVoicemailNotifier.java1
-rw-r--r--src/com/android/dialerbind/ObjectFactory.java12
9 files changed, 61 insertions, 112 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 15ba5df16..b851372c0 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -70,7 +70,8 @@ import java.util.List;
* This activity can be either started with the URI of a single call log entry, or with the
* {@link #EXTRA_CALL_LOG_IDS} extra to specify a group of call log entries.
*/
-public class CallDetailActivity extends Activity {
+public class CallDetailActivity extends Activity
+ implements MenuItem.OnMenuItemClickListener {
private static final String TAG = "CallDetail";
/** A long array extra containing ids of call log entries to display. */
@@ -152,8 +153,8 @@ public class CallDetailActivity extends Activity {
mHasEditNumberBeforeCallOption =
canPlaceCallsTo && !isSipNumber && !mIsVoicemailNumber;
- mHasTrashOption = hasVoicemail();
- mHasRemoveFromCallLogOption = !hasVoicemail();
+ mHasReportMenuOption = mContactInfoHelper.canReportAsInvalid(
+ firstDetails.sourceType, firstDetails.objectId);
invalidateOptionsMenu();
ListView historyList = (ListView) findViewById(R.id.history);
@@ -208,7 +209,7 @@ public class CallDetailActivity extends Activity {
private View mCallButton;
private ContactInfoHelper mContactInfoHelper;
- private String mNumber;
+ protected String mNumber;
private boolean mIsVoicemailNumber;
private String mDefaultCountryIso;
@@ -222,10 +223,7 @@ public class CallDetailActivity extends Activity {
/** Whether we should show "edit number before call" in the options menu. */
private boolean mHasEditNumberBeforeCallOption;
- /** Whether we should show "trash" in the options menu. */
- private boolean mHasTrashOption;
- /** Whether we should show "remove from call log" in the options menu. */
- private boolean mHasRemoveFromCallLogOption;
+ private boolean mHasReportMenuOption;
@Override
protected void onCreate(Bundle icicle) {
@@ -270,7 +268,10 @@ public class CallDetailActivity extends Activity {
@Override
public void onResume() {
super.onResume();
+ getCallDetails();
+ }
+ public void getCallDetails() {
CallLogAsyncTaskUtil.getCallDetails(this, getCallLogEntryUris(), mCallLogAsyncTaskListener);
}
@@ -327,30 +328,44 @@ public class CallDetailActivity extends Activity {
public boolean onPrepareOptionsMenu(Menu menu) {
// This action deletes all elements in the group from the call log.
// We don't have this action for voicemails, because you can just use the trash button.
- menu.findItem(R.id.menu_remove_from_call_log).setVisible(mHasRemoveFromCallLogOption);
- menu.findItem(R.id.menu_edit_number_before_call).setVisible(mHasEditNumberBeforeCallOption);
- menu.findItem(R.id.menu_trash).setVisible(mHasTrashOption);
+ menu.findItem(R.id.menu_remove_from_call_log)
+ .setVisible(!hasVoicemail())
+ .setOnMenuItemClickListener(this);
+ menu.findItem(R.id.menu_edit_number_before_call)
+ .setVisible(mHasEditNumberBeforeCallOption)
+ .setOnMenuItemClickListener(this);
+ menu.findItem(R.id.menu_trash)
+ .setVisible(hasVoicemail())
+ .setOnMenuItemClickListener(this);
+ menu.findItem(R.id.menu_report)
+ .setVisible(mHasReportMenuOption)
+ .setOnMenuItemClickListener(this);
return super.onPrepareOptionsMenu(menu);
}
- public void onMenuRemoveFromCallLog(MenuItem menuItem) {
- final StringBuilder callIds = new StringBuilder();
- for (Uri callUri : getCallLogEntryUris()) {
- if (callIds.length() != 0) {
- callIds.append(",");
- }
- callIds.append(ContentUris.parseId(callUri));
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.menu_remove_from_call_log:
+ final StringBuilder callIds = new StringBuilder();
+ for (Uri callUri : getCallLogEntryUris()) {
+ if (callIds.length() != 0) {
+ callIds.append(",");
+ }
+ callIds.append(ContentUris.parseId(callUri));
+ }
+ CallLogAsyncTaskUtil.deleteCalls(
+ this, callIds.toString(), mCallLogAsyncTaskListener);
+ break;
+ case R.id.menu_edit_number_before_call:
+ startActivity(new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(mNumber)));
+ break;
+ case R.id.menu_trash:
+ CallLogAsyncTaskUtil.deleteVoicemail(
+ this, mVoicemailUri, mCallLogAsyncTaskListener);
+ break;
}
-
- CallLogAsyncTaskUtil.deleteCalls(this, callIds.toString(), mCallLogAsyncTaskListener);
- }
-
- public void onMenuEditNumberBeforeCall(MenuItem menuItem) {
- startActivity(new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(mNumber)));
- }
-
- public void onMenuTrashVoicemail(MenuItem menuItem) {
- CallLogAsyncTaskUtil.deleteVoicemail(this, mVoicemailUri, mCallLogAsyncTaskListener);
+ return true;
}
private void closeSystemDialogs() {
diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java
index 68fdadc0c..add63151a 100644
--- a/src/com/android/dialer/PhoneCallDetails.java
+++ b/src/com/android/dialer/PhoneCallDetails.java
@@ -60,6 +60,7 @@ public class PhoneCallDetails {
public CharSequence numberLabel;
// The URI of the contact associated with this phone call.
public Uri contactUri;
+
/**
* The photo URI of the picture of the contact that is associated with this phone call or
* null if there is none.
@@ -71,6 +72,9 @@ public class PhoneCallDetails {
// The source type of the contact associated with this call.
public int sourceType;
+ // The object id type of the contact associated with this call.
+ public String objectId;
+
// The unique identifier for the account associated with the call.
public PhoneAccountHandle accountHandle;
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index daa735070..69fbb034b 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -59,11 +59,6 @@ public class CallLogAdapter extends GroupingListAdapter
public void fetchCalls();
}
- /** Implements onClickListener for the report button. */
- public interface OnReportButtonClickListener {
- public void onReportButtonClick(String number);
- }
-
private static final int VIEW_TYPE_SHOW_CALL_HISTORY_LIST_ITEM = 10;
private static final int NO_EXPANDED_LIST_ITEM = -1;
@@ -71,7 +66,6 @@ public class CallLogAdapter extends GroupingListAdapter
private final ContactInfoHelper mContactInfoHelper;
private final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter;
private final CallFetcher mCallFetcher;
- private final OnReportButtonClickListener mOnReportButtonClickListener;
private ViewTreeObserver mViewTreeObserver = null;
protected ContactInfoCache mContactInfoCache;
@@ -143,7 +137,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (viewHolder.getAdapterPosition() == mCurrentlyExpandedPosition) {
// Hide actions, if the clicked item is the expanded item.
- viewHolder.showActions(false, mOnReportButtonClickListener);
+ viewHolder.showActions(false);
mCurrentlyExpandedPosition = RecyclerView.NO_POSITION;
mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM;
} else {
@@ -160,7 +154,7 @@ public class CallLogAdapter extends GroupingListAdapter
notifyItemChanged(mCurrentlyExpandedPosition);
}
// Show the actions for the clicked list item.
- viewHolder.showActions(true, mOnReportButtonClickListener);
+ viewHolder.showActions(true);
mCurrentlyExpandedPosition = viewHolder.getAdapterPosition();
mCurrentlyExpandedRowId = viewHolder.rowId;
}
@@ -207,8 +201,7 @@ public class CallLogAdapter extends GroupingListAdapter
CallFetcher callFetcher,
ContactInfoHelper contactInfoHelper,
VoicemailPlaybackPresenter voicemailPlaybackPresenter,
- boolean isShowingRecentsTab,
- OnReportButtonClickListener onReportButtonClickListener) {
+ boolean isShowingRecentsTab) {
super(context);
mContext = context;
@@ -216,7 +209,6 @@ public class CallLogAdapter extends GroupingListAdapter
mContactInfoHelper = contactInfoHelper;
mVoicemailPlaybackPresenter = voicemailPlaybackPresenter;
mIsShowingRecentsTab = isShowingRecentsTab;
- mOnReportButtonClickListener = onReportButtonClickListener;
mContactInfoCache = new ContactInfoCache(
mContactInfoHelper, mOnContactInfoChangedListener);
@@ -394,6 +386,7 @@ public class CallLogAdapter extends GroupingListAdapter
details.numberLabel = info.label;
details.photoUri = info.photoUri;
details.sourceType = info.sourceType;
+ details.objectId = info.objectId;
}
CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
@@ -408,11 +401,6 @@ public class CallLogAdapter extends GroupingListAdapter
// Stash away the Ids of the calls so that we can support deleting a row in the call log.
views.callIds = getCallIds(c, count);
- // The entry can only be reported as invalid if it has a valid ID and the source of the
- // entry supports marking entries as invalid.
- views.canBeReportedAsInvalid = mContactInfoHelper.canReportAsInvalid(
- info.sourceType, info.objectId);
-
// Default case: an item in the call log.
views.primaryActionView.setVisibility(View.VISIBLE);
@@ -431,7 +419,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (mCurrentlyExpandedRowId == views.rowId) {
mCurrentlyExpandedPosition = position;
}
- views.showActions(mCurrentlyExpandedPosition == position, mOnReportButtonClickListener);
+ views.showActions(mCurrentlyExpandedPosition == position);
views.updateCallButton();
String nameForDefaultImage = null;
diff --git a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
index 97fc324b1..812e1a77a 100644
--- a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
+++ b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
@@ -170,9 +170,10 @@ public class CallLogAsyncTaskUtil {
details.numberLabel = info.label;
details.photoUri = info.photoUri;
details.sourceType = info.sourceType;
+ details.objectId = info.objectId;
details.callTypes = new int[] {
- cursor.getInt(CallDetailQuery.CALL_TYPE_COLUMN_INDEX)
+ cursor.getInt(CallDetailQuery.CALL_TYPE_COLUMN_INDEX)
};
details.date = cursor.getLong(CallDetailQuery.DATE_COLUMN_INDEX);
details.duration = cursor.getLong(CallDetailQuery.DURATION_COLUMN_INDEX);
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index d57d87a81..6f9767c41 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -64,12 +64,9 @@ import java.util.List;
* (all, missed or voicemails), specify it in the constructor.
*/
public class CallLogFragment extends Fragment
- implements CallLogQueryHandler.Listener, CallLogAdapter.OnReportButtonClickListener,
- CallLogAdapter.CallFetcher {
+ implements CallLogQueryHandler.Listener, CallLogAdapter.CallFetcher {
private static final String TAG = "CallLogFragment";
- private static final String REPORT_DIALOG_TAG = "report_dialog";
-
/**
* ID of the empty loader to defer other fragments.
*/
@@ -278,8 +275,7 @@ public class CallLogFragment extends Fragment
this,
new ContactInfoHelper(getActivity(), currentCountryIso),
mVoicemailPlaybackPresenter,
- isShowingRecentsTab,
- this);
+ isShowingRecentsTab);
mRecyclerView.setAdapter(mAdapter);
fetchCalls();
@@ -445,20 +441,4 @@ public class CallLogFragment extends Fragment
CallLogNotificationsHelper.updateVoicemailNotifications(getActivity());
}
}
-
- public void onBadDataReported(String number) {
- if (number == null) {
- return;
- }
- mAdapter.invalidateCache();
- mAdapter.notifyDataSetChanged();
- }
-
- public void onReportButtonClick(String number) {
- DialogFragment df = ObjectFactory.getReportDialogFragment(number);
- if (df != null) {
- df.setTargetFragment(this, 0);
- df.show(getActivity().getFragmentManager(), REPORT_DIALOG_TAG);
- }
- }
}
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index 6e3e8b582..d08810706 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -104,10 +104,6 @@ import com.android.dialer.R;
views.detailsButtonView.setContentDescription(
TextUtils.expandTemplate(
mResources.getString(R.string.description_details_action), nameOrNumber));
-
- views.reportButtonView.setContentDescription(
- TextUtils.expandTemplate(
- mResources.getString(R.string.description_report_action), nameOrNumber));
}
/**
diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
index 5125247aa..987bcb85d 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
@@ -77,7 +77,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
public View addToExistingContactButtonView;
public View sendMessageView;
public View detailsButtonView;
- public View reportButtonView;
/**
* The row Id for the first call associated with the call log entry. Used as a key for the
@@ -129,12 +128,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
public CharSequence nameOrNumber;
/**
- * Whether or not the contact info can be marked as invalid from the source where
- * it was obtained.
- */
- public boolean canBeReportedAsInvalid;
-
- /**
* The contact info for the contact displayed in this list item.
*/
public ContactInfo info;
@@ -222,8 +215,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
*
* @param callLogItem The call log list item view.
*/
- public void inflateActionViewStub(
- final CallLogAdapter.OnReportButtonClickListener onReportButtonClickListener) {
+ public void inflateActionViewStub() {
ViewStub stub = (ViewStub) rootView.findViewById(R.id.call_log_entry_actions_stub);
if (stub != null) {
actionsView = (ViewGroup) stub.inflate();
@@ -246,16 +238,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
detailsButtonView = actionsView.findViewById(R.id.details_action);
detailsButtonView.setOnClickListener(mActionListener);
-
- reportButtonView = actionsView.findViewById(R.id.report_action);
- reportButtonView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (onReportButtonClickListener != null) {
- onReportButtonClickListener.onReportButtonClick(number);
- }
- }
- });
}
bindActionButtons();
@@ -327,12 +309,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
detailsButtonView.setTag(
IntentProvider.getCallDetailIntentProvider(rowId, callIds, null));
- if (canBeReportedAsInvalid && !info.isBadData) {
- reportButtonView.setVisibility(View.VISIBLE);
- } else {
- reportButtonView.setVisibility(View.GONE);
- }
-
if (info != null && UriUtils.isEncodedContactUri(info.lookupUri)) {
createNewContactButtonView.setTag(IntentProvider.getAddContactIntentProvider(
info.lookupUri, info.name, info.number, info.type, true /* isNewContact */));
@@ -356,13 +332,12 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
*
* If the action views have never been shown yet for this view, inflate the view stub.
*/
- public void showActions(boolean show,
- final CallLogAdapter.OnReportButtonClickListener onReportButtonClickListener) {
+ public void showActions(boolean show) {
expandVoicemailTranscriptionView(show);
if (show) {
// Inflate the view stub if necessary, and wire up the event handlers.
- inflateActionViewStub(onReportButtonClickListener);
+ inflateActionViewStub();
actionsView.setVisibility(View.VISIBLE);
actionsView.setAlpha(1.0f);
@@ -438,7 +413,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder {
new TextView(context),
new View(context));
viewHolder.detailsButtonView = new TextView(context);
- viewHolder.reportButtonView = new TextView(context);
viewHolder.actionsView = new View(context);
viewHolder.voicemailPlaybackView = new VoicemailPlaybackLayout(context);
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index 942a73fb4..3c9fa1d73 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -32,7 +32,6 @@ import android.text.TextUtils;
import android.util.Log;
import com.android.common.io.MoreCloseables;
-import com.android.dialer.CallDetailActivity;
import com.android.dialer.R;
import com.android.dialer.calllog.PhoneAccountUtils;
import com.google.common.collect.Maps;
diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java
index 43b237c1b..1a36b05d6 100644
--- a/src/com/android/dialerbind/ObjectFactory.java
+++ b/src/com/android/dialerbind/ObjectFactory.java
@@ -18,11 +18,9 @@ package com.android.dialerbind;
import static com.android.dialer.calllog.CallLogAdapter.CallFetcher;
-import android.app.DialogFragment;
import android.content.Context;
import com.android.dialer.calllog.CallLogAdapter;
-import com.android.dialer.calllog.CallLogAdapter.OnReportButtonClickListener;
import com.android.dialer.calllog.ContactInfoHelper;
import com.android.dialer.service.CachedNumberLookupService;
import com.android.dialer.voicemail.VoicemailPlaybackPresenter;
@@ -49,18 +47,12 @@ public class ObjectFactory {
CallFetcher callFetcher,
ContactInfoHelper contactInfoHelper,
VoicemailPlaybackPresenter voicemailPlaybackPresenter,
- boolean isShowingRecentsTab,
- OnReportButtonClickListener onReportButtonClickListener) {
+ boolean isShowingRecentsTab) {
return new CallLogAdapter(
context,
callFetcher,
contactInfoHelper,
voicemailPlaybackPresenter,
- isShowingRecentsTab,
- onReportButtonClickListener);
- }
-
- public static DialogFragment getReportDialogFragment(String number) {
- return null;
+ isShowingRecentsTab);
}
}