-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add banner warning about API 19 deprecation.
- Loading branch information
1 parent
7617a16
commit 564b9f4
Showing
7 changed files
with
115 additions
and
6 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
app/src/main/java/org/thoughtcrime/securesms/components/reminder/Api19Reminder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.thoughtcrime.securesms.components.reminder | ||
|
||
import android.content.Context | ||
import android.os.Build | ||
import org.thoughtcrime.securesms.R | ||
import org.thoughtcrime.securesms.util.Util | ||
import java.text.SimpleDateFormat | ||
import java.util.Date | ||
import java.util.Locale | ||
|
||
/** | ||
* Shown when a user has API 19. | ||
*/ | ||
class Api19Reminder(context: Context) : Reminder(null, context.getString(R.string.API19Reminder_banner_message, getExpireDate())) { | ||
|
||
init { | ||
addAction( | ||
Action( | ||
context.getString(R.string.API19Reminder_learn_more), | ||
R.id.reminder_action_api_19_learn_more | ||
) | ||
) | ||
} | ||
|
||
override fun isDismissable(): Boolean { | ||
return false | ||
} | ||
|
||
override fun getImportance(): Importance { | ||
return Importance.TERMINAL | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
fun isEligible(): Boolean { | ||
return Build.VERSION.SDK_INT < 21 && !ExpiredBuildReminder.isEligible() | ||
} | ||
|
||
fun getExpireDate(): String { | ||
val formatter = SimpleDateFormat("MMMM d", Locale.getDefault()) | ||
val expireDate = Date(System.currentTimeMillis() + Util.getTimeUntilBuildExpiry()) | ||
return formatter.format(expireDate) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters