diff --git a/src/com/edlplan/ui/fragment/SearchBarFragment.kt b/src/com/edlplan/ui/fragment/SearchBarFragment.kt index d798882df..298bfb056 100644 --- a/src/com/edlplan/ui/fragment/SearchBarFragment.kt +++ b/src/com/edlplan/ui/fragment/SearchBarFragment.kt @@ -21,17 +21,15 @@ import com.edlplan.ui.EasingHelper import com.reco1l.osu.mainThread import com.reco1l.toolkt.android.cornerRadius import com.reco1l.toolkt.android.dp -import org.anddev.andengine.engine.handler.IUpdateHandler import org.anddev.andengine.entity.scene.Scene import ru.nsu.ccfit.zuev.osu.* -import ru.nsu.ccfit.zuev.osu.helper.InputManager import ru.nsu.ccfit.zuev.osu.helper.StringTable import ru.nsu.ccfit.zuev.osu.menu.IFilterMenu import ru.nsu.ccfit.zuev.osu.menu.SongMenu import ru.nsu.ccfit.zuev.osuplus.R import ru.nsu.ccfit.zuev.osu.GlobalManager.getInstance as getGlobal -class SearchBarFragment : BaseFragment(), IUpdateHandler, IFilterMenu { +class SearchBarFragment : BaseFragment(), IFilterMenu { private var configContext: Context? = null private var savedFolder: String? = null private var savedFavOnly = false @@ -322,16 +320,6 @@ class SearchBarFragment : BaseFragment(), IUpdateHandler, IFilterMenu { updater?.update() } - override fun onUpdate(pSecondsElapsed: Float) { - if (InputManager.getInstance().isChanged) { - filter.setText(InputManager.getInstance().text) - } - } - - override fun reset() { - TODO("Not yet implemented") - } - // Due to how the fragment lifecycle works in this context, the state needs to be saved manually private companion object { var folder: String? = null diff --git a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java index 5cf710ed5..7b8b1ea8f 100644 --- a/src/ru/nsu/ccfit/zuev/osu/MainActivity.java +++ b/src/ru/nsu/ccfit/zuev/osu/MainActivity.java @@ -80,7 +80,6 @@ import ru.nsu.ccfit.zuev.audio.serviceAudio.SaveServiceObject; import ru.nsu.ccfit.zuev.audio.serviceAudio.SongService; import ru.nsu.ccfit.zuev.osu.helper.FileUtils; -import ru.nsu.ccfit.zuev.osu.helper.InputManager; import ru.nsu.ccfit.zuev.osu.helper.StringTable; import ru.nsu.ccfit.zuev.osu.menu.LoadingScreen; import ru.nsu.ccfit.zuev.osu.menu.ModMenu; @@ -122,7 +121,6 @@ public Engine onLoadEngine() { //Debug.setDebugLevel(Debug.DebugLevel.NONE); StringTable.setContext(this); ToastLogger.init(this); - InputManager.setContext(this); OnlineManager.getInstance().init(); crashlytics.setUserId(Config.getOnlineDeviceID()); @@ -774,9 +772,6 @@ public boolean onKeyDown(final int keyCode, final KeyEvent event) { && GlobalManager.getInstance().getSongMenu().getScene().hasChildScene()) { if (GlobalManager.getInstance().getSongMenu().getScene().getChildScene() == GlobalManager.getInstance().getSongMenu().getSearchBar().getScene()) { - if (keyCode == KeyEvent.KEYCODE_ENTER) { - InputManager.getInstance().toggleKeyboard(); - } GlobalManager.getInstance().getSongMenu().getSearchBar().hideMenu(); } @@ -828,16 +823,6 @@ public boolean onKeyDown(final int keyCode, final KeyEvent event) { return true; } - if (InputManager.getInstance().isStarted()) { - if (keyCode == KeyEvent.KEYCODE_DEL) { - InputManager.getInstance().pop(); - } else if (keyCode != KeyEvent.KEYCODE_ENTER) { - final char c = (char) event.getUnicodeChar(); - if (c != 0) { - InputManager.getInstance().append(c); - } - } - } return super.onKeyDown(keyCode, event); } diff --git a/src/ru/nsu/ccfit/zuev/osu/helper/InputManager.java b/src/ru/nsu/ccfit/zuev/osu/helper/InputManager.java deleted file mode 100644 index ab6266695..000000000 --- a/src/ru/nsu/ccfit/zuev/osu/helper/InputManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package ru.nsu.ccfit.zuev.osu.helper; - -import android.content.Context; -import android.view.inputmethod.InputMethodManager; - -public class InputManager { - private static Context context; - private static InputManager instance = new InputManager(); - private boolean inputStarted = false; - private boolean changed = true; - private StringBuilder builder; - private int maxlength; - private InputManager() { - } - - public static void setContext(final Context context) { - InputManager.context = context; - } - - public static InputManager getInstance() { - return instance; - } - - public void startInput(final String start, final int maxlength) { - this.maxlength = maxlength; - builder = new StringBuilder(start); - changed = true; - inputStarted = true; - toggleKeyboard(); - } - - public void toggleKeyboard() { - final InputMethodManager mgr = (InputMethodManager) context - .getSystemService(Context.INPUT_METHOD_SERVICE); - mgr.toggleSoftInput(0, 0); - } - - public void append(final char c) { - if (!inputStarted) { - return; - } - if (builder.length() >= maxlength) { - return; - } - changed = true; - builder.append(c); - } - - public void pop() { - if (!inputStarted || builder.length() == 0) { - return; - } - changed = true; - builder.deleteCharAt(builder.length() - 1); - } - - public String getText() { - if (!inputStarted) { - return ""; - } - changed = false; - return builder.toString(); - } - - public void setText(final String text) { - builder = new StringBuilder(text); - changed = true; - } - - public boolean isChanged() { - return changed; - } - - public boolean isStarted() { - return inputStarted; - } - - public String finish() { - inputStarted = false; - final String str = builder.toString(); - builder = null; - return str; - } -}