MCPcopy Index your code
hub / github.com/Yellow5A5/ClearScreenHelper

github.com/Yellow5A5/ClearScreenHelper @1.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.2 ↗ · + Follow
89 symbols 188 edges 14 files 14 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ClearScreenHelper

中文][English

In our daily work, we may need to clean the UI from screen occasionally. The main way is through a Event of Button-Click, but some application can clean the UI by sliding the screen. In my mind, cleaning the screen by sliding-mode will be more favored by the user. The ClearScreenHelper will make this feature easily to implement. I hope it will be helpful to you.

Import

Step 1. Add the JitPack repository to your build file

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }

Step 2. Add the dependency

    dependencies {
            compile 'com.github.Yellow5A5:ClearScreenHelper:1.0.1'
    }

Introduction

ClearScreenHelper has the following advantages:

  • Minimal changes to the original code
  • Dynamic settings the UI which need to be removed
  • Simple and Convenient in maintenance

Demo Show here:

Usage

First Mode(Recomment)

Step 1: replace outermost layout in xml

Original Layout Replace To
RelativeLayout RelativeRootView
LinearLayout LinearRootView
FrameLayout FrameRootView

eg.

  • Original Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/sample_clear_root_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="yellow5a5.sample.SampleFirActivity">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        .......
        .......
        .......
  • After Be Replaced:
<?xml version="1.0" encoding="utf-8"?>
<yellow5a5.clearscreenhelper.View.RelativeRootView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/sample_clear_root_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="yellow5a5.sample.SampleFirActivity">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        .......
        .......
        .......

Step 2: Init in Java.

mClearRootLayout = (RelativeRootView) findViewById(R.id.sample_clear_root_layout);
mClearScreenHelper = new ClearScreenHelper(this, mClearRootLayout);
mClearScreenHelper.bind(mLeftBottomBtn, mRightBottomBtn, mRightTopTextV, mFansTextV, mInfoTextV);

//Add the callback if you want.
mClearScreenHelper.setIClearEvent(new IClearEvent() {
    @Override
    public void onClearEnd() {
        Toast.makeText(SampleFirActivity.this, "Clear End...", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRecovery() {
        Toast.makeText(SampleFirActivity.this, "Recovery Now...", Toast.LENGTH_SHORT).show();
    }
});

Second Mode(Not recommended for use.)

  • Not recommended for use beacause we must move from side of screen in this mode, and it will cover the event of touch.
mClearScreenHelper = new ClearScreenHelper(this);
mClearScreenHelper.bind(mLeftBottomBtn, mRightBottomBtn, mRightTopTextV, mFansTextV, mInfoTextV);

//Add the callback if you want.
mClearScreenHelper.setIClearEvent(new IClearEvent() {
    @Override
    public void onClearEnd() {
        Toast.makeText(SampleFirActivity.this, "Clear End...", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRecovery() {
        Toast.makeText(SampleFirActivity.this, "Recovery Now...", Toast.LENGTH_SHORT).show();
    }
}

License

Copyright 2016 Yellow5A5

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Extension points exported contracts — how you extend this code

IClearRootView (Interface)
Created by Yellow5A5 on 16/10/24. [4 implementers]
library/src/main/java/yellow5a5/clearscreenhelper/IClearRootView.java
IClearEvent (Interface)
Created by Yellow5A5 on 16/10/27. [2 implementers]
library/src/main/java/yellow5a5/clearscreenhelper/IClearEvent.java
IPositionCallBack (Interface)
Created by Yellow5A5 on 16/10/22. [1 implementers]
library/src/main/java/yellow5a5/clearscreenhelper/IPositionCallBack.java

Core symbols most depended-on inside this repo

onPositionChange
called by 8
library/src/main/java/yellow5a5/clearscreenhelper/IPositionCallBack.java
onClearEnd
called by 5
library/src/main/java/yellow5a5/clearscreenhelper/IClearEvent.java
onRecovery
called by 5
library/src/main/java/yellow5a5/clearscreenhelper/IClearEvent.java
bind
called by 3
library/src/main/java/yellow5a5/clearscreenhelper/ClearScreenHelper.java
isGreaterThanMinSize
called by 3
library/src/main/java/yellow5a5/clearscreenhelper/View/LinearRootView.java
isGreaterThanMinSize
called by 3
library/src/main/java/yellow5a5/clearscreenhelper/View/FrameRootView.java
isGreaterThanMinSize
called by 3
library/src/main/java/yellow5a5/clearscreenhelper/View/RelativeRootView.java
unbind
called by 2
library/src/main/java/yellow5a5/clearscreenhelper/ClearScreenHelper.java

Shape

Method 73
Class 11
Interface 3
Enum 2

Languages

Java100%

Modules by API surface

library/src/main/java/yellow5a5/clearscreenhelper/ClearScreenHelper.java13 symbols
library/src/main/java/yellow5a5/clearscreenhelper/View/ScreenSideView.java12 symbols
library/src/main/java/yellow5a5/clearscreenhelper/View/RelativeRootView.java12 symbols
library/src/main/java/yellow5a5/clearscreenhelper/View/LinearRootView.java12 symbols
library/src/main/java/yellow5a5/clearscreenhelper/View/FrameRootView.java12 symbols
sample/src/main/java/yellow5a5/sample/SampleFirActivity.java7 symbols
library/src/main/java/yellow5a5/clearscreenhelper/IClearRootView.java5 symbols
library/src/main/java/yellow5a5/clearscreenhelper/IClearEvent.java3 symbols
library/src/main/java/yellow5a5/clearscreenhelper/Constants.java3 symbols
sample/src/test/java/yellow5a5/sample/ExampleUnitTest.java2 symbols
sample/src/androidTest/java/yellow5a5/sample/ExampleInstrumentedTest.java2 symbols
library/src/test/java/yellow5a5/clearscreenhelper/ExampleUnitTest.java2 symbols

For agents

$ claude mcp add ClearScreenHelper \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact