Merge pull request #34 from SimpleMobileTools/master

upd
This commit is contained in:
solokot 2020-11-04 18:19:05 +03:00 committed by GitHub
commit ebcc4afc98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
179 changed files with 2230 additions and 4427 deletions

View File

@ -1,6 +1,86 @@
Changelog Changelog
========== ==========
Version 6.13.1 *(2020-10-27)*
----------------------------
* Redesigned the View and Edit screens, use bigger contact image
* Added quick action buttons to Viber, WhatsApp, Telegram and Signal contacts
* Added some UX and translation improvements
Version 6.13.0 *(2020-09-19)*
----------------------------
* Fixed search with non UTF characters
* Added many smaller translation and UX improvements
Version 6.12.7 *(2020-08-06)*
----------------------------
* Do not require the Telephony hardware feature for installing the app
* Some translation and UX improvements
Version 6.12.6 *(2020-07-18)*
----------------------------
* Allow adding contact events without specifying a year
* Always show the contacts middle name after the first name
* Make sure groups are properly sorted by name
Version 6.12.5 *(2020-07-12)*
----------------------------
* Adding some improvements related to contacts having multiple phone numbers
Version 6.12.4 *(2020-07-08)*
----------------------------
* Adding some smaller translation, stability and UX improvements
Version 6.12.3 *(2020-06-19)*
----------------------------
* Adding some private contact handling related improvements
Version 6.12.2 *(2020-06-17)*
----------------------------
* Reverting a check at fetching contacts, let's show more contacts rather than less
Version 6.12.1 *(2020-06-16)*
----------------------------
* Properly check phone numbers at Search too
* Fixed a glitch with wrong contacts being listed
Version 6.12.0 *(2020-06-03)*
----------------------------
* Added sorting by full name, which is the way most people expect sorting to work
* Improve searching, do not reset it at opening a contact
* Some translation and stability improvements
Version 6.11.3 *(2020-05-26)*
----------------------------
* Properly handle call initiating
Version 6.11.1 *(2020-05-25)*
----------------------------
* Use Call action at clicking the phone icon, not just Dial
* Use a nicer app icon on some older Android versions
Version 6.11.0 *(2020-05-23)*
----------------------------
* All calling related functions with many improvements have been moved into the new Simple Dialer app, please get it from https://play.google.com/store/apps/details?id=com.simplemobiletools.dialer
* Added a toggle for accessing privately stored contacts by Simple Dialer and Simple SMS Messenger apps
* Removed many no longer needed permissions
* Lowered the minimal required OS version back to 21 (Android 5, Lollipop)
* Allow customizing the default tab at startup
* Added a couple other UI and translation improvements
Version 6.10.2 *(2020-05-06)* Version 6.10.2 *(2020-05-06)*
---------------------------- ----------------------------

View File

@ -15,10 +15,10 @@ android {
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.contacts.pro" applicationId "com.simplemobiletools.contacts.pro"
minSdkVersion 23 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 63 versionCode 77
versionName "6.10.2" versionName "6.13.1"
setProperty("archivesBaseName", "contacts") setProperty("archivesBaseName", "contacts")
} }
@ -57,10 +57,11 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.28.2' implementation 'com.simplemobiletools:commons:5.31.18'
implementation 'joda-time:joda-time:2.10.1' implementation 'joda-time:joda-time:2.10.1'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a' implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
kapt "androidx.room:room-compiler:2.2.5" kapt "androidx.room:room-compiler:2.2.5"
implementation "androidx.room:room-runtime:2.2.5" implementation "androidx.room:room-runtime:2.2.5"

View File

@ -5,31 +5,24 @@
package="com.simplemobiletools.contacts.pro" package="com.simplemobiletools.contacts.pro"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/> <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/> <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.telecom.action.CONFIGURE_PHONE_ACCOUNT" />
<uses-permission <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" /> android:maxSdkVersion="28" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false"/>
<uses-permission <uses-permission
android:name="android.permission.USE_FINGERPRINT" android:name="android.permission.USE_FINGERPRINT"
tools:node="remove"/> tools:node="remove"/>
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<application <application
android:name=".App" android:name=".App"
android:allowBackup="true" android:allowBackup="true"
@ -64,12 +57,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".activities.CallActivity"
android:label="@string/ongoing_call"
android:screenOrientation="portrait"
android:showOnLockScreen="true"/>
<activity <activity
android:name=".activities.SettingsActivity" android:name=".activities.SettingsActivity"
android:label="@string/settings" android:label="@string/settings"
@ -82,7 +69,8 @@
<activity <activity
android:name=".activities.ViewContactActivity" android:name=".activities.ViewContactActivity"
android:label="@string/details" android:label="@string/details"
android:parentActivityName=".activities.MainActivity"> android:parentActivityName=".activities.MainActivity"
android:theme="@style/TranslucentTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
@ -115,7 +103,8 @@
<activity <activity
android:name=".activities.EditContactActivity" android:name=".activities.EditContactActivity"
android:parentActivityName=".activities.MainActivity"> android:parentActivityName=".activities.MainActivity"
android:theme="@style/TranslucentTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.EDIT"/> <action android:name="android.intent.action.EDIT"/>
@ -225,70 +214,6 @@
android:label="@string/frequently_asked_questions" android:label="@string/frequently_asked_questions"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/> android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>
<activity
android:name="com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity"
android:label="@string/blocked_numbers"
android:parentActivityName=".activities.SettingsActivity"/>
<activity
android:name=".activities.ManageSpeedDialActivity"
android:label="@string/speed_dial"
android:parentActivityName=".activities.SettingsActivity"/>
<activity
android:name=".activities.DialpadActivity"
android:label="@string/dialpad"
android:parentActivityName=".activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.DIAL"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="tel"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DIAL"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".activities.DialerActivity"
android:label="@string/dialer"
android:theme="@style/Theme.Transparent">
<intent-filter>
<action android:name="android.intent.action.CALL"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="tel"/>
</intent-filter>
</activity>
<service
android:name=".services.CallService"
android:permission="android.permission.BIND_INCALL_SERVICE">
<meta-data
android:name="android.telecom.IN_CALL_SERVICE_UI"
android:value="true" />
<intent-filter>
<action android:name="android.telecom.InCallService"/>
</intent-filter>
</service>
<receiver
android:name=".receivers.CallActionReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.simplemobiletools.contacts.action.ACCEPT_CALL" />
<action android:name="com.simplemobiletools.contacts.action.DECLINE_CALL" />
</intent-filter>
</receiver>
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider" android:authorities="${applicationId}.provider"
@ -299,6 +224,11 @@
android:resource="@xml/provider_paths"/> android:resource="@xml/provider_paths"/>
</provider> </provider>
<provider
android:name=".contentproviders.MyContactsContentProvider"
android:authorities="com.simplemobiletools.commons.contactsprovider"
android:exported="true"/>
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Red" android:name=".activities.SplashActivity.Red"
android:enabled="false" android:enabled="false"

View File

@ -1,407 +0,0 @@
package com.simplemobiletools.contacts.pro.activities
import android.annotation.SuppressLint
import android.app.*
import android.content.Context
import android.content.Intent
import android.graphics.*
import android.media.AudioManager
import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.os.PowerManager
import android.provider.MediaStore
import android.telecom.Call
import android.util.Size
import android.view.WindowManager
import android.widget.RemoteViews
import androidx.core.app.NotificationCompat
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.MINUTE_SECONDS
import com.simplemobiletools.commons.helpers.isOreoMr1Plus
import com.simplemobiletools.commons.helpers.isOreoPlus
import com.simplemobiletools.commons.helpers.isQPlus
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.addCharacter
import com.simplemobiletools.contacts.pro.extensions.audioManager
import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.extensions.startCallIntent
import com.simplemobiletools.contacts.pro.helpers.ACCEPT_CALL
import com.simplemobiletools.contacts.pro.helpers.CallManager
import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL
import com.simplemobiletools.contacts.pro.models.CallContact
import com.simplemobiletools.contacts.pro.receivers.CallActionReceiver
import kotlinx.android.synthetic.main.activity_call.*
import kotlinx.android.synthetic.main.dialpad.*
import java.util.*
class CallActivity : SimpleActivity() {
private val CALL_NOTIFICATION_ID = 1
private var isSpeakerOn = false
private var isMicrophoneOn = true
private var isCallEnded = false
private var callDuration = 0
private var callContact: CallContact? = null
private var callContactAvatar: Bitmap? = null
private var proximityWakeLock: PowerManager.WakeLock? = null
private var callTimer = Timer()
override fun onCreate(savedInstanceState: Bundle?) {
supportActionBar?.hide()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_call)
updateTextColors(call_holder)
initButtons()
audioManager.mode = AudioManager.MODE_IN_CALL
CallManager.getCallContact(applicationContext) { contact ->
callContact = contact
callContactAvatar = getCallContactAvatar()
runOnUiThread {
setupNotification()
updateOtherPersonsInfo()
}
}
addLockScreenFlags()
initProximitySensor()
CallManager.registerCallback(callCallback)
updateCallState(CallManager.getState())
}
override fun onDestroy() {
super.onDestroy()
notificationManager.cancel(CALL_NOTIFICATION_ID)
CallManager.unregisterCallback(callCallback)
callTimer.cancel()
if (proximityWakeLock?.isHeld == true) {
proximityWakeLock!!.release()
}
if (CallManager.getState() == Call.STATE_DIALING) {
endCall()
}
}
override fun onBackPressed() {
if (dialpad_wrapper.isVisible()) {
dialpad_wrapper.beGone()
return
} else {
super.onBackPressed()
}
if (CallManager.getState() == Call.STATE_DIALING) {
endCall()
}
}
private fun initButtons() {
call_decline.setOnClickListener {
endCall()
}
call_accept.setOnClickListener {
acceptCall()
}
call_toggle_microphone.setOnClickListener {
toggleMicrophone()
}
call_toggle_speaker.setOnClickListener {
toggleSpeaker()
}
call_dialpad.setOnClickListener {
toggleDialpadVisibility()
}
dialpad_close.setOnClickListener {
dialpad_wrapper.beGone()
}
call_end.setOnClickListener {
endCall()
}
dialpad_0_holder.setOnClickListener { dialpadPressed('0') }
dialpad_1.setOnClickListener { dialpadPressed('1') }
dialpad_2.setOnClickListener { dialpadPressed('2') }
dialpad_3.setOnClickListener { dialpadPressed('3') }
dialpad_4.setOnClickListener { dialpadPressed('4') }
dialpad_5.setOnClickListener { dialpadPressed('5') }
dialpad_6.setOnClickListener { dialpadPressed('6') }
dialpad_7.setOnClickListener { dialpadPressed('7') }
dialpad_8.setOnClickListener { dialpadPressed('8') }
dialpad_9.setOnClickListener { dialpadPressed('9') }
dialpad_0_holder.setOnLongClickListener { dialpadPressed('+'); true }
dialpad_asterisk.setOnClickListener { dialpadPressed('*') }
dialpad_hashtag.setOnClickListener { dialpadPressed('#') }
dialpad_wrapper.setBackgroundColor(config.backgroundColor)
arrayOf(call_toggle_microphone, call_toggle_speaker, call_dialpad, dialpad_close).forEach {
it.applyColorFilter(config.textColor)
}
}
private fun dialpadPressed(char: Char) {
CallManager.keypad(char)
dialpad_input.addCharacter(char)
}
private fun toggleSpeaker() {
isSpeakerOn = !isSpeakerOn
val drawable = if (isSpeakerOn) R.drawable.ic_speaker_on_vector else R.drawable.ic_speaker_off_vector
call_toggle_speaker.setImageDrawable(getDrawable(drawable))
audioManager.isSpeakerphoneOn = isSpeakerOn
}
private fun toggleMicrophone() {
isMicrophoneOn = !isMicrophoneOn
val drawable = if (isMicrophoneOn) R.drawable.ic_microphone_vector else R.drawable.ic_microphone_off_vector
call_toggle_microphone.setImageDrawable(getDrawable(drawable))
audioManager.isMicrophoneMute = !isMicrophoneOn
}
private fun toggleDialpadVisibility() {
if (dialpad_wrapper.isVisible()) {
dialpad_wrapper.beGone()
} else {
dialpad_wrapper.beVisible()
}
}
private fun updateOtherPersonsInfo() {
if (callContact == null) {
return
}
caller_name_label.text = if (callContact!!.name.isNotEmpty()) callContact!!.name else getString(R.string.unknown_caller)
if (callContactAvatar != null) {
caller_avatar.setImageBitmap(callContactAvatar)
}
}
private fun updateCallState(state: Int) {
when (state) {
Call.STATE_RINGING -> callRinging()
Call.STATE_ACTIVE -> callStarted()
Call.STATE_DISCONNECTED -> endCall()
Call.STATE_CONNECTING, Call.STATE_DIALING -> initOutgoingCallUI()
Call.STATE_SELECT_PHONE_ACCOUNT -> showPhoneAccountPicker()
}
if (state == Call.STATE_DISCONNECTED || state == Call.STATE_DISCONNECTING) {
callTimer.cancel()
}
val statusTextId = when (state) {
Call.STATE_RINGING -> R.string.is_calling
Call.STATE_DIALING -> R.string.dialing
else -> 0
}
if (statusTextId != 0) {
call_status_label.text = getString(statusTextId)
}
setupNotification()
}
private fun acceptCall() {
CallManager.accept()
}
private fun initOutgoingCallUI() {
incoming_call_holder.beGone()
ongoing_call_holder.beVisible()
}
private fun callRinging() {
incoming_call_holder.beVisible()
}
private fun callStarted() {
incoming_call_holder.beGone()
ongoing_call_holder.beVisible()
callTimer.scheduleAtFixedRate(getCallTimerUpdateTask(), 1000, 1000)
}
private fun showPhoneAccountPicker() {
if (callContact == null || callContact!!.number.isEmpty()) {
toast(R.string.unknown_error_occurred)
} else {
startCallIntent(callContact!!.number)
}
}
private fun endCall() {
CallManager.reject()
if (proximityWakeLock?.isHeld == true) {
proximityWakeLock!!.release()
}
audioManager.mode = AudioManager.MODE_NORMAL
if (isCallEnded) {
finish()
return
}
isCallEnded = true
if (callDuration > 0) {
runOnUiThread {
call_status_label.text = "${callDuration.getFormattedDuration()} (${getString(R.string.call_ended)})"
Handler().postDelayed({
finish()
}, 3000)
}
} else {
call_status_label.text = getString(R.string.call_ended)
finish()
}
}
private fun getCallTimerUpdateTask() = object : TimerTask() {
override fun run() {
callDuration++
runOnUiThread {
if (!isCallEnded) {
call_status_label.text = callDuration.getFormattedDuration()
}
}
}
}
@SuppressLint("NewApi")
private val callCallback = object : Call.Callback() {
override fun onStateChanged(call: Call, state: Int) {
super.onStateChanged(call, state)
updateCallState(state)
}
}
@SuppressLint("NewApi")
private fun addLockScreenFlags() {
if (isOreoMr1Plus()) {
setShowWhenLocked(true)
setTurnScreenOn(true)
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
}
if (isOreoPlus()) {
(getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).requestDismissKeyguard(this, null)
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
}
}
private fun initProximitySensor() {
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
proximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "com.simplemobiletools.contacts.pro:wake_lock")
proximityWakeLock!!.acquire(10 * MINUTE_SECONDS * 1000L)
}
@SuppressLint("NewApi")
private fun setupNotification() {
val callState = CallManager.getState()
val channelId = "simple_contacts_call"
if (isOreoPlus()) {
val importance = NotificationManager.IMPORTANCE_DEFAULT
val name = "call_notification_channel"
NotificationChannel(channelId, name, importance).apply {
setSound(null, null)
notificationManager.createNotificationChannel(this)
}
}
val openAppIntent = Intent(this, CallActivity::class.java)
openAppIntent.flags = Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT
val openAppPendingIntent = PendingIntent.getActivity(this, 0, openAppIntent, 0)
val acceptCallIntent = Intent(this, CallActionReceiver::class.java)
acceptCallIntent.action = ACCEPT_CALL
val acceptPendingIntent = PendingIntent.getBroadcast(this, 0, acceptCallIntent, PendingIntent.FLAG_CANCEL_CURRENT)
val declineCallIntent = Intent(this, CallActionReceiver::class.java)
declineCallIntent.action = DECLINE_CALL
val declinePendingIntent = PendingIntent.getBroadcast(this, 1, declineCallIntent, PendingIntent.FLAG_CANCEL_CURRENT)
val callerName = if (callContact != null && callContact!!.name.isNotEmpty()) callContact!!.name else getString(R.string.unknown_caller)
val contentTextId = when (callState) {
Call.STATE_RINGING -> R.string.is_calling
Call.STATE_DIALING -> R.string.dialing
Call.STATE_DISCONNECTED -> R.string.call_ended
Call.STATE_DISCONNECTING -> R.string.call_ending
else -> R.string.ongoing_call
}
val collapsedView = RemoteViews(packageName, R.layout.call_notification).apply {
setText(R.id.notification_caller_name, callerName)
setText(R.id.notification_call_status, getString(contentTextId))
setVisibleIf(R.id.notification_accept_call, callState == Call.STATE_RINGING)
setOnClickPendingIntent(R.id.notification_decline_call, declinePendingIntent)
setOnClickPendingIntent(R.id.notification_accept_call, acceptPendingIntent)
if (callContactAvatar != null) {
setImageViewBitmap(R.id.notification_thumbnail, getCircularBitmap(callContactAvatar!!))
}
}
val builder = NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_phone_vector)
.setContentIntent(openAppPendingIntent)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setCategory(Notification.CATEGORY_CALL)
.setCustomContentView(collapsedView)
.setOngoing(true)
.setSound(null)
.setUsesChronometer(callState == Call.STATE_ACTIVE)
.setChannelId(channelId)
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
val notification = builder.build()
notificationManager.notify(CALL_NOTIFICATION_ID, notification)
}
@SuppressLint("NewApi")
private fun getCallContactAvatar(): Bitmap? {
var bitmap: Bitmap? = null
if (callContact?.photoUri?.isNotEmpty() == true) {
val photoUri = Uri.parse(callContact!!.photoUri)
bitmap = if (isQPlus()) {
val tmbSize = resources.getDimension(R.dimen.contact_icons_size).toInt()
contentResolver.loadThumbnail(photoUri, Size(tmbSize, tmbSize), null)
} else {
MediaStore.Images.Media.getBitmap(contentResolver, photoUri)
}
bitmap = getCircularBitmap(bitmap!!)
}
return bitmap
}
private fun getCircularBitmap(bitmap: Bitmap): Bitmap {
val output = Bitmap.createBitmap(bitmap.width, bitmap.width, Bitmap.Config.ARGB_8888)
val canvas = Canvas(output)
val paint = Paint()
val rect = Rect(0, 0, bitmap.width, bitmap.height)
val radius = bitmap.width / 2.toFloat()
paint.isAntiAlias = true
canvas.drawARGB(0, 0, 0, 0)
canvas.drawCircle(radius, radius, radius, paint)
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_IN)
canvas.drawBitmap(bitmap, rect, rect, paint)
return output
}
}

View File

@ -1,11 +1,14 @@
package com.simplemobiletools.contacts.pro.activities package com.simplemobiletools.contacts.pro.activities
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.provider.ContactsContract.CommonDataKinds.* import android.provider.ContactsContract.CommonDataKinds.*
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -16,7 +19,8 @@ import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.letterBackgroundColors
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent import com.simplemobiletools.contacts.pro.extensions.sendEmailIntent
@ -31,35 +35,41 @@ abstract class ContactActivity : SimpleActivity() {
protected var currentContactPhotoPath = "" protected var currentContactPhotoPath = ""
fun showPhotoPlaceholder(photoView: ImageView) { fun showPhotoPlaceholder(photoView: ImageView) {
val placeholder = BitmapDrawable(resources, SimpleContactsHelper(this).getContactLetterIcon(contact?.getNameToDisplay() ?: "A")) val placeholder = BitmapDrawable(resources, getBigLetterPlaceholder(contact?.getNameToDisplay() ?: "A"))
photoView.setImageDrawable(placeholder) photoView.setImageDrawable(placeholder)
currentContactPhotoPath = "" currentContactPhotoPath = ""
contact?.photo = null contact?.photo = null
} }
fun updateContactPhoto(path: String, photoView: ImageView, bitmap: Bitmap? = null) { fun updateContactPhoto(path: String, photoView: ImageView, bottomShadow: ImageView, bitmap: Bitmap? = null) {
currentContactPhotoPath = path currentContactPhotoPath = path
val options = RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.centerCrop()
if (isDestroyed || isFinishing) { if (isDestroyed || isFinishing) {
return return
} }
val options = RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.centerCrop()
val wantedWidth = realScreenSize.x
val wantedHeight = resources.getDimension(R.dimen.top_contact_image_height).toInt()
Glide.with(this) Glide.with(this)
.load(bitmap ?: path) .load(bitmap ?: path)
.transition(DrawableTransitionOptions.withCrossFade()) .transition(DrawableTransitionOptions.withCrossFade())
.apply(options) .apply(options)
.apply(RequestOptions.circleCropTransform()) .override(wantedWidth, wantedHeight)
.listener(object : RequestListener<Drawable> { .listener(object : RequestListener<Drawable> {
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
photoView.background = ColorDrawable(0) photoView.background = ColorDrawable(0)
bottomShadow.beVisible()
return false return false
} }
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
showPhotoPlaceholder(photoView) showPhotoPlaceholder(photoView)
bottomShadow.beGone()
return true return true
} }
}).into(photoView) }).into(photoView)
@ -111,23 +121,6 @@ abstract class ContactActivity : SimpleActivity() {
} }
} }
fun getPhoneNumberTypeText(type: Int, label: String): String {
return if (type == BaseTypes.TYPE_CUSTOM) {
label
} else {
getString(when (type) {
Phone.TYPE_MOBILE -> R.string.mobile
Phone.TYPE_HOME -> R.string.home
Phone.TYPE_WORK -> R.string.work
Phone.TYPE_MAIN -> R.string.main_number
Phone.TYPE_FAX_WORK -> R.string.work_fax
Phone.TYPE_FAX_HOME -> R.string.home_fax
Phone.TYPE_PAGER -> R.string.pager
else -> R.string.other
})
}
}
fun getEmailTypeText(type: Int, label: String): String { fun getEmailTypeText(type: Int, label: String): String {
return if (type == BaseTypes.TYPE_CUSTOM) { return if (type == BaseTypes.TYPE_CUSTOM) {
label label
@ -175,4 +168,35 @@ abstract class ContactActivity : SimpleActivity() {
Event.TYPE_BIRTHDAY -> R.string.birthday Event.TYPE_BIRTHDAY -> R.string.birthday
else -> R.string.other else -> R.string.other
} }
private fun getBigLetterPlaceholder(name: String): Bitmap {
val letter = name.getNameLetter()
val height = resources.getDimension(R.dimen.top_contact_image_height).toInt()
val bitmap = Bitmap.createBitmap(realScreenSize.x, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
val view = TextView(this)
view.layout(0, 0, bitmap.width, bitmap.height)
val circlePaint = Paint().apply {
color = letterBackgroundColors[Math.abs(name.hashCode()) % letterBackgroundColors.size].toInt()
isAntiAlias = true
style = Paint.Style.FILL
}
val wantedTextSize = bitmap.height / 2f
val textPaint = Paint().apply {
color = circlePaint.color.getContrastColor()
isAntiAlias = true
textAlign = Paint.Align.CENTER
textSize = wantedTextSize
}
canvas.drawPaint(circlePaint)
val xPos = canvas.width / 2f
val yPos = canvas.height / 2 - (textPaint.descent() + textPaint.ascent()) / 2
canvas.drawText(letter, xPos, yPos, textPaint)
view.draw(canvas)
return bitmap
}
} }

View File

@ -1,71 +0,0 @@
package com.simplemobiletools.contacts.pro.activities
import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.telecom.TelecomManager
import android.view.Menu
import com.simplemobiletools.commons.extensions.isDefaultDialer
import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.extensions.telecomManager
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.REQUEST_CODE_SET_DEFAULT_DIALER
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.getHandleToUse
class DialerActivity : SimpleActivity() {
private var callNumber: Uri? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (intent.action == Intent.ACTION_CALL && intent.data != null) {
callNumber = intent.data
// make sure Simple Contacts is the default Phone app before initiating an outgoing call
if (!isDefaultDialer()) {
launchSetDefaultDialerIntent()
} else {
initOutgoingCall()
}
} else {
toast(R.string.unknown_error_occurred)
finish()
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
updateMenuItemColors(menu)
return super.onCreateOptionsMenu(menu)
}
@SuppressLint("MissingPermission")
private fun initOutgoingCall() {
try {
getHandleToUse(intent, callNumber.toString()) { handle ->
Bundle().apply {
putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, handle)
putBoolean(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, false)
putBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, false)
telecomManager.placeCall(callNumber, this)
}
finish()
}
} catch (e: Exception) {
showErrorToast(e)
finish()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == REQUEST_CODE_SET_DEFAULT_DIALER) {
if (!isDefaultDialer()) {
finish()
} else {
initOutgoingCall()
}
}
}
}

View File

@ -1,228 +0,0 @@
package com.simplemobiletools.contacts.pro.activities
import android.annotation.TargetApi
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Telephony.Sms.Intents.SECRET_CODE_ACTION
import android.telephony.PhoneNumberUtils
import android.telephony.TelephonyManager
import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.view.View
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.KEY_PHONE
import com.simplemobiletools.commons.helpers.REQUEST_CODE_SET_DEFAULT_DIALER
import com.simplemobiletools.commons.helpers.isOreoPlus
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.adapters.ContactsAdapter
import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog
import com.simplemobiletools.contacts.pro.extensions.*
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.helpers.LOCATION_DIALPAD
import com.simplemobiletools.contacts.pro.models.Contact
import com.simplemobiletools.contacts.pro.models.SpeedDial
import kotlinx.android.synthetic.main.activity_dialpad.*
import kotlinx.android.synthetic.main.activity_dialpad.dialpad_holder
import kotlinx.android.synthetic.main.dialpad.*
class DialpadActivity : SimpleActivity() {
private var contacts = ArrayList<Contact>()
private var speedDialValues = ArrayList<SpeedDial>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_dialpad)
if (checkAppSideloading()) {
return
}
speedDialValues = config.getSpeedDialValues()
dialpad_0_holder.setOnClickListener { dialpadPressed('0', it) }
dialpad_1.setOnClickListener { dialpadPressed('1', it) }
dialpad_2.setOnClickListener { dialpadPressed('2', it) }
dialpad_3.setOnClickListener { dialpadPressed('3', it) }
dialpad_4.setOnClickListener { dialpadPressed('4', it) }
dialpad_5.setOnClickListener { dialpadPressed('5', it) }
dialpad_6.setOnClickListener { dialpadPressed('6', it) }
dialpad_7.setOnClickListener { dialpadPressed('7', it) }
dialpad_8.setOnClickListener { dialpadPressed('8', it) }
dialpad_9.setOnClickListener { dialpadPressed('9', it) }
dialpad_1.setOnLongClickListener { speedDial(1); true }
dialpad_2.setOnLongClickListener { speedDial(2); true }
dialpad_3.setOnLongClickListener { speedDial(3); true }
dialpad_4.setOnLongClickListener { speedDial(4); true }
dialpad_5.setOnLongClickListener { speedDial(5); true }
dialpad_6.setOnLongClickListener { speedDial(6); true }
dialpad_7.setOnLongClickListener { speedDial(7); true }
dialpad_8.setOnLongClickListener { speedDial(8); true }
dialpad_9.setOnLongClickListener { speedDial(9); true }
dialpad_0_holder.setOnLongClickListener { dialpadPressed('+', null); true }
dialpad_asterisk.setOnClickListener { dialpadPressed('*', it) }
dialpad_hashtag.setOnClickListener { dialpadPressed('#', it) }
dialpad_clear_char.setOnClickListener { clearChar(it) }
dialpad_clear_char.setOnLongClickListener { clearInput(); true }
dialpad_call_button.setOnClickListener { initCall() }
dialpad_input.onTextChangeListener { dialpadValueChanged(it) }
ContactsHelper(this).getContacts { gotContacts(it) }
disableKeyboardPopping()
val callIcon = resources.getColoredDrawableWithColor(R.drawable.ic_phone_vector, if (isBlackAndWhiteTheme()) Color.BLACK else config.primaryColor.getContrastColor())
dialpad_call_button.setImageDrawable(callIcon)
dialpad_call_button.background.applyColorFilter(getAdjustedPrimaryColor())
val showLetters = config.showDialpadLetters
arrayOf(dialpad_2_letters, dialpad_3_letters, dialpad_4_letters, dialpad_5_letters, dialpad_6_letters, dialpad_7_letters, dialpad_8_letters, dialpad_9_letters).forEach {
it.beVisibleIf(showLetters)
}
}
override fun onResume() {
super.onResume()
updateTextColors(dialpad_holder)
dialpad_clear_char.applyColorFilter(config.textColor)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_dialpad, menu)
updateMenuItemColors(menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.add_number_to_contact -> addNumberToContact()
else -> return super.onOptionsItemSelected(item)
}
return true
}
private fun checkDialIntent(): Boolean {
return if (intent.action == Intent.ACTION_DIAL && intent.data != null && intent.dataString?.contains("tel:") == true) {
val number = Uri.decode(intent.dataString).substringAfter("tel:")
dialpad_input.setText(number)
dialpad_input.setSelection(number.length)
true
} else {
false
}
}
private fun addNumberToContact() {
Intent().apply {
action = Intent.ACTION_INSERT_OR_EDIT
type = "vnd.android.cursor.item/contact"
putExtra(KEY_PHONE, dialpad_input.value)
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
}
private fun dialpadPressed(char: Char, view: View?) {
dialpad_input.addCharacter(char)
view?.performHapticFeedback()
}
private fun clearChar(view: View) {
dialpad_input.dispatchKeyEvent(dialpad_input.getKeyEvent(KeyEvent.KEYCODE_DEL))
view.performHapticFeedback()
}
private fun clearInput() {
dialpad_input.setText("")
}
private fun disableKeyboardPopping() {
dialpad_input.showSoftInputOnFocus = false
}
private fun gotContacts(newContacts: ArrayList<Contact>) {
contacts = newContacts
if (!checkDialIntent() && dialpad_input.value.isEmpty()) {
dialpadValueChanged("")
}
}
@TargetApi(Build.VERSION_CODES.O)
private fun dialpadValueChanged(text: String) {
val len = text.length
if (len > 8 && text.startsWith("*#*#") && text.endsWith("#*#*")) {
val secretCode = text.substring(4, text.length - 4)
if (isOreoPlus()) {
if (isDefaultDialer()) {
getSystemService(TelephonyManager::class.java)?.sendDialerSpecialCode(secretCode)
} else {
launchSetDefaultDialerIntent()
}
} else {
val intent = Intent(SECRET_CODE_ACTION, Uri.parse("android_secret_code://$secretCode"))
sendBroadcast(intent)
}
return
}
val showLetters = config.showDialpadLetters
(dialpad_list.adapter as? ContactsAdapter)?.finishActMode()
val filtered = contacts.filter {
val convertedName = PhoneNumberUtils.convertKeypadLettersToDigits(it.getNameToDisplay().normalizeString())
val company = PhoneNumberUtils.convertKeypadLettersToDigits(it.getFullCompany().normalizeString())
it.doesContainPhoneNumber(text, showLetters) || (showLetters && (convertedName.contains(text, true) || company.contains(text, true)))
}.sortedWith(compareBy {
if (showLetters) {
!it.doesContainPhoneNumber(text, showLetters)
} else {
true
}
}).toMutableList() as ArrayList<Contact>
ContactsAdapter(this, filtered, null, LOCATION_DIALPAD, null, dialpad_list, dialpad_fastscroller, text) {
callContact(it as Contact)
}.apply {
dialpad_list.adapter = this
}
dialpad_fastscroller.setScrollToY(0)
dialpad_fastscroller.setViews(dialpad_list) {
val item = (dialpad_list.adapter as ContactsAdapter).contactItems.getOrNull(it)
dialpad_fastscroller.updateBubbleText(item?.getBubbleText() ?: "")
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
if (requestCode == REQUEST_CODE_SET_DEFAULT_DIALER && isDefaultDialer()) {
dialpadValueChanged(dialpad_input.value)
}
}
private fun initCall(number: String = dialpad_input.value) {
if (number.isNotEmpty()) {
if (config.showCallConfirmation) {
CallConfirmationDialog(this, number) {
startCallIntent(number)
}
} else {
startCallIntent(number)
}
}
}
private fun speedDial(id: Int) {
if (dialpad_input.value.isEmpty()) {
val speedDial = speedDialValues.firstOrNull { it.id == id }
if (speedDial?.isValid() == true) {
initCall(speedDial.number)
}
}
}
}

View File

@ -1,31 +1,31 @@
package com.simplemobiletools.contacts.pro.activities package com.simplemobiletools.contacts.pro.activities
import android.app.Activity import android.app.Activity
import android.app.DatePickerDialog
import android.content.ClipData import android.content.ClipData
import android.content.ContentValues import android.content.ContentValues
import android.content.Intent import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.provider.ContactsContract.CommonDataKinds import android.provider.ContactsContract.CommonDataKinds
import android.provider.ContactsContract.CommonDataKinds.* import android.provider.ContactsContract.CommonDataKinds.*
import android.provider.MediaStore import android.provider.MediaStore
import android.view.Menu import android.view.View
import android.view.MenuItem
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import android.widget.EditText import android.widget.EditText
import android.widget.ImageView import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView import android.widget.TextView
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CONTACTS
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.dialogs.CustomLabelDialog import com.simplemobiletools.contacts.pro.dialogs.CustomLabelDialog
import com.simplemobiletools.contacts.pro.dialogs.MyDatePickerDialog
import com.simplemobiletools.contacts.pro.dialogs.SelectGroupsDialog import com.simplemobiletools.contacts.pro.dialogs.SelectGroupsDialog
import com.simplemobiletools.contacts.pro.extensions.* import com.simplemobiletools.contacts.pro.extensions.*
import com.simplemobiletools.contacts.pro.helpers.* import com.simplemobiletools.contacts.pro.helpers.*
@ -41,8 +41,6 @@ import kotlinx.android.synthetic.main.item_edit_im.view.*
import kotlinx.android.synthetic.main.item_edit_phone_number.view.* import kotlinx.android.synthetic.main.item_edit_phone_number.view.*
import kotlinx.android.synthetic.main.item_edit_website.view.* import kotlinx.android.synthetic.main.item_edit_website.view.*
import kotlinx.android.synthetic.main.item_event.view.* import kotlinx.android.synthetic.main.item_event.view.*
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
class EditContactActivity : ContactActivity() { class EditContactActivity : ContactActivity() {
private val INTENT_TAKE_PHOTO = 1 private val INTENT_TAKE_PHOTO = 1
@ -64,6 +62,7 @@ class EditContactActivity : ContactActivity() {
private var originalContactSource = "" private var originalContactSource = ""
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
showTransparentTop = true
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_edit_contact) setContentView(R.layout.activity_edit_contact)
@ -71,6 +70,9 @@ class EditContactActivity : ContactActivity() {
return return
} }
contact_wrapper.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
setupMenu()
val action = intent.action val action = intent.action
isThirdPartyIntent = action == Intent.ACTION_EDIT || action == Intent.ACTION_INSERT || action == ADD_NEW_CONTACT_NUMBER isThirdPartyIntent = action == Intent.ACTION_EDIT || action == Intent.ACTION_INSERT || action == ADD_NEW_CONTACT_NUMBER
val isFromSimpleContacts = intent.getBooleanExtra(IS_FROM_SIMPLE_CONTACTS, false) val isFromSimpleContacts = intent.getBooleanExtra(IS_FROM_SIMPLE_CONTACTS, false)
@ -95,39 +97,12 @@ class EditContactActivity : ContactActivity() {
} }
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_edit_contact, menu)
if (wasActivityInitialized) {
menu.findItem(R.id.delete).isVisible = contact?.id != 0
menu.findItem(R.id.share).isVisible = contact?.id != 0
menu.findItem(R.id.open_with).isVisible = contact?.id != 0 && contact?.isPrivate() == false
}
updateMenuItemColors(menu, true)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (contact == null) {
return true
}
when (item.itemId) {
R.id.save -> saveContact()
R.id.share -> shareContact(contact!!)
R.id.open_with -> openWith()
R.id.delete -> deleteContact()
else -> return super.onOptionsItemSelected(item)
}
return true
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData) super.onActivityResult(requestCode, resultCode, resultData)
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
when (requestCode) { when (requestCode) {
INTENT_TAKE_PHOTO, INTENT_CHOOSE_PHOTO -> startCropPhotoIntent(lastPhotoIntentUri, resultData?.data) INTENT_TAKE_PHOTO, INTENT_CHOOSE_PHOTO -> startCropPhotoIntent(lastPhotoIntentUri, resultData?.data)
INTENT_CROP_PHOTO -> updateContactPhoto(lastPhotoIntentUri.toString(), contact_photo) INTENT_CROP_PHOTO -> updateContactPhoto(lastPhotoIntentUri.toString(), contact_photo, contact_photo_bottom_shadow)
} }
} }
} }
@ -209,20 +184,17 @@ class EditContactActivity : ContactActivity() {
} }
setupTypePickers() setupTypePickers()
contact_send_sms.beVisibleIf(contact!!.phoneNumbers.isNotEmpty())
contact_start_call.beVisibleIf(contact!!.phoneNumbers.isNotEmpty())
contact_send_email.beVisibleIf(contact!!.emails.isNotEmpty())
if (contact!!.photoUri.isEmpty() && contact!!.photo == null) { if (contact!!.photoUri.isEmpty() && contact!!.photo == null) {
showPhotoPlaceholder(contact_photo) showPhotoPlaceholder(contact_photo)
contact_photo_bottom_shadow.beGone()
} else { } else {
updateContactPhoto(contact!!.photoUri, contact_photo, contact!!.photo) updateContactPhoto(contact!!.photoUri, contact_photo, contact_photo_bottom_shadow, contact!!.photo)
} }
val textColor = config.textColor val textColor = config.textColor
arrayOf(contact_send_sms, contact_start_call, contact_send_email, contact_name_image, contact_numbers_image, contact_emails_image, contact_addresses_image, arrayOf(contact_name_image, contact_numbers_image, contact_emails_image, contact_addresses_image, contact_ims_image, contact_events_image,
contact_ims_image, contact_events_image, contact_notes_image, contact_organization_image, contact_websites_image, contact_groups_image, contact_notes_image, contact_organization_image, contact_websites_image, contact_groups_image, contact_source_image).forEach {
contact_source_image).forEach {
it.applyColorFilter(textColor) it.applyColorFilter(textColor)
} }
@ -239,9 +211,7 @@ class EditContactActivity : ContactActivity() {
contact_toggle_favorite.setOnClickListener { toggleFavorite() } contact_toggle_favorite.setOnClickListener { toggleFavorite() }
contact_photo.setOnClickListener { trySetPhoto() } contact_photo.setOnClickListener { trySetPhoto() }
contact_send_sms.setOnClickListener { trySendSMS() } contact_change_photo.setOnClickListener { trySetPhoto() }
contact_start_call.setOnClickListener { tryStartCall(contact!!) }
contact_send_email.setOnClickListener { trySendEmail() }
contact_numbers_add_new.setOnClickListener { addNewPhoneNumberField() } contact_numbers_add_new.setOnClickListener { addNewPhoneNumberField() }
contact_emails_add_new.setOnClickListener { addNewEmailField() } contact_emails_add_new.setOnClickListener { addNewEmailField() }
contact_addresses_add_new.setOnClickListener { addNewAddressField() } contact_addresses_add_new.setOnClickListener { addNewAddressField() }
@ -256,14 +226,47 @@ class EditContactActivity : ContactActivity() {
contact_toggle_favorite.apply { contact_toggle_favorite.apply {
setImageDrawable(getStarDrawable(contact!!.starred == 1)) setImageDrawable(getStarDrawable(contact!!.starred == 1))
tag = contact!!.starred tag = contact!!.starred
applyColorFilter(textColor)
} }
updateTextColors(contact_scrollview) updateTextColors(contact_scrollview)
numberViewToColor?.setTextColor(adjustedPrimaryColor) numberViewToColor?.setTextColor(adjustedPrimaryColor)
emailViewToColor?.setTextColor(adjustedPrimaryColor) emailViewToColor?.setTextColor(adjustedPrimaryColor)
wasActivityInitialized = true wasActivityInitialized = true
invalidateOptionsMenu()
contact_toolbar.menu.apply {
findItem(R.id.delete).isVisible = contact?.id != 0
findItem(R.id.share).isVisible = contact?.id != 0
findItem(R.id.open_with).isVisible = contact?.id != 0 && contact?.isPrivate() == false
}
}
private fun setupMenu() {
(contact_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
contact_toolbar.menu.apply {
findItem(R.id.save).setOnMenuItemClickListener {
saveContact()
true
}
findItem(R.id.share).setOnMenuItemClickListener {
shareContact(contact!!)
true
}
findItem(R.id.open_with).setOnMenuItemClickListener {
openWith()
true
}
findItem(R.id.delete).setOnMenuItemClickListener {
deleteContact()
true
}
}
contact_toolbar.setNavigationOnClickListener {
finish()
}
} }
private fun openWith() { private fun openWith() {
@ -691,19 +694,13 @@ class EditContactActivity : ContactActivity() {
val eventField = eventHolder.contact_event val eventField = eventHolder.contact_event
eventField.setOnClickListener { eventField.setOnClickListener {
val setDateListener = DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth -> MyDatePickerDialog(this, eventField.tag?.toString() ?: "") { dateTag ->
eventHolder.contact_event_remove.beVisible()
val date = DateTime().withDate(year, monthOfYear + 1, dayOfMonth).withTimeAtStartOfDay()
val formatted = date.toString(DateTimeFormat.mediumDate())
eventField.apply { eventField.apply {
text = formatted dateTag.getDateTimeFromDateString(this)
tag = date.toString("yyyy-MM-dd") tag = dateTag
alpha = 1f alpha = 1f
} }
} }
val date = (eventField.tag?.toString() ?: "").getDateTimeFromDateString()
DatePickerDialog(this, getDialogTheme(), setDateListener, date.year, date.monthOfYear - 1, date.dayOfMonth).show()
} }
eventHolder.contact_event_remove.apply { eventHolder.contact_event_remove.apply {
@ -1126,7 +1123,10 @@ class EditContactActivity : ContactActivity() {
when (it as Int) { when (it as Int) {
TAKE_PHOTO -> startTakePhotoIntent() TAKE_PHOTO -> startTakePhotoIntent()
CHOOSE_PHOTO -> startChoosePhotoIntent() CHOOSE_PHOTO -> startChoosePhotoIntent()
else -> showPhotoPlaceholder(contact_photo) else -> {
showPhotoPlaceholder(contact_photo)
contact_photo_bottom_shadow.beGone()
}
} }
} }
} }

View File

@ -13,10 +13,7 @@ import androidx.appcompat.widget.SearchView
import androidx.core.view.MenuItemCompat import androidx.core.view.MenuItemCompat
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.KEY_PHONE import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.PERMISSION_GET_ACCOUNTS
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CONTACTS
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.adapters.ViewPagerAdapter import com.simplemobiletools.contacts.pro.adapters.ViewPagerAdapter
import com.simplemobiletools.contacts.pro.dialogs.ChangeSortingDialog import com.simplemobiletools.contacts.pro.dialogs.ChangeSortingDialog
@ -39,8 +36,8 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
private var searchMenuItem: MenuItem? = null private var searchMenuItem: MenuItem? = null
private val contactsFavoritesList = arrayListOf( private val contactsFavoritesList = arrayListOf(
CONTACTS_TAB_MASK, TAB_CONTACTS,
FAVORITES_TAB_MASK TAB_FAVORITES
) )
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -133,7 +130,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
insert_or_edit_tabs_holder.removeAllTabs() insert_or_edit_tabs_holder.removeAllTabs()
var skippedTabs = 0 var skippedTabs = 0
contactsFavoritesList.forEachIndexed { index, value -> contactsFavoritesList.forEachIndexed { index, value ->
if (config.showTabs and value == 0 && value == FAVORITES_TAB_MASK) { if (config.showTabs and value == 0 && value == TAB_FAVORITES) {
skippedTabs++ skippedTabs++
} else { } else {
val tab = insert_or_edit_tabs_holder.newTab().setIcon(getTabIcon(index)) val tab = insert_or_edit_tabs_holder.newTab().setIcon(getTabIcon(index))
@ -220,11 +217,11 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
return@getContacts return@getContacts
} }
if (refreshTabsMask and CONTACTS_TAB_MASK != 0) { if (refreshTabsMask and TAB_CONTACTS != 0) {
contacts_fragment?.refreshContacts(contacts) contacts_fragment?.refreshContacts(contacts)
} }
if (refreshTabsMask and FAVORITES_TAB_MASK != 0) { if (refreshTabsMask and TAB_FAVORITES != 0) {
favorites_fragment?.refreshContacts(contacts) favorites_fragment?.refreshContacts(contacts)
} }
} }
@ -298,9 +295,9 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
} }
fun getTabsMask(): Int { fun getTabsMask(): Int {
var mask = CONTACTS_TAB_MASK var mask = TAB_CONTACTS
if (config.showTabs and FAVORITES_TAB_MASK != 0) { if (config.showTabs and TAB_FAVORITES != 0) {
mask += FAVORITES_TAB_MASK mask += TAB_FAVORITES
} }
return mask return mask
} }

View File

@ -6,7 +6,6 @@ import android.app.SearchManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ShortcutInfo import android.content.pm.ShortcutInfo
import android.content.pm.ShortcutManager
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Icon import android.graphics.drawable.Icon
import android.graphics.drawable.LayerDrawable import android.graphics.drawable.LayerDrawable
@ -35,8 +34,10 @@ import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.extensions.getTempFile import com.simplemobiletools.contacts.pro.extensions.getTempFile
import com.simplemobiletools.contacts.pro.extensions.handleGenericContactClick import com.simplemobiletools.contacts.pro.extensions.handleGenericContactClick
import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment
import com.simplemobiletools.contacts.pro.helpers.* import com.simplemobiletools.contacts.pro.helpers.ALL_TABS_MASK
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.helpers.VcfExporter
import com.simplemobiletools.contacts.pro.helpers.tabsList
import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener
import com.simplemobiletools.contacts.pro.models.Contact import com.simplemobiletools.contacts.pro.models.Contact
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
@ -57,7 +58,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private var isFirstResume = true private var isFirstResume = true
private var isGettingContacts = false private var isGettingContacts = false
private var ignoredExportContactSources = HashSet<String>() private var ignoredExportContactSources = HashSet<String>()
private var handledShowTabs = 0
private var storedTextColor = 0 private var storedTextColor = 0
private var storedBackgroundColor = 0 private var storedBackgroundColor = 0
@ -73,9 +73,9 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
appLaunched(BuildConfig.APPLICATION_ID) appLaunched(BuildConfig.APPLICATION_ID)
storeStateVariables()
setupTabColors() setupTabColors()
checkContactPermissions() checkContactPermissions()
storeStateVariables()
checkWhatsNewDialog() checkWhatsNewDialog()
} }
@ -172,7 +172,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
isFirstResume = false isFirstResume = false
checkShortcuts() checkShortcuts()
invalidateOptionsMenu()
} }
override fun onPause() { override fun onPause() {
@ -180,11 +179,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
storeStateVariables() storeStateVariables()
} }
override fun onStop() {
super.onStop()
searchMenuItem?.collapseActionView()
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
config.lastUsedViewPagerPage = viewpager.currentItem config.lastUsedViewPagerPage = viewpager.currentItem
@ -228,8 +222,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) { if (requestCode == PICK_IMPORT_SOURCE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
tryImportContactsFromFile(resultData.data!!) tryImportContactsFromFile(resultData.data!!)
} else if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) { } else if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
val outputStream = contentResolver.openOutputStream(resultData.data!!) try {
exportContactsTo(ignoredExportContactSources, outputStream) val outputStream = contentResolver.openOutputStream(resultData.data!!)
exportContactsTo(ignoredExportContactSources, outputStream)
} catch (e: Exception) {
showErrorToast(e)
}
} }
} }
@ -294,35 +292,16 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private fun checkShortcuts() { private fun checkShortcuts() {
val appIconColor = config.appIconColor val appIconColor = config.appIconColor
if (isNougatMR1Plus() && config.lastHandledShortcutColor != appIconColor) { if (isNougatMR1Plus() && config.lastHandledShortcutColor != appIconColor) {
val launchDialpad = getLaunchDialpadShortcut(appIconColor)
val createNewContact = getCreateNewContactShortcut(appIconColor) val createNewContact = getCreateNewContactShortcut(appIconColor)
val manager = getSystemService(ShortcutManager::class.java)
try { try {
manager.dynamicShortcuts = Arrays.asList(launchDialpad, createNewContact) shortcutManager.dynamicShortcuts = Arrays.asList(createNewContact)
config.lastHandledShortcutColor = appIconColor config.lastHandledShortcutColor = appIconColor
} catch (ignored: Exception) { } catch (ignored: Exception) {
} }
} }
} }
@SuppressLint("NewApi")
private fun getLaunchDialpadShortcut(appIconColor: Int): ShortcutInfo {
val newEvent = getString(R.string.dialpad)
val drawable = resources.getDrawable(R.drawable.shortcut_dialpad)
(drawable as LayerDrawable).findDrawableByLayerId(R.id.shortcut_dialpad_background).applyColorFilter(appIconColor)
val bmp = drawable.convertToBitmap()
val intent = Intent(this, DialpadActivity::class.java)
intent.action = Intent.ACTION_VIEW
return ShortcutInfo.Builder(this, "launch_dialpad")
.setShortLabel(newEvent)
.setLongLabel(newEvent)
.setIcon(Icon.createWithBitmap(bmp))
.setIntent(intent)
.build()
}
@SuppressLint("NewApi") @SuppressLint("NewApi")
private fun getCreateNewContactShortcut(appIconColor: Int): ShortcutInfo { private fun getCreateNewContactShortcut(appIconColor: Int): ShortcutInfo {
val newEvent = getString(R.string.create_new_contact) val newEvent = getString(R.string.create_new_contact)
@ -343,15 +322,15 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private fun getCurrentFragment(): MyViewPagerFragment? { private fun getCurrentFragment(): MyViewPagerFragment? {
val showTabs = config.showTabs val showTabs = config.showTabs
val fragments = arrayListOf<MyViewPagerFragment>() val fragments = arrayListOf<MyViewPagerFragment>()
if (showTabs and CONTACTS_TAB_MASK != 0) { if (showTabs and TAB_CONTACTS != 0) {
fragments.add(contacts_fragment) fragments.add(contacts_fragment)
} }
if (showTabs and FAVORITES_TAB_MASK != 0) { if (showTabs and TAB_FAVORITES != 0) {
fragments.add(favorites_fragment) fragments.add(favorites_fragment)
} }
if (showTabs and GROUPS_TAB_MASK != 0) { if (showTabs and TAB_GROUPS != 0) {
fragments.add(groups_fragment) fragments.add(groups_fragment)
} }
@ -359,8 +338,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
} }
private fun setupTabColors() { private fun setupTabColors() {
handledShowTabs = config.showTabs val lastUsedPage = getDefaultTab()
val lastUsedPage = config.lastUsedViewPagerPage
main_tabs_holder.apply { main_tabs_holder.apply {
background = ColorDrawable(config.backgroundColor) background = ColorDrawable(config.backgroundColor)
setSelectedTabIndicatorColor(getAdjustedPrimaryColor()) setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
@ -426,14 +404,14 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
skippedTabs++ skippedTabs++
} else { } else {
val tab = main_tabs_holder.newTab().setIcon(getTabIcon(index)) val tab = main_tabs_holder.newTab().setIcon(getTabIcon(index))
main_tabs_holder.addTab(tab, index - skippedTabs, config.lastUsedViewPagerPage == index - skippedTabs) main_tabs_holder.addTab(tab, index - skippedTabs, getDefaultTab() == index - skippedTabs)
} }
} }
// selecting the proper tab sometimes glitches, add an extra selector to make sure we have it right // selecting the proper tab sometimes glitches, add an extra selector to make sure we have it right
main_tabs_holder.onGlobalLayout { main_tabs_holder.onGlobalLayout {
Handler().postDelayed({ Handler().postDelayed({
main_tabs_holder.getTabAt(config.lastUsedViewPagerPage)?.select() main_tabs_holder.getTabAt(getDefaultTab())?.select()
invalidateOptionsMenu() invalidateOptionsMenu()
}, 100L) }, 100L)
} }
@ -447,20 +425,25 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private fun showSortingDialog() { private fun showSortingDialog() {
ChangeSortingDialog(this) { ChangeSortingDialog(this) {
refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK) refreshContacts(TAB_CONTACTS or TAB_FAVORITES)
} }
} }
fun showFilterDialog() { fun showFilterDialog() {
FilterContactSourcesDialog(this) { FilterContactSourcesDialog(this) {
contacts_fragment?.forceListRedraw = true contacts_fragment?.forceListRedraw = true
refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK) refreshContacts(TAB_CONTACTS or TAB_FAVORITES)
} }
} }
private fun launchDialpad() { private fun launchDialpad() {
val intent = Intent(applicationContext, DialpadActivity::class.java) Intent(Intent.ACTION_DIAL).apply {
startActivity(intent) if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
}
} }
private fun tryImportContacts() { private fun tryImportContacts() {
@ -567,14 +550,15 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
FAQItem(R.string.faq_1_title, R.string.faq_1_text), FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons), FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons), FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons),
FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons) FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons),
FAQItem(R.string.faq_9_title_commons, R.string.faq_9_text_commons)
) )
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
} }
override fun refreshContacts(refreshTabsMask: Int) { override fun refreshContacts(refreshTabsMask: Int) {
if (isDestroyed || isFinishing || isGettingContacts) { if (isDestroyed || isFinishing || isGettingContacts || isSearchOpen) {
return return
} }
@ -582,7 +566,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
if (viewpager.adapter == null) { if (viewpager.adapter == null) {
viewpager.adapter = ViewPagerAdapter(this, tabsList, config.showTabs) viewpager.adapter = ViewPagerAdapter(this, tabsList, config.showTabs)
viewpager.currentItem = config.lastUsedViewPagerPage viewpager.currentItem = getDefaultTab()
} }
ContactsHelper(this).getContacts { contacts -> ContactsHelper(this).getContacts { contacts ->
@ -591,16 +575,16 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
return@getContacts return@getContacts
} }
if (refreshTabsMask and CONTACTS_TAB_MASK != 0) { if (refreshTabsMask and TAB_CONTACTS != 0) {
contacts_fragment?.refreshContacts(contacts) contacts_fragment?.refreshContacts(contacts)
} }
if (refreshTabsMask and FAVORITES_TAB_MASK != 0) { if (refreshTabsMask and TAB_FAVORITES != 0) {
favorites_fragment?.refreshContacts(contacts) favorites_fragment?.refreshContacts(contacts)
} }
if (refreshTabsMask and GROUPS_TAB_MASK != 0) { if (refreshTabsMask and TAB_GROUPS != 0) {
if (refreshTabsMask == GROUPS_TAB_MASK) { if (refreshTabsMask == TAB_GROUPS) {
groups_fragment.skipHashComparing = true groups_fragment.skipHashComparing = true
} }
groups_fragment?.refreshContacts(contacts) groups_fragment?.refreshContacts(contacts)
@ -614,6 +598,22 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private fun getAllFragments() = arrayListOf(contacts_fragment, favorites_fragment, groups_fragment) private fun getAllFragments() = arrayListOf(contacts_fragment, favorites_fragment, groups_fragment)
private fun getDefaultTab(): Int {
val showTabsMask = config.showTabs
return when (config.defaultTab) {
TAB_LAST_USED -> config.lastUsedViewPagerPage
TAB_CONTACTS -> 0
TAB_FAVORITES -> if (showTabsMask and TAB_CONTACTS > 0) 1 else 0
else -> {
if (showTabsMask and TAB_CONTACTS > 0) {
if (showTabsMask and TAB_FAVORITES > 0) 2 else 1
} else {
0
}
}
}
}
private fun checkWhatsNewDialog() { private fun checkWhatsNewDialog() {
arrayListOf<Release>().apply { arrayListOf<Release>().apply {
add(Release(10, R.string.release_10)) add(Release(10, R.string.release_10))

View File

@ -1,68 +0,0 @@
package com.simplemobiletools.contacts.pro.activities
import android.os.Bundle
import com.google.gson.Gson
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.adapters.SpeedDialAdapter
import com.simplemobiletools.contacts.pro.dialogs.SelectContactsDialog
import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.interfaces.RemoveSpeedDialListener
import com.simplemobiletools.contacts.pro.models.Contact
import com.simplemobiletools.contacts.pro.models.SpeedDial
import kotlinx.android.synthetic.main.activity_manage_speed_dial.*
class ManageSpeedDialActivity : SimpleActivity(), RemoveSpeedDialListener {
private var allContacts = ArrayList<Contact>()
private var speedDialValues = ArrayList<SpeedDial>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_manage_speed_dial)
speedDialValues = config.getSpeedDialValues()
updateAdapter()
ContactsHelper(this).getContacts { contacts ->
allContacts = contacts
}
updateTextColors(manage_speed_dial_scrollview)
}
override fun onStop() {
super.onStop()
config.speedDial = Gson().toJson(speedDialValues)
}
private fun updateAdapter() {
SpeedDialAdapter(this, speedDialValues, this, speed_dial_list) {
val clickedContact = it as SpeedDial
if (allContacts.isEmpty()) {
return@SpeedDialAdapter
}
SelectContactsDialog(this, allContacts, false, true) { addedContacts, removedContacts ->
val selectedContact = addedContacts.first()
speedDialValues.first { it.id == clickedContact.id }.apply {
displayName = selectedContact.getNameToDisplay()
number = selectedContact.phoneNumbers.first().value
}
updateAdapter()
}
}.apply {
speed_dial_list.adapter = this
}
}
override fun removeSpeedDial(ids: ArrayList<Int>) {
ids.forEach {
val dialId = it
speedDialValues.first { it.id == dialId }.apply {
displayName = ""
number = ""
}
}
updateAdapter()
}
}

View File

@ -201,7 +201,6 @@ class SelectContactActivity : SimpleActivity() {
select_contact_list.adapter = this select_contact_list.adapter = this
} }
select_contact_fastscroller.allowBubbleDisplay = true
select_contact_fastscroller.setViews(select_contact_list) { select_contact_fastscroller.setViews(select_contact_list) {
select_contact_fastscroller.updateBubbleText(contacts[it].getBubbleText()) select_contact_fastscroller.updateBubbleText(contacts[it].getBubbleText())
} }

View File

@ -1,12 +1,9 @@
package com.simplemobiletools.contacts.pro.activities package com.simplemobiletools.contacts.pro.activities
import android.annotation.TargetApi
import android.content.Intent
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.baseConfig
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getFontSizeText import com.simplemobiletools.commons.extensions.getFontSizeText
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
@ -34,8 +31,6 @@ class SettingsActivity : SimpleActivity() {
setupCustomizeColors() setupCustomizeColors()
setupManageShownContactFields() setupManageShownContactFields()
setupManageShownTabs() setupManageShownTabs()
setupManageBlockedNumbers()
setupManageSpeedDial()
setupFontSize() setupFontSize()
setupUseEnglish() setupUseEnglish()
setupShowContactThumbnails() setupShowContactThumbnails()
@ -44,8 +39,9 @@ class SettingsActivity : SimpleActivity() {
setupStartNameWithSurname() setupStartNameWithSurname()
setupShowCallConfirmation() setupShowCallConfirmation()
setupShowDialpadButton() setupShowDialpadButton()
setupShowDialpadLetters() setupShowPrivateContacts()
setupOnContactClick() setupOnContactClick()
setupDefaultTab()
updateTextColors(settings_holder) updateTextColors(settings_holder)
invalidateOptionsMenu() invalidateOptionsMenu()
} }
@ -73,20 +69,28 @@ class SettingsActivity : SimpleActivity() {
} }
} }
// support for device-wise blocking came on Android 7, rely only on that private fun setupDefaultTab() {
@TargetApi(Build.VERSION_CODES.N) settings_default_tab.text = getDefaultTabText()
private fun setupManageBlockedNumbers() { settings_default_tab_holder.setOnClickListener {
settings_manage_blocked_numbers_holder.beVisibleIf(isNougatPlus()) val items = arrayListOf(
settings_manage_blocked_numbers_holder.setOnClickListener { RadioItem(TAB_CONTACTS, getString(R.string.contacts_tab)),
startActivity(Intent(this, ManageBlockedNumbersActivity::class.java)) RadioItem(TAB_FAVORITES, getString(R.string.favorites_tab)),
RadioItem(TAB_GROUPS, getString(R.string.groups_tab)),
RadioItem(TAB_LAST_USED, getString(R.string.last_used_tab)))
RadioGroupDialog(this@SettingsActivity, items, config.defaultTab) {
config.defaultTab = it as Int
settings_default_tab.text = getDefaultTabText()
}
} }
} }
private fun setupManageSpeedDial() { private fun getDefaultTabText() = getString(when (baseConfig.defaultTab) {
settings_manage_speed_dial_holder.setOnClickListener { TAB_CONTACTS -> R.string.contacts_tab
startActivity(Intent(this, ManageSpeedDialActivity::class.java)) TAB_FAVORITES -> R.string.favorites_tab
} TAB_GROUPS -> R.string.groups_tab
} else -> R.string.last_used_tab
})
private fun setupFontSize() { private fun setupFontSize() {
settings_font_size.text = getFontSizeText() settings_font_size.text = getFontSizeText()
@ -154,11 +158,11 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupShowDialpadLetters() { private fun setupShowPrivateContacts() {
settings_show_dialpad_letters.isChecked = config.showDialpadLetters settings_show_private_contacts.isChecked = config.showPrivateContacts
settings_show_dialpad_letters_holder.setOnClickListener { settings_show_private_contacts_holder.setOnClickListener {
settings_show_dialpad_letters.toggle() settings_show_private_contacts.toggle()
config.showDialpadLetters = settings_show_dialpad_letters.isChecked config.showPrivateContacts = settings_show_private_contacts.isChecked
} }
} }

View File

@ -1,23 +1,23 @@
package com.simplemobiletools.contacts.pro.activities package com.simplemobiletools.contacts.pro.activities
import android.content.ContentUris
import android.content.Intent import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle import android.os.Bundle
import android.provider.ContactsContract import android.provider.ContactsContract
import android.view.Menu
import android.view.MenuItem
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.widget.RelativeLayout import android.widget.RelativeLayout
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.FitCenter
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.CONTACT_ID
import com.simplemobiletools.commons.helpers.IS_PRIVATE
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog
import com.simplemobiletools.contacts.pro.dialogs.ChooseSocialDialog
import com.simplemobiletools.contacts.pro.extensions.* import com.simplemobiletools.contacts.pro.extensions.*
import com.simplemobiletools.contacts.pro.helpers.* import com.simplemobiletools.contacts.pro.helpers.*
import com.simplemobiletools.contacts.pro.models.* import com.simplemobiletools.contacts.pro.models.*
@ -42,6 +42,7 @@ class ViewContactActivity : ContactActivity() {
private val COMPARABLE_PHONE_NUMBER_LENGTH = 9 private val COMPARABLE_PHONE_NUMBER_LENGTH = 9
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
showTransparentTop = true
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_view_contact) setContentView(R.layout.activity_view_contact)
@ -50,6 +51,8 @@ class ViewContactActivity : ContactActivity() {
} }
showFields = config.showContactFields showFields = config.showContactFields
contact_wrapper.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
setupMenu()
} }
override fun onResume() { override fun onResume() {
@ -73,36 +76,33 @@ class ViewContactActivity : ContactActivity() {
} }
} }
override fun onBackPressed() { private fun setupMenu() {
if (contact_photo_big.alpha == 1f) { (contact_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
hideBigContactPhoto() contact_toolbar.menu.apply {
} else { findItem(R.id.share).setOnMenuItemClickListener {
super.onBackPressed() shareContact(fullContact!!)
} true
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { findItem(R.id.edit).setOnMenuItemClickListener {
menuInflater.inflate(R.menu.menu_view_contact, menu) launchEditContact(contact!!)
menu.apply { true
findItem(R.id.open_with).isVisible = contact?.isPrivate() == false }
updateMenuItemColors(this)
}
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean { findItem(R.id.open_with).setOnMenuItemClickListener {
if (contact == null) { openWith()
return true true
}
findItem(R.id.delete).setOnMenuItemClickListener {
deleteContactFromAllSources()
true
}
} }
when (item.itemId) { contact_toolbar.setNavigationOnClickListener {
R.id.edit -> launchEditContact(contact!!) finish()
R.id.share -> shareContact(fullContact!!)
R.id.open_with -> openWith()
R.id.delete -> deleteContactFromAllSources()
else -> return super.onOptionsItemSelected(item)
} }
return true
} }
private fun initContact() { private fun initContact() {
@ -168,31 +168,14 @@ class ViewContactActivity : ContactActivity() {
if (contact!!.photoUri.isEmpty() && contact!!.photo == null) { if (contact!!.photoUri.isEmpty() && contact!!.photo == null) {
showPhotoPlaceholder(contact_photo) showPhotoPlaceholder(contact_photo)
contact_photo_bottom_shadow.beGone()
} else { } else {
updateContactPhoto(contact!!.photoUri, contact_photo, contact!!.photo) updateContactPhoto(contact!!.photoUri, contact_photo, contact_photo_bottom_shadow, contact!!.photo)
val options = RequestOptions()
.transform(FitCenter(), RoundedCorners(resources.getDimension(R.dimen.normal_margin).toInt()))
Glide.with(this)
.load(contact!!.photo ?: currentContactPhotoPath)
.apply(options)
.into(contact_photo_big)
contact_photo.setOnClickListener {
contact_photo_big.alpha = 0f
contact_photo_big.beVisible()
contact_photo_big.animate().alpha(1f).start()
}
contact_photo_big.setOnClickListener {
hideBigContactPhoto()
}
} }
val textColor = config.textColor val textColor = config.textColor
arrayOf(contact_send_sms, contact_start_call, contact_send_email, contact_name_image, contact_numbers_image, contact_emails_image, arrayOf(contact_name_image, contact_numbers_image, contact_emails_image, contact_addresses_image, contact_events_image, contact_source_image,
contact_addresses_image, contact_events_image, contact_source_image, contact_notes_image, contact_organization_image, contact_notes_image, contact_organization_image, contact_websites_image, contact_groups_image).forEach {
contact_websites_image, contact_groups_image).forEach {
it.applyColorFilter(textColor) it.applyColorFilter(textColor)
} }
@ -201,7 +184,7 @@ class ViewContactActivity : ContactActivity() {
contact_send_email.setOnClickListener { trySendEmail() } contact_send_email.setOnClickListener { trySendEmail() }
updateTextColors(contact_scrollview) updateTextColors(contact_scrollview)
invalidateOptionsMenu() contact_toolbar.menu.findItem(R.id.open_with).isVisible = contact?.isPrivate() == false
} }
private fun setupViewContact() { private fun setupViewContact() {
@ -251,11 +234,22 @@ class ViewContactActivity : ContactActivity() {
private fun setupFavorite() { private fun setupFavorite() {
contact_toggle_favorite.apply { contact_toggle_favorite.apply {
beVisible() beVisible()
setImageDrawable(getStarDrawable(contact!!.starred == 1))
tag = contact!!.starred tag = contact!!.starred
applyColorFilter(config.textColor) setImageDrawable(getStarDrawable(tag == 1))
setOnClickListener { setOnClickListener {
toast(R.string.must_be_at_edit) val newIsStarred = if (tag == 1) 0 else 1
ensureBackgroundThread {
val contacts = arrayListOf(contact!!)
if (newIsStarred == 1) {
ContactsHelper(context).addFavorites(contacts)
} else {
ContactsHelper(context).removeFavorites(contacts)
}
}
contact!!.starred = newIsStarred
tag = contact!!.starred
setImageDrawable(getStarDrawable(tag == 1))
} }
} }
} }
@ -289,7 +283,6 @@ class ViewContactActivity : ContactActivity() {
if (contact_prefix.isGone() && contact_first_name.isGone() && contact_middle_name.isGone() && contact_surname.isGone() && contact_suffix.isGone() if (contact_prefix.isGone() && contact_first_name.isGone() && contact_middle_name.isGone() && contact_surname.isGone() && contact_suffix.isGone()
&& contact_nickname.isGone()) { && contact_nickname.isGone()) {
contact_name_image.beInvisible() contact_name_image.beInvisible()
(contact_photo.layoutParams as RelativeLayout.LayoutParams).bottomMargin = resources.getDimension(R.dimen.medium_margin).toInt()
} }
} }
} }
@ -539,6 +532,38 @@ class ViewContactActivity : ContactActivity() {
contact_source.setOnClickListener { contact_source.setOnClickListener {
launchEditContact(key) launchEditContact(key)
} }
if (value.toLowerCase() == WHATSAPP) {
contact_source_image.setImageDrawable(getPackageDrawable(WHATSAPP_PACKAGE))
contact_source_image.beVisible()
contact_source_image.setOnClickListener {
showSocialActions(key.id)
}
}
if (value.toLowerCase() == SIGNAL) {
contact_source_image.setImageDrawable(getPackageDrawable(SIGNAL_PACKAGE))
contact_source_image.beVisible()
contact_source_image.setOnClickListener {
showSocialActions(key.id)
}
}
if (value.toLowerCase() == VIBER) {
contact_source_image.setImageDrawable(getPackageDrawable(VIBER_PACKAGE))
contact_source_image.beVisible()
contact_source_image.setOnClickListener {
showSocialActions(key.id)
}
}
if (value.toLowerCase() == TELEGRAM) {
contact_source_image.setImageDrawable(getPackageDrawable(TELEGRAM_PACKAGE))
contact_source_image.beVisible()
contact_source_image.setOnClickListener {
showSocialActions(key.id)
}
}
} }
} }
@ -584,6 +609,22 @@ class ViewContactActivity : ContactActivity() {
} }
} }
private fun showSocialActions(contactId: Int) {
ensureBackgroundThread {
val actions = getSocialActions(contactId)
runOnUiThread {
ChooseSocialDialog(this@ViewContactActivity, actions) { action ->
Intent(Intent.ACTION_VIEW).apply {
val uri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, action.dataId)
setDataAndType(uri, action.mimetype)
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(this)
}
}
}
}
}
private fun getDuplicateContacts(callback: () -> Unit) { private fun getDuplicateContacts(callback: () -> Unit) {
ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts -> ContactsHelper(this).getDuplicatesOfContact(contact!!, false) { contacts ->
ensureBackgroundThread { ensureBackgroundThread {
@ -622,10 +663,6 @@ class ViewContactActivity : ContactActivity() {
private fun getStarDrawable(on: Boolean) = resources.getDrawable(if (on) R.drawable.ic_star_on_vector else R.drawable.ic_star_off_vector) private fun getStarDrawable(on: Boolean) = resources.getDrawable(if (on) R.drawable.ic_star_on_vector else R.drawable.ic_star_off_vector)
private fun hideBigContactPhoto() {
contact_photo_big.animate().alpha(0f).withEndAction { contact_photo_big.beGone() }.start()
}
private fun View.copyOnLongClick(value: String) { private fun View.copyOnLongClick(value: String) {
setOnLongClickListener { setOnLongClickListener {
copyToClipboard(value) copyToClipboard(value)

View File

@ -16,8 +16,7 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.commons.views.MyRecyclerView
@ -40,7 +39,6 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
private var config = activity.config private var config = activity.config
private var textToHighlight = highlightText private var textToHighlight = highlightText
var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
var startNameWithSurname = config.startNameWithSurname var startNameWithSurname = config.startNameWithSurname
var showContactThumbnails = config.showContactThumbnails var showContactThumbnails = config.showContactThumbnails
var showPhoneNumbers = config.showPhoneNumbers var showPhoneNumbers = config.showPhoneNumbers
@ -137,9 +135,8 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
private fun askConfirmDelete() { private fun askConfirmDelete() {
val itemsCnt = selectedKeys.size val itemsCnt = selectedKeys.size
val firstItem = getSelectedItems().first()
val items = if (itemsCnt == 1) { val items = if (itemsCnt == 1) {
"\"${firstItem.getNameToDisplay()}\"" "\"${getSelectedItems().first().getNameToDisplay()}\""
} else { } else {
resources.getQuantityString(R.plurals.delete_contacts, itemsCnt, itemsCnt) resources.getQuantityString(R.plurals.delete_contacts, itemsCnt, itemsCnt)
} }
@ -176,7 +173,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
finishActMode() finishActMode()
} else { } else {
removeSelectedItems(positions) removeSelectedItems(positions)
refreshListener?.refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK) refreshListener?.refreshContacts(TAB_CONTACTS or TAB_FAVORITES)
} }
} }
} }
@ -192,7 +189,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
if (location == LOCATION_FAVORITES_TAB) { if (location == LOCATION_FAVORITES_TAB) {
ContactsHelper(activity).removeFavorites(contactsToRemove) ContactsHelper(activity).removeFavorites(contactsToRemove)
if (contactItems.isEmpty()) { if (contactItems.isEmpty()) {
refreshListener?.refreshContacts(FAVORITES_TAB_MASK) refreshListener?.refreshContacts(TAB_FAVORITES)
finishActMode() finishActMode()
} else { } else {
removeSelectedItems(positions) removeSelectedItems(positions)
@ -205,7 +202,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
private fun addToFavorites() { private fun addToFavorites() {
ContactsHelper(activity).addFavorites(getSelectedItems()) ContactsHelper(activity).addFavorites(getSelectedItems())
refreshListener?.refreshContacts(FAVORITES_TAB_MASK) refreshListener?.refreshContacts(TAB_FAVORITES)
finishActMode() finishActMode()
} }
@ -227,14 +224,14 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
CreateNewGroupDialog(activity) { CreateNewGroupDialog(activity) {
ensureBackgroundThread { ensureBackgroundThread {
activity.addContactsToGroup(selectedContacts, it.id!!.toLong()) activity.addContactsToGroup(selectedContacts, it.id!!.toLong())
refreshListener?.refreshContacts(GROUPS_TAB_MASK) refreshListener?.refreshContacts(TAB_GROUPS)
} }
finishActMode() finishActMode()
} }
} else { } else {
ensureBackgroundThread { ensureBackgroundThread {
activity.addContactsToGroup(selectedContacts, it.toLong()) activity.addContactsToGroup(selectedContacts, it.toLong())
refreshListener?.refreshContacts(GROUPS_TAB_MASK) refreshListener?.refreshContacts(TAB_GROUPS)
} }
finishActMode() finishActMode()
} }

View File

@ -7,10 +7,10 @@ import android.view.ViewGroup
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.getTextSize import com.simplemobiletools.commons.extensions.getTextSize
import com.simplemobiletools.commons.extensions.highlightTextPart import com.simplemobiletools.commons.extensions.highlightTextPart
import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.helpers.TAB_GROUPS
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.commons.views.MyRecyclerView
@ -20,7 +20,6 @@ import com.simplemobiletools.contacts.pro.dialogs.RenameGroupDialog
import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.extensions.groupsDB import com.simplemobiletools.contacts.pro.extensions.groupsDB
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.helpers.GROUPS_TAB_MASK
import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener
import com.simplemobiletools.contacts.pro.models.Group import com.simplemobiletools.contacts.pro.models.Group
import kotlinx.android.synthetic.main.item_group.view.* import kotlinx.android.synthetic.main.item_group.view.*
@ -30,8 +29,6 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
fastScroller: FastScroller, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { fastScroller: FastScroller, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
private var textToHighlight = "" private var textToHighlight = ""
var adjustedPrimaryColor = activity.getAdjustedPrimaryColor()
var showContactThumbnails = activity.config.showContactThumbnails var showContactThumbnails = activity.config.showContactThumbnails
var fontSize = activity.getTextSize() var fontSize = activity.getTextSize()
@ -102,7 +99,7 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
val group = getItemWithKey(selectedKeys.first()) ?: return val group = getItemWithKey(selectedKeys.first()) ?: return
RenameGroupDialog(activity, group) { RenameGroupDialog(activity, group) {
finishActMode() finishActMode()
refreshListener?.refreshContacts(GROUPS_TAB_MASK) refreshListener?.refreshContacts(TAB_GROUPS)
} }
} }
@ -143,7 +140,7 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
activity.runOnUiThread { activity.runOnUiThread {
if (groups.isEmpty()) { if (groups.isEmpty()) {
refreshListener?.refreshContacts(GROUPS_TAB_MASK) refreshListener?.refreshContacts(TAB_GROUPS)
finishActMode() finishActMode()
} else { } else {
removeSelectedItems(positions) removeSelectedItems(positions)

View File

@ -1,80 +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.views.MyRecyclerView
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.interfaces.RemoveSpeedDialListener
import com.simplemobiletools.contacts.pro.models.SpeedDial
import kotlinx.android.synthetic.main.item_speed_dial.view.*
import java.util.*
class SpeedDialAdapter(activity: SimpleActivity, var speedDialValues: ArrayList<SpeedDial>, private val removeListener: RemoveSpeedDialListener,
recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) {
init {
setupDragListener(true)
}
override fun getActionMenuId() = R.menu.cab_delete_only
override fun prepareActionMode(menu: Menu) {}
override fun actionItemPressed(id: Int) {
if (selectedKeys.isEmpty()) {
return
}
when (id) {
R.id.cab_delete -> deleteSpeedDial()
}
}
override fun getSelectableItemCount() = speedDialValues.size
override fun getIsItemSelectable(position: Int) = speedDialValues[position].isValid()
override fun getItemSelectionKey(position: Int) = speedDialValues.getOrNull(position)?.hashCode()
override fun getItemKeyPosition(key: Int) = speedDialValues.indexOfFirst { it.hashCode() == key }
override fun onActionModeCreated() {}
override fun onActionModeDestroyed() {}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_speed_dial, parent)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val speedDial = speedDialValues[position]
holder.bindView(speedDial, true, true) { itemView, layoutPosition ->
setupView(itemView, speedDial)
}
bindViewHolder(holder)
}
override fun getItemCount() = speedDialValues.size
private fun getSelectedItems() = speedDialValues.filter { selectedKeys.contains(it.hashCode()) } as ArrayList<SpeedDial>
private fun deleteSpeedDial() {
val ids = getSelectedItems().map { it.id }.toMutableList() as ArrayList<Int>
removeListener.removeSpeedDial(ids)
finishActMode()
}
private fun setupView(view: View, speedDial: SpeedDial) {
view.apply {
var displayName = "${speedDial.id}. "
displayName += if (speedDial.isValid()) speedDial.displayName else ""
speed_dial_label.apply {
text = displayName
isSelected = selectedKeys.contains(speedDial.hashCode())
setTextColor(textColor)
}
}
}
}

View File

@ -3,12 +3,12 @@ package com.simplemobiletools.contacts.pro.adapters
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.PagerAdapter
import com.simplemobiletools.commons.helpers.TAB_CONTACTS
import com.simplemobiletools.commons.helpers.TAB_FAVORITES
import com.simplemobiletools.commons.helpers.TAB_GROUPS
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment import com.simplemobiletools.contacts.pro.fragments.MyViewPagerFragment
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 ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList<Int>, val showTabs: Int) : PagerAdapter() { class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList<Int>, val showTabs: Int) : PagerAdapter() {
@ -34,15 +34,15 @@ class ViewPagerAdapter(val activity: SimpleActivity, val currTabsList: ArrayList
private fun getFragment(position: Int): Int { private fun getFragment(position: Int): Int {
val fragments = arrayListOf<Int>() val fragments = arrayListOf<Int>()
if (showTabs and CONTACTS_TAB_MASK != 0) { if (showTabs and TAB_CONTACTS != 0) {
fragments.add(R.layout.fragment_contacts) fragments.add(R.layout.fragment_contacts)
} }
if (showTabs and FAVORITES_TAB_MASK != 0) { if (showTabs and TAB_FAVORITES != 0) {
fragments.add(R.layout.fragment_favorites) fragments.add(R.layout.fragment_favorites)
} }
if (showTabs and GROUPS_TAB_MASK != 0) { if (showTabs and TAB_GROUPS != 0) {
fragments.add(R.layout.fragment_groups) fragments.add(R.layout.fragment_groups)
} }

View File

@ -0,0 +1,56 @@
package com.simplemobiletools.contacts.pro.contentproviders
import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.database.MatrixCursor
import android.net.Uri
import com.google.gson.Gson
import com.simplemobiletools.commons.helpers.MyContactsContentProvider
import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.helpers.LocalContactsHelper
class MyContactsContentProvider : ContentProvider() {
override fun insert(uri: Uri, contentValues: ContentValues?) = null
override fun query(uri: Uri, projection: Array<out String>?, selection: String?, selectionArgs: Array<out String>?, sortOrder: String?): Cursor? {
if (context == null || !context!!.config.showPrivateContacts) {
return null
} else {
val matrixCursor = MatrixCursor(arrayOf(
MyContactsContentProvider.COL_RAW_ID,
MyContactsContentProvider.COL_CONTACT_ID,
MyContactsContentProvider.COL_NAME,
MyContactsContentProvider.COL_PHOTO_URI,
MyContactsContentProvider.COL_PHONE_NUMBERS,
MyContactsContentProvider.COL_BIRTHDAYS,
MyContactsContentProvider.COL_ANNIVERSARIES)
)
LocalContactsHelper(context!!).getPrivateSimpleContactsSync(selection == MyContactsContentProvider.FAVORITES_ONLY).forEach {
val phoneNumbers = Gson().toJson(it.phoneNumbers)
val birthdays = Gson().toJson(it.birthdays)
val anniversaries = Gson().toJson(it.anniversaries)
matrixCursor.newRow()
.add(MyContactsContentProvider.COL_RAW_ID, it.rawId)
.add(MyContactsContentProvider.COL_CONTACT_ID, it.contactId)
.add(MyContactsContentProvider.COL_NAME, it.name)
.add(MyContactsContentProvider.COL_PHOTO_URI, it.photoUri)
.add(MyContactsContentProvider.COL_PHONE_NUMBERS, phoneNumbers)
.add(MyContactsContentProvider.COL_BIRTHDAYS, birthdays)
.add(MyContactsContentProvider.COL_ANNIVERSARIES, anniversaries)
}
return matrixCursor
}
}
override fun onCreate() = true
override fun update(uri: Uri, values: ContentValues?, selection: String?, selectionArgs: Array<out String>?) = 1
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int = 0
override fun getType(uri: Uri) = ""
}

View File

@ -3,10 +3,7 @@ package com.simplemobiletools.contacts.pro.dialogs
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.helpers.SORT_BY_FIRST_NAME import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.SORT_BY_MIDDLE_NAME
import com.simplemobiletools.commons.helpers.SORT_BY_SURNAME
import com.simplemobiletools.commons.helpers.SORT_DESCENDING
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.config
import kotlinx.android.synthetic.main.dialog_change_sorting.view.* import kotlinx.android.synthetic.main.dialog_change_sorting.view.*
@ -18,11 +15,11 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, private val callback
init { init {
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
activity.setupDialogStuff(view, this, R.string.sort_by) activity.setupDialogStuff(view, this, R.string.sort_by)
} }
currSorting = config.sorting currSorting = config.sorting
setupSortRadio() setupSortRadio()
@ -34,7 +31,8 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, private val callback
val sortBtn = when { val sortBtn = when {
currSorting and SORT_BY_FIRST_NAME != 0 -> sortingRadio.sorting_dialog_radio_first_name currSorting and SORT_BY_FIRST_NAME != 0 -> sortingRadio.sorting_dialog_radio_first_name
currSorting and SORT_BY_MIDDLE_NAME != 0 -> sortingRadio.sorting_dialog_radio_middle_name currSorting and SORT_BY_MIDDLE_NAME != 0 -> sortingRadio.sorting_dialog_radio_middle_name
else -> sortingRadio.sorting_dialog_radio_surname currSorting and SORT_BY_SURNAME != 0 -> sortingRadio.sorting_dialog_radio_surname
else -> sortingRadio.sorting_dialog_radio_full_name
} }
sortBtn.isChecked = true sortBtn.isChecked = true
} }
@ -54,7 +52,8 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, private val callback
var sorting = when (sortingRadio.checkedRadioButtonId) { var sorting = when (sortingRadio.checkedRadioButtonId) {
R.id.sorting_dialog_radio_first_name -> SORT_BY_FIRST_NAME R.id.sorting_dialog_radio_first_name -> SORT_BY_FIRST_NAME
R.id.sorting_dialog_radio_middle_name -> SORT_BY_MIDDLE_NAME R.id.sorting_dialog_radio_middle_name -> SORT_BY_MIDDLE_NAME
else -> SORT_BY_SURNAME R.id.sorting_dialog_radio_surname -> SORT_BY_SURNAME
else -> SORT_BY_FULL_NAME
} }
if (view.sorting_dialog_radio_order.checkedRadioButtonId == R.id.sorting_dialog_radio_descending) { if (view.sorting_dialog_radio_order.checkedRadioButtonId == R.id.sorting_dialog_radio_descending) {

View File

@ -0,0 +1,47 @@
package com.simplemobiletools.contacts.pro.dialogs
import android.app.Activity
import android.view.ViewGroup
import android.widget.RadioGroup
import android.widget.RelativeLayout
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.extensions.beGone
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.getPackageDrawable
import com.simplemobiletools.contacts.pro.models.SocialAction
import kotlinx.android.synthetic.main.dialog_choose_social.view.*
import kotlinx.android.synthetic.main.item_choose_social.view.*
class ChooseSocialDialog(val activity: Activity, actions: ArrayList<SocialAction>, val callback: (action: SocialAction) -> Unit) {
private lateinit var dialog: AlertDialog
init {
val view = activity.layoutInflater.inflate(R.layout.dialog_choose_social, null)
actions.sortBy { it.type }
actions.forEach { action ->
val item = (activity.layoutInflater.inflate(R.layout.item_choose_social, null) as RelativeLayout).apply {
item_social_label.text = action.label
setOnClickListener {
callback(action)
dialog.dismiss()
}
val drawable = activity.getPackageDrawable(action.packageName)
if (drawable == null) {
item_social_image.beGone()
} else {
item_social_image.setImageDrawable(drawable)
}
}
view.dialog_choose_social.addView(item, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
}
val builder = AlertDialog.Builder(activity)
dialog = builder.create().apply {
activity.setupDialogStuff(view, this)
}
}
}

View File

@ -41,7 +41,7 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG
val items = ArrayList<RadioItem>() val items = ArrayList<RadioItem>()
contactSources.forEachIndexed { index, contactSource -> contactSources.forEachIndexed { index, contactSource ->
items.add(RadioItem(index, contactSource.name)) items.add(RadioItem(index, contactSource.publicName))
} }
activity.runOnUiThread { activity.runOnUiThread {

View File

@ -3,13 +3,13 @@ package com.simplemobiletools.contacts.pro.dialogs
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.helpers.TAB_CONTACTS
import com.simplemobiletools.commons.helpers.TAB_FAVORITES
import com.simplemobiletools.commons.helpers.TAB_GROUPS
import com.simplemobiletools.commons.views.MyAppCompatCheckbox import com.simplemobiletools.commons.views.MyAppCompatCheckbox
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.helpers.ALL_TABS_MASK 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) { class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_visible_tabs, null) private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_visible_tabs, null)
@ -17,9 +17,9 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
init { init {
tabs.apply { tabs.apply {
put(CONTACTS_TAB_MASK, R.id.manage_visible_tabs_contacts) put(TAB_CONTACTS, R.id.manage_visible_tabs_contacts)
put(FAVORITES_TAB_MASK, R.id.manage_visible_tabs_favorites) put(TAB_FAVORITES, R.id.manage_visible_tabs_favorites)
put(GROUPS_TAB_MASK, R.id.manage_visible_tabs_groups) put(TAB_GROUPS, R.id.manage_visible_tabs_groups)
} }
val showTabs = activity.config.showTabs val showTabs = activity.config.showTabs
@ -28,11 +28,11 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
} }
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
activity.setupDialogStuff(view, this) activity.setupDialogStuff(view, this)
} }
} }
private fun dialogConfirmed() { private fun dialogConfirmed() {

View File

@ -0,0 +1,58 @@
package com.simplemobiletools.contacts.pro.dialogs
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.contacts.pro.R
import kotlinx.android.synthetic.main.dialog_date_picker.view.*
import org.joda.time.DateTime
import java.util.*
class MyDatePickerDialog(val activity: BaseSimpleActivity, val defaultDate: String, val callback: (dateTag: String) -> Unit) {
private var view = activity.layoutInflater.inflate(R.layout.dialog_date_picker, null)
init {
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this) {
val today = Calendar.getInstance()
var year = today.get(Calendar.YEAR)
var month = today.get(Calendar.MONTH)
var day = today.get(Calendar.DAY_OF_MONTH)
if (defaultDate.isNotEmpty()) {
val ignoreYear = defaultDate.startsWith("-")
view.hide_year.isChecked = ignoreYear
if (ignoreYear) {
month = defaultDate.substring(2, 4).toInt() - 1
day = defaultDate.substring(5, 7).toInt()
} else {
year = defaultDate.substring(0, 4).toInt()
month = defaultDate.substring(5, 7).toInt() - 1
day = defaultDate.substring(8, 10).toInt()
}
}
view.date_picker.updateDate(year, month, day)
}
}
}
private fun dialogConfirmed() {
val year = view.date_picker.year
val month = view.date_picker.month + 1
val day = view.date_picker.dayOfMonth
val date = DateTime().withDate(year, month, day).withTimeAtStartOfDay()
val tag = if (view.hide_year.isChecked) {
date.toString("--MM-dd")
} else {
date.toString("yyyy-MM-dd")
}
callback(tag)
}
}

View File

@ -40,9 +40,8 @@ class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayL
view.apply { view.apply {
select_contact_list.adapter = SelectContactsAdapter(activity, allContacts, initiallySelectedContacts, allowSelectMultiple, select_contact_list.adapter = SelectContactsAdapter(activity, allContacts, initiallySelectedContacts, allowSelectMultiple,
select_contact_list, select_contact_fastscroller, contactClickCallback) select_contact_list, select_contact_fastscroller, contactClickCallback)
select_contact_fastscroller.allowBubbleDisplay = true
select_contact_fastscroller.setViews(select_contact_list) { select_contact_fastscroller.setViews(select_contact_list) {
select_contact_fastscroller.updateBubbleText(allContacts[it].getBubbleText()) select_contact_fastscroller.updateBubbleText(allContacts[it].getBubbleText())
} }

View File

@ -1,47 +0,0 @@
package com.simplemobiletools.contacts.pro.dialogs
import android.annotation.SuppressLint
import android.telecom.PhoneAccountHandle
import android.view.ViewGroup
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.config
import com.simplemobiletools.contacts.pro.extensions.getAvailableSIMCardLabels
import kotlinx.android.synthetic.main.dialog_select_sim.view.*
@SuppressLint("MissingPermission")
class SelectSIMDialog(val activity: BaseSimpleActivity, val phoneNumber: String, val callback: (handle: PhoneAccountHandle) -> Unit) {
private var dialog: AlertDialog? = null
private val view = activity.layoutInflater.inflate(R.layout.dialog_select_sim, null)
init {
val radioGroup = view.select_sim_radio_group
activity.getAvailableSIMCardLabels().forEachIndexed { index, SIMAccount ->
val radioButton = (activity.layoutInflater.inflate(R.layout.radio_button, null) as RadioButton).apply {
text = SIMAccount.label
id = index
setOnClickListener { selectedSIM(SIMAccount.handle, SIMAccount.label) }
}
radioGroup!!.addView(radioButton, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
}
dialog = AlertDialog.Builder(activity)
.create().apply {
activity.setupDialogStuff(view, this)
}
}
private fun selectedSIM(handle: PhoneAccountHandle, label: String) {
if (view.select_sim_remember.isChecked) {
activity.config.saveCustomSIM(phoneNumber, label)
}
callback(handle)
dialog?.dismiss()
}
}

View File

@ -1,31 +1,33 @@
package com.simplemobiletools.contacts.pro.extensions package com.simplemobiletools.contacts.pro.extensions
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.telecom.PhoneAccount import android.provider.ContactsContract.CommonDataKinds.BaseTypes
import android.telecom.PhoneAccountHandle import android.provider.ContactsContract.CommonDataKinds.Phone
import android.telecom.TelecomManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_PHONE_STATE import com.simplemobiletools.commons.helpers.PERMISSION_CALL_PHONE
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.BuildConfig import com.simplemobiletools.contacts.pro.BuildConfig
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog import com.simplemobiletools.contacts.pro.dialogs.CallConfirmationDialog
import com.simplemobiletools.contacts.pro.dialogs.SelectSIMDialog
import com.simplemobiletools.contacts.pro.helpers.* import com.simplemobiletools.contacts.pro.helpers.*
import com.simplemobiletools.contacts.pro.models.Contact import com.simplemobiletools.contacts.pro.models.Contact
fun SimpleActivity.startCallIntent(recipient: String) { fun SimpleActivity.startCallIntent(recipient: String) {
if (isDefaultDialer()) { handlePermission(PERMISSION_CALL_PHONE) {
getHandleToUse(null, recipient) { handle -> val action = if (it) Intent.ACTION_CALL else Intent.ACTION_DIAL
launchCallIntent(recipient, handle) Intent(action).apply {
data = Uri.fromParts("tel", recipient, null)
if (resolveActivity(packageManager) != null) {
startActivity(this)
} else {
toast(R.string.no_app_found)
}
} }
} else {
launchCallIntent(recipient, null)
} }
} }
@ -46,7 +48,7 @@ fun SimpleActivity.startCall(contact: Contact) {
} else if (numbers.size > 1) { } else if (numbers.size > 1) {
val items = ArrayList<RadioItem>() val items = ArrayList<RadioItem>()
numbers.forEachIndexed { index, phoneNumber -> numbers.forEachIndexed { index, phoneNumber ->
items.add(RadioItem(index, phoneNumber.value, phoneNumber.value)) items.add(RadioItem(index, "${phoneNumber.value} (${getPhoneNumberTypeText(phoneNumber.type, phoneNumber.label)})", phoneNumber.value))
} }
RadioGroupDialog(this, items) { RadioGroupDialog(this, items) {
@ -111,27 +113,19 @@ fun SimpleActivity.callContact(contact: Contact) {
} }
} }
// used at devices with multiple SIM cards fun SimpleActivity.getPhoneNumberTypeText(type: Int, label: String): String {
@SuppressLint("MissingPermission") return if (type == BaseTypes.TYPE_CUSTOM) {
fun SimpleActivity.getHandleToUse(intent: Intent?, phoneNumber: String, callback: (PhoneAccountHandle) -> Unit) { label
handlePermission(PERMISSION_READ_PHONE_STATE) { } else {
if (it) { getString(when (type) {
val defaultHandle = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL) Phone.TYPE_MOBILE -> R.string.mobile
when { Phone.TYPE_HOME -> R.string.home
intent?.hasExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE) == true -> callback(intent.getParcelableExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE)!!) Phone.TYPE_WORK -> R.string.work
config.getCustomSIM(phoneNumber)?.isNotEmpty() == true -> { Phone.TYPE_MAIN -> R.string.main_number
val storedLabel = Uri.decode(config.getCustomSIM(phoneNumber)) Phone.TYPE_FAX_WORK -> R.string.work_fax
val availableSIMs = getAvailableSIMCardLabels() Phone.TYPE_FAX_HOME -> R.string.home_fax
val firstornull = availableSIMs.firstOrNull { it.label == storedLabel }?.handle ?: availableSIMs.first().handle Phone.TYPE_PAGER -> R.string.pager
callback(firstornull) else -> R.string.other
} })
defaultHandle != null -> callback(defaultHandle)
else -> {
SelectSIMDialog(this, phoneNumber) { handle ->
callback(handle)
}
}
}
}
} }
} }

View File

@ -1,23 +1,17 @@
package com.simplemobiletools.contacts.pro.extensions package com.simplemobiletools.contacts.pro.extensions
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Context.AUDIO_SERVICE
import android.content.Intent import android.content.Intent
import android.content.pm.LauncherApps
import android.database.Cursor import android.database.Cursor
import android.media.AudioManager import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.provider.ContactsContract import android.provider.ContactsContract
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import com.simplemobiletools.commons.extensions.getIntValue import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.hasPermission import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.extensions.telecomManager
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CONTACTS
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.contacts.pro.BuildConfig import com.simplemobiletools.contacts.pro.BuildConfig
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.EditContactActivity import com.simplemobiletools.contacts.pro.activities.EditContactActivity
@ -29,7 +23,7 @@ import com.simplemobiletools.contacts.pro.interfaces.GroupsDao
import com.simplemobiletools.contacts.pro.models.Contact import com.simplemobiletools.contacts.pro.models.Contact
import com.simplemobiletools.contacts.pro.models.ContactSource import com.simplemobiletools.contacts.pro.models.ContactSource
import com.simplemobiletools.contacts.pro.models.Organization import com.simplemobiletools.contacts.pro.models.Organization
import com.simplemobiletools.contacts.pro.models.SIMAccount import com.simplemobiletools.contacts.pro.models.SocialAction
import java.io.File import java.io.File
val Context.config: Config get() = Config.newInstance(applicationContext) val Context.config: Config get() = Config.newInstance(applicationContext)
@ -38,8 +32,6 @@ val Context.contactsDB: ContactsDao get() = ContactsDatabase.getInstance(applica
val Context.groupsDB: GroupsDao get() = ContactsDatabase.getInstance(applicationContext).GroupsDao() val Context.groupsDB: GroupsDao get() = ContactsDatabase.getInstance(applicationContext).GroupsDao()
val Context.audioManager: AudioManager get() = getSystemService(AUDIO_SERVICE) as AudioManager
fun Context.getEmptyContact(): Contact { fun Context.getEmptyContact(): Contact {
val originalContactSource = if (hasContactPermissions()) config.lastUsedContactSource else SMT_PRIVATE val originalContactSource = if (hasContactPermissions()) config.lastUsedContactSource else SMT_PRIVATE
val organization = Organization("", "") val organization = Organization("", "")
@ -201,7 +193,10 @@ fun Context.getPublicContactSource(source: String, callback: (String) -> Unit) {
var newSource = source var newSource = source
for (contactSource in it) { for (contactSource in it) {
if (contactSource.name == source && contactSource.type == TELEGRAM_PACKAGE) { if (contactSource.name == source && contactSource.type == TELEGRAM_PACKAGE) {
newSource += " (${getString(R.string.telegram)})" newSource = getString(R.string.telegram)
break
} else if (contactSource.name == source && contactSource.type == VIBER_PACKAGE) {
newSource = getString(R.string.viber)
break break
} }
} }
@ -220,7 +215,10 @@ fun Context.getPublicContactSourceSync(source: String, contactSources: ArrayList
var newSource = source var newSource = source
for (contactSource in contactSources) { for (contactSource in contactSources) {
if (contactSource.name == source && contactSource.type == TELEGRAM_PACKAGE) { if (contactSource.name == source && contactSource.type == TELEGRAM_PACKAGE) {
newSource += " (${getString(R.string.telegram)})" newSource = getString(R.string.telegram)
break
} else if (contactSource.name == source && contactSource.type == VIBER_PACKAGE) {
newSource = getString(R.string.viber)
break break
} }
} }
@ -236,16 +234,16 @@ fun Context.sendSMSToContacts(contacts: ArrayList<Contact>) {
val number = it.phoneNumbers.firstOrNull { it.type == ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE } val number = it.phoneNumbers.firstOrNull { it.type == ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE }
?: it.phoneNumbers.firstOrNull() ?: it.phoneNumbers.firstOrNull()
if (number != null) { if (number != null) {
numbers.append("${number.value};") numbers.append("${Uri.encode(number.value)};")
} }
}
val uriString = "smsto:${numbers.toString().trimEnd(';')}" val uriString = "smsto:${numbers.toString().trimEnd(';')}"
Intent(Intent.ACTION_SENDTO, Uri.parse(uriString)).apply { Intent(Intent.ACTION_SENDTO, Uri.parse(uriString)).apply {
if (resolveActivity(packageManager) != null) { if (resolveActivity(packageManager) != null) {
startActivity(this) startActivity(this)
} else { } else {
toast(R.string.no_app_found) toast(R.string.no_app_found)
}
} }
} }
} }
@ -331,19 +329,69 @@ fun Context.getAllContactSources(): ArrayList<ContactSource> {
fun Context.getPrivateContactSource() = ContactSource(SMT_PRIVATE, SMT_PRIVATE, getString(R.string.phone_storage_hidden)) fun Context.getPrivateContactSource() = ContactSource(SMT_PRIVATE, SMT_PRIVATE, getString(R.string.phone_storage_hidden))
@SuppressLint("MissingPermission") fun Context.getSocialActions(id: Int): ArrayList<SocialAction> {
fun Context.getAvailableSIMCardLabels(): ArrayList<SIMAccount> { val uri = ContactsContract.Data.CONTENT_URI
val SIMAccounts = ArrayList<SIMAccount>() val projection = arrayOf(
telecomManager.callCapablePhoneAccounts.forEach { account -> ContactsContract.Data._ID,
val phoneAccount = telecomManager.getPhoneAccount(account) ContactsContract.Data.DATA3,
var label = phoneAccount.label.toString() ContactsContract.Data.MIMETYPE,
var address = phoneAccount.address.toString() ContactsContract.Data.ACCOUNT_TYPE_AND_DATA_SET
if (address.startsWith("tel:") && address.substringAfter("tel:").isNotEmpty()) { )
address = Uri.decode(address.substringAfter("tel:"))
label += " ($address)" val socialActions = ArrayList<SocialAction>()
var curActionId = 0
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ?"
val selectionArgs = arrayOf(id.toString())
queryCursor(uri, projection, selection, selectionArgs, null, true) { cursor ->
val mimetype = cursor.getStringValue(ContactsContract.Data.MIMETYPE)
val type = when (mimetype) {
// WhatsApp
"vnd.android.cursor.item/vnd.com.whatsapp.profile" -> SOCIAL_MESSAGE
"vnd.android.cursor.item/vnd.com.whatsapp.voip.call" -> SOCIAL_VOICE_CALL
"vnd.android.cursor.item/vnd.com.whatsapp.video.call" -> SOCIAL_VIDEO_CALL
// Viber
"vnd.android.cursor.item/vnd.com.viber.voip.viber_number_call" -> SOCIAL_VOICE_CALL
"vnd.android.cursor.item/vnd.com.viber.voip.viber_out_call_viber" -> SOCIAL_VOICE_CALL
"vnd.android.cursor.item/vnd.com.viber.voip.viber_out_call_none_viber" -> SOCIAL_VOICE_CALL
"vnd.android.cursor.item/vnd.com.viber.voip.viber_number_message" -> SOCIAL_MESSAGE
// Signal
"vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.contact" -> SOCIAL_MESSAGE
"vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.call" -> SOCIAL_VOICE_CALL
// Telegram
"vnd.android.cursor.item/vnd.org.telegram.messenger.android.call" -> SOCIAL_VOICE_CALL
"vnd.android.cursor.item/vnd.org.telegram.messenger.android.call.video" -> SOCIAL_VIDEO_CALL
"vnd.android.cursor.item/vnd.org.telegram.messenger.android.profile" -> SOCIAL_MESSAGE
else -> return@queryCursor
} }
val SIM = SIMAccount(phoneAccount.accountHandle, label)
SIMAccounts.add(SIM) val label = cursor.getStringValue(ContactsContract.Data.DATA3)
val realID = cursor.getLongValue(ContactsContract.Data._ID)
val packageName = cursor.getStringValue(ContactsContract.Data.ACCOUNT_TYPE_AND_DATA_SET)
val socialAction = SocialAction(curActionId++, type, label, mimetype, realID, packageName)
socialActions.add(socialAction)
} }
return SIMAccounts return socialActions
}
fun Context.getPackageDrawable(packageName: String): Drawable? {
var drawable: Drawable? = null
try {
// try getting the properly colored launcher icons
val launcher = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
val activityList = launcher.getActivityList(packageName, android.os.Process.myUserHandle())[0]
drawable = activityList.getBadgedIcon(0)
} catch (ignored: Exception) {
}
if (drawable == null) {
try {
drawable = packageManager.getApplicationIcon(packageName)
} catch (ignored: Exception) {
}
}
return drawable
} }

View File

@ -1,26 +0,0 @@
package com.simplemobiletools.contacts.pro.extensions
import android.view.KeyEvent
import android.widget.EditText
fun EditText.addCharacter(char: Char) {
dispatchKeyEvent(getKeyEvent(getCharKeyCode(char)))
}
fun EditText.getKeyEvent(keyCode: Int) = KeyEvent(0, 0, KeyEvent.ACTION_DOWN, keyCode, 0)
private fun getCharKeyCode(char: Char) = when (char) {
'0' -> KeyEvent.KEYCODE_0
'1' -> KeyEvent.KEYCODE_1
'2' -> KeyEvent.KEYCODE_2
'3' -> KeyEvent.KEYCODE_3
'4' -> KeyEvent.KEYCODE_4
'5' -> KeyEvent.KEYCODE_5
'6' -> KeyEvent.KEYCODE_6
'7' -> KeyEvent.KEYCODE_7
'8' -> KeyEvent.KEYCODE_8
'9' -> KeyEvent.KEYCODE_9
'*' -> KeyEvent.KEYCODE_STAR
'+' -> KeyEvent.KEYCODE_PLUS
else -> KeyEvent.KEYCODE_POUND
}

View File

@ -1,34 +0,0 @@
package com.simplemobiletools.contacts.pro.extensions
import android.widget.TextView
import com.simplemobiletools.commons.helpers.getDateFormats
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*
fun String.getDateTimeFromDateString(viewToUpdate: TextView? = null): DateTime {
val dateFormats = getDateFormats()
var date = DateTime()
for (format in dateFormats) {
try {
date = DateTime.parse(this, DateTimeFormat.forPattern(format))
val formatter = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault())
var localPattern = (formatter as SimpleDateFormat).toLocalizedPattern()
val hasYear = format.contains("y")
if (!hasYear) {
localPattern = localPattern.replace("y", "").trim()
date = date.withYear(DateTime().year)
}
val formattedString = date.toString(localPattern)
viewToUpdate?.text = formattedString
break
} catch (ignored: Exception) {
}
}
return date
}

View File

@ -2,11 +2,11 @@ package com.simplemobiletools.contacts.pro.fragments
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import com.simplemobiletools.commons.helpers.TAB_FAVORITES
import com.simplemobiletools.contacts.pro.activities.MainActivity import com.simplemobiletools.contacts.pro.activities.MainActivity
import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.dialogs.SelectContactsDialog import com.simplemobiletools.contacts.pro.dialogs.SelectContactsDialog
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
import com.simplemobiletools.contacts.pro.helpers.FAVORITES_TAB_MASK
class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
override fun fabClicked() { override fun fabClicked() {
@ -25,7 +25,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
removeFavorites(removedContacts) removeFavorites(removedContacts)
} }
(activity as? MainActivity)?.refreshContacts(FAVORITES_TAB_MASK) (activity as? MainActivity)?.refreshContacts(TAB_FAVORITES)
} }
} }
} }

View File

@ -2,10 +2,10 @@ package com.simplemobiletools.contacts.pro.fragments
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import com.simplemobiletools.commons.helpers.TAB_GROUPS
import com.simplemobiletools.contacts.pro.activities.MainActivity import com.simplemobiletools.contacts.pro.activities.MainActivity
import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.activities.SimpleActivity
import com.simplemobiletools.contacts.pro.dialogs.CreateNewGroupDialog import com.simplemobiletools.contacts.pro.dialogs.CreateNewGroupDialog
import com.simplemobiletools.contacts.pro.helpers.GROUPS_TAB_MASK
class GroupsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) { class GroupsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
override fun fabClicked() { override fun fabClicked() {
@ -19,7 +19,7 @@ class GroupsFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
private fun showNewGroupsDialog() { private fun showNewGroupsDialog() {
CreateNewGroupDialog(activity as SimpleActivity) { CreateNewGroupDialog(activity as SimpleActivity) {
(activity as? MainActivity)?.refreshContacts(GROUPS_TAB_MASK) (activity as? MainActivity)?.refreshContacts(TAB_GROUPS)
} }
} }
} }

View File

@ -8,9 +8,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
import com.reddit.indicatorfastscroll.FastScrollItemIndicator import com.reddit.indicatorfastscroll.FastScrollItemIndicator
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.SORT_BY_FIRST_NAME import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.SORT_BY_MIDDLE_NAME
import com.simplemobiletools.commons.helpers.SORT_BY_SURNAME
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.activities.GroupContactsActivity import com.simplemobiletools.contacts.pro.activities.GroupContactsActivity
import com.simplemobiletools.contacts.pro.activities.InsertOrEditContactActivity import com.simplemobiletools.contacts.pro.activities.InsertOrEditContactActivity
@ -81,7 +79,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
fun textColorChanged(color: Int) { fun textColorChanged(color: Int) {
when { when {
this is GroupsFragment -> (fragment_list.adapter as GroupsAdapter).updateTextColor(color) this is GroupsFragment -> (fragment_list.adapter as GroupsAdapter).updateTextColor(color)
else -> (fragment_list.adapter as ContactsAdapter).apply { else -> (fragment_list.adapter as? ContactsAdapter)?.apply {
updateTextColor(color) updateTextColor(color)
} }
} }
@ -94,29 +92,21 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
fragment_fastscroller?.updateBubblePrimaryColor() fragment_fastscroller?.updateBubblePrimaryColor()
letter_fastscroller_thumb?.thumbColor = config.primaryColor.getColorStateList() letter_fastscroller_thumb?.thumbColor = config.primaryColor.getColorStateList()
letter_fastscroller_thumb?.textColor = config.primaryColor.getContrastColor() letter_fastscroller_thumb?.textColor = config.primaryColor.getContrastColor()
(fragment_list.adapter as? ContactsAdapter)?.apply {
adjustedPrimaryColor = context.getAdjustedPrimaryColor()
}
(fragment_list.adapter as? GroupsAdapter)?.apply {
adjustedPrimaryColor = context.getAdjustedPrimaryColor()
}
} }
fun startNameWithSurnameChanged(startNameWithSurname: Boolean) { fun startNameWithSurnameChanged(startNameWithSurname: Boolean) {
if (this !is GroupsFragment) { if (this !is GroupsFragment) {
(fragment_list.adapter as? ContactsAdapter)?.apply { (fragment_list.adapter as? ContactsAdapter)?.apply {
config.sorting = if (startNameWithSurname) SORT_BY_SURNAME else SORT_BY_FIRST_NAME config.sorting = if (startNameWithSurname) SORT_BY_SURNAME else SORT_BY_FIRST_NAME
(this@MyViewPagerFragment.activity!! as MainActivity).refreshContacts(CONTACTS_TAB_MASK or FAVORITES_TAB_MASK) (this@MyViewPagerFragment.activity!! as MainActivity).refreshContacts(TAB_CONTACTS or TAB_FAVORITES)
} }
} }
} }
fun refreshContacts(contacts: ArrayList<Contact>) { fun refreshContacts(contacts: ArrayList<Contact>) {
if ((config.showTabs and CONTACTS_TAB_MASK == 0 && this is ContactsFragment && activity !is InsertOrEditContactActivity) || if ((config.showTabs and TAB_CONTACTS == 0 && this is ContactsFragment && activity !is InsertOrEditContactActivity) ||
(config.showTabs and FAVORITES_TAB_MASK == 0 && this is FavoritesFragment) || (config.showTabs and TAB_FAVORITES == 0 && this is FavoritesFragment) ||
(config.showTabs and GROUPS_TAB_MASK == 0 && this is GroupsFragment)) { (config.showTabs and TAB_GROUPS == 0 && this is GroupsFragment)) {
return return
} }
@ -172,7 +162,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
} }
} }
storedGroups = storedGroups.asSequence().sortedWith(compareBy { it.title.normalizeString() }).toMutableList() as ArrayList<Group> storedGroups = storedGroups.asSequence().sortedWith(compareBy { it.title.toLowerCase().normalizeString() }).toMutableList() as ArrayList<Group>
fragment_placeholder_2.beVisibleIf(storedGroups.isEmpty()) fragment_placeholder_2.beVisibleIf(storedGroups.isEmpty())
fragment_placeholder.beVisibleIf(storedGroups.isEmpty()) fragment_placeholder.beVisibleIf(storedGroups.isEmpty())
@ -296,11 +286,13 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
val adapter = fragment_list.adapter val adapter = fragment_list.adapter
if (adapter is ContactsAdapter) { if (adapter is ContactsAdapter) {
val shouldNormalize = text.normalizeString() == text val shouldNormalize = text.normalizeString() == text
val convertLetters = config.showDialpadLetters
val filtered = contactsIgnoringSearch.filter { val filtered = contactsIgnoringSearch.filter {
getProperText(it.getNameToDisplay(), shouldNormalize).contains(text, true) || getProperText(it.getNameToDisplay(), shouldNormalize).contains(text, true) ||
getProperText(it.nickname, shouldNormalize).contains(text, true) || getProperText(it.nickname, shouldNormalize).contains(text, true) ||
it.doesContainPhoneNumber(text, convertLetters) || it.phoneNumbers.any {
text.normalizePhoneNumber().isNotEmpty() && (it.normalizedNumber
?: it.value).contains(text.normalizePhoneNumber(), true)
} ||
it.emails.any { it.value.contains(text, true) } || it.emails.any { it.value.contains(text, true) } ||
it.addresses.any { getProperText(it.value, shouldNormalize).contains(text, true) } || it.addresses.any { getProperText(it.value, shouldNormalize).contains(text, true) } ||
it.IMs.any { it.value.contains(text, true) } || it.IMs.any { it.value.contains(text, true) } ||
@ -359,7 +351,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
private fun updateViewStuff() { private fun updateViewStuff() {
context.updateTextColors(fragment_wrapper.parent as ViewGroup) context.updateTextColors(fragment_wrapper.parent as ViewGroup)
fragment_fastscroller?.updateBubbleColors() fragment_fastscroller?.updateBubbleColors()
fragment_fastscroller?.allowBubbleDisplay = true
fragment_placeholder_2?.setTextColor(context.getAdjustedPrimaryColor()) fragment_placeholder_2?.setTextColor(context.getAdjustedPrimaryColor())
letter_fastscroller_thumb?.fontSize = context.getTextSize() letter_fastscroller_thumb?.fontSize = context.getTextSize()
} }

View File

@ -1,86 +0,0 @@
package com.simplemobiletools.contacts.pro.helpers
import android.annotation.SuppressLint
import android.content.Context
import android.net.Uri
import android.telecom.Call
import android.telecom.VideoProfile
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.contacts.pro.extensions.contactsDB
import com.simplemobiletools.contacts.pro.models.CallContact
// inspired by https://github.com/Chooloo/call_manage
@SuppressLint("NewApi")
class CallManager {
companion object {
var call: Call? = null
fun accept() {
call?.answer(VideoProfile.STATE_AUDIO_ONLY)
}
fun reject() {
if (call != null) {
if (call!!.state == Call.STATE_RINGING) {
call!!.reject(false, null)
} else {
call!!.disconnect()
}
}
}
fun registerCallback(callback: Call.Callback) {
if (call != null) {
call!!.registerCallback(callback)
}
}
fun unregisterCallback(callback: Call.Callback) {
call?.unregisterCallback(callback)
}
fun getState() = if (call == null) {
Call.STATE_DISCONNECTED
} else {
call!!.state
}
fun keypad(c: Char) {
call?.playDtmfTone(c)
call?.stopDtmfTone()
}
fun getCallContact(context: Context, callback: (CallContact?) -> Unit) {
val callContact = CallContact("", "", "")
if (call == null || call!!.details == null || call!!.details!!.handle == null) {
callback(callContact)
return
}
val uri = Uri.decode(call!!.details.handle.toString())
if (uri.startsWith("tel:")) {
val number = uri.substringAfter("tel:")
callContact.number = number
callContact.name = SimpleContactsHelper(context).getNameFromPhoneNumber(number)
callContact.photoUri = SimpleContactsHelper(context).getPhotoUriFromPhoneNumber(number)
if (callContact.name == callContact.number) {
ensureBackgroundThread {
val localContact = context.contactsDB.getContactWithNumber("%$number%")
if (localContact != null) {
val storedGroups = ContactsHelper(context).getStoredGroupsSync()
val newContact = LocalContactsHelper(context).convertLocalContactToContact(localContact, storedGroups)
callContact.name = newContact!!.getNameToDisplay()
callContact.photoUri = newContact.photoUri
}
callback(callContact)
}
} else {
callback(callContact)
}
}
}
}
}

View File

@ -1,11 +1,7 @@
package com.simplemobiletools.contacts.pro.helpers package com.simplemobiletools.contacts.pro.helpers
import android.content.Context import android.content.Context
import android.net.Uri
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.simplemobiletools.commons.helpers.BaseConfig import com.simplemobiletools.commons.helpers.BaseConfig
import com.simplemobiletools.contacts.pro.models.SpeedDial
class Config(context: Context) : BaseConfig(context) { class Config(context: Context) : BaseConfig(context) {
companion object { companion object {
@ -28,10 +24,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(SHOW_ONLY_CONTACTS_WITH_NUMBERS, false) get() = prefs.getBoolean(SHOW_ONLY_CONTACTS_WITH_NUMBERS, false)
set(showOnlyContactsWithNumbers) = prefs.edit().putBoolean(SHOW_ONLY_CONTACTS_WITH_NUMBERS, showOnlyContactsWithNumbers).apply() set(showOnlyContactsWithNumbers) = prefs.edit().putBoolean(SHOW_ONLY_CONTACTS_WITH_NUMBERS, showOnlyContactsWithNumbers).apply()
var startNameWithSurname: Boolean
get() = prefs.getBoolean(START_NAME_WITH_SURNAME, false)
set(startNameWithSurname) = prefs.edit().putBoolean(START_NAME_WITH_SURNAME, startNameWithSurname).apply()
var lastUsedContactSource: String var lastUsedContactSource: String
get() = prefs.getString(LAST_USED_CONTACT_SOURCE, "")!! get() = prefs.getString(LAST_USED_CONTACT_SOURCE, "")!!
set(lastUsedContactSource) = prefs.edit().putString(LAST_USED_CONTACT_SOURCE, lastUsedContactSource).apply() set(lastUsedContactSource) = prefs.edit().putString(LAST_USED_CONTACT_SOURCE, lastUsedContactSource).apply()
@ -57,10 +49,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(SHOW_DIALPAD_BUTTON, true) get() = prefs.getBoolean(SHOW_DIALPAD_BUTTON, true)
set(showDialpadButton) = prefs.edit().putBoolean(SHOW_DIALPAD_BUTTON, showDialpadButton).apply() set(showDialpadButton) = prefs.edit().putBoolean(SHOW_DIALPAD_BUTTON, showDialpadButton).apply()
var showDialpadLetters: Boolean
get() = prefs.getBoolean(SHOW_DIALPAD_LETTERS, true)
set(showDialpadLetters) = prefs.edit().putBoolean(SHOW_DIALPAD_LETTERS, showDialpadLetters).apply()
var wasLocalAccountInitialized: Boolean var wasLocalAccountInitialized: Boolean
get() = prefs.getBoolean(WAS_LOCAL_ACCOUNT_INITIALIZED, false) get() = prefs.getBoolean(WAS_LOCAL_ACCOUNT_INITIALIZED, false)
set(wasLocalAccountInitialized) = prefs.edit().putBoolean(WAS_LOCAL_ACCOUNT_INITIALIZED, wasLocalAccountInitialized).apply() set(wasLocalAccountInitialized) = prefs.edit().putBoolean(WAS_LOCAL_ACCOUNT_INITIALIZED, wasLocalAccountInitialized).apply()
@ -73,23 +61,7 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getString(SPEED_DIAL, "")!! get() = prefs.getString(SPEED_DIAL, "")!!
set(speedDial) = prefs.edit().putString(SPEED_DIAL, speedDial).apply() set(speedDial) = prefs.edit().putString(SPEED_DIAL, speedDial).apply()
fun saveCustomSIM(number: String, SIMlabel: String) { var showPrivateContacts: Boolean
prefs.edit().putString(REMEMBER_SIM_PREFIX + number, Uri.encode(SIMlabel)).apply() get() = prefs.getBoolean(SHOW_PRIVATE_CONTACTS, true)
} set(showPrivateContacts) = prefs.edit().putBoolean(SHOW_PRIVATE_CONTACTS, showPrivateContacts).apply()
fun getCustomSIM(number: String) = prefs.getString(REMEMBER_SIM_PREFIX + number, "")
fun getSpeedDialValues(): ArrayList<SpeedDial> {
val speedDialType = object : TypeToken<List<SpeedDial>>() {}.type
val speedDialValues = Gson().fromJson<ArrayList<SpeedDial>>(speedDial, speedDialType) ?: ArrayList(1)
for (i in 1..9) {
val speedDial = SpeedDial(i, "", "")
if (speedDialValues.firstOrNull { it.id == i } == null) {
speedDialValues.add(speedDial)
}
}
return speedDialValues
}
} }

View File

@ -2,6 +2,9 @@ package com.simplemobiletools.contacts.pro.helpers
import android.provider.ContactsContract.CommonDataKinds import android.provider.ContactsContract.CommonDataKinds
import com.simplemobiletools.commons.extensions.normalizeString import com.simplemobiletools.commons.extensions.normalizeString
import com.simplemobiletools.commons.helpers.TAB_CONTACTS
import com.simplemobiletools.commons.helpers.TAB_FAVORITES
import com.simplemobiletools.commons.helpers.TAB_GROUPS
import com.simplemobiletools.contacts.pro.models.LocalContact import com.simplemobiletools.contacts.pro.models.LocalContact
// shared prefs // shared prefs
@ -9,32 +12,24 @@ const val SHOW_CONTACT_THUMBNAILS = "show_contact_thumbnails"
const val SHOW_PHONE_NUMBERS = "show_phone_numbers" const val SHOW_PHONE_NUMBERS = "show_phone_numbers"
const val SHOW_ONLY_CONTACTS_WITH_NUMBERS = "show_only_contacts_with_numbers" const val SHOW_ONLY_CONTACTS_WITH_NUMBERS = "show_only_contacts_with_numbers"
const val IGNORED_CONTACT_SOURCES = "ignored_contact_sources_2" const val IGNORED_CONTACT_SOURCES = "ignored_contact_sources_2"
const val START_NAME_WITH_SURNAME = "start_name_with_surname"
const val LAST_USED_CONTACT_SOURCE = "last_used_contact_source" const val LAST_USED_CONTACT_SOURCE = "last_used_contact_source"
const val ON_CONTACT_CLICK = "on_contact_click" const val ON_CONTACT_CLICK = "on_contact_click"
const val SHOW_CONTACT_FIELDS = "show_contact_fields" const val SHOW_CONTACT_FIELDS = "show_contact_fields"
const val SHOW_TABS = "show_tabs" const val SHOW_TABS = "show_tabs"
const val SHOW_CALL_CONFIRMATION = "show_call_confirmation" const val SHOW_CALL_CONFIRMATION = "show_call_confirmation"
const val SHOW_DIALPAD_BUTTON = "show_dialpad_button" const val SHOW_DIALPAD_BUTTON = "show_dialpad_button"
const val SHOW_DIALPAD_LETTERS = "show_dialpad_letters"
const val SPEED_DIAL = "speed_dial" const val SPEED_DIAL = "speed_dial"
const val LAST_EXPORT_PATH = "last_export_path" const val LAST_EXPORT_PATH = "last_export_path"
const val WAS_LOCAL_ACCOUNT_INITIALIZED = "was_local_account_initialized" const val WAS_LOCAL_ACCOUNT_INITIALIZED = "was_local_account_initialized"
const val REMEMBER_SIM_PREFIX = "remember_sim_" const val SHOW_PRIVATE_CONTACTS = "show_private_contacts"
const val CONTACT_ID = "contact_id"
const val SMT_PRIVATE = "smt_private" // used at the contact source of local contacts hidden from other apps const val SMT_PRIVATE = "smt_private" // used at the contact source of local contacts hidden from other apps
const val IS_PRIVATE = "is_private"
const val GROUP = "group" const val GROUP = "group"
const val IS_FROM_SIMPLE_CONTACTS = "is_from_simple_contacts" const val IS_FROM_SIMPLE_CONTACTS = "is_from_simple_contacts"
const val ADD_NEW_CONTACT_NUMBER = "add_new_contact_number" const val ADD_NEW_CONTACT_NUMBER = "add_new_contact_number"
const val FIRST_CONTACT_ID = 1000000 const val FIRST_CONTACT_ID = 1000000
const val FIRST_GROUP_ID = 10000L const val FIRST_GROUP_ID = 10000L
private const val PATH = "com.simplemobiletools.contacts.action."
const val ACCEPT_CALL = PATH + "accept_call"
const val DECLINE_CALL = PATH + "decline_call"
// extras used at third party intents // extras used at third party intents
const val KEY_NAME = "name" const val KEY_NAME = "name"
const val KEY_EMAIL = "email" const val KEY_EMAIL = "email"
@ -46,14 +41,11 @@ const val LOCATION_GROUP_CONTACTS = 2
const val LOCATION_DIALPAD = 3 const val LOCATION_DIALPAD = 3
const val LOCATION_INSERT_OR_EDIT = 4 const val LOCATION_INSERT_OR_EDIT = 4
const val CONTACTS_TAB_MASK = 1 const val ALL_TABS_MASK = TAB_CONTACTS or TAB_FAVORITES or TAB_GROUPS
const val FAVORITES_TAB_MASK = 2
const val GROUPS_TAB_MASK = 8
const val ALL_TABS_MASK = CONTACTS_TAB_MASK or FAVORITES_TAB_MASK or GROUPS_TAB_MASK
val tabsList = arrayListOf(CONTACTS_TAB_MASK, val tabsList = arrayListOf(TAB_CONTACTS,
FAVORITES_TAB_MASK, TAB_FAVORITES,
GROUPS_TAB_MASK TAB_GROUPS
) )
// contact photo changes // contact photo changes
@ -114,6 +106,16 @@ const val DEFAULT_IM_TYPE = CommonDataKinds.Im.PROTOCOL_SKYPE
const val TELEGRAM_PACKAGE = "org.telegram.messenger" const val TELEGRAM_PACKAGE = "org.telegram.messenger"
const val SIGNAL_PACKAGE = "org.thoughtcrime.securesms" const val SIGNAL_PACKAGE = "org.thoughtcrime.securesms"
const val WHATSAPP_PACKAGE = "com.whatsapp" const val WHATSAPP_PACKAGE = "com.whatsapp"
const val VIBER_PACKAGE = "com.viber.voip"
const val WHATSAPP = "whatsapp"
const val SIGNAL = "signal"
const val VIBER = "viber"
const val TELEGRAM = "telegram"
const val SOCIAL_VOICE_CALL = 0
const val SOCIAL_VIDEO_CALL = 1
const val SOCIAL_MESSAGE = 2
fun getEmptyLocalContact() = LocalContact(0, "", "", "", "", "", "", null, "", ArrayList(), ArrayList(), ArrayList(), 0, ArrayList(), "", ArrayList(), "", "", ArrayList(), ArrayList()) fun getEmptyLocalContact() = LocalContact(0, "", "", "", "", "", "", null, "", ArrayList(), ArrayList(), ArrayList(), 0, ArrayList(), "", ArrayList(), "", "", ArrayList(), ArrayList())

View File

@ -117,7 +117,7 @@ class ContactsHelper(val context: Context) {
val type = cursor.getStringValue(RawContacts.ACCOUNT_TYPE) ?: "" val type = cursor.getStringValue(RawContacts.ACCOUNT_TYPE) ?: ""
var publicName = name var publicName = name
if (type == TELEGRAM_PACKAGE) { if (type == TELEGRAM_PACKAGE) {
publicName += " (${context.getString(R.string.telegram)})" publicName = context.getString(R.string.telegram)
} }
val source = ContactSource(name, type, publicName) val source = ContactSource(name, type, publicName)
@ -770,7 +770,9 @@ class ContactsHelper(val context: Context) {
if (ContentResolver.getIsSyncable(it, AUTHORITY) == 1) { if (ContentResolver.getIsSyncable(it, AUTHORITY) == 1) {
var publicName = it.name var publicName = it.name
if (it.type == TELEGRAM_PACKAGE) { if (it.type == TELEGRAM_PACKAGE) {
publicName += " (${context.getString(R.string.telegram)})" publicName = context.getString(R.string.telegram)
} else if (it.type == VIBER_PACKAGE) {
publicName = context.getString(R.string.viber)
} }
val contactSource = ContactSource(it.name, it.type, publicName) val contactSource = ContactSource(it.name, it.type, publicName)
sources.add(contactSource) sources.add(contactSource)

View File

@ -4,8 +4,10 @@ import android.content.Context
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.net.Uri import android.net.Uri
import android.provider.ContactsContract.CommonDataKinds.Event
import android.provider.MediaStore import android.provider.MediaStore
import com.simplemobiletools.commons.extensions.getChoppedList import com.simplemobiletools.commons.extensions.getChoppedList
import com.simplemobiletools.commons.models.SimpleContact
import com.simplemobiletools.contacts.pro.extensions.contactsDB import com.simplemobiletools.contacts.pro.extensions.contactsDB
import com.simplemobiletools.contacts.pro.extensions.getByteArray import com.simplemobiletools.contacts.pro.extensions.getByteArray
import com.simplemobiletools.contacts.pro.extensions.getEmptyContact import com.simplemobiletools.contacts.pro.extensions.getEmptyContact
@ -16,8 +18,8 @@ import com.simplemobiletools.contacts.pro.models.LocalContact
import com.simplemobiletools.contacts.pro.models.Organization import com.simplemobiletools.contacts.pro.models.Organization
class LocalContactsHelper(val context: Context) { class LocalContactsHelper(val context: Context) {
fun getAllContacts(): ArrayList<Contact> { fun getAllContacts(favoritesOnly: Boolean = false): ArrayList<Contact> {
val contacts = context.contactsDB.getContacts() val contacts = if (favoritesOnly) context.contactsDB.getFavoriteContacts() else context.contactsDB.getContacts()
val storedGroups = ContactsHelper(context).getStoredGroupsSync() val storedGroups = ContactsHelper(context).getStoredGroupsSync()
return contacts.map { convertLocalContactToContact(it, storedGroups) }.toMutableList() as ArrayList<Contact> return contacts.map { convertLocalContactToContact(it, storedGroups) }.toMutableList() as ArrayList<Contact>
} }
@ -104,7 +106,6 @@ class LocalContactsHelper(val context: Context) {
surname = localContact.surname surname = localContact.surname
suffix = localContact.suffix suffix = localContact.suffix
nickname = localContact.nickname nickname = localContact.nickname
photoUri = ""
phoneNumbers = localContact.phoneNumbers phoneNumbers = localContact.phoneNumbers
emails = localContact.emails emails = localContact.emails
addresses = localContact.addresses addresses = localContact.addresses
@ -152,4 +153,17 @@ class LocalContactsHelper(val context: Context) {
IMs = contact.IMs IMs = contact.IMs
} }
} }
private fun convertContactToSimpleContact(contact: Contact?): SimpleContact? {
return if (contact == null || contact.phoneNumbers.isEmpty()) {
null
} else {
val phoneNumbers = contact.phoneNumbers.map { it.value }.toMutableList() as ArrayList<String>
val birthdays = contact.events.filter { it.type == Event.TYPE_BIRTHDAY }.map { it.value }.toMutableList() as ArrayList<String>
val anniversaries = contact.events.filter { it.type == Event.TYPE_ANNIVERSARY }.map { it.value }.toMutableList() as ArrayList<String>
SimpleContact(contact.id, contact.id, contact.getNameToDisplay(), contact.photoUri, phoneNumbers, birthdays, anniversaries)
}
}
fun getPrivateSimpleContactsSync(favoritesOnly: Boolean) = getAllContacts(favoritesOnly).mapNotNull { convertContactToSimpleContact(it) }
} }

View File

@ -5,11 +5,11 @@ import android.provider.ContactsContract.CommonDataKinds
import android.provider.ContactsContract.CommonDataKinds.* import android.provider.ContactsContract.CommonDataKinds.*
import android.provider.MediaStore import android.provider.MediaStore
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getDateTimeFromDateString
import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.getByteArray import com.simplemobiletools.contacts.pro.extensions.getByteArray
import com.simplemobiletools.contacts.pro.extensions.getDateTimeFromDateString
import com.simplemobiletools.contacts.pro.helpers.VcfExporter.ExportResult.EXPORT_FAIL import com.simplemobiletools.contacts.pro.helpers.VcfExporter.ExportResult.EXPORT_FAIL
import com.simplemobiletools.contacts.pro.models.Contact import com.simplemobiletools.contacts.pro.models.Contact
import ezvcard.Ezvcard import ezvcard.Ezvcard

View File

@ -73,7 +73,9 @@ class VcfImporter(val activity: SimpleActivity) {
"" ""
} }
emails.add(Email(email, type, label)) if (email.isNotEmpty()) {
emails.add(Email(email, type, label))
}
} }
val addresses = ArrayList<Address>() val addresses = ArrayList<Address>()

View File

@ -11,6 +11,9 @@ interface ContactsDao {
@Query("SELECT * FROM contacts") @Query("SELECT * FROM contacts")
fun getContacts(): List<LocalContact> fun getContacts(): List<LocalContact>
@Query("SELECT * FROM contacts WHERE starred = 1")
fun getFavoriteContacts(): List<LocalContact>
@Query("SELECT * FROM contacts WHERE id = :id") @Query("SELECT * FROM contacts WHERE id = :id")
fun getContactWithId(id: Int): LocalContact? fun getContactWithId(id: Int): LocalContact?

View File

@ -1,5 +0,0 @@
package com.simplemobiletools.contacts.pro.interfaces
interface RemoveSpeedDialListener {
fun removeSpeedDial(ids: ArrayList<Int>)
}

View File

@ -1,4 +0,0 @@
package com.simplemobiletools.contacts.pro.models
// a simpler Contact model containing just info needed at the call screen
data class CallContact(var name: String, var photoUri: String, var number: String)

View File

@ -6,6 +6,7 @@ import com.simplemobiletools.commons.extensions.normalizePhoneNumber
import com.simplemobiletools.commons.extensions.normalizeString import com.simplemobiletools.commons.extensions.normalizeString
import com.simplemobiletools.commons.helpers.SORT_BY_FIRST_NAME import com.simplemobiletools.commons.helpers.SORT_BY_FIRST_NAME
import com.simplemobiletools.commons.helpers.SORT_BY_MIDDLE_NAME import com.simplemobiletools.commons.helpers.SORT_BY_MIDDLE_NAME
import com.simplemobiletools.commons.helpers.SORT_BY_SURNAME
import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.commons.helpers.SORT_DESCENDING
import com.simplemobiletools.contacts.pro.helpers.SMT_PRIVATE import com.simplemobiletools.contacts.pro.helpers.SMT_PRIVATE
@ -32,10 +33,14 @@ data class Contact(var id: Int, var prefix: String, var firstName: String, var m
firstString = middleName.normalizeString() firstString = middleName.normalizeString()
secondString = other.middleName.normalizeString() secondString = other.middleName.normalizeString()
} }
else -> { sorting and SORT_BY_SURNAME != 0 -> {
firstString = surname.normalizeString() firstString = surname.normalizeString()
secondString = other.surname.normalizeString() secondString = other.surname.normalizeString()
} }
else -> {
firstString = getNameToDisplay().normalizeString()
secondString = other.getNameToDisplay().normalizeString()
}
} }
if (firstString.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty()) { if (firstString.isEmpty() && firstName.isEmpty() && middleName.isEmpty() && surname.isEmpty()) {
@ -88,12 +93,9 @@ data class Contact(var id: Int, var prefix: String, var firstName: String, var m
} }
fun getNameToDisplay(): String { fun getNameToDisplay(): String {
var firstPart = if (startWithSurname) surname else firstName val firstMiddle = "$firstName $middleName".trim()
if (middleName.isNotEmpty()) { val firstPart = if (startWithSurname) surname else firstMiddle
firstPart += " $middleName" val lastPart = if (startWithSurname) firstMiddle else surname
}
val lastPart = if (startWithSurname) firstName else surname
val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val suffixComma = if (suffix.isEmpty()) "" else ", $suffix"
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim() val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
return if (fullName.isEmpty()) { return if (fullName.isEmpty()) {

View File

@ -1,5 +0,0 @@
package com.simplemobiletools.contacts.pro.models
import android.telecom.PhoneAccountHandle
data class SIMAccount(val handle: PhoneAccountHandle, val label: String)

View File

@ -0,0 +1,3 @@
package com.simplemobiletools.contacts.pro.models
data class SocialAction(var actionId: Int, var type: Int, var label: String, var mimetype: String, val dataId: Long, val packageName: String)

View File

@ -1,5 +0,0 @@
package com.simplemobiletools.contacts.pro.models
data class SpeedDial(val id: Int, var number: String, var displayName: String) {
fun isValid() = number.trim().isNotEmpty()
}

View File

@ -1,17 +0,0 @@
package com.simplemobiletools.contacts.pro.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.simplemobiletools.contacts.pro.helpers.ACCEPT_CALL
import com.simplemobiletools.contacts.pro.helpers.CallManager
import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL
class CallActionReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
ACCEPT_CALL -> CallManager.accept()
DECLINE_CALL -> CallManager.reject()
}
}
}

View File

@ -1,22 +0,0 @@
package com.simplemobiletools.contacts.pro.services
import android.content.Intent
import android.telecom.Call
import android.telecom.InCallService
import com.simplemobiletools.contacts.pro.activities.CallActivity
import com.simplemobiletools.contacts.pro.helpers.CallManager
class CallService : InCallService() {
override fun onCallAdded(call: Call) {
super.onCallAdded(call)
val intent = Intent(this, CallActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
CallManager.call = call
}
override fun onCallRemoved(call: Call) {
super.onCallRemoved(call)
CallManager.call = null
}
}

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.9,0.89 1.59,0.89h15c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM19,15.59L17.59,17 14,13.41 10.41,17 9,15.59 12.59,12 9,8.41 10.41,7 14,10.59 17.59,7 19,8.41 15.41,12 19,15.59z"/>
</vector>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_foreground">
<item android:id="@+id/shortcut_dialpad_background">
<shape android:shape="oval">
<solid android:color="@color/md_green_700" />
</shape>
</item>
<item
android:bottom="@dimen/medium_margin"
android:drawable="@drawable/ic_phone_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin" />
</ripple>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_foreground">
<item android:id="@+id/shortcut_dialpad_background">
<shape android:shape="oval">
<solid android:color="@color/md_red_700" />
</shape>
</item>
<item
android:bottom="@dimen/medium_margin"
android:drawable="@drawable/ic_phone_down_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin" />
</ripple>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,19c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,1c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,1c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M19,11C19,11 19.0088,9.8569 18.1571,9.8714 17.362,9.885 17.3,11 17.3,11c0,0.74 -0.16,1.43 -0.43,2.05l1.23,1.23C18.66,13.3 19,12.19 19,11ZM14.98,11.17C14.98,11.11 15,11.06 15,11L15,5C15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5L9,5.18ZM4.27,3 L3,4.27l6.01,6.01 0,0.72c0,1.66 1.33,3 2.99,3 0.22,0 0.44,-0.03 0.65,-0.08l1.66,1.66C13.6,15.91 12.81,16.1 12,16.1 9.24,16.1 6.7,14 6.7,11 6.7,11 6.6686,9.9807 5.8435,9.992 5.0185,10.0033 5,11 5,11c0,3.41 2.72,6.23 6,6.72L11,21c0,0 -0.0013,1.036 1.0127,1.0169C12.9886,21.9987 13,21 13,21l0,-3.28c0.91,-0.13 1.77,-0.45 2.54,-0.9L19.73,21 21,19.73Z" />
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_red_700"
android:pathData="M23.4267,12.2343C20.4492,9.413 16.4272,7.6753 11.9951,7.6753c-4.4321,0 -8.4541,1.7377 -11.4316,4.559 -0.1757,0.1757 -0.2831,0.4198 -0.2831,0.6931 0,0.2733 0.1074,0.5174 0.2831,0.6931l2.421,2.421c0.1757,0.1757 0.4198,0.2831 0.6931,0.2831 0.2636,0 0.5076,-0.1074 0.6834,-0.2733 0.7712,-0.7224 1.6498,-1.3277 2.5968,-1.806 0.3222,-0.1562 0.5467,-0.4881 0.5467,-0.8786l0,-3.0263C8.92,9.8718 10.4332,9.6278 11.9951,9.6278c1.562,0 3.0751,0.2441 4.4906,0.7029l0,3.0263c0,0.3807 0.2245,0.7224 0.5467,0.8786 0.9567,0.4783 1.8255,1.0934 2.6065,1.806 0.1757,0.1757 0.4198,0.2733 0.6834,0.2733 0.2733,0 0.5174,-0.1074 0.6931,-0.2831l2.421,-2.421c0.1757,-0.1757 0.2831,-0.4198 0.2831,-0.6931 0,-0.2733 -0.1171,-0.5076 -0.2929,-0.6834z" />
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M23.4267,12.2343C20.4492,9.413 16.4272,7.6753 11.9951,7.6753c-4.4321,0 -8.4541,1.7377 -11.4316,4.559 -0.1757,0.1757 -0.2831,0.4198 -0.2831,0.6931 0,0.2733 0.1074,0.5174 0.2831,0.6931l2.421,2.421c0.1757,0.1757 0.4198,0.2831 0.6931,0.2831 0.2636,0 0.5076,-0.1074 0.6834,-0.2733 0.7712,-0.7224 1.6498,-1.3277 2.5968,-1.806 0.3222,-0.1562 0.5467,-0.4881 0.5467,-0.8786l0,-3.0263C8.92,9.8718 10.4332,9.6278 11.9951,9.6278c1.562,0 3.0751,0.2441 4.4906,0.7029l0,3.0263c0,0.3807 0.2245,0.7224 0.5467,0.8786 0.9567,0.4783 1.8255,1.0934 2.6065,1.806 0.1757,0.1757 0.4198,0.2733 0.6834,0.2733 0.2733,0 0.5174,-0.1074 0.6931,-0.2831l2.421,-2.421c0.1757,-0.1757 0.2831,-0.4198 0.2831,-0.6931 0,-0.2733 -0.1171,-0.5076 -0.2929,-0.6834z" />
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_green_700"
android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z" />
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v2.21l2.45,2.45c0.03,-0.2 0.05,-0.41 0.05,-0.63zM19,12c0,0.94 -0.2,1.82 -0.54,2.64l1.51,1.51C20.63,14.91 21,13.5 21,12c0,-4.28 -2.99,-7.86 -7,-8.77v2.06c2.89,0.86 5,3.54 5,6.71zM4.27,3L3,4.27 7.73,9L3,9v6h4l5,5v-6.73l4.25,4.25c-0.67,0.52 -1.42,0.93 -2.25,1.18v2.06c1.38,-0.31 2.63,-0.95 3.69,-1.81L19.73,21 21,19.73l-9,-9L4.27,3zM12,4L9.91,6.09 12,8.18L12,4z" />
</vector>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z" />
</vector>

View File

@ -1,6 +0,0 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/md_grey">
<item
android:id="@android:id/mask"
android:drawable="@android:color/white" />
</ripple>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shortcut_dialpad_background">
<shape android:shape="oval">
<solid android:color="@color/color_primary"/>
</shape>
</item>
<item
android:bottom="@dimen/medium_margin"
android:drawable="@drawable/ic_dialpad_vector"
android:left="@dimen/medium_margin"
android:right="@dimen/medium_margin"
android:top="@dimen/medium_margin"/>
</layer-list>

View File

@ -1,202 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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/call_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/caller_avatar"
android:layout_width="@dimen/incoming_call_button_size"
android:layout_height="@dimen/incoming_call_button_size"
android:contentDescription="@string/accept"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.2"
tools:src="@drawable/ic_call_accept" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/caller_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_margin"
android:textSize="@dimen/caller_name_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/caller_avatar"
tools:text="Caller name" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/call_status_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_margin"
android:alpha="0.8"
android:textSize="@dimen/call_status_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/caller_name_label"
tools:text="Is Calling" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ongoing_call_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/call_toggle_microphone"
android:layout_width="@dimen/dialpad_button_size"
android:layout_height="@dimen/dialpad_button_size"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_microphone_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.15"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75" />
<ImageView
android:id="@+id/call_toggle_speaker"
android:layout_width="@dimen/dialpad_button_size"
android:layout_height="@dimen/dialpad_button_size"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_speaker_off_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75" />
<ImageView
android:id="@+id/call_dialpad"
android:layout_width="@dimen/dialpad_button_size"
android:layout_height="@dimen/dialpad_button_size"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_dialpad_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.85"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75" />
<ImageView
android:id="@+id/call_end"
android:layout_width="@dimen/dialpad_button_size"
android:layout_height="@dimen/dialpad_button_size"
android:contentDescription="@string/decline"
android:src="@drawable/ic_call_decline"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.9" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/incoming_call_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/call_decline"
android:layout_width="@dimen/incoming_call_button_size"
android:layout_height="@dimen/incoming_call_button_size"
android:contentDescription="@string/decline"
android:src="@drawable/ic_call_decline"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.15"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.85" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/call_decline_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_margin"
android:text="@string/decline"
android:textSize="@dimen/big_text_size"
app:layout_constraintEnd_toEndOf="@+id/call_decline"
app:layout_constraintStart_toStartOf="@+id/call_decline"
app:layout_constraintTop_toBottomOf="@+id/call_decline" />
<ImageView
android:id="@+id/call_accept"
android:layout_width="@dimen/incoming_call_button_size"
android:layout_height="@dimen/incoming_call_button_size"
android:contentDescription="@string/accept"
android:src="@drawable/ic_call_accept"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.85"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.85" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/call_accept_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_margin"
android:text="@string/accept"
android:textSize="@dimen/big_text_size"
app:layout_constraintEnd_toEndOf="@+id/call_accept"
app:layout_constraintStart_toStartOf="@+id/call_accept"
app:layout_constraintTop_toBottomOf="@+id/call_accept" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="@+id/dialpad_wrapper"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/activity_margin"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/call_status_label">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/dialpad_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/dialpad_include"
android:layout_marginStart="@dimen/dialpad_button_size"
android:layout_marginEnd="@dimen/medium_margin"
android:layout_toStartOf="@+id/dialpad_close"
android:gravity="center"
android:inputType="phone"
android:textCursorDrawable="@null"
android:textSize="@dimen/dialpad_text_size" />
<ImageView
android:id="@+id/dialpad_close"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:layout_alignTop="@+id/dialpad_input"
android:layout_alignBottom="@+id/dialpad_input"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/activity_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_cross_vector" />
<include
android:id="@+id/dialpad_include"
layout="@layout/dialpad" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/dialpad_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:focusableInTouchMode="true">
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/dialpad_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/dialpad_input"
app:layout_constraintTop_toTopOf="parent" />
<com.simplemobiletools.commons.views.FastScroller
android:id="@+id/dialpad_fastscroller"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignParentEnd="true"
android:paddingStart="@dimen/normal_margin"
app:layout_constraintBottom_toBottomOf="@+id/dialpad_list"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/dialpad_list">
<include layout="@layout/fastscroller_handle_vertical" />
</com.simplemobiletools.commons.views.FastScroller>
<TextView
android:id="@+id/dialpad_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/divider"
app:layout_constraintBottom_toTopOf="@+id/dialpad_input" />
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/dialpad_input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:gravity="center"
android:inputType="phone"
android:textCursorDrawable="@null"
android:textSize="@dimen/dialpad_text_size"
app:layout_constraintBottom_toTopOf="@+id/dialpad_wrapper"
app:layout_constraintEnd_toStartOf="@+id/dialpad_clear_char"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/dialpad_clear_char"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginEnd="@dimen/activity_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:src="@drawable/ic_backspace_vector"
app:layout_constraintBottom_toBottomOf="@+id/dialpad_input"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/dialpad_input" />
<include
android:id="@+id/dialpad_wrapper"
layout="@layout/dialpad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/dialpad_call_button" />
<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_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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/manage_speed_dial_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/manage_speed_dial_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="HardcodedText">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/manage_speed_dial_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/normal_margin"
android:text="@string/speed_dial_label"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/speed_dial_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
</LinearLayout>
</ScrollView>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/settings_scrollview" android:id="@+id/settings_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -25,11 +24,11 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_customize_colors" android:id="@+id/settings_customize_colors"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/customize_colors"/> android:text="@string/customize_colors" />
</RelativeLayout> </RelativeLayout>
@ -52,7 +51,7 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/use_english_language" android:text="@string/use_english_language"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -69,11 +68,11 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_contact_fields" android:id="@+id/settings_manage_contact_fields"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/manage_shown_contact_fields"/> android:text="@string/manage_shown_contact_fields" />
</RelativeLayout> </RelativeLayout>
@ -90,53 +89,43 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_tabs" android:id="@+id/settings_manage_tabs"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/manage_shown_tabs"/> android:text="@string/manage_shown_tabs" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_manage_blocked_numbers_holder" android:id="@+id/settings_default_tab_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin" android:paddingLeft="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin" android:paddingRight="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_blocked_numbers" android:id="@+id/settings_default_tab_label"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin" android:layout_toStartOf="@+id/settings_default_tab"
android:text="@string/manage_blocked_numbers"/> android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
</RelativeLayout> android:text="@string/default_tab_to_open" />
<RelativeLayout
android:id="@+id/settings_manage_speed_dial_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_speed_dial" android:id="@+id/settings_default_tab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_alignParentEnd="true"
android:paddingStart="@dimen/medium_margin" android:layout_marginEnd="@dimen/medium_margin"
android:text="@string/manage_speed_dial"/> android:background="@null"
android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@ -159,7 +148,7 @@
android:layout_toStartOf="@+id/settings_font_size" android:layout_toStartOf="@+id/settings_font_size"
android:paddingLeft="@dimen/medium_margin" android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingRight="@dimen/medium_margin"
android:text="@string/font_size"/> android:text="@string/font_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_font_size" android:id="@+id/settings_font_size"
@ -168,7 +157,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/medium_margin" android:layout_marginEnd="@dimen/medium_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
@ -191,7 +180,7 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_contact_thumbnails" android:text="@string/show_contact_thumbnails"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -214,7 +203,7 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_phone_numbers" android:text="@string/show_phone_numbers"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -237,7 +226,7 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_only_contacts_with_numbers" android:text="@string/show_only_contacts_with_numbers"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -260,7 +249,7 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/start_name_with_surname" android:text="@string/start_name_with_surname"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -283,7 +272,7 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_call_confirmation_dialog" android:text="@string/show_call_confirmation_dialog"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -306,12 +295,12 @@
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_dialpad_button" android:text="@string/show_dialpad_button"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_show_dialpad_letters_holder" android:id="@+id/settings_show_private_contacts_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
@ -322,14 +311,14 @@
android:paddingBottom="@dimen/activity_margin"> android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat <com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_show_dialpad_letters" android:id="@+id/settings_show_private_contacts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:text="@string/show_dialpad_letters" android:text="@string/show_private_contacts"
app:switchPadding="@dimen/medium_margin"/> app:switchPadding="@dimen/medium_margin" />
</RelativeLayout> </RelativeLayout>
@ -352,7 +341,7 @@
android:layout_toStartOf="@+id/settings_on_contact_click" android:layout_toStartOf="@+id/settings_on_contact_click"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/on_contact_click"/> android:text="@string/on_contact_click" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_on_contact_click" android:id="@+id/settings_on_contact_click"
@ -361,7 +350,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@null" android:background="@null"
android:clickable="false"/> android:clickable="false" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout 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/contact_wrapper" android:id="@+id/contact_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -8,32 +10,36 @@
android:id="@+id/contact_scrollview" android:id="@+id/contact_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scrollbars="none"
android:visibility="gone"> android:visibility="gone">
<RelativeLayout <RelativeLayout
android:id="@+id/contact_holder" android:id="@+id/contact_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:paddingLeft="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingBottom="@dimen/medium_margin">
<ImageView <ImageView
android:id="@+id/contact_photo" android:id="@+id/contact_photo"
android:layout_width="@dimen/contact_photo_size" android:layout_width="match_parent"
android:layout_height="@dimen/contact_photo_size" android:layout_height="@dimen/top_contact_image_height"
android:layout_marginBottom="@dimen/normal_margin" /> android:layout_marginBottom="@dimen/normal_margin"
tools:src="@drawable/ic_person_vector" />
<ImageView
android:id="@+id/contact_photo_bottom_shadow"
android:layout_width="match_parent"
android:layout_height="@dimen/top_shadow_height"
android:layout_alignBottom="@+id/contact_photo"
android:background="@drawable/gradient_background"
android:contentDescription="@null" />
<ImageView <ImageView
android:id="@+id/contact_toggle_favorite" android:id="@+id/contact_toggle_favorite"
android:layout_width="@dimen/contact_actions_size" android:layout_width="@dimen/contact_actions_size"
android:layout_height="@dimen/contact_actions_size" android:layout_height="@dimen/contact_actions_size"
android:layout_alignTop="@+id/contact_photo" android:layout_alignStart="@+id/contact_photo"
android:layout_alignBottom="@id/contact_photo" android:layout_alignBottom="@id/contact_photo"
android:layout_marginStart="@dimen/medium_margin" android:layout_margin="@dimen/medium_margin"
android:layout_toEndOf="@+id/contact_photo"
android:adjustViewBounds="true"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/tiny_margin" android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_star_off_vector" android:src="@drawable/ic_star_off_vector"
@ -41,11 +47,13 @@
<LinearLayout <LinearLayout
android:id="@+id/contact_actions_holder" android:id="@+id/contact_actions_holder"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_photo" android:layout_alignEnd="@+id/contact_photo"
android:layout_alignBottom="@id/contact_photo" android:layout_alignBottom="@id/contact_photo"
android:gravity="center_vertical|end"> android:gravity="bottom|end"
android:paddingEnd="@dimen/medium_margin"
android:paddingBottom="@dimen/medium_margin">
<ImageView <ImageView
android:id="@+id/contact_send_email" android:id="@+id/contact_send_email"
@ -53,8 +61,8 @@
android:layout_height="@dimen/contact_actions_size" android:layout_height="@dimen/contact_actions_size"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingRight="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_email_vector" /> android:src="@drawable/ic_email_vector" />
@ -65,8 +73,8 @@
android:layout_marginStart="@dimen/normal_margin" android:layout_marginStart="@dimen/normal_margin"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingRight="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_phone_vector" /> android:src="@drawable/ic_phone_vector" />
@ -77,8 +85,8 @@
android:layout_marginStart="@dimen/normal_margin" android:layout_marginStart="@dimen/normal_margin"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingRight="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_sms_vector" /> android:src="@drawable/ic_sms_vector" />
@ -89,6 +97,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_below="@+id/contact_photo" android:layout_below="@+id/contact_photo"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -106,6 +115,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />
@ -122,6 +132,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />
@ -138,6 +149,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />
@ -154,6 +166,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />
@ -170,6 +183,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />
@ -186,6 +200,7 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />
@ -195,6 +210,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_numbers_holder" android:layout_alignTop="@+id/contact_numbers_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -206,6 +222,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_emails_holder" android:layout_alignTop="@+id/contact_emails_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -217,6 +234,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_addresses_holder" android:layout_alignTop="@+id/contact_addresses_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -228,6 +246,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_ims_holder" android:layout_alignTop="@+id/contact_ims_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -239,6 +258,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_events_holder" android:layout_alignTop="@+id/contact_events_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -250,6 +270,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_notes" android:layout_alignTop="@+id/contact_notes"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -261,6 +282,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_organization_company" android:layout_alignTop="@+id/contact_organization_company"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -272,6 +294,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_websites_holder" android:layout_alignTop="@+id/contact_websites_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -283,6 +306,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_groups_holder" android:layout_alignTop="@+id/contact_groups_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -294,6 +318,7 @@
android:layout_width="@dimen/contact_icons_size" android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size" android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_sources_holder" android:layout_alignTop="@+id/contact_sources_holder"
android:layout_marginStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/small_margin" android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
@ -307,7 +332,6 @@
android:layout_below="@+id/contact_nickname" android:layout_below="@+id/contact_nickname"
android:layout_toEndOf="@+id/contact_numbers_image" android:layout_toEndOf="@+id/contact_numbers_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
@ -317,7 +341,6 @@
android:layout_below="@+id/contact_numbers_holder" android:layout_below="@+id/contact_numbers_holder"
android:layout_toEndOf="@+id/contact_name_image" android:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
@ -327,7 +350,6 @@
android:layout_below="@+id/contact_emails_holder" android:layout_below="@+id/contact_emails_holder"
android:layout_toEndOf="@+id/contact_name_image" android:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
@ -337,7 +359,6 @@
android:layout_below="@+id/contact_addresses_holder" android:layout_below="@+id/contact_addresses_holder"
android:layout_toEndOf="@+id/contact_name_image" android:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
@ -365,7 +386,6 @@
android:layout_below="@+id/contact_websites_holder" android:layout_below="@+id/contact_websites_holder"
android:layout_toEndOf="@+id/contact_name_image" android:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
@ -375,7 +395,6 @@
android:layout_below="@+id/contact_groups_holder" android:layout_below="@+id/contact_groups_holder"
android:layout_toEndOf="@+id/contact_name_image" android:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin"
android:visibility="gone" /> android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@ -427,15 +446,28 @@
</ScrollView> </ScrollView>
<ImageView <ImageView
android:id="@+id/contact_photo_big" android:id="@+id/contact_photo_top_shadow"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="@dimen/top_shadow_height"
android:alpha="0" android:layout_alignParentTop="true"
android:background="#88000000" android:background="@drawable/gradient_background_flipped"
android:clickable="true" android:contentDescription="@null" />
android:padding="@dimen/activity_margin"
android:scaleType="fitCenter"
android:src="@drawable/img_write_storage"
android:visibility="gone" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/contact_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:elevation="0dp"
app:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/contact_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:menu="@menu/menu_view_contact"
app:navigationIcon="@drawable/ic_arrow_left_vector" />
</com.google.android.material.appbar.AppBarLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/notification_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/notification_caller_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/md_grey_black"
android:textSize="@dimen/bigger_text_size"
android:textStyle="bold"
tools:text="Caller name" />
<TextView
android:id="@+id/notification_call_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/notification_caller_name"
android:alpha="0.8"
android:textColor="@color/md_grey_black"
tools:text="123 456 789" />
<ImageView
android:id="@+id/notification_thumbnail"
android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true" />
<LinearLayout
android:id="@+id/notification_actions_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/notification_call_status"
android:layout_marginTop="@dimen/activity_margin"
android:orientation="horizontal">
<ImageView
android:id="@+id/notification_decline_call"
android:layout_width="wrap_content"
android:layout_height="@dimen/call_notification_button_size"
android:layout_weight="1"
android:background="@drawable/ripple_background"
android:src="@drawable/ic_phone_down_red_vector" />
<ImageView
android:id="@+id/notification_accept_call"
android:layout_width="wrap_content"
android:layout_height="@dimen/call_notification_button_size"
android:layout_weight="1"
android:background="@drawable/ripple_background"
android:src="@drawable/ic_phone_green_vector" />
</LinearLayout>
</RelativeLayout>

View File

@ -44,6 +44,14 @@
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:text="@string/surname"/> android:text="@string/surname"/>
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_full_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin"
android:text="@string/full_name"/>
</RadioGroup> </RadioGroup>
<include <include

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_choose_social"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/theme_dark_background_color">
<DatePicker
android:id="@+id/date_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/hide_year"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/date_picker"
android:layout_alignStart="@+id/date_picker"
android:layout_marginStart="@dimen/activity_margin"
android:paddingStart="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingBottom="@dimen/medium_margin"
android:text="@string/hide_year" />
</RelativeLayout>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/select_sim_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/select_sim_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/small_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/select_sim"
android:textSize="@dimen/normal_text_size" />
<RadioGroup
android:id="@+id/select_sim_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/small_margin" />
<include layout="@layout/divider" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/select_sim_remember"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/always_use_this_sim" />
</LinearLayout>

View File

@ -1,269 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="wrap_content"
android:layout_alignParentBottom="true"
android:focusableInTouchMode="true"
android:paddingBottom="@dimen/normal_margin"
tools:ignore="HardcodedText">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_1"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:text="1"
app:layout_constraintBottom_toTopOf="@+id/dialpad_4"
app:layout_constraintEnd_toStartOf="@+id/dialpad_2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_2"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="2"
app:layout_constraintBottom_toTopOf="@+id/dialpad_5"
app:layout_constraintEnd_toStartOf="@+id/dialpad_3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_1" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_2_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="ABC"
app:layout_constraintBottom_toTopOf="@+id/dialpad_5"
app:layout_constraintEnd_toStartOf="@+id/dialpad_3"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_1" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_3"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="3"
app:layout_constraintBottom_toTopOf="@+id/dialpad_6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_2" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_3_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="DEF"
app:layout_constraintBottom_toTopOf="@+id/dialpad_6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_2" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_4"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:text="4"
app:layout_constraintBottom_toTopOf="@+id/dialpad_7"
app:layout_constraintEnd_toStartOf="@+id/dialpad_5"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_4_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:text="GHI"
app:layout_constraintBottom_toTopOf="@+id/dialpad_7"
app:layout_constraintEnd_toStartOf="@+id/dialpad_5"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_5"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="5"
app:layout_constraintBottom_toTopOf="@+id/dialpad_8"
app:layout_constraintEnd_toStartOf="@+id/dialpad_6"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_4" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_5_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="JKL"
app:layout_constraintBottom_toTopOf="@+id/dialpad_8"
app:layout_constraintEnd_toStartOf="@+id/dialpad_6"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_4" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_6"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="6"
app:layout_constraintBottom_toTopOf="@+id/dialpad_9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_5" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_6_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="MNO"
app:layout_constraintBottom_toTopOf="@+id/dialpad_9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_5" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_7"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:text="7"
app:layout_constraintBottom_toTopOf="@+id/dialpad_asterisk"
app:layout_constraintEnd_toStartOf="@+id/dialpad_8"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_7_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:text="PQRS"
app:layout_constraintBottom_toTopOf="@+id/dialpad_asterisk"
app:layout_constraintEnd_toStartOf="@+id/dialpad_8"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_8"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="8"
app:layout_constraintBottom_toTopOf="@+id/dialpad_0_holder"
app:layout_constraintEnd_toStartOf="@+id/dialpad_9"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_7" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_8_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="TUV"
app:layout_constraintBottom_toTopOf="@+id/dialpad_0_holder"
app:layout_constraintEnd_toStartOf="@+id/dialpad_9"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_7" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_9"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="9"
app:layout_constraintBottom_toTopOf="@+id/dialpad_hashtag"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_8" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_9_letters"
style="@style/DialpadLetterStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="WXYZ"
app:layout_constraintBottom_toTopOf="@+id/dialpad_hashtag"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_8" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_asterisk"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:text="*"
app:layout_constraintEnd_toStartOf="@+id/dialpad_0_holder"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialpad_7" />
<RelativeLayout
android:id="@+id/dialpad_0_holder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toStartOf="@+id/dialpad_hashtag"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_asterisk"
app:layout_constraintTop_toTopOf="@+id/dialpad_asterisk">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_0"
style="@style/DialpadNumberStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="0" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/dialpad_0"
android:layout_alignBottom="@+id/dialpad_0"
android:layout_centerHorizontal="true"
android:layout_toEndOf="@+id/dialpad_0"
android:gravity="center"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/small_margin"
android:text="+"
android:textSize="@dimen/actionbar_text_size" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/dialpad_hashtag"
style="@style/DialpadNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/activity_margin"
android:text="#"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/dialpad_0_holder"
app:layout_constraintTop_toTopOf="@+id/dialpad_0_holder" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_social_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/medium_margin">
<ImageView
android:id="@+id/item_social_image"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_phone_vector" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/item_social_label"
android:layout_width="match_parent"
android:layout_height="@dimen/normal_icon_size"
android:layout_toEndOf="@+id/item_social_image"
android:gravity="center_vertical"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingEnd="@dimen/normal_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size"
tools:text="Voice call 123 456 789" />
</RelativeLayout>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_address_holder" android:id="@+id/contact_address_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_address" android:id="@+id/contact_address"
@ -14,21 +14,21 @@
android:hint="@string/address" android:hint="@string/address"
android:inputType="textCapWords|textMultiLine" android:inputType="textCapWords|textMultiLine"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_address_type" android:id="@+id/contact_address_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_address"
android:layout_alignBottom="@+id/contact_address" android:layout_alignBottom="@+id/contact_address"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/contact_address"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/address" android:text="@string/address"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_email_holder" android:id="@+id/contact_email_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_email" android:id="@+id/contact_email"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_email_type"
android:layout_toStartOf="@+id/contact_email_type" android:layout_toStartOf="@+id/contact_email_type"
android:hint="@string/email" android:hint="@string/email"
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
@ -18,22 +17,21 @@
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_email_type" android:id="@+id/contact_email_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_email"
android:layout_alignBottom="@+id/contact_email" android:layout_alignBottom="@+id/contact_email"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_email"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/home" android:text="@string/home"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,41 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_group_holder" android:id="@+id/contact_group_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_group" android:id="@+id/contact_group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_group_remove"
android:layout_toStartOf="@+id/contact_group_remove" android:layout_toStartOf="@+id/contact_group_remove"
android:alpha="0.5" android:alpha="0.5"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/no_groups" android:text="@string/no_groups"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<ImageView <ImageView
android:id="@+id/contact_group_remove" android:id="@+id/contact_group_remove"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_group"
android:layout_alignBottom="@+id/contact_group" android:layout_alignBottom="@+id/contact_group"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/contact_group"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginStart="@dimen/small_margin" android:layout_marginStart="@dimen/small_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_marginBottom="@dimen/medium_margin"
android:background="@drawable/button_background" android:background="@drawable/button_background"
android:padding="@dimen/medium_margin" android:padding="@dimen/medium_margin"
android:src="@drawable/ic_minus_vector" android:src="@drawable/ic_minus_vector"
android:visibility="gone"/> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,38 +1,36 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_im_holder" android:id="@+id/contact_im_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_im" android:id="@+id/contact_im"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_im_type"
android:layout_toStartOf="@+id/contact_im_type" android:layout_toStartOf="@+id/contact_im_type"
android:hint="@string/im" android:hint="@string/im"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_im_type" android:id="@+id/contact_im_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_im"
android:layout_alignBottom="@+id/contact_im" android:layout_alignBottom="@+id/contact_im"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_im"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/skype" android:text="@string/skype"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_number_holder" android:id="@+id/contact_number_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_number" android:id="@+id/contact_number"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_number_type"
android:layout_toStartOf="@+id/contact_number_type" android:layout_toStartOf="@+id/contact_number_type"
android:hint="@string/number" android:hint="@string/number"
android:inputType="phone" android:inputType="phone"
@ -18,22 +17,21 @@
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_number_type" android:id="@+id/contact_number_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_number"
android:layout_alignBottom="@+id/contact_number" android:layout_alignBottom="@+id/contact_number"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_number"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/mobile" android:text="@string/mobile"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_website_holder" android:id="@+id/contact_website_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_website" android:id="@+id/contact_website"
@ -16,6 +16,6 @@
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textCursorDrawable="@null" android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,57 +1,55 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_event_holder" android:id="@+id/contact_event_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_event" android:id="@+id/contact_event"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_event_remove"
android:layout_toStartOf="@+id/contact_event_remove" android:layout_toStartOf="@+id/contact_event_remove"
android:alpha="0.5" android:alpha="0.5"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/unknown" android:text="@string/unknown"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<ImageView <ImageView
android:id="@+id/contact_event_remove" android:id="@+id/contact_event_remove"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@+id/contact_event"
android:layout_alignTop="@+id/contact_event" android:layout_alignTop="@+id/contact_event"
android:layout_alignBottom="@+id/contact_event"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/medium_margin" android:layout_marginStart="@dimen/small_margin"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginRight="@dimen/small_margin"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_marginBottom="@dimen/medium_margin"
android:layout_toStartOf="@+id/contact_event_type" android:layout_toStartOf="@+id/contact_event_type"
android:background="@drawable/button_background" android:background="@drawable/button_background"
android:padding="@dimen/medium_margin" android:padding="@dimen/medium_margin"
android:src="@drawable/ic_minus_vector" android:src="@drawable/ic_minus_vector"
android:visibility="gone"/> android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_event_type" android:id="@+id/contact_event_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_event"
android:layout_alignBottom="@+id/contact_event" android:layout_alignBottom="@+id/contact_event"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_event"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/birthday" android:text="@string/birthday"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/filter_contact_source_holder" android:id="@+id/filter_contact_source_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -13,6 +12,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/medium_margin" android:layout_marginEnd="@dimen/medium_margin"
android:clickable="false" android:clickable="false"
android:paddingStart="@dimen/small_margin"/> android:paddingStart="@dimen/small_margin" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/speed_dial_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:foreground="@drawable/selector"
android:lines="1"
android:maxLines="1"
android:padding="@dimen/activity_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />

View File

@ -1,35 +1,34 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_address_holder" android:id="@+id/contact_address_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"> android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_address" android:id="@+id/contact_address"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_address_type"
android:layout_toStartOf="@+id/contact_address_type" android:layout_toStartOf="@+id/contact_address_type"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_address_type" android:id="@+id/contact_address_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_address"
android:layout_alignBottom="@+id/contact_address" android:layout_alignBottom="@+id/contact_address"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_address"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/home" android:text="@string/home"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,15 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/contact_source" android:id="@+id/contact_source_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" <com.simplemobiletools.commons.views.MyTextView
android:ellipsize="end" android:id="@+id/contact_source"
android:lines="1" android:layout_width="match_parent"
android:maxLines="1" android:layout_height="wrap_content"
android:paddingTop="@dimen/normal_margin" android:layout_centerVertical="true"
android:paddingBottom="@dimen/normal_margin" android:layout_toStartOf="@+id/contact_source_image"
android:singleLine="true" android:background="?attr/selectableItemBackground"
android:textSize="@dimen/bigger_text_size"/> android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size" />
<ImageView
android:id="@+id/contact_source_image"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:layout_alignTop="@+id/contact_source"
android:layout_alignBottom="@+id/contact_source"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/normal_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/small_margin"
tools:src="@drawable/ic_phone_vector" />
</RelativeLayout>

View File

@ -1,38 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_email_holder" android:id="@+id/contact_email_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"> android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_email" android:id="@+id/contact_email"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_email_type"
android:layout_toStartOf="@+id/contact_email_type" android:layout_toStartOf="@+id/contact_email_type"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_email_type" android:id="@+id/contact_email_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_email"
android:layout_alignBottom="@+id/contact_email" android:layout_alignBottom="@+id/contact_email"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_email"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center" android:gravity="center"
android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/home" android:text="@string/home"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -4,7 +4,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"> android:paddingBottom="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
@ -27,8 +29,8 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center" android:gravity="center"
android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/home" android:text="@string/home"
android:textSize="@dimen/bigger_text_size" /> android:textSize="@dimen/bigger_text_size" />

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_group" android:id="@+id/contact_group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -9,7 +8,9 @@
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />

View File

@ -1,38 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_im_holder" android:id="@+id/contact_im_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"> android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_im" android:id="@+id/contact_im"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_im_type"
android:layout_toStartOf="@+id/contact_im_type" android:layout_toStartOf="@+id/contact_im_type"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_im_type" android:id="@+id/contact_im_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_im"
android:layout_alignBottom="@+id/contact_im" android:layout_alignBottom="@+id/contact_im"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_im"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/aim" android:text="@string/aim"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,38 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_number_holder" android:id="@+id/contact_number_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin" android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"> android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_number" android:id="@+id/contact_number"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_number_type"
android:layout_toStartOf="@+id/contact_number_type" android:layout_toStartOf="@+id/contact_number_type"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_number_type" android:id="@+id/contact_number_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/contact_number"
android:layout_alignBottom="@+id/contact_number" android:layout_alignBottom="@+id/contact_number"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_number"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:gravity="center" android:gravity="center"
android:paddingStart="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/medium_margin" android:paddingEnd="@dimen/medium_margin"
android:text="@string/mobile" android:text="@string/mobile"
android:textSize="@dimen/bigger_text_size"/> android:textSize="@dimen/bigger_text_size" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/add_number_to_contact"
android:icon="@drawable/ic_plus_vector"
android:title="@string/add_number_to_contact"
app:showAsAction="ifRoom"/>
</menu>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Some files were not shown because too many files have changed in this diff Show More