Fix conflicts on merging

This commit is contained in:
Javi Rueda 2020-12-18 14:46:35 +01:00
commit 4c9f037ecc
11 changed files with 301 additions and 267 deletions

View file

@ -18,7 +18,17 @@ The minimum supported Android version is 5.0 Lollipop. There are two ways to ins
The app can be launched by opening **LBRY** from the device's app drawer or via the shortcut on the home screen if that was created upon installation.
## Running from Source
Clone the repository and open the project in Android Studio. Android Studio will automatically run the initial build process. Click the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
Clone the repository and open the project in Android Studio. Android Studio will automatically run the initial build process.
Create file 'twitter.properties' in app/ folder with the following content:
```
twitterConsumerKey=XXXXXX
twitterConsumerSecret=XXXXXX
```
Click the Sync button and when process finishes, the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
## Contributing
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing

View file

@ -101,10 +101,8 @@ dependencies {
implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.3.1.LTS'
implementation('org.bitcoinj:bitcoinj-tools:0.14.7') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude module: 'guava'
}
implementation 'commons-codec:commons-codec:1.15'
implementation 'org.bitcoinj:bitcoinj-tools:0.14.7'
implementation 'org.java-websocket:Java-WebSocket:1.5.1'
compileOnly 'org.projectlombok:lombok:1.18.10'

View file

@ -12,7 +12,6 @@ import lombok.Data;
@Data
public class Comment implements Comparable<Comment> {
public static final double LBC_COST = 1;
public static final int MAX_LENGTH = 2000;
private Claim poster;

View file

@ -24,18 +24,16 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class CommentCreateWithTipTask extends AsyncTask<Void, Void, Comment> {
public class CommentCreateTask extends AsyncTask<Void, Void, Comment> {
private static final String STATUS_ENDPOINT = "https://comments.lbry.com";
private Comment comment;
private BigDecimal amount;
private View progressView;
private CommentCreateWithTipHandler handler;
private Exception error;
public CommentCreateWithTipTask(Comment comment, BigDecimal amount, View progressView, CommentCreateWithTipHandler handler) {
public CommentCreateTask(Comment comment, View progressView, CommentCreateWithTipHandler handler) {
this.comment = comment;
this.amount = amount;
this.progressView = progressView;
this.handler = handler;
}
@ -62,13 +60,6 @@ public class CommentCreateWithTipTask extends AsyncTask<Void, Void, Comment> {
}
Map<String, Object> options = new HashMap<>();
options.put("blocking", true);
options.put("claim_id", comment.getClaimId());
options.put("amount", new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).format(amount.doubleValue()));
options.put("tip", true);
Lbry.genericApiCall(Lbry.METHOD_SUPPORT_CREATE, options);
options = new HashMap<>();
options.put("comment", comment.getText());
options.put("claim_id", comment.getClaimId());
options.put("channel_id", comment.getChannelId());

View file

@ -30,7 +30,6 @@ import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
@ -45,7 +44,7 @@ import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.Comment;
import io.lbry.browser.model.WalletBalance;
import io.lbry.browser.tasks.CommentCreateWithTipTask;
import io.lbry.browser.tasks.CommentCreateTask;
import io.lbry.browser.tasks.CommentListHandler;
import io.lbry.browser.tasks.CommentListTask;
import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask;
@ -58,7 +57,6 @@ import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryAnalytics;
import io.lbry.browser.utils.LbryUri;
import io.lbry.browser.utils.Lbryio;
import lombok.Setter;
public class ChannelCommentsFragment extends Fragment implements SdkStatusListener, WalletBalanceListener {
@ -367,9 +365,6 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
}
private void initCommentForm(View root) {
double amount = Comment.LBC_COST;
String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount));
buttonPostComment.setText(buttonText);
textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH));
buttonClearReplyToComment.setOnClickListener(new View.OnClickListener() {
@ -387,7 +382,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
return;
}
validateAndCheckPostComment(amount);
validateAndCheckPostComment();
}
});
@ -433,7 +428,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
});
}
private void validateAndCheckPostComment(double amount) {
private void validateAndCheckPostComment() {
String comment = Helper.getValue(inputComment.getText());
Claim channel = (Claim) commentChannelSpinner.getSelectedItem();
@ -445,29 +440,18 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
showError(getString(R.string.please_select_channel));
return;
}
if (Lbry.walletBalance == null || amount > Lbry.walletBalance.getAvailable().doubleValue()) {
showError(getString(R.string.insufficient_balance));
return;
}
Context context = getContext();
if (context != null) {
String titleText = getResources().getQuantityString(
R.plurals.post_and_tip,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount));
String confirmText = getResources().getQuantityString(
R.plurals.confirm_post_comment,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount),
claim.getTitleOrName());
String titleText = getResources().getString(R.string.comment_confirm_post);
String confirmText = getResources().getString(R.string.confirm_post_comment);
AlertDialog.Builder builder = new AlertDialog.Builder(context).
setTitle(titleText).
setMessage(confirmText)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
postComment(amount);
postComment();
}
}).setNegativeButton(R.string.no, null);
builder.show();
@ -545,17 +529,15 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
replyToComment = null;
}
private void postComment(double tipAmount) {
private void postComment() {
if (postingComment) {
return;
}
Comment comment = buildPostComment();
// only use 2 decimal places
BigDecimal amount = new BigDecimal(String.valueOf(tipAmount));
beforePostComment();
CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() {
CommentCreateTask task = new CommentCreateTask(comment, progressPostComment, new CommentCreateTask.CommentCreateWithTipHandler() {
@Override
public void onSuccess(Comment createdComment) {
inputComment.setText(null);
@ -573,7 +555,6 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
checkNoComments();
Bundle bundle = new Bundle();
bundle.putDouble("amount", amount.doubleValue());
bundle.putString("claim_id", claim != null ? claim.getClaimId() : null);
bundle.putString("claim_name", claim != null ? claim.getName() : null);
LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle);

View file

@ -123,7 +123,7 @@ import io.lbry.browser.model.WalletBalance;
import io.lbry.browser.model.lbryinc.Reward;
import io.lbry.browser.model.lbryinc.Subscription;
import io.lbry.browser.tasks.BufferEventTask;
import io.lbry.browser.tasks.CommentCreateWithTipTask;
import io.lbry.browser.tasks.CommentCreateTask;
import io.lbry.browser.tasks.CommentListHandler;
import io.lbry.browser.tasks.CommentListTask;
import io.lbry.browser.tasks.GenericTaskHandler;
@ -2989,9 +2989,6 @@ public class FileViewFragment extends BaseFragment implements
}
private void initCommentForm(View root) {
double amount = Comment.LBC_COST;
String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount));
buttonPostComment.setText(buttonText);
textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH));
buttonClearReplyToComment.setOnClickListener(new View.OnClickListener() {
@ -3009,7 +3006,7 @@ public class FileViewFragment extends BaseFragment implements
return;
}
validateAndCheckPostComment(amount);
validateAndCheckPostComment();
}
});
@ -3055,7 +3052,7 @@ public class FileViewFragment extends BaseFragment implements
});
}
private void validateAndCheckPostComment(double amount) {
private void validateAndCheckPostComment() {
String comment = Helper.getValue(inputComment.getText());
Claim channel = (Claim) commentChannelSpinner.getSelectedItem();
@ -3067,29 +3064,18 @@ public class FileViewFragment extends BaseFragment implements
showError(getString(R.string.please_select_channel));
return;
}
if (Lbry.walletBalance == null || amount > Lbry.walletBalance.getAvailable().doubleValue()) {
showError(getString(R.string.insufficient_balance));
return;
}
Context context = getContext();
if (context != null) {
String titleText = getResources().getQuantityString(
R.plurals.post_and_tip,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount));
String confirmText = getResources().getQuantityString(
R.plurals.confirm_post_comment,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount),
claim.getTitleOrName());
String titleText = getResources().getString(R.string.comment_confirm_post);
String confirmText = getResources().getString(R.string.confirm_post_comment);
AlertDialog.Builder builder = new AlertDialog.Builder(context).
setTitle(titleText).
setMessage(confirmText)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
postComment(amount);
postComment();
}
}).setNegativeButton(R.string.no, null);
builder.show();
@ -3167,17 +3153,15 @@ public class FileViewFragment extends BaseFragment implements
replyToComment = null;
}
private void postComment(double tipAmount) {
private void postComment() {
if (postingComment) {
return;
}
Comment comment = buildPostComment();
// only use 2 decimal places
BigDecimal amount = new BigDecimal(String.valueOf(tipAmount));
beforePostComment();
CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() {
CommentCreateTask task = new CommentCreateTask(comment, progressPostComment, new CommentCreateTask.CommentCreateWithTipHandler() {
@Override
public void onSuccess(Comment createdComment) {
inputComment.setText(null);
@ -3195,7 +3179,6 @@ public class FileViewFragment extends BaseFragment implements
checkNoComments();
Bundle bundle = new Bundle();
bundle.putDouble("amount", amount.doubleValue());
bundle.putString("claim_id", claim != null ? claim.getClaimId() : null);
bundle.putString("claim_name", claim != null ? claim.getName() : null);
LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle);

View file

@ -29,9 +29,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.common.util.Hex;
import org.apache.commons.codec.binary.Hex;
import org.bitcoinj.core.Base58;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -39,7 +38,7 @@ import org.json.JSONObject;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
@ -795,9 +794,9 @@ public final class Helper {
public static String SHA256(String value) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(value.getBytes("UTF-8"));
return Hex.bytesToStringLowercase(hash);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
byte[] hash = digest.digest(value.getBytes(StandardCharsets.UTF_8));
return Hex.encodeHexString(hash, true);
} catch (NoSuchAlgorithmException ex) {
return null;
}
}

View file

@ -47,22 +47,25 @@
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:visibility="gone">
<View
android:id="@+id/comment_form_reply_to_vertical_bar"
android:layout_width="3dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/nextLbryGreen" />
android:background="@color/nextLbryGreen"
android:orientation="vertical" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="40dp">
android:layout_marginEnd="40dp"
android:orientation="vertical">
<TextView
android:id="@+id/comment_form_replying_to_text"
android:layout_width="wrap_content"
@ -77,19 +80,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:lineSpacingMultiplier="1.05"
android:fontFamily="@font/inter"
android:lineSpacingMultiplier="1.05"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/comment_form_clear_reply_to"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_alignParentEnd="true"
android:layout_width="36dp"
android:layout_height="36dp">
android:layout_height="36dp"
android:layout_alignParentEnd="true"
android:background="?attr/selectableItemBackground"
android:clickable="true">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
@ -168,12 +172,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/comment_form_post"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter" />
android:layout_centerVertical="true"
android:fontFamily="@font/inter"
android:text="@string/comment_form_post" />
<ProgressBar
android:id="@+id/comment_form_post_progress"
android:layout_width="20dp"

View file

@ -37,58 +37,66 @@
<LinearLayout
android:id="@+id/file_view_claim_display_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
<RelativeLayout
android:id="@+id/file_view_media_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="246dp">
android:layout_height="246dp"
android:background="@color/mediaContainerBackground">
<RelativeLayout
android:id="@+id/file_view_media_meta_container"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:clickable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
android:id="@+id/file_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/file_view_main_action_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true" />
<com.google.android.material.button.MaterialButton
android:id="@+id/file_view_main_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/inter"
android:text="@string/play"
android:textSize="14sp"
android:visibility="invisible"
android:text="@string/play" />
android:visibility="invisible" />
<LinearLayout
android:id="@+id/file_view_fee_container"
android:background="@drawable/bg_stream_cost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentEnd="true"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:background="@drawable/bg_stream_cost"
android:orientation="horizontal"
android:paddingStart="6dp"
android:paddingTop="2dp"
android:paddingEnd="7dp"
android:paddingBottom="2dp"
android:visibility="gone">
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/file_view_fee"
android:layout_width="wrap_content"
@ -97,22 +105,24 @@
android:layout_marginStart="1dp"
android:fontFamily="@font/inter"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textFontWeight="300" />
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_exoplayer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/file_view_exoplayer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/exo_playback_control_view"/>
app:controller_layout_id="@layout/exo_playback_control_view" />
<ProgressBar
android:id="@+id/player_buffering_progress"
android:layout_width="36dp"
@ -123,47 +133,52 @@
<RelativeLayout
android:id="@+id/file_view_unsupported_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/mediaContainerBackground"
android:padding="36dp"
android:visibility="gone">
<ImageView
android:id="@+id/file_view_unsupported_gerbil"
android:src="@drawable/gerbil_happy"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content" />
android:src="@drawable/gerbil_happy" />
<LinearLayout
android:layout_toEndOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="24dp"
android:layout_centerVertical="true">
android:layout_toEndOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/unsupported_content"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/unsupported_content" />
android:textSize="18sp" />
<TextView
android:id="@+id/file_view_unsupported_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/unsupported_content_desc"
android:textColor="@color/white"
android:textSize="14sp"
android:textFontWeight="300"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:textSize="14sp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/file_view_open_external_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="14sp"
android:text="@string/open" />
android:text="@string/open"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
@ -173,31 +188,37 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/card_reward_driver"
android:visibility="gone"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
layout="@layout/card_reward_driver"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/file_view_title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clickable="true"
android:paddingStart="16dp"
android:paddingEnd="4dp">
android:paddingTop="8dp"
android:paddingEnd="4dp"
android:paddingBottom="8dp">
<LinearLayout
android:id="@+id/file_view_title_layout"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp">
android:layout_centerVertical="true"
android:layout_marginEnd="48dp"
android:orientation="vertical">
<TextView
android:id="@+id/file_view_title"
android:layout_width="wrap_content"
@ -205,38 +226,41 @@
android:fontFamily="@font/inter"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:orientation="horizontal">
<TextView
android:id="@+id/file_view_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300"
android:textSize="12sp"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publish_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300" />
android:textFontWeight="300"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/file_view_desc_toggle_arrow"
android:src="@drawable/ic_arrow_dropdown"
android:layout_toStartOf="@+id/file_view_title_layout"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/file_view_title_layout"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
</RelativeLayout>
@ -246,280 +270,308 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5">
<LinearLayout
android:id="@+id/file_view_action_share"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_share" />
android:src="@drawable/ic_share"
android:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/share"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_tip"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:textSize="20dp"
android:text="@string/fa_gift"/>
android:text="@string/fa_gift"
android:textColor="@color/foreground"
android:textSize="20dp" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/support"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/support"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_repost"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_repost"/>
android:text="@string/fa_repost"
android:textColor="@color/foreground"
android:textSize="20dp" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/repost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/repost"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_edit"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit" />
android:src="@drawable/ic_edit"
android:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/edit"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_download"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ProgressBar
android:id="@+id/file_view_download_progress"
style="?android:progressBarStyleHorizontal"
android:layout_width="36dp"
android:layout_height="36dp"
style="?android:progressBarStyleHorizontal"
android:progressDrawable="@drawable/determinate_progress_circle"
android:visibility="gone" />
<ImageView
android:id="@+id/file_view_action_download_icon"
android:tint="@color/foreground"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_download" />
android:src="@drawable/ic_download"
android:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/download"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_delete"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_delete" />
android:src="@drawable/ic_delete"
android:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/delete"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_unpublish"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_unpublish" />
android:src="@drawable/ic_unpublish"
android:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/unpublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/unpublish"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_report"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_report" />
android:src="@drawable/ic_report"
android:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/report"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="12dp"
android:layout_height="0.5dp" />
android:background="@color/divider" />
<RelativeLayout
android:id="@+id/file_view_publisher_area"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/file_view_publisher_info_area"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:layout_toStartOf="@id/file_view_publisher_area_actions"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:paddingStart="16dp"
android:paddingBottom="12dp"
android:layout_toStartOf="@id/file_view_publisher_area_actions">
android:paddingTop="12dp"
android:paddingBottom="12dp">
<RelativeLayout
android:id="@+id/file_view_publisher_avatar"
android:layout_width="50dp"
@ -527,28 +579,31 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:visibility="gone">
<RelativeLayout
android:layout_centerHorizontal="true"
android:background="@drawable/bg_channel_icon"
android:id="@+id/file_view_publisher_no_thumbnail"
android:layout_width="50dp"
android:layout_height="50dp">
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:background="@drawable/bg_channel_icon">
<TextView
android:id="@+id/file_view_publisher_thumbnail_alpha"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/inter"
android:textAllCaps="true"
android:textSize="24sp"
android:textColor="@color/white"
android:textFontWeight="300" />
android:textFontWeight="300"
android:textSize="24sp" />
</RelativeLayout>
<ImageView
android:layout_centerHorizontal="true"
android:id="@+id/file_view_publisher_thumbnail"
android:layout_width="50dp"
android:layout_height="50dp" />
android:layout_height="50dp"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<LinearLayout
@ -557,6 +612,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/file_view_publisher_title"
android:layout_width="wrap_content"
@ -565,6 +621,7 @@
android:textFontWeight="300"
android:textSize="14sp"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publisher_name"
android:layout_width="wrap_content"
@ -580,18 +637,20 @@
android:id="@+id/file_view_publisher_area_actions"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true">
android:orientation="horizontal">
<LinearLayout
android:id="@+id/file_view_icon_follow"
android:background="?attr/selectableItemBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="horizontal"
android:clickable="true">
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -599,9 +658,9 @@
android:layout_marginStart="16dp"
android:fontFamily="@font/inter"
android:text="@string/follow"
android:textAllCaps="true"
android:textSize="12sp"
android:textStyle="bold"
android:textAllCaps="true" />
android:textStyle="bold" />
<io.lbry.browser.ui.controls.OutlineIconView
android:layout_width="24dp"
@ -615,12 +674,12 @@
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_unfollow"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:text="@string/fa_heart_broken"
android:textColor="@color/foreground"
android:textSize="20dp"
@ -628,23 +687,23 @@
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_bell"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:text="@string/fa_bell_slash"
android:textColor="@color/foreground"
android:textSize="20dp"
android:visibility="gone"/>
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
android:background="@color/divider" />
<LinearLayout
android:id="@+id/file_view_description_area"
@ -702,22 +761,25 @@
<LinearLayout
android:id="@+id/file_view_related_content_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
android:layout_marginBottom="8dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/related_content"
android:layout_centerVertical="true"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:layout_centerVertical="true" />
android:text="@string/related_content"
android:textSize="16sp" />
<ProgressBar
android:id="@+id/file_view_related_content_progress"
android:layout_width="16dp"
@ -726,23 +788,25 @@
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/file_view_no_related_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_related_content"
android:textSize="14sp"
android:textFontWeight="300"
android:textSize="14sp"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_related_content_list"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:overScrollMode="never" />
</LinearLayout>
<View
@ -755,14 +819,15 @@
android:id="@+id/file_view_comments_area"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:orientation="vertical">
android:orientation="vertical"
android:paddingBottom="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
<ProgressBar
android:id="@+id/file_view_comments_progress"
android:layout_width="16dp"
@ -787,8 +852,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_comments"
android:textFontWeight="300"

View file

@ -87,23 +87,14 @@
<string name="comment_as">Comment as</string>
<string name="please_enter_comment">Please enter a comment to post.</string>
<string name="please_select_channel">Please select a channel to post your comment as.</string>
<string name="comment_form_post">Post</string>
<string name="comment_confirm_post">Confirm your comment</string>
<string name="confirm_post_comment">This will post your comment</string>
<string name="comment_posted">Your comment was successfully posted.</string>
<string name="please_select_repost_channel">Please select a channel to repost on.</string>
<string name="reply">Reply</string>
<string name="replying_to">Replying to %1$s</string>
<string name="choose_app">Choose app</string>
<plurals name="post_and_tip">
<item quantity="one">Post and tip %1$s credit?</item>
<item quantity="other">Post and tip %1$s credits?</item>
</plurals>
<plurals name="post_for_credits">
<item quantity="one">Post for %1$s credit</item>
<item quantity="other">Post for %1$s credits</item>
</plurals>
<plurals name="confirm_post_comment">
<item quantity="one">This will post your comment with a tip of %1$s credit for %2$s</item>
<item quantity="other">This will post your comment with a tip of %1$s credits for %2$s</item>
</plurals>
<plurals name="view_count">
<item quantity="one">%1$s view</item>
<item quantity="other">%1$s views</item>

View file

@ -0,0 +1,11 @@
package io.lbry.browser.utils;
import junit.framework.TestCase;
public class HelperTest extends TestCase {
public void testSHA256() {
// Using a fake user id, which is a long.
assertEquals("de9edb2044d012f04553e49b04d54cbec8e8a46a40ad5a19bc5dcce1da00ecfd", Helper.SHA256(String.valueOf(12345678912345L)));
}
}