Merge pull request #1013 from clay53/987

Add ability to download & delete your own videos and move unpublish button to description
This commit is contained in:
Akinwale Ariwodola 2020-10-02 11:05:44 +01:00 committed by GitHub
commit 6a0263c5bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 43 deletions

View file

@ -1015,19 +1015,6 @@ public class FileViewFragment extends BaseFragment implements
} }
if (claim != null) { if (claim != null) {
boolean isOwnClaim = Lbry.ownClaims.contains(claim);
if (isOwnClaim) {
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();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()). AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_file). setTitle(R.string.delete_file).
setMessage(R.string.confirm_delete_file_message) setMessage(R.string.confirm_delete_file_message)
@ -1040,6 +1027,28 @@ public class FileViewFragment extends BaseFragment implements
builder.show(); builder.show();
} }
} }
});
root.findViewById(R.id.file_view_action_unpublish).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!Lbry.SDK_READY) {
Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
return;
}
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();
}
} }
}); });
@ -2778,10 +2787,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

@ -298,6 +298,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>