-
Notifications
You must be signed in to change notification settings - Fork 28
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
1 parent
744e5e2
commit 6b1808a
Showing
36 changed files
with
286 additions
and
131 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
51 changes: 51 additions & 0 deletions
51
library/src/main/java/cz/kinst/jakub/view/TintableImageView.java
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,51 @@ | ||
package cz.kinst.jakub.view; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.graphics.Color; | ||
import android.graphics.PorterDuff; | ||
import android.support.annotation.ColorInt; | ||
import android.support.annotation.ColorRes; | ||
import android.util.AttributeSet; | ||
import android.widget.ImageView; | ||
|
||
|
||
public class TintableImageView extends ImageView { | ||
|
||
|
||
public TintableImageView(Context context) { | ||
super(context); | ||
} | ||
|
||
|
||
public TintableImageView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
init(context, attrs, 0); | ||
} | ||
|
||
|
||
public TintableImageView(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
init(context, attrs, defStyle); | ||
} | ||
|
||
|
||
private void init(Context context, AttributeSet attrs, int defStyle) { | ||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TintableImageView, defStyle, 0); | ||
int tintColor = a.getColor(R.styleable.TintableImageView_tint, Color.BLACK); | ||
a.recycle(); | ||
setTintColor(tintColor); | ||
} | ||
|
||
|
||
public void setTintColor(@ColorInt int color) { | ||
super.setColorFilter(color, PorterDuff.Mode.SRC_IN); | ||
} | ||
|
||
|
||
public void setTintColorResource(@ColorRes int colorResource) { | ||
super.setColorFilter(getContext().getResources().getColor(colorResource), PorterDuff.Mode.SRC_IN); | ||
} | ||
|
||
|
||
} |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.