implementation files("$buildDir/icu4j-57.1.small.jar") {
builtBy 'makesmallicu'
}
+ implementation 'com.android.support:preference-v7:25.3.1'
}
task makesmallicu (type:Exec, dependsOn: configurations.smallicu) {
def utildir = hasProperty("quickdicUtilDir") ? quickdicUtilDir : "Util"
+allprojects {
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
+ }
+}
+
android {
compileSdkVersion 29
lintOptions {
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ <fragment
+ android:name="com.hughes.android.dictionary.PreferenceFragment"
+ android:tag="com.hughes.android.dictionary.PreferenceFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+</FrameLayout>
<resources>
<style name="AppBaseThemeLight" parent="@style/Theme.AppCompat.Light">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
</style>
<style name="AppBaseThemeDark" parent="@style/Theme.AppCompat">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseThemeLight" parent="@style/Theme.AppCompat.Light">
-
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
</style>
<style name="AppBaseThemeDark" parent="@style/Theme.AppCompat">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceManager;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.support.annotation.NonNull;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
-import android.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceManager;
import android.support.v4.view.MenuItemCompat;
import android.util.Log;
import android.util.TypedValue;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
-import android.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceManager;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceManager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.os.Bundle;
import android.os.Build;
import android.os.Environment;
-import android.preference.ListPreference;
-import android.preference.PreferenceManager;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.preference.PreferenceManager;
+import android.support.v7.preference.ListPreference;
import java.io.File;
import java.util.List;
-public class PreferenceActivity extends android.preference.PreferenceActivity
+public class PreferenceActivity extends AppCompatActivity
implements SharedPreferences.OnSharedPreferenceChangeListener {
static boolean prefsMightHaveChanged = false;
* fashion
*/
super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.preferences);
- ListPreference defaultDic = (ListPreference) findPreference(getResources().getString(
- R.string.defaultDicKey));
- List<DictionaryInfo> dicts = application.getDictionariesOnDevice(null);
-
- final CharSequence[] entries = new CharSequence[dicts.size()];
- final CharSequence[] entryvalues = new CharSequence[dicts.size()];
-
- for (int i = 0; i < entries.length; ++i) {
- entries[i] = dicts.get(i).dictInfo;
- entryvalues[i] = dicts.get(i).uncompressedFilename;
- }
-
- defaultDic.setEntries(entries);
- defaultDic.setEntryValues(entryvalues);
+ setContentView(R.layout.preference_activity);
}
@Override
--- /dev/null
+package com.hughes.android.dictionary;
+
+import android.os.Bundle;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.PreferenceFragmentCompat;
+
+import java.util.List;
+
+public class PreferenceFragment extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String s) {
+ final DictionaryApplication application = DictionaryApplication.INSTANCE;
+ addPreferencesFromResource(R.xml.preferences);
+ ListPreference defaultDic = (ListPreference) findPreference(getResources().getString(
+ R.string.defaultDicKey));
+ List<DictionaryInfo> dicts = application.getDictionariesOnDevice(null);
+
+ final CharSequence[] entries = new CharSequence[dicts.size()];
+ final CharSequence[] entryvalues = new CharSequence[dicts.size()];
+
+ for (int i = 0; i < entries.length; ++i) {
+ entries[i] = dicts.get(i).dictInfo;
+ entryvalues[i] = dicts.get(i).uncompressedFilename;
+ }
+
+ defaultDic.setEntries(entries);
+ defaultDic.setEntryValues(entryvalues);
+ }
+}