GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - LianjiaTech/ProgressLayout: A simple Android library about progress layout

BranchesTags
Open more actions menu

Latest commit

 

History

39 Commits
39 Commits

Folders and files

NameName
Last commit message
Last commit date
images
images
 
 
progressLayout
progressLayout
 
 
sample
sample
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

#ProgressLayout

![Method count](https://img.shields.io/badge/Method count - 62-ff69b4.svg?style=flat) ![Size](https://img.shields.io/badge/Size - 10 KB-ff69b4.svg?style=flat)

GitHub stars GitHub forks GitHub issues

![GitHub license](https://img.shields.io/badge/License - Apache%202-blue.svg?style=flat-square)

介绍

一个轻量的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
      ......
      app:loading_layout="@layout/loading_layout"
      app:none_content="@layout/none_layout"
      app:network_content="@layout/connectionless_layout"
      app:failed_content="@layout/failed_layout"
      >

    <!--Your content layout-->
   ......

  </com.lianjiatech.infrastructure.ProgressLayout>

在Theme中设置

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

  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
     ......

    <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

  • 小鄧子 - [email protected]

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.    

About

A simple Android library about progress layout

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

88 stars

Watchers

4 watching

Forks

11 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.