hardware keyboard input enabled

This commit is contained in:
Sergey Solovyev 2012-12-02 15:57:22 +04:00
parent 7a4d4485de
commit cd025c3a89
2 changed files with 2 additions and 24 deletions

View File

@ -56,6 +56,7 @@
<item name="android:gravity">left|top</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:inputType">text</item>
<item name="android:textSize">@dimen/cpp_editor_text_size</item>
</style>

View File

@ -7,6 +7,7 @@ package org.solovyev.android.calculator;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
@ -65,30 +66,6 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe
super(context, attrs, defStyle);
}
@Override
public boolean onCheckIsTextEditor() {
// NOTE: code below can be used carefully and should not be copied without special intention
// The main purpose of code is to disable soft input (virtual keyboard) but leave all the TextEdit functionality, like cursor, scrolling, copy/paste menu etc
if (Build.VERSION.SDK_INT >= 11) {
// fix for missing cursor in android 3 and higher
try {
// IDEA: return false always except if method was called from TextView.isCursorVisible() method
for (StackTraceElement stackTraceElement : CollectionsUtils.asList(Thread.currentThread().getStackTrace())) {
if ("isCursorVisible".equals(stackTraceElement.getMethodName())) {
return true;
}
}
} catch (RuntimeException e) {
// just in case...
}
return false;
} else {
return false;
}
}
@Override
protected void onCreateContextMenu(ContextMenu menu) {
super.onCreateContextMenu(menu);