diff --git a/app/build.gradle b/app/build.gradle
index 7dfd51dc..e9f600b2 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -61,6 +61,6 @@ android {
}
dependencies {
- implementation 'com.github.SimpleMobileTools:Simple-Commons:dea77e0130'
+ implementation 'com.github.SimpleMobileTools:Simple-Commons:ac7e52249a'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/activities/MainActivity.kt
index e402109d..c58b65ff 100644
--- a/app/src/main/kotlin/com/simplemobiletools/dialer/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/dialer/activities/MainActivity.kt
@@ -32,6 +32,7 @@ import com.simplemobiletools.dialer.R
import com.simplemobiletools.dialer.adapters.ViewPagerAdapter
import com.simplemobiletools.dialer.dialogs.ChangeSortingDialog
import com.simplemobiletools.dialer.extensions.config
+import com.simplemobiletools.dialer.extensions.launchCreateNewContactIntent
import com.simplemobiletools.dialer.fragments.FavoritesFragment
import com.simplemobiletools.dialer.fragments.MyViewPagerFragment
import com.simplemobiletools.dialer.helpers.OPEN_DIAL_PAD_AT_LAUNCH
@@ -122,6 +123,7 @@ class MainActivity : SimpleActivity() {
menu.apply {
findItem(R.id.clear_call_history).isVisible = getCurrentFragment() == recents_fragment
findItem(R.id.sort).isVisible = getCurrentFragment() != recents_fragment
+ findItem(R.id.create_new_contact).isVisible = getCurrentFragment() == contacts_fragment
setupSearch(this)
updateMenuItemColors(this)
@@ -132,9 +134,10 @@ class MainActivity : SimpleActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.clear_call_history -> clearCallHistory()
+ R.id.create_new_contact -> launchCreateNewContactIntent()
+ R.id.sort -> showSortingDialog(showCustomSorting = getCurrentFragment() is FavoritesFragment)
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
- R.id.sort -> showSortingDialog(showCustomSorting = getCurrentFragment() is FavoritesFragment)
else -> return super.onOptionsItemSelected(item)
}
return true
@@ -250,8 +253,9 @@ class MainActivity : SimpleActivity() {
main_tabs_holder.setBackgroundColor(bottomBarColor)
updateNavigationBarColor(bottomBarColor)
} else {
- main_tabs_holder.setBackgroundColor(getProperBackgroundColor())
- updateNavigationBarColor(config.navigationBarColor)
+ val bottomBarColor = config.backgroundColor.lightenColor(4)
+ main_tabs_holder.setBackgroundColor(bottomBarColor)
+ updateNavigationBarColor(bottomBarColor)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/extensions/Activity.kt
index 1a46ca29..6b810a58 100644
--- a/app/src/main/kotlin/com/simplemobiletools/dialer/extensions/Activity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/dialer/extensions/Activity.kt
@@ -25,6 +25,14 @@ fun SimpleActivity.startCallIntent(recipient: String) {
}
}
+fun SimpleActivity.launchCreateNewContactIntent() {
+ Intent().apply {
+ action = Intent.ACTION_INSERT
+ data = ContactsContract.Contacts.CONTENT_URI
+ launchActivityIntent(this)
+ }
+}
+
fun BaseSimpleActivity.callContactWithSim(recipient: String, useMainSIM: Boolean) {
handlePermission(PERMISSION_READ_PHONE_STATE) {
val wantedSimIndex = if (useMainSIM) 0 else 1
diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt
index 6c9ba0df..f0a2bb9f 100644
--- a/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/ContactsFragment.kt
@@ -1,8 +1,6 @@
package com.simplemobiletools.dialer.fragments
import android.content.Context
-import android.content.Intent
-import android.provider.ContactsContract
import android.util.AttributeSet
import com.reddit.indicatorfastscroll.FastScrollItemIndicator
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
@@ -15,6 +13,7 @@ import com.simplemobiletools.dialer.R
import com.simplemobiletools.dialer.activities.MainActivity
import com.simplemobiletools.dialer.activities.SimpleActivity
import com.simplemobiletools.dialer.adapters.ContactsAdapter
+import com.simplemobiletools.dialer.extensions.launchCreateNewContactIntent
import com.simplemobiletools.dialer.extensions.startContactDetailsIntent
import com.simplemobiletools.dialer.interfaces.RefreshItemsListener
import kotlinx.android.synthetic.main.fragment_letters_layout.view.*
@@ -33,7 +32,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
fragment_placeholder.text = context.getString(placeholderResId)
val placeholderActionResId = if (context.hasPermission(PERMISSION_READ_CONTACTS)) {
- R.string.create_new
+ R.string.create_new_contact
} else {
R.string.request_access
}
@@ -43,16 +42,12 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
underlineText()
setOnClickListener {
if (context.hasPermission(PERMISSION_READ_CONTACTS)) {
- launchCreateNewIntent()
+ activity?.launchCreateNewContactIntent()
} else {
requestReadContactsPermission()
}
}
}
-
- fragment_fab.setOnClickListener {
- launchCreateNewIntent()
- }
}
override fun setupColors(textColor: Int, primaryColor: Int, properPrimaryColor: Int) {
@@ -65,12 +60,6 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
letter_fastscroller_thumb.setupWithFastScroller(letter_fastscroller)
letter_fastscroller_thumb.textColor = properPrimaryColor.getContrastColor()
letter_fastscroller_thumb.thumbColor = properPrimaryColor.getColorStateList()
-
- fragment_fab.setColors(
- textColor,
- properPrimaryColor,
- properPrimaryColor.getContrastColor()
- )
}
override fun refreshItems(callback: (() -> Unit)?) {
@@ -159,11 +148,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
activity?.handlePermission(PERMISSION_READ_CONTACTS) {
if (it) {
fragment_placeholder.text = context.getString(R.string.no_contacts_found)
- fragment_placeholder_2.text = context.getString(R.string.create_new)
- fragment_placeholder_2.setOnClickListener {
- launchCreateNewIntent()
- }
-
+ fragment_placeholder_2.text = context.getString(R.string.create_new_contact)
SimpleContactsHelper(context).getAvailableContacts(false) { contacts ->
activity?.runOnUiThread {
gotContacts(contacts)
@@ -172,12 +157,4 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
}
}
}
-
- private fun launchCreateNewIntent() {
- Intent().apply {
- action = Intent.ACTION_INSERT
- data = ContactsContract.Contacts.CONTENT_URI
- context.launchActivityIntent(this)
- }
- }
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/FavoritesFragment.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/FavoritesFragment.kt
index 02730bf3..ab89672b 100644
--- a/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/FavoritesFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/FavoritesFragment.kt
@@ -33,7 +33,6 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
}
fragment_placeholder.text = context.getString(placeholderResId)
- fragment_fab.beGone()
fragment_placeholder_2.beGone()
}
diff --git a/app/src/main/res/layout/fragment_letters_layout.xml b/app/src/main/res/layout/fragment_letters_layout.xml
index fed28cc1..03f8085b 100644
--- a/app/src/main/res/layout/fragment_letters_layout.xml
+++ b/app/src/main/res/layout/fragment_letters_layout.xml
@@ -28,10 +28,10 @@
android:layout_height="wrap_content"
android:layout_below="@+id/fragment_placeholder"
android:layout_centerHorizontal="true"
- android:background="?attr/selectableItemBackground"
+ android:background="@drawable/ripple_all_corners"
android:gravity="center"
android:padding="@dimen/activity_margin"
- android:text="@string/create_new"
+ android:text="@string/create_new_contact"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone" />
@@ -62,16 +62,4 @@
android:layout_toStartOf="@+id/letter_fastscroller" />
-
-
-
diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml
index cc84a847..8f4181a9 100644
--- a/app/src/main/res/menu/menu.xml
+++ b/app/src/main/res/menu/menu.xml
@@ -12,6 +12,10 @@
android:icon="@drawable/ic_sort_vector"
android:title="@string/sort_by"
app:showAsAction="always" />
+