Skip to content

Commit

Permalink
[优化] 优化布局
Browse files Browse the repository at this point in the history
  • Loading branch information
F1ReKing committed Jan 31, 2018
1 parent a58ceec commit e3b9437
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 40 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
#### Step 1. Add the JitPack repository to your build file
```
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
```

#### Step 2. Add the dependency
```
dependencies {
compile 'com.github.F1ReKing:StatusLayout:1.0.0'
}
dependencies {
compile 'com.github.F1ReKing:StatusLayout:1.0.0'
}
```

## 使用
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 100
versionName "1.0.0"
versionCode 110
versionName "1.1.0"
}

buildTypes {
Expand Down
9 changes: 9 additions & 0 deletions library/src/main/res/drawable/ic_empty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="64dp"
android:viewportHeight="1024.0"
android:viewportWidth="1024.0"
android:width="64dp">
<path
android:fillColor="#FF515151"
android:pathData="M855.9,390.2 L520.4,221 624,94.3c5.4,-6.6 14.7,-8.5 22.2,-4.4L945,249.3c10,5.3 12.5,18.4 5.3,27.1L855.9,390.2 855.9,390.2zM415.4,94.5l99.3,126.5L182.2,390.2 82.6,273.8c-7.5,-8.8 -4.8,-22.2 5.4,-27.5L393.3,89.7C400.9,85.8 410.2,87.8 415.4,94.5zM509.4,549.6l-56.8,160.5c-1.4,3.8 -5.8,5.6 -9.4,3.8L131.7,554.2c-5.2,-2.6 -7.5,-8.7 -5.5,-14.1l55.8,-149.3L509.4,549.6 509.4,549.6zM506.8,612.3 L506.8,906.8c0,3.9 -4,6.5 -7.6,4.8L171.4,757.3c-6.2,-2.9 -10.2,-9.1 -10.1,-16l1,-140.5c0,-4.3 4.6,-7.1 8.4,-5.1l279.5,144.4c5.2,2.6 11.4,0.2 13.5,-5.2L506.8,612.3zM581.9,711.3 L527,549.6l328.9,-158.8 62.6,147.4c2.4,5.6 -0,12 -5.5,14.6L587.7,713.7C585.5,714.8 582.7,713.7 581.9,711.3zM873.7,742.9c0,5.9 -3.4,11.3 -8.8,13.7L536.8,911.6c-3.5,1.6 -7.6,-0.9 -7.6,-4.8L529.3,612.3l40.6,124.1c1.5,4.2 6.3,6.1 10.3,4.2l283,-142.6c4.9,-2.4 10.7,1.1 10.7,6.6L873.7,742.9z"/>
</vector>
9 changes: 9 additions & 0 deletions library/src/main/res/drawable/ic_error.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="64dp"
android:viewportHeight="1024"
android:viewportWidth="1024"
android:width="64dp">
<path
android:fillColor="#FF515151"
android:pathData="M512,85.3c-235.5,0 -426.7,190.9 -426.7,426.7s191.1,426.7 426.7,426.7 426.7,-190.9 426.7,-426.7 -191.1,-426.7 -426.7,-426.7zM554.7,725.3l-85.3,0 0,-85.3 85.3,0 0,85.3zM554.7,554.7l-85.3,0 0,-256 85.3,0 0,256z"/>
</vector>
Binary file removed library/src/main/res/drawable/ic_no.png
Binary file not shown.
6 changes: 0 additions & 6 deletions library/src/main/res/drawable/shape_bg_click.xml

This file was deleted.

18 changes: 9 additions & 9 deletions library/src/main/res/layout/layout_empty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@

<ImageView
android:id="@+id/iv_status_empty"
android:layout_width="150dp"
android:layout_height="100dp"
android:src="@drawable/ic_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_empty"
/>

<TextView
android:id="@+id/tv_status_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="数据为空"
android:textColor="@color/title"
android:textSize="16sp"
Expand All @@ -27,12 +29,10 @@
android:id="@+id/tv_click_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/shape_bg_click"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:layout_marginTop="5dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:padding="10dp"
android:text="刷新"
android:textColor="@color/click"
android:textSize="14sp"
Expand Down
24 changes: 12 additions & 12 deletions library/src/main/res/layout/layout_error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical"
android:background="@color/white"
>

<ImageView
android:id="@+id/iv_status_error"
android:layout_width="150dp"
android:layout_height="100dp"
android:src="@drawable/ic_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_error"
/>

<TextView
android:id="@+id/tv_status_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="发生错误,请重试"
android:textSize="16sp"
android:textColor="@color/title"
android:textSize="16sp"
/>

<TextView
android:id="@+id/tv_click_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginTop="5dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:padding="10dp"
android:text="重新加载"
android:textSize="14sp"
android:textColor="@color/click"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:background="@drawable/shape_bg_click"
android:textSize="14sp"
/>
</LinearLayout>
1 change: 1 addition & 0 deletions library/src/main/res/layout/layout_loading.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
android:text="加载中"
android:textColor="@color/text"
android:textSize="16sp"
android:gravity="center"
/>

</LinearLayout>
2 changes: 1 addition & 1 deletion library/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<color name="title">#333333</color>
<color name="text">#888888</color>

<color name="click">#FF4081</color>
<color name="click">#455A64</color>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.Toast
import com.f1reking.statuslayout.R.id.tv_content
import com.f1reking.statuslayout.library.StatusClickListener
import com.f1reking.statuslayout.library.StatusLayout
import kotlinx.android.synthetic.main.activity_main.tv_content
Expand All @@ -23,7 +24,7 @@ class MainActivity : AppCompatActivity() {
private fun initView() {
statusLayout = StatusLayout.Builder(tv_content)
.setLoadingText("加载中...")
.setEmptyText("空数据了...")
.setEmptyText("空数据了\ndadwadwadwad")
.setErrorText("错误了...")
.setStatusClickListener(object :StatusClickListener{
override fun onEmptyClick(view: View) {
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<color name="colorPrimary">#212121</color>
<color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#455A64</color>
<color name="accent">#455A64</color>

<color name="white">#ffffff</color>
<color name="title">#333333</color>
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">@color/accent</item>
</style>

</resources>

0 comments on commit e3b9437

Please sign in to comment.