-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
1,405 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ | |
/build | ||
/captures | ||
.externalNativeBuild | ||
/.idea/ | ||
/release/ | ||
|
||
/app/release/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
|
||
# Chameleoen | ||
|
||
|
||
<img src="/pic/logo.png" width = 20%> | ||
|
||
[![](https://jitpack.io/v/sangcomz/chameleon.svg)](https://jitpack.io/#sangcomz/chameleon) | ||
|
||
Chameleoen deals with the Status of RecyclerView. | ||
|
||
## How to Use | ||
|
||
### Gradle | ||
```groovy | ||
repositories { | ||
maven { url 'https://jitpack.io' } | ||
} | ||
dependencies { | ||
compile 'com.github.sangcomz:Chameleon:v0.0.1' | ||
} | ||
``` | ||
### Usage | ||
```xml | ||
<xyz.sangcomz.chameleon.Chameleon xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/root" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:emptyButtonBackgroundColor="@color/colorPrimary" | ||
app:emptyButtonText="+Add Chameleon" | ||
app:emptyButtonTextColor="#ffffff" | ||
app:emptyButtonTextSize="12sp" | ||
app:emptyDrawable="@drawable/ic_empty" | ||
app:emptySubText="@string/sub_empty" | ||
app:emptyText="@string/empty" | ||
app:errorButtonBackgroundColor="@color/colorPrimary" | ||
app:errorButtonText="Retry" | ||
app:errorButtonTextColor="#ffffff" | ||
app:errorButtonTextSize="12sp" | ||
app:errorDrawable="@drawable/ic_error" | ||
app:errorSubText="@string/sub_error" | ||
app:errorText="@string/error" | ||
app:isLargeProgress="true" | ||
app:progressDrawable="@drawable/drawable_progress" | ||
app:useEmptyButton="true" | ||
app:useErrorButton="true" | ||
tools:context="xyz.sangcomz.chameleonsample.MainActivity"> | ||
|
||
<android.support.v7.widget.RecyclerView | ||
android:id="@+id/rv_main_list" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</xyz.sangcomz.chameleon.Chameleon> | ||
``` | ||
|
||
#### STATUS | ||
| Status | Description | | ||
|:--------:|------------------| | ||
| CONTENT | show content | | ||
| LOADING | show progress | | ||
| EMPTY | show empty view | | ||
| ERROR | show error view | | ||
|
||
##### usage | ||
```kotlin | ||
chameleon.showState(Chameleon.STATE.CONTENT) | ||
chameleon.showState(Chameleon.STATE.LOADING) | ||
chameleon.showState(Chameleon.STATE.EMPTY) | ||
chameleon.showState(Chameleon.STATE.ERROR) | ||
|
||
chameleon.setEmptyButtonClickListener { Toast.makeText(this, "Empty Button!", Toast.LENGTH_LONG).show() } | ||
chameleon.setErrorButtonClickListener { Toast.makeText(this, "Error Button!", Toast.LENGTH_LONG).show() } | ||
``` | ||
|
||
#### attribute | ||
|
||
| Attribute Name | Description | Default Value | | ||
|:--------------------------:|-------------------------------------------|:-------------------:| | ||
| emptyText | empty view Change text | "empty" | | ||
| emptyTextColor | empty view Change text color | #808080 | | ||
| emptyTextSize | empty view Change text size | 24sp | | ||
| emptySubText | empty view Change sub text | "empty content" | | ||
| emptySubTextColor | empty view Change sub text color | #b7b7b7 | | ||
| emptySubTextSize | empty view Change sub text size | 16sp | | ||
| emptyDrawable | empty view Change drawable | R.drawable.ic_empty | | ||
| emptyButtonText | empty view Change button text | "retry" | | ||
| emptyButtonTextColor | empty view Change button text color | #808080 | | ||
| emptyButtonTextSize | empty view Change button text size | 24sp | | ||
| emptyButtonBackgroundColor | empty view Change button background color | #b7b7b7 | | ||
| useEmptyButton | Change whether to use empty view Button | false | | ||
| errorText | error view Change text | "error" | | ||
| errorTextColor | error view Change text color | #808080 | | ||
| errorTextSize | error view Change text size | 24sp | | ||
| errorSubText | error view Change sub text | "error content" | | ||
| errorSubTextColor | error view Change sub text color | #b7b7b7 | | ||
| errorSubTextSize | error view Change sub text size | 16sp | | ||
| errorDrawable | error view Change drawable | R.drawable.ic_error | | ||
| errorButtonText | error view Change button text | "retry" | | ||
| errorButtonTextColor | error view Change button text color | #808080 | | ||
| errorButtonTextSize | error view Change button text size | 24sp | | ||
| errorButtonBackgroundColor | error view Change button background color | #808080 | | ||
| useErrorButton | Change whether to use error view Button | false | | ||
| progressDrawable | progress drawable setting | - | | ||
| isLargeProgress | Whether to use large progress | false | | ||
|
||
|
||
## Result Screen | ||
|
||
| Project Name | Result Screen | | ||
|:---------:|---| | ||
| Sample <p style="float:left;"> <a href="https://play.google.com/store/apps/details?id=xyz.sangcomz.chameleonsample"> <img HEIGHT="40" WIDTH="135" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a></p> | <img src="/pic/sample.gif"> | | ||
|
||
# Contribute | ||
We welcome any contributions. | ||
|
||
# Inspired by | ||
* [Kennyc1012/MultiStateView](https://github.com/Kennyc1012/MultiStateView), I was inspired by his code. | ||
|
||
# License | ||
|
||
Copyright 2018 Jeong Seok-Won | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,55 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
apply plugin: 'kotlin-android' | ||
|
||
apply plugin: 'kotlin-android-extensions' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
signingConfigs { | ||
if (project.rootProject.file('release/sign.properties').exists()) { | ||
Properties signProp = new Properties() | ||
signProp.load(project.rootProject.file('release/sign.properties').newDataInputStream()) | ||
config { | ||
keyAlias signProp.get("alias") ? signProp.get("alias") : "" | ||
keyPassword signProp.get("alias_password") ? signProp.get("alias_password") : "" | ||
storeFile rootProject.file("release/key.jks") | ||
storePassword signProp.get("password") ? signProp.get("password") : "" | ||
v2SigningEnabled true | ||
} | ||
} | ||
} | ||
|
||
compileSdkVersion gradle.compileSdk | ||
defaultConfig { | ||
applicationId "xyz.sangcomz.chameleonsample" | ||
minSdkVersion 15 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
minSdkVersion gradle.minSdk | ||
targetSdkVersion gradle.targetSdk | ||
versionName gradle.versionName | ||
versionCode gradle.versionCode | ||
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
if (project.rootProject.file('release/sign.properties').exists()) { | ||
signingConfig signingConfigs.config | ||
} | ||
} | ||
|
||
debug { | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" | ||
implementation "com.android.support:appcompat-v7:$support_version" | ||
implementation "com.android.support.constraint:constraint-layout:$constraint_version" | ||
project (':chameleon') | ||
implementation 'com.squareup.picasso:picasso:2.71828' | ||
implementation 'xyz.sangcomz:dalcomz:0.0.4' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.1' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' | ||
implementation project(':chameleon') | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package xyz.sangcomz.chameleonsample | ||
|
||
/** | ||
* Created by sangcomz on 27/03/2018. | ||
*/ | ||
data class Chameleon(val petName: String, | ||
val drawableId: Int) |
50 changes: 50 additions & 0 deletions
50
app/src/main/java/xyz/sangcomz/chameleonsample/ChameleonAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package xyz.sangcomz.chameleonsample | ||
|
||
import android.support.v7.widget.AppCompatImageView | ||
import android.support.v7.widget.AppCompatTextView | ||
import android.support.v7.widget.RecyclerView | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.squareup.picasso.Picasso | ||
|
||
/** | ||
* Created by sangcomz on 27/03/2018. | ||
*/ | ||
class ChameleonAdapter : RecyclerView.Adapter<ChameleonAdapter.ViewHolder>() { | ||
private var chameleonList: List<Chameleon> = arrayListOf() | ||
|
||
fun setChameleonList(chameleonList: List<Chameleon>) { | ||
this.chameleonList = chameleonList | ||
notifyDataSetChanged() | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
return ViewHolder( | ||
LayoutInflater.from(parent.context).inflate(R.layout.item_chamelon, parent, false) | ||
) | ||
} | ||
|
||
override fun getItemCount(): Int = chameleonList.size | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
holder.setItem(chameleonList[position]) | ||
} | ||
|
||
|
||
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
|
||
private val ivItemChameleon = itemView.findViewById<AppCompatImageView>(R.id.iv_item_chameleon) | ||
private val tvItemChameleon = itemView.findViewById<AppCompatTextView>(R.id.tv_item_chameleon) | ||
|
||
fun setItem(chameleon: Chameleon) { | ||
Picasso.get() | ||
.load(chameleon.drawableId) | ||
.fit() | ||
.centerCrop() | ||
.into(ivItemChameleon) | ||
tvItemChameleon.text = chameleon.petName | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.