This Repository is to solve the flashing problem when switching the keyboard and the customized panel. In addition, an editor that handles the keyword tag is provided.
Including three main functions:
- Eliminating the screen frashing when the customized panel and the keyboard switch between each other. The layout of a control bar above the soft keyboard is not affected in the same time.
- Hidding the keyboard and the panel by touching outside the
EditText
.- Adding a new function to
EditText
-- the ability to handle the tags, including automatically highlight, adding by click, adding by typing and delete.
-
Smooth the switch between the keyboard and the panel while the control bar staying at the same position on the screen. The keys are :
- Calculate the height of soft keyboard. Refer to LayoutChangeListener.java.
- Switch the soft input mode between ADJUST_ NOTHING and ADJUST_RESIZE. Refer to LayoutHandlerImp.java.
-
Add a new function that handling tags to the EditText. The keys are :
- Overwrite the delete event in
OnKeyListener
interface in order to delete tag by tag instead of by letter. Refer to RichOnKeyListener.java. - Overwrite
TextWatcher
in order to add and highlight each input keyword as a tag. Refer to RichTextWatcher.java.
- Overwrite the delete event in
This demo shows the critical steps when imports the modulelibHTagEditor
in your host project.
- Inflate layout and obtain element references.
- Create data and item layout of tags.
- Create all the handler instances. Firstly, to create the main handler
LayoutHandlerImp
. Secondly, to register the listenerRichTextWatcher
for EditText. Thirdly, to register the listenerSwitcherChangedListener
for switch button. Finally, to register the layout listenerLayoutChangeListener
for the global layout. - Unregister the layout listener when Activity is destroied.
Copyright (C) 2017. Henry Tam (Hosle)
Contact: hosle@163.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.