Skip to content

Commit

Permalink
Code style fix ups
Browse files Browse the repository at this point in the history
  • Loading branch information
AviranAbady committed Dec 4, 2018
1 parent b332058 commit d8715ee
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 30 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-CookieBar2-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6122) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6474fc01133444e0b6f615d9b1af8589)](https://www.codacy.com/app/AviranAbady/CookieBar2?utm_source=github.com&utm_medium=referral&utm_content=AviranAbady/CookieBar2&utm_campaign=badger)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-CookieBar2-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6122) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6474fc01133444e0b6f615d9b1af8589)](https://www.codacy.com/app/AviranAbady/CookieBar2?utm_source=github.com&utm_medium=referral&utm_content=AviranAbady/CookieBar2&utm_campaign=badger) [![AndroidWeekly335](https://raw.githubusercontent.com/AviranAbady/storage/master/AndroidWeekly335.png)](http:https://androidweekly.net/issues/issue-335)

CookieBar 2
===============
Expand All @@ -11,7 +11,7 @@ implementation 'org.aviran.cookiebar2:cookiebar2:1.1.0'
## Screenshot
<img src="https://raw.githubusercontent.com/AviranAbady/storage/master/cookiebar2_1.1.0.gif">

Main differences from the original <a href="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/liuguangqiang/CookieBar/">Cookiebar</a> are:
Main differences from the original Cookiebar library are:

* Swipe to dismiss has been added.
* Programmatic dismiss functionality added.
Expand Down Expand Up @@ -132,7 +132,7 @@ CookieBar.build(MainActivity.this)

## Dynamically set cookie properties
* Cookie position (Top/Bottom)
* Display Duration
* Display duration
* Title text color
* Body text color
* Action text color
Expand All @@ -142,9 +142,12 @@ CookieBar.build(MainActivity.this)
* In/Out animations for the entire view
* View layout

## Attribution
Forked from the early code base of CookieBar, by Eric Liu.

## License

Copyright 2017
Copyright 2018, Aviran Abady.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
46 changes: 21 additions & 25 deletions cookiebar2/src/main/java/org/aviran/cookiebar2/CookieBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
import android.view.View;
import android.view.ViewGroup;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* CookieBar is a lightweight library for showing a brief message at the top or bottom of the
* screen.
Expand All @@ -28,6 +25,9 @@
* .show();
*/
public class CookieBar {
public static final int TOP = Gravity.TOP;
public static final int BOTTOM = Gravity.BOTTOM;

private Cookie cookieView;
private final Activity context;

Expand Down Expand Up @@ -114,8 +114,7 @@ public View getView() {
public static class Builder {

private final Params params = new Params();

final Activity context;
private final Activity context;

/**
* Create a builder for an cookie.
Expand Down Expand Up @@ -268,29 +267,26 @@ final static class Params {
public String title;
public String message;
public String action;
boolean enableSwipeToDismiss = true;
boolean enableAutoDismiss = true;
int iconResId;
int backgroundColor;
int titleColor;
int messageColor;
int actionColor;
long duration = 2000;
int cookiePosition = Gravity.TOP;
int customViewResource;
int animationInTop = R.anim.slide_in_from_top;
int animationInBottom = R.anim.slide_in_from_bottom;
int animationOutTop = R.anim.slide_out_to_top;
int animationOutBottom = R.anim.slide_out_to_bottom;
CustomViewInitializer viewInitializer;
OnActionClickListener onActionClickListener;
AnimatorSet iconAnimator;
public boolean enableSwipeToDismiss = true;
public boolean enableAutoDismiss = true;
public int iconResId;
public int backgroundColor;
public int titleColor;
public int messageColor;
public int actionColor;
public long duration = 2000;
public int cookiePosition = Gravity.TOP;
public int customViewResource;
public int animationInTop = R.anim.slide_in_from_top;
public int animationInBottom = R.anim.slide_in_from_bottom;
public int animationOutTop = R.anim.slide_out_to_top;
public int animationOutBottom = R.anim.slide_out_to_bottom;
public CustomViewInitializer viewInitializer;
public OnActionClickListener onActionClickListener;
public AnimatorSet iconAnimator;
}

public interface CustomViewInitializer {
void initView(View view);
}

public static final int TOP = Gravity.TOP;
public static final int BOTTOM = Gravity.BOTTOM;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static int getColor(Context context, @AttrRes int attr) {
return getColor(context, attr, 0);
}

static int getColor(Context context, @AttrRes int attr, int defaultColor) {
public static int getColor(Context context, @AttrRes int attr, int defaultColor) {
TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{attr});
try {
return a.getColor(0, defaultColor);
Expand Down

0 comments on commit d8715ee

Please sign in to comment.