From c8c63057573f1a268edd31d8bb3511cd9773811e Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Tue, 22 Dec 2020 02:26:37 +0100 Subject: [PATCH 1/8] Avoid showing vertical scroll bar on stage error listview --- .../java/io/lbry/browser/MainActivity.java | 18 ++++++++++++++++++ app/src/main/res/layout/app_bar_main.xml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java index 39ec4a90..11d93373 100644 --- a/app/src/main/java/io/lbry/browser/MainActivity.java +++ b/app/src/main/java/io/lbry/browser/MainActivity.java @@ -40,6 +40,7 @@ import android.view.KeyEvent; import android.view.MenuItem; import android.view.View; import android.view.Menu; +import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; @@ -2750,6 +2751,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages); listView.setAdapter(adapter); + // Add 1 pixel to listview height + int listHeight = Math.round(getResources().getDisplayMetrics().density); + + for (int i = 0; i < startupStages.size(); i++) { + View item = adapter.getView(i, null, listView); + item.measure(0, 0); + listHeight += item.getMeasuredHeight(); + } + + // Properly set listview height by adding all seven items and the divider heights + // and the additional 1 pixel so no vertical scroll bar is shown + ViewGroup.LayoutParams params = listView.getLayoutParams(); + params.height = listHeight + (listView.getCount() + 1) * listView.getDividerHeight(); + listView.setLayoutParams(params); + listView.invalidate(); + listView.requestLayout(); + findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE); findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE); } diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index a27be78f..2122929b 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -159,7 +159,7 @@ Date: Sun, 27 Dec 2020 03:54:36 -0500 Subject: [PATCH 2/8] Changed wallet send notification to accept 4 digit decimal --- app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java index c22a4109..69ff7690 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java @@ -463,7 +463,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W double sentAmount = actualSendAmount; String message = getResources().getQuantityString( R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2, - new DecimalFormat("#,###.##").format(sentAmount)); + new DecimalFormat("#,###.####").format(sentAmount)); Helper.setViewText(inputSendAddress, null); Helper.setViewText(inputSendAmount, null); if (view != null) { From b1e0b9af33bbb12e35e3545ebee1b3c460fc1264 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 29 Dec 2020 06:45:29 +0100 Subject: [PATCH 3/8] sdk 0.87.0. Show confirmation for unfollow. --- app/build.gradle | 4 +- .../java/io/lbry/browser/MainActivity.java | 11 +++ .../browser/ui/channel/ChannelFragment.java | 78 +++++++++++------- .../ui/findcontent/FileViewFragment.java | 80 ++++++++++++------- app/src/main/res/values/strings.xml | 2 + 5 files changed, 114 insertions(+), 61 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 628b0cc6..d5ad5f52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -131,8 +131,8 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - __32bitImplementation 'io.lbry:lbrysdk32:0.86.1' - __64bitImplementation 'io.lbry:lbrysdk64:0.86.1' + __32bitImplementation 'io.lbry:lbrysdk32:0.87.0' + __64bitImplementation 'io.lbry:lbrysdk64:0.87.0' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java index 991ce942..2c060485 100644 --- a/app/src/main/java/io/lbry/browser/MainActivity.java +++ b/app/src/main/java/io/lbry/browser/MainActivity.java @@ -3091,6 +3091,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener String action = intent.getAction(); if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) { MainActivity.this.receivedStopService = true; + + // STOP is meant to close everything, + // So destroy the player at this point (even with background play enabled) + if (appPlayer != null) { + playerNotificationManager.setPlayer(null); + stopExoplayer(); + nowPlayingClaim = null; + nowPlayingClaimUrl = null; + nowPlayingClaimBitmap = null; + } + MainActivity.this.finish(); } else if (LbrynetService.LBRY_SDK_SERVICE_STARTED.equals(action)) { // Rebuild the service notification diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java index 75750775..f7bb34e3 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java @@ -252,37 +252,22 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen return; } - subscribing = true; boolean isFollowing = Lbryio.isFollowing(claim); - Subscription subscription = Subscription.fromClaim(claim); - view.setEnabled(false); - new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() { - @Override - public void onSuccess() { - if (isFollowing) { - Lbryio.removeSubscription(subscription); - Lbryio.removeCachedResolvedSubscription(claim); - } else { - Lbryio.addSubscription(subscription); - Lbryio.addCachedResolvedSubscription(claim); - } - buttonFollowUnfollow.setEnabled(true); - subscribing = false; - checkIsFollowing(); - FollowingFragment.resetClaimSearchContent = true; - - Context context = getContext(); - if (context != null) { - context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE)); - } - } - - @Override - public void onError(Exception exception) { - buttonFollowUnfollow.setEnabled(true); - subscribing = false; - } - }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + if (isFollowing) { + Context context = getContext(); + AlertDialog.Builder builder = new AlertDialog.Builder(context). + setTitle(R.string.confirm_unfollow). + setMessage(R.string.confirm_unfollow_message) + .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + doFollowUnfollow(isFollowing, view); + } + }).setNegativeButton(R.string.no, null); + builder.show(); + } else { + doFollowUnfollow(isFollowing, view); + } } } }); @@ -290,6 +275,39 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen return root; } + private void doFollowUnfollow(boolean isFollowing, View view) { + subscribing = true; + Subscription subscription = Subscription.fromClaim(claim); + view.setEnabled(false); + new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() { + @Override + public void onSuccess() { + if (isFollowing) { + Lbryio.removeSubscription(subscription); + Lbryio.removeCachedResolvedSubscription(claim); + } else { + Lbryio.addSubscription(subscription); + Lbryio.addCachedResolvedSubscription(claim); + } + buttonFollowUnfollow.setEnabled(true); + subscribing = false; + checkIsFollowing(); + FollowingFragment.resetClaimSearchContent = true; + + Context context = getContext(); + if (context != null) { + context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE)); + } + } + + @Override + public void onError(Exception exception) { + buttonFollowUnfollow.setEnabled(true); + subscribing = false; + } + }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + private void deleteCurrentClaim() { if (claim != null) { Helper.setViewVisibility(layoutDisplayArea, View.GONE); diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java index 805c21f1..3c52114b 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java @@ -824,42 +824,64 @@ public class FileViewFragment extends BaseFragment implements private View.OnClickListener followUnfollowListener = new View.OnClickListener() { @Override - public void onClick(View view) { + public void onClick(final View view) { if (claim != null && claim.getSigningChannel() != null) { Claim publisher = claim.getSigningChannel(); boolean isFollowing = Lbryio.isFollowing(publisher); - Subscription subscription = Subscription.fromClaim(publisher); - view.setEnabled(false); - Context context = getContext(); - new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() { - @Override - public void onSuccess() { - if (isFollowing) { - Lbryio.removeSubscription(subscription); - Lbryio.removeCachedResolvedSubscription(publisher); - } else { - Lbryio.addSubscription(subscription); - Lbryio.addCachedResolvedSubscription(publisher); - } - view.setEnabled(true); - checkIsFollowing(); - FollowingFragment.resetClaimSearchContent = true; - - // Save shared user state - if (context != null) { - context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE)); - } - } - - @Override - public void onError(Exception exception) { - view.setEnabled(true); - } - }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + if (isFollowing) { + // show unfollow confirmation + Context context = getContext(); + AlertDialog.Builder builder = new AlertDialog.Builder(context). + setTitle(R.string.confirm_unfollow). + setMessage(R.string.confirm_unfollow_message) + .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + doFollowUnfollow(isFollowing, view); + } + }).setNegativeButton(R.string.no, null); + builder.show(); + } else { + doFollowUnfollow(isFollowing, view); + } } } }; + private void doFollowUnfollow(boolean isFollowing, View view) { + if (claim != null && claim.getSigningChannel() != null) { + Claim publisher = claim.getSigningChannel(); + Subscription subscription = Subscription.fromClaim(publisher); + view.setEnabled(false); + Context context = getContext(); + new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() { + @Override + public void onSuccess() { + if (isFollowing) { + Lbryio.removeSubscription(subscription); + Lbryio.removeCachedResolvedSubscription(publisher); + } else { + Lbryio.addSubscription(subscription); + Lbryio.addCachedResolvedSubscription(publisher); + } + view.setEnabled(true); + checkIsFollowing(); + FollowingFragment.resetClaimSearchContent = true; + + // Save shared user state + if (context != null) { + context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE)); + } + } + + @Override + public void onError(Exception exception) { + view.setEnabled(true); + } + }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + } + private void resolveUrl(String url) { resolving = true; Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fba9edfa..c900a781 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -111,6 +111,8 @@ reposted You will receive all notifications You will not receive notifications for this channel + Stop following channel? + Are you sure you want to stop following this channel? %1$s follower %1$s followers From ebf3299c30d2562521150eb730daf4d28aae5d64 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 29 Dec 2020 07:00:45 +0100 Subject: [PATCH 4/8] add scrollbars attribute to listview --- app/src/main/res/layout/app_bar_main.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 70891455..3b46df68 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -163,6 +163,7 @@ android:layout_marginTop="12dp" android:divider="@android:color/transparent" android:dividerHeight="8dp" + android:scrollbars="none" tools:listitem="@layout/list_item_startupstage"> From 136853853aa58c18fed15944ce90cd2594b96d5f Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 29 Dec 2020 07:02:13 +0100 Subject: [PATCH 5/8] bumpversion 0.16.11 --> 0.16.12 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d5ad5f52..f3fca2fe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "io.lbry.browser" minSdkVersion 21 targetSdkVersion 29 - versionCode 1611 - versionName "0.16.11" + versionCode 1612 + versionName "0.16.12" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } From 99a4a0a22f7537e90b461df95094528227a906a2 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 29 Dec 2020 07:07:53 +0100 Subject: [PATCH 6/8] Remove comment post confirmation. Fix resources build error. --- .../ui/channel/ChannelCommentsFragment.java | 16 +--------------- .../browser/ui/findcontent/FileViewFragment.java | 16 +--------------- app/src/main/res/values/strings.xml | 6 ++++-- 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java index ce6dc6c3..c32d0f05 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelCommentsFragment.java @@ -441,21 +441,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen return; } - Context context = getContext(); - if (context != null) { - 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(); - } - }).setNegativeButton(R.string.no, null); - builder.show(); - } + postComment(); } private void updatePostAsChannel(Claim channel) { diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java index 3c52114b..a586e748 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java @@ -3086,21 +3086,7 @@ public class FileViewFragment extends BaseFragment implements return; } - Context context = getContext(); - if (context != null) { - 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(); - } - }).setNegativeButton(R.string.no, null); - builder.show(); - } + postComment(); } private void updatePostAsChannel(Claim channel) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c900a781..1d64448f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -88,8 +88,6 @@ Please enter a comment to post. Please select a channel to post your comment as. Post - Confirm your comment - This will post your comment Your comment was successfully posted. Please select a channel to repost on. Reply @@ -103,6 +101,10 @@ This will purchase "%1$s" for %2$s credit This will purchase "%1$s" for %2$s credits + + This will post your comment with a tip of %1$s credit for %2$s + This will post your comment with a tip of %1$s credits for %2$s + There\'s nothing here yet.\nPlease check back later. From ef80c9f7fd2f8eb29c1184de5024411278e8df5e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 29 Dec 2020 07:13:57 +0100 Subject: [PATCH 7/8] fix resource build error --- app/src/main/res/values/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1d64448f..1dd72f04 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,6 +101,10 @@ This will purchase "%1$s" for %2$s credit This will purchase "%1$s" for %2$s credits + + Post for %1$s credit + Post for %1$s credits + This will post your comment with a tip of %1$s credit for %2$s This will post your comment with a tip of %1$s credits for %2$s From fb560f8f01b66022f008b15457eb9a8c8483c350 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 29 Dec 2020 07:20:46 +0100 Subject: [PATCH 8/8] fix last resource build error --- app/src/main/res/values/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1dd72f04..e4f90698 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,6 +101,10 @@ This will purchase "%1$s" for %2$s credit This will purchase "%1$s" for %2$s credits + + Post and tip %1$s credit? + Post and tip %1$s credits? + Post for %1$s credit Post for %1$s credits