Skip to content

Commit

Permalink
fix(image-viewer): put the download and share buttons back on a sensi…
Browse files Browse the repository at this point in the history
…ble place
  • Loading branch information
LucasGGamerM committed May 27, 2024
1 parent 38996d8 commit 5e7f4bd
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,32 +207,32 @@ public void onPageSelected(int position){
toolbar=uiOverlay.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(v->onStartSwipeToDismissTransition(0));

if(status!=null) {
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)
.setOnMenuItemClickListener(item -> {
.setOnMenuItemClickListener(item->{
showInfoSheet();
return true;
})
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
} else {
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);
}

uiOverlay.setAlpha(0f);
Expand Down Expand Up @@ -781,17 +781,18 @@ public void onButtonClick(int id){
if(status!=null){
AccountSessionManager.get(accountID).getStatusInteractionController().setFavorited(status, !status.favourited, r->{});
}
}else if(id==R.id.btn_share){
if(status!=null){
shareCurrentFile();
}
// }else if(id==R.id.btn_share){
// if(status!=null){
// shareCurrentFile();
// }
}else if(id==R.id.btn_bookmark){
if(status!=null){
AccountSessionManager.get(accountID).getStatusInteractionController().setBookmarked(status, !status.bookmarked);
}
}else if(id==R.id.btn_download){
saveCurrentFile();
}
// else if(id==R.id.btn_download){
// saveCurrentFile();
// }
}
});
sheet.setStatus(status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public PhotoViewerInfoSheet(@NonNull Context context, Attachment attachment, int

boostBtn.setOnClickListener(clickListener);
favoriteBtn.setOnClickListener(clickListener);
findViewById(R.id.btn_share).setOnClickListener(clickListener);
// findViewById(R.id.btn_share).setOnClickListener(clickListener);
bookmarkBtn.setOnClickListener(clickListener);
findViewById(R.id.btn_download).setOnClickListener(clickListener);
// findViewById(R.id.btn_download).setOnClickListener(clickListener);
}

private void showAltTextHelp(){
Expand Down
52 changes: 26 additions & 26 deletions mastodon/src/main/res/layout/sheet_photo_viewer_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<Button
android:id="@+id/btn_boost"
android:layout_width="wrap_content"
android:layout_width="92dp"
android:layout_height="64dp"
android:text="@string/button_reblog"
android:drawableTop="@drawable/ic_boost"
Expand All @@ -47,24 +47,24 @@

<Button
android:id="@+id/btn_favorite"
android:layout_width="wrap_content"
android:layout_width="92dp"
android:layout_height="64dp"
android:text="@string/button_favorite"
android:drawableTop="@drawable/ic_fluent_star_24_selector"
style="@style/Widget.Mastodon.M3.Button.IconWithLabel"/>

<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"/>
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1"/>-->

<Button
android:id="@+id/btn_share"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/button_share"
android:drawableTop="@drawable/ic_fluent_share_24_regular"
style="@style/Widget.Mastodon.M3.Button.IconWithLabel"/>
<!-- <Button-->
<!-- android:id="@+id/btn_share"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="64dp"-->
<!-- android:text="@string/button_share"-->
<!-- android:drawableTop="@drawable/ic_fluent_share_24_regular"-->
<!-- style="@style/Widget.Mastodon.M3.Button.IconWithLabel"/>-->

<Space
android:layout_width="0dp"
Expand All @@ -73,24 +73,24 @@

<Button
android:id="@+id/btn_bookmark"
android:layout_width="wrap_content"
android:layout_width="92dp"
android:layout_height="64dp"
android:text="@string/add_bookmark"
android:drawableTop="@drawable/ic_fluent_bookmark_24_selector"
style="@style/Widget.Mastodon.M3.Button.IconWithLabel"/>

<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"/>

<Button
android:id="@+id/btn_download"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:text="@string/download"
android:drawableTop="@drawable/ic_fluent_arrow_download_24_regular"
style="@style/Widget.Mastodon.M3.Button.IconWithLabel"/>
<!-- <Space-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_weight="1"/>-->

<!-- <Button-->
<!-- android:id="@+id/btn_download"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="64dp"-->
<!-- android:text="@string/download"-->
<!-- android:drawableTop="@drawable/ic_fluent_arrow_download_24_regular"-->
<!-- style="@style/Widget.Mastodon.M3.Button.IconWithLabel"/>-->

</LinearLayout>

Expand Down

0 comments on commit 5e7f4bd

Please sign in to comment.