* totally refactored the Languages, the Database and the IME module. New and more clear folder/package structure * CharMap and LangHelper are no more * removed many unused icons, translations and other resources * deleted the old keymap samples * Update user-manual.md * Preferences are stored in Preferences, not in the database. * removed some unclear and unused settings from the Preferences screen and the code. * fixed issues with displaying the UI * removed all non-English words and words with foreign spelling from the English dictionary * 0 now works as it should in all modes. * a more clear newline character in suggestions view * last used input mode is now preserved and restored the next time * removed the smiley and symbol dialogs * capsMode -> textCase * language names are no longer translated * updated build instructions * better use of threads for DB operations * current text candidate is as long as the sequence, to make it more intuitive * single characters are added to the end of the suggestion, when there are no more in the database * Added ѝ to Bulgarian character map * disabled adding words in a user-friendly manner * when adding a new word is not possible, a toast message appears, for better user experience * an error is logged when there are duplicate language IDs * settings -> settings_legacy * custom Logger class for easier debugging and no logcat flood in the Release version * removed unnecessary single letters and invalid words from the dictionaries * more translations cleanup; also corrected some weird translations * upgraded gradle
39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package io.github.sspanak.tt9.settings_legacy;
|
|
|
|
// http://stackoverflow.com/a/8488691
|
|
|
|
import android.content.Context;
|
|
import android.content.res.XmlResourceParser;
|
|
import android.util.AttributeSet;
|
|
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
|
|
import java.lang.reflect.Constructor;
|
|
import java.util.ArrayList;
|
|
|
|
public class CustomInflater {
|
|
public static ArrayList<Setting> inflate(Context context, int xmlFileResId, Object[] isettings)
|
|
throws Exception {
|
|
ArrayList<Setting> settings = new ArrayList<Setting>();
|
|
|
|
XmlResourceParser parser = context.getResources().getXml(xmlFileResId);
|
|
int token;
|
|
while ((token = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
|
if (token == XmlPullParser.START_TAG) {
|
|
if (!parser.getName().equals("Settings")) {
|
|
//prepend package
|
|
Class aClass = Class.forName("io.github.sspanak.tt9.settings_legacy."+parser.getName());
|
|
Class<?>[] params = new Class[]{Context.class, AttributeSet.class, isettings.getClass()};
|
|
Constructor<?> constructor = aClass.getConstructor(params);
|
|
try {
|
|
settings.add((Setting) constructor.newInstance(context, parser, isettings));
|
|
} catch (InstantiationException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return settings;
|
|
}
|
|
}
|