Loading java/com/android/dialer/app/AccountSelectionActivity.java 0 → 100644 +101 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.dialer.app; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment; import com.android.contacts.common.widget.SelectPhoneAccountDialogOptions; import com.android.contacts.common.widget.SelectPhoneAccountDialogOptionsUtil; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.util.CallUtil; import java.util.ArrayList; import java.util.List; public class AccountSelectionActivity extends AppCompatActivity { public static Intent createIntent(Context context, String number, CallInitiationType.Type initiationType) { if (TextUtils.isEmpty(number)) { return null; } List<PhoneAccount> accounts = CallUtil.getCallCapablePhoneAccounts(context, PhoneAccount.SCHEME_TEL); if (accounts == null || accounts.size() <= 1) { return null; } ArrayList<PhoneAccountHandle> accountHandles = new ArrayList<>(); for (PhoneAccount account : accounts) { accountHandles.add(account.getAccountHandle()); } return new Intent(context, AccountSelectionActivity.class) .putExtra("number", number) .putExtra("accountHandles", accountHandles) .putExtra("type", initiationType.ordinal()); } private String number; private CallInitiationType.Type initiationType; private SelectPhoneAccountDialogFragment.SelectPhoneAccountListener listener = new SelectPhoneAccountDialogFragment.SelectPhoneAccountListener() { @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, boolean setDefault, String callId) { Intent intent = new CallIntentBuilder(number, initiationType) .setPhoneAccountHandle(selectedAccountHandle) .build(); startActivity(intent); finish(); } @Override public void onDialogDismissed(String callId) { finish(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); number = getIntent().getStringExtra("number"); initiationType = CallInitiationType.Type.values()[getIntent().getIntExtra("type", 0)]; if (getFragmentManager().findFragmentByTag("dialog") == null) { List<PhoneAccountHandle> handles = getIntent().getParcelableArrayListExtra("accountHandles"); SelectPhoneAccountDialogOptions options = SelectPhoneAccountDialogOptionsUtil .builderWithAccounts(handles) .setTitle(R.string.call_via_dialog_title) .setCanSetDefault(false) .build(); SelectPhoneAccountDialogFragment dialog = SelectPhoneAccountDialogFragment.newInstance(options, listener); dialog.show(getFragmentManager(), "dialog"); } } } java/com/android/dialer/app/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,10 @@ android:theme="@style/DialtactsTheme"> </activity> <activity android:name="com.android.dialer.app.AccountSelectionActivity" android:theme="@style/TransparentTheme" android:exported="false" /> <receiver android:name="com.android.dialer.app.calllog.CallLogReceiver"> <intent-filter> <action android:name="android.intent.action.NEW_VOICEMAIL"/> Loading java/com/android/dialer/app/DialtactsActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -769,9 +769,10 @@ public class DialtactsActivity extends TransactionSafeActivity String number = data.getStringExtra(OldCallDetailsActivity.EXTRA_PHONE_NUMBER); int snackbarDurationMillis = 5_000; Snackbar.make(parentLayout, getString(R.string.ec_data_deleted), snackbarDurationMillis) .setAction( R.string.view_conversation, v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) .setAction(R.string.view_conversation, v -> { IntentProvider provider = IntentProvider.getSendSmsIntentProvider(number); startActivity(provider.getClickIntent(this)); }) .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) .show(); } Loading java/com/android/dialer/app/calllog/CallLogActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -284,9 +284,10 @@ public class CallLogActivity extends TransactionSafeActivity && data.getBooleanExtra(OldCallDetailsActivity.EXTRA_HAS_ENRICHED_CALL_DATA, false)) { String number = data.getStringExtra(OldCallDetailsActivity.EXTRA_PHONE_NUMBER); Snackbar.make(findViewById(R.id.calllog_frame), getString(R.string.ec_data_deleted), 5_000) .setAction( R.string.view_conversation, v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) .setAction(R.string.view_conversation, v -> { IntentProvider provider = IntentProvider.getSendSmsIntentProvider(number); startActivity(provider.getClickIntent(this)); }) .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) .show(); } Loading java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +17 −1 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ import java.lang.ref.WeakReference; */ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener, MenuItem.OnMenuItemClickListener, View.OnCreateContextMenuListener { Loading Loading @@ -306,6 +307,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder quickContactView.setOverlay(null); quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); primaryActionButtonView.setOnClickListener(this); primaryActionButtonView.setOnLongClickListener(this); primaryActionView.setOnClickListener(this.expandCollapseListener); if (this.voicemailPlaybackPresenter != null && ConfigProviderComponent.get(this.context) Loading Loading @@ -519,6 +521,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder primaryActionButtonView.setContentDescription( TextUtils.expandTemplate( context.getString(R.string.description_voicemail_action), validNameOrNumber)); primaryActionButtonView.setTag(null); primaryActionButtonView.setVisibility(View.VISIBLE); } else { primaryActionButtonView.setVisibility(View.GONE); Loading Loading @@ -1053,7 +1056,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder return; } intentProvider.logInteraction(context); final Intent intent = intentProvider.getIntent(context); final Intent intent = intentProvider.getClickIntent(context); // See IntentProvider.getCallDetailIntentProvider() for why this may be null. if (intent == null) { return; Loading @@ -1073,6 +1077,18 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } } @Override public boolean onLongClick(View view) { final IntentProvider intentProvider = (IntentProvider) view.getTag(); final Intent intent = intentProvider != null ? intentProvider.getLongClickIntent(context) : null; if (intent != null) { DialerUtils.startActivityWithErrorToast(context, intent); return true; } return false; } private static boolean isNonContactEntry(ContactInfo info) { if (info == null || info.sourceType != Type.SOURCE_TYPE_DIRECTORY) { return true; Loading Loading
java/com/android/dialer/app/AccountSelectionActivity.java 0 → 100644 +101 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.dialer.app; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment; import com.android.contacts.common.widget.SelectPhoneAccountDialogOptions; import com.android.contacts.common.widget.SelectPhoneAccountDialogOptionsUtil; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.util.CallUtil; import java.util.ArrayList; import java.util.List; public class AccountSelectionActivity extends AppCompatActivity { public static Intent createIntent(Context context, String number, CallInitiationType.Type initiationType) { if (TextUtils.isEmpty(number)) { return null; } List<PhoneAccount> accounts = CallUtil.getCallCapablePhoneAccounts(context, PhoneAccount.SCHEME_TEL); if (accounts == null || accounts.size() <= 1) { return null; } ArrayList<PhoneAccountHandle> accountHandles = new ArrayList<>(); for (PhoneAccount account : accounts) { accountHandles.add(account.getAccountHandle()); } return new Intent(context, AccountSelectionActivity.class) .putExtra("number", number) .putExtra("accountHandles", accountHandles) .putExtra("type", initiationType.ordinal()); } private String number; private CallInitiationType.Type initiationType; private SelectPhoneAccountDialogFragment.SelectPhoneAccountListener listener = new SelectPhoneAccountDialogFragment.SelectPhoneAccountListener() { @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, boolean setDefault, String callId) { Intent intent = new CallIntentBuilder(number, initiationType) .setPhoneAccountHandle(selectedAccountHandle) .build(); startActivity(intent); finish(); } @Override public void onDialogDismissed(String callId) { finish(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); number = getIntent().getStringExtra("number"); initiationType = CallInitiationType.Type.values()[getIntent().getIntExtra("type", 0)]; if (getFragmentManager().findFragmentByTag("dialog") == null) { List<PhoneAccountHandle> handles = getIntent().getParcelableArrayListExtra("accountHandles"); SelectPhoneAccountDialogOptions options = SelectPhoneAccountDialogOptionsUtil .builderWithAccounts(handles) .setTitle(R.string.call_via_dialog_title) .setCanSetDefault(false) .build(); SelectPhoneAccountDialogFragment dialog = SelectPhoneAccountDialogFragment.newInstance(options, listener); dialog.show(getFragmentManager(), "dialog"); } } }
java/com/android/dialer/app/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,10 @@ android:theme="@style/DialtactsTheme"> </activity> <activity android:name="com.android.dialer.app.AccountSelectionActivity" android:theme="@style/TransparentTheme" android:exported="false" /> <receiver android:name="com.android.dialer.app.calllog.CallLogReceiver"> <intent-filter> <action android:name="android.intent.action.NEW_VOICEMAIL"/> Loading
java/com/android/dialer/app/DialtactsActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -769,9 +769,10 @@ public class DialtactsActivity extends TransactionSafeActivity String number = data.getStringExtra(OldCallDetailsActivity.EXTRA_PHONE_NUMBER); int snackbarDurationMillis = 5_000; Snackbar.make(parentLayout, getString(R.string.ec_data_deleted), snackbarDurationMillis) .setAction( R.string.view_conversation, v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) .setAction(R.string.view_conversation, v -> { IntentProvider provider = IntentProvider.getSendSmsIntentProvider(number); startActivity(provider.getClickIntent(this)); }) .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) .show(); } Loading
java/com/android/dialer/app/calllog/CallLogActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -284,9 +284,10 @@ public class CallLogActivity extends TransactionSafeActivity && data.getBooleanExtra(OldCallDetailsActivity.EXTRA_HAS_ENRICHED_CALL_DATA, false)) { String number = data.getStringExtra(OldCallDetailsActivity.EXTRA_PHONE_NUMBER); Snackbar.make(findViewById(R.id.calllog_frame), getString(R.string.ec_data_deleted), 5_000) .setAction( R.string.view_conversation, v -> startActivity(IntentProvider.getSendSmsIntentProvider(number).getIntent(this))) .setAction(R.string.view_conversation, v -> { IntentProvider provider = IntentProvider.getSendSmsIntentProvider(number); startActivity(provider.getClickIntent(this)); }) .setActionTextColor(getResources().getColor(R.color.dialer_snackbar_action_text_color)) .show(); } Loading
java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +17 −1 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ import java.lang.ref.WeakReference; */ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener, MenuItem.OnMenuItemClickListener, View.OnCreateContextMenuListener { Loading Loading @@ -306,6 +307,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder quickContactView.setOverlay(null); quickContactView.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE); primaryActionButtonView.setOnClickListener(this); primaryActionButtonView.setOnLongClickListener(this); primaryActionView.setOnClickListener(this.expandCollapseListener); if (this.voicemailPlaybackPresenter != null && ConfigProviderComponent.get(this.context) Loading Loading @@ -519,6 +521,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder primaryActionButtonView.setContentDescription( TextUtils.expandTemplate( context.getString(R.string.description_voicemail_action), validNameOrNumber)); primaryActionButtonView.setTag(null); primaryActionButtonView.setVisibility(View.VISIBLE); } else { primaryActionButtonView.setVisibility(View.GONE); Loading Loading @@ -1053,7 +1056,8 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder return; } intentProvider.logInteraction(context); final Intent intent = intentProvider.getIntent(context); final Intent intent = intentProvider.getClickIntent(context); // See IntentProvider.getCallDetailIntentProvider() for why this may be null. if (intent == null) { return; Loading @@ -1073,6 +1077,18 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } } @Override public boolean onLongClick(View view) { final IntentProvider intentProvider = (IntentProvider) view.getTag(); final Intent intent = intentProvider != null ? intentProvider.getLongClickIntent(context) : null; if (intent != null) { DialerUtils.startActivityWithErrorToast(context, intent); return true; } return false; } private static boolean isNonContactEntry(ContactInfo info) { if (info == null || info.sourceType != Type.SOURCE_TYPE_DIRECTORY) { return true; Loading