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
Button valid = (Button)findViewById(R.id.valid); | |
valid.setOnClickListener(new View.OnClickListener { | |
public void onClick(View v) { | |
// TODO: do some stuff... | |
} | |
public void onLongClick(View v) { | |
// we don't need to it | |
} |
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
public interface OnClickListener { | |
void onClick(View v); | |
} | |
public interface OnLongClickListener { | |
void onLongClick(View v); | |
} | |
public interface OnTouchListener { | |
void onTouch(View v, MotionEvent event); | |
} |
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
class Program { | |
public void work() { | |
// ....code | |
} | |
} | |
class Engineer{ | |
Program program; |
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
interface IProgram { | |
public void work(); | |
} | |
class Program implements IProgram{ | |
public void work() { | |
// ....code | |
} | |
} |
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
private void loadImage(ImageView imageView) { | |
Glide.with(this) | |
.load(getString(R.string.img_url)) | |
.into(imageView); | |
} |
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
private void transition(View view, String url, String id) { | |
Intent intent = new Intent(this, ZoomPichActivity.class); | |
intent.putExtra("url", url); | |
intent.putExtra("id", id); | |
ViewCompat.setTransitionName(view, id); | |
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, view, id); | |
startActivity(intent, options.toBundle()); | |
} |
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
public class FrameTouch extends FrameLayout implements ScaleGestureDetector.OnScaleGestureListener { | |
GestureDetectorCompat detector; | |
ScaleGestureDetector scaleDetector; | |
FrameOnTouch frameOnTouch; | |
@Override | |
public boolean onScale(ScaleGestureDetector detector) { | |
return true; | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<example.com.zoompinch.widget.FrameTouch xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/backgroundZoom" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@android:color/black" | |
android:orientation="vertical" | |
android:layout_gravity="center"> |
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
private PhotoViewAttacher mAttacher; | |
{ | |
.... | |
mAttacher = new PhotoViewAttacher(photo); | |
mAttacher.setMinimumScale(0.5f); | |
mAttacher.setMaximumScale(mAttacher.getMaximumScale()); | |
mAttacher.setScaleType(ImageView.ScaleType.FIT_CENTER); | |
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
supportPostponeEnterTransition(); | |
Glide.with(this) | |
.load(imgUrl) | |
.listener(new RequestListener<String, GlideDrawable>() { | |
@Override | |
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { | |
supportStartPostponedEnterTransition(); | |
return false; | |
} |