fixed the 'SoftKeyXXX can only be used with a Theme.AppCompat theme (or descendant)' error
This commit is contained in:
parent
df4ec5478f
commit
57d7fc4a1f
3 changed files with 12 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:tools="http://schemas.android.com/tools"
|
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:versionCode="611"
|
android:versionCode="609"
|
||||||
android:versionName="35.12"
|
android:versionName="35.10"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <!-- allows displaying notifications on Android >= 13 -->
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <!-- allows displaying notifications on Android >= 13 -->
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/Theme.AppCompat.DayNight"
|
android:theme="@style/TT9Theme"
|
||||||
android:supportsRtl="true">
|
android:supportsRtl="true">
|
||||||
|
|
||||||
<service android:name="io.github.sspanak.tt9.ime.TraditionalT9" android:permission="android.permission.BIND_INPUT_METHOD"
|
<service android:name="io.github.sspanak.tt9.ime.TraditionalT9" android:permission="android.permission.BIND_INPUT_METHOD"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package io.github.sspanak.tt9.ui.main;
|
package io.github.sspanak.tt9.ui.main;
|
||||||
|
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
|
@ -7,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import io.github.sspanak.tt9.R;
|
||||||
import io.github.sspanak.tt9.ime.TraditionalT9;
|
import io.github.sspanak.tt9.ime.TraditionalT9;
|
||||||
import io.github.sspanak.tt9.ui.main.keys.SoftKey;
|
import io.github.sspanak.tt9.ui.main.keys.SoftKey;
|
||||||
|
|
||||||
|
|
@ -47,7 +49,11 @@ abstract class BaseMainLayout {
|
||||||
|
|
||||||
protected View getView() {
|
protected View getView() {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
view = View.inflate(tt9.getApplicationContext(), xml, null);
|
// Adding the ContextThemeWrapper fixes this error log:
|
||||||
|
// "View class SoftKeyXXX is an AppCompat widget that can only be used with a
|
||||||
|
// Theme.AppCompat theme (or descendant)."
|
||||||
|
ContextThemeWrapper themedCtx = new ContextThemeWrapper(tt9, R.style.TT9Theme);
|
||||||
|
view = View.inflate(themedCtx, xml, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<style name="TT9Theme" parent="Theme.AppCompat.DayNight" />
|
||||||
|
|
||||||
<style name="hSeparator">
|
<style name="hSeparator">
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
<item name="android:layout_width">3dp</item>
|
<item name="android:layout_width">3dp</item>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue