removing some redundant code

This commit is contained in:
tibbi 2018-10-26 12:11:32 +02:00
parent 80b8d5b4d1
commit 870c325032
5 changed files with 4 additions and 33 deletions

View File

@ -11,7 +11,6 @@ import com.simplemobiletools.commons.extensions.*
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
@ -43,7 +42,7 @@ class DialpadActivity : SimpleActivity() {
dialpad_clear_char.setOnClickListener { clearChar(it) }
dialpad_clear_char.setOnLongClickListener { clearInput(); true }
dialpad_call_button.setOnClickListener { initCall() }
dialpad_input.afterTextChanged { dialpadValueChanged(it) }
dialpad_input.onTextChangeListener { dialpadValueChanged(it) }
ContactsHelper(this).getContacts { gotContacts(it) }
disableKeyboardPopping()

View File

@ -27,7 +27,6 @@ import com.simplemobiletools.contacts.dialogs.ExportContactsDialog
import com.simplemobiletools.contacts.dialogs.FilterContactSourcesDialog
import com.simplemobiletools.contacts.dialogs.ImportContactsDialog
import com.simplemobiletools.contacts.extensions.config
import com.simplemobiletools.contacts.extensions.dbHelper
import com.simplemobiletools.contacts.extensions.getTempFile
import com.simplemobiletools.contacts.fragments.MyViewPagerFragment
import com.simplemobiletools.contacts.helpers.*
@ -63,9 +62,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
appLaunched(BuildConfig.APPLICATION_ID)
setupTabColors()
// just get a reference to the database to make sure it is created properly
dbHelper
handlePermission(PERMISSION_READ_CALL_LOG) {
if (it) {
handlePermission(PERMISSION_WRITE_CALL_LOG) {
@ -320,8 +316,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
override fun onPageSelected(position: Int) {
main_tabs_holder.getTabAt(position)?.select()

View File

@ -1,13 +0,0 @@
package com.simplemobiletools.contacts.extensions
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
fun EditText.afterTextChanged(callback: (String) -> Unit) = addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(text: Editable) = callback(text.toString())
})

View File

@ -1,7 +0,0 @@
<resources>
<style name="DialpadNumberStyle" parent="DialpadNumberStyle.Base">
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>
</resources>

View File

@ -2,15 +2,12 @@
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="DialpadNumberStyle.Base">
<style name="DialpadNumberStyle">
<item name="android:gravity">center</item>
<item name="android:paddingBottom">@dimen/medium_margin</item>
<item name="android:paddingTop">@dimen/normal_margin</item>
<item name="android:textSize">@dimen/dialpad_text_size</item>
</style>
<style name="DialpadNumberStyle" parent="DialpadNumberStyle.Base">
<item name="android:background">?attr/selectableItemBackground</item>
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>
</resources>