Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions SimpleLogin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: "androidx.navigation.safeargs"
apply plugin: 'com.android.application'

android {
compileSdk 34
compileSdk 35

defaultConfig {
applicationId "io.simplelogin.android"
Expand Down Expand Up @@ -44,12 +44,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
jvmTarget = JavaVersion.VERSION_21.toString()
}

flavorDimensions 'version'
Expand All @@ -69,23 +69,23 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.core:core-ktx:1.15.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.7'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation "androidx.biometric:biometric:1.1.0"
implementation "androidx.browser:browser:1.7.0"
implementation "androidx.browser:browser:1.8.0"

// Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.6'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.6'
implementation 'androidx.navigation:navigation-fragment-ktx:2.8.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.8.3'

// Shared view model
implementation "androidx.fragment:fragment-ktx:1.6.2"
implementation "androidx.fragment:fragment-ktx:1.8.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class ShareActivity : BaseAppCompatActivity() {
}

// Move cursor to the last character
binding.prefixEditText.setSelection(binding.prefixEditText.text.count())
binding.prefixEditText.setSelection(binding.prefixEditText.text!!.count())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If prefixEditText is ever null this will cause a crash. Could you update it to avoid it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I have no idea why I made those changes in the first place. 😄

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, you added it because otherwise, it would cause a compilation error. Right now, reverting it makes the code fail to compile. The ideal approach would be to write it in a more null-safe way. For example, you could add a .orEmpty().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

private fun setLoading(loading: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun Context.toastUpToDate() = toastShortly("You are up to date")

fun Context.getVersionName(): String {
val packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES)
return packageInfo.versionName
return packageInfo.versionName!!
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If versionName is ever null this will cause a crash. Could you update it to avoid it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed now :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

fun Context.dpToPixel(dp: Float): Float =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.os.Parcelable
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.util.TypedValue
import androidx.core.content.ContextCompat
import androidx.core.text.color
import com.google.gson.annotations.SerializedName
Expand Down Expand Up @@ -73,7 +74,7 @@ data class Alias(
fun getCountSpannableString(context: Context): Spannable {
if (_countSpannableString == null) {
val darkGrayColor = ContextCompat.getColor(context, R.color.colorDarkGray)
val blackColor = ContextCompat.getColor(context, R.color.colorText)
val blackColor = getColorFromAttr(context, R.attr.colorOnSurface)
val spannableString = SpannableStringBuilder()
.color(blackColor) { append("$forwardCount ") }
.color(darkGrayColor) { append(if (forwardCount > 1) "forwards," else "forwards,") }
Expand Down Expand Up @@ -144,13 +145,19 @@ data class AliasArray(
@SerializedName("aliases") val aliases: List<Alias>
)

fun getColorFromAttr(context: Context, attr: Int): Int {
val typedValue = TypedValue()
context.theme.resolveAttribute(attr, typedValue, true)
return typedValue.data
}

fun List<AliasMailbox>.toSpannableString(context: Context): Spannable {
val primaryColor = ContextCompat.getColor(context, R.color.colorPrimary)
val blackColor = ContextCompat.getColor(context, R.color.colorText)
val primaryColor = getColorFromAttr(context, R.attr.colorPrimary)
val textColor = getColorFromAttr(context, R.attr.colorOnSurface)
val spannableString = SpannableStringBuilder()

forEachIndexed { index, aliasMailbox ->
spannableString.color(blackColor) { append(" ${aliasMailbox.email} ") }
spannableString.color(textColor) { append(" ${aliasMailbox.email} ") }
if (index != size - 1) {
spannableString.color(primaryColor) { append("&") }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class AliasActivityHeaderViewHolder(private val binding: RecyclerItemAliasActivi
ContextCompat.getDrawable(context, R.drawable.ic_block_58dp)
)
binding.blockedStat.rootLinearLayout.setBackgroundColor(
ContextCompat.getColor(context, R.color.colorNegative)
ContextCompat.getColor(context, R.color.color_error)
)
binding.blockedStat.numberTextView.text = "${alias.blockCount}"
binding.blockedStat.typeTextView.text = "Email blocked"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AliasActivityViewHolder(private val binding: RecyclerItemAliasActivityBind
R.drawable.ic_send_28dp
)
)
binding.iconImageView.setTint(R.color.colorPrimary)
binding.iconImageView.setTint(R.color.color_primary)
}

Action.REPLY -> {
Expand All @@ -47,7 +47,7 @@ class AliasActivityViewHolder(private val binding: RecyclerItemAliasActivityBind
R.drawable.ic_reply_24dp
)
)
binding.iconImageView.setTint(R.color.colorPrimary)
binding.iconImageView.setTint(R.color.color_primary)
}

else -> {
Expand All @@ -58,7 +58,7 @@ class AliasActivityViewHolder(private val binding: RecyclerItemAliasActivityBind
R.drawable.ic_block_24dp
)
)
binding.iconImageView.setTint(R.color.colorNegative)
binding.iconImageView.setTint(R.color.color_error)
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions SimpleLogin/app/src/main/res/color/btn_text_color_state.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimary" android:state_enabled="true"/>
<item android:color="@color/colorDarkGray" android:state_enabled="false"/>
<item android:color="?attr/colorPrimary" android:state_enabled="true"/>
<item android:color="?attr/colorOnSurfaceVariant" android:state_enabled="false"/>
</selector>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
Expand Down
15 changes: 0 additions & 15 deletions SimpleLogin/app/src/main/res/drawable/button_border_proton.xml

This file was deleted.

15 changes: 0 additions & 15 deletions SimpleLogin/app/src/main/res/drawable/button_border_sl.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<corners android:radius="@dimen/margin_8"/>
<solid android:color="@color/colorItemBackground"/>
<stroke android:color="@color/cardStrokeColor" android:width="1dp"/>
<stroke android:color="?attr/colorOutlineVariant" android:width="1dp"/>
</shape>
</item>
</ripple>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/colorPrimary">
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M17.77,3.77l-1.77,-1.77l-10,10l10,10l1.77,-1.77l-8.23,-8.23z"/>
Expand Down
2 changes: 1 addition & 1 deletion SimpleLogin/app/src/main/res/drawable/ic_close_24dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/colorPrimary">
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12 19,6.41z"/>
Expand Down
2 changes: 1 addition & 1 deletion SimpleLogin/app/src/main/res/drawable/ic_hamburger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/colorPrimary"
android:fillColor="?attr/colorPrimary"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>
2 changes: 1 addition & 1 deletion SimpleLogin/app/src/main/res/drawable/ic_user_48dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/colorPrimary">
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="@color/colorItemBackground"/>
<solid android:color="?attr/colorSurfaceContainerLow"/>

<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
android:topLeftRadius="16dp"
android:topRightRadius="16dp" />

</shape>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="@color/colorItemBackground"/>
<solid android:color="?attr/colorSurfaceContainerLow"/>

<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
android:topLeftRadius="16dp"
android:topRightRadius="16dp" />

</shape>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp"/>
<corners android:radius="8dp"/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp"/>
<solid android:color="@color/colorPrimary"/>
<solid android:color="?attr/colorPrimary"/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp"/>
<solid android:color="@android:color/holo_red_light"/>
<solid android:color="?attr/colorError"/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
android:shape="oval">
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
android:color="?attr/colorPrimary" />
</shape>
17 changes: 0 additions & 17 deletions SimpleLogin/app/src/main/res/drawable/switch_thumb.xml

This file was deleted.

5 changes: 0 additions & 5 deletions SimpleLogin/app/src/main/res/drawable/switch_track.xml

This file was deleted.

2 changes: 1 addition & 1 deletion SimpleLogin/app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/menu_header"
app:itemIconTint="@color/colorPrimary"
app:itemIconTint="?attr/colorPrimary"
app:itemTextColor="?attr/colorControlNormal" />

</androidx.drawerlayout.widget.DrawerLayout>
Expand Down
5 changes: 0 additions & 5 deletions SimpleLogin/app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorItemBackground"
android:layout_gravity="start"
app:itemIconPadding="@dimen/margin_20"
app:itemIconSize="22dp"
app:headerLayout="@layout/menu_header"
app:itemIconTint="@color/colorPrimary"
app:itemTextColor="@color/colorControlNormal"
app:menu="@menu/home_left_menu" />

</androidx.drawerlayout.widget.DrawerLayout>
Expand Down
Loading