diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c965a109..fd10164a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,10 +12,7 @@ - - - @@ -59,15 +56,6 @@ - - - - - - - - - R.drawable.ic_person LOCATION_FAVORITES_TAB -> R.drawable.ic_star_on - LOCATION_RECENTS_TAB -> R.drawable.ic_clock else -> R.drawable.ic_group } @@ -529,52 +509,16 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { favorites_fragment?.refreshContacts(contacts) } - if (refreshTabsMask and RECENTS_TAB_MASK != 0) { - recents_fragment?.refreshContacts(contacts) - } - if (refreshTabsMask and GROUPS_TAB_MASK != 0) { if (refreshTabsMask == GROUPS_TAB_MASK) { groups_fragment.skipHashComparing = true } groups_fragment?.refreshContacts(contacts) } - - if (refreshTabsMask and RECENTS_TAB_MASK != 0) { - ContactsHelper(this).getRecents { - it.filter { it.name == null }.forEach { - val namelessCall = it - val contact = contacts.firstOrNull { it.doesContainPhoneNumber(namelessCall.number) } - if (contact != null) { - it.name = contact.getNameToDisplay() - } - } - - runOnUiThread { - recents_fragment?.updateRecentCalls(it) - } - } - } } } - private fun getAllFragments() = arrayListOf(contacts_fragment, favorites_fragment, recents_fragment, groups_fragment) - - private fun getRecentsTabIndex(): Int { - var index = 0 - if (config.showTabs and RECENTS_TAB_MASK == 0) { - return index - } - - if (config.showTabs and CONTACTS_TAB_MASK != 0) { - index++ - } - - if (config.showTabs and FAVORITES_TAB_MASK != 0) { - index++ - } - return index - } + private fun getAllFragments() = arrayListOf(contacts_fragment, favorites_fragment, groups_fragment) private fun checkWhatsNewDialog() { arrayListOf().apply { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/RecentCallsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/RecentCallsAdapter.kt deleted file mode 100644 index 72a13c33..00000000 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/RecentCallsAdapter.kt +++ /dev/null @@ -1,150 +0,0 @@ -package com.simplemobiletools.contacts.pro.adapters - -import android.view.Menu -import android.view.View -import android.view.ViewGroup -import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter -import com.simplemobiletools.commons.dialogs.ConfirmationDialog -import com.simplemobiletools.commons.extensions.beVisibleIf -import com.simplemobiletools.commons.helpers.isNougatPlus -import com.simplemobiletools.commons.views.FastScroller -import com.simplemobiletools.commons.views.MyRecyclerView -import com.simplemobiletools.contacts.pro.R -import com.simplemobiletools.contacts.pro.activities.SimpleActivity -import com.simplemobiletools.contacts.pro.extensions.addBlockedNumber -import com.simplemobiletools.contacts.pro.extensions.config -import com.simplemobiletools.contacts.pro.extensions.startCallIntent -import com.simplemobiletools.contacts.pro.helpers.ContactsHelper -import com.simplemobiletools.contacts.pro.helpers.RECENTS_TAB_MASK -import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener -import com.simplemobiletools.contacts.pro.models.RecentCall -import kotlinx.android.synthetic.main.item_recent_call.view.* -import java.util.* - -class RecentCallsAdapter(activity: SimpleActivity, var recentCalls: ArrayList, val refreshListener: RefreshContactsListener?, recyclerView: MyRecyclerView, - fastScroller: FastScroller, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { - private val showPhoneNumbers = activity.config.showPhoneNumbers - - init { - setupDragListener(true) - } - - override fun getActionMenuId() = R.menu.cab_recent_calls - - override fun prepareActionMode(menu: Menu) { - val selectedItems = getSelectedItems() - if (selectedItems.isEmpty()) { - return - } - - menu.apply { - findItem(R.id.cab_block_number).isVisible = isNougatPlus() - findItem(R.id.cab_block_number).title = activity.getString(if (isOneItemSelected()) R.string.block_number else R.string.block_numbers) - findItem(R.id.cab_call_number).isVisible = isOneItemSelected() && selectedItems.first().name == null - } - } - - override fun actionItemPressed(id: Int) { - if (selectedKeys.isEmpty()) { - return - } - - when (id) { - R.id.cab_call_number -> callNumber() - R.id.cab_select_all -> selectAll() - R.id.cab_delete -> askConfirmDelete() - R.id.cab_block_number -> blockNumber() - } - } - - override fun getSelectableItemCount() = recentCalls.size - - override fun getIsItemSelectable(position: Int) = true - - override fun getItemSelectionKey(position: Int) = recentCalls.getOrNull(position)?.id - - override fun getItemKeyPosition(key: Int) = recentCalls.indexOfFirst { it.id == key } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_recent_call, parent) - - override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) { - val recentCall = recentCalls[position] - holder.bindView(recentCall, true, true) { itemView, layoutPosition -> - setupView(itemView, recentCall) - } - bindViewHolder(holder) - } - - override fun getItemCount() = recentCalls.size - - fun updateItems(newItems: ArrayList) { - recentCalls = newItems - notifyDataSetChanged() - finishActMode() - fastScroller?.measureRecyclerView() - } - - private fun callNumber() { - (activity as SimpleActivity).startCallIntent(getSelectedItems().first().number) - } - - private fun askConfirmDelete() { - ConfirmationDialog(activity) { - deleteRecentCalls() - } - } - - private fun deleteRecentCalls() { - if (selectedKeys.isEmpty()) { - return - } - - val callsToRemove = getSelectedItems() - val positions = getSelectedItemPositions() - ContactsHelper(activity).removeRecentCalls(callsToRemove.map { it.id } as ArrayList) - recentCalls.removeAll(callsToRemove) - - if (recentCalls.isEmpty()) { - refreshListener?.refreshContacts(RECENTS_TAB_MASK) - finishActMode() - } else { - removeSelectedItems(positions) - } - } - - private fun blockNumber() { - Thread { - getSelectedItems().forEach { - activity.addBlockedNumber(it.number) - } - - refreshListener?.refreshContacts(RECENTS_TAB_MASK) - activity.runOnUiThread { - finishActMode() - } - }.start() - } - - private fun getSelectedItems() = recentCalls.filter { selectedKeys.contains(it.id) } as ArrayList - - private fun setupView(view: View, recentCall: RecentCall) { - view.apply { - recent_call_frame?.isSelected = selectedKeys.contains(recentCall.id) - recent_call_name.apply { - text = recentCall.name ?: recentCall.number - setTextColor(textColor) - } - - recent_call_number.apply { - beVisibleIf(showPhoneNumbers && recentCall.name != null) - text = recentCall.number - setTextColor(textColor) - } - - recent_call_date_time.apply { - text = recentCall.dateTime - setTextColor(textColor) - } - } - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt index bbc91af0..12d0edb3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/ViewPagerAdapter.kt @@ -7,7 +7,10 @@ import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.activities.MainActivity import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment -import com.simplemobiletools.contacts.pro.helpers.* +import com.simplemobiletools.contacts.pro.helpers.CONTACTS_TAB_MASK +import com.simplemobiletools.contacts.pro.helpers.FAVORITES_TAB_MASK +import com.simplemobiletools.contacts.pro.helpers.GROUPS_TAB_MASK +import com.simplemobiletools.contacts.pro.helpers.tabsList class ViewPagerAdapter(val activity: MainActivity) : PagerAdapter() { private val showTabs = activity.config.showTabs @@ -42,10 +45,6 @@ class ViewPagerAdapter(val activity: MainActivity) : PagerAdapter() { fragments.add(R.layout.fragment_favorites) } - if (showTabs and RECENTS_TAB_MASK != 0) { - fragments.add(R.layout.fragment_recents) - } - if (showTabs and GROUPS_TAB_MASK != 0) { fragments.add(R.layout.fragment_groups) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ManageVisibleTabsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ManageVisibleTabsDialog.kt index 076c1be7..0ecc7271 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ManageVisibleTabsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ManageVisibleTabsDialog.kt @@ -6,7 +6,10 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.views.MyAppCompatCheckbox import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.extensions.config -import com.simplemobiletools.contacts.pro.helpers.* +import com.simplemobiletools.contacts.pro.helpers.ALL_TABS_MASK +import com.simplemobiletools.contacts.pro.helpers.CONTACTS_TAB_MASK +import com.simplemobiletools.contacts.pro.helpers.FAVORITES_TAB_MASK +import com.simplemobiletools.contacts.pro.helpers.GROUPS_TAB_MASK class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) { private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_visible_tabs, null) @@ -16,7 +19,6 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) { tabs.apply { put(CONTACTS_TAB_MASK, R.id.manage_visible_tabs_contacts) put(FAVORITES_TAB_MASK, R.id.manage_visible_tabs_favorites) - put(RECENTS_TAB_MASK, R.id.manage_visible_tabs_recents) put(GROUPS_TAB_MASK, R.id.manage_visible_tabs_groups) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt index 6421f519..675efa3e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt @@ -15,7 +15,6 @@ import com.simplemobiletools.contacts.pro.activities.MainActivity import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.adapters.ContactsAdapter import com.simplemobiletools.contacts.pro.adapters.GroupsAdapter -import com.simplemobiletools.contacts.pro.adapters.RecentCallsAdapter import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.contactClicked import com.simplemobiletools.contacts.pro.extensions.getVisibleContactSources @@ -59,11 +58,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) fragment_placeholder.text = activity.getString(R.string.no_group_created) fragment_placeholder_2.text = activity.getString(R.string.create_group) } - this is RecentsFragment -> { - fragment_fab.beGone() - fragment_placeholder.text = activity.getString(R.string.no_recent_calls_found) - fragment_placeholder_2.text = activity.getString(R.string.request_the_required_permissions) - } } } } @@ -71,7 +65,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) fun textColorChanged(color: Int) { when { this is GroupsFragment -> (fragment_list.adapter as GroupsAdapter).updateTextColor(color) - this is RecentsFragment -> (fragment_list.adapter as RecentCallsAdapter).updateTextColor(color) else -> (fragment_list.adapter as ContactsAdapter).apply { updateTextColor(color) initDrawables() @@ -88,7 +81,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) } fun startNameWithSurnameChanged(startNameWithSurname: Boolean) { - if (this !is GroupsFragment && this !is RecentsFragment) { + if (this !is GroupsFragment) { (fragment_list.adapter as? ContactsAdapter)?.apply { config.sorting = if (startNameWithSurname) SORT_BY_SURNAME else SORT_BY_FIRST_NAME this@MyViewPagerFragment.activity!!.refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK) @@ -99,7 +92,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) fun refreshContacts(contacts: ArrayList) { if ((config.showTabs and CONTACTS_TAB_MASK == 0 && this is ContactsFragment) || (config.showTabs and FAVORITES_TAB_MASK == 0 && this is FavoritesFragment) || - (config.showTabs and RECENTS_TAB_MASK == 0 && this is RecentsFragment) || (config.showTabs and GROUPS_TAB_MASK == 0 && this is GroupsFragment)) { return } @@ -114,7 +106,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) val filtered = when { this is GroupsFragment -> contacts this is FavoritesFragment -> contacts.filter { it.starred == 1 } as ArrayList - this is RecentsFragment -> ArrayList() else -> { val contactSources = activity!!.getVisibleContactSources() contacts.filter { contactSources.contains(it.source) } as ArrayList @@ -133,7 +124,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) private fun setupContacts(contacts: ArrayList) { if (this is GroupsFragment) { setupGroupsAdapter(contacts) - } else if (this !is RecentsFragment) { + } else { setupContactsFavoritesAdapter(contacts) } @@ -219,7 +210,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) showContactThumbnails = showThumbnails notifyDataSetChanged() } - } else if (this !is RecentsFragment) { + } else { (fragment_list.adapter as? ContactsAdapter)?.apply { showContactThumbnails = showThumbnails notifyDataSetChanged() diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/RecentsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/RecentsFragment.kt deleted file mode 100644 index a227c7e9..00000000 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/RecentsFragment.kt +++ /dev/null @@ -1,89 +0,0 @@ -package com.simplemobiletools.contacts.pro.fragments - -import android.annotation.TargetApi -import android.content.Context -import android.content.Intent -import android.os.Build -import android.telecom.TelecomManager -import android.util.AttributeSet -import com.simplemobiletools.commons.extensions.beVisibleIf -import com.simplemobiletools.commons.extensions.hasPermission -import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALL_LOG -import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALL_LOG -import com.simplemobiletools.commons.helpers.isMarshmallowPlus -import com.simplemobiletools.contacts.pro.activities.InsertOrEditContactActivity -import com.simplemobiletools.contacts.pro.adapters.RecentCallsAdapter -import com.simplemobiletools.contacts.pro.extensions.contactClicked -import com.simplemobiletools.contacts.pro.extensions.isDefaultDialer -import com.simplemobiletools.contacts.pro.extensions.normalizeNumber -import com.simplemobiletools.contacts.pro.helpers.IS_FROM_SIMPLE_CONTACTS -import com.simplemobiletools.contacts.pro.helpers.KEY_PHONE -import com.simplemobiletools.contacts.pro.helpers.RECENTS_TAB_MASK -import com.simplemobiletools.contacts.pro.models.Contact -import com.simplemobiletools.contacts.pro.models.RecentCall -import kotlinx.android.synthetic.main.fragment_layout.view.* - -class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { - override fun fabClicked() {} - - @TargetApi(Build.VERSION_CODES.M) - override fun placeholderClicked() { - if (!isMarshmallowPlus() || (isMarshmallowPlus() && context.isDefaultDialer())) { - activity!!.handlePermission(PERMISSION_WRITE_CALL_LOG) { - if (it) { - activity!!.handlePermission(PERMISSION_READ_CALL_LOG) { - activity?.refreshContacts(RECENTS_TAB_MASK) - } - } - } - } else { - val intent = Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER).putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, context.packageName) - context.startActivity(intent) - } - } - - fun updateRecentCalls(recentCalls: ArrayList) { - if (activity == null || activity!!.isDestroyed) { - return - } - - fragment_placeholder.beVisibleIf(recentCalls.isEmpty()) - fragment_placeholder_2.beVisibleIf(recentCalls.isEmpty() && !activity!!.hasPermission(PERMISSION_WRITE_CALL_LOG)) - fragment_list.beVisibleIf(recentCalls.isNotEmpty()) - - val currAdapter = fragment_list.adapter - if (currAdapter == null) { - RecentCallsAdapter(activity!!, recentCalls, activity, fragment_list, fragment_fastscroller) { - val recentCall = (it as RecentCall).number.normalizeNumber() - var selectedContact: Contact? = null - for (contact in allContacts) { - if (contact.doesContainPhoneNumber(recentCall)) { - selectedContact = contact - break - } - } - - if (selectedContact != null) { - activity?.contactClicked(selectedContact) - } else { - Intent(context, InsertOrEditContactActivity::class.java).apply { - action = Intent.ACTION_INSERT_OR_EDIT - putExtra(KEY_PHONE, recentCall) - putExtra(IS_FROM_SIMPLE_CONTACTS, true) - context.startActivity(this) - } - } - }.apply { - addVerticalDividers(true) - fragment_list.adapter = this - } - - fragment_fastscroller.setViews(fragment_list) { - val item = (fragment_list.adapter as RecentCallsAdapter).recentCalls.getOrNull(it) - fragment_fastscroller.updateBubbleText(item?.name ?: item?.number ?: "") - } - } else { - (currAdapter as RecentCallsAdapter).updateItems(recentCalls) - } - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt index 1e2786de..9a59aaa4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt @@ -35,21 +35,18 @@ const val KEY_NAME = "name" const val LOCATION_CONTACTS_TAB = 0 const val LOCATION_FAVORITES_TAB = 1 -const val LOCATION_RECENTS_TAB = 2 -const val LOCATION_GROUPS_TAB = 3 -const val LOCATION_GROUP_CONTACTS = 4 -const val LOCATION_DIALPAD = 5 -const val LOCATION_INSERT_OR_EDIT = 6 +const val LOCATION_GROUPS_TAB = 2 +const val LOCATION_GROUP_CONTACTS = 3 +const val LOCATION_DIALPAD = 4 +const val LOCATION_INSERT_OR_EDIT = 5 const val CONTACTS_TAB_MASK = 1 const val FAVORITES_TAB_MASK = 2 -const val RECENTS_TAB_MASK = 4 const val GROUPS_TAB_MASK = 8 -const val ALL_TABS_MASK = 15 +const val ALL_TABS_MASK = CONTACTS_TAB_MASK or FAVORITES_TAB_MASK or GROUPS_TAB_MASK val tabsList = arrayListOf(CONTACTS_TAB_MASK, FAVORITES_TAB_MASK, - RECENTS_TAB_MASK, GROUPS_TAB_MASK ) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index a4e69bf3..b25544e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -2,14 +2,12 @@ package com.simplemobiletools.contacts.pro.helpers import android.accounts.Account import android.accounts.AccountManager -import android.annotation.SuppressLint import android.content.* import android.database.Cursor import android.graphics.Bitmap import android.net.Uri import android.os.Handler import android.os.Looper -import android.provider.CallLog import android.provider.ContactsContract import android.provider.ContactsContract.CommonDataKinds import android.provider.ContactsContract.CommonDataKinds.Nickname @@ -23,7 +21,6 @@ import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.extensions.* import com.simplemobiletools.contacts.pro.models.* import com.simplemobiletools.contacts.pro.overloads.times -import java.text.SimpleDateFormat import java.util.* import kotlin.collections.ArrayList @@ -1552,93 +1549,4 @@ class ContactsHelper(val context: Context) { context.showErrorToast(e) } } - - @SuppressLint("MissingPermission") - fun getRecents(callback: (ArrayList) -> Unit) { - Thread { - val calls = ArrayList() - if (!context.hasPermission(PERMISSION_WRITE_CALL_LOG) || !context.hasPermission(PERMISSION_READ_CALL_LOG)) { - callback(calls) - return@Thread - } - - val blockedNumbers = context.getBlockedNumbers() - val uri = CallLog.Calls.CONTENT_URI - val projection = arrayOf( - CallLog.Calls._ID, - CallLog.Calls.NUMBER, - CallLog.Calls.DATE, - CallLog.Calls.CACHED_NAME - ) - - val sorting = "${CallLog.Calls._ID} DESC LIMIT 100" - val currentDate = Date(System.currentTimeMillis()) - val currentYear = SimpleDateFormat("yyyy", Locale.getDefault()).format(currentDate) - val todayDate = SimpleDateFormat("dd MMM yyyy", Locale.getDefault()).format(currentDate) - val yesterdayDate = SimpleDateFormat("dd MMM yyyy", Locale.getDefault()).format(Date(System.currentTimeMillis() - DAY_SECONDS * 1000)) - val yesterday = context.getString(R.string.yesterday) - val timeFormat = if (context.config.use24HourFormat) "HH:mm" else "h:mm a" - var prevNumber = "" - - var cursor: Cursor? = null - try { - cursor = context.contentResolver.query(uri, projection, null, null, sorting) - if (cursor?.moveToFirst() == true) { - do { - val id = cursor.getIntValue(CallLog.Calls._ID) - val number = cursor.getStringValue(CallLog.Calls.NUMBER) - val date = cursor.getLongValue(CallLog.Calls.DATE) - val name = cursor.getStringValue(CallLog.Calls.CACHED_NAME) - if (number == prevNumber) { - continue - } - - if (blockedNumbers.any { it.number == number || it.normalizedNumber == number }) { - continue - } - - var formattedDate = SimpleDateFormat("dd MMM yyyy, $timeFormat", Locale.getDefault()).format(Date(date)) - val datePart = formattedDate.substring(0, 11) - when { - datePart == todayDate -> formattedDate = formattedDate.substring(12) - datePart == yesterdayDate -> formattedDate = yesterday + formattedDate.substring(11) - formattedDate.substring(7, 11) == currentYear -> formattedDate = formattedDate.substring(0, 6) + formattedDate.substring(11) - } - - prevNumber = number - val recentCall = RecentCall(id, number, formattedDate, name) - calls.add(recentCall) - } while (cursor.moveToNext()) - } - } finally { - cursor?.close() - } - callback(calls) - }.start() - } - - fun removeRecentCalls(ids: ArrayList) { - Thread { - try { - val operations = ArrayList() - val selection = "${CallLog.Calls._ID} = ?" - ids.forEach { - ContentProviderOperation.newDelete(CallLog.Calls.CONTENT_URI).apply { - val selectionArgs = arrayOf(it.toString()) - withSelection(selection, selectionArgs) - operations.add(build()) - } - - if (operations.size % BATCH_SIZE == 0) { - context.contentResolver.applyBatch(CallLog.AUTHORITY, operations) - operations.clear() - } - } - - context.contentResolver.applyBatch(CallLog.AUTHORITY, operations) - } catch (e: Exception) { - context.showErrorToast(e) - } - }.start() - } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/RecentCall.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/RecentCall.kt deleted file mode 100644 index 536599e8..00000000 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/models/RecentCall.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.simplemobiletools.contacts.pro.models - -data class RecentCall(var id: Int, var number: String, var dateTime: String, var name: String?) diff --git a/app/src/main/res/layout/dialog_manage_visible_tabs.xml b/app/src/main/res/layout/dialog_manage_visible_tabs.xml index e690b1dc..65e8978c 100644 --- a/app/src/main/res/layout/dialog_manage_visible_tabs.xml +++ b/app/src/main/res/layout/dialog_manage_visible_tabs.xml @@ -30,14 +30,6 @@ android:paddingTop="@dimen/activity_margin" android:text="@string/favorites"/> - - - - - - - diff --git a/app/src/main/res/layout/item_recent_call.xml b/app/src/main/res/layout/item_recent_call.xml deleted file mode 100644 index da43a6ea..00000000 --- a/app/src/main/res/layout/item_recent_call.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - diff --git a/app/src/main/res/menu/cab_recent_calls.xml b/app/src/main/res/menu/cab_recent_calls.xml deleted file mode 100644 index d26f3097..00000000 --- a/app/src/main/res/menu/cab_recent_calls.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index acede989..be13ce8c 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -19,13 +19,11 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found Yeni kontakt Redaktə et @@ -65,7 +63,6 @@ Göstərilən nişanları idarə et Kontaktlar Sevimlilər - Hazırki zənglər Zəngə başlamazdan əvvəl zəng təsdiq pəncərəsi göstər Show only contacts with phone numbers diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 33cc39a4..d7e3206d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -19,13 +19,11 @@ Zu einem existierenden Kontakt hinzufügen Du musst diese App als Standardtelefonie-App einstellen, um Nummern blockieren zu können. Als Standard auswählen - Call number Keine Kontakte gefunden Keine Kontakte mit E-Mailadressen gefunden Keine Kontakte mit Telefonnummern gefunden - Keine kürzlichen Anrufe gefunden Neuer Kontakt Kontakt bearbeiten @@ -65,7 +63,6 @@ Anzuzeigende Tabs festlegen Kontakte Favoriten - Anrufliste Bestätigungsdialog zeigen, bevor ein Anruf durchgeführt wird Nur Kontakte mit Telefonnummern anzeigen diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 2a858e7b..19e9a015 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -19,13 +19,11 @@ Προσθήκη σε μια υπάρχουσα Επαφή You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found Νέα επαφή Επεξεργασία επαφής @@ -65,7 +63,6 @@ Διαχείριση εμφανιζόμενων καρτελών Επαφές Αγαπημένες - Πρόσφατες Κλήσεις Εμφάνιση διαλόγου επιβεβαίωσης πριν από την έναρξη μιας κλήσης Show only contacts with phone numbers diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index a1953388..68fae2d6 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -19,13 +19,11 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found Kontaktu berria Editatu taldea @@ -65,7 +63,6 @@ Kudeatu erakutsitako fitxak Kontaktuak Gogokoak - Azken deiak Erakutsi egiaztatze mezua dei bat hasi baino lehen Show only contacts with phone numbers diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 0c2046fc..467c73d3 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -19,13 +19,11 @@ Ajouter à un contact existant You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number Aucun contact n\'a été trouvé Aucun contact avec une adresse de courriel n\'a été trouvé Aucun contact avec un numéro de téléphone n\'a été trouvé - Aucun appel récent n\'a été trouvé Nouveau contact Modifier contact @@ -65,7 +63,6 @@ Gérer les onglets affichés Contacts Favoris - Appels récents Afficher une demande de confirmation avant de démarrer un appel Afficher uniquement les contacts avec un numéro de téléphone diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 56d48fa1..2853450c 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -19,13 +19,11 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found Novi kontakt Uredi kontakt @@ -65,7 +63,6 @@ Upravljaj prikazanim karticama Kontakti Favoriti - Nedavni pozivi Pokažite dijaloški okvir za potvrdu poziva prije pokretanja poziva Show only contacts with phone numbers diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 8e11b78e..74f1533b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -19,13 +19,11 @@ Aggiungi a un contatto esistente È necessario impostare quest\'app come predefinita per utilizzare i numeri bloccati. Imposta come predefinita - Chiama numero Nessun contatto trovato Nessun contatto trovato con un\'email Nessun contatto trovato con un numero di telefono - Nessuna chiamata recente trovata Nuovo contatto Modifica contatto @@ -65,7 +63,6 @@ Gestisci le schede mostrate Contatti Preferiti - Chiamate recenti Mostra un messaggio di conferma prima di iniziare una chiamata Mostra solamente i contatti con almeno un numero telefonico diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index c8ba4496..8bff5251 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -19,13 +19,11 @@ 既存の連絡先に追加 You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number 連絡先が見つかりません メールアドレスが登録された連絡先が見つかりません 電話番号が登録された連絡先が見つかりません - 通話履歴はありません 新しい連絡先 連絡先を編集 @@ -65,7 +63,6 @@ 表示するタブを管理 連絡先 お気に入り - 通話履歴 発信する前に確認ダイアログを表示する 電話番号が登録された連絡先のみ表示する diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 8a52b90e..95e6b9c6 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -19,13 +19,11 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found 새로운 연락처 연락처 수정 @@ -65,7 +63,6 @@ Manage shown tabs Contacts Favorites - Recent calls Show a call confirmation dialog before initiating a call Show only contacts with phone numbers diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 63c8ea85..017d7dd5 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -19,13 +19,11 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found Naujas kontaktas Redaguoti kontaktą @@ -65,7 +63,6 @@ Manage shown tabs Contacts Favorites - Recent calls Show a call confirmation dialog before initiating a call Show only contacts with phone numbers diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index c195c4f7..e0e2425e 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -19,13 +19,11 @@ Adicionar a contacto existente Tem que tornar esta a aplicação padrão para poder bloquear números. Definir como padrão - Call number Não existem contactos Não existem contactos com endereço de e-mail Não existem contactos com número de telefone - Não existem chamadas recentes Novo contacto Editar contacto @@ -65,7 +63,6 @@ Gerir separadores a exibir Contactos Favoritos - Chamadas recentes Mostrar diálogo para confirmar a chamada Mostrar apenas contactos com número de telefone diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 793cb16a..4c6d71a9 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -19,13 +19,11 @@ Добавить к существующему контакту Вы должны сделать \"Simple Contacts\" приложением по умолчанию для набора номера для использования блокировки номеров. Сделать по умолчанию - Набрать номер Контакты не найдены Контакты с адресами электронной почты не найдены Контакты с номерами телефонов не найдены - Недавние вызовы не найдены Новый контакт Редактировать контакт @@ -65,7 +63,6 @@ Управление отображаемыми вкладками Контакты Избранное - Недавние вызовы Показывать диалог подтверждения вызова Показывать только контакты с номерами телефонов diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 8f3d6205..4359917a 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -19,13 +19,11 @@ Pridať k existujúcemu kontaktu Pre použitie blokovania čísel musíte nastaviť aplikáciu ako predvolenú pre správu hovorov. Nastaviť ako predvolenú - Zavolať číslo Nenašli sa žiadne kontakty Nenašli sa žiadne kontakty s emailami Nenašli sa žiadne kontakty s telefónnymi číslami - Nenašli sa žiadne posledné hovory Nový kontakt Upraviť kontakt @@ -65,7 +63,6 @@ Spravovať zobrazené karty Kontakty Obľúbené - Predošlé hovory Zobraziť pred spustením hovoru okno na jeho potvrdenie Zobraziť iba kontakty s telefónnymi číslami diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 869498cd..e1395ac7 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -19,13 +19,11 @@ Lägg till i en befintlig kontakt You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number Inga kontakter hittades Inga kontakter med e-postadresser hittades Inga kontakter med telefonnummer hittades - No recent calls found Ny kontakt Redigera kontakt @@ -65,7 +63,6 @@ Hantera visade flikar Kontakter Favoriter - Senaste samtal Visa en bekräftelsedialogruta före uppringning Visa bara kontakter med telefonnummer diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f96f9a28..dab3779d 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -19,13 +19,11 @@ Mevcut bir kişiye ekle You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number Kişi bulunamadı E-posta ile hiç bağlantı bulunamadı Telefon numaralarını içeren kişi bulunamadı - No recent calls found Yeni kişi Kişiyi düzenle @@ -65,7 +63,6 @@ Gösterilen sekmeleri yönet Kişiler Favoriler - Son aramalar Arama başlatmadan önce arama onayı penceresi göster Sadece telefon numaralarını içeren kişileri göster diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d42a3f88..238140b1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -19,13 +19,11 @@ 添加至已存在的聯絡人 你必須將這應用程式設為預設的撥號程式來使用黑名單。 設為預設 - 撥打號碼 未發現聯絡人 未發現含有電子信箱的聯絡人 未發現含有電話號碼的聯絡人 - 未發現通話紀錄 新聯絡人 編輯聯絡人 @@ -65,7 +63,6 @@ 管理顯示的頁面 聯絡人 我的最愛 - 通話紀錄 開始通話前顯示通話確認框 只顯示含有電話話碼的聯絡人 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a7ce2f58..563c53cc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,13 +19,11 @@ Add to an existing contact You have to make this app the default dialer app to make use of blocked numbers. Set to default - Call number No contacts found No contacts with emails have been found No contacts with phone numbers have been found - No recent calls found New contact Edit contact @@ -65,7 +63,6 @@ Manage shown tabs Contacts Favorites - Recent calls Show a call confirmation dialog before initiating a call Show only contacts with phone numbers