Loading src/com/android/dialer/calllog/CallLogAdapter.java +17 −16 Original line number Diff line number Diff line Loading @@ -195,26 +195,27 @@ public class CallLogAdapter extends GroupingListAdapter private ImageView mBadgeImageView; private TextView mBadgeText; /** Listener for the primary action in the list, opens the call details. */ private final View.OnClickListener mPrimaryActionListener = new View.OnClickListener() { /** Listener for the primary or secondary actions in the list. * Primary opens the call details. * Secondary calls or plays. **/ private final View.OnClickListener mActionListener = new View.OnClickListener() { @Override public void onClick(View view) { IntentProvider intentProvider = (IntentProvider) view.getTag(); if (intentProvider != null) { mContext.startActivity(intentProvider.getIntent(mContext)); } startActivityForAction(view); } }; /** Listener for the secondary action in the list, either call or play. */ private final View.OnClickListener mSecondaryActionListener = new View.OnClickListener() { @Override public void onClick(View view) { IntentProvider intentProvider = (IntentProvider) view.getTag(); private void startActivityForAction(View view) { final IntentProvider intentProvider = (IntentProvider) view.getTag(); if (intentProvider != null) { mContext.startActivity(intentProvider.getIntent(mContext)); final Intent intent = intentProvider.getIntent(mContext); // See IntentProvider.getCallDetailIntentProvider() for why this may be null. if (intent != null) { mContext.startActivity(intent); } } } }; @Override public boolean onPreDraw() { Loading Loading @@ -497,8 +498,8 @@ public class CallLogAdapter extends GroupingListAdapter private void findAndCacheViews(View view) { // Get the views to bind to. CallLogListItemViews views = CallLogListItemViews.fromView(view); views.primaryActionView.setOnClickListener(mPrimaryActionListener); views.secondaryActionView.setOnClickListener(mSecondaryActionListener); views.primaryActionView.setOnClickListener(mActionListener); views.secondaryActionView.setOnClickListener(mActionListener); view.setTag(views); } Loading src/com/android/dialer/calllog/IntentProvider.java +12 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.provider.CallLog.Calls; import android.util.Log; import com.android.contacts.common.CallUtil; import com.android.dialer.CallDetailActivity; Loading @@ -32,6 +33,9 @@ import com.android.dialer.CallDetailActivity; * The intent is constructed lazily with the given information. */ public abstract class IntentProvider { private static final String TAG = IntentProvider.class.getSimpleName(); public abstract Intent getIntent(Context context); public static IntentProvider getReturnCallIntentProvider(final String number) { Loading Loading @@ -66,6 +70,14 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { if (cursor.isClosed()) { // There are reported instances where the cursor is already closed. // b/10937133 // When causes a crash when it's accessed here. Log.e(TAG, "getCallDetailIntentProvider() cursor is already closed."); return null; } cursor.moveToPosition(position); Intent intent = new Intent(context, CallDetailActivity.class); Loading Loading
src/com/android/dialer/calllog/CallLogAdapter.java +17 −16 Original line number Diff line number Diff line Loading @@ -195,26 +195,27 @@ public class CallLogAdapter extends GroupingListAdapter private ImageView mBadgeImageView; private TextView mBadgeText; /** Listener for the primary action in the list, opens the call details. */ private final View.OnClickListener mPrimaryActionListener = new View.OnClickListener() { /** Listener for the primary or secondary actions in the list. * Primary opens the call details. * Secondary calls or plays. **/ private final View.OnClickListener mActionListener = new View.OnClickListener() { @Override public void onClick(View view) { IntentProvider intentProvider = (IntentProvider) view.getTag(); if (intentProvider != null) { mContext.startActivity(intentProvider.getIntent(mContext)); } startActivityForAction(view); } }; /** Listener for the secondary action in the list, either call or play. */ private final View.OnClickListener mSecondaryActionListener = new View.OnClickListener() { @Override public void onClick(View view) { IntentProvider intentProvider = (IntentProvider) view.getTag(); private void startActivityForAction(View view) { final IntentProvider intentProvider = (IntentProvider) view.getTag(); if (intentProvider != null) { mContext.startActivity(intentProvider.getIntent(mContext)); final Intent intent = intentProvider.getIntent(mContext); // See IntentProvider.getCallDetailIntentProvider() for why this may be null. if (intent != null) { mContext.startActivity(intent); } } } }; @Override public boolean onPreDraw() { Loading Loading @@ -497,8 +498,8 @@ public class CallLogAdapter extends GroupingListAdapter private void findAndCacheViews(View view) { // Get the views to bind to. CallLogListItemViews views = CallLogListItemViews.fromView(view); views.primaryActionView.setOnClickListener(mPrimaryActionListener); views.secondaryActionView.setOnClickListener(mSecondaryActionListener); views.primaryActionView.setOnClickListener(mActionListener); views.secondaryActionView.setOnClickListener(mActionListener); view.setTag(views); } Loading
src/com/android/dialer/calllog/IntentProvider.java +12 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.provider.CallLog.Calls; import android.util.Log; import com.android.contacts.common.CallUtil; import com.android.dialer.CallDetailActivity; Loading @@ -32,6 +33,9 @@ import com.android.dialer.CallDetailActivity; * The intent is constructed lazily with the given information. */ public abstract class IntentProvider { private static final String TAG = IntentProvider.class.getSimpleName(); public abstract Intent getIntent(Context context); public static IntentProvider getReturnCallIntentProvider(final String number) { Loading Loading @@ -66,6 +70,14 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { if (cursor.isClosed()) { // There are reported instances where the cursor is already closed. // b/10937133 // When causes a crash when it's accessed here. Log.e(TAG, "getCallDetailIntentProvider() cursor is already closed."); return null; } cursor.moveToPosition(position); Intent intent = new Intent(context, CallDetailActivity.class); Loading