MCPcopy Index your code
hub / github.com/LianjiaTech/ProgressLayout

github.com/LianjiaTech/ProgressLayout @1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.0 ↗ · + Follow
45 symbols 105 edges 7 files 13 documented · 29%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ProgressLayout

介绍

一个轻量的ProgressLayout,能够帮助你实现“加载中”、“无内容”,“网络错误”,“加载失败”等不同场景下的页面切换与展示,并且支持点击页面重试。

用法

首先,在项目根目录下的build.gradle中添加如下代码:

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

其次,在module的build.gradle中添加最新版本库的依赖:

 dependencies {
           compile 'com.github.LianjiaTech:ProgressLayout:x.y.z'
  }

可以通过下几种属性来指定不同情况需要展现的layout:

<resources>
  <declare-styleable name="ProgressLayout">

    <attr name="loading_layout" format="integer"/>

    <attr name="none_content" format="integer"/>

    <attr name="network_content" format="integer"/>

    <attr name="failed_content" format="integer"/>
  </declare-styleable>

  <attr name="progressLayoutDefStyle" format="reference"/>
</resources>

在Xml中设置

<com.lianjiatech.infrastructure.ProgressLayout
      android:layout_below="@id/scroller"
      android:id="@+id/progress_container"
      android:layout_margin="@dimen/material_4dp"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/boundary_background"
      app:loading_layout="@layout/loading_layout"
      app:none_content="@layout/none_layout"
      app:network_content="@layout/connectionless_layout"
      app:failed_content="@layout/failed_layout"
      >


   ......

  </com.lianjiatech.infrastructure.ProgressLayout>

在Theme中设置

如果不同的Activity需要对应不同的页面,也可以通过在Theme中指定progressLayoutDefStyle的方式来设置需要的Layout:


  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

     ......

    <item name="progressLayoutDefStyle">@style/progressLayoutStyle</item>
  </style>

  <style name="progressLayoutStyle">
    <item name="loading_layout">@layout/loading_layout</item>
    <item name="none_content">@layout/none_layout</item>
    <item name="network_content">@layout/connectionless_layout</item>
    <item name="failed_content">@layout/failed_layout</item>
  </style>

函数使用

通过调用不同的方法,来展示对应的页面,如.showLoading();.showContent()等。或者为“错误页面”添加点击重试事件:

  progressLayout.showNetError(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                /*重试逻辑*/
            }
        });

GIF

Developed By

  • 小鄧子 - dengwei@lianjia.com

License

Copyright 2016 LianjiaTech, Inc.

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.

Core symbols most depended-on inside this repo

setContentVisibility
called by 6
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
addView
called by 4
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
hideLoadingView
called by 4
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
hideNoneView
called by 4
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
hideNetErrorView
called by 4
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
hideFailedView
called by 4
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
showLoading
called by 3
progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java
init
called by 1
sample/src/main/java/com/lianjiatech/infrastructure/example/SmartTextView.java

Shape

Method 37
Class 7
Enum 1

Languages

Java100%

Modules by API surface

progressLayout/src/main/java/com/lianjiatech/infrastructure/ProgressLayout.java25 symbols
sample/src/main/java/com/lianjiatech/infrastructure/example/MainActivity.java9 symbols
sample/src/main/java/com/lianjiatech/infrastructure/example/SmartTextView.java3 symbols
sample/src/test/java/com/lianjiatech/infrastructure/example/ExampleUnitTest.java2 symbols
sample/src/androidTest/java/com/lianjiatech/infrastructure/example/ApplicationTest.java2 symbols
progressLayout/src/test/java/com/lianjiatech/infrastructure/ExampleUnitTest.java2 symbols
progressLayout/src/androidTest/java/com/lianjiatech/infrastructure/ApplicationTest.java2 symbols

For agents

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

⬇ download graph artifact