├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── gradle.xml ├── markdown-navigator-enh.xml ├── markdown-navigator.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── README_EN.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── lmx │ │ └── clearscreenapp │ │ └── MainActivity.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── lmx │ │ └── library │ │ └── widget │ │ ├── ClearScreenLayout.java │ │ └── SlideDirection.java │ └── res │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | xmlns:android 11 | 12 | ^$ 13 | 14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 | xmlns:.* 22 | 23 | ^$ 24 | 25 | 26 | BY_NAME 27 | 28 |
29 |
30 | 31 | 32 | 33 | .*:id 34 | 35 | http://schemas.android.com/apk/res/android 36 | 37 | 38 | 39 |
40 |
41 | 42 | 43 | 44 | .*:name 45 | 46 | http://schemas.android.com/apk/res/android 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | name 56 | 57 | ^$ 58 | 59 | 60 | 61 |
62 |
63 | 64 | 65 | 66 | style 67 | 68 | ^$ 69 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | .* 78 | 79 | ^$ 80 | 81 | 82 | BY_NAME 83 | 84 |
85 |
86 | 87 | 88 | 89 | .* 90 | 91 | http://schemas.android.com/apk/res/android 92 | 93 | 94 | ANDROID_ATTRIBUTE_ORDER 95 | 96 |
97 |
98 | 99 | 100 | 101 | .* 102 | 103 | .* 104 | 105 | 106 | BY_NAME 107 | 108 |
109 |
110 |
111 |
112 |
113 |
-------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/markdown-navigator-enh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # clearscreen 2 | 3 | ![](https://img.shields.io/badge/version-1.2.1-brightgreen.svg)  4 | ![](https://img.shields.io/badge/license-Apache%202-blue.svg) 5 | 6 | [**English**](https://github.com/lmxjw3/clearscreen/blob/master/README_EN.md) 7 | 8 | 直播间左滑或右滑清屏控件 9 | 10 | 11 | ### Import 12 | ``` 13 | implementation 'com.lmxjw3.widget:clearscreen:1.2.1' 14 | ``` 15 | 16 | 17 | ### Usage 18 | 19 | ##### 1. 像使用 FrameLayout 一样在根布局使用 ClearScreenLayout。 20 | 21 | ##### 2. API 22 | ``` 23 | // 添加需要滑动清屏的View 24 | addClearViews(View... views) 25 | 26 | // 移除需要滑动清屏的View 27 | removeClearViews(View... views) 28 | 29 | // 移除所有需要滑动清屏的View 30 | removeAllClearViews() 31 | 32 | // 设置滑动方向(左滑 or 右滑) 33 | setSlideDirection(SlideDirection direction) 34 | 35 | // 设置滑动监听器 36 | setOnSlideListener(OnSlideClearListener slideListener) 37 | 38 | // 滑动开关 39 | setEnabled(boolean enable) 40 | 41 | // 清屏(有动画) 42 | clearWithAnim() 43 | // 清屏(无动画) 44 | clearWithoutAnim() 45 | // 还原(有动画) 46 | restoreWithAnim() 47 | // 还原(无动画) 48 | restoreWithoutAnim() 49 | ``` -------------------------------------------------------------------------------- /README_EN.md: -------------------------------------------------------------------------------- 1 | # clearscreen 2 | 3 | ![](https://img.shields.io/badge/version-1.2.1-brightgreen.svg)  4 | ![](https://img.shields.io/badge/license-Apache%202-blue.svg) 5 | 6 | [**中文版**](https://github.com/lmxjw3/clearscreen/blob/master/README.md) 7 | 8 | Swipe left or right to clear screen controls 9 | 10 | 11 | ### Import 12 | ``` 13 | implementation 'com.lmxjw3.widget:clearscreen:1.2.1' 14 | ``` 15 | 16 | 17 | ### Usage 18 | 19 | ##### 1. Use ClearScreenLayout in root layout like using FrameLayout. 20 | 21 | ##### 2. API 22 | ``` 23 | // Add swipe clear view 24 | addClearViews(View... views) 25 | 26 | // Remove swipe clear view 27 | removeClearViews(View... views) 28 | 29 | // Remove all swipe clear views 30 | removeAllClearViews() 31 | 32 | // Set swipe direction(LEFT or RIGHT) 33 | setSlideDirection(SlideDirection direction) 34 | 35 | // Set swipe listener 36 | setOnSlideListener(OnSlideClearListener slideListener) 37 | 38 | // Enabled swipe 39 | setEnabled(boolean enable) 40 | 41 | clearWithAnim() 42 | clearWithoutAnim() 43 | restoreWithAnim() 44 | restoreWithoutAnim() 45 | ``` -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | defaultConfig { 6 | applicationId "com.lmx.clearscreenapp" 7 | minSdkVersion 15 8 | targetSdkVersion 29 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'androidx.appcompat:appcompat:1.1.0' 24 | implementation project(path: ':library') 25 | // implementation "com.lmxjw3.widget:clearscreen:1.2.0" 26 | } 27 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/lmx/clearscreenapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.lmx.clearscreenapp; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.TextView; 8 | 9 | import com.lmx.library.widget.ClearScreenLayout; 10 | 11 | public class MainActivity extends AppCompatActivity implements View.OnClickListener { 12 | private ClearScreenLayout layoutClear; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | init(); 19 | } 20 | 21 | private void init() { 22 | layoutClear = findViewById(R.id.layoutClear); 23 | View viewWhite = findViewById(R.id.viewWhite); 24 | View ll12 = findViewById(R.id.ll12); 25 | View tv3 = findViewById(R.id.tv3); 26 | View viewBg = findViewById(R.id.viewBg); 27 | layoutClear.addClearViews(viewWhite, ll12, tv3, viewBg); 28 | } 29 | 30 | @Override 31 | public void onClick(View view) { 32 | switch (view.getId()) { 33 | case R.id.btnClearWithAnim: 34 | layoutClear.clearWithAnim(); 35 | break; 36 | case R.id.btnRestoreWithAnim: 37 | layoutClear.restoreWithAnim(); 38 | break; 39 | case R.id.btnClearNoAnim: 40 | layoutClear.clearWithoutAnim(); 41 | break; 42 | case R.id.btnRestoreNoAnim: 43 | layoutClear.restoreWithoutAnim(); 44 | break; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 20 | 21 | 28 | 29 | 36 | 37 | 42 | 43 | 48 | 49 | 50 | 57 | 58 | 64 | 65 | 70 | 71 | 72 | 80 | 81 |