Skip to content

feat: add input field for testing#2040

Merged
goofyz merged 5 commits into
osfans:developfrom
goofyz:fix-1987
Jul 6, 2026
Merged

feat: add input field for testing#2040
goofyz merged 5 commits into
osfans:developfrom
goofyz:fix-1987

Conversation

@goofyz

@goofyz goofyz commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Pull request

Issue tracker

Fixes will automatically close the related issues

Fixes #1987

Feature

Add a input field for testing different input type in the main screen.

Code of conduct

Code style

Build pass

  • make debug

Manually test

  • Done

Code Review

  1. No wildcards import
  2. Manual build and test pass
  3. GitHub Action CI pass
  4. At least one contributor review and approve
  5. Merged clean without conflicts
  6. PR will be merged by rebase upstream base

Daily build

Login and download artifact at https://github.com/osfans/trime/actions

Additional Info

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “Test input” panel to the app’s main screen so users can bring up the keyboard and quickly verify different inputType behaviors (text/number/password/phone/email/url), with persistence for panel visibility/expanded state.

Changes:

  • Introduces TestInputPanel custom view with input-type pills, clear button, collapse/hide actions, and preference persistence.
  • Integrates the panel into activity_main.xml and adds a toolbar action to restore it when hidden.
  • Adds supporting resources (strings/localizations, colors, backgrounds, and icons).

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/src/main/res/values/themes.xml Adds pill TextView style used by the input-type selector.
app/src/main/res/values/strings.xml Adds English strings for the test input panel and actions.
app/src/main/res/values/colors.xml Adds day-mode colors for the panel background/stroke states.
app/src/main/res/values-night/colors.xml Adds night-mode colors for the panel background/stroke states.
app/src/main/res/values-zh-rTW/strings.xml Adds zh-TW strings for the test input panel.
app/src/main/res/values-zh-rCN/strings.xml Adds zh-CN strings for the test input panel.
app/src/main/res/layout/test_input_panel.xml New layout for the panel UI (header, pills, edit field, clear/hide/collapse).
app/src/main/res/layout/activity_main.xml Places TestInputPanel on the main screen and adjusts content layout sizing.
app/src/main/res/drawable/bg_test_input_panel.xml Background shape for the panel container.
app/src/main/res/drawable/bg_test_input_field.xml Selector background for the test EditText focus state.
app/src/main/res/drawable/bg_input_type_pill.xml Selector background for pill selection state.
app/src/main/res/color/text_input_type_pill.xml Color state list for pill text (selected vs unselected).
app/src/main/res/drawable/ic_baseline_phone_24.xml New icon for phone input type pill.
app/src/main/res/drawable/ic_baseline_numbers_24.xml New icon for number input type pill.
app/src/main/res/drawable/ic_baseline_lock_24.xml New icon for password input type pill.
app/src/main/res/drawable/ic_baseline_link_24.xml New icon for URL input type pill.
app/src/main/res/drawable/ic_baseline_email_24.xml New icon for email input type pill.
app/src/main/java/com/osfans/trime/ui/main/TestInputPanel.kt Implements the panel behavior, selection logic, and preference persistence.
app/src/main/java/com/osfans/trime/ui/main/MainActivity.kt Binds panel visibility to a “Show test input” toolbar item and adjusts insets for IME.
app/src/main/java/com/osfans/trime/data/prefs/AppPrefs.kt Adds persisted preferences for test input visibility/expanded state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +51 to +55
setBackgroundResource(R.drawable.bg_test_input_panel)
val paddingPx = (12 * resources.displayMetrics.density).toInt()
setPadding(paddingPx, paddingPx, paddingPx, paddingPx)
binding = TestInputPanelBinding.inflate(LayoutInflater.from(context), this)
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not correct. Custom view should not call this method.

Comment on lines +36 to +38
private val binding: TestInputPanelBinding
private val activity = context as FragmentActivity
private var onVisibilityChanged: ((visible: Boolean) -> Unit)? = null
Comment on lines +231 to +234
val icon = ContextCompat.getDrawable(context, iconRes)?.mutate()
pill.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null)
TextViewCompat.setCompoundDrawableTintList(pill, pill.textColors)
}
Comment on lines +16 to +20
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M20.5,10L21,8h-4l1,-4h-2l-1,4h-4l1,-4h-2L9,8H5l-0.5,2h4l-1,4h-4L3,16h4l-1,4h2l1,-4h4l-1,4h2l1,-4h4l0.5,-2h-4l1,-4H20.5zM13.5,14h-4l1,-4h4L13.5,14z"/>

</vector>

@Bambooin Bambooin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified this patch, please fix the reasonable comments by copilot.

@goofyz

goofyz commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

Suggestions (beside the first one) by copolit are committed.

@goofyz
goofyz merged commit 9c25449 into osfans:develop Jul 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

在APP主畫面新增輸入欄位

3 participants