aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-10-03 22:31:55 +0200
committerChristian Schneppe <christian@pix-art.de>2018-10-03 22:31:55 +0200
commit26cc9dcbea89b5767c4c4c7dd3cfeb11a7ab168d (patch)
treee41b4f1b2521c325270600387dccd4091cb9a959
parent8e088ccdb71495cf8bbd86919011296d2f7acde0 (diff)
rework MediaViewerActivity
-rw-r--r--build.gradle4
-rw-r--r--src/main/AndroidManifest.xml4
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java12
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java (renamed from src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java)151
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/ViewUtil.java6
-rw-r--r--src/main/res/drawable-hdpi/ic_delete_black_24dp.pngbin0 -> 492 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_menu_white_24dp.pngbin0 -> 417 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_share_black_24dp.pngbin0 -> 753 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_video_black_24dp.pngbin0 -> 237 bytes
-rw-r--r--src/main/res/drawable-hdpi/ic_video_white_24dp.pngbin0 -> 239 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_delete_black_24dp.pngbin0 -> 410 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_menu_white_24dp.pngbin0 -> 366 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_share_black_24dp.pngbin0 -> 573 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_video_black_24dp.pngbin0 -> 146 bytes
-rw-r--r--src/main/res/drawable-mdpi/ic_video_white_24dp.pngbin0 -> 150 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_delete_black_24dp.pngbin0 -> 479 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_menu_white_24dp.pngbin0 -> 386 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_share_black_24dp.pngbin0 -> 852 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_video_black_24dp.pngbin0 -> 212 bytes
-rw-r--r--src/main/res/drawable-xhdpi/ic_video_white_24dp.pngbin0 -> 206 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_delete_black_24dp.pngbin0 -> 575 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_menu_white_24dp.pngbin0 -> 420 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_share_black_24dp.pngbin0 -> 1190 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_video_black_24dp.pngbin0 -> 325 bytes
-rw-r--r--src/main/res/drawable-xxhdpi/ic_video_white_24dp.pngbin0 -> 332 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.pngbin0 -> 668 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.pngbin0 -> 450 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_share_black_24dp.pngbin0 -> 1556 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_video_black_24dp.pngbin0 -> 425 bytes
-rw-r--r--src/main/res/drawable-xxxhdpi/ic_video_white_24dp.pngbin0 -> 419 bytes
-rw-r--r--src/main/res/layout/activity_media_viewer.xml (renamed from src/main/res/layout/activity_fullscreen_message.xml)4
-rw-r--r--src/main/res/menu/contact_details.xml2
-rw-r--r--src/main/res/menu/editaccount.xml2
-rw-r--r--src/main/res/menu/media_viewer.xml17
-rw-r--r--src/main/res/menu/muc_details.xml2
-rw-r--r--src/main/res/values/attrs.xml1
-rw-r--r--src/main/res/values/defaults.xml2
-rw-r--r--src/main/res/values/strings.xml2
-rw-r--r--src/main/res/values/themes.xml4
40 files changed, 157 insertions, 58 deletions
diff --git a/build.gradle b/build.gradle
index 72e2088e9..52df95a1f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -68,7 +68,7 @@ dependencies {
implementation "com.android.support:design:$supportLibVersion"
implementation "com.android.support:cardview-v7:$supportLibVersion"
implementation 'com.github.bumptech.glide:glide:3.8.0'
- implementation 'com.github.chrisbanes:PhotoView:2.0.0'
+ implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.3'
implementation 'pub.devrel:easypermissions:1.2.0'
implementation 'com.wefika:flowlayout:0.4.1'
@@ -156,7 +156,7 @@ android {
}
lintOptions {
- disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource'
+ disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource', 'RestrictedApi'
}
subprojects {
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index bfdb2ec3d..ce3bfc406 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -104,8 +104,8 @@
android:name=".ui.ConversationsActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
- android:minHeight="300dp"
android:minWidth="300dp"
+ android:minHeight="300dp"
android:windowSoftInputMode="stateHidden"></activity>
<activity
android:name=".ui.ScanActivity"
@@ -238,7 +238,7 @@
android:name=".ui.SearchActivity"
android:label="@string/search_messages" />
<activity
- android:name=".ui.ShowFullscreenMessageActivity"
+ android:name=".ui.MediaViewerActivity"
android:configChanges="orientation|screenSize"
android:theme="@style/ConversationsTheme.FullScreen"></activity>
<activity
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 8397a7bb8..0333d24fd 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -111,8 +111,7 @@ public class FileBackend {
}
}
- public boolean deleteFile(Message message) {
- File file = getFile(message);
+ public boolean deleteFile(File file) {
if (file.delete()) {
updateMediaScanner(file);
return true;
@@ -121,6 +120,11 @@ public class FileBackend {
}
}
+ public boolean deleteFile(Message message) {
+ File file = getFile(message);
+ return deleteFile(file);
+ }
+
public DownloadableFile getFile(Message message) {
return getFile(message, true);
}
@@ -219,8 +223,8 @@ public class FileBackend {
}
public static String getConversationsDirectory(final String type) {
- if (type.equalsIgnoreCase("null") || type == null) {
- return getAppMediaDirectory() + "Pix-Art Messenger" + "/";
+ if (type.equalsIgnoreCase("null")) {
+ return Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "Pix-Art Messenger" + "/";
} else {
return getAppMediaDirectory() + "Pix-Art Messenger" + " " + type + "/";
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index e7c7ae1a8..2655837fa 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -625,7 +625,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
final boolean hideVoice = p.getBoolean("show_record_voice_btn", activity.getResources().getBoolean(R.bool.show_record_voice_btn));
PopupMenu popup = new PopupMenu(activity, v);
popup.inflate(R.menu.choose_attachment);
- Menu menu = popup.getMenu();
+ final Menu menu = popup.getMenu();
ConversationMenuConfigurator.configureQuickShareAttachmentMenu(conversation, menu, hideVoice);
popup.setOnMenuItemClickListener(attachmentItem -> {
switch (attachmentItem.getItemId()) {
diff --git a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java
index b34e49653..a8285d594 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java
@@ -4,6 +4,8 @@ import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -13,37 +15,40 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.ActionBar;
+import android.support.v7.view.menu.MenuBuilder;
+import android.support.v7.view.menu.MenuPopupHelper;
+import android.support.v7.widget.PopupMenu;
import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.webkit.MimeTypeMap;
import android.widget.ImageView;
import android.widget.Toast;
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.resource.drawable.GlideDrawable;
-import com.bumptech.glide.request.animation.GlideAnimation;
-import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
-import com.github.chrisbanes.photoview.PhotoView;
-import com.github.chrisbanes.photoview.PhotoViewAttacher;
+import com.davemorrissey.labs.subscaleview.ImageSource;
+import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.github.rtoshiro.view.video.FullscreenVideoLayout;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.persistance.FileBackend;
import de.pixart.messenger.utils.ExifHelper;
+import de.pixart.messenger.utils.MimeUtils;
import static de.pixart.messenger.persistance.FileBackend.close;
-public class ShowFullscreenMessageActivity extends XmppActivity {
+public class MediaViewerActivity extends XmppActivity {
Integer oldOrientation;
- PhotoView mImage;
+ SubsamplingScaleImageView mImage;
FullscreenVideoLayout mVideo;
ImageView mFullscreenbutton;
Uri mFileUri;
@@ -52,6 +57,22 @@ public class ShowFullscreenMessageActivity extends XmppActivity {
int height = 0;
int width = 0;
int rotation = 0;
+ boolean isImage = false;
+ boolean isVideo = false;
+
+ public static String getMimeType(String path) {
+ try {
+ String type = null;
+ String extension = path.substring(path.lastIndexOf(".") + 1, path.length());
+ if (extension != null) {
+ type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
+ }
+ return type;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -73,18 +94,59 @@ public class ShowFullscreenMessageActivity extends XmppActivity {
getWindow().setAttributes(layout);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- setContentView(R.layout.activity_fullscreen_message);
+ setContentView(R.layout.activity_media_viewer);
mImage = findViewById(R.id.message_image_view);
mVideo = findViewById(R.id.message_video_view);
mFullscreenbutton = findViewById(R.id.vcv_img_fullscreen);
fab = findViewById(R.id.fab);
fab.setOnClickListener(v -> {
- mVideo.reset();
- shareWith(mFile);
+ PopupMenu popup = new PopupMenu(MediaViewerActivity.this, v);
+ popup.inflate(R.menu.media_viewer);
+ final Menu menu = popup.getMenu();
+ MenuItem delete = menu.findItem(R.id.action_delete);
+ MenuItem open = menu.findItem(R.id.action_open);
+ Log.d(Config.LOGTAG, "Path = " + mFile.toString());
+ if (mFile == null || !mFile.toString().startsWith("/") || mFile.toString().contains(FileBackend.getConversationsDirectory("null"))) {
+ delete.setVisible(true);
+ } else {
+ delete.setVisible(false);
+ }
+ if (isVideo) {
+ if (isDarkTheme()) {
+ open.setIcon(R.drawable.ic_video_white_24dp);
+ } else {
+ open.setIcon(R.drawable.ic_video_black_24dp);
+ }
+ } else if (isImage) {
+ if (isDarkTheme()) {
+ open.setIcon(R.drawable.ic_image_white_24dp);
+ } else {
+ open.setIcon(R.drawable.ic_image_black_24dp);
+ }
+ }
+ popup.setOnMenuItemClickListener(item -> {
+ switch (item.getItemId()) {
+ case R.id.action_share:
+ share();
+ break;
+ case R.id.action_open:
+ open();
+ break;
+ case R.id.action_delete:
+ deleteFile();
+ break;
+ default:
+ return false;
+ }
+ return true;
+ });
+ MenuPopupHelper menuHelper = new MenuPopupHelper(MediaViewerActivity.this, (MenuBuilder) menu, v);
+ menuHelper.setForceShowIcon(true);
+ menuHelper.show();
});
}
- private void shareWith(File mFile) {
+ private void share() {
Intent share = new Intent(Intent.ACTION_SEND);
share.setType(getMimeType(mFile.toString()));
share.putExtra(Intent.EXTRA_STREAM, FileBackend.getUriForFile(this, mFile));
@@ -96,18 +158,35 @@ public class ShowFullscreenMessageActivity extends XmppActivity {
}
}
- public static String getMimeType(String path) {
+ private void deleteFile() {
+ this.xmppConnectionService.getFileBackend().deleteFile(mFile);
+ finish();
+ }
+
+ private void open() {
+ Uri uri;
try {
- String type = null;
- String extension = path.substring(path.lastIndexOf(".") + 1, path.length());
- if (extension != null) {
- type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
- }
- return type;
- } catch (Exception e) {
- e.printStackTrace();
+ uri = FileBackend.getUriForFile(this, mFile);
+ } catch (SecurityException e) {
+ Log.d(Config.LOGTAG, "No permission to access " + mFile.getAbsolutePath(), e);
+ Toast.makeText(this, this.getString(R.string.no_permission_to_access_x, mFile.getAbsolutePath()), Toast.LENGTH_SHORT).show();
+ return;
+ }
+ String mime = MimeUtils.guessMimeTypeFromUri(this, uri);
+ Intent openIntent = new Intent(Intent.ACTION_VIEW);
+ openIntent.setDataAndType(uri, mime);
+ openIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ PackageManager manager = this.getPackageManager();
+ List<ResolveInfo> info = manager.queryIntentActivities(openIntent, 0);
+ if (info.size() == 0) {
+ openIntent.setDataAndType(uri, "*/*");
+ }
+ try {
+ this.startActivity(openIntent);
+ finish();
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show();
}
- return null;
}
@Override
@@ -125,34 +204,38 @@ public class ShowFullscreenMessageActivity extends XmppActivity {
mFile = new File(mFileUri.getPath());
if (mFileUri != null && mFile.exists() && mFile.length() > 0) {
try {
- DisplayImage(mFile);
+ isImage = true;
+ DisplayImage(mFile, mFileUri);
} catch (Exception e) {
+ isImage = false;
Log.d(Config.LOGTAG, "Illegal exeption :" + e);
- Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
+ Toast.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
finish();
}
} else {
- Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
+ Toast.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
}
} else if (intent.hasExtra("video")) {
mFileUri = intent.getParcelableExtra("video");
mFile = new File(mFileUri.getPath());
if (mFileUri != null && mFile.exists() && mFile.length() > 0) {
try {
+ isVideo = true;
DisplayVideo(mFileUri);
} catch (Exception e) {
+ isVideo = false;
Log.d(Config.LOGTAG, "Illegal exeption :" + e);
- Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
+ Toast.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
finish();
}
} else {
- Toast.makeText(ShowFullscreenMessageActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
+ Toast.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
}
}
}
}
- private void DisplayImage(final File file) {
+ private void DisplayImage(final File file, final Uri FileUri) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(new File(file.getPath()).getAbsolutePath(), options);
@@ -163,19 +246,9 @@ public class ShowFullscreenMessageActivity extends XmppActivity {
if (useAutoRotateScreen()) {
rotateScreen(width, height, rotation);
}
- final PhotoViewAttacher mAttacher = new PhotoViewAttacher(mImage);
mImage.setVisibility(View.VISIBLE);
try {
- Glide.with(this)
- .load(file)
- .dontAnimate()
- .into(new GlideDrawableImageViewTarget(mImage) {
- @Override
- public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
- super.onResourceReady(resource, animation);
- mAttacher.update();
- }
- });
+ mImage.setImage(ImageSource.uri(FileUri));
} catch (Exception e) {
Toast.makeText(this, getString(R.string.error_file_corrupt), Toast.LENGTH_LONG).show();
e.printStackTrace();
diff --git a/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java b/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java
index b1905479b..07e25e31d 100644
--- a/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java
+++ b/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java
@@ -15,7 +15,7 @@ import java.util.List;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.persistance.FileBackend;
-import de.pixart.messenger.ui.ShowFullscreenMessageActivity;
+import de.pixart.messenger.ui.MediaViewerActivity;
public class ViewUtil {
@@ -36,7 +36,7 @@ public class ViewUtil {
}
// use internal viewer for images and videos
if (mime.startsWith("image/")) {
- Intent intent = new Intent(context, ShowFullscreenMessageActivity.class);
+ Intent intent = new Intent(context, MediaViewerActivity.class);
intent.putExtra("image", Uri.fromFile(file));
try {
context.startActivity(intent);
@@ -45,7 +45,7 @@ public class ViewUtil {
//ignored
}
} else if (mime.startsWith("video/")) {
- Intent intent = new Intent(context, ShowFullscreenMessageActivity.class);
+ Intent intent = new Intent(context, MediaViewerActivity.class);
intent.putExtra("video", Uri.fromFile(file));
try {
context.startActivity(intent);
diff --git a/src/main/res/drawable-hdpi/ic_delete_black_24dp.png b/src/main/res/drawable-hdpi/ic_delete_black_24dp.png
new file mode 100644
index 000000000..789d96d42
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_delete_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_menu_white_24dp.png b/src/main/res/drawable-hdpi/ic_menu_white_24dp.png
new file mode 100644
index 000000000..aeb1e31a0
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_menu_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_share_black_24dp.png b/src/main/res/drawable-hdpi/ic_share_black_24dp.png
new file mode 100644
index 000000000..7331f79b3
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_share_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_video_black_24dp.png b/src/main/res/drawable-hdpi/ic_video_black_24dp.png
new file mode 100644
index 000000000..afd308697
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_video_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-hdpi/ic_video_white_24dp.png b/src/main/res/drawable-hdpi/ic_video_white_24dp.png
new file mode 100644
index 000000000..ca414b356
--- /dev/null
+++ b/src/main/res/drawable-hdpi/ic_video_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_delete_black_24dp.png b/src/main/res/drawable-mdpi/ic_delete_black_24dp.png
new file mode 100644
index 000000000..7981a3def
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_delete_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_menu_white_24dp.png b/src/main/res/drawable-mdpi/ic_menu_white_24dp.png
new file mode 100644
index 000000000..60e4398a3
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_menu_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_share_black_24dp.png b/src/main/res/drawable-mdpi/ic_share_black_24dp.png
new file mode 100644
index 000000000..d4ebebd06
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_share_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_video_black_24dp.png b/src/main/res/drawable-mdpi/ic_video_black_24dp.png
new file mode 100644
index 000000000..c4be08a55
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_video_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-mdpi/ic_video_white_24dp.png b/src/main/res/drawable-mdpi/ic_video_white_24dp.png
new file mode 100644
index 000000000..60cc35c42
--- /dev/null
+++ b/src/main/res/drawable-mdpi/ic_video_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png b/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png
new file mode 100644
index 000000000..16e6e7055
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_delete_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_menu_white_24dp.png b/src/main/res/drawable-xhdpi/ic_menu_white_24dp.png
new file mode 100644
index 000000000..5b7f7480b
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_menu_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_share_black_24dp.png b/src/main/res/drawable-xhdpi/ic_share_black_24dp.png
new file mode 100644
index 000000000..5c058d4eb
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_share_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_video_black_24dp.png b/src/main/res/drawable-xhdpi/ic_video_black_24dp.png
new file mode 100644
index 000000000..f695100bb
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_video_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xhdpi/ic_video_white_24dp.png b/src/main/res/drawable-xhdpi/ic_video_white_24dp.png
new file mode 100644
index 000000000..2c764cbb5
--- /dev/null
+++ b/src/main/res/drawable-xhdpi/ic_video_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png b/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png
new file mode 100644
index 000000000..d118ae77b
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_delete_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_menu_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_menu_white_24dp.png
new file mode 100644
index 000000000..dcbdc6ac9
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_menu_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_share_black_24dp.png b/src/main/res/drawable-xxhdpi/ic_share_black_24dp.png
new file mode 100644
index 000000000..f52683b7f
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_share_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_video_black_24dp.png b/src/main/res/drawable-xxhdpi/ic_video_black_24dp.png
new file mode 100644
index 000000000..2cb46bf1a
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_video_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxhdpi/ic_video_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_video_white_24dp.png
new file mode 100644
index 000000000..77ef5ec76
--- /dev/null
+++ b/src/main/res/drawable-xxhdpi/ic_video_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png b/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png
new file mode 100644
index 000000000..c49da5b4e
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_delete_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png
new file mode 100644
index 000000000..0966d1f16
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_share_black_24dp.png b/src/main/res/drawable-xxxhdpi/ic_share_black_24dp.png
new file mode 100644
index 000000000..484b6d474
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_share_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_video_black_24dp.png b/src/main/res/drawable-xxxhdpi/ic_video_black_24dp.png
new file mode 100644
index 000000000..bd76e9db6
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_video_black_24dp.png
Binary files differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_video_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_video_white_24dp.png
new file mode 100644
index 000000000..d8ab46d9f
--- /dev/null
+++ b/src/main/res/drawable-xxxhdpi/ic_video_white_24dp.png
Binary files differ
diff --git a/src/main/res/layout/activity_fullscreen_message.xml b/src/main/res/layout/activity_media_viewer.xml
index c1a1bc619..2eaad0d04 100644
--- a/src/main/res/layout/activity_fullscreen_message.xml
+++ b/src/main/res/layout/activity_media_viewer.xml
@@ -13,7 +13,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
- <com.github.chrisbanes.photoview.PhotoView
+ <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
android:id="@id/message_image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -32,6 +32,6 @@
android:layout_height="wrap_content"
android:layout_gravity="right|top"
android:layout_margin="16dp"
- android:src="?attr/icon_share" />
+ android:src="@drawable/ic_menu_white_24dp" />
</FrameLayout>
</RelativeLayout> \ No newline at end of file
diff --git a/src/main/res/menu/contact_details.xml b/src/main/res/menu/contact_details.xml
index 50243150b..b9268e4f9 100644
--- a/src/main/res/menu/contact_details.xml
+++ b/src/main/res/menu/contact_details.xml
@@ -11,7 +11,7 @@
<item
android:id="@+id/action_share"
- android:icon="?attr/icon_share"
+ android:icon="@drawable/ic_share_white_24dp"
android:orderInCategory="15"
app:showAsAction="always"
android:title="@string/share_uri_with">
diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml
index fbc5841ea..cbdde1fce 100644
--- a/src/main/res/menu/editaccount.xml
+++ b/src/main/res/menu/editaccount.xml
@@ -9,7 +9,7 @@
<item android:id="@+id/action_share"
android:title="@string/share_uri_with"
- android:icon="?attr/icon_share"
+ android:icon="@drawable/ic_share_white_24dp"
app:showAsAction="always">
<menu>
<item
diff --git a/src/main/res/menu/media_viewer.xml b/src/main/res/menu/media_viewer.xml
new file mode 100644
index 000000000..c3898c79b
--- /dev/null
+++ b/src/main/res/menu/media_viewer.xml
@@ -0,0 +1,17 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/action_share"
+ android:icon="?attr/icon_share"
+ android:orderInCategory="10"
+ android:title="@string/share" />
+ <item
+ android:id="@+id/action_open"
+ android:orderInCategory="20"
+ android:title="@string/action_open" />
+ <item
+ android:id="@+id/action_delete"
+ android:icon="?attr/icon_delete"
+ android:orderInCategory="30"
+ android:title="@string/action_delete" />
+</menu> \ No newline at end of file
diff --git a/src/main/res/menu/muc_details.xml b/src/main/res/menu/muc_details.xml
index b5e74f271..9f12e7333 100644
--- a/src/main/res/menu/muc_details.xml
+++ b/src/main/res/menu/muc_details.xml
@@ -4,7 +4,7 @@
<item
android:id="@+id/action_share"
- android:icon="?attr/icon_share"
+ android:icon="@drawable/ic_share_white_24dp"
android:orderInCategory="15"
android:title="@string/share_uri_with"
app:showAsAction="always">
diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml
index 284e7d74b..c537fd248 100644
--- a/src/main/res/values/attrs.xml
+++ b/src/main/res/values/attrs.xml
@@ -75,6 +75,7 @@
<attr name="icon_secure" format="reference" />
<attr name="icon_settings" format="reference" />
<attr name="icon_share" format="reference" />
+ <attr name="icon_delete" format="reference" />
<attr name="icon_import_export" format="reference" />
<attr name="icon_scan_qr_code" format="reference" />
<attr name="icon_enable_undecided_device" format="reference" />
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index e213ea773..51971bcfd 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -41,7 +41,7 @@
\n\nhttp://hc.apache.org/httpcomponents-client\n(Apache License, Version 2.0)
\n\nhttp://hc.apache.org/httpcomponents-core\n(Apache License, Version 2.0)
\n\nhttps://github.com/bumptech/glide\n(BSD, The MIT License (MIT) and Apache License, Version 2.0)
- \n\nhttps://github.com/chrisbanes/PhotoView\n(Apache License, Version 2.0)
+ \n\nhttps://github.com/davemorrissey/subsampling-scale-image-view\n(Apache License, Version 2.0)
\n\nhttps://github.com/rtoshiro/FullscreenVideoView\n(Apache License, Version 2.0)
\n\nhttps://github.com/mangstadt/ez-vcard\n(FreeBSD)
\n\nhttps://github.com/googlesamples/easypermissions\n(Apache License, Version 2.0)
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index d3f9eeb0c..28a0b3156 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -827,4 +827,6 @@
<string name="view_media">View media</string>
<string name="media_browser">Media browser</string>
<string name="account_status_stream_opening_error">Stream opening error</string>
+ <string name="action_open">Open</string>
+ <string name="action_delete">Delete</string>
</resources>
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 8abbbd1e9..a8bdf3e1d 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -99,7 +99,8 @@
<item name="icon_settings" type="reference">@drawable/ic_settings_black_24dp</item>
<item name="icon_import_export" type="reference">@drawable/ic_import_export_white_24dp
</item>
- <item name="icon_share" type="reference">@drawable/ic_share_white_24dp</item>
+ <item name="icon_delete" type="reference">@drawable/ic_delete_black_24dp</item>
+ <item name="icon_share" type="reference">@drawable/ic_share_black_24dp</item>
<item name="icon_scan_qr_code" type="reference">@drawable/ic_barcode_scan_white_24dp</item>
<item name="icon_scroll_down" type="reference">@drawable/ic_scroll_to_end_black</item>
@@ -271,6 +272,7 @@
<item name="icon_settings" type="reference">@drawable/ic_settings_white_24dp</item>
<item name="icon_import_export" type="reference">@drawable/ic_import_export_white_24dp
</item>
+ <item name="icon_delete" type="reference">@drawable/ic_delete_white_24dp</item>
<item name="icon_share" type="reference">@drawable/ic_share_white_24dp</item>
<item name="icon_scan_qr_code" type="reference">@drawable/ic_barcode_scan_white_24dp</item>
<item name="icon_scroll_down" type="reference">@drawable/ic_scroll_to_end_white</item>