Add ability to download & delete your own videos and move unpublish button to description #1013

Merged
clay53 merged 1 commit from 987 into master 2020-10-02 12:05:45 +02:00
4 changed files with 76 additions and 43 deletions

View file

@ -1010,30 +1010,39 @@ public class FileViewFragment extends BaseFragment implements
} }
if (claim != null) { if (claim != null) {
boolean isOwnClaim = Lbry.ownClaims.contains(claim); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
if (isOwnClaim) { setTitle(R.string.delete_file).
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()). setMessage(R.string.confirm_delete_file_message)
setTitle(R.string.delete_content). .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
setMessage(R.string.confirm_delete_content_message) @Override
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) {
@Override deleteClaimFile();
public void onClick(DialogInterface dialogInterface, int i) { }
deleteCurrentClaim(); }).setNegativeButton(R.string.no, null);
} builder.show();
}).setNegativeButton(R.string.no, null); }
builder.show(); }
} else { });
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_file). root.findViewById(R.id.file_view_action_unpublish).setOnClickListener(new View.OnClickListener() {
setMessage(R.string.confirm_delete_file_message) @Override
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(View view) {
@Override if (!Lbry.SDK_READY) {
public void onClick(DialogInterface dialogInterface, int i) { Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
deleteClaimFile(); return;
} }
}).setNegativeButton(R.string.no, null);
builder.show(); if (claim != null) {
} AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_content).
setMessage(R.string.confirm_delete_content_message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
deleteCurrentClaim();
}
}).setNegativeButton(R.string.no, null);
builder.show();
} }
} }
}); });
@ -2773,10 +2782,9 @@ public class FileViewFragment extends BaseFragment implements
boolean isOwnClaim = Lbry.ownClaims.contains(claim); boolean isOwnClaim = Lbry.ownClaims.contains(claim);
View root = getView(); View root = getView();
if (root != null) { if (root != null) {
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_download), isOwnClaim ? View.GONE : View.VISIBLE);
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_report), isOwnClaim ? View.GONE : View.VISIBLE); Helper.setViewVisibility(root.findViewById(R.id.file_view_action_report), isOwnClaim ? View.GONE : View.VISIBLE);
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_edit), isOwnClaim ? View.VISIBLE : View.GONE); Helper.setViewVisibility(root.findViewById(R.id.file_view_action_edit), isOwnClaim ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_delete), isOwnClaim ? View.VISIBLE : View.GONE); Helper.setViewVisibility(root.findViewById(R.id.file_view_action_unpublish), isOwnClaim ? View.VISIBLE : View.GONE);
} }
} }
} }

View file

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF"
android:alpha="0.8">
<path
android:fillColor="#FF000000"
android:pathData="M5,3h14v2h-14zM9,7v6h-4l7,7l7,-7h-4v-6"/>
</vector>

View file

@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/file_view_global_layout" android:id="@+id/file_view_global_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -578,52 +579,63 @@
<LinearLayout <LinearLayout
android:id="@+id/file_view_description_area" android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:id="@+id/file_view_description" android:id="@+id/file_view_description"
android:textSize="12sp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/inter" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:autoLink="all" android:autoLink="all"
android:fontFamily="@font/inter"
android:textColorLink="@color/lbryGreen" android:textColorLink="@color/lbryGreen"
android:textFontWeight="300" android:textFontWeight="300"
android:layout_marginStart="16dp" android:textSize="12sp" />
android:layout_marginEnd="16dp" />
<LinearLayout <LinearLayout
android:id="@+id/file_view_tag_area" android:id="@+id/file_view_tag_area"
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="10"
android:paddingTop="36dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"> android:layout_marginEnd="16dp"
android:layout_weight="10"
android:orientation="horizontal"
android:paddingTop="36dp">
<TextView <TextView
android:layout_weight="2"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:text="@string/tags" android:text="@string/tags"
android:textSize="12sp" android:textFontWeight="600"
android:textFontWeight="600" /> android:textSize="12sp" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list" android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginStart="8dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="8" />
</LinearLayout> </LinearLayout>
<Button
android:id="@+id/file_view_action_unpublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/unpublish"
app:icon="@drawable/ic_unpublish" />
<View <View
android:background="@color/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_height="0.5dp" /> android:background="@color/divider" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -751,4 +763,5 @@
android:visibility="gone"> android:visibility="gone">
</RelativeLayout> </RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -297,6 +297,7 @@
<string name="receive">Receive</string> <string name="receive">Receive</string>
<string name="spend">Spend</string> <string name="spend">Spend</string>
<string name="publish">Publish</string> <string name="publish">Publish</string>
<string name="unpublish">Unpublish</string>
<string name="support">Support</string> <string name="support">Support</string>
<string name="abandon">Abandon</string> <string name="abandon">Abandon</string>
<string name="channel">Channel</string> <string name="channel">Channel</string>