Fix pre 21 support

This commit is contained in:
topjohnwu 2021-02-20 03:38:39 -08:00
parent 9cc91b30b3
commit ccb55205e6
6 changed files with 13 additions and 11 deletions

View File

@ -38,7 +38,7 @@ withContext(Dispatchers.Default) {
add("pt-BR")
// Then add all supported locales
addAll(res.assets.locales)
addAll(Resources.getSystem().assets.locales)
}.map {
it.langTagToLocale()
}.distinctBy {

View File

@ -51,7 +51,7 @@ fun String.langTagToLocale(): Locale {
if (Build.VERSION.SDK_INT >= 21) {
return Locale.forLanguageTag(this)
} else {
val tok = split("-".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
val tok = split("[-_]".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
if (tok.isEmpty()) {
return Locale("")
}

View File

@ -3,9 +3,9 @@
<item>
<shape android:shape="rectangle">
<solid android:color="?colorSecondary" />
<solid android:color="@android:color/black" />
<corners android:bottomLeftRadius="2dp" android:bottomRightRadius="2dp" />
</shape>
</item>
</selector>
</selector>

View File

@ -3,9 +3,9 @@
<item>
<shape android:shape="rectangle">
<solid android:color="?colorSecondary" />
<solid android:color="@android:color/black" />
<corners android:topLeftRadius="2dp" android:topRightRadius="2dp" />
</shape>
</item>
</selector>
</selector>

View File

@ -29,14 +29,15 @@
tools:layout_gravity="center"
tools:minHeight="?listPreferredItemHeightSmall">
<View
<ImageView
android:id="@+id/track_top"
invisible="@{isTop}"
android:layout_width="2dp"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:alpha=".3"
android:background="@drawable/bg_line_bottom_rounded"
app:tint="?colorSecondary"
app:srcCompat="@drawable/bg_line_bottom_rounded"
app:layout_constraintBottom_toTopOf="@+id/track_bullet"
app:layout_constraintEnd_toEndOf="@+id/track_bullet"
app:layout_constraintStart_toStartOf="@+id/track_bullet"
@ -54,14 +55,15 @@
app:tint="@color/color_primary_error_transient"
tools:srcCompat="@drawable/ic_check_md2" />
<View
<ImageView
android:id="@+id/track_bottom"
invisible="@{isBottom}"
android:layout_width="2dp"
android:layout_height="0dp"
android:layout_marginTop="2dp"
android:alpha=".3"
android:background="@drawable/bg_line_top_rounded"
app:tint="?colorSecondary"
app:srcCompat="@drawable/bg_line_top_rounded"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/track_bullet"
app:layout_constraintStart_toStartOf="@+id/track_bullet"

View File

@ -145,7 +145,7 @@ static void exec_cmd(const char *action, vector<Extra> &data,
// Finally, fallback to start activity with component name
args[4] = "-n";
sprintf(target, "%s/a.m", info->str[SU_MANAGER].data());
sprintf(target, "%s/.ui.surequest.SuRequestActivity", info->str[SU_MANAGER].data());
exec.fd = -2;
exec.fork = fork_dont_care;
exec_command(exec);