Skip to content

Commit

Permalink
v.6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodwy committed Dec 4, 2024
1 parent 7771725 commit c7f47bd
Show file tree
Hide file tree
Showing 104 changed files with 2,128 additions and 627 deletions.
17 changes: 15 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.ksp)
alias(libs.plugins.detekt)
base
}

Expand Down Expand Up @@ -110,8 +111,21 @@ android {

lint {
checkReleaseBuilds = false
abortOnError = false
abortOnError = true
warningsAsErrors = true
baseline = file("lint-baseline.xml")
}

bundle {
language {
@Suppress("UnstableApiUsage")
enableSplit = false
}
}
}

detekt {
baseline = file("detekt-baseline.xml")
}

dependencies {
Expand All @@ -125,7 +139,6 @@ dependencies {
implementation(libs.shortcut.badger)
implementation(libs.googlecode.libphonenumber)
implementation(libs.googlecode.geocoder)
implementation(libs.rustore.client)
implementation(libs.behavio.rule)
implementation(libs.rx.animation)
implementation(libs.rx.java)
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<package android:name="com.goodwy.filemanager" />
<package android:name="com.goodwy.audiobooklite" />
<package android:name="com.goodwy.keyboard" />

<!-- Required for loading contact accounts -->
<intent>
<action android:name="android.accounts.AccountAuthenticator" />
</intent>
</queries>

<application
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/kotlin/com/goodwy/dialer/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import androidx.lifecycle.ProcessLifecycleOwner
import com.goodwy.commons.RightApp
import com.goodwy.commons.extensions.checkUseEnglish
import com.goodwy.commons.extensions.isRuStoreInstalled
import com.goodwy.commons.extensions.showErrorToast
import com.goodwy.commons.helpers.rustore.RuStoreModule
import com.goodwy.dialer.extensions.*
Expand All @@ -30,8 +30,7 @@ class App : RightApp(), LifecycleObserver {
super.onCreate()
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
EventBus.getDefault().register(this)
checkUseEnglish()
RuStoreModule.install(this, "309929407") //TODO rustore
if (isRuStoreInstalled()) RuStoreModule.install(this, "309929407") //TODO rustore
}

override fun onTerminate() {
Expand Down
146 changes: 96 additions & 50 deletions app/src/main/kotlin/com/goodwy/dialer/activities/CallActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import android.graphics.drawable.RippleDrawable
import android.media.AudioManager
import android.net.Uri
import android.os.*
import android.provider.Settings
import android.telecom.Call
import android.telecom.CallAudioState
import android.view.*
Expand All @@ -22,14 +21,15 @@ import android.widget.LinearLayout
import android.widget.PopupMenu
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.os.postDelayed
import androidx.core.view.children
import androidx.core.view.isVisible
import com.goodwy.commons.extensions.*
import com.goodwy.commons.helpers.*
import com.goodwy.commons.helpers.setWindowTransparency
import com.goodwy.commons.models.SimpleListItem
import com.goodwy.dialer.R
import com.goodwy.dialer.databinding.ActivityCallBinding
import com.goodwy.dialer.dialogs.ChangeTextDialog
import com.goodwy.dialer.dialogs.DynamicBottomSheetChooserDialog
import com.goodwy.dialer.extensions.*
import com.goodwy.dialer.helpers.*
Expand All @@ -48,7 +48,7 @@ class CallActivity : SimpleActivity() {
fun getStartIntent(context: Context, needSelectSIM: Boolean = false): Intent {
val openAppIntent = Intent(context, CallActivity::class.java)
openAppIntent.putExtra(NEED_SELECT_SIM, needSelectSIM)
openAppIntent.flags = Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
openAppIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT //Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT --removed it, it can cause a full screen ringing instead of notifications
return openAppIntent
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ class CallActivity : SimpleActivity() {

binding.apply {
arrayOf(
callerNameLabel, callerDescription, callerNumber, callStatusLabel, callDeclineLabel, callAcceptLabel,
callerNameLabel, callerDescription, callerNumber, callerNotes, callStatusLabel, callDeclineLabel, callAcceptLabel,
dialpadInclude.dialpad1, dialpadInclude.dialpad2, dialpadInclude.dialpad3, dialpadInclude.dialpad4,
dialpadInclude.dialpad5, dialpadInclude.dialpad6, dialpadInclude.dialpad7, dialpadInclude.dialpad8,
dialpadInclude.dialpad9, dialpadInclude.dialpad0, dialpadInclude.dialpadPlus, dialpadInput,
Expand All @@ -134,7 +134,7 @@ class CallActivity : SimpleActivity() {

arrayOf(
callToggleMicrophone, callToggleSpeaker, callDialpad, /*dialpadClose,*/ callSimImage, callDetails,
callToggleHold, callAddContact, callAdd, callSwap, callMerge, callInfo, imageView,
callToggleHold, callAddContact, callAdd, callSwap, callMerge, callInfo, addCallerNote, imageView,
dialpadInclude.dialpadAsterisk, dialpadInclude.dialpadHashtag
).forEach {
it.applyColorFilter(Color.WHITE)
Expand All @@ -153,7 +153,7 @@ class CallActivity : SimpleActivity() {
binding.apply {
arrayOf(
callToggleMicrophone, callToggleSpeaker, callDialpad, /*dialpadClose,*/ callSimImage, callDetails,
callToggleHold, callAddContact, callAdd, callSwap, callMerge, callInfo, imageView,
callToggleHold, callAddContact, callAdd, callSwap, callMerge, callInfo, addCallerNote, imageView,
dialpadInclude.dialpadAsterisk, dialpadInclude.dialpadHashtag, callMessage, callRemind
).forEach {
it.applyColorFilter(properTextColor)
Expand Down Expand Up @@ -338,18 +338,16 @@ class CallActivity : SimpleActivity() {
}

callToggleMicrophone.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
toggleMicrophone()
maybePerformDialpadHapticFeedback(it)
}

callToggleSpeaker.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
//toggleSpeaker()
changeCallAudioRoute()
maybePerformDialpadHapticFeedback(it)
}

callToggleSpeaker.setOnLongClickListener {
maybePerformDialpadHapticFeedback(it)
// if (CallManager.getCallAudioRoute() == AudioRoute.BLUETOOTH) {
// openBluetoothSettings()
val supportAudioRoutes = CallManager.getSupportedAudioRoutes()
Expand All @@ -359,50 +357,51 @@ class CallActivity : SimpleActivity() {
CallManager.setAudioRoute(newRoute)
}
else toast(callToggleSpeaker.contentDescription.toString())
maybePerformDialpadHapticFeedback(it)
true
}

callDialpadHolder.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
toggleDialpadVisibility()
maybePerformDialpadHapticFeedback(it)
}

dialpadClose.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
hideDialpad()
maybePerformDialpadHapticFeedback(it)
}

callAddHolder.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
Intent(applicationContext, DialpadActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
startActivity(this)
}
maybePerformDialpadHapticFeedback(it)
}

callSwapHolder.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
CallManager.swap()
maybePerformDialpadHapticFeedback(it)
}

callMergeHolder.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
CallManager.merge()
maybePerformDialpadHapticFeedback(it)
}

callInfo.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
startActivity(Intent(this@CallActivity, ConferenceActivity::class.java))
maybePerformDialpadHapticFeedback(it)
}

callToggleHold.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
toggleHold()
maybePerformDialpadHapticFeedback(it)
}

callAddContactHolder.setOnClickListener {
maybePerformDialpadHapticFeedback(it)
addContact()
maybePerformDialpadHapticFeedback(it)
}

callEnd.setOnClickListener {
Expand All @@ -428,7 +427,7 @@ class CallActivity : SimpleActivity() {

arrayOf(
callToggleMicrophone, callDialpadHolder, callToggleHold,
callAddHolder, callSwapHolder, callMergeHolder, callInfo, callAddContactHolder
callAddHolder, callSwapHolder, callMergeHolder, callInfo, addCallerNote, callAddContactHolder
).forEach { imageView ->
imageView.setOnLongClickListener {
if (!imageView.contentDescription.isNullOrEmpty()) {
Expand Down Expand Up @@ -845,9 +844,9 @@ class CallActivity : SimpleActivity() {
dialpadWrapper.beVisible()
dialpadClose.beVisible()
arrayOf(
callerAvatar, callerNameLabel, callerDescription, callerNumber, callStatusLabel,
callerAvatar, callerNameLabel, callerDescription, callerNumber, callerNotes, callStatusLabel,
callSimImage, callSimId, callToggleMicrophone, callDialpadHolder,
callToggleSpeaker, callAddContactHolder, callInfo
callToggleSpeaker, callAddContactHolder, callInfo, addCallerNote
).forEach {
it.beGone()
}
Expand Down Expand Up @@ -882,6 +881,7 @@ class CallActivity : SimpleActivity() {
}
callAddContactHolder.beVisibleIf(config.callButtonStyle == IOS16)
callerDescription.beVisibleIf(callerDescription.text.isNotEmpty())
callerNotes.beVisibleIf(callerNotes.text.isNotEmpty())
val accounts = telecomManager.callCapablePhoneAccounts
callSimImage.beVisibleIf(accounts.size > 1)
callSimId.beVisibleIf(accounts.size > 1)
Expand Down Expand Up @@ -942,6 +942,7 @@ class CallActivity : SimpleActivity() {
callerNumber.setOnClickListener {
if (callerNumber.text == numberLabelText) callerNumber.text = numberText
else callerNumber.text = numberLabelText
maybePerformDialpadHapticFeedback(it)
}
} else {
callerNumber.text = numberText
Expand Down Expand Up @@ -1031,38 +1032,82 @@ class CallActivity : SimpleActivity() {
setOnLongClickListener { toast(R.string.send_sms); true; }
}

callRemind.setOnClickListener {
this@CallActivity.handleNotificationPermission { permission ->
if (permission) {
val wrapper: Context = ContextThemeWrapper(this@CallActivity, getPopupMenuTheme())
val popupMenu = PopupMenu(wrapper, callRemind, Gravity.START)
popupMenu.menu.add(1, 1, 1, String.format(resources.getQuantityString(R.plurals.minutes, 10, 10)))
popupMenu.menu.add(1, 2, 2, String.format(resources.getQuantityString(R.plurals.minutes, 30, 30)))
popupMenu.menu.add(1, 3, 3, String.format(resources.getQuantityString(R.plurals.minutes, 60, 60)))
popupMenu.setOnMenuItemClickListener { item ->
when (item.itemId) {
1 -> {
startTimer(600)
endCall()
}

2 -> {
startTimer(1800)
endCall()
}

else -> {
startTimer(3600)
endCall()
callRemind.apply {
setOnClickListener {
this@CallActivity.handleNotificationPermission { permission ->
if (permission) {
val wrapper: Context = ContextThemeWrapper(this@CallActivity, getPopupMenuTheme())
val popupMenu = PopupMenu(wrapper, callRemind, Gravity.START)
popupMenu.menu.add(1, 1, 1, String.format(resources.getQuantityString(R.plurals.minutes, 10, 10)))
popupMenu.menu.add(1, 2, 2, String.format(resources.getQuantityString(R.plurals.minutes, 30, 30)))
popupMenu.menu.add(1, 3, 3, String.format(resources.getQuantityString(R.plurals.minutes, 60, 60)))
popupMenu.setOnMenuItemClickListener { item ->
when (item.itemId) {
1 -> {
startTimer(600)
endCall()
}

2 -> {
startTimer(1800)
endCall()
}

else -> {
startTimer(3600)
endCall()
}
}
true
}
true
popupMenu.show()
} else {
toast(R.string.allow_notifications_reminders)
}
popupMenu.show()
} else {
toast(R.string.allow_notifications_reminders)
}
}
setOnLongClickListener { toast(R.string.remind_me); true; }
}

val callNote = callerNotesHelper.getCallerNotes(number)
callerNotes.apply {
beVisibleIf(callNote != null && !isConference)
if (callNote != null) {
text = callNote.note
}
setOnClickListener {
changeNoteDialog(number)
}
}

addCallerNote.apply {
setOnClickListener {
changeNoteDialog(number)
}
}
}
}

private fun changeNoteDialog(number: String) {
val callerNote = callerNotesHelper.getCallerNotes(number)
ChangeTextDialog(
activity = this@CallActivity,
title = getString(R.string.add_notes) + " ($number)",
currentText = callerNote?.note,
maxLength = CALLER_NOTES_MAX_LENGTH,
showNeutralButton = true,
neutralTextRes = com.goodwy.commons.R.string.delete
) {
if (it != "") {
callerNotesHelper.addCallerNotes(number, it, callerNote) {
binding.callerNotes.text = it
binding.callerNotes.beVisible()
}
} else {
callerNotesHelper.deleteCallerNotes(callerNote) {
binding.callerNotes.text = it
binding.callerNotes.beGone()
}
}
}
}
Expand Down Expand Up @@ -1156,6 +1201,7 @@ class CallActivity : SimpleActivity() {
}

callInfo.beVisibleIf(!isCallEnded && call.hasCapability(Call.Details.CAPABILITY_MANAGE_CONFERENCE))
addCallerNote.beVisibleIf(!callInfo.isVisible)
if (dialpadWrapper.isGone()) {
setActionButtonEnabled(callSwapHolder, enabled = !isCallEnded && state == Call.STATE_ACTIVE)
setActionButtonEnabled(callMergeHolder, enabled = !isCallEnded && state == Call.STATE_ACTIVE)
Expand Down Expand Up @@ -1312,13 +1358,13 @@ class CallActivity : SimpleActivity() {
}

private fun callStarted() {
maybePerformCallHapticFeedback(binding.callerNameLabel)
enableProximitySensor()
binding.incomingCallHolder.beGone()
binding.ongoingCallHolder.beVisible()
binding.callEnd.beVisible()
callDurationHandler.removeCallbacks(updateCallDurationTask)
callDurationHandler.post(updateCallDurationTask)
maybePerformCallHapticFeedback(binding.callerNameLabel)
if (config.flashForAlerts) MyCameraImpl.newInstance(this).toggleSOS()
}

Expand All @@ -1332,7 +1378,6 @@ class CallActivity : SimpleActivity() {

private fun endCall(rejectWithMessage: Boolean = false, textMessage: String? = null) {
CallManager.reject(rejectWithMessage, textMessage)
maybePerformCallHapticFeedback(binding.callerNameLabel)
disableProximitySensor()
audioRouteChooserDialog?.dismissAllowingStateLoss()

Expand Down Expand Up @@ -1365,6 +1410,7 @@ class CallActivity : SimpleActivity() {
} else finish()
}
}
maybePerformCallHapticFeedback(binding.callerNameLabel)
}

private val callCallback = object : CallManagerListener {
Expand Down
Loading

0 comments on commit c7f47bd

Please sign in to comment.