Commit 93329b07 authored by 王韦's avatar 王韦

[new] 优化pop base

parent eb094659
......@@ -29,37 +29,40 @@ class CommomPopActivity : AppCompatActivity() {
// .build()
// commonPopWindow.show(findViewById(R.id.root))
// commonPopWindow.dimBehind(0.5f)
i = System.currentTimeMillis()
"$i".V()
// i.hashCode().toString().V()
if (dialog == null) {
val right: (CommonPopWindow: CommonPopWindow) -> Unit = {
Toast.makeText(this, "确定", Toast.LENGTH_SHORT).show()
it.dismiss()
"$i".V()
// "---------${i.hashCode()}".V()
}
dialog = QmAlertDialog
.Builder()
.withContext(this)
.withLeftButton(leftButtonText = "取消", clickListener = {
Toast.makeText(this, "取消", Toast.LENGTH_SHORT).show()
it.dismiss()
TestWindow(this, findViewById<Button>(R.id.root)).build().show()
})
.withRightButton(rightButtonText = "确定", clickListener = right).withRootView(
findViewById(R.id.root)
)
.withTitle("订单1111")
.withSubTitle("子标题")
.withWidth(400)
.build()
}
dialog?.show()
// i = System.currentTimeMillis()
// "$i".V()
//// i.hashCode().toString().V()
// if (dialog == null) {
// val right: (CommonPopWindow: CommonPopWindow) -> Unit = {
// Toast.makeText(this, "确定", Toast.LENGTH_SHORT).show()
// it.dismiss()
// "$i".V()
//// "---------${i.hashCode()}".V()
//
// }
//
//
// dialog = QmAlertDialog
// .Builder()
// .withContext(this)
// .withLeftButton(leftButtonText = "取消", clickListener = {
// Toast.makeText(this, "取消", Toast.LENGTH_SHORT).show()
// it.dismiss()
//
// })
// .withRightButton(rightButtonText = "确定", clickListener = right).withRootView(
//
// findViewById(R.id.root)
// )
// .withTitle("订单1111")
// .withSubTitle("子标题")
// .withWidth(400)
// .build()
// }
// dialog?.show()
}
......
......@@ -19,13 +19,13 @@ class MainActivity : AppCompatActivity() {
// ToastUtils.getInstance().showCenter("测试测试")
// ToastUtils.getInstance().setMsgColor(Color.RED).showTaost("测试出的的")
//
//// startActivity(Intent(MainActivity@ this, CommomPopActivity::class.java))
//// val loding = Loading()
//// loding.isCancelable =false
//// loding.show(supportFragmentManager, "loading")
TestWindow(this, findViewById<Button>(R.id.commonPop)).build().show()
startActivity(Intent(MainActivity@ this, CommomPopActivity::class.java))
// val loding = Loading()
// loding.isCancelable =false
// loding.show(supportFragmentManager, "loading")
// TestWindow(this, findViewById<Button>(R.id.commonPop)).build().show()
}
......
......@@ -5,6 +5,7 @@ import android.graphics.Point
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import com.qimai.android.tools.dpTopx
import com.qimai.android.tools.getScreenWidth
import com.qimai.android.widgetlib.popup.AbsQMBasePopup
......@@ -29,6 +30,10 @@ class TestWindow constructor(var ctx: Context, var anchor: View) : AbsQMBasePopu
}
override fun onShowBegin(contentView: View): Point {
contentView.findViewById<TextView>(R.id.alert_confirm)
.setOnClickListener {
dismiss()
}
return Point(0, 0)
}
......
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.60'
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.41'
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }// 阿里云镜像
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
google()
jcenter()
......@@ -28,12 +30,13 @@ buildscript {
}
}
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }// 阿里云镜像
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
google()
jcenter()
......
include ':app', ':widgetlib', ':tools', ':fragmentcontroller'
include ':app', ':widgetlib', ':tools', ':fragmentcontroller', ':smallwidget', ':usefulltool'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
# 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
package com.qmai.android.samllwidget
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.qmai.android.samllwidget.test", appContext.packageName)
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.qmai.android.samllwidget" />
package com.qmai.android.samllwidget;
import android.content.Context;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
/**
* created by wangwei ON 2019-11-13 email:wangwei_5521@163.com
*
* @version 1.1.1
* @Description
**/
public class CheckTextView extends AppCompatTextView {
public CheckTextView(Context context) {
super(context);
}
public CheckTextView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public CheckTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}
<resources>
<string name="app_name">SamllWidget</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CheckTextView">
<attr name="check_bg_color" format="color" />
<attr name="radius" format="integer" />
</declare-styleable>
</resources>
\ No newline at end of file
package com.qmai.android.samllwidget
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)
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
# 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
package com.qmai.android.usefulltool
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.qmai.android.usefulltool.test", appContext.packageName)
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.qmai.android.usefulltool" />
<resources>
<string name="app_name">usefullTool</string>
</resources>
package com.qmai.android.usefulltool
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)
}
}
......@@ -47,7 +47,7 @@ repositories {
group 'com.qmai.android.sdk'
version '1.1.19-SNAPSHOT'
version '1.1.20-SNAPSHOT'
gradlePublish {
......
......@@ -18,7 +18,7 @@ import android.widget.PopupWindow
abstract class AbsQMBasePopup(open var context: Context) {
private var mWindow = PopupWindow()
protected var mWindow = PopupWindow()
private lateinit var mRootViewWrapper: FrameLayout
private lateinit var mWindowManager: WindowManager
......@@ -151,7 +151,7 @@ abstract class AbsQMBasePopup(open var context: Context) {
}
}
} catch (ignore: Exception) {
// irgnore
}
return decorView
......@@ -166,7 +166,5 @@ abstract class AbsQMBasePopup(open var context: Context) {
lateinit var mContentView: View
lateinit var mAnchorView: View
var isOutsideTouchable = true
}
}
\ No newline at end of file
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