Bugfixes: Keyboard hides after convert; cursor is now shown
This commit is contained in:
parent
9a8059577e
commit
20badbff2b
5 changed files with 21 additions and 18 deletions
|
@ -109,15 +109,7 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
|
|||
super.onDrawerOpened(view);
|
||||
// This closes the soft keyboard, when the drawer is opened
|
||||
try {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
if (getCurrentSection() == writtenMorse) {
|
||||
EditText myEditText = (EditText) findViewById(R.id.editTextWrittenMorse);
|
||||
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
|
||||
} else if (getCurrentSection() == normalMorse) {
|
||||
EditText myEditText = (EditText) findViewById(R.id.editTextNormalMorse);
|
||||
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
|
||||
}
|
||||
closeKeyboard();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -174,6 +166,18 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void closeKeyboard(){
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
if (getCurrentSection() == writtenMorse) {
|
||||
EditText myEditText = (EditText) findViewById(R.id.editTextWrittenMorse);
|
||||
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
|
||||
} else if (getCurrentSection() == normalMorse) {
|
||||
EditText myEditText = (EditText) findViewById(R.id.editTextNormalMorse);
|
||||
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void normalMorseEncode(View view){
|
||||
try{
|
||||
EditText input = (EditText) findViewById(R.id.editTextNormalMorse);
|
||||
|
@ -183,6 +187,7 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
|
|||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
output.setText(EncodeNormalMorseManager.getEncodedString(input.getText().toString()));
|
||||
closeKeyboard();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -197,7 +202,7 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
|
|||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
output.setText(DecodeNormalMorseManager.getDecodedString(input.getText().toString()));
|
||||
|
||||
closeKeyboard();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -212,6 +217,7 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
|
|||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
output.setText(EncodeWrittenMorseManager.getEncodedString(input.getText().toString()));
|
||||
closeKeyboard();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -226,6 +232,7 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro
|
|||
cardView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
output.setText(DecodeWrittenMorseManager.getDecodedString(input.getText().toString()));
|
||||
closeKeyboard();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -70,8 +70,7 @@
|
|||
android:scrollbars="vertical"
|
||||
android:minLines="5"
|
||||
android:singleLine="false"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:textCursorDrawable="@color/colorPrimary"/>
|
||||
android:background="@color/cardview_light_background"/>
|
||||
|
||||
<View
|
||||
style="@style/Divider"
|
||||
|
|
|
@ -70,8 +70,7 @@
|
|||
android:ems="10"
|
||||
android:hint="@string/edit_message"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:minLines="5"
|
||||
android:textCursorDrawable="@color/colorPrimary">
|
||||
android:minLines="5">
|
||||
</EditText>
|
||||
|
||||
<View
|
||||
|
|
|
@ -69,8 +69,7 @@
|
|||
android:scrollbars="vertical"
|
||||
android:minLines="5"
|
||||
android:singleLine="false"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:textCursorDrawable="@color/colorPrimary"/>
|
||||
android:background="@color/cardview_light_background"/>
|
||||
|
||||
<View
|
||||
style="@style/Divider"
|
||||
|
|
|
@ -69,8 +69,7 @@
|
|||
android:ems="10"
|
||||
android:hint="@string/edit_message"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:minLines="5"
|
||||
android:textCursorDrawable="@color/colorPrimary">
|
||||
android:minLines="5">
|
||||
</EditText>
|
||||
|
||||
<View
|
||||
|
|
Reference in a new issue