Skip to content

Commit

Permalink
Merge pull request #20 from santalu/development
Browse files Browse the repository at this point in the history
Rename and update xml attributes for clear intentions
  • Loading branch information
santalu authored Mar 29, 2018
2 parents ed8e7c1 + e550b3c commit 6d53fc6
Show file tree
Hide file tree
Showing 21 changed files with 1,202 additions and 680 deletions.
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
363 changes: 363 additions & 0 deletions .idea/codeStyles/Project.xml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 62 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ allprojects {
```
```
dependencies {
implementation 'com.github.santalu:emptyview:1.1.5'
implementation 'com.github.santalu:emptyview:1.2'
}
```

Expand All @@ -38,25 +38,30 @@ dependencies {
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:emptyButtonText="@string/try_again"
app:emptyButtonTextColor="@color/colorPrimaryDark"
app:emptyDrawable="@drawable/ic_sentiment_dissatisfied"
app:emptyDrawableTint="@color/colorPrimary"
app:emptyFont="@font/allerta"
app:emptyText="@string/empty"
app:emptyTransition="slide"
app:errorBackgroundColor="@color/red"
app:errorButtonBackgroundColor="@color/white"
app:errorButtonText="@string/try_again"
app:errorButtonTextColor="@color/black"
app:errorDrawable="@drawable/ic_sentiment_very_dissatisfied"
app:errorDrawableTint="@color/white"
app:errorText="@string/emptyview_error_unknown"
app:errorTextColor="@color/white"
app:loadingDrawable="@drawable/ic_sentiment_satisfied"
app:loadingStyle="circular"
app:loadingText="@string/emptyview_loading"
app:loadingTint="@color/colorPrimary">
app:ev_buttonTextSize="18sp"
app:ev_empty_button="@string/try_again"
app:ev_empty_buttonTextColor="@color/colorPrimaryDark"
app:ev_empty_drawable="@drawable/ic_sentiment_dissatisfied"
app:ev_empty_drawableTint="@color/colorPrimary"
app:ev_empty_text="@string/empty"
app:ev_empty_title="@string/emptyview_unknown_error_title"
app:ev_error_backgroundColor="@color/red"
app:ev_error_button="@string/try_again"
app:ev_error_buttonTextColor="@color/white"
app:ev_error_drawable="@drawable/ic_sentiment_very_dissatisfied"
app:ev_error_drawableTint="@color/white"
app:ev_error_text="@string/emptyview_unknown_error_text"
app:ev_error_textColor="@color/white"
app:ev_error_title="@string/emptyview_unknown_error_title"
app:ev_error_titleTextColor="@color/white"
app:ev_font="@font/allerta"
app:ev_loading="circular"
app:ev_loading_drawable="@drawable/ic_sentiment_satisfied"
app:ev_loading_drawableTint="@color/colorPrimary"
app:ev_loading_title="@string/emptyview_loading"
app:ev_textSize="16sp"
app:ev_titleTextSize="20sp"
app:ev_transition="slide">

*** your content here ***

Expand All @@ -67,37 +72,45 @@ dependencies {

| Name | Value |
| ------------- |:-------------:|
| loadingStyle | circular, linear, text default circular |
| loadingText | string |
| loadingTextColor | color default black |
| loadingDrawable | reference |
| loadingTint | color default transparent |
| loadingBackgroundColor | color default transparent |
| emptyFont | reference |
| emptyTransition | slide, explode, fade default null |
| emptyTitle | string |
| emptyTitleColor | color default black |
| emptyText | string |
| emptyTextColor | color default black |
| emptyLetterSpacing | float default 0 |
| emptyLineSpacingExtra | float default 1 |
| emptyLineSpacingMultiplier | float default 1 |
| emptyDrawable | reference |
| emptyDrawableTint | color default transparent |
| emptyBackgroundColor | color default transparent |
| errorText | string |
| errorTextColor | color default black |
| errorDrawable | reference |
| errorDrawableTint | color default transparent |
| errorBackgroundColor | color default transparent |
| errorButtonText | string |
| errorButtonTextColor | color default black |
| errorButtonBackgroundColor | color default transparent |
| ev_transition | slide, explode, fade default slide |
| ev_font | reference |
| ev_titleTextSize | dimension |
| ev_textSize | dimension |
| ev_letterSpacing | dimension |
| ev_lineSpacingExtra | dimension |
| ev_lineSpacingExtraMultiplier | dimension |
| ev_buttonTextSize | dimension |
| ev_loading | none, circular default circular |
| ev_loading_title | string |
| ev_loading_titleTextColor | color |
| ev_loading_text | string |
| ev_loading_textColor | color |
| ev_loading_drawable | reference |
| ev_loading_drawableTint | color |
| ev_loading_backgroundColor | color |
| ev_empty_title | string |
| ev_empty_titleTextColor | color |
| ev_empty_text | string |
| ev_empty_textColor | color |
| ev_empty_button | string |
| ev_empty_buttonTextColor | color |
| ev_empty_buttonBackgroundColor | color |
| ev_empty_drawable | reference |
| ev_empty_drawableTint | color |
| ev_empty_backgroundColor | color |
| ev_error_title | string |
| ev_error_titleTextColor | color |
| ev_error_text | string |
| ev_error_textColor | color |
| ev_error_button | string |
| ev_error_buttonTextColor | color |
| ev_error_buttonBackgroundColor | color |
| ev_error_drawable | reference |
| ev_error_drawableTint | color |
| ev_error_backgroundColor | color |

## Notes

* Use `setTransition(android.support.transition transition)` method to define which transitions is played when animating layout changes
* Use `setEmptyButton(CharSequence text, @ColorInt int color, @ColorInt int backgroundColor)` or `setErrorButton(CharSequence text, @ColorInt int color, @ColorInt int backgroundColor)` methods to set button text, textColor and backgroundColor attributes
* Use `exclude(int... ids)` or `exclude(View... views)` methods to exclude views from visibility changes

## License
Expand All @@ -115,8 +128,4 @@ 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.
```




```
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation project(':library')
}
154 changes: 0 additions & 154 deletions app/src/main/java/com/santalu/myapplication/EmptyHelper.java

This file was deleted.

47 changes: 30 additions & 17 deletions app/src/main/java/com/santalu/myapplication/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
public class MainActivity extends AppCompatActivity {

private EmptyView emptyView;
private EmptyHelper emptyHelper;

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
emptyView = findViewById(R.id.empty_view);
//emptyView.exclude(R.id.text);
//emptyView.setErrorButton("Error Button");
//emptyView.setEmptyButton("Empty Button");
emptyHelper = new EmptyHelper(emptyView);

/*emptyView.setState(EmptyView.EMPTY)
.setEmptyDrawable(R.mipmap.ic_launcher)
.setEmptyDrawableTint(0)
.setEmptyTitle("Empty Title")
.setEmptyText("Empty Text")
.setEmptyButtonText("Empty Button")
.show();*/
}

@Override public boolean onCreateOptionsMenu(Menu menu) {
Expand All @@ -32,24 +35,34 @@ public class MainActivity extends AppCompatActivity {
int itemId = item.getItemId();
switch (itemId) {
case R.id.show_progress:
emptyHelper.showLoading();
//emptyView.showLoading();
emptyView.setState(EmptyView.LOADING)
.show();
break;
case R.id.show_content:
emptyHelper.showContent();
//emptyView.showContent();
emptyView.setState(EmptyView.CONTENT)
.show();
break;
case R.id.show_error:
emptyHelper.showError(new OnClickListener() {
@Override public void onClick(View v) {
emptyView.showLoading();
}
});
//emptyView.showError();
emptyView.setState(EmptyView.ERROR)
.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) {
emptyView.showLoading();
}
})
.show();
break;
case R.id.show_empty:
emptyHelper.showEmpty(new OnClickListener() {
@Override public void onClick(View v) {
emptyView.showLoading();
}
});
//emptyView.showEmpty();
emptyView.setState(EmptyView.EMPTY)
.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) {
emptyView.showLoading();
}
})
.show();
break;
}
return super.onOptionsItemSelected(item);
Expand Down
Loading

0 comments on commit 6d53fc6

Please sign in to comment.