|
|
@ -30,7 +30,6 @@ import android.os.Handler;
|
|
|
|
import android.view.Display;
|
|
|
|
import android.view.Display;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.Window;
|
|
|
|
import android.view.Window;
|
|
|
@ -222,6 +221,11 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void toogleFullScreen() {
|
|
|
|
|
|
|
|
fullscreen = !fullscreen;
|
|
|
|
|
|
|
|
setFullscreen(fullscreen);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
|
|
|
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
|
|
|
getMenuInflater().inflate(R.menu.menu_media, menu);
|
|
|
|
getMenuInflater().inflate(R.menu.menu_media, menu);
|
|
|
@ -310,25 +314,9 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
private void toggleScreenContain(boolean fullscreen) {
|
|
|
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (event.getAction()) {
|
|
|
|
|
|
|
|
case MotionEvent.ACTION_DOWN:
|
|
|
|
|
|
|
|
startX = event.getX();
|
|
|
|
|
|
|
|
startY = event.getY();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MotionEvent.ACTION_UP:
|
|
|
|
|
|
|
|
float endX = event.getX();
|
|
|
|
|
|
|
|
float endY = event.getY();
|
|
|
|
|
|
|
|
if (endY > minTouch && endY < maxTouch && isAClick(startX, endX, startY, endY)) {
|
|
|
|
|
|
|
|
setFullscreen(!fullscreen);
|
|
|
|
|
|
|
|
if (!fullscreen) {
|
|
|
|
if (!fullscreen) {
|
|
|
|
String description = attachments.get(binding.mediaViewpager.getCurrentItem()).description;
|
|
|
|
String description = attachments.get(binding.mediaViewpager.getCurrentItem()).description;
|
|
|
|
if (handler != null) {
|
|
|
|
|
|
|
|
handler.removeCallbacksAndMessages(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
handler = new Handler();
|
|
|
|
|
|
|
|
if (description != null && description.trim().length() > 0 && description.trim().compareTo("null") != 0) {
|
|
|
|
if (description != null && description.trim().length() > 0 && description.trim().compareTo("null") != 0) {
|
|
|
|
binding.mediaDescription.setText(description);
|
|
|
|
binding.mediaDescription.setText(description);
|
|
|
|
if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) {
|
|
|
|
if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) {
|
|
|
@ -356,24 +344,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|
|
|
binding.mediaDescription.setVisibility(View.GONE);
|
|
|
|
binding.mediaDescription.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
return super.dispatchTouchEvent(event);
|
|
|
|
|
|
|
|
} catch (IllegalArgumentException ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isAClick(float startX, float endX, float startY, float endY) {
|
|
|
|
|
|
|
|
float differenceX = Math.abs(startX - endX);
|
|
|
|
|
|
|
|
float differenceY = Math.abs(startY - endY);
|
|
|
|
|
|
|
|
int CLICK_ACTION_THRESHOLD = 200;
|
|
|
|
|
|
|
|
return !(differenceX > CLICK_ACTION_THRESHOLD/* =5 */ || differenceY > CLICK_ACTION_THRESHOLD);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onDestroy() {
|
|
|
|
public void onDestroy() {
|
|
|
@ -425,6 +396,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|
|
|
binding.translate.setVisibility(View.GONE);
|
|
|
|
binding.translate.setVisibility(View.GONE);
|
|
|
|
binding.originalMessage.setVisibility(View.INVISIBLE);
|
|
|
|
binding.originalMessage.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleScreenContain(fullscreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void hideSystemUI() {
|
|
|
|
private void hideSystemUI() {
|
|
|
|