Skip to content

Commit

Permalink
Fix small behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryosuke839 committed Sep 15, 2024
1 parent 164ec84 commit a0cccce
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "jp.ddo.hotmist.unicodepad"
minSdkVersion 21
targetSdkVersion 34
versionCode 62
versionName "2.14.0"
versionCode 63
versionName "2.14.1"
}

compileOptions {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/jp/ddo/hotmist/unicodepad/FindAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ internal class FindAdapter(activity: Activity, private val pref: SharedPreferenc
activity.theme.resolveAttribute(R.attr.search, it, true)
}.resourceId, null))
val text = AutoCompleteTextView(activity)
text.id = R.id.searchText
text.setSingleLine()
text.setText(saved)
text.setHint(R.string.fhint)
Expand Down
21 changes: 16 additions & 5 deletions app/src/main/java/jp/ddo/hotmist/unicodepad/UnicodeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class UnicodeActivity : BaseActivity() {
AndroidView(
factory = { context ->
if (useEmoji != "null") { AppCompatEditText(context) } else { EditText(context) }.apply {
id = R.id.editText
setOnTouchListener { view: View, motionEvent: MotionEvent ->
view.onTouchEvent(motionEvent)
if (disableime) (getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(
Expand All @@ -165,7 +166,7 @@ class UnicodeActivity : BaseActivity() {
maxLines = if (multiline) 3 else 1
inputType = InputType.TYPE_CLASS_TEXT or if (multiline) InputType.TYPE_TEXT_FLAG_MULTI_LINE else 0
setOnEditorActionListener { _, actionId, keyEvent ->
if (keyEvent?.keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_DOWN || actionId == EditorInfo.IME_ACTION_DONE) {
if (keyEvent?.keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_DOWN && !multiline || actionId == EditorInfo.IME_ACTION_DONE) {
btnFinish.performClick()
true
} else
Expand Down Expand Up @@ -530,6 +531,7 @@ class UnicodeActivity : BaseActivity() {
}
}
}
bottomSheetBackCallback.isEnabled = false
behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
bottomSheetBackCallback.isEnabled = newState != BottomSheetBehavior.STATE_HIDDEN
Expand Down Expand Up @@ -940,13 +942,22 @@ class UnicodeActivity : BaseActivity() {
disableime = pref.getBoolean("ime", true)
showBtnClear = pref.getBoolean("clear", false)
showBtnRow = pref.getBoolean("buttons", true)
scrollUi = (pref.getString("scroll", null)?.toIntOrNull() ?: 1) + (if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) 1 else 0) > 1
if (created) {
editText.textSize = fontsize
adpPage.notifyDataSetChanged()
scrollUi = (pref.getString("scroll", null)?.toIntOrNull() ?: 1) + (if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) 1 else 0) > 1
val multiline = pref.getBoolean("multiline", false)
editText.maxLines = if (multiline) 3 else 1
editText.inputType = InputType.TYPE_CLASS_TEXT or if (multiline) InputType.TYPE_TEXT_FLAG_MULTI_LINE else 0
editText.apply {
val multiline = pref.getBoolean("multiline", false)
editText.maxLines = if (multiline) 3 else 1
editText.inputType = InputType.TYPE_CLASS_TEXT or if (multiline) InputType.TYPE_TEXT_FLAG_MULTI_LINE else 0
setOnEditorActionListener { _, actionId, keyEvent ->
if (keyEvent?.keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_DOWN && !multiline || actionId == EditorInfo.IME_ACTION_DONE) {
btnFinish.performClick()
true
} else
false
}
}
}
if (requestCode != -1) {
adCompat.renderAdToContainer(this, pref)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
<item name="fontBar" type="id"/>
<item name="finish" type="id"/>
<item name="adContainer" type="id"/>
<item name="editText" type="id"/>
<item name="searchText" type="id"/>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
Copyright © 1991-2023 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in
http://www.unicode.org/copyright.html.</string>
<string name="legal_app" translatable="false">UnicodePad 2.14.0</string>
<string name="legal_app" translatable="false">UnicodePad 2.14.1</string>
<string name="legal_app2" translatable="false">UnicodePad is licensed under the Apache License, Version2.0
https://github.com/Ryosuke839/UnicodePad</string>
</resources>

0 comments on commit a0cccce

Please sign in to comment.