add a Call button at the dialpad activity
This commit is contained in:
parent
cacbbcedc1
commit
d024bc7551
|
@ -13,9 +13,11 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.isLollipopPlus
|
||||
import com.simplemobiletools.contacts.R
|
||||
import com.simplemobiletools.contacts.adapters.ContactsAdapter
|
||||
import com.simplemobiletools.contacts.dialogs.CallConfirmationDialog
|
||||
import com.simplemobiletools.contacts.extensions.afterTextChanged
|
||||
import com.simplemobiletools.contacts.extensions.callContact
|
||||
import com.simplemobiletools.contacts.extensions.config
|
||||
import com.simplemobiletools.contacts.extensions.startCallIntent
|
||||
import com.simplemobiletools.contacts.helpers.ContactsHelper
|
||||
import com.simplemobiletools.contacts.helpers.KEY_PHONE
|
||||
import com.simplemobiletools.contacts.helpers.LOCATION_DIALPAD
|
||||
|
@ -42,6 +44,7 @@ class DialpadActivity : SimpleActivity() {
|
|||
dialpad_hashtag.setOnClickListener { dialpadPressed("#", it) }
|
||||
dialpad_clear_char.setOnClickListener { clearChar(it) }
|
||||
dialpad_clear_char.setOnLongClickListener { clearInput(); true }
|
||||
dialpad_call_button.setOnClickListener { initCall() }
|
||||
dialpad_input.afterTextChanged { dialpadValueChanged(it) }
|
||||
ContactsHelper(this).getContacts { gotContacts(it) }
|
||||
disableKeyboardPopping()
|
||||
|
@ -143,4 +146,17 @@ class DialpadActivity : SimpleActivity() {
|
|||
dialpad_fastscroller.updateBubbleText(item?.getBubbleText() ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
private fun initCall() {
|
||||
val number = dialpad_input.value
|
||||
if (number.isNotEmpty()) {
|
||||
if (config.showCallConfirmation) {
|
||||
CallConfirmationDialog(this, number) {
|
||||
startCallIntent(number)
|
||||
}
|
||||
} else {
|
||||
startCallIntent(number)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/dialpad_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||
|
@ -181,11 +179,10 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/activity_margin"
|
||||
android:text="*"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/dialpad_call_button"
|
||||
app:layout_constraintEnd_toStartOf="@+id/dialpad_0"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_editor_absoluteY="0dp"/>
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/dialpad_0"
|
||||
|
@ -193,7 +190,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/dialpad_call_button"
|
||||
app:layout_constraintEnd_toStartOf="@+id/dialpad_hashtag"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/dialpad_asterisk"/>
|
||||
|
@ -205,9 +202,22 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/activity_margin"
|
||||
android:text="#"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/dialpad_call_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/dialpad_0"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dialpad_call_button"
|
||||
android:layout_width="@dimen/dialpad_button_size"
|
||||
android:layout_height="@dimen/dialpad_button_size"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:background="@drawable/circle_background"
|
||||
android:elevation="@dimen/medium_margin"
|
||||
android:padding="@dimen/normal_margin"
|
||||
android:src="@drawable/ic_phone_big"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
Loading…
Reference in New Issue