Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
288e35dd64 | ||
|
|
d4af28d1c5 | ||
|
|
37cf85a5f6 | ||
|
|
c2cbd76f49 | ||
|
|
3d874435c3 | ||
|
|
9ed8864f23 | ||
|
|
61263dd59d | ||
|
|
2707e135c6 | ||
|
|
f9de0d7937 | ||
|
|
f03d58d648 | ||
|
|
f49a3570e9 | ||
|
|
1d97f9008d |
No files matched your search
+6
-6
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1509
|
||||
versionName "0.15.9"
|
||||
versionCode 1511
|
||||
versionName "0.15.11"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -54,7 +54,7 @@ task printVersionName {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0-rc01'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.2.0-alpha06'
|
||||
implementation "androidx.cardview:cardview:1.0.0"
|
||||
@@ -64,7 +64,7 @@ dependencies {
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'androidx.webkit:webkit:1.3.0-alpha02'
|
||||
implementation 'androidx.webkit:webkit:1.3.0-alpha03'
|
||||
implementation 'androidx.camera:camera-core:1.0.0-beta03'
|
||||
implementation 'androidx.camera:camera-camera2:1.0.0-beta03'
|
||||
implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03'
|
||||
@@ -72,9 +72,9 @@ dependencies {
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||
implementation 'com.google.firebase:firebase-analytics:17.4.1'
|
||||
implementation 'com.google.firebase:firebase-analytics:17.4.2'
|
||||
implementation 'com.google.android.gms:play-services-base:17.2.1'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.1.7'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.2.0'
|
||||
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
|
||||
|
||||
@@ -746,13 +746,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
public void openPublishesOnSuccessfulPublish() {
|
||||
// close publish form
|
||||
try {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
onBackPressed();
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
try {
|
||||
onBackPressed();
|
||||
} catch (IllegalStateException iex) {
|
||||
// if this fails on some devices. what's the solution?
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void openPublishForm(Claim claim) {
|
||||
@@ -837,10 +846,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
listener.onEnterPIPMode();
|
||||
}
|
||||
|
||||
View pipPlayerContainer = findViewById(R.id.pip_player_container);
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.VISIBLE);
|
||||
pipPlayer.setPlayer(appPlayer);
|
||||
pipPlayer.setUseController(false);
|
||||
pipPlayerContainer.setVisibility(View.VISIBLE);
|
||||
playerReassigned = true;
|
||||
}
|
||||
private void renderFullMode() {
|
||||
@@ -871,9 +881,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
listener.onExitPIPMode();
|
||||
}
|
||||
|
||||
View pipPlayerContainer = findViewById(R.id.pip_player_container);
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.INVISIBLE);
|
||||
pipPlayer.setPlayer(null);
|
||||
pipPlayerContainer.setVisibility(View.INVISIBLE);
|
||||
playerReassigned = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
|
||||
vh.titleView.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
|
||||
String thumbnailUrl = claim.getThumbnailUrl();
|
||||
if (!Helper.isNullOrEmpty(thumbnailUrl) && context != null) {
|
||||
Glide.with(context.getApplicationContext()).asBitmap().load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
}
|
||||
vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE);
|
||||
vh.thumbnailView.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.GONE : View.VISIBLE);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
|
||||
vh.alphaView.setText(claim.getName().substring(1, 2));
|
||||
if (!Helper.isNullOrEmpty(thumbnailUrl)) {
|
||||
vh.thumbnailView.setVisibility(View.VISIBLE);
|
||||
Glide.with(context.getApplicationContext()).asBitmap().load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
} else {
|
||||
vh.thumbnailView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -192,14 +192,16 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||
private void loadChannels(List<Claim> channels) {
|
||||
if (channelSpinnerAdapter == null) {
|
||||
Context context = getContext();
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
if (context != null) {
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
channelSpinnerAdapter.clear();
|
||||
channelSpinnerAdapter.addAll(channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (channelSpinner != null) {
|
||||
if (channelSpinner != null && channelSpinnerAdapter != null) {
|
||||
channelSpinner.setAdapter(channelSpinnerAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Comment {
|
||||
public static final double COST = 0.25;
|
||||
public static final double LBC_COST = 2;
|
||||
public static final int MAX_LENGTH = 2000;
|
||||
|
||||
private Claim poster;
|
||||
|
||||
@@ -66,10 +66,15 @@ public class UpdateSuggestedTagsTask extends AsyncTask<Void, Void, List<Tag>> {
|
||||
if (excludeMature && knownTag.isMature()) {
|
||||
continue;
|
||||
}
|
||||
if ((knownTag.getLowercaseName().startsWith(filter) || knownTag.getLowercaseName().matches(filter)) &&
|
||||
(!tags.contains(knownTag) &&
|
||||
!Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))) {
|
||||
tags.add(knownTag);
|
||||
try {
|
||||
if ((knownTag.getLowercaseName().startsWith(filter) ||
|
||||
knownTag.getLowercaseName().matches(filter)) &&
|
||||
(!tags.contains(knownTag) && !Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))
|
||||
) {
|
||||
tags.add(knownTag);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,19 @@ import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private String claimId;
|
||||
private int page;
|
||||
private int pageSize;
|
||||
private ClaimSearchResultHandler handler;
|
||||
private View progressView;
|
||||
private Exception error;
|
||||
|
||||
public PurchaseListTask(String claimId, View progressView, ClaimSearchResultHandler handler) {
|
||||
this.claimId = claimId;
|
||||
this.progressView = progressView;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public PurchaseListTask(int page, int pageSize, View progressView, ClaimSearchResultHandler handler) {
|
||||
this.page = page;
|
||||
this.pageSize = pageSize;
|
||||
@@ -38,8 +45,15 @@ public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
List<Claim> claims = null;
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
options.put("page", page);
|
||||
options.put("page_size", pageSize);
|
||||
if (!Helper.isNullOrEmpty(claimId)) {
|
||||
options.put("claim_id", claimId);
|
||||
}
|
||||
if (page > 0) {
|
||||
options.put("page", page);
|
||||
}
|
||||
if (pageSize > 0) {
|
||||
options.put("page_size", pageSize);
|
||||
}
|
||||
options.put("resolve", true);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PURCHASE_LIST, options);
|
||||
@@ -47,9 +61,10 @@ public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
claims = new ArrayList<>();
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
Claim claim = Claim.fromJSONObject(items.getJSONObject(i).getJSONObject("claim"));
|
||||
claims.add(claim);
|
||||
|
||||
Lbry.addClaimToCache(claim);
|
||||
if (!Helper.isNullOrEmpty(claim.getClaimId())) {
|
||||
claims.add(claim);
|
||||
Lbry.addClaimToCache(claim);
|
||||
}
|
||||
}
|
||||
} catch (ApiCallException | JSONException | ClassCastException ex) {
|
||||
error = ex;
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -19,7 +18,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -352,7 +350,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||
}
|
||||
|
||||
private void initCommentForm(View root) {
|
||||
double amount = Comment.COST / Lbryio.LBCUSDRate;
|
||||
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));
|
||||
@@ -437,13 +435,17 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||
|
||||
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());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||
setTitle(R.string.post_comment).
|
||||
setTitle(titleText).
|
||||
setMessage(confirmText)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@@ -533,7 +535,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||
|
||||
Comment comment = buildPostComment();
|
||||
// only use 2 decimal places
|
||||
BigDecimal amount = new BigDecimal(new DecimalFormat(Helper.PLAIN_CURRENCY_FORMAT_PATTERN).format(tipAmount));
|
||||
BigDecimal amount = new BigDecimal(String.valueOf(tipAmount));
|
||||
|
||||
beforePostComment();
|
||||
CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() {
|
||||
@@ -553,6 +555,12 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||
afterPostComment();
|
||||
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);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(R.string.comment_posted);
|
||||
|
||||
@@ -426,7 +426,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
Glide.with(context.getApplicationContext()).load(coverUrl).centerCrop().into(imageCover);
|
||||
}
|
||||
if (context != null && !Helper.isNullOrEmpty(thumbnailUrl)) {
|
||||
Glide.with(context.getApplicationContext()).asBitmap().load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(imageThumbnail);
|
||||
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(imageThumbnail);
|
||||
noThumbnailView.setVisibility(View.GONE);
|
||||
} else {
|
||||
imageThumbnail.setVisibility(View.GONE);
|
||||
|
||||
@@ -131,6 +131,7 @@ import io.lbry.browser.tasks.claim.AbandonStreamTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimSearchResultHandler;
|
||||
import io.lbry.browser.tasks.claim.PurchaseListTask;
|
||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||
import io.lbry.browser.tasks.file.DeleteFileTask;
|
||||
import io.lbry.browser.tasks.file.FileListTask;
|
||||
@@ -342,6 +343,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
((MainActivity) context).onBackPressed();
|
||||
}
|
||||
|
||||
boolean invalidRepost = false;
|
||||
if (updateRequired) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).clearNowPlayingClaim();
|
||||
@@ -365,6 +367,20 @@ public class FileViewFragment extends BaseFragment implements
|
||||
onNewClaim(currentUrl);
|
||||
if (Lbry.claimCache.containsKey(key)) {
|
||||
claim = Lbry.claimCache.get(key);
|
||||
if (Claim.TYPE_REPOST.equalsIgnoreCase(claim.getValueType())) {
|
||||
claim = claim.getRepostedClaim();
|
||||
if (claim == null || Helper.isNullOrEmpty(claim.getClaimId())) {
|
||||
// Invalid repost, probably
|
||||
invalidRepost = true;
|
||||
renderNothingAtLocation();
|
||||
} else if (claim.getName().startsWith("@")) {
|
||||
// this is a reposted channel, so launch the channel url
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openChannelUrl(!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resolveUrl(currentUrl);
|
||||
}
|
||||
@@ -380,7 +396,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
Helper.saveUrlHistory(currentUrl, claim != null ? claim.getTitle() : null, UrlSuggestion.TYPE_FILE);
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
if (claim != null && !invalidRepost) {
|
||||
Helper.saveViewHistory(currentUrl, claim);
|
||||
checkAndLoadRelatedContent();
|
||||
checkAndLoadComments();
|
||||
@@ -1021,7 +1037,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
});
|
||||
|
||||
root.findViewById(R.id.file_view_publisher_name).setOnClickListener(new View.OnClickListener() {
|
||||
root.findViewById(R.id.file_view_publisher_info_area).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
@@ -1155,13 +1171,19 @@ public class FileViewFragment extends BaseFragment implements
|
||||
return;
|
||||
}
|
||||
|
||||
fileGetPending = true;
|
||||
MainActivity.requestPermission(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
MainActivity.REQUEST_STORAGE_PERMISSION,
|
||||
getString(R.string.storage_permission_rationale_download),
|
||||
context,
|
||||
true);
|
||||
try {
|
||||
if (context != null) {
|
||||
fileGetPending = true;
|
||||
MainActivity.requestPermission(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
MainActivity.REQUEST_STORAGE_PERMISSION,
|
||||
getString(R.string.storage_permission_rationale_download),
|
||||
context,
|
||||
true);
|
||||
}
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
} else {
|
||||
fileGet(true);
|
||||
}
|
||||
@@ -1282,6 +1304,8 @@ public class FileViewFragment extends BaseFragment implements
|
||||
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Context context = getContext();
|
||||
|
||||
root.findViewById(R.id.file_view_scroll_view).scrollTo(0, 0);
|
||||
Helper.setViewVisibility(layoutDisplayArea, View.VISIBLE);
|
||||
|
||||
@@ -1303,7 +1327,29 @@ public class FileViewFragment extends BaseFragment implements
|
||||
((TextView) root.findViewById(R.id.file_view_publisher_name)).setText(
|
||||
Helper.isNullOrEmpty(claim.getPublisherName()) ? getString(R.string.anonymous) : claim.getPublisherName());
|
||||
|
||||
Context context = getContext();
|
||||
Claim signingChannel = claim.getSigningChannel();
|
||||
boolean hasPublisher = signingChannel != null;
|
||||
boolean hasPublisherThumbnail = hasPublisher && !Helper.isNullOrEmpty(signingChannel.getThumbnailUrl());
|
||||
root.findViewById(R.id.file_view_publisher_avatar).setVisibility(hasPublisher ? View.VISIBLE : View.GONE);
|
||||
root.findViewById(R.id.file_view_publisher_thumbnail).setVisibility(hasPublisherThumbnail ? View.VISIBLE : View.INVISIBLE);
|
||||
root.findViewById(R.id.file_view_publisher_no_thumbnail).setVisibility(!hasPublisherThumbnail ? View.VISIBLE : View.INVISIBLE);
|
||||
if (hasPublisher) {
|
||||
int bgColor = Helper.generateRandomColorForValue(signingChannel.getClaimId());
|
||||
Helper.setIconViewBackgroundColor(root.findViewById(R.id.file_view_publisher_no_thumbnail), bgColor, false, context);
|
||||
if (hasPublisherThumbnail && context != null) {
|
||||
Glide.with(context.getApplicationContext()).load(signingChannel.getThumbnailUrl()).
|
||||
apply(RequestOptions.circleCropTransform()).into((ImageView) root.findViewById(R.id.file_view_publisher_thumbnail));
|
||||
}
|
||||
((TextView) root.findViewById(R.id.file_view_publisher_thumbnail_alpha)).
|
||||
setText(signingChannel.getName() != null ? signingChannel.getName().substring(1, 2).toUpperCase() : null);
|
||||
|
||||
}
|
||||
|
||||
String publisherTitle = signingChannel != null ? signingChannel.getTitle() : null;
|
||||
TextView textPublisherTitle = root.findViewById(R.id.file_view_publisher_title);
|
||||
textPublisherTitle.setVisibility(Helper.isNullOrEmpty(publisherTitle) ? View.GONE : View.VISIBLE);
|
||||
textPublisherTitle.setText(publisherTitle);
|
||||
|
||||
RecyclerView descTagsList = root.findViewById(R.id.file_view_tag_list);
|
||||
FlexboxLayoutManager flm = new FlexboxLayoutManager(context);
|
||||
descTagsList.setLayoutManager(flm);
|
||||
@@ -1609,29 +1655,65 @@ public class FileViewFragment extends BaseFragment implements
|
||||
// Check if the claim is free
|
||||
Claim.GenericMetadata metadata = claim.getValue();
|
||||
if (metadata instanceof Claim.StreamMetadata) {
|
||||
Claim.StreamMetadata streamMetadata = (Claim.StreamMetadata) metadata;
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.findViewById(R.id.file_view_main_action_button).setVisibility(View.INVISIBLE);
|
||||
root.findViewById(R.id.file_view_main_action_loading).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (claim.getFile() == null && !claim.isFree()) {
|
||||
// TODO: also check ownership from purchase_list
|
||||
// not free (and the user does not own the claim yet), perform a purchase
|
||||
confirmPurchaseUrl();
|
||||
} else {
|
||||
if (!claim.isPlayable() && !Lbry.SDK_READY) {
|
||||
if (!Lbry.SDK_READY) {
|
||||
Snackbar.make(getView().findViewById(R.id.file_view_global_layout), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.findViewById(R.id.file_view_main_action_button).setVisibility(View.INVISIBLE);
|
||||
root.findViewById(R.id.file_view_main_action_loading).setVisibility(View.VISIBLE);
|
||||
handleMainActionForClaim();
|
||||
checkAndConfirmPurchaseUrl();
|
||||
} else {
|
||||
if (!claim.isPlayable() && !Lbry.SDK_READY) {
|
||||
Snackbar.make(getView().findViewById(R.id.file_view_global_layout), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
handleMainActionForClaim();
|
||||
}
|
||||
} else {
|
||||
showError(getString(R.string.cannot_view_claim));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndConfirmPurchaseUrl() {
|
||||
if (claim != null) {
|
||||
PurchaseListTask task = new PurchaseListTask(claim.getClaimId(), null, new ClaimSearchResultHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
|
||||
boolean purchased = false;
|
||||
if (claims.size() == 1) {
|
||||
Claim purchasedClaim = claims.get(0);
|
||||
if (claim.getClaimId().equalsIgnoreCase(purchasedClaim.getClaimId())) {
|
||||
// already purchased
|
||||
purchased = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (purchased) {
|
||||
handleMainActionForClaim();
|
||||
} else {
|
||||
restoreMainActionButton();
|
||||
confirmPurchaseUrl();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
// pass
|
||||
restoreMainActionButton();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
private void confirmPurchaseUrl() {
|
||||
if (claim != null) {
|
||||
Fee fee = ((Claim.StreamMetadata) claim.getValue()).getFee();
|
||||
@@ -2030,6 +2112,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
|
||||
private void resolveCommentPosters() {
|
||||
if (commentListAdapter != null) {
|
||||
long st = System.currentTimeMillis();;
|
||||
List<String> urlsToResolve = new ArrayList<>(commentListAdapter.getClaimUrlsToResolve());
|
||||
if (urlsToResolve.size() > 0) {
|
||||
ResolveTask task = new ResolveTask(urlsToResolve, Lbry.SDK_CONNECTION_STRING, null, new ClaimListResultHandler() {
|
||||
@@ -2671,7 +2754,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
private void initCommentForm(View root) {
|
||||
double amount = Comment.COST / Lbryio.LBCUSDRate;
|
||||
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));
|
||||
@@ -2756,13 +2839,17 @@ public class FileViewFragment extends BaseFragment implements
|
||||
|
||||
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());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||
setTitle(R.string.post_comment).
|
||||
setTitle(titleText).
|
||||
setMessage(confirmText)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@@ -2852,7 +2939,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
|
||||
Comment comment = buildPostComment();
|
||||
// only use 2 decimal places
|
||||
BigDecimal amount = new BigDecimal(new DecimalFormat(Helper.PLAIN_CURRENCY_FORMAT_PATTERN).format(tipAmount));
|
||||
BigDecimal amount = new BigDecimal(String.valueOf(tipAmount));
|
||||
|
||||
beforePostComment();
|
||||
CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() {
|
||||
@@ -2872,6 +2959,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||
afterPostComment();
|
||||
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);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(R.string.comment_posted);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class PublishFragment extends BaseFragment implements
|
||||
preview.setSurfaceProvider(cameraPreview.createSurfaceProvider(camera.getCameraInfo()));
|
||||
cameraPreviewInitialized = true;
|
||||
}
|
||||
} catch (ExecutionException | InterruptedException ex) {
|
||||
} catch (ExecutionException | IllegalArgumentException | InterruptedException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
@@ -103,16 +103,20 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
||||
TransactionListTask task = new TransactionListTask(currentTransactionPage, TRANSACTION_PAGE_LIMIT, loading, new TransactionListTask.TransactionListHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
|
||||
Context context = getContext();
|
||||
|
||||
transactionsLoading = false;
|
||||
transactionsHaveReachedEnd = hasReachedEnd;
|
||||
if (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, getContext());
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
if (context != null) {
|
||||
if (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, context);
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
}
|
||||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
checkNoTransactions();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public class LbryAnalytics {
|
||||
|
||||
public static final String EVENT_APP_ERROR = "app_error";
|
||||
public static final String EVENT_APP_LAUNCH = "app_launch";
|
||||
public static final String EVENT_COMMENT_CREATE = "comment_create";
|
||||
public static final String EVENT_EMAIL_ADDED = "email_added";
|
||||
public static final String EVENT_EMAIL_VERIFIED = "email_verified";
|
||||
public static final String EVENT_FIRST_RUN_COMPLETED = "first_run_completed";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/post_as"
|
||||
android:text="@string/comment_as"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300" />
|
||||
|
||||
@@ -128,12 +128,18 @@
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/pip_player"
|
||||
<RelativeLayout
|
||||
android:id="@+id/pip_player_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/black"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="invisible" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/pip_player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -468,41 +468,89 @@
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_name_area"
|
||||
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:clickable="true"
|
||||
android:orientation="vertical">
|
||||
android:paddingTop="12dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:layout_toLeftOf="@id/file_view_icon_follow_unfollow">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="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">
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_thumbnail_alpha"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:textFontWeight="300" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:layout_centerHorizontal="true"
|
||||
android:id="@+id/file_view_publisher_thumbnail"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_name"
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_name_area"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textFontWeight="600"
|
||||
android:textSize="14sp" />
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textFontWeight="600"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_follow_unfollow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
@@ -511,7 +559,6 @@
|
||||
<View
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/gerbil_happy" />
|
||||
<TextView
|
||||
android:text="@string/no_channel_created"
|
||||
android:text="@string/no_publishes_created"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
|
||||
@@ -82,14 +82,17 @@
|
||||
<string name="content_deleted">The content was successfully deleted from the blockchain.</string>
|
||||
<string name="content_failed_delete">The content could not be deleted at this time. Please try again later.</string>
|
||||
<string name="comment">Comment</string>
|
||||
<string name="post_as">Post as</string>
|
||||
<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="post_comment">Post comment with tip?</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>
|
||||
<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>
|
||||
@@ -118,6 +121,7 @@
|
||||
</plurals>
|
||||
|
||||
<!-- Publish -->
|
||||
<string name="no_publishes_created">It looks like you have not published content to LBRY yet.</string>
|
||||
<string name="record">Record</string>
|
||||
<string name="take_photo">Take a Photo</string>
|
||||
<string name="upload_file">Upload a file</string>
|
||||
|
||||
Reference in new issue
Block a user