Skip to content

Instantly share code, notes, and snippets.

@gturedi
Last active February 10, 2016 09:34
Show Gist options
  • Save gturedi/55583af51b68e86f0999 to your computer and use it in GitHub Desktop.
Save gturedi/55583af51b68e86f0999 to your computer and use it in GitHub Desktop.
abstract classes to avoid to implement unnecessary methods and boilerplate code for android development
package gturedi.gist;
import android.view.animation.Animation;
public abstract class CustomAnimationListener
implements Animation.AnimationListener {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
}
package gturedi.gist;
import android.animation.Animator;
public abstract class CustomAnimatorListener
implements Animator.AnimatorListener {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}
package gturedi.gist;
import android.view.View;
import android.widget.AdapterView;
public abstract class CustomOnItemSelectedListener
implements AdapterView.OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
}
package gturedi.gist;
import android.text.Editable;
import android.text.TextWatcher;
public abstract class CustomTextWatcher
implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
}
EditText et = new EditText(this);
et.addTextChangedListener(new CustomTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
Log.w(TAG, "change: "+s);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment