-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5048ffc
Showing
80 changed files
with
2,641 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# QLiveMessage | ||
|
||
## 简介: | ||
|
||
下拉拖拽关闭Activity,下拉返回Activity。仿大众点评、快手、小红书详情界面:可下滑关闭详情界面。 | ||
Drag down to close activity | ||
|
||
## 安装体验: | ||
![](https://upload-images.jianshu.io/upload_images/26002059-94273eadb7cf0295.png) | ||
|
||
## 功能(优点): | ||
- ✅Demo包含`瀑布列表跳转到详情,带动画`+`详情可左滑进入个人主页`+`下拉拖拽关闭Activity` | ||
- ✅到为了让Activity的xml布局层级最少,只需要把本库设置为最外层的RelativeLayout | ||
- ✅仿大众点评:下拉过程中除了图片,别的部分随着下拉距离而半透明 | ||
- ✅仿快手:fling快速下滑也可触发关闭 | ||
- ✅详情界面可左滑进入个人主页,你可以自己实现懒加载 | ||
- ✅解决下拉返回ImageView闪一下问题 | ||
- ✅完美解耦,可轻松让你的任何Activity实现下拉关闭效果 | ||
|
||
## 作者说明: | ||
- Android系统的Activity过场动画会让shareElementImageView.setAlpha(0);然后回退动画结束再进行.setAlpha(1)<bar /> | ||
- 这样会导致一个问题:我们下拉返回的时候,由于弹回动画是我们自己做的。但是系统依然会再进行一遍.setAlpha(1),导致回弹动画结束时候图片会闪一下。参考下面的第1个gif<bar /> | ||
- 为了解决"闪一下"的问题,我用这种方法把他提前设为.setAlpha(1)<bar /> | ||
|
||
|
||
## 效果gif图(Gif图有点卡,实际运行一点都不卡): | ||
![](https://upload-images.jianshu.io/upload_images/26002059-96c272f540bddb21.gif) | ||
![](https://upload-images.jianshu.io/upload_images/26002059-da019a1de650eca8.gif) | ||
|
||
## 导入 | ||
``` | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
dependencies { | ||
implementation 'com.github.QDong415:QLiveMessage:v1.0.1' | ||
} | ||
``` | ||
|
||
## 使用 | ||
|
||
```java | ||
QDragRelativeLayout contentLayout = findViewById(R.id.drag_layout); | ||
contentLayout.setOnLiveMessageListener(this); | ||
//传入列表的点击项目的ImageView的坐标 | ||
contentLayout.setupFromImageView(fromX, fromY, fromWidth, fromHeight, transition_share_view); | ||
``` | ||
|
||
```xml | ||
<declare-styleable name="QLiveMessage"> | ||
<!-- 是否可以手势下拉,默认true --> | ||
<attr name="dragEnable" format="boolean" /> | ||
<!-- 下拉距离占总height百分之多少就触发关闭,0 - 1之间,默认0.2 --> | ||
<attr name="closeYRatio" format="float" /> | ||
<!-- 手指快速下滑也可以触发关闭,默认true --> | ||
<attr name="flingCloseEnable" format="boolean" /> | ||
<!-- 手势下拉过程中,其他View根据滑动距离半透明,默认false --> | ||
<attr name="alphaWhenDragging" format="boolean" /> | ||
<!-- 关闭动画耗时,默认450 --> | ||
<attr name="closeAnimationDuration" format="integer" /> | ||
<!-- 下拉力度不够,反弹回正常状态动画耗时,默认200 --> | ||
<attr name="rollToNormalAnimationDuration" format="integer" /> | ||
</declare-styleable> | ||
``` | ||
|
||
|
||
## Author:DQ | ||
|
||
有问题联系QQ:285275534, 285275534@qq.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
compileSdk 31 | ||
|
||
defaultConfig { | ||
applicationId "com.dq.livemessagedemo" | ||
minSdk 21 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0.1" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
|
||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'com.google.android.material:material:1.3.0' | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
|
||
// Retrofit | ||
implementation 'com.squareup.retrofit2:retrofit:2.9.0' | ||
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0' | ||
|
||
//性能监控 kotlin编译插件为1.3.72; 支持Gradle 6.8及以下 | ||
debugImplementation 'io.github.didi.dokit:dokitx:3.5.0.1' | ||
|
||
implementation project(path: ':liveMessage') | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": 2, | ||
"artifactType": { | ||
"type": "APK", | ||
"kind": "Directory" | ||
}, | ||
"applicationId": "com.dq.livemessagedemo", | ||
"variantName": "processReleaseResources", | ||
"elements": [ | ||
{ | ||
"type": "SINGLE", | ||
"filters": [], | ||
"versionCode": 1, | ||
"versionName": "1.0.1", | ||
"outputFile": "app-release.apk" | ||
} | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/dq/livemessagedemo/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.dq.livemessagedemo; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("com.dq.livemessagedemo", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.dq.livemessagedemo"> | ||
|
||
<application | ||
android:name="com.dq.livemessagedemo.tool.QApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.LiveMessageDemo"> | ||
|
||
<activity | ||
android:name=".RootActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name=".LiveActivity" | ||
android:screenOrientation="portrait" /> | ||
|
||
</application> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
</manifest> |
Oops, something went wrong.