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 double getDistance() { | |
int distance = (int) Math.sqrt(photo.getTranslationY()*photo.getTranslationY() + photo.getTranslationX()*photo.getTranslationX()); | |
return Util.pxToDp(this, distance); | |
} | |
@Override | |
public void onFrameTouchUp() { | |
if (getDistance() > 50) { | |
onBackPressed(); | |
} else { |
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 ZoomPichActivity extends AppCompatActivity implements FrameTouch.FrameOnTouch{ | |
@BindView(R.id.photo) | |
ImageView photo; | |
@BindView(R.id.backgroundZoom) | |
FrameTouch frame; | |
private PhotoViewAttacher mAttacher; |
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 { | |
... | |
@Override | |
public boolean onScale(ScaleGestureDetector detector) { | |
return true; | |
} | |
@Override |
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 class MyGestureListener extends GestureDetector.SimpleOnGestureListener { | |
@Override | |
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { | |
frameOnTouch.onScrollMovie(distanceX, distanceY); | |
return super.onScroll(e1, e2, distanceX, distanceY); | |
} |
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 FrameOnTouch { | |
void onFrameTouchUp(); | |
void onScrollMovie(float x, float y); | |
} | |
public FrameTouch(Context context) { | |
super(context); | |
detector = new GestureDetectorCompat(context, new MyGestureListener()); | |
} |
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
var counter, quantity = 10; | |
var list = []; | |
for(counter = 0; counter < quantity; counter++){ | |
var object = {}; | |
object.onClick = (function(counter) { | |
return function() { | |
alert(counter); | |
} | |
})(counter) | |
list.push(object); |
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
<FrameLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:orientation="vertical"> | |
<TextView | |
android:id="@+id/txtName" | |
android:layout_width="wrap_content" |
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
<com.example.app.widget.WidgetButton | |
android:id="@+id/widgetButton" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
app:isBlue="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
@BindView(R.id.widgetButton) | |
lateinit var widgetButton: WidgetButton |