Commit d77725d0 authored by 王韦's avatar 王韦

[new] 增加 键盘库

parent df0012b3
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke
android:width="1dp"
android:color="#FFDB2D" />
<size
android:width="50dp"
android:height="50dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFDB2D" />
<stroke
android:width="1dp"
android:color="#FFDB2D" />
<size
android:width="50dp"
android:height="50dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff"/>
</shape>
\ No newline at end of file
...@@ -29,6 +29,7 @@ dependencies { ...@@ -29,6 +29,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2' implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(path: ':KeyBoardView')
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
...@@ -36,6 +37,7 @@ dependencies { ...@@ -36,6 +37,7 @@ dependencies {
// implementation 'com.qmai.android.sdk:widgetlib:1.1.2-SNAPSHOT' // implementation 'com.qmai.android.sdk:widgetlib:1.1.2-SNAPSHOT'
implementation project(path: ':tools') implementation project(path: ':tools')
implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.github.sebdomdev:android-drawer-sheet:1.0'
// todo test // todo test
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".GridDividerActivity"/> <activity android:name=".DrawerActivity"/>
<activity android:name=".GridDividerActivity" />
<activity android:name=".TipActivity" /> <activity android:name=".TipActivity" />
<activity android:name=".CommomPopActivity" /> <activity android:name=".CommomPopActivity" />
<activity android:name=".TopBarActivity" /> <activity android:name=".TopBarActivity" />
<activity android:name=".MainActivity"> <activity android:name="com.qimai.android.widget.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
package com.qimai.android.widget package com.qimai.android.widget
import android.app.Activity
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
...@@ -27,15 +24,17 @@ class DemoDialogFragmemt : ...@@ -27,15 +24,17 @@ class DemoDialogFragmemt :
return view!! return view!!
} }
override fun onAttach(context: Context?) {
super.onAttach(context)
}
override fun config(): DialogFramgentConfig { override fun config(): DialogFramgentConfig {
return DialogFramgentConfig().apply { return DialogFramgentConfig().apply {
mWindowWidth = getScreenWidth(context!!) - context!!.dpTopx(30.0f) context?.let {
c ->
mWindowWidth = getScreenWidth(c) - c.dpTopx(30.0f)
}
} }
} }
......
package com.qimai.android.widget;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import androidx.appcompat.app.AppCompatActivity;
public class DrawerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer);
final FrameLayout frameLayout = findViewById(R.id.left);
final DrawerLayout drawer = findViewById(R.id.drawer);
Button btn = findViewById(R.id.btn_context);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
frameLayout.removeAllViews();
frameLayout.addView(LayoutInflater.from(DrawerActivity.this).inflate(R.layout.other_layout,null));
drawer.invalidate();
drawer.openDrawer(Gravity.LEFT);
}
});
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -3,9 +3,10 @@ package com.qimai.android.widget ...@@ -3,9 +3,10 @@ package com.qimai.android.widget
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.widget.Button import android.widget.Button
import android.widget.Toast import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.qimai.android.widgetlib.toast.HolderContext import com.qimai.android.widgetlib.toast.HolderContext
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
...@@ -15,7 +16,6 @@ class MainActivity : AppCompatActivity() { ...@@ -15,7 +16,6 @@ class MainActivity : AppCompatActivity() {
HolderContext.getInstance().register { HolderContext.getInstance().register {
this this
} }
supportFragmentManager
findViewById<Button>(R.id.commonPop).setOnClickListener { findViewById<Button>(R.id.commonPop).setOnClickListener {
// ToastUtils.getInstance().showCenter("测试测试") // ToastUtils.getInstance().showCenter("测试测试")
...@@ -26,12 +26,15 @@ class MainActivity : AppCompatActivity() { ...@@ -26,12 +26,15 @@ class MainActivity : AppCompatActivity() {
// val loding = Loading() // val loding = Loading()
// loding.isCancelable =false // loding.isCancelable =false
// loding.show(supportFragmentManager, "loading") // loding.show(supportFragmentManager, "loading")
Toast.makeText(this, "", Toast.LENGTH_SHORT);
// TestWindow(this, findViewById<Button>(R.id.commonPop)).build().show() // TestWindow(this, findViewById<Button>(R.id.commonPop)).build().show()
// CustomToastUtils.getInstance().success() // CustomToastUtils.getInstance().success()
} }
keyboard.bindEditText(inputText)
findViewById<TextView>(R.id.drawer).setOnClickListener {
startActivity(Intent(MainActivity@ this, DrawerActivity::class.java))
}
findViewById<Button>(R.id.tip).setOnClickListener { findViewById<Button>(R.id.tip).setOnClickListener {
startActivity(Intent(MainActivity@ this, TipActivity::class.java)) startActivity(Intent(MainActivity@ this, TipActivity::class.java))
......
...@@ -18,10 +18,7 @@ class StoreLocalLayout : ViewGroup { ...@@ -18,10 +18,7 @@ class StoreLocalLayout : ViewGroup {
context, context,
attrs, attrs,
defStyleAttr defStyleAttr
) { )
}
private val mAllView = mutableListOf<List<View>>() private val mAllView = mutableListOf<List<View>>()
private val mLineHeight = mutableListOf<Int>() private val mLineHeight = mutableListOf<Int>()
......
<?xml version="1.0" encoding="utf-8"?>
<com.qimai.android.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer"
tools:context=".DrawerActivity">
<!-- 内容 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_context"
android:text="context"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
<!-- 左边菜单 -->
<FrameLayout
android:id="@+id/left"
android:background="@color/colorAccent"
android:layout_gravity="start"
android:layout_width="200dp"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_left_menu"
android:text="left menu"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
<!-- 左边菜单 -->
<FrameLayout
android:id="@+id/RightContainer"
android:background="@color/colorAccent"
android:layout_gravity="end"
android:layout_width="200dp"
android:layout_height="match_parent">
<Button
android:id="@+id/right"
android:text="left menu"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</com.qimai.android.widget.DrawerLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
...@@ -18,6 +16,7 @@ ...@@ -18,6 +16,7 @@
android:text="topbar" android:text="topbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" /> android:layout_height="50dp" />
<Button <Button
android:id="@+id/commonPop" android:id="@+id/commonPop"
android:text="commonPop" android:text="commonPop"
...@@ -29,21 +28,30 @@ ...@@ -29,21 +28,30 @@
android:text="Tip" android:text="Tip"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" /> android:layout_height="50dp" />
<Button <Button
android:id="@+id/divide" android:id="@+id/divide"
android:text="griddivider" android:text="griddivider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" /> android:layout_height="50dp" />
<Button
android:id="@+id/drawer"
android:text="drawer"
android:layout_width="match_parent"
android:layout_height="50dp" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:text="测试111111 " android:text="测试111111 "
android:gravity="center" android:gravity="center"
android:textColor="@color/colorAccent" android:textColor="@color/colorAccent"
android:layout_height="20dp" /> android:layout_height="20dp" />
<com.qimai.android.widget.StoreLocalLayout <com.qimai.android.widget.StoreLocalLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp"> android:layout_height="100dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="测试111111 " android:text="测试111111 "
...@@ -51,6 +59,19 @@ ...@@ -51,6 +59,19 @@
android:layout_height="20dp" /> android:layout_height="20dp" />
</com.qimai.android.widget.StoreLocalLayout> </com.qimai.android.widget.StoreLocalLayout>
<EditText
android:id="@+id/inputText"
android:textColor="#000000"
android:textSize="22sp"
tools:text="2222"
android:layout_width="match_parent"
android:layout_height="80dp" />
<com.qmai.android.keyboard.NumberKeyBoard
android:id="@+id/keyboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="车道上的金佛耳机佛"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="qmdrawerLayoutStyle" format="reference"/>
<attr name="elevation" format="dimension" />
<declare-styleable name="QmDrawerLayout">
<!-- The height difference between the drawer and the base surface. Only takes effect on API 21 and above -->
<attr name="elevation"/>
</declare-styleable>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="qm_def_drawer_elevation">10dp</dimen>
</resources>
\ No newline at end of file
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="qmKeyboardViewStyle">@style/Widget.qmKeyboardViewStyleValue</item>
</style> </style>
<style name="tangshi"> <style name="tangshi">
<item name="overlay_radius">5dp</item> <item name="overlay_radius">5dp</item>
......
include ':KeyBoardView'
include ':app', ':widgetlib', ':tools', ':smallwidget', ':usefulltool' include ':app', ':widgetlib', ':tools', ':smallwidget', ':usefulltool'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment