Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use PhotoViewerInfoSheet buttons #357

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonAPIController;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
import org.joinmastodon.android.model.Attachment;
import org.joinmastodon.android.ui.ImageDescriptionSheet;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
import org.joinmastodon.android.utils.FileProvider;
import org.joinmastodon.android.ui.utils.UiUtils;

import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -117,7 +114,6 @@ public class PhotoViewer implements ZoomPanView.Listener{
private TextView videoTimeView;
private ImageButton videoPlayPauseButton;
private View videoControls;
private MenuItem imageDescriptionButton;
private boolean uiVisible=true;
private AudioManager.OnAudioFocusChangeListener audioFocusListener=this::onAudioFocusChanged;
private Runnable uiAutoHider=()->{
Expand Down Expand Up @@ -210,32 +206,6 @@ public void onPageSelected(int position){
toolbarWrap=uiOverlay.findViewById(R.id.toolbar_wrap);
toolbar=uiOverlay.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(v->onStartSwipeToDismissTransition(0));
imageDescriptionButton = toolbar.getMenu()
.add(R.string.sk_image_description)
.setIcon(R.drawable.ic_fluent_image_alt_text_24_regular)
.setVisible(attachments.get(pager.getCurrentItem()).description != null
&& !attachments.get(pager.getCurrentItem()).description.isEmpty())
.setOnMenuItemClickListener(item -> {
new ImageDescriptionSheet(activity,attachments.get(pager.getCurrentItem())).show();
return true;
});
imageDescriptionButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
toolbar.getMenu()
.add(R.string.download)
.setIcon(R.drawable.ic_fluent_arrow_download_24_regular)
.setOnMenuItemClickListener(item -> {
saveCurrentFile();
return true;
})
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
toolbar.getMenu()
.add(R.string.button_share)
.setIcon(R.drawable.ic_fluent_share_24_regular)
.setOnMenuItemClickListener(item -> {
shareCurrentFile();
return true;
})
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
if(status!=null)
toolbar.getMenu().add(R.string.info).setIcon(R.drawable.ic_fluent_info_24_regular).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
else
Expand Down Expand Up @@ -446,7 +416,6 @@ private void hideUiDelayed(long delay){
private void onPageChanged(int index){
currentIndex=index;
Attachment att=attachments.get(index);
imageDescriptionButton.setVisible(att.description != null && !att.description.isEmpty());
V.setVisibilityAnimated(videoControls, att.type==Attachment.Type.VIDEO ? View.VISIBLE : View.GONE);
if(att.type==Attachment.Type.VIDEO){
videoSeekBar.setSecondaryProgress(0);
Expand Down Expand Up @@ -805,7 +774,7 @@ public void onButtonClick(int id){
}
}else if(id==R.id.btn_share){
if(status!=null){
UiUtils.openSystemShareSheet(activity, status.url);
shareCurrentFile();
}
}else if(id==R.id.btn_bookmark){
if(status!=null){
Expand Down
8 changes: 4 additions & 4 deletions mastodon/src/main/res/layout/sheet_photo_viewer_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<Button
android:id="@+id/btn_favorite"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/button_favorite"
android:drawableTop="@drawable/ic_fluent_star_24_selector"
Expand All @@ -60,7 +60,7 @@

<Button
android:id="@+id/btn_share"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/button_share"
android:drawableTop="@drawable/ic_fluent_share_24_regular"
Expand All @@ -73,7 +73,7 @@

<Button
android:id="@+id/btn_bookmark"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/add_bookmark"
android:drawableTop="@drawable/ic_fluent_bookmark_24_selector"
Expand All @@ -86,7 +86,7 @@

<Button
android:id="@+id/btn_download"
android:layout_width="64dp"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/download"
android:drawableTop="@drawable/ic_fluent_arrow_download_24_regular"
Expand Down
Loading