Skip to content

Commit

Permalink
SelectorImageButton
Browse files Browse the repository at this point in the history
  • Loading branch information
Kale committed Apr 28, 2018
1 parent 79b7576 commit cd2f4d3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/kale/selectorinjection/ImageFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import kale.injection.SelectorInjection;
import kale.ui.view.ISelectorView;
import kale.ui.view.SelectorImageView;
import kale.ui.view.SelectorImageButton;

/**
* @author Kale
Expand Down Expand Up @@ -50,7 +50,7 @@ public void onClick(View v) {
findCbAndSetListener(root, R.id.isSmart_cb);
findCbAndSetListener(root, R.id.show_ripple_cb);

final SelectorImageView imageView = root.findViewById(R.id.check_iv);
final SelectorImageButton imageView = root.findViewById(R.id.check_iv);

imageView.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -59,9 +59,9 @@ public void onClick(View v) {
}
});

imageView.setOnCheckedChangeListener(new SelectorImageView.OnCheckedChangeListener() {
imageView.setOnCheckedChangeListener(new SelectorImageButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(SelectorImageView view, boolean isChecked) {
public void onCheckedChanged(SelectorImageButton view, boolean isChecked) {
Toast.makeText(getActivity(), "" + isChecked, Toast.LENGTH_SHORT).show();
}
});
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/image_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:orientation="vertical"
>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:id="@+id/stv"
android:layout_width="200dp"
android:layout_height="200dp"
Expand Down Expand Up @@ -92,7 +92,7 @@

</LinearLayout>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
Expand All @@ -101,7 +101,7 @@
app:src="@drawable/icon_facebook_svg"
/>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="20dp"
Expand All @@ -117,7 +117,7 @@
/>


<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:id="@+id/check_iv"
android:layout_width="100dp"
android:layout_height="100dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/ripple_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
app:ripple="true"
/>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:layout_width="120dp"
android:layout_height="80dp"
android:layout_marginTop="20dp"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/svg_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
android:padding="@dimen/activity_horizontal_margin"
>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="15dp"
Expand All @@ -88,7 +88,7 @@
app:srcCompat="@drawable/icon_facebook_svg"
/>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="15dp"
Expand All @@ -100,7 +100,7 @@
app:srcCompat="@drawable/icon_renren_svg"
/>

<kale.ui.view.SelectorImageView
<kale.ui.view.SelectorImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="15dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
import kale.injection.SelectorInjection;
import kale.utils.SelectorUtils;

public class SelectorImageView extends AppCompatImageButton implements ISelectorView {
public class SelectorImageButton extends AppCompatImageButton implements ISelectorView {

private SelectorInjection injection;

private OnCheckedChangeListener mOnCheckedChangeListener;

public SelectorImageView(Context context) {
public SelectorImageButton(Context context) {
this(context, null);
}

public SelectorImageView(Context context, AttributeSet attrs) {
public SelectorImageButton(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public SelectorImageView(Context context, AttributeSet attrs, int defStyle) {
public SelectorImageButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
injection = SelectorUtils.injectionToSelectorView(this, attrs, defStyle);
// setClickable(true);
Expand Down Expand Up @@ -81,6 +81,6 @@ public void setOnCheckedChangeListener(@Nullable OnCheckedChangeListener listene

public interface OnCheckedChangeListener {

void onCheckedChanged(SelectorImageView view, boolean isChecked);
void onCheckedChanged(SelectorImageButton view, boolean isChecked);
}
}
2 changes: 1 addition & 1 deletion lib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<attr name="backgroundTint"/>
</declare-styleable>

<declare-styleable name="SelectorImageView">
<declare-styleable name="SelectorImageButton">
<attr name="normalColor" />
<attr name="pressedColor"/>
<attr name="checkedColor"/>
Expand Down

0 comments on commit cd2f4d3

Please sign in to comment.