-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to implement in java #20
Comments
Hi. The setup and layout usage are the same. In your layout you can find the icon by its ID and use it like any other view. <og.android.lib.toggleiconview.rounded.PlayPause
android:id="@+id/playPause"
android:layout_width="24dp"
android:layout_height="24dp" /> ToggleIconView toggleIconView = (ToggleIconView) findViewById(R.id.playPause);
toggleIconView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
toggleIconView.toggle();
}
});
toggleIconView.setOnCheckedChangeListener(new Function2<ToggleIconView, Boolean, Unit>() {
@Override
public Unit invoke(ToggleIconView view, Boolean isChecked) {
Toast.makeText(getApplicationContext(), isChecked.toString(), Toast.LENGTH_SHORT).show();
return null;
}
});
// toggleIconView.toggle();
// toggleIconView.setChecked(...);
// toggleIconView.isChecked();
// toggleIconView.setCheckedContentDescription(...);
// toggleIconView.getCheckedContentDescription();
// toggleIconView.setCheckedTooltipText(...);
// toggleIconView.getCheckedTooltipText() But if I can create an interface for onCheckedChangeListener, the code will make more sense when used with Java. I'll look into this. |
Hi again, I updated the library. Now you can use the listener like this: toggleIconView.setOnCheckedChangeListener(new ToggleIconView.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(@NonNull ToggleIconView view, boolean isChecked) {
Toast.makeText(getApplicationContext(), isChecked.toString(), Toast.LENGTH_SHORT).show();
}
}); |
thankyou somuch.thankyou for creating this amazing lib i will implement and tell you the result on my app |
|
what is code to implement in java?
The text was updated successfully, but these errors were encountered: