This commit is contained in:
lijia 2022-04-03 18:17:37 +08:00
parent e1cdff0d5b
commit 2c12943daf
67 changed files with 7127 additions and 537 deletions

View File

@ -11,6 +11,7 @@
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/keybordlib" />
<option value="$PROJECT_DIR$/mylibrary" />
</set>
</option>

View File

@ -114,4 +114,5 @@ dependencies {
implementation project(path: ':mylibrary')
implementation project(path: ':keybordlib')
}

View File

@ -2367,6 +2367,11 @@
"area": [
"中原区",
"金水区",
"高新区",
"航空港区",
"国际物流园区",
"经开区",
"郑东新区",
"二七区",
"管城回族区",
"上街区",

View File

@ -14,6 +14,7 @@ public class BusInfoBean implements Serializable {
private String code;
private String enterpriseName;
private String pwd;
private String unifiedSocialCreditCode;//统一社会信用代码
private String nationalClassA;//国家A级
private String businessType;//业务类型
private String avatarUrl;
@ -25,6 +26,14 @@ public class BusInfoBean implements Serializable {
private String name;//厂区地址
private ParamsDao params;
public String getUnifiedSocialCreditCode() {
return unifiedSocialCreditCode;
}
public void setUnifiedSocialCreditCode(String unifiedSocialCreditCode) {
this.unifiedSocialCreditCode = unifiedSocialCreditCode;
}
public String getName() {
return name;
}

View File

@ -22,6 +22,7 @@ public class PassBean implements Serializable {
private String driverPhone;
private String startPoint;
private String endPoint;
private String driverIdcard;
private String createTime;
private String startTime;
private String endTime;
@ -45,6 +46,14 @@ public class PassBean implements Serializable {
private String notUsedNumMF;
private String notUsedNumSF;
public String getDriverIdcard() {
return driverIdcard;
}
public void setDriverIdcard(String driverIdcard) {
this.driverIdcard = driverIdcard;
}
public String getNotUsedNumMF() {
return notUsedNumMF;
}

View File

@ -1,19 +1,37 @@
package com.dahe.pass.ui.account.activity
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import android.os.Handler
import android.os.Message
import android.view.View
import android.widget.Toast
import com.bigkoo.pickerview.builder.OptionsPickerBuilder
import com.bigkoo.pickerview.view.OptionsPickerView
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.pass.R
import com.dahe.pass.base.AppConfig
import com.dahe.pass.bean.BusInfoBean
import com.dahe.pass.bean.JsonBean
import com.dahe.pass.net.BaseObserver
import com.dahe.pass.net.DataManager
import com.dahe.pass.net.RxHttpCallBack
import com.dahe.pass.ui.account.LoginActivity
import com.dahe.pass.utils.AppActivityUtils
import com.dahe.pass.utils.GetJsonDataUtil
import com.google.gson.Gson
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.util.KeyboardUtils
import kotlinx.android.synthetic.main.activity_add_go.*
import kotlinx.android.synthetic.main.activity_apply.*
import kotlinx.android.synthetic.main.activity_apply.etPhone
import kotlinx.android.synthetic.main.activity_business_info.*
import kotlinx.android.synthetic.main.activity_business_info.etQymc
import org.json.JSONArray
import java.util.ArrayList
/**
* @ClassName BusinessInfoActivity
@ -29,6 +47,8 @@ class BusinessInfoActivity : BaseActivity(), View.OnClickListener {
btnGo.setOnClickListener(this)
tv_yhxy.setOnClickListener(this)
tv_yszc.setOnClickListener(this)
etDj.setOnClickListener(this)
etDz.setOnClickListener(this)
}
override fun initDate() {
@ -36,39 +56,63 @@ class BusinessInfoActivity : BaseActivity(), View.OnClickListener {
override fun onClick(view: View) {
super.onClick(view)
when(view.id){
R.id.btnGo->go()
when (view.id) {
R.id.btnGo -> go()
R.id.etDz -> {
KeyboardUtils.hideSoftInput(etQymc)
if (isLoaded) {
setProText()
} else {
mHandler.sendEmptyMessage(MSG_LOAD_DATA)
}
}
R.id.tv_yhxy -> AppActivityUtils.openWebViewActivity(this,
"用户服务协议",
"https://downtest.dahehuodongbao.com/passcheck/user-agreement.html");
R.id.tv_yszc -> AppActivityUtils.openWebViewActivity(this, "隐私政策",
"https://downtest.dahehuodongbao.com/passcheck/user-privacy.html")
R.id.etDj -> {
XPopup.Builder(this).hasShadowBg(false).offsetY(50).atView(etDj)
.popupWidth(500)
.asAttachList(arrayOf("2A", "3A", "4A", "5A", "其他"),
null,
{ position, text -> etDj.text = text }).show()
}
}
}
fun go(){
fun go() {
val qymc = etQymc.text.toString()
val ywlx = etYwlx.text.toString()
// val ywlx = etYwlx.text.toString()
val etDz = etDz.text.toString()
val etTbr = etTbr.text.toString()
if (qymc.isNullOrEmpty()){
if (qymc.isNullOrEmpty()) {
showToast("请输入企业名称")
return
}
if (ywlx.isNullOrEmpty()){
showToast("请输入业务类型")
return
}
// if (ywlx.isNullOrEmpty()) {
// showToast("请输入业务类型")
// return
// }
if (etDz.isNullOrEmpty()){
if (etDz.isNullOrEmpty()) {
showToast("请输入注册地址")
return
}
if (etNsr.text.toString().isNullOrEmpty() || etFzr.text.toString().isNullOrEmpty() ||
etFzrPhone.text.toString().isNullOrEmpty() || etDj.text.toString().isNullOrEmpty() ||
etGsdz.text.toString().isNullOrEmpty()
) {
showToast("请完善信息")
return
}
val extras = intent.extras
val bean : BusInfoBean= extras?.getSerializable(AppConfig.BEAN) as BusInfoBean
val bean: BusInfoBean = extras?.getSerializable(AppConfig.BEAN) as BusInfoBean
val busInfoBean = BusInfoBean()
val paramsDao = BusInfoBean.ParamsDao()
@ -76,12 +120,13 @@ class BusinessInfoActivity : BaseActivity(), View.OnClickListener {
busInfoBean.phone = bean.phone
busInfoBean.params = paramsDao
busInfoBean.pwd = bean.pwd
busInfoBean.unifiedSocialCreditCode = etNsr.text.toString()
busInfoBean.enterpriseName = qymc
busInfoBean.nationalClassA = etDj.text.toString()
busInfoBean.businessType = ywlx
// busInfoBean.businessType = ywlx
busInfoBean.placeOfRegistration = etDz
busInfoBean.companyAddress = etGsdz.text.toString()
busInfoBean.plantAddress = etCqdz.text.toString()
// busInfoBean.plantAddress = etCqdz.text.toString()
busInfoBean.contacts = etFzr.text.toString()
busInfoBean.contactsPhone = etFzrPhone.text.toString()
busInfoBean.name = etTbr
@ -90,11 +135,134 @@ class BusinessInfoActivity : BaseActivity(), View.OnClickListener {
DataManager.getInstance().register(busInfoBean)
.compose(DataManager.setThread())
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<Any>(){
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<Any>?) {
super.onSuccess(t)
ActivityUtils.finishOtherActivities(LoginActivity::class.java)
}
}))
}
private var options1Items = ArrayList<JsonBean>()
private val options2Items = ArrayList<ArrayList<String>>()
private val options3Items = ArrayList<ArrayList<ArrayList<String>>>()
private val MSG_LOAD_DATA = 0x0001
private val MSG_LOAD_SUCCESS = 0x0002
private val MSG_LOAD_FAILED = 0x0003
private var thread: Thread? = null
private var isLoaded = false
private fun setProText() {
val pvOptions: OptionsPickerView<*> = OptionsPickerBuilder(this
) { options1, options2, options3, v ->
//返回的分别是三个级别的选中位置
val opt1tx =
if (options1Items.size > 0) options1Items.get(options1).getPickerViewText() else ""
val opt2tx = if (options2Items.size > 0
&& options2Items.get(options1).size > 0
) options2Items.get(options1).get(options2) else ""
val opt3tx =
if (options2Items.size > 0 && options3Items.get(options1).size > 0 && options3Items.get(
options1).get(options2).size > 0
) options3Items.get(options1).get(options2).get(options3) else ""
val tx = "$opt1tx-$opt2tx-$opt3tx"
etDz.text = tx
}
.setSubmitColor(Color.parseColor("#F1474B")) //确定按钮文字颜色
.setCancelColor(Color.parseColor("#F1474B")) //取消按钮文字颜色
.setTitleBgColor(Color.parseColor("#FFFFFF"))
.setBgColor(Color.parseColor("#F5F5F5"))
.setContentTextSize(20)
.build<Any>()
pvOptions.setPicker(options1Items as List<Nothing>?,
options2Items as List<Nothing>?, options3Items as List<Nothing>?) //三级选择器
pvOptions.show()
}
private fun initJsonData() { //解析数据
/**
* 注意assets 目录下的Json文件仅供参考实际使用可自行替换文件
* 关键逻辑在于循环体
*
*/
val JsonData: String =
GetJsonDataUtil().getJson(this, "province.json") //获取assets目录下的json文件数据
// String JsonData1 = new GetJsonDataUtil().getJson(this, "city.json");//获取assets目录下的json文件数据
val jsonBean: ArrayList<JsonBean> = parseData(JsonData) //用Gson 转成实体
// ArrayList<Province> data = getData(JsonData1);
/**
* 添加省份数据
*
* 注意如果是添加的JavaBean实体则实体类需要实现 IPickerViewData 接口
* PickerView会通过getPickerViewText方法获取字符串显示出来
*/
options1Items = jsonBean
for (i in jsonBean.indices) { //遍历省份
val cityList = ArrayList<String>() //该省的城市列表(第二级)
val province_AreaList = ArrayList<ArrayList<String>>() //该省的所有地区列表(第三极)
for (c in 0 until jsonBean[i].cityList.size) { //遍历该省份的所有城市
val cityName = jsonBean[i].cityList[c].name
cityList.add(cityName) //添加城市
val city_AreaList = ArrayList<String>() //该城市的所有地区列表
//如果无地区数据建议添加空字符串防止数据为null 导致三个选项长度不匹配造成崩溃
/*if (jsonBean.get(i).getCityList().get(c).getArea() == null
|| jsonBean.get(i).getCityList().get(c).getArea().size() == 0) {
city_AreaList.add("");
} else {
city_AreaList.addAll(jsonBean.get(i).getCityList().get(c).getArea());
}*/city_AreaList.addAll(jsonBean[i].cityList[c].area)
province_AreaList.add(city_AreaList) //添加该省所有地区数据
}
/**
* 添加城市数据
*/
options2Items.add(cityList)
/**
* 添加地区数据
*/
options3Items.add(province_AreaList)
}
mHandler.sendEmptyMessage(MSG_LOAD_SUCCESS)
}
fun parseData(result: String): ArrayList<JsonBean> { //Gson 解析
val detail = ArrayList<JsonBean>()
try {
val data = JSONArray(result)
val gson = Gson()
for (i in 0 until data.length()) {
val entity = gson.fromJson(data.optJSONObject(i).toString(), JsonBean::class.java)
detail.add(entity)
}
} catch (e: Exception) {
e.printStackTrace()
mHandler.sendEmptyMessage(MSG_LOAD_FAILED)
}
return detail
}
@SuppressLint("HandlerLeak")
private val mHandler: Handler = object : Handler() {
override fun handleMessage(msg: Message) {
when (msg.what) {
MSG_LOAD_DATA -> if (thread == null) { //如果已创建就不再重新创建子线程了
thread = Thread { // 子线程中解析省市区数据
initJsonData()
}
thread?.start()
}
MSG_LOAD_SUCCESS -> {
// Toast.makeText(MyInfoActivity.this, "Parse Succeed", Toast.LENGTH_SHORT).show();
setProText()
isLoaded = true
}
MSG_LOAD_FAILED -> Toast.makeText(this@BusinessInfoActivity,
"地区解析失败",
Toast.LENGTH_SHORT).show()
}
}
}
}

View File

@ -26,6 +26,7 @@ import com.dahe.pass.net.RxHttpCallBack
import com.dahe.pass.utils.GetJsonDataUtil
import com.dahe.pass.utils.SPUtils
import com.google.gson.Gson
import com.king.keyboard.KingKeyboard
import com.lxj.xpopup.util.KeyboardUtils
import kotlinx.android.synthetic.main.activity_add_go.*
import org.json.JSONArray
@ -39,6 +40,8 @@ import java.util.*
* @Description TODO
*/
class AddGoActivity : BaseActivity(), View.OnClickListener {
private lateinit var kingKeyboard : KingKeyboard
override fun getLayout() = R.layout.activity_add_go
override fun initView(savedInstanceState: Bundle?) {
@ -50,13 +53,29 @@ class AddGoActivity : BaseActivity(), View.OnClickListener {
tvStartTime.setOnClickListener(this)
tvEndTime.setOnClickListener(this)
tvSflx.setOnClickListener(this)
tvSTime.text = SPUtils.get(mContext,AppConfig.START_TIME, "").toString()
tvETime.text = SPUtils.get(mContext,AppConfig.END_TIME, "").toString()
// tvSTime.text = SPUtils.get(mContext,AppConfig.START_TIME, "").toString()
// tvETime.text = SPUtils.get(mContext,AppConfig.END_TIME, "").toString()
kingKeyboard = KingKeyboard(this,keyboardParent)
kingKeyboard.register(etCarNum,KingKeyboard.KeyboardType.LICENSE_PLATE_PROVINCE)
}
override fun initDate() {
}
/**
* 在Activity或Fragment的生命周期中调用对应的方法
*/
override fun onResume() {
super.onResume()
kingKeyboard.onResume()
}
override fun onDestroy() {
super.onDestroy()
kingKeyboard.onDestroy()
}
override fun onClick(view: View) {
super.onClick(view)
when (view.id) {
@ -73,10 +92,10 @@ class AddGoActivity : BaseActivity(), View.OnClickListener {
fun sub() {
KeyboardUtils.hideSoftInput(tvTxbh)
if (tvTxbh.text.toString().isNullOrEmpty() || tvSTime.text.toString().isNullOrEmpty() ||
if (tvTxbh.text.toString().isNullOrEmpty() ||
etCarNum.text.toString().isNullOrEmpty() || etName.text.toString().isNullOrEmpty() ||
etPhone.text.toString().isNullOrEmpty() || etWpzl.text.toString().isNullOrEmpty() ||
etDs.text.toString().isNullOrEmpty() || etQd.text.toString().isNullOrEmpty()|| tvSflx.text.toString().isNullOrEmpty()
etDs.text.toString().isNullOrEmpty() || etQd.text.toString().isNullOrEmpty()|| etCardId.text.toString().isNullOrEmpty()
) {
showToast("请完善信息")
return
@ -84,7 +103,7 @@ class AddGoActivity : BaseActivity(), View.OnClickListener {
val passBean = PassBean()
passBean.passNo = tvTxbh.text.toString()
passBean.passNo = """FG-${tvTxbh.text.toString()}"""
passBean.vehicle = etCarNum.text.toString()
passBean.driverName = etName.text.toString()
passBean.driverPhone = etPhone.text.toString()
@ -92,12 +111,13 @@ class AddGoActivity : BaseActivity(), View.OnClickListener {
passBean.transportTonnage = etDs.text.toString()
passBean.startPoint = etQd.text.toString()
passBean.endPoint = etZd.text.toString()
passBean.driverIdcard = etCardId.text.toString()
passBean.useStartTime = tvSTime.text.toString()
passBean.useEndTime = tvETime.text.toString()
// passBean.useEndTime = tvETime.text.toString()
passBean.startTime = tvStartTime.text.toString()
passBean.endTime = tvEndTime.text.toString()
passBean.remarks = tvBz.text.toString()
passBean.chargeType = tvSflx.text.toString()
// passBean.chargeType = tvSflx.text.toString()
DataManager.getInstance().addPass(passBean)
.compose(DataManager.setThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {

View File

@ -67,6 +67,7 @@ class EditGoActivity : BaseActivity(), View.OnClickListener {
tvStartTime.text = passBean.startTime
tvEndTime.text = passBean.endTime
tvSflx.text = passBean.chargeType
etCardId.text = passBean.driverIdcard
}
}

View File

@ -55,7 +55,7 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
override fun initDate() {
DataManager.getInstance().userInfo
.compose(DataManager.setThread())
.subscribe(BaseObserver(mContext,object :RxHttpCallBack<BusInfoBean>(){
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<BusInfoBean>() {
override fun onSuccess(t: CommonResponseBean<BusInfoBean>?) {
super.onSuccess(t)
etQymc.text = t?.data?.enterpriseName
@ -112,8 +112,8 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
// Toast.makeText(this@MainActivity, str, Toast.LENGTH_SHORT).show()
}
.build<CompanyBean>()
mutableListOf.add(CompanyBean("免费","0"))
mutableListOf.add(CompanyBean("收费","1"))
mutableListOf.add(CompanyBean("免费", "0"))
mutableListOf.add(CompanyBean("收费", "1"))
@ -131,7 +131,7 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
jb = mutableListOf.get(options1).signName
tvJb.text = mutableListOf.get(options1).signName
}
.setTitleText("国家A")
.setTitleText("国家")
.setContentTextSize(20) //设置滚轮文字大小
.setDividerColor(Color.LTGRAY) //设置分割线的颜色
.setSelectOptions(0, 1) //默认选中项
@ -151,11 +151,11 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
// Toast.makeText(this@MainActivity, str, Toast.LENGTH_SHORT).show()
}
.build<CompanyBean>()
mutableListOf.add(CompanyBean(""))
mutableListOf.add(CompanyBean("A"))
mutableListOf.add(CompanyBean("AA"))
mutableListOf.add(CompanyBean("AAA"))
mutableListOf.add(CompanyBean("AAAA"))
mutableListOf.add(CompanyBean("2A"))
mutableListOf.add(CompanyBean("3A"))
mutableListOf.add(CompanyBean("4A"))
mutableListOf.add(CompanyBean("5A"))
mutableListOf.add(CompanyBean("其他"))
@ -235,7 +235,7 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
val mutableListOf = mutableListOf<CompanyTypeBean>()
val build = OptionsPickerBuilder(mContext
) { options1, options2, options3, v -> //返回的分别是三个级别的选中位置
if (options1>=mutableListOf.size)
if (options1 >= mutableListOf.size)
return@OptionsPickerBuilder
curCompanyType = mutableListOf.get(options1)
tvQylx.text = mutableListOf.get(options1).enterpriseTypeName
@ -277,10 +277,10 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
fun sub() {
if (!::curCompanyBean.isInitialized || !::curCompanyType.isInitialized || !::jb.isInitialized ||
if (!::curCompanyBean.isInitialized || !::jb.isInitialized ||
!::shi.isInitialized || etQymc.text.toString().isNullOrEmpty() ||
etLxr.text.toString().isNullOrEmpty() || etPhone.text.toString().isNullOrEmpty() ||
etCl.text.toString().isNullOrEmpty() || etTxz.text.toString().isNullOrEmpty()|| tvSflx.text.toString().isNullOrEmpty()
etCl.text.toString().isNullOrEmpty() || etTxz.text.toString().isNullOrEmpty()
) {
showToast("请完善信息")
return
@ -289,7 +289,7 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
val applySendBean = ApplySendBean()
applySendBean.sign = curCompanyBean.sign
applySendBean.enterpriseName = etQymc.text.toString()
applySendBean.typeId = curCompanyType.typeId
// applySendBean.typeId = curCompanyType.typeId
applySendBean.provinceName = sheng
applySendBean.cityName = shi
applySendBean.countyName = xian
@ -298,7 +298,7 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
applySendBean.enterpriseContactPhone = etPhone.text.toString()
applySendBean.vehiclesNumber = etCl.text.toString()
applySendBean.numberOfPassesRequired = etTxz.text.toString()
applySendBean.chargeType = tvSflx.text.toString()
// applySendBean.chargeType = tvSflx.text.toString()
DataManager.getInstance().applySend(applySendBean)
.compose(DataManager.setThread())
@ -361,7 +361,7 @@ class ApplyActivity : BaseActivity(), View.OnClickListener {
.setCancelColor(Color.parseColor("#F1474B")) //取消按钮文字颜色
.setTitleBgColor(Color.parseColor("#FFFFFF"))
.setBgColor(Color.parseColor("#F5F5F5"))
.setSelectOptions(15,0,0)
.setSelectOptions(15, 0, 0)
.setContentTextSize(20)
.build<Any>()
pvOptions.setPicker(options1Items as List<Nothing>?,

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
@ -51,6 +52,7 @@
android:background="@color/color_line"></View>
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
@ -113,6 +115,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
@ -120,6 +123,7 @@
android:background="@color/color_line"></View>
<LinearLayout
android:visibility="gone"
android:id="@+id/llQylx"
android:layout_width="match_parent"
android:layout_height="50dp"
@ -272,6 +276,7 @@
android:gravity="right"
android:hint="请输入电话"
android:maxLength="11"
android:inputType="phone"
android:paddingRight="6dp"
android:textSize="14dp"></EditText>

View File

@ -54,7 +54,7 @@
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="企业名称,必填"
android:hint="企业名称"
android:maxLength="11"
android:maxLines="1"></EditText>
@ -84,7 +84,38 @@
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="管理人姓名,必填"
android:hint="法人人姓名"
android:maxLength="11"
android:maxLines="1"></EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="26dp"
android:layout_marginTop="20dp"
android:layout_marginRight="26dp"
android:background="@drawable/shape_gray_bg25"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/nsr"></ImageView>
<EditText
android:id="@+id/etNsr"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="统一社会信用代码"
android:maxLength="11"
android:maxLines="1"></EditText>
@ -115,7 +146,7 @@
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="负责人,必填"
android:hint="通行证管理人"
android:maxLength="11"
android:maxLines="1"></EditText>
@ -146,7 +177,7 @@
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="负责人电话,必填"
android:hint="管理人电话"
android:maxLength="11"
android:maxLines="1"></EditText>
@ -173,7 +204,9 @@
android:layout_height="wrap_content"
android:background="@drawable/dj"></ImageView>
<EditText
<TextView
android:textSize="16dp"
android:gravity="center_vertical"
android:id="@+id/etDj"
android:layout_width="match_parent"
android:layout_height="40dp"
@ -181,13 +214,16 @@
android:background="@null"
android:ellipsize="end"
android:hint="等级"
android:textColor="@color/black"
android:textStyle=""
android:maxLength="11"
android:maxLines="1"></EditText>
android:maxLines="1"></TextView>
</LinearLayout>
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="26dp"
@ -211,7 +247,7 @@
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="业务类型,必填"
android:hint="业务类型"
android:maxLength="11"
android:maxLines="1"></EditText>
@ -235,16 +271,19 @@
android:layout_height="wrap_content"
android:background="@drawable/dz"></ImageView>
<EditText
<TextView
android:gravity="center_vertical"
android:textSize="16dp"
android:id="@+id/etDz"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:background="@null"
android:ellipsize="end"
android:hint="注册地址,必填"
android:hint="注册地址"
android:maxLength="11"
android:maxLines="1"></EditText>
android:textColor="@color/black"
android:maxLines="1"></TextView>
</LinearLayout>
@ -274,13 +313,14 @@
android:layout_weight="1"
android:background="@null"
android:ellipsize="end"
android:hint="公司地址"
android:hint="公司园区地址"
android:maxLines="1"></EditText>
</LinearLayout>
<LinearLayout
android:visibility="gone"
android:id="@+id/ll_pass"
android:layout_width="match_parent"
android:layout_height="50dp"

View File

@ -41,6 +41,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
@ -48,6 +49,7 @@
android:background="@color/color_line"></View>
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
@ -73,6 +75,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
@ -81,6 +84,7 @@
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
@ -106,6 +110,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
@ -114,6 +119,7 @@
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
@ -205,6 +211,43 @@
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@color/color_line"></View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="6dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="司机身份证号"
android:textColor="@color/black"></TextView>
<TextView
android:id="@+id/etCardId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:gravity="right"
android:paddingRight="6dp"
android:maxLength="18"
android:maxLines="1"
android:singleLine="true"
android:inputType="number"
android:digits="0123456789xyzXYZ"
android:textSize="14dp"></TextView>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@ -151,6 +151,7 @@
</LinearLayout>
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginTop="4dp"

View File

@ -126,6 +126,7 @@
</LinearLayout>
<LinearLayout
android:visibility="gone"
android:layout_marginTop="6dp"
android:layout_width="match_parent"
android:layout_height="20dp"

View File

@ -182,6 +182,7 @@
</LinearLayout>
<TextView
android:visibility="gone"
android:id="@+id/tvType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -53,6 +53,7 @@
android:textSize="10dp"></TextView>
<TextView
android:visibility="gone"
android:id="@+id/tvType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

1
keybordlib/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

12
keybordlib/bintray.gradle Normal file
View File

@ -0,0 +1,12 @@
apply plugin: 'com.novoda.bintray-release'
//
publish {
userOrg = 'jenly'//bintray.com用户名
groupId = 'com.king.keyboard'//jcenter上的路径
artifactId = 'kingkeyboard'//
publishVersion = app_version.versionName//
desc = 'KingKeyboard for Android'//
website = 'https://github.com/jenly1314/KingKeyboard'//
licences = ['MIT']//
}

42
keybordlib/build.gradle Normal file
View File

@ -0,0 +1,42 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
//apply from: 'bintray.gradle'
//apply plugin: "com.vanniktech.maven.publish"
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
warning 'InvalidPackage'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.31"
compileOnly "androidx.appcompat:appcompat:1.1.0"
testImplementation "junit:junit:4.12"
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
}

View File

View File

@ -0,0 +1,3 @@
POM_NAME=KingKeyboard
POM_ARTIFACT_ID=kingkeyboard
POM_PACKAGING=aar

21
keybordlib/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,24 @@
package com.king.keyboard
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.king.keyboard.test", appContext.packageName)
}
}

View File

@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.king.keyboard" >
<!-- 震动权限 -->
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>

View File

@ -0,0 +1,913 @@
package com.king.keyboard;
/*
* Copyright (C) 2008-2009 Google Inc.
*
* 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.
*/
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
import androidx.annotation.XmlRes;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard
* consists of rows of keys.
* <p>The layout file for a keyboard contains XML that looks like the following snippet:</p>
* <pre>
* &lt;Keyboard
* android:keyWidth="%10p"
* android:keyHeight="50px"
* android:horizontalGap="2px"
* android:verticalGap="2px" &gt;
* &lt;Row android:keyWidth="32px" &gt;
* &lt;Key android:keyLabel="A" /&gt;
* ...
* &lt;/Row&gt;
* ...
* &lt;/Keyboard&gt;
* </pre>
* @attr ref android.R.styleable#King_Keyboard_keyWidth
* @attr ref android.R.styleable#King_Keyboard_keyHeight
* @attr ref android.R.styleable#King_Keyboard_horizontalGap
* @attr ref android.R.styleable#King_Keyboard_verticalGap
* This class is deprecated because this is just a convenient UI widget class that
* application developers can re-implement on top of existing public APIs. If you have
* already depended on this class, consider copying the implementation from AOSP into
* your project or re-implementing a similar widget by yourselves
*/
public class Keyboard {
static final String TAG = "Keyboard";
// Keyboard XML Tags
private static final String TAG_KEYBOARD = "Keyboard";
private static final String TAG_ROW = "Row";
private static final String TAG_KEY = "Key";
public static final int EDGE_LEFT = 0x01;
public static final int EDGE_RIGHT = 0x02;
public static final int EDGE_TOP = 0x04;
public static final int EDGE_BOTTOM = 0x08;
public static final int KEYCODE_SHIFT = -1;
public static final int KEYCODE_MODE_CHANGE = -2;
public static final int KEYCODE_CANCEL = -3;
public static final int KEYCODE_DONE = -4;
public static final int KEYCODE_DELETE = -5;
public static final int KEYCODE_ALT = -6;
/** Keyboard label **/
private CharSequence mLabel;
/** Horizontal gap default for all rows */
private int mDefaultHorizontalGap;
/** Default key width */
private int mDefaultWidth;
/** Default key height */
private int mDefaultHeight;
/** Default gap between rows */
private int mDefaultVerticalGap;
/** Is the keyboard in the shifted state */
private boolean mShifted;
/** Key instance for the shift key, if present */
private Key[] mShiftKeys = { null, null };
/** Key index for the shift key, if present */
private int[] mShiftKeyIndices = {-1, -1};
/** Current key width, while loading the keyboard */
private int mKeyWidth;
/** Current key height, while loading the keyboard */
private int mKeyHeight;
/** Total height of the keyboard, including the padding and keys */
private int mTotalHeight;
/**
* Total width of the keyboard, including left side gaps and keys, but not any gaps on the
* right side.
*/
private int mTotalWidth;
/** List of keys in this keyboard */
private List<Key> mKeys;
/** List of modifier keys such as Shift & Alt, if any */
private List<Key> mModifierKeys;
/** Width of the screen available to fit the keyboard */
private int mDisplayWidth;
/** Height of the screen */
private int mDisplayHeight;
/** Keyboard mode, or zero, if none. */
private int mKeyboardMode;
// Variables for pre-computing nearest keys.
private static final int GRID_WIDTH = 10;
private static final int GRID_HEIGHT = 5;
private static final int GRID_SIZE = GRID_WIDTH * GRID_HEIGHT;
private int mCellWidth;
private int mCellHeight;
private int[][] mGridNeighbors;
private int mProximityThreshold;
/** Number of key widths from current touch point to search for nearest keys. */
private static float SEARCH_DISTANCE = 1.8f;
private ArrayList<Row> rows = new ArrayList<>();
/**
* Container for keys in the keyboard. All keys in a row are at the same Y-coordinate.
* Some of the key size defaults can be overridden per row from what the {@link Keyboard}
* defines.
* @attr ref android.R.styleable#King_Keyboard_keyWidth
* @attr ref android.R.styleable#King_Keyboard_keyHeight
* @attr ref android.R.styleable#King_Keyboard_horizontalGap
* @attr ref android.R.styleable#King_Keyboard_verticalGap
* @attr ref android.R.styleable#King_Keyboard_Row_rowEdgeFlags
* @attr ref android.R.styleable#King_Keyboard_Row_keyboardMode
*/
public static class Row {
/** Default width of a key in this row. */
public int defaultWidth;
/** Default height of a key in this row. */
public int defaultHeight;
/** Default horizontal gap between keys in this row. */
public int defaultHorizontalGap;
/** Vertical gap following this row. */
public int verticalGap;
ArrayList<Key> mKeys = new ArrayList<>();
/**
* Edge flags for this row of keys. Possible values that can be assigned are
* {@link Keyboard#EDGE_TOP EDGE_TOP} and {@link Keyboard#EDGE_BOTTOM EDGE_BOTTOM}
*/
public int rowEdgeFlags;
/** The keyboard mode for this row */
public int mode;
private Keyboard parent;
public Row(Keyboard parent) {
this.parent = parent;
}
public Row(Resources res, Keyboard parent, XmlResourceParser parser) {
this.parent = parent;
TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard);
defaultWidth = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyWidth,
parent.mDisplayWidth, parent.mDefaultWidth);
defaultHeight = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyHeight,
parent.mDisplayHeight, parent.mDefaultHeight);
defaultHorizontalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_horizontalGap,
parent.mDisplayWidth, parent.mDefaultHorizontalGap);
verticalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_verticalGap,
parent.mDisplayHeight, parent.mDefaultVerticalGap);
a.recycle();
a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard_Row);
rowEdgeFlags = a.getInt(R.styleable.King_Keyboard_Row_android_rowEdgeFlags, 0);
mode = a.getResourceId(R.styleable.King_Keyboard_Row_android_keyboardMode,
0);
}
}
/**
* Class for describing the position and characteristics of a single key in the keyboard.
*
* @attr ref android.R.styleable#King_Keyboard_keyWidth
* @attr ref android.R.styleable#King_Keyboard_keyHeight
* @attr ref android.R.styleable#King_Keyboard_horizontalGap
* @attr ref android.R.styleable#King_Keyboard_Key_codes
* @attr ref android.R.styleable#King_Keyboard_Key_keyIcon
* @attr ref android.R.styleable#King_Keyboard_Key_keyLabel
* @attr ref android.R.styleable#King_Keyboard_Key_iconPreview
* @attr ref android.R.styleable#King_Keyboard_Key_isSticky
* @attr ref android.R.styleable#King_Keyboard_Key_isRepeatable
* @attr ref android.R.styleable#King_Keyboard_Key_isModifier
* @attr ref android.R.styleable#King_Keyboard_Key_popupKeyboard
* @attr ref android.R.styleable#King_Keyboard_Key_popupCharacters
* @attr ref android.R.styleable#King_Keyboard_Key_keyOutputText
* @attr ref android.R.styleable#King_Keyboard_Key_keyEdgeFlags
*/
public static class Key {
/**
* All the key codes (unicode or custom code) that this key could generate, zero'th
* being the most important.
*/
public int[] codes;
/** Label to display */
public CharSequence label;
/** Icon to display instead of a label. Icon takes precedence over a label */
public Drawable icon;
/** Preview version of the icon, for the preview popup */
public Drawable iconPreview;
/** Width of the key, not including the gap */
public int width;
/** Height of the key, not including the gap */
public int height;
/** The horizontal gap before this key */
public int gap;
/** Whether this key is sticky, i.e., a toggle key */
public boolean sticky;
/** X coordinate of the key in the keyboard layout */
public int x;
/** Y coordinate of the key in the keyboard layout */
public int y;
/** The current pressed state of this key */
public boolean pressed;
/** If this is a sticky key, is it on? */
public boolean on;
/** Text to output when pressed. This can be multiple characters, like ".com" */
public CharSequence text;
/** Popup characters */
public CharSequence popupCharacters;
/**
* Flags that specify the anchoring to edges of the keyboard for detecting touch events
* that are just out of the boundary of the key. This is a bit mask of
* {@link Keyboard#EDGE_LEFT}, {@link Keyboard#EDGE_RIGHT}, {@link Keyboard#EDGE_TOP} and
* {@link Keyboard#EDGE_BOTTOM}.
*/
public int edgeFlags;
/** Whether this is a modifier key, such as Shift or Alt */
public boolean modifier;
/** The keyboard that this key belongs to */
private Keyboard keyboard;
/**
* If this key pops up a mini keyboard, this is the resource id for the XML layout for that
* keyboard.
*/
public int popupResId;
/** Whether this key repeats itself when held down */
public boolean repeatable;
private final static int[] KEY_STATE_NORMAL_ON = {
android.R.attr.state_checkable,
android.R.attr.state_checked
};
private final static int[] KEY_STATE_PRESSED_ON = {
android.R.attr.state_pressed,
android.R.attr.state_checkable,
android.R.attr.state_checked
};
private final static int[] KEY_STATE_NORMAL_OFF = {
android.R.attr.state_checkable
};
private final static int[] KEY_STATE_PRESSED_OFF = {
android.R.attr.state_pressed,
android.R.attr.state_checkable
};
private final static int[] KEY_STATE_NORMAL = {
};
private final static int[] KEY_STATE_PRESSED = {
android.R.attr.state_pressed
};
/** Create an empty key with no attributes. */
public Key(Row parent) {
keyboard = parent.parent;
height = parent.defaultHeight;
width = parent.defaultWidth;
gap = parent.defaultHorizontalGap;
edgeFlags = parent.rowEdgeFlags;
}
/** Create a key with the given top-left coordinate and extract its attributes from
* the XML parser.
* @param res resources associated with the caller's context
* @param parent the row that this key belongs to. The row must already be attached to
* a {@link Keyboard}.
* @param x the x coordinate of the top-left
* @param y the y coordinate of the top-left
* @param parser the XML parser containing the attributes for this key
*/
public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) {
this(parent);
this.x = x;
this.y = y;
TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard);
width = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyWidth,
keyboard.mDisplayWidth, parent.defaultWidth);
height = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyHeight,
keyboard.mDisplayHeight, parent.defaultHeight);
gap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_horizontalGap,
keyboard.mDisplayWidth, parent.defaultHorizontalGap);
a.recycle();
a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard_Key);
this.x += gap;
TypedValue codesValue = new TypedValue();
a.getValue(R.styleable.King_Keyboard_Key_android_codes,
codesValue);
if (codesValue.type == TypedValue.TYPE_INT_DEC
|| codesValue.type == TypedValue.TYPE_INT_HEX) {
codes = new int[] { codesValue.data };
} else if (codesValue.type == TypedValue.TYPE_STRING) {
codes = parseCSV(codesValue.string.toString());
}
iconPreview = a.getDrawable(R.styleable.King_Keyboard_Key_android_iconPreview);
if (iconPreview != null) {
iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(),
iconPreview.getIntrinsicHeight());
}
popupCharacters = a.getText(
R.styleable.King_Keyboard_Key_android_popupCharacters);
popupResId = a.getResourceId(
R.styleable.King_Keyboard_Key_android_popupKeyboard, 0);
repeatable = a.getBoolean(
R.styleable.King_Keyboard_Key_android_isRepeatable, false);
modifier = a.getBoolean(
R.styleable.King_Keyboard_Key_android_isModifier, false);
sticky = a.getBoolean(
R.styleable.King_Keyboard_Key_android_isSticky, false);
edgeFlags = a.getInt(R.styleable.King_Keyboard_Key_android_keyEdgeFlags, 0);
edgeFlags |= parent.rowEdgeFlags;
icon = a.getDrawable(
R.styleable.King_Keyboard_Key_android_keyIcon);
if (icon != null) {
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
}
label = a.getText(R.styleable.King_Keyboard_Key_android_keyLabel);
text = a.getText(R.styleable.King_Keyboard_Key_android_keyOutputText);
if (codes == null && !TextUtils.isEmpty(label)) {
codes = new int[] { label.charAt(0) };
}
a.recycle();
}
/**
* Informs the key that it has been pressed, in case it needs to change its appearance or
* state.
* @see #onReleased(boolean)
*/
public void onPressed() {
pressed = !pressed;
}
/**
* Changes the pressed state of the key.
*
* <p>Toggled state of the key will be flipped when all the following conditions are
* fulfilled:</p>
*
* <ul>
* <li>This is a sticky key, that is, {@link #sticky} is {@code true}.
* <li>The parameter {@code inside} is {@code true}.
* <li>{@link android.os.Build.VERSION#SDK_INT} is greater than
* {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}.
* </ul>
*
* @param inside whether the finger was released inside the key. Works only on Android M and
* later. See the method document for details.
* @see #onPressed()
*/
public void onReleased(boolean inside) {
pressed = !pressed;
if (sticky && inside) {
on = !on;
}
}
int[] parseCSV(String value) {
int count = 0;
int lastIndex = 0;
if (value.length() > 0) {
count++;
while ((lastIndex = value.indexOf(",", lastIndex + 1)) > 0) {
count++;
}
}
int[] values = new int[count];
count = 0;
StringTokenizer st = new StringTokenizer(value, ",");
while (st.hasMoreTokens()) {
try {
values[count++] = Integer.parseInt(st.nextToken());
} catch (NumberFormatException nfe) {
Log.e(TAG, "Error parsing keycodes " + value);
}
}
return values;
}
/**
* Detects if a point falls inside this key.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return whether or not the point falls inside the key. If the key is attached to an edge,
* it will assume that all points between the key and the edge are considered to be inside
* the key.
*/
public boolean isInside(int x, int y) {
boolean leftEdge = (edgeFlags & EDGE_LEFT) > 0;
boolean rightEdge = (edgeFlags & EDGE_RIGHT) > 0;
boolean topEdge = (edgeFlags & EDGE_TOP) > 0;
boolean bottomEdge = (edgeFlags & EDGE_BOTTOM) > 0;
if ((x >= this.x || (leftEdge && x <= this.x + this.width))
&& (x < this.x + this.width || (rightEdge && x >= this.x))
&& (y >= this.y || (topEdge && y <= this.y + this.height))
&& (y < this.y + this.height || (bottomEdge && y >= this.y))) {
return true;
} else {
return false;
}
}
/**
* Returns the square of the distance between the center of the key and the given point.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return the square of the distance of the point from the center of the key
*/
public int squaredDistanceFrom(int x, int y) {
int xDist = this.x + width / 2 - x;
int yDist = this.y + height / 2 - y;
return xDist * xDist + yDist * yDist;
}
/**
* Returns the drawable state for the key, based on the current state and type of the key.
* @return the drawable state of the key.
* @see android.graphics.drawable.StateListDrawable#setState(int[])
*/
public int[] getCurrentDrawableState() {
int[] states = KEY_STATE_NORMAL;
if (on) {
if (pressed) {
states = KEY_STATE_PRESSED_ON;
} else {
states = KEY_STATE_NORMAL_ON;
}
} else {
if (sticky) {
if (pressed) {
states = KEY_STATE_PRESSED_OFF;
} else {
states = KEY_STATE_NORMAL_OFF;
}
} else {
if (pressed) {
states = KEY_STATE_PRESSED;
}
}
}
return states;
}
}
/**
* Creates a keyboard from the given xml key layout file.
* @param context the application or service context
* @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
*/
public Keyboard(Context context, int xmlLayoutResId) {
this(context, xmlLayoutResId, 0);
}
/**
* Creates a keyboard from the given xml key layout file. Weeds out rows
* that have a keyboard mode defined but don't match the specified mode.
* @param context the application or service context
* @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
* @param modeId keyboard mode identifier
* @param width sets width of keyboard
* @param height sets height of keyboard
*/
public Keyboard(Context context, @XmlRes int xmlLayoutResId, int modeId, int width,
int height) {
mDisplayWidth = width;
mDisplayHeight = height;
mDefaultHorizontalGap = 0;
mDefaultWidth = mDisplayWidth / 10;
mDefaultVerticalGap = 0;
mDefaultHeight = mDefaultWidth;
mKeys = new ArrayList<>();
mModifierKeys = new ArrayList<>();
mKeyboardMode = modeId;
loadKeyboard(context, context.getResources().getXml(xmlLayoutResId));
}
/**
* Creates a keyboard from the given xml key layout file. Weeds out rows
* that have a keyboard mode defined but don't match the specified mode.
* @param context the application or service context
* @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
* @param modeId keyboard mode identifier
*/
public Keyboard(Context context, @XmlRes int xmlLayoutResId, int modeId) {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
mDisplayWidth = dm.widthPixels;
mDisplayHeight = dm.heightPixels;
//Log.v(TAG, "keyboard's display metrics:" + dm);
mDefaultHorizontalGap = 0;
mDefaultWidth = mDisplayWidth / 10;
mDefaultVerticalGap = 0;
mDefaultHeight = mDefaultWidth;
mKeys = new ArrayList<>();
mModifierKeys = new ArrayList<>();
mKeyboardMode = modeId;
loadKeyboard(context, context.getResources().getXml(xmlLayoutResId));
}
/**
* <p>Creates a blank keyboard from the given resource file and populates it with the specified
* characters in left-to-right, top-to-bottom fashion, using the specified number of columns.
* </p>
* <p>If the specified number of columns is -1, then the keyboard will fit as many keys as
* possible in each row.</p>
* @param context the application or service context
* @param layoutTemplateResId the layout template file, containing no keys.
* @param characters the list of characters to display on the keyboard. One key will be created
* for each character.
* @param columns the number of columns of keys to display. If this number is greater than the
* number of keys that can fit in a row, it will be ignored. If this number is -1, the
* keyboard will fit as many keys as possible in each row.
*/
public Keyboard(Context context, int layoutTemplateResId,
CharSequence characters, int columns, int horizontalPadding) {
this(context, layoutTemplateResId);
int x = 0;
int y = 0;
int column = 0;
mTotalWidth = 0;
Row row = new Row(this);
row.defaultHeight = mDefaultHeight;
row.defaultWidth = mDefaultWidth;
row.defaultHorizontalGap = mDefaultHorizontalGap;
row.verticalGap = mDefaultVerticalGap;
row.rowEdgeFlags = EDGE_TOP | EDGE_BOTTOM;
final int maxColumns = columns == -1 ? Integer.MAX_VALUE : columns;
for (int i = 0; i < characters.length(); i++) {
char c = characters.charAt(i);
if (column >= maxColumns
|| x + mDefaultWidth + horizontalPadding > mDisplayWidth) {
x = 0;
y += mDefaultVerticalGap + mDefaultHeight;
column = 0;
}
final Key key = new Key(row);
key.x = x;
key.y = y;
key.label = String.valueOf(c);
key.codes = new int[] { c };
column++;
x += key.width + key.gap;
mKeys.add(key);
row.mKeys.add(key);
if (x > mTotalWidth) {
mTotalWidth = x;
}
}
mTotalHeight = y + mDefaultHeight;
rows.add(row);
}
final void resize(int newWidth, int newHeight) {
int numRows = rows.size();
for (int rowIndex = 0; rowIndex < numRows; ++rowIndex) {
Row row = rows.get(rowIndex);
int numKeys = row.mKeys.size();
int totalGap = 0;
int totalWidth = 0;
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) {
Key key = row.mKeys.get(keyIndex);
if (keyIndex > 0) {
totalGap += key.gap;
}
totalWidth += key.width;
}
if (totalGap + totalWidth > newWidth) {
int x = 0;
float scaleFactor = (float)(newWidth - totalGap) / totalWidth;
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) {
Key key = row.mKeys.get(keyIndex);
key.width *= scaleFactor;
key.x = x;
x += key.width + key.gap;
}
}
}
mTotalWidth = newWidth;
// TODO: This does not adjust the vertical placement according to the new size.
// The main problem in the previous code was horizontal placement/size, but we should
// also recalculate the vertical sizes/positions when we get this resize call.
}
public List<Key> getKeys() {
return mKeys;
}
public List<Key> getModifierKeys() {
return mModifierKeys;
}
protected int getHorizontalGap() {
return mDefaultHorizontalGap;
}
protected void setHorizontalGap(int gap) {
mDefaultHorizontalGap = gap;
}
protected int getVerticalGap() {
return mDefaultVerticalGap;
}
protected void setVerticalGap(int gap) {
mDefaultVerticalGap = gap;
}
protected int getKeyHeight() {
return mDefaultHeight;
}
protected void setKeyHeight(int height) {
mDefaultHeight = height;
}
protected int getKeyWidth() {
return mDefaultWidth;
}
protected void setKeyWidth(int width) {
mDefaultWidth = width;
}
/**
* Returns the total height of the keyboard
* @return the total height of the keyboard
*/
public int getHeight() {
return mTotalHeight;
}
public int getMinWidth() {
return mTotalWidth;
}
public boolean setShifted(boolean shiftState) {
for (Key shiftKey : mShiftKeys) {
if (shiftKey != null) {
shiftKey.on = shiftState;
}
}
if (mShifted != shiftState) {
mShifted = shiftState;
return true;
}
return false;
}
public boolean isShifted() {
return mShifted;
}
/**
* @hide
*/
public int[] getShiftKeyIndices() {
return mShiftKeyIndices;
}
public int getShiftKeyIndex() {
return mShiftKeyIndices[0];
}
private void computeNearestNeighbors() {
// Round-up so we don't have any pixels outside the grid
mCellWidth = (getMinWidth() + GRID_WIDTH - 1) / GRID_WIDTH;
mCellHeight = (getHeight() + GRID_HEIGHT - 1) / GRID_HEIGHT;
mGridNeighbors = new int[GRID_SIZE][];
int[] indices = new int[mKeys.size()];
final int gridWidth = GRID_WIDTH * mCellWidth;
final int gridHeight = GRID_HEIGHT * mCellHeight;
for (int x = 0; x < gridWidth; x += mCellWidth) {
for (int y = 0; y < gridHeight; y += mCellHeight) {
int count = 0;
for (int i = 0; i < mKeys.size(); i++) {
final Key key = mKeys.get(i);
if (key.squaredDistanceFrom(x, y) < mProximityThreshold ||
key.squaredDistanceFrom(x + mCellWidth - 1, y) < mProximityThreshold ||
key.squaredDistanceFrom(x + mCellWidth - 1, y + mCellHeight - 1)
< mProximityThreshold ||
key.squaredDistanceFrom(x, y + mCellHeight - 1) < mProximityThreshold) {
indices[count++] = i;
}
}
int [] cell = new int[count];
System.arraycopy(indices, 0, cell, 0, count);
mGridNeighbors[(y / mCellHeight) * GRID_WIDTH + (x / mCellWidth)] = cell;
}
}
}
/**
* Returns the indices of the keys that are closest to the given point.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return the array of integer indices for the nearest keys to the given point. If the given
* point is out of range, then an array of size zero is returned.
*/
public int[] getNearestKeys(int x, int y) {
if (mGridNeighbors == null) computeNearestNeighbors();
if (x >= 0 && x < getMinWidth() && y >= 0 && y < getHeight()) {
int index = (y / mCellHeight) * GRID_WIDTH + (x / mCellWidth);
if (index < GRID_SIZE) {
return mGridNeighbors[index];
}
}
return new int[0];
}
protected Row createRowFromXml(Resources res, XmlResourceParser parser) {
return new Row(res, this, parser);
}
protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
XmlResourceParser parser) {
return new Key(res, parent, x, y, parser);
}
private void loadKeyboard(Context context, XmlResourceParser parser) {
boolean inKey = false;
boolean inRow = false;
boolean leftMostKey = false;
int row = 0;
int x = 0;
int y = 0;
Key key = null;
Row currentRow = null;
Resources res = context.getResources();
boolean skipRow = false;
try {
int event;
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
if (event == XmlResourceParser.START_TAG) {
String tag = parser.getName();
if (TAG_ROW.equals(tag)) {
inRow = true;
x = 0;
currentRow = createRowFromXml(res, parser);
rows.add(currentRow);
skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode;
if (skipRow) {
skipToEndOfRow(parser);
inRow = false;
}
} else if (TAG_KEY.equals(tag)) {
inKey = true;
key = createKeyFromXml(res, currentRow, x, y, parser);
mKeys.add(key);
if (key.codes[0] == KEYCODE_SHIFT) {
// Find available shift key slot and put this shift key in it
for (int i = 0; i < mShiftKeys.length; i++) {
if (mShiftKeys[i] == null) {
mShiftKeys[i] = key;
mShiftKeyIndices[i] = mKeys.size()-1;
break;
}
}
mModifierKeys.add(key);
} else if (key.codes[0] == KEYCODE_ALT) {
mModifierKeys.add(key);
}
currentRow.mKeys.add(key);
} else if (TAG_KEYBOARD.equals(tag)) {
parseKeyboardAttributes(res, parser);
}
} else if (event == XmlResourceParser.END_TAG) {
if (inKey) {
inKey = false;
x += key.gap + key.width;
if (x > mTotalWidth) {
mTotalWidth = x;
}
} else if (inRow) {
inRow = false;
y += currentRow.verticalGap;
y += currentRow.defaultHeight;
row++;
} else {
// TODO: error or extend?
}
}
}
} catch (Exception e) {
Log.e(TAG, "Parse error:" + e);
e.printStackTrace();
}
mTotalHeight = y - mDefaultVerticalGap;
}
private void skipToEndOfRow(XmlResourceParser parser)
throws XmlPullParserException, IOException {
int event;
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
if (event == XmlResourceParser.END_TAG
&& parser.getName().equals(TAG_ROW)) {
break;
}
}
}
private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) {
TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard);
mDefaultWidth = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyWidth,
mDisplayWidth, mDisplayWidth / 10);
mDefaultHeight = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyHeight,
mDisplayHeight, 50);
mDefaultHorizontalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_horizontalGap,
mDisplayWidth, 0);
mDefaultVerticalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_verticalGap,
mDisplayHeight, 0);
mProximityThreshold = (int) (mDefaultWidth * SEARCH_DISTANCE);
mProximityThreshold = mProximityThreshold * mProximityThreshold; // Square it for comparison
a.recycle();
}
static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) {
TypedValue value = a.peekValue(index);
if (value == null) return defValue;
if (value.type == TypedValue.TYPE_DIMENSION) {
return a.getDimensionPixelOffset(index, defValue);
} else if (value.type == TypedValue.TYPE_FRACTION) {
// Round it to avoid values like 47.9999 from getting truncated
return Math.round(a.getFraction(index, base, base, defValue));
}
return defValue;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
package com.king.keyboard
import android.content.Context
import android.util.SparseArray
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.annotation.RequiresApi
/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
/**
* 判断是否是小写字母
*/
fun Char.isLowerCase(c: Char): Boolean{
return c.toInt() in 97..122
}
/**
* 判断是否是大写字母
*/
fun Char.isUpperCase(c: Char): Boolean{
return c.toInt() in 65..90
}
/**
* 显示系统输入法
*/
fun View.showSystemInputMethod(){
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(this,InputMethodManager.SHOW_IMPLICIT)
}
/**
* 隐藏系统输入法
*/
fun View.hideSystemInputMethod(){
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(windowToken,0)
}
var View.isVisible: Boolean
get() = visibility == View.VISIBLE
set(value) {
visibility = if (value) View.VISIBLE else View.GONE
}
/** Returns true if the collection contains [key]. */
@RequiresApi(16)
fun <T> SparseArray<T>.containsKey(key: Int) = indexOfKey(key) >= 0
/** Allows the use of the index operator for storing values in the collection. */
@RequiresApi(16)
operator fun <T> SparseArray<T>.set(key: Int, value: T) = put(key, value)

View File

@ -0,0 +1,316 @@
package com.king.keyboard
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
open class KingKeyboardView : KeyboardView {
private var isCap = false
private var isAllCaps = false
private lateinit var config: Config
private val paint by lazy { Paint() }
companion object {
const val iconRatio = 0.5f
}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes){
init(context, attrs)
}
private fun init(context: Context, attrs: AttributeSet?) {
config = Config(context)
var a = context.obtainStyledAttributes(attrs, R.styleable.KingKeyboardView)
a.indexCount.let {
config.run {
for (i in 0 until it) {
when (val attr = a.getIndex(i)) {
R.styleable.KingKeyboardView_kkbDeleteDrawable -> deleteDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCapitalDrawable -> capitalDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCapitalLockDrawable -> capitalLockDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCancelDrawable -> cancelDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCancelDrawable -> spaceDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_android_labelTextSize -> labelTextSize = a.getDimensionPixelSize(attr, labelTextSize)
R.styleable.KingKeyboardView_android_keyTextSize -> keyTextSize = a.getDimensionPixelSize(attr, keyTextSize)
R.styleable.KingKeyboardView_android_keyTextColor -> keyTextColor = a.getColor(attr, keyTextColor)
R.styleable.KingKeyboardView_kkbKeyIconColor -> keyIconColor = a.getColor(attr, ContextCompat.getColor(context, R.color.king_keyboard_key_icon_color))
R.styleable.KingKeyboardView_kkbKeySpecialTextColor -> keySpecialTextColor = a.getColor(attr, keySpecialTextColor)
R.styleable.KingKeyboardView_kkbKeyDoneTextColor -> keyDoneTextColor = a.getColor(attr, keyDoneTextColor)
R.styleable.KingKeyboardView_kkbKeyNoneTextColor -> keyNoneTextColor = a.getColor(attr, keyNoneTextColor)
R.styleable.KingKeyboardView_android_keyBackground -> keyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbSpecialKeyBackground -> specialKeyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbDoneKeyBackground -> doneKeyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbNoneKeyBackground -> noneKeyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbKeyDoneTextSize -> keyDoneTextSize = a.getDimensionPixelSize(attr, keyDoneTextSize)
R.styleable.KingKeyboardView_kkbKeyDoneText -> keyDoneText = a.getString(attr)
}
}
}
a.recycle()
}
paint.textAlign = Paint.Align.CENTER
paint.isAntiAlias = true
}
fun getConfig(): Config {
return config
}
fun setConfig(config: Config) {
this.config = config
invalidate()
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
drawKeyboard(canvas, keyboard?.keys)
}
/**
* 绘制键盘
*/
private fun drawKeyboard(canvas: Canvas,keys: List<Keyboard.Key>?){
keys?.let {
for (key in it) {
drawKey(canvas, key)
}
}
}
/**
* 绘制键盘按键
*/
private fun drawKey(canvas: Canvas, key: Keyboard.Key) {
when (key.codes[0]) {
KingKeyboard.KEYCODE_SHIFT -> drawShiftKey(canvas, key)
KingKeyboard.KEYCODE_MODE_CHANGE -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
KingKeyboard.KEYCODE_CANCEL -> drawCancelKey(canvas, key)
KingKeyboard.KEYCODE_DONE -> drawDoneKey(canvas, key)
KingKeyboard.KEYCODE_DELETE -> drawDeleteKey(canvas, key)
KingKeyboard.KEYCODE_ALT -> drawAltKey(canvas, key)
KingKeyboard.KEYCODE_SPACE -> drawKey(canvas, key, config.keyBackground, config.keyTextColor, config.spaceDrawable)
KingKeyboard.KEYCODE_NONE -> drawNoneKey(canvas, key)
KingKeyboard.KEYCODE_MODE_BACK -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
KingKeyboard.KEYCODE_BACK -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
KingKeyboard.KEYCODE_MORE -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
in -399..-300 -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
// else -> drawKey(canvas,key,keyBackground)
}
}
/**
* 绘制Cancel键常见于关闭键盘键
*/
private fun drawCancelKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.cancelDrawable)
}
/**
* 绘制Done键常见于右下角蓝色的确定按键
*/
private fun drawDoneKey(canvas: Canvas, key: Keyboard.Key) {
config.keyDoneText?.let {
key.label = it
}
drawKey(canvas, key, config.doneKeyBackground, config.keyDoneTextColor, null, true)
}
/**
* 绘制Delete键
*/
private fun drawNoneKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.noneKeyBackground, config.keyNoneTextColor)
}
/**
* 绘制Alt键
*/
private fun drawAltKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
}
/**
* 绘制Delete键
*/
private fun drawDeleteKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.deleteDrawable)
}
/**
* 绘制Shift键
*/
private fun drawShiftKey(canvas: Canvas, key: Keyboard.Key) {
when {
isAllCaps -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.capitalLockDrawable)
isCap -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.capitalDrawable)
else -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.lowerDrawable)
}
}
/**
* 绘制键盘按键
*/
private fun drawKey(canvas: Canvas, key: Keyboard.Key, keyBackground: Drawable?, textColor: Int, iconDrawable: Drawable? = key.icon, isDone: Boolean = false) {
//绘制按键背景
keyBackground?.run {
if (key.codes[0] != 0) {
state = key.currentDrawableState
}
setBounds(
key.x.plus(paddingLeft),
key.y.plus(paddingTop),
key.x.plus(paddingLeft).plus(key.width),
key.y.plus(paddingTop).plus(key.height)
)
draw(canvas)
}
//绘制键盘图标
iconDrawable?.run {
val drawable = DrawableCompat.wrap(this)
config.keyIconColor?.takeIf { it != 0 }?.let {
drawable.setTint(it)
}
key.icon = drawable
var iconWidth = key.icon.intrinsicWidth.toFloat()
var iconHeight = key.icon.intrinsicHeight.toFloat()
val widthRatio = iconWidth.div(key.width.toFloat())
val heightRatio = iconHeight.div(key.height.toFloat())
if (widthRatio <= heightRatio) {//当图标的宽占比小于等于高占比时以高度比例为基准并控制在iconRatio比例范围内进行同比例缩放
val ratio = heightRatio.coerceAtMost(iconRatio)
iconWidth = iconWidth.div(heightRatio).times(ratio)
iconHeight = iconHeight.div(heightRatio).times(ratio)
} else {//反之则以宽度比例为基准并控制在iconRatio比例范围内进行同比例缩放
val ratio = widthRatio.coerceAtMost(iconRatio)
iconWidth = iconWidth.div(widthRatio).times(ratio)
iconHeight = iconHeight.div(widthRatio).times(ratio)
}
val left = key.x.plus(paddingLeft).plus(key.width.minus(iconWidth).div(2f)).toInt()
val top = key.y.plus(paddingTop).plus(key.height.minus(iconHeight).div(2f)).toInt()
val right = left.plus(iconWidth).toInt()
val bottom = top.plus(iconHeight).toInt()
key.icon.setBounds(left, top, right, bottom)
key.icon.draw(canvas)
} ?: key.label?.let {
//绘制键盘文字
if (isDone) {
paint.textSize = config.keyDoneTextSize.toFloat()
} else if (it.length > 1 && key.codes.size < 2) {// 键盘key内容多个字符
paint.textSize = config.labelTextSize.toFloat()
} else {
paint.textSize = config.keyTextSize.toFloat()
}
paint.color = textColor
paint.typeface = Typeface.DEFAULT
canvas.drawText(
it.toString(),
key.x.plus(paddingLeft).plus(key.width.div(2f)),
key.y.plus(paddingTop).plus(key.height.div(2.0f)).plus(
paint.textSize.minus(paint.descent()).div(2.0f)
),
paint
)
}
}
fun setCap(isCap: Boolean) {
this.isCap = isCap
}
fun isCap(): Boolean {
return isCap
}
fun setAllCaps(isAllCaps: Boolean) {
this.isAllCaps = isAllCaps
}
fun isAllCaps(): Boolean {
return isAllCaps
}
/**
* Config为KingKeyboard的配置类方便统一管理配置信息
*/
open class Config(context: Context) {
var deleteDrawable = context.getDrawable(R.drawable.king_keyboard_key_delete)
var lowerDrawable = context.getDrawable(R.drawable.king_keyboard_key_lower)
var capitalDrawable = context.getDrawable(R.drawable.king_keyboard_key_cap)
var capitalLockDrawable = context.getDrawable(R.drawable.king_keyboard_key_all_caps)
var cancelDrawable = context.getDrawable(R.drawable.king_keyboard_key_cancel)
var spaceDrawable = context.getDrawable(R.drawable.king_keyboard_key_space)
var labelTextSize = context.resources.getDimensionPixelSize(R.dimen.king_keyboard_label_text_size)
var keyTextSize = context.resources.getDimensionPixelSize(R.dimen.king_keyboard_text_size)
var keyTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_text_color)
var keyIconColor: Int? = null
var keySpecialTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_special_text_color)
var keyDoneTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_done_text_color)
var keyNoneTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_none_text_color)
var keyBackground = context.getDrawable(R.drawable.king_keyboard_key_bg)
var specialKeyBackground = context.getDrawable(R.drawable.king_keyboard_special_key_bg)
var doneKeyBackground = context.getDrawable(R.drawable.king_keyboard_done_key_bg)
var noneKeyBackground = context.getDrawable(R.drawable.king_keyboard_none_key_bg)
var keyDoneTextSize = context.resources.getDimensionPixelSize(R.dimen.king_keyboard_done_text_size)
var keyDoneText: CharSequence? = context.getString(R.string.king_keyboard_key_done_text)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_done_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_done_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_none_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_none_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_special_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_special_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/king_keyboard_view_bg">
<com.king.keyboard.KingKeyboardView
android:id="@+id/keyboardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:animateLayoutChanges="true"
android:paddingTop="@dimen/king_keyboard_view_padding_top"
android:paddingBottom="@dimen/king_keyboard_view_padding_bottom"
android:keyBackground="@drawable/king_keyboard_key_bg"
android:keyTextColor="@color/king_keyboard_key_text_color"
android:keyTextSize="@dimen/king_keyboard_text_size"
android:labelTextSize="@dimen/king_keyboard_label_text_size"/>
</RelativeLayout>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="king_keyboard_key_done_text">完成</string>
<string name="king_keyboard_key_more_text">更多</string>
<string name="king_keyboard_key_back_text">返回</string>
</resources>

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="KingKeyboardView">
<attr name="android:labelTextSize"/>
<attr name="android:keyTextSize"/>
<attr name="android:keyTextColor"/>
<attr name="android:keyBackground"/>
<attr name="kkbDeleteDrawable" format="reference"/>
<attr name="kkbCapitalDrawable" format="reference"/>
<attr name="kkbCapitalLockDrawable" format="reference"/>
<attr name="kkbCancelDrawable" format="reference"/>
<attr name="kkbSpaceDrawable" format="reference"/>
<attr name="kkbSpecialKeyBackground" format="reference"/>
<attr name="kkbDoneKeyBackground" format="reference"/>
<attr name="kkbNoneKeyBackground" format="reference"/>
<attr name="kkbKeyIconColor" format="color"/>
<attr name="kkbKeySpecialTextColor" format="color"/>
<attr name="kkbKeyDoneTextColor" format="color"/>
<attr name="kkbKeyDoneTextSize" format="dimension"/>
<attr name="kkbKeyNoneTextColor" format="color"/>
<attr name="kkbKeyDoneText" format="string"/>
</declare-styleable>
<declare-styleable name="King_KeyboardView">
<attr name="android:keyBackground"/>
<attr name="android:keyTextSize"/>
<attr name="android:labelTextSize" />
<attr name="android:keyTextColor"/>
<attr name="android:keyPreviewLayout" />
<attr name="android:keyPreviewOffset" />
<attr name="android:keyPreviewHeight" />
<attr name="android:verticalCorrection" />
<attr name="android:popupLayout" />
<attr name="android:shadowColor" />
<attr name="android:shadowRadius" />
</declare-styleable>
<declare-styleable name="King_KeyboardViewPreviewState">
<attr name="android:state_long_pressable"/>
</declare-styleable>
<declare-styleable name="King_Keyboard">
<attr name="android:keyWidth" />
<attr name="android:keyHeight" />
<attr name="android:horizontalGap" />
<attr name="android:verticalGap"/>
</declare-styleable>
<declare-styleable name="King_Keyboard_Row">
<attr name="android:rowEdgeFlags"/>
<attr name="android:keyboardMode"/>
</declare-styleable>
<declare-styleable name="King_Keyboard_Key">
<attr name="android:codes"/>
<attr name="android:popupKeyboard"/>
<attr name="android:popupCharacters" />
<attr name="android:keyEdgeFlags"/>
<attr name="android:isModifier" />
<attr name="android:isSticky" />
<attr name="android:isRepeatable" />
<attr name="android:iconPreview"/>
<attr name="android:keyOutputText" />
<attr name="android:keyLabel" />
<attr name="android:keyIcon"/>
<attr name="android:keyboardMode" />
</declare-styleable>
</resources>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="king_keyboard_key_text_color">#ff333333</color>
<color name="king_keyboard_key_special_text_color">#ff333333</color>
<color name="king_keyboard_key_done_text_color">#ffeeeeee</color>
<color name="king_keyboard_key_none_text_color">#7f999999</color>
<color name="king_keyboard_key_icon_color">#ff333333</color>
<color name="king_keyboard_key_bg_normal">#ffffffff</color>
<color name="king_keyboard_key_bg_pressed">#ffbbbbbb</color>
<color name="king_keyboard_special_key_bg_normal">#ffa8afbf</color>
<color name="king_keyboard_special_key_bg_pressed">#ff989faf</color>
<color name="king_keyboard_done_key_bg_normal">#ff0477ff</color>
<color name="king_keyboard_done_key_bg_pressed">#ff0467ef</color>
<color name="king_keyboard_none_key_bg_normal">#ffefefef</color>
<color name="king_keyboard_none_key_bg_pressed">#ffefefef</color>
</resources>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="king_keyboard_key_height">48dp</dimen>
<dimen name="king_keyboard_key_height2">101dp</dimen>
<dimen name="king_keyboard_key_height3">154dp</dimen>
<dimen name="king_keyboard_vertical_gap">5dp</dimen>
<dimen name="king_keyboard_horizontal_gap">10dp</dimen>
<dimen name="king_keyboard_view_padding_top">6dp</dimen>
<dimen name="king_keyboard_view_padding_bottom">6dp</dimen>
<dimen name="king_keyboard_preview_height">56dp</dimen>
<dimen name="king_keyboard_text_size">20sp</dimen>
<dimen name="king_keyboard_done_text_size">20sp</dimen>
<dimen name="king_keyboard_label_text_size">16sp</dimen>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<string name="king_keyboard_key_done_text">Done</string>
<string name="king_keyboard_key_more_text">More</string>
<string name="king_keyboard_key_back_text">Back</string>
</resources>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="88"
android:keyLabel="X" />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="13%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:keyWidth="11.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="98"
android:keyLabel="b"
android:keyWidth="11.4%p"/>
<Key
android:codes="99"
android:keyLabel="c"
android:keyWidth="11.3%p"/>
<Key
android:codes="100"
android:keyLabel="d"
android:keyWidth="11.3%p"/>
<Key
android:codes="101"
android:keyLabel="e"
android:keyWidth="11.3%p"/>
<Key
android:codes="102"
android:keyLabel="f"
android:keyWidth="11.3%p"/>
<Key
android:codes="103"
android:keyLabel="g"
android:keyWidth="11.4%p"/>
<Key
android:codes="104"
android:keyLabel="h"
android:keyWidth="11.5%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="105"
android:keyLabel="i"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="106"
android:keyLabel="j" />
<Key
android:codes="107"
android:keyLabel="k" />
<Key
android:codes="108"
android:keyLabel="l" />
<Key
android:codes="109"
android:keyLabel="m" />
<Key
android:codes="110"
android:keyLabel="n" />
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="112"
android:keyLabel="p"
android:keyWidth="13.5%p"/>
<Key
android:codes="113"
android:keyLabel="q" />
<Key
android:codes="114"
android:keyLabel="r" />
<Key
android:codes="115"
android:keyLabel="s" />
<Key
android:codes="116"
android:keyLabel="t" />
<Key
android:codes="117"
android:keyLabel="u" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-1"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="118"
android:keyLabel="v" />
<Key
android:codes="119"
android:keyLabel="w" />
<Key
android:codes="120"
android:keyLabel="x" />
<Key
android:codes="121"
android:keyLabel="y" />
<Key
android:codes="122"
android:keyLabel="z" />
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2"
android:keyWidth="8.9%p" />
<Key
android:codes="51"
android:keyLabel="3"
android:keyWidth="8.9%p" />
<Key
android:codes="52"
android:keyLabel="4"
android:keyWidth="8.9%p" />
<Key
android:codes="53"
android:keyLabel="5"
android:keyWidth="8.9%p" />
<Key
android:codes="54"
android:keyLabel="6"
android:keyWidth="8.9%p" />
<Key
android:codes="55"
android:keyLabel="7"
android:keyWidth="8.9%p" />
<Key
android:codes="56"
android:keyLabel="8"
android:keyWidth="8.9%p" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="8.9%p" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="113"
android:keyLabel="q"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="119"
android:keyLabel="w"
android:keyWidth="8.9%p"/>
<Key
android:codes="101"
android:keyLabel="e"
android:keyWidth="8.9%p" />
<Key
android:codes="114"
android:keyWidth="8.9%p"
android:keyLabel="r" />
<Key
android:codes="116"
android:keyLabel="t"
android:keyWidth="8.9%p"/>
<Key
android:codes="121"
android:keyLabel="y"
android:keyWidth="8.9%p"/>
<Key
android:codes="117"
android:keyLabel="u"
android:keyWidth="8.9%p"/>
<Key
android:codes="105"
android:keyLabel="i"
android:keyWidth="8.9%p"/>
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="8.9%p"/>
<Key
android:codes="112"
android:keyLabel="p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="115"
android:keyLabel="s"
android:keyWidth="8.9%p"/>
<Key
android:codes="100"
android:keyLabel="d"
android:keyWidth="8.9%p"/>
<Key
android:codes="102"
android:keyLabel="f"
android:keyWidth="8.9%p"/>
<Key
android:codes="103"
android:keyLabel="g"
android:keyWidth="8.9%p"/>
<Key
android:codes="104"
android:keyLabel="h"
android:keyWidth="8.9%p"/>
<Key
android:codes="106"
android:keyLabel="j"
android:keyWidth="8.9%p"/>
<Key
android:codes="107"
android:keyLabel="k"
android:keyWidth="8.9%p"/>
<Key
android:codes="108"
android:keyLabel="l"
android:keyWidth="8.9%p"/>
<Key
android:codes="-5"
android:keyWidth="8.9%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-1"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="122"
android:keyLabel="z"
android:keyWidth="9%p"/>
<Key
android:codes="120"
android:keyLabel="x"
android:keyWidth="9%p"/>
<Key
android:codes="99"
android:keyLabel="c"
android:keyWidth="9%p"/>
<Key
android:codes="118"
android:keyLabel="v"
android:keyWidth="9%p"/>
<Key
android:codes="98"
android:keyLabel="b"
android:keyWidth="9%p"/>
<Key
android:codes="110"
android:keyLabel="n"
android:keyWidth="9%p"/>
<Key
android:codes="109"
android:keyLabel="m"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="0x4eac"
android:keyLabel="京"
android:keyEdgeFlags="left" />
<Key
android:codes="0x6d25"
android:keyLabel="津" />
<Key
android:codes="0x6caa"
android:keyLabel="沪" />
<Key
android:codes="0x6e1d"
android:keyLabel="渝" />
<Key
android:codes="0x5180"
android:keyLabel="冀" />
<Key
android:codes="0x8c6b"
android:keyLabel="豫" />
<Key
android:codes="0x4e91"
android:keyLabel="云" />
<Key
android:codes="0x8fbd"
android:keyLabel="辽" />
<Key
android:codes="0x9ed1"
android:keyLabel="黑" />
<Key
android:codes="0x6e58"
android:keyLabel="湘"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x7696"
android:keyLabel="皖"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9c81"
android:keyLabel="鲁" />
<Key
android:codes="0x65b0"
android:keyLabel="新" />
<Key
android:codes="0x82cf"
android:keyLabel="苏" />
<Key
android:codes="0x6d59"
android:keyLabel="浙" />
<Key
android:codes="0x8d63"
android:keyLabel="赣" />
<Key
android:codes="0x9102"
android:keyLabel="鄂" />
<Key
android:codes="0x6842"
android:keyLabel="桂" />
<Key
android:codes="0x7518"
android:keyLabel="甘" />
<Key
android:codes="0x664b"
android:keyLabel="晋"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-103"
android:keyLabel="@string/king_keyboard_key_more_text"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x8499"
android:keyLabel="蒙"
android:keyWidth="9%p"/>
<Key
android:codes="0x9655"
android:keyLabel="陕"
android:keyWidth="9%p"/>
<Key
android:codes="0x5409"
android:keyLabel="吉"
android:keyWidth="9%p"/>
<Key
android:codes="0x95fd"
android:keyLabel="闽"
android:keyWidth="9%p"/>
<Key
android:codes="0x8d35"
android:keyLabel="贵"
android:keyWidth="9%p"/>
<Key
android:codes="0x7ca4"
android:keyLabel="粤"
android:keyWidth="9%p"/>
<Key
android:codes="0x9752"
android:keyLabel="青"
android:keyWidth="9%p"/>
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-2"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate_number"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x85cf"
android:keyLabel="藏"
android:keyWidth="9%p"/>
<Key
android:codes="0x5ddd"
android:keyLabel="川"
android:keyWidth="9%p"/>
<Key
android:codes="0x5b81"
android:keyLabel="宁"
android:keyWidth="9%p"/>
<Key
android:codes="0x743c"
android:keyLabel="琼"
android:keyWidth="9%p"/>
<Key
android:codes="0x6e2f"
android:keyLabel="港"
android:keyWidth="9%p"/>
<Key
android:codes="0x6fb3"
android:keyLabel="澳"
android:keyWidth="9%p"/>
<Key
android:codes="0x6302"
android:keyLabel="挂"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="0x4eac"
android:keyLabel="京"
android:keyEdgeFlags="left" />
<Key
android:codes="0x6d25"
android:keyLabel="津" />
<Key
android:codes="0x6caa"
android:keyLabel="沪" />
<Key
android:codes="0x6e1d"
android:keyLabel="渝" />
<Key
android:codes="0x5180"
android:keyLabel="冀" />
<Key
android:codes="0x8c6b"
android:keyLabel="豫" />
<Key
android:codes="0x4e91"
android:keyLabel="云" />
<Key
android:codes="0x8fbd"
android:keyLabel="辽" />
<Key
android:codes="0x9ed1"
android:keyLabel="黑" />
<Key
android:codes="0x6e58"
android:keyLabel="湘"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x7696"
android:keyLabel="皖"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9c81"
android:keyLabel="鲁" />
<Key
android:codes="0x65b0"
android:keyLabel="新" />
<Key
android:codes="0x82cf"
android:keyLabel="苏" />
<Key
android:codes="0x6d59"
android:keyLabel="浙" />
<Key
android:codes="0x8d63"
android:keyLabel="赣" />
<Key
android:codes="0x9102"
android:keyLabel="鄂" />
<Key
android:codes="0x6842"
android:keyLabel="桂" />
<Key
android:codes="0x7518"
android:keyLabel="甘" />
<Key
android:codes="0x664b"
android:keyLabel="晋"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-102"
android:keyLabel="@string/king_keyboard_key_back_text"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x8499"
android:keyLabel="蒙"
android:keyWidth="9%p"/>
<Key
android:codes="0x9655"
android:keyLabel="陕"
android:keyWidth="9%p"/>
<Key
android:codes="0x5409"
android:keyLabel="吉"
android:keyWidth="9%p"/>
<Key
android:codes="0x95fd"
android:keyLabel="闽"
android:keyWidth="9%p"/>
<Key
android:codes="0x8d35"
android:keyLabel="贵"
android:keyWidth="9%p"/>
<Key
android:codes="0x7ca4"
android:keyLabel="粤"
android:keyWidth="9%p"/>
<Key
android:codes="0x9752"
android:keyLabel="青"
android:keyWidth="9%p"/>
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-2"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate_number"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x4f7f"
android:keyLabel="使"
android:keyWidth="9%p"/>
<Key
android:codes="0x9886"
android:keyLabel="领"
android:keyWidth="9%p"/>
<Key
android:codes="0x5b66"
android:keyLabel="学"
android:keyWidth="9%p"/>
<Key
android:codes="0x8b66"
android:keyLabel="警"
android:keyWidth="9%p"/>
<Key
android:codes="0x8bd5"
android:keyLabel="试"
android:keyWidth="9%p"/>
<Key
android:codes="0x8d85"
android:keyLabel="超"
android:keyWidth="9%p"/>
<Key
android:codes="0x4e34"
android:keyLabel="临"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="52"
android:keyLabel="4" />
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="55"
android:keyLabel="7" />
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="81"
android:keyLabel="Q"
android:keyEdgeFlags="left" />
<Key
android:codes="87"
android:keyLabel="W" />
<Key
android:codes="69"
android:keyLabel="E" />
<Key
android:codes="82"
android:keyLabel="R" />
<Key
android:codes="84"
android:keyLabel="T" />
<Key
android:codes="89"
android:keyLabel="Y" />
<Key
android:codes="85"
android:keyLabel="U" />
<Key
android:codes="0"
android:keyLabel="I" />
<Key
android:codes="0"
android:keyLabel="O" />
<Key
android:codes="80"
android:keyLabel="P"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="65"
android:keyLabel="A"
android:keyEdgeFlags="left" />
<Key
android:codes="83"
android:keyLabel="S" />
<Key
android:codes="68"
android:keyLabel="D" />
<Key
android:codes="70"
android:keyLabel="F" />
<Key
android:codes="71"
android:keyLabel="G" />
<Key
android:codes="72"
android:keyLabel="H" />
<Key
android:codes="74"
android:keyLabel="J" />
<Key
android:codes="75"
android:keyLabel="K" />
<Key
android:codes="76"
android:keyLabel="L" />
<Key
android:codes="-5"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-102"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="90"
android:keyLabel="Z"
android:keyWidth="9%p"/>
<Key
android:codes="88"
android:keyLabel="X"
android:keyWidth="9%p"/>
<Key
android:codes="67"
android:keyLabel="C"
android:keyWidth="9%p"/>
<Key
android:codes="86"
android:keyLabel="V"
android:keyWidth="9%p"/>
<Key
android:codes="66"
android:keyLabel="B"
android:keyWidth="9%p"/>
<Key
android:codes="78"
android:keyLabel="N"
android:keyWidth="9%p"/>
<Key
android:codes="77"
android:keyLabel="M"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="0x4eac"
android:keyLabel="京"
android:keyEdgeFlags="left" />
<Key
android:codes="0x6d25"
android:keyLabel="津" />
<Key
android:codes="0x6caa"
android:keyLabel="沪" />
<Key
android:codes="0x6e1d"
android:keyLabel="渝" />
<Key
android:codes="0x5180"
android:keyLabel="冀" />
<Key
android:codes="0x8c6b"
android:keyLabel="豫" />
<Key
android:codes="0x4e91"
android:keyLabel="云" />
<Key
android:codes="0x8fbd"
android:keyLabel="辽" />
<Key
android:codes="0x9ed1"
android:keyLabel="黑" />
<Key
android:codes="0x6e58"
android:keyLabel="湘"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x7696"
android:keyLabel="皖"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9c81"
android:keyLabel="鲁" />
<Key
android:codes="0x65b0"
android:keyLabel="新" />
<Key
android:codes="0x82cf"
android:keyLabel="苏" />
<Key
android:codes="0x6d59"
android:keyLabel="浙" />
<Key
android:codes="0x8d63"
android:keyLabel="赣" />
<Key
android:codes="0x9102"
android:keyLabel="鄂" />
<Key
android:codes="0x6842"
android:keyLabel="桂" />
<Key
android:codes="0x7518"
android:keyLabel="甘" />
<Key
android:codes="0x664b"
android:keyLabel="晋"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x8499"
android:keyLabel="蒙"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9655"
android:keyLabel="陕" />
<Key
android:codes="0x5409"
android:keyLabel="吉" />
<Key
android:codes="0x95fd"
android:keyLabel="闽" />
<Key
android:codes="0x8d35"
android:keyLabel="贵" />
<Key
android:codes="0x7ca4"
android:keyLabel="粤" />
<Key
android:codes="0x9752"
android:keyLabel="青" />
<Key
android:codes="0x85cf"
android:keyLabel="藏" />
<Key
android:codes="0x5ddd"
android:keyLabel="川" />
<Key
android:codes="-5"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-2"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate_number"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x5b81"
android:keyLabel="宁"
android:keyWidth="9%p"/>
<Key
android:codes="0x743c"
android:keyLabel="琼"
android:keyWidth="9%p"/>
<Key
android:codes="0x6e2f"
android:keyLabel="港"
android:keyWidth="9%p"/>
<Key
android:codes="0x6fb3"
android:keyLabel="澳"
android:keyWidth="9%p"/>
<Key
android:codes="0x6302"
android:keyLabel="挂"
android:keyWidth="9%p"/>
<Key
android:codes="0x5b66"
android:keyLabel="学"
android:keyWidth="9%p"/>
<Key
android:codes="0x8b66"
android:keyLabel="警"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="13%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:keyWidth="13.5%p" />
<Key
android:codes="98"
android:keyLabel="b" />
<Key
android:codes="99"
android:keyLabel="c" />
<Key
android:codes="100"
android:keyLabel="d" />
<Key
android:codes="101"
android:keyLabel="e" />
<Key
android:codes="102"
android:keyLabel="f" />
<Key
android:codes="103"
android:keyLabel="g"
android:keyWidth="13.5%p" />
</Row>
<Row>
<Key
android:codes="104"
android:keyLabel="h"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="105"
android:keyLabel="i" />
<Key
android:codes="106"
android:keyLabel="j" />
<Key
android:codes="107"
android:keyLabel="k" />
<Key
android:codes="108"
android:keyLabel="l" />
<Key
android:codes="109"
android:keyLabel="m" />
<Key
android:codes="110"
android:keyLabel="n"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="112"
android:keyLabel="p" />
<Key
android:codes="113"
android:keyLabel="q" />
<Key
android:codes="114"
android:keyLabel="r" />
<Key
android:codes="115"
android:keyLabel="s" />
<Key
android:codes="116"
android:keyLabel="t" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="117"
android:keyLabel="u"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="118"
android:keyLabel="v" />
<Key
android:codes="119"
android:keyLabel="w" />
<Key
android:codes="120"
android:keyLabel="x" />
<Key
android:codes="121"
android:keyLabel="y" />
<Key
android:codes="122"
android:keyLabel="z" />
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="113"
android:keyLabel="q"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="119"
android:keyLabel="w"
android:keyWidth="8.9%p"/>
<Key
android:codes="101"
android:keyLabel="e"
android:keyWidth="8.9%p" />
<Key
android:codes="114"
android:keyWidth="8.9%p"
android:keyLabel="r" />
<Key
android:codes="116"
android:keyLabel="t"
android:keyWidth="8.9%p"/>
<Key
android:codes="121"
android:keyLabel="y"
android:keyWidth="8.9%p"/>
<Key
android:codes="117"
android:keyLabel="u"
android:keyWidth="8.9%p"/>
<Key
android:codes="105"
android:keyLabel="i"
android:keyWidth="8.9%p"/>
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="8.9%p"/>
<Key
android:codes="112"
android:keyLabel="p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:horizontalGap="5.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="115"
android:keyLabel="s" />
<Key
android:codes="100"
android:keyLabel="d" />
<Key
android:codes="102"
android:keyLabel="f" />
<Key
android:codes="103"
android:keyLabel="g" />
<Key
android:codes="104"
android:keyLabel="h" />
<Key
android:codes="106"
android:keyLabel="j" />
<Key
android:codes="107"
android:keyLabel="k" />
<Key
android:codes="108"
android:keyLabel="l"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-1"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="122"
android:keyLabel="z" />
<Key
android:codes="120"
android:keyLabel="x" />
<Key
android:codes="99"
android:keyLabel="c" />
<Key
android:codes="118"
android:keyLabel="v" />
<Key
android:codes="98"
android:keyLabel="b" />
<Key
android:codes="110"
android:keyLabel="n" />
<Key
android:codes="109"
android:keyLabel="m" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-2"
android:keyLabel="\?123"
android:keyWidth="17%p" />
<Key
android:codes="46"
android:keyLabel="."
android:keyWidth="12%p" />
<Key
android:codes="32"
android:keyWidth="36%p"
android:isRepeatable="false"/>
<Key
android:codes="63"
android:keyLabel="\?"
android:keyWidth="12%p" />
<Key
android:codes="-3"
android:keyWidth="17%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2"
android:keyWidth="8.9%p" />
<Key
android:codes="51"
android:keyLabel="3"
android:keyWidth="8.9%p" />
<Key
android:codes="52"
android:keyLabel="4"
android:keyWidth="8.9%p" />
<Key
android:codes="53"
android:keyLabel="5"
android:keyWidth="8.9%p" />
<Key
android:codes="54"
android:keyLabel="6"
android:keyWidth="8.9%p"
/>
<Key
android:codes="55"
android:keyLabel="7"
android:keyWidth="8.9%p" />
<Key
android:codes="56"
android:keyLabel="8"
android:keyWidth="8.9%p" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="8.9%p" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="33"
android:keyLabel="!"
android:horizontalGap="5.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="64"
android:keyLabel="\@" />
<Key
android:codes="35"
android:keyLabel="#" />
<Key
android:codes="36"
android:keyLabel="\$" />
<Key
android:codes="37"
android:keyLabel="%" />
<Key
android:codes="38"
android:keyLabel="&amp;" />
<Key
android:codes="42"
android:keyLabel="*" />
<Key
android:codes="40"
android:keyLabel="(" />
<Key
android:codes="41"
android:keyLabel=")"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-103"
android:keyLabel="@string/king_keyboard_key_more_text"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="39"
android:keyLabel="'" />
<Key
android:codes="47"
android:keyLabel="/" />
<Key
android:codes="45"
android:keyLabel="-" />
<Key
android:codes="95"
android:keyLabel="_" />
<Key
android:codes="58"
android:keyLabel=":" />
<Key
android:codes="59"
android:keyLabel=";" />
<Key
android:codes="44"
android:keyLabel="," />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-102"
android:keyWidth="17%p"
android:keyLabel="@string/king_keyboard_key_back_text" />
<Key
android:codes="46"
android:keyWidth="12%p"
android:keyLabel="." />
<Key
android:codes="32"
android:isRepeatable="false"
android:keyWidth="36%p"
android:keyLabel="" />
<Key
android:codes="63"
android:keyWidth="12%p"
android:keyLabel="\?" />
<Key
android:codes="-3"
android:keyWidth="17%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="91"
android:keyLabel="["
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="93"
android:keyLabel="]"
android:keyWidth="8.9%p" />
<Key
android:codes="123"
android:keyLabel="{"
android:keyWidth="8.9%p" />
<Key
android:codes="125"
android:keyLabel="}"
android:keyWidth="8.9%p" />
<Key
android:codes="35"
android:keyLabel="#"
android:keyWidth="8.9%p" />
<Key
android:codes="37"
android:keyLabel="%"
android:keyWidth="8.9%p"
/>
<Key
android:codes="94"
android:keyLabel="^"
android:keyWidth="8.9%p" />
<Key
android:codes="96"
android:keyLabel="`"
android:keyWidth="8.9%p" />
<Key
android:codes="43"
android:keyLabel="+"
android:keyWidth="8.9%p" />
<Key
android:codes="61"
android:keyLabel="="
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="126"
android:keyLabel="~"
android:horizontalGap="5.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="92"
android:keyLabel="\\" />
<Key
android:codes="124"
android:keyLabel="|" />
<Key
android:codes="60"
android:keyLabel="&lt;" />
<Key
android:codes="62"
android:keyLabel="&gt;" />
<Key
android:codes="165"
android:keyLabel="¥" />
<Key
android:codes="8364"
android:keyLabel="€" />
<Key
android:codes="163"
android:keyLabel="£" />
<Key
android:codes="8356"
android:keyLabel="₤"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-101"
android:keyLabel="123"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="39"
android:keyLabel="'" />
<Key
android:codes="47"
android:keyLabel="/" />
<Key
android:codes="45"
android:keyLabel="-" />
<Key
android:codes="95"
android:keyLabel="_" />
<Key
android:codes="58"
android:keyLabel=":" />
<Key
android:codes="59"
android:keyLabel=";" />
<Key
android:codes="44"
android:keyLabel="," />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-102"
android:keyWidth="17%p"
android:keyLabel="@string/king_keyboard_key_back_text" />
<Key
android:codes="46"
android:keyWidth="12%p"
android:keyLabel="." />
<Key
android:codes="32"
android:isRepeatable="false"
android:keyWidth="36%p"
android:keyLabel="" />
<Key
android:codes="63"
android:keyWidth="12%p"
android:keyLabel="\?" />
<Key
android:codes="-3"
android:keyWidth="17%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="0"
android:keyLabel="" />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="46"
android:keyLabel="." />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="45"
android:keyLabel="-" />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="13%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="65"
android:keyLabel="A"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="66"
android:keyLabel="B" />
<Key
android:codes="67"
android:keyLabel="C" />
<Key
android:codes="68"
android:keyLabel="D" />
<Key
android:codes="69"
android:keyLabel="E" />
<Key
android:codes="70"
android:keyLabel="F" />
<Key
android:codes="71"
android:keyLabel="G"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="72"
android:keyLabel="H"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="73"
android:keyLabel="I" />
<Key
android:codes="74"
android:keyLabel="J" />
<Key
android:codes="75"
android:keyLabel="K" />
<Key
android:codes="76"
android:keyLabel="L" />
<Key
android:codes="77"
android:keyLabel="M" />
<Key
android:codes="78"
android:keyLabel="N"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="79"
android:keyLabel="O"
android:keyWidth="13.5%p"/>
<Key
android:codes="80"
android:keyLabel="P" />
<Key
android:codes="81"
android:keyLabel="Q" />
<Key
android:codes="82"
android:keyLabel="R" />
<Key
android:codes="83"
android:keyLabel="S" />
<Key
android:codes="84"
android:keyLabel="T" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="85"
android:keyLabel="U"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="86"
android:keyLabel="V" />
<Key
android:codes="87"
android:keyLabel="W" />
<Key
android:codes="88"
android:keyLabel="X" />
<Key
android:codes="89"
android:keyLabel="Y" />
<Key
android:codes="90"
android:keyLabel="Z" />
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View File

@ -0,0 +1,18 @@
package com.king.keyboard
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@ -1,3 +1,4 @@
rootProject.name = "Pass"
include ':app'
include ':mylibrary'
include ':keybordlib'