Skip to content

Commit

Permalink
Merge pull request #27
Browse files Browse the repository at this point in the history
v1.4.0: Add cursor control support.
  • Loading branch information
HoraceHuang-ui authored Aug 18, 2022
2 parents 5babfff + 882bdb0 commit 08ce5ee
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId 'com.horacehyy.freecalc'
minSdk 26
targetSdk 32
versionCode 8
versionName "1.3.0"
versionCode 9
versionName "1.4.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/example/freecalc/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class MainActivity : AppCompatActivity() {
binding.eqForm.setText(s.substring(0 until temp-1) + "_" + s[temp-1] + s.substring(temp+1))
binding.eqForm.setSelection(temp - 1)
}
}
}
binding.cursorRight?.setOnClickListener { _ ->
val temp = binding.eqForm.selectionStart
if (temp != binding.eqForm.length()-1) {
Expand Down
26 changes: 24 additions & 2 deletions app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@
tools:text="Result: 0"
app:layout_constraintBottom_toTopOf="@id/calc_button" />

<ImageButton
android:id="@+id/cursor_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/calc_button"
app:layout_constraintEnd_toStartOf="@id/calc_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@id/calc_button"
android:src="@drawable/ic_cursor_left"
android:backgroundTint="#00000000"/>

<Button
android:id="@+id/calc_button"
android:layout_width="0dp"
Expand All @@ -82,10 +93,21 @@
android:layout_margin="20dp"
android:textSize="18sp"
android:minHeight="@dimen/keyboard_button_minHeight"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/cursor_right"
app:layout_constraintStart_toEndOf="@id/cursor_left"
app:layout_constraintBottom_toBottomOf="parent"/>

<ImageButton
android:id="@+id/cursor_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/calc_button"
app:layout_constraintStart_toEndOf="@id/calc_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/calc_button"
android:src="@drawable/ic_cursor_right"
android:backgroundTint="#00000000"/>

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
Expand Down

0 comments on commit 08ce5ee

Please sign in to comment.