mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
remove unused code
This commit is contained in:
parent
3ec8315d03
commit
296f37c829
5 changed files with 5 additions and 128 deletions
|
@ -16,7 +16,6 @@ import android.text.InputType;
|
|||
|
||||
import org.dslul.openboard.inputmethod.keyboard.internal.keyboard_parser.LocaleKeyTexts;
|
||||
import org.dslul.openboard.inputmethod.latin.utils.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.util.Xml;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
|
||||
|
@ -55,7 +54,6 @@ public final class KeyboardLayoutSet {
|
|||
|
||||
private static final String TAG_KEYBOARD_SET = "KeyboardLayoutSet";
|
||||
private static final String TAG_ELEMENT = "Element";
|
||||
private static final String TAG_FEATURE = "Feature";
|
||||
|
||||
private static final String KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX = "keyboard_layout_set_";
|
||||
|
||||
|
@ -86,13 +84,6 @@ public final class KeyboardLayoutSet {
|
|||
}
|
||||
}
|
||||
|
||||
private static final class ElementParams {
|
||||
int mKeyboardXmlId;
|
||||
|
||||
public ElementParams() {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Params {
|
||||
String mKeyboardLayoutSetName;
|
||||
int mMode;
|
||||
|
@ -114,8 +105,6 @@ public final class KeyboardLayoutSet {
|
|||
// Indicates if the user has enabled the split-layout preference
|
||||
// and the required ProductionFlags are enabled.
|
||||
boolean mIsSplitLayoutEnabled;
|
||||
// Sparse array of KeyboardLayoutSet element parameters indexed by element's id.
|
||||
final SparseArray<ElementParams> mKeyboardLayoutSetElementIdToParamsMap = new SparseArray<>();
|
||||
}
|
||||
|
||||
public static void onSystemLocaleChanged() {
|
||||
|
@ -163,12 +152,6 @@ public final class KeyboardLayoutSet {
|
|||
break;
|
||||
}
|
||||
|
||||
ElementParams elementParams = mParams.mKeyboardLayoutSetElementIdToParamsMap.get(
|
||||
keyboardLayoutSetElementId);
|
||||
if (elementParams == null) {
|
||||
elementParams = mParams.mKeyboardLayoutSetElementIdToParamsMap.get(
|
||||
KeyboardId.ELEMENT_ALPHABET);
|
||||
}
|
||||
// Note: The keyboard for each shift state, and mode are represented as an elementName
|
||||
// attribute in a keyboard_layout_set XML file. Also each keyboard layout XML resource is
|
||||
// specified as an elementKeyboard attribute in the file.
|
||||
|
@ -176,7 +159,7 @@ public final class KeyboardLayoutSet {
|
|||
|
||||
final KeyboardId id = new KeyboardId(keyboardLayoutSetElementId, mParams);
|
||||
try {
|
||||
return getKeyboard(elementParams, id);
|
||||
return getKeyboard(id);
|
||||
} catch (final RuntimeException e) {
|
||||
Log.e(TAG, "Can't create keyboard: " + id, e);
|
||||
throw new KeyboardLayoutSetException(e, id);
|
||||
|
@ -184,7 +167,7 @@ public final class KeyboardLayoutSet {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
private Keyboard getKeyboard(final ElementParams elementParams, final KeyboardId id) {
|
||||
private Keyboard getKeyboard(final KeyboardId id) {
|
||||
final SoftReference<Keyboard> ref = sKeyboardCache.get(id);
|
||||
final Keyboard cachedKeyboard = (ref == null) ? null : ref.get();
|
||||
if (cachedKeyboard != null) {
|
||||
|
@ -197,8 +180,7 @@ public final class KeyboardLayoutSet {
|
|||
final KeyboardBuilder<KeyboardParams> builder =
|
||||
new KeyboardBuilder<>(mContext, new KeyboardParams(sUniqueKeysCache));
|
||||
sUniqueKeysCache.setEnabled(id.isAlphabetKeyboard());
|
||||
final int keyboardXmlId = elementParams.mKeyboardXmlId;
|
||||
builder.load(keyboardXmlId, id);
|
||||
builder.load(id);
|
||||
if (mParams.mDisableTouchPositionCorrectionDataForTest) {
|
||||
builder.disableTouchPositionCorrectionDataForTest();
|
||||
}
|
||||
|
@ -267,10 +249,8 @@ public final class KeyboardLayoutSet {
|
|||
public Builder setSubtype(@NonNull final RichInputMethodSubtype subtype) {
|
||||
final boolean asciiCapable = subtype.getRawSubtype().isAsciiCapable();
|
||||
// TODO: Consolidate with {@link InputAttributes}.
|
||||
@SuppressWarnings("deprecation") final boolean deprecatedForceAscii = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, FORCE_ASCII, mParams.mEditorInfo);
|
||||
final boolean forceAscii = (mParams.mEditorInfo.imeOptions & EditorInfo.IME_FLAG_FORCE_ASCII) != 0
|
||||
|| deprecatedForceAscii;
|
||||
|| InputAttributes.inPrivateImeOptions(mPackageName, FORCE_ASCII, mParams.mEditorInfo);
|
||||
final RichInputMethodSubtype keyboardSubtype = (forceAscii && !asciiCapable)
|
||||
? RichInputMethodSubtype.getNoLanguageSubtype()
|
||||
: subtype;
|
||||
|
@ -390,13 +370,6 @@ public final class KeyboardLayoutSet {
|
|||
R.styleable.KeyboardLayoutSet_Element_elementName, "elementName",
|
||||
TAG_ELEMENT, parser);
|
||||
XmlParseUtils.checkEndTag(TAG_ELEMENT, parser);
|
||||
|
||||
final ElementParams elementParams = new ElementParams();
|
||||
final int elementName = a.getInt(
|
||||
R.styleable.KeyboardLayoutSet_Element_elementName, 0);
|
||||
elementParams.mKeyboardXmlId = a.getResourceId(
|
||||
R.styleable.KeyboardLayoutSet_Element_elementKeyboard, 0);
|
||||
mParams.mKeyboardLayoutSetElementIdToParamsMap.put(elementName, elementParams);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
mParams.mAllowRedundantMoreKeys = enabled
|
||||
}
|
||||
|
||||
fun load(xmlId: Int, id: KeyboardId): KeyboardBuilder<KP> {
|
||||
fun load(id: KeyboardId): KeyboardBuilder<KP> {
|
||||
mParams.mId = id
|
||||
if (id.isEmojiKeyboard) {
|
||||
setAllowRedundantMoreKeys(true)
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
* modified
|
||||
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.dslul.openboard.inputmethod.latin.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public final class FileTransforms {
|
||||
public static OutputStream getCryptedStream(OutputStream out) {
|
||||
// Crypt the stream.
|
||||
return out;
|
||||
}
|
||||
|
||||
public static InputStream getDecryptedStream(InputStream in) {
|
||||
// Decrypt the stream.
|
||||
return in;
|
||||
}
|
||||
|
||||
public static InputStream getUncompressedStream(InputStream in) throws IOException {
|
||||
return new GZIPInputStream(in);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
* modified
|
||||
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.dslul.openboard.inputmethod.latin.utils;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
public final class IntentUtils {
|
||||
private static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
|
||||
// TODO: Can these be constants instead of literal String constants?
|
||||
private static final String INPUT_METHOD_SUBTYPE_SETTINGS =
|
||||
"android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
|
||||
|
||||
private IntentUtils() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
|
||||
public static Intent getInputLanguageSelectionIntent(final String inputMethodId,
|
||||
final int flagsForSubtypeSettings) {
|
||||
// Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
|
||||
final String action = INPUT_METHOD_SUBTYPE_SETTINGS;
|
||||
final Intent intent = new Intent(action);
|
||||
if (!TextUtils.isEmpty(inputMethodId)) {
|
||||
intent.putExtra(EXTRA_INPUT_METHOD_ID, inputMethodId);
|
||||
}
|
||||
if (flagsForSubtypeSettings > 0) {
|
||||
intent.setFlags(flagsForSubtypeSettings);
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
* modified
|
||||
* SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.dslul.openboard.inputmethod.latin.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dslul.openboard.inputmethod.annotations.UsedForTesting;
|
||||
|
||||
public class ManagedProfileUtils {
|
||||
private static ManagedProfileUtils INSTANCE = new ManagedProfileUtils();
|
||||
private static ManagedProfileUtils sTestInstance;
|
||||
|
||||
private ManagedProfileUtils() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
public static void setTestInstance(final ManagedProfileUtils testInstance) {
|
||||
sTestInstance = testInstance;
|
||||
}
|
||||
|
||||
public static ManagedProfileUtils getInstance() {
|
||||
return sTestInstance == null ? INSTANCE : sTestInstance;
|
||||
}
|
||||
|
||||
public boolean hasWorkProfile(final Context context) {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue