Compare commits

...
6 Commits
15 changed files with 165 additions and 58 deletions

No files matched your search

+6 -6
View File
@@ -16,8 +16,8 @@ android {
applicationId "io.lbry.browser"
minSdkVersion 21
targetSdkVersion 29
versionCode 1510
versionName "0.15.10"
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) {
@@ -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
}
}
}
@@ -350,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));
@@ -435,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
@@ -531,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() {
@@ -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);
@@ -1037,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) {
@@ -1171,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);
}
@@ -1298,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);
@@ -1319,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);
@@ -2082,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() {
@@ -2723,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));
@@ -2808,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
@@ -2904,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() {
@@ -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;
+63 -16
View File
@@ -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"
+5 -1
View File
@@ -85,11 +85,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="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>