Skip to content

Commit 78f3428

Browse files
committed
Fix themes colors and CLEVER_DIALER_CSS_SELECTOR
1 parent b856dbe commit 78f3428

File tree

11 files changed

+36
-21
lines changed

11 files changed

+36
-21
lines changed

app/src/main/java/com/addev/listaspam/adapter/CallLogAdapter.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import android.content.pm.PackageManager
99
import android.net.Uri
1010
import android.provider.CallLog
1111
import android.provider.ContactsContract
12+
import android.util.TypedValue
1213
import android.view.Gravity
1314
import android.view.LayoutInflater
1415
import android.view.View
@@ -45,7 +46,7 @@ class CallLogAdapter(
4546
const val REPORT_URL_TEMPLATE = "https://www.listaspam.com/busca.php?Telefono=%s#denuncia"
4647
}
4748

48-
private val formatter = SimpleDateFormat("dd/MM/yyyy HH:ss")
49+
private val formatter = SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
4950
private var onItemChangedListener: OnItemChangedListener? = null
5051

5152
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CallLogViewHolder {
@@ -101,7 +102,7 @@ class CallLogAdapter(
101102
isBlocked -> numberTextView.setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_light))
102103
isWhitelisted -> numberTextView.setTextColor(ContextCompat.getColor(context, android.R.color.holo_blue_dark))
103104
else -> {
104-
numberTextView.setTextColor(ContextCompat.getColor(context, android.R.color.darker_gray))
105+
numberTextView.setTextColor(ContextCompat.getColor(context, R.color.textColor))
105106
}
106107
}
107108

app/src/main/java/com/addev/listaspam/util/NotificationUtils.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ import com.addev.listaspam.R
1313
private const val NOTIFICATION_CHANNEL_ID = "NOTIFICATION_CHANNEL"
1414
private const val NOTIFICATION_ID = 1
1515

16-
fun sendNotification(context: Context, number: String, reason: String) {
16+
fun sendBlockedCallNotification(context: Context, number: String, reason: String) {
17+
sendNotification(context,
18+
context.getString(R.string.notification_title_spam_blocked, number),
19+
context.getString(R.string.block_reason) + " " + reason)
20+
}
21+
22+
fun sendNotification(context: Context, title: String, message: String) {
1723
createNotificationChannel(context)
1824

1925
if (ActivityCompat.checkSelfPermission(
@@ -27,8 +33,8 @@ fun sendNotification(context: Context, number: String, reason: String) {
2733

2834
val notification = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
2935
.setSmallIcon(R.mipmap.ic_launcher)
30-
.setContentTitle(context.getString(R.string.notification_title_spam_blocked, number))
31-
.setContentText(context.getString(R.string.block_reason) + " " + reason)
36+
.setContentTitle(title)
37+
.setContentText(message)
3238
.setPriority(NotificationCompat.PRIORITY_HIGH)
3339
.build()
3440

app/src/main/java/com/addev/listaspam/util/SharedPreferencesUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fun shouldFilterWithListaSpam(context: Context): Boolean {
2929

3030
fun shouldFilterWithResponderONo(context: Context): Boolean {
3131
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
32-
return sharedPreferences.getBoolean("pref_filter_responder_o_no", true)
32+
return sharedPreferences.getBoolean("pref_filter_responder_o_no", false)
3333
}
3434

3535
fun shouldFilterWithCleverdialer(context: Context): Boolean {

app/src/main/java/com/addev/listaspam/util/SpamUtils.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SpamUtils {
3636
"https://www.responderono.es/numero-de-telefono/%s"
3737
private const val RESPONDERONO_CSS_SELECTOR = ".scoreContainer .score.negative"
3838
private const val CLEVER_DIALER_URL_TEMPLATE = "https://www.cleverdialer.es/numero/%s"
39-
private const val CLEVER_DIALER_CSS_SELECTOR = ".front-stars:not(.star-rating .stars-4, .star-rating .stars-5):not(.page_speed_767712278), .circle-spam"
39+
private const val CLEVER_DIALER_CSS_SELECTOR = "body:has(#comments):has(.front-stars:not(.star-rating .stars-4, .star-rating .stars-5)), .circle-spam"
4040

4141
private const val USER_AGENT =
4242
"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36"
@@ -80,7 +80,8 @@ class SpamUtils {
8080
if (isSpam) {
8181
handleSpamNumber(context, number, context.getString(R.string.block_spam_number), callback)
8282
} else {
83-
handleNonSpamNumber(context, number, callback)
83+
handleNonSpamNumber(context, number)
84+
return@launch
8485
}
8586
}
8687
}
@@ -268,7 +269,7 @@ class SpamUtils {
268269
if (saveNumber) {
269270
saveSpamNumber(context, number)
270271
}
271-
sendNotification(context, number, reason)
272+
sendBlockedCallNotification(context, number, reason)
272273
callback(true)
273274
}
274275

@@ -280,14 +281,15 @@ class SpamUtils {
280281
*/
281282
private fun handleNonSpamNumber(
282283
context: Context,
283-
number: String,
284-
callback: (isSpam: Boolean) -> Unit
284+
number: String
285285
) {
286-
Handler(Looper.getMainLooper()).post {
287-
showToast(context, context.getString(R.string.incoming_call_not_spam), Toast.LENGTH_LONG)
286+
CoroutineScope(Dispatchers.Main).launch {
287+
sendNotification(
288+
context,
289+
context.getString(R.string.call_incoming),
290+
context.getString(R.string.incoming_call_not_spam))
291+
removeSpamNumber(context, number)
288292
}
289-
removeSpamNumber(context, number)
290-
callback(false)
291293
}
292294

293295
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3-
<solid android:color="#f0f0f0" />
3+
<solid android:color="@color/cardBackgroundColor" />
44
<corners android:radius="8dp" />
55
</shape>

app/src/main/res/layout/item_call_log.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
android:layout_width="wrap_content"
1313
android:layout_height="wrap_content"
1414
android:textSize="18sp"
15-
android:textColor="?attr/colorPrimary"
1615
android:layout_alignParentStart="true" />
1716

1817
<TextView

app/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<string name="pref_enable_blocking_summary">Habilita o deshabilita el sistema de bloqueo de llamadas en toda la aplicación</string>
3737

3838
<string name="pref_filter_lista_spam_title">Filtrar con listaspam.com</string>
39-
<string name="pref_filter_lista_spam_summary">Bloquea llamadas de números de spam incluidos en la base de datos de listaspam.com</string>
39+
<string name="pref_filter_lista_spam_summary">(Recomendado) Bloquea llamadas de números de spam incluidos en la base de datos de listaspam.com</string>
4040

4141
<string name="pref_filter_responder_o_no_title">Filtrar con responderono.es</string>
4242
<string name="pref_filter_responder_o_no_summary">Bloquea llamadas de números de spam incluidos en la base de datos de responderono.es</string>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="textColor">#e6e6e6</color>
4+
<color name="cardBackgroundColor">#303030</color>
5+
</resources>

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3+
<color name="textColor">#404040</color>
34
<color name="black">#FF000000</color>
45
<color name="white">#FFFFFFFF</color>
56
<color name="darkBackground">#212121</color>
7+
<color name="cardBackgroundColor">#f0f0f0</color>
68
</resources>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<string name="pref_enable_blocking_summary">Enables or disables the call blocking system across the entire application</string>
3636

3737
<string name="pref_filter_lista_spam_title">Filter with listaspam.com</string>
38-
<string name="pref_filter_lista_spam_summary">Blocks calls from spam numbers included in the listaspam.com database</string>
38+
<string name="pref_filter_lista_spam_summary">(Recommended) Blocks calls from spam numbers included in the listaspam.com database</string>
3939

4040
<string name="pref_filter_responder_o_no_title">Filter with responderono.es</string>
4141
<string name="pref_filter_responder_o_no_summary">Blocks calls from spam numbers included in the responderono.es database</string>

0 commit comments

Comments
 (0)