From 508f5972dff31c6d032b358d1325702a8c419383 Mon Sep 17 00:00:00 2001 From: fengjian Date: Fri, 1 Apr 2016 15:57:38 +0800 Subject: [PATCH] add sample code for KeyBoradLess --- .../app/activity/KeyboradActivity.java | 28 +++++++++++++++ app/src/main/res/layout/activity_keyborad.xml | 35 ++++++++++++++----- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/jayfeng/lesscode/app/activity/KeyboradActivity.java b/app/src/main/java/com/jayfeng/lesscode/app/activity/KeyboradActivity.java index a1612bd..e9dd8d7 100644 --- a/app/src/main/java/com/jayfeng/lesscode/app/activity/KeyboradActivity.java +++ b/app/src/main/java/com/jayfeng/lesscode/app/activity/KeyboradActivity.java @@ -2,14 +2,42 @@ import android.app.Activity; import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; import com.jayfeng.lesscode.app.R; +import com.jayfeng.lesscode.core.KeyBoardLess; +import com.jayfeng.lesscode.core.ViewLess; public class KeyboradActivity extends Activity { + private EditText editText; + private Button showKeyboradButton; + private Button hideKeyboradButton; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_keyborad); + + editText = ViewLess.$(this, R.id.edit); + showKeyboradButton = ViewLess.$(this, R.id.show); + hideKeyboradButton = ViewLess.$(this, R.id.hide); + + showKeyboradButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + KeyBoardLess.$show(KeyboradActivity.this, editText); + } + }); + + hideKeyboradButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + KeyBoardLess.$hide(KeyboradActivity.this, editText); + } + }); + } } diff --git a/app/src/main/res/layout/activity_keyborad.xml b/app/src/main/res/layout/activity_keyborad.xml index 4f669c7..ba68b90 100644 --- a/app/src/main/res/layout/activity_keyborad.xml +++ b/app/src/main/res/layout/activity_keyborad.xml @@ -1,12 +1,29 @@ - - + - +