From 493c771e94c5374c5175e38c6336d9fa2bbeecae Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 8 Mar 2021 19:52:15 +0100 Subject: [PATCH 1/7] sdk 0.91.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 80d62b5e..94be895b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -133,8 +133,8 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - __32bitImplementation 'io.lbry:lbrysdk32:0.88.0' - __64bitImplementation 'io.lbry:lbrysdk64:0.88.0' + __32bitImplementation 'io.lbry:lbrysdk32:0.91.0' + __64bitImplementation 'io.lbry:lbrysdk64:0.91.0' } apply plugin: 'com.google.gms.google-services' -- 2.45.2 From 36c105d3a7d9e45df0143494206536d0bddf6d81 Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Mon, 1 Mar 2021 21:47:54 +0100 Subject: [PATCH 2/7] Enable phone verification Show the Close button after phone number has been verified --- .../io/lbry/browser/VerificationActivity.java | 47 +++++++++++-------- .../ManualVerificationFragment.java | 8 ++++ .../layout/fragment_verification_manual.xml | 27 +++++++++++ app/src/main/res/values/strings.xml | 3 ++ 4 files changed, 66 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/VerificationActivity.java b/app/src/main/java/io/lbry/browser/VerificationActivity.java index 8b08e91f..78e2000a 100644 --- a/app/src/main/java/io/lbry/browser/VerificationActivity.java +++ b/app/src/main/java/io/lbry/browser/VerificationActivity.java @@ -204,15 +204,16 @@ public class VerificationActivity extends FragmentActivity implements SignInList } else if (flow == VERIFICATION_FLOW_REWARDS) { User user = Lbryio.currentUser; // disable phone verification for now - /*if (!user.isIdentityVerified()) { + if (!user.isIdentityVerified()) { // phone number verification required viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false); flowHandled = true; - } else */ - if (!user.isRewardApproved()) { - // manual verification required - viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); - flowHandled = true; + } else { + if (!user.isRewardApproved()) { + // manual verification required + viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); + flowHandled = true; + } } } @@ -225,6 +226,11 @@ public class VerificationActivity extends FragmentActivity implements SignInList } } + public void showPhoneVerification() { + ViewPager2 viewPager = findViewById(R.id.verification_pager); + viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false); + } + public void showLoading() { findViewById(R.id.verification_loading_progress).setVisibility(View.VISIBLE); findViewById(R.id.verification_pager).setVisibility(View.INVISIBLE); @@ -238,8 +244,12 @@ public class VerificationActivity extends FragmentActivity implements SignInList @Override public void onBackPressed() { - // ignore back press - return; + ViewPager2 viewPager = findViewById(R.id.verification_pager); + + if (viewPager.getCurrentItem() != VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL) + viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL); + else + super.onBackPressed(); } public void onEmailAdded(String email) { @@ -296,20 +306,18 @@ public class VerificationActivity extends FragmentActivity implements SignInList ViewPager2 viewPager = findViewById(R.id.verification_pager); // for rewards, (show phone verification if not done, or manual verification if required) if (flow == VERIFICATION_FLOW_REWARDS) { - // skipping phone verification - /*if (!user.isIdentityVerified()) { + if (!user.isIdentityVerified()) { // phone number verification required viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false); - } else - */ - if (!user.isRewardApproved()) { - - // manual verification required - viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); } else { - // fully verified - setResult(RESULT_OK); - finish(); + if (!user.isRewardApproved()) { + // manual verification required + viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); + } else { + // fully verified + setResult(RESULT_OK); + finish(); + } } } else if (flow == VERIFICATION_FLOW_WALLET) { // for wallet sync, if password unlock is required, show password entry page @@ -347,6 +355,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList return; } + findViewById(R.id.verification_close_button).setVisibility(View.VISIBLE); // show manual verification page if the user is still not reward approved ViewPager2 viewPager = findViewById(R.id.verification_pager); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); diff --git a/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java b/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java index 3dd421ff..cd9a17ca 100644 --- a/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java @@ -21,6 +21,7 @@ import com.google.android.material.snackbar.Snackbar; import io.lbry.browser.MainActivity; import io.lbry.browser.R; +import io.lbry.browser.VerificationActivity; import io.lbry.browser.listener.SignInListener; import io.lbry.browser.model.TwitterOauth; import io.lbry.browser.model.lbryinc.RewardVerified; @@ -98,6 +99,13 @@ public class ManualVerificationFragment extends Fragment { } }); + root.findViewById(R.id.verification_manual_phone_number_button).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ((VerificationActivity) getContext()).showPhoneVerification(); + } + }); + root.findViewById(R.id.verification_manual_continue_button).setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/res/layout/fragment_verification_manual.xml b/app/src/main/res/layout/fragment_verification_manual.xml index 211a8c38..8817f06f 100644 --- a/app/src/main/res/layout/fragment_verification_manual.xml +++ b/app/src/main/res/layout/fragment_verification_manual.xml @@ -68,6 +68,33 @@ android:fontFamily="@font/inter" android:text="@string/twitter_verify" /> + + + + + Twitter Verification Get instantly verified using your Twitter account. Your Twitter email address must match the email that you provided and your account should be active. Verify with Twitter + Phone Number Verification + Get instantly verified using your phone number. + Verify with phone number Skip the Queue Skip the manual verification queue by paying a fee in order to start participating in the rewards program immediately. If you previously completed a purchase successfully and you still see this screen, please tap the verify purchase button below. -- 2.45.2 From 911ca998e7de769ba9ce5644cd118dbd40cc9494 Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Tue, 2 Mar 2021 17:49:44 +0100 Subject: [PATCH 3/7] Use total wallet balance instead of spendable --- .../browser/adapter/WalletDetailAdapter.java | 100 ++++++ .../lbry/browser/model/WalletDetailItem.java | 17 + .../browser/ui/wallet/WalletFragment.java | 174 +++++---- .../java/io/lbry/browser/utils/Helper.java | 1 + .../browser/views/CreditsBalanceView.java | 69 ++++ .../main/res/layout/card_wallet_balance.xml | 336 ++++++------------ .../res/layout/list_item_boosting_balance.xml | 68 ++++ app/src/main/res/values-af/strings.xml | 7 - app/src/main/res/values-ca/strings.xml | 7 - app/src/main/res/values-de/strings.xml | 7 - app/src/main/res/values-es/strings.xml | 7 - app/src/main/res/values-et/strings.xml | 7 - app/src/main/res/values-fr/strings.xml | 7 - app/src/main/res/values-gu/strings.xml | 7 - app/src/main/res/values-he/strings.xml | 7 - app/src/main/res/values-hi/strings.xml | 7 - app/src/main/res/values-id/strings.xml | 7 - app/src/main/res/values-it/strings.xml | 7 - app/src/main/res/values-jv/strings.xml | 7 - app/src/main/res/values-ms/strings.xml | 7 - app/src/main/res/values-nl/strings.xml | 7 - app/src/main/res/values-pl/strings.xml | 7 - app/src/main/res/values-pt-rBR/strings.xml | 7 - app/src/main/res/values-pt/strings.xml | 7 - app/src/main/res/values-ro/strings.xml | 7 - app/src/main/res/values-ru/strings.xml | 7 - app/src/main/res/values-sr/strings.xml | 7 - app/src/main/res/values-tr/strings.xml | 7 - app/src/main/res/values-uk/strings.xml | 7 - app/src/main/res/values-vi/strings.xml | 7 - app/src/main/res/values-zh-rTW/strings.xml | 7 - app/src/main/res/values/attrs.xml | 8 + app/src/main/res/values/dimens.xml | 3 + app/src/main/res/values/strings.xml | 18 +- 34 files changed, 494 insertions(+), 468 deletions(-) create mode 100644 app/src/main/java/io/lbry/browser/adapter/WalletDetailAdapter.java create mode 100644 app/src/main/java/io/lbry/browser/model/WalletDetailItem.java create mode 100644 app/src/main/java/io/lbry/browser/views/CreditsBalanceView.java create mode 100644 app/src/main/res/layout/list_item_boosting_balance.xml create mode 100644 app/src/main/res/values/attrs.xml diff --git a/app/src/main/java/io/lbry/browser/adapter/WalletDetailAdapter.java b/app/src/main/java/io/lbry/browser/adapter/WalletDetailAdapter.java new file mode 100644 index 00000000..0622d4a1 --- /dev/null +++ b/app/src/main/java/io/lbry/browser/adapter/WalletDetailAdapter.java @@ -0,0 +1,100 @@ +package io.lbry.browser.adapter; + +import android.content.Context; +import android.content.DialogInterface; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageButton; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.appcompat.app.AlertDialog; + +import java.util.List; + +import io.lbry.browser.MainActivity; +import io.lbry.browser.R; +import io.lbry.browser.model.WalletDetailItem; +import io.lbry.browser.utils.Helper; +import io.lbry.browser.views.CreditsBalanceView; + +public class WalletDetailAdapter extends BaseAdapter { + private final List list; + private final LayoutInflater inflater; + + public WalletDetailAdapter(Context ctx, List rows) { + this.list = rows; + this.inflater = LayoutInflater.from(ctx); + } + @Override + public int getCount() { + return list.size(); + } + + @Override + public Object getItem(int i) { + return list.get(i); + } + + @Override + public long getItemId(int i) { + return i; + } + + @Override + public View getView(int i, View view, ViewGroup viewGroup) { + if (view == null) { + view = inflater.inflate(R.layout.list_item_boosting_balance, viewGroup, false); + + CreditsBalanceView balanceView = view.findViewById(R.id.wallet_supporting_balance); + TextView detailTextView = view.findViewById(R.id.detail); + TextView detailExplanationTextView = view.findViewById(R.id.detail_explanation); + + WalletDetailItem item = (WalletDetailItem) getItem(i); + + detailTextView.setText(item.detail); + detailExplanationTextView.setText(item.detailDesc); + + Helper.setViewText(balanceView, item.detailAmount); + + ProgressBar progressUnlockTips = view.findViewById(R.id.wallet_unlock_tips_progress); + progressUnlockTips.setVisibility(item.isInProgress ? View.VISIBLE : View.GONE); + + ImageButton buttonLock = view.findViewById(R.id.lock_button); + buttonLock.setVisibility((item.isUnlockable && !item.isInProgress) ? View.VISIBLE : View.GONE); + + if (item.isUnlockable) { + buttonLock.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (view.getContext() != null) { + AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()). + setTitle(R.string.unlock_tips). + setMessage(R.string.confirm_unlock_tips) + .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + unlockTips(view); + } + }).setNegativeButton(R.string.no, null); + builder.show(); + } + } + }); + } + } + return view; + } + + private void unlockTips(View v) { + Context ctx = v.getContext(); + if (ctx instanceof MainActivity) { + v.setVisibility(View.GONE); + View progress = v.getRootView().findViewById(R.id.wallet_unlock_tips_progress); + progress.setVisibility(View.VISIBLE); + ((MainActivity) ctx).unlockTips(); + } + } +} diff --git a/app/src/main/java/io/lbry/browser/model/WalletDetailItem.java b/app/src/main/java/io/lbry/browser/model/WalletDetailItem.java new file mode 100644 index 00000000..571f092a --- /dev/null +++ b/app/src/main/java/io/lbry/browser/model/WalletDetailItem.java @@ -0,0 +1,17 @@ +package io.lbry.browser.model; + +public class WalletDetailItem { + public String detail; + public String detailDesc; + public String detailAmount; + public boolean isUnlockable; + public boolean isInProgress; + + public WalletDetailItem(String detail, String detailDesc, String detailAmount, boolean isUnlockable, boolean isInProgress) { + this.detail = detail; + this.detailDesc = detailDesc; + this.detailAmount = detailAmount; + this.isUnlockable = isUnlockable; + this.isInProgress = isInProgress; + } +} 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 69ff7690..bf89bae9 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 @@ -3,12 +3,12 @@ package io.lbry.browser.ui.wallet; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; -import android.content.DialogInterface; import android.content.SharedPreferences; import android.graphics.Color; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; +import android.transition.TransitionManager; import android.util.Base64; import android.view.GestureDetector; import android.view.LayoutInflater; @@ -16,11 +16,11 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; +import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; import androidx.browser.customtabs.CustomTabsIntent; import androidx.core.content.ContextCompat; import androidx.preference.PreferenceManager; @@ -41,6 +41,7 @@ import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; +import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -50,21 +51,23 @@ import javax.crypto.spec.SecretKeySpec; import io.lbry.browser.MainActivity; import io.lbry.browser.R; import io.lbry.browser.adapter.TransactionListAdapter; +import io.lbry.browser.adapter.WalletDetailAdapter; import io.lbry.browser.listener.SdkStatusListener; import io.lbry.browser.listener.WalletBalanceListener; import io.lbry.browser.model.NavMenuItem; import io.lbry.browser.model.Transaction; import io.lbry.browser.model.WalletBalance; +import io.lbry.browser.model.WalletDetailItem; import io.lbry.browser.tasks.wallet.TransactionListTask; import io.lbry.browser.tasks.wallet.WalletAddressUnusedTask; import io.lbry.browser.tasks.wallet.WalletSendTask; import io.lbry.browser.ui.BaseFragment; -import io.lbry.browser.ui.publish.PublishFragment; 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 io.lbry.browser.views.CreditsBalanceView; public class WalletFragment extends BaseFragment implements SdkStatusListener, WalletBalanceListener { @@ -75,16 +78,17 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W private View layoutAccountRecommended; private View layoutSdkInitializing; private View linkSkipAccount; - private TextView textWalletBalance; + private CreditsBalanceView walletTotalBalanceView; + private CreditsBalanceView walletSpendableBalanceView; + private CreditsBalanceView walletSupportingBalanceView; private TextView textWalletBalanceUSD; - private TextView textTipsBalance; - private TextView textTipsBalanceUSD; - private TextView textClaimsBalance; - private TextView textSupportsBalance; - private ProgressBar walletSendProgress; + private TextView textWalletBalanceDesc; + private TextView buttonViewMore; + private ListView detailListView; + List detailRows; + private WalletDetailAdapter detailAdapter; - private TextView linkUnlockTips; - private ProgressBar progressUnlockTips; + private ProgressBar walletSendProgress; private View loadingRecentContainer; private View inlineBalanceContainer; @@ -95,7 +99,6 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W private View linkViewAll; private TextView textConvertCredits; private TextView textConvertCreditsBittrex; - private TextView textEarnMoreTips; private TextView textWhatSyncMeans; private TextView textWalletReceiveAddress; private TextView textWalletHintSyncStatus; @@ -127,16 +130,14 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W textWalletInlineBalance = root.findViewById(R.id.wallet_inline_balance_value); walletSendProgress = root.findViewById(R.id.wallet_send_progress); - textWalletBalance = root.findViewById(R.id.wallet_balance_value); + walletTotalBalanceView = root.findViewById(R.id.wallet_total_balance); + walletSpendableBalanceView = root.findViewById(R.id.wallet_spendable_balance); + walletSupportingBalanceView = root.findViewById(R.id.wallet_supporting_balance); textWalletBalanceUSD = root.findViewById(R.id.wallet_balance_usd_value); - textTipsBalance = root.findViewById(R.id.wallet_balance_tips); - textTipsBalanceUSD = root.findViewById(R.id.wallet_balance_tips_usd_value); - textClaimsBalance = root.findViewById(R.id.wallet_balance_staked_publishes); - textSupportsBalance = root.findViewById(R.id.wallet_balance_staked_supports); + textWalletBalanceDesc = root.findViewById(R.id.total_balance_desc); textWalletHintSyncStatus = root.findViewById(R.id.wallet_hint_sync_status); - - linkUnlockTips = root.findViewById(R.id.wallet_unlock_tips_link); - progressUnlockTips = root.findViewById(R.id.wallet_unlock_tips_progress); + buttonViewMore = root.findViewById(R.id.view_more_button); + detailListView = root.findViewById(R.id.balance_detail_listview); recentTransactionsList = root.findViewById(R.id.wallet_recent_transactions_list); linkViewAll = root.findViewById(R.id.wallet_link_view_all); @@ -144,7 +145,6 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W buttonBuyLBC = root.findViewById(R.id.wallet_buy_lbc_button); textConvertCredits = root.findViewById(R.id.wallet_hint_convert_credits); textConvertCreditsBittrex = root.findViewById(R.id.wallet_hint_convert_credits_bittrex); - textEarnMoreTips = root.findViewById(R.id.wallet_hint_earn_more_tips); textWhatSyncMeans = root.findViewById(R.id.wallet_hint_what_sync_means); textWalletReceiveAddress = root.findViewById(R.id.wallet_receive_address); buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address); @@ -267,29 +267,26 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W itemDecoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.thin_divider)); recentTransactionsList.addItemDecoration(itemDecoration); - linkUnlockTips.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (context != null) { - AlertDialog.Builder builder = new AlertDialog.Builder(context). - setTitle(R.string.unlock_tips). - setMessage(R.string.confirm_unlock_tips) - .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - unlockTips(); - } - }).setNegativeButton(R.string.no, null); - builder.show(); - } - } - }); + detailRows = new ArrayList(3); - textEarnMoreTips.setOnClickListener(new View.OnClickListener() { + detailAdapter = new WalletDetailAdapter((MainActivity) context, detailRows); + detailListView.setAdapter(detailAdapter); + + buttonViewMore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + Context context = getContext(); if (context instanceof MainActivity) { - ((MainActivity) context).openFragment(PublishFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH); + View walletDetail = ((MainActivity) context).findViewById(R.id.balance_detail_listview); + + if (walletDetail.getVisibility() == View.GONE) { + TransitionManager.beginDelayedTransition((ViewGroup) walletDetail.getParent()); + walletDetail.setVisibility(View.VISIBLE); + buttonViewMore.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_dropup, 0); + } else { + walletDetail.setVisibility(View.GONE); + buttonViewMore.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_dropdown, 0); + } } } }); @@ -638,36 +635,92 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W } public void onWalletBalanceUpdated(WalletBalance walletBalance) { - double balance = walletBalance.getAvailable().doubleValue(); - double usdBalance = balance * Lbryio.LBCUSDRate; + double totalBalance = walletBalance.getTotal().doubleValue(); + double spendableBalance = walletBalance.getAvailable().doubleValue(); + double supportingBalance = walletBalance.getClaims().doubleValue() + walletBalance.getTips().doubleValue() + walletBalance.getSupports().doubleValue(); + double usdBalance = spendableBalance * Lbryio.LBCUSDRate; double tipsBalance = walletBalance.getTips().doubleValue(); - double tipsUsdBalance = tipsBalance * Lbryio.LBCUSDRate; - String formattedBalance = Helper.SIMPLE_CURRENCY_FORMAT.format(balance); - Helper.setViewText(textWalletBalance, balance > 0 && formattedBalance.equals("0") ? Helper.FULL_LBC_CURRENCY_FORMAT.format(balance) : formattedBalance); - Helper.setViewText(textTipsBalance, Helper.shortCurrencyFormat(tipsBalance)); - Helper.setViewText(textClaimsBalance, Helper.shortCurrencyFormat(walletBalance.getClaims().doubleValue())); - Helper.setViewText(textSupportsBalance, Helper.shortCurrencyFormat(walletBalance.getSupports().doubleValue())); - Helper.setViewText(textWalletInlineBalance, Helper.shortCurrencyFormat(balance)); + if (detailRows == null) + detailRows = new ArrayList<>(3); + + if (detailAdapter == null) { + detailAdapter = new WalletDetailAdapter((MainActivity) getContext(), detailRows); + detailListView.setAdapter(detailAdapter); + } + + WalletDetailItem earnedBalance = new WalletDetailItem(getResources().getString(R.string.earned_from_others), getResources().getString(R.string.unlock_to_spend), Helper.SIMPLE_CURRENCY_FORMAT.format(tipsBalance), tipsBalance != 0, ((MainActivity) getContext()).isUnlockingTips()); + WalletDetailItem initialPublishes = new WalletDetailItem(getResources().getString(R.string.on_initial_publishes), getResources().getString(R.string.delete_or_edit_past_content), Helper.SIMPLE_CURRENCY_FORMAT.format(walletBalance.getClaims().doubleValue()), false, false); + WalletDetailItem supportingContent = new WalletDetailItem(getResources().getString(R.string.supporting_content), getResources().getString(R.string.delete_supports_to_spend), Helper.SIMPLE_CURRENCY_FORMAT.format(walletBalance.getSupports().doubleValue()), false, false); + + boolean needNotifyAdapter = false; + boolean firstDatasetNotification; + + if (detailRows.size() == 0) { + detailRows.add(0, earnedBalance); + detailRows.add(1, initialPublishes); + detailRows.add(2, supportingContent); + needNotifyAdapter = true; + firstDatasetNotification = true; + } else { + firstDatasetNotification = false; + if (!detailRows.get(0).detailAmount.equals(earnedBalance.detailAmount) + || detailRows.get(0).isInProgress != earnedBalance.isInProgress + || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { + detailRows.set(0, earnedBalance); + needNotifyAdapter = true; + } + if (!detailRows.get(1).detailAmount.equals(initialPublishes.detailAmount)) { + detailRows.set(1, initialPublishes); + needNotifyAdapter = true; + } + if (!detailRows.get(2).detailAmount.equals(supportingContent.detailAmount)) { + detailRows.set(2, supportingContent); + needNotifyAdapter = true; + } + } + + if (needNotifyAdapter) { + // notifyDatasetChanged() doesn't work, so simply reset the adapter to the list + // to update the view + detailListView.setAdapter(detailAdapter); + + if (firstDatasetNotification) { + int listHeight = Math.round(getResources().getDisplayMetrics().density); + + for (int i = 0; i < detailRows.size(); i++) { + View item = detailAdapter.getView(i, null, detailListView); + item.measure(0, 0); + listHeight += item.getMeasuredHeight(); + } + + // Avoid scroll bars being displayed + ViewGroup.LayoutParams params = detailListView.getLayoutParams(); + params.height = listHeight + (detailListView.getCount() + 1) * detailListView.getDividerHeight(); + detailListView.setLayoutParams(params); + detailListView.setVerticalScrollBarEnabled(false); + detailListView.requestLayout(); + } + } + + String formattedTotalBalance = Helper.REDUCED_LBC_CURRENCY_FORMAT.format(totalBalance); + String formattedSpendableBalance = Helper.SIMPLE_CURRENCY_FORMAT.format(spendableBalance); + String formattedSupportingBalance = Helper.SIMPLE_CURRENCY_FORMAT.format(supportingBalance); + Helper.setViewText(walletTotalBalanceView, totalBalance > 0 && formattedTotalBalance.equals("0") ? Helper.FULL_LBC_CURRENCY_FORMAT.format(totalBalance) : formattedTotalBalance); + Helper.setViewText(walletSpendableBalanceView, spendableBalance > 0 && formattedSpendableBalance.equals("0") ? Helper.FULL_LBC_CURRENCY_FORMAT.format(spendableBalance) : formattedSpendableBalance); + Helper.setViewText(walletSupportingBalanceView, supportingBalance > 0 && formattedSupportingBalance.equals("0") ? Helper.FULL_LBC_CURRENCY_FORMAT.format(supportingBalance) : formattedSupportingBalance); + Helper.setViewText(textWalletInlineBalance, Helper.shortCurrencyFormat(spendableBalance)); if (Lbryio.LBCUSDRate > 0) { // only update display usd values if the rate is loaded Helper.setViewText(textWalletBalanceUSD, String.format("≈$%s", Helper.SIMPLE_CURRENCY_FORMAT.format(usdBalance))); - Helper.setViewText(textTipsBalanceUSD, String.format("≈$%s", Helper.SIMPLE_CURRENCY_FORMAT.format(tipsUsdBalance))); } + textWalletBalanceDesc.setText(spendableBalance == totalBalance ? getResources().getString(R.string.your_total_balance) : getResources().getString(R.string.all_of_this_is_yours)); + checkTips(); checkRewardsDriver(); } - private void unlockTips() { - Context context = getContext(); - if (context instanceof MainActivity) { - linkUnlockTips.setVisibility(View.GONE); - progressUnlockTips.setVisibility(View.VISIBLE); - ((MainActivity) context).unlockTips(); - } - } - public void checkTips() { checkTips(false); } @@ -681,9 +734,6 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W MainActivity activity = (MainActivity) context; unlocking = activity.isUnlockingTips(); } - - Helper.setViewVisibility(linkUnlockTips, !forceHideLink && tipBalance > 0 && !unlocking ? View.VISIBLE : View.GONE); - Helper.setViewVisibility(progressUnlockTips, unlocking ? View.VISIBLE : View.GONE); } private void checkRewardsDriver() { diff --git a/app/src/main/java/io/lbry/browser/utils/Helper.java b/app/src/main/java/io/lbry/browser/utils/Helper.java index fe374aac..7a2c5de2 100644 --- a/app/src/main/java/io/lbry/browser/utils/Helper.java +++ b/app/src/main/java/io/lbry/browser/utils/Helper.java @@ -77,6 +77,7 @@ public final class Helper { public static final String FILE_SIZE_FORMAT_PATTERN = "#,###.#"; public static final DecimalFormat LBC_CURRENCY_FORMAT = new DecimalFormat(LBC_CURRENCY_FORMAT_PATTERN); public static final DecimalFormat FULL_LBC_CURRENCY_FORMAT = new DecimalFormat("#,###.########"); + public static final DecimalFormat REDUCED_LBC_CURRENCY_FORMAT = new DecimalFormat("#,###.####"); public static final DecimalFormat SIMPLE_CURRENCY_FORMAT = new DecimalFormat("#,##0.00"); public static final SimpleDateFormat FILESTAMP_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss"); public static final String EXPLORER_TX_PREFIX = "https://explorer.lbry.com/tx"; diff --git a/app/src/main/java/io/lbry/browser/views/CreditsBalanceView.java b/app/src/main/java/io/lbry/browser/views/CreditsBalanceView.java new file mode 100644 index 00000000..725f1e81 --- /dev/null +++ b/app/src/main/java/io/lbry/browser/views/CreditsBalanceView.java @@ -0,0 +1,69 @@ +package io.lbry.browser.views; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.util.DisplayMetrics; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import io.lbry.browser.R; + +public class CreditsBalanceView extends TextView { + float textFontSize; + private float iconSize; + Rect r; + Paint p; + + public CreditsBalanceView(Context context) { + super(context); + } + + public CreditsBalanceView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + r = new Rect(); + p = new Paint(); + + TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CreditsBalanceView,0, 0); + + try { + textFontSize = a.getDimension(R.styleable.CreditsBalanceView_textSize, 24f); + iconSize = a.getDimension(R.styleable.CreditsBalanceView_iconSize, 20f); + + this.setTextSize((int) textFontSize); + + DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); + float px = 8 * (metrics.densityDpi / 160f); + + setPadding((int) iconSize + Math.round(px), 0, 0, 0); + } finally { + a.recycle(); + } + + } + + @Override + protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec){ + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } + + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + drawLbryCredits(canvas); + } + + private void drawLbryCredits(Canvas c) { + @SuppressLint("UseCompatLoadingForDrawables") Drawable icon = getResources().getDrawable(R.drawable.ic_credits, null); + float delta = (c.getHeight() - iconSize) / 2; + icon.setBounds(0, (int) delta, (int) iconSize, (int) (delta + iconSize)); + icon.draw(c); + } +} diff --git a/app/src/main/res/layout/card_wallet_balance.xml b/app/src/main/res/layout/card_wallet_balance.xml index c9d6a01f..c27a93af 100644 --- a/app/src/main/res/layout/card_wallet_balance.xml +++ b/app/src/main/res/layout/card_wallet_balance.xml @@ -1,6 +1,7 @@ @@ -8,63 +9,122 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> - - - + android:layout_height="wrap_content" + android:padding="16dp" + android:orientation="vertical"> - - - - + lbry:textSize="@dimen/wallet_total_balance_font_size" + lbry:iconSize="24dp" + android:textColor="@color/white" + android:textFontWeight="300" /> + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml index dd36539b..c1f021f5 100644 --- a/app/src/main/res/values-af/strings.xml +++ b/app/src/main/res/values-af/strings.xml @@ -252,15 +252,8 @@ Balans - U het tans U kan u krediete in USD omskakel en die omgeskakelde bedrag met \'n uitruil onttrek. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Skakel krediete na USD op Bittrex</a> - Jy het ook - Jy het vasgehou - in wenke - in u publikasies - in u steun - Verdien meer wenke deur cool video\'s op te laai Die agtergronddiens word steeds geïnitialiseer. U kan die inhoud intussen verken en kyk. U kan dit nie nou doen nie, want die agtergronddiens is nog besig om te initialiseer. diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 2dd06daf..f78bf90a 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -265,15 +265,8 @@ Balanç - Ara tens Pots convertir els teus crèdits a USD i retirar la quantitat convertida emprant un intercanvi. <a href=\"https://lbry.com/faq/exchanges\">Aprèn-ne més</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Converteix crèdits a USD a Bittrex</a> - També tens - Has invertit - en propines - en les teves publicacions - en els teus suports - Obtén més propines pujant vídeos genials El servei en segon pla s\'està inicialitzant... El servei en segon pla encara s\'està inicialitzant. Pots explorar i veure contingut mentrestant. No pots fer això ara perquè el servei en segon pla encara s\'està inicialitzant. diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 41eaeeda..8c29fc0a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -256,15 +256,8 @@ Bitte versuche es später erneut. Kontostand - Sie haben derzeit Sie können Ihr Guthaben in USD umrechnen und den umgerechneten Betrag über einen Umtausch abheben. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Sie haben auch - Sie haben gesteckt - in Trinkgeldern - in Deinen Veröffentlichungen - in Deinen Unterstützungen - Verdienen Sie weitere Tipps, indem Sie coole Videos hochladen Der Hintergrunddienst wird noch initialisiert. In der Zwischenzeit können Sie Inhalte erkunden und ansehen. Sie können dies derzeit nicht tun, da der Hintergrunddienst noch initialisiert wird. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7fbc797d..3de9690f 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -265,15 +265,8 @@ Saldo - Tu Actualmente tienes Puede convertir sus créditos a USD y retirar el monto convertido mediante un intercambio. <a href=\"https://lbry.com/faq/exchanges\">Aprender más</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convierta créditos a USD en Bittrex</a> - También tienes - En stake - en propinas - en tus publicaciones - en tus propinas - Obtenga más propinas al subir videos geniales El servicio en segundo plano se está iniciando... El servicio en segundo plano aún se está iniciando. Puede explorar y ver contenido mientras tanto. No puede hacer esto ahora porque el servicio en segundo plano todavía no está iniciado. diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 4a691aec..bf0a0513 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -221,15 +221,8 @@ Saldo - Hetkel on sul Valuutavahetustes saad vahetada oma LBC raha USD vastu ja selle välja võtta. <a href=\"https://lbry.com/faq/exchanges\">Loe lisa</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Valuutavahetus Bittrex LBC > USD</a> - Lisaks on sul - Sul on panused - jootrahana - sinu postitustes - sinu toetustes - Teeni lisapreemiaid laadides üles huvitavaid videosid Taustateenus veel stardib. Võid seniks postitusi sirvida. Seda ei saa hetkel teha, kuna taustateenus pole veel käivitunud. diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 668ba22b..acc9d256 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -265,15 +265,8 @@ Solde - Vous avez actuellement Vous pouvez convertir vos crédits en USD et retirer le montant converti à l\'aide d\'un échange. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Vous avez aussi - Tu as jalonné - En pourboires - dans vos publications - dans vos supports - Obtenez plus de pourboire en téléchargeant des vidéos sympas Le service d\'arrière-plan est en cours d\'initialisation… Le service d\'arrière-plan est toujours en cours d\'initialisation. Vous pouvez explorer et regarder du contenu en attendant. Vous ne pouvez pas le faire pour le moment car le service d\'arrière-plan est toujours en cours d\'initialisation. diff --git a/app/src/main/res/values-gu/strings.xml b/app/src/main/res/values-gu/strings.xml index 7c426dc6..951515ab 100644 --- a/app/src/main/res/values-gu/strings.xml +++ b/app/src/main/res/values-gu/strings.xml @@ -252,15 +252,8 @@ બેલેન્સ - તમારી પાસે હાલમાં તમે તમારા ક્રેડિટને USD માં કન્વર્ટ કરી શકો છો અને એક્સચેંજનો ઉપયોગ કરીને રૂપાંતરિત રકમ પાછા ખેંચી શકો છો. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - તમારી પાસે પણ છે - તમે સ્ટેક્ડ - ટીપ્સમાં - તમારા પ્રકાશનોમાં - તમારા સપોર્ટ - કૂલ વિડિઓઝ અપલોડ કરીને વધુ ટીપ્સ કમાઓ પૃષ્ઠભૂમિ સેવા હજી પ્રારંભ થઈ રહી છે. તમે સરેરાશ સમયમાં અન્વેષણ કરી શકો છો અને સામગ્રી જોઈ શકો છો. તમે હમણાં આ કરી શકતા નથી કારણ કે પૃષ્ઠભૂમિ સેવા હજી પ્રારંભ થઈ રહી છે. diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index b2304d89..edb5a171 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -281,15 +281,8 @@ מאזן - יש לך כרגע ביכולתך להמיר את הקרדיט שלך ל-USD ולמשוך את הסכום המומר באמצעות חלפניה. <a href=\"https://lbry.com/faq/exchanges\">למדו עוד</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">המר קרדיט ל-USD באתר Bittrex</a> - יש לך גם - השקעת - בטיפים - בפרסומים שלך - בפעולות תמיכה - הרווח יותר טיפים ע\"י העלאת סרטונים מגניבים תהליך הרקע כרגע מתאתחל… תהליך הרקע כרגע מתאתחל. אתה יכול לבצע סקירה ולצפות בתכנים בינתיים. אינך יכול לבצע זאת בינתיים משום שתהליך הרקע עדיין מתאתחל. diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 0453a6b0..d42a0911 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -265,15 +265,8 @@ बैलेंस - आपके पास अभी है आप अपने क्रेडिटस को यूसडी में बदल सकते हैं और उन्हें एक्सचेंज की मदद से निकाल भी सकते हैं। <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\"> क्रेडिटस को यूसडी में बदलें बिट्रिक्स पर</a> - आपके पास और भी है - आपने स्टेक की है - टिप्स में - आपकी पब्लिशिस में हैं - आपके सपोर्ट्स में हैं - मनोरंजक वीडियोस अपलोड करके और अधिक टिप्स कमाए पृष्ठभूमि सेवा प्रारंभ कर रहा है ... पृष्ठभूमि सेवाएं अभी भी शुरू हो रही है। इस दौरान आप अन्य सामग्री को खोज एवं देख सकते हैं। आप यह अभी नहीं कर सकते हैं क्योंकि पृष्ठभूमि सेवाएं अभी भी शुरू हो रही है diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 2bfccd91..02fa0495 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -257,15 +257,8 @@ Saldo - Anda sekarang punya Anda dapat mengonversi kredit Anda ke USD dan menarik jumlah yang dikonversi menggunakan pertukaran. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Kamu juga punya - Anda mempertaruhkan - dalam tips - di publikasi Anda - dalam dukungan Anda - Hasilkan lebih banyak tips dengan mengunggah video keren Layanan latar belakang sedang menginisialisasi... Layanan latar belakang masih diinisialisasi. Anda dapat menjelajahi dan menonton konten dalam waktu yang bersamaan. Anda tidak dapat melakukan ini sekarang karena layanan latar belakang masih diinisialisasi. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 818b0811..9c999cbe 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -265,15 +265,8 @@ Saldo - Hai attualmente Puoi convertire i tuoi crediti in USD e trasferire il valore convertito utilizzando un cambio. <a href=\"https://lbry.com/faq/exchanges\">Vedi altro</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Converti crediti in USD su Bittrex</a> - Hai anche - Hai accumulato - in donaziones - nelle tue pubblicazioni - nei tuoi supporti - Guadagna altre donazioni caricando video interessanti Avvio servizio in background... Il servizio in background è ancora in avvio. Puoi esplorare e visualizzare contenuti nel frattempo. Non puoi fare questo al momento perché il servizio in background è ancora in avviamento. diff --git a/app/src/main/res/values-jv/strings.xml b/app/src/main/res/values-jv/strings.xml index 5cb1c3bd..01b9c9f0 100644 --- a/app/src/main/res/values-jv/strings.xml +++ b/app/src/main/res/values-jv/strings.xml @@ -257,15 +257,8 @@ Duwitmu - Sampeyan saiki duwe Sampeyan bisa ngowahi kridit sampeyan menyang USD lan mbatalake jumlah sing diowahi nggunakake ijol-ijolan. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Sampeyan yo duwe - Sampeyan naruhno - ing tips - ing nerbitake sampeyan - ing dhukungan sampeyan - Entuk tips liyane kanthi ngunggah video sing viral Miwiti Layanan latar mburi... Layanan latar mburi isih miwiti. Sampeyan bisa njelajah lan nonton konten ing wektu tegese. Sampeyan ora bisa nindakake iki saiki amarga layanan latar mburi isih miwiti. diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index c61b38ed..f871b317 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -258,15 +258,8 @@ Sila kembali sebentar lagi. Baki - Anda kini mempunyai Anda boleh menukar kredit anda ke USD dan keluarkan jumlah tersebut menerusi sebuah bursa. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Tukar kredit ke USD dengan Bittrex</a> - Anda juga mempunyai - Anda mempertaruhkan - dalam tips - dalam terbitan anda - dalam sokongan anda - Dapatkan lebih banyak tips dengan memuat-naik video yang menarik Servis latar belakang sedang diinisialisasi... Servis latar belakang masih diinisialisasi. Anda boleh meneroka dan menonton kandungan dalam masa yang sama. Anda tidak dapat melakukan ini sekarang kerana servis latar belakang masih diinisialisasi. diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index d2846b23..9f6917e0 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -252,15 +252,8 @@ Balans - U hebt momenteel U kunt uw tegoeden omzetten in USD en het omgerekende bedrag opnemen met een omwisseling. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - U hebt ook - U hebt ingezet - in fooien - in uw publicaties - in uw steunen - Verdien meer fooien door coole video\'s te uploaden De achtergrondservice wordt nog geïnitialiseerd. U kunt ondertussen inhoud verkennen en bekijken. U kunt dit nu niet doen omdat de achtergrondservice nog steeds wordt geïnitialiseerd. diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index f7d8a994..557d874f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -281,15 +281,8 @@ Balans - Obecnie posiadasz Możesz zamienić swoje kredyty na USD i wypłacić przeliczoną kwotę za pomocą giełdy. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Posiadasz również - Zestackowane - w napiwkach - w twoich publikacjach - w twoich wsparciach - Zarób więcej napiwków publikując fajne filmiki Usługa w tle jest inicjowana... Usługa w tle jest nadal inicjowana. W międzyczasie możesz eksplorować i oglądać treści. Nie możesz tego teraz zrobić, ponieważ usługa w tle wciąż się inicjuje. diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 90bce54d..c11bfd66 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -265,15 +265,8 @@ Saldo - Você tem atualmente Você pode converter seus créditos em USD e retirar o valor convertido usando uma exchange. <a href=\"https://lbry.com/faq/exchanges\">Saiba mais</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Converter creditos para USD no Bittrex</a> - Você também tem - Você investiu - em gorjetas - nas suas publicções - Nos seus apoios - Ganhe mais gorjetas enviando vídeos legais O serviço de segundo plano está sendo inicializado.... O serviço de segundo plano ainda está sendo inicializado. Você pode explorar conteúdos incríveis nesse meio tempo. Você não pode fazer isso agora porque o serviço de segundo plano ainda está sendo inicializado. diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d6e48ebc..b74185ed 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -265,15 +265,8 @@ Saldo - Atualmente você tem Você pode converter seus créditos em dólares americanos e retirar o valor convertido usando uma exchange. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Você também tem - Você acumulou - em gorjetas - nas suas publicações - nos seus apoios - Ganhe mais gorjetas enviando videos legais O serviço em segundo plano está inicializando... O serviço em segundo plano ainda está sendo inicializado. Você pode explorar e assistir ao conteúdo nesse meio tempo. Você não pode fazer isso agora porque o serviço em segundo plano ainda está sendo inicializado. diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 62e25ed3..16602da4 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -260,15 +260,8 @@ Sold - Acum ai Îţi poţi converti creditele în USD şi să retragi suma folosind o casă de schimb. <a href=\"https://lbry.com/faq/exchanges\">Detalii</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Schimbă creditele în USD la Bittrex</a> - Mai ai și - Ai depus - în bacşişuri - în publicările tale - în susţinerile tale - Câştigă mai multe bacşişuri publicând conţinut Serviciul din fundal încă se iniţializează. Poţi explora şi vedea conţinut între timp. Nu poţi face asta acum deoarce serviciul din fundal încă se iniţializează. diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 0d95fbbf..43206fae 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -281,15 +281,8 @@ Баланс - У Вас сейчас есть Вы можете поменять кредиты на доллары США и снять сумму, используя обменник. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - У Вас также есть - У Вас сохранено - в чаевых - в Ваших публикациях - в Ваших поддержках - Заработайте больше чаевых, загружая крутые видео Фоновый сервис запускается... Фоновый сервис всё ещё запускается. Между тем Вы уже можете искать и смотреть какой-либо контент. Вы не можете сделать это прямо сейчас, потому что фоновый сервис всё ещё запускается. diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 3d2ab68d..873e28df 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -273,15 +273,8 @@ Balans - Trenutno imate Možete konvertovati vaše kredite u USD i unovčiti konvertovani iznos koristeći menjačnicu. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Takođje imate - Vi štedite - u tipovima - u vašim objavama - u vašim podrškama - Zaradi više tipova tako što ćeš objaviti što više cool video klipova Pozadinski servis se pokreće... Pokretanje pozadinskog servisa je i dalje u toku. Za to vreme možete istraživati i gledati sadržaje. Ne možete uraditi ovo za vreme učitavanja pozadinskog servisa. diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 76a5e4bb..5aeef757 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -252,15 +252,8 @@ Bakiye - Şuna sahipsiniz Kredilerinizi USD\'ye çevirebilir ve döviz hizmeti ile paranızı çekebilirsiniz. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - Şunlara da sahipsiniz - Ayırdığınız miktar - bahşiş olarak - yayınlarınızda mevcut olan - desteklerinizde mevcut olan - Daha havalı videolar yükleyerek daha çok bahşiş kazan Arkaplan servisi hala başlatılıyor. Bu arada siz içerikleri keşfedebilir ve izleyebilirsiniz. Bunu şu an yapamazsınız çünkü arkaplan servisi hala başlatılıyor. diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 2a352775..9c444332 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -268,15 +268,8 @@ Рахунок - У Вас зараз є Ви можете обміняти кредити на долари США та зняти ці гроші за допомогою обміннику. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Convert credits to USD on Bittrex</a> - У Вас також є - Ви стейкнули - в чайових - у Ваших публікаціях - у Ваших підтримках - Заробляйте більше чайових, завантажуючи класні відео Фоновий сервіс все ще ініціалізується. Ви можете шукати та переглядати у цей час. Ви не можете публікувати контент прямо зараз, тому що фоновий сервіс все ще ініціалізується. diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 991016a8..7497092a 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -245,15 +245,8 @@ Tài khoản - Bạn hiện có Bạn có thể chuyển đổi tín dụng của mình sang USD và rút số tiền đã chuyển đổi bằng cách sử dụng một trao đổi. <a href=\"https://lbry.com/faq/exchanges\">Learn more</a>. <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Đổi LBC sang USD tại Bittrex</a> - Bạn cũng có - Bạn đặt cược - in tips - trong nội dung của bạn - trong sự hỗ trợ của bạn - Kiếm thêm tiền bằng cách tải lên các video thú vị Dịch vụ nền vẫn đang khởi tạo. Bạn có thể khám phá và xem nội dung trong thời gian trung bình. Bạn không thể làm điều này ngay bây giờ vì dịch vụ nền vẫn đang khởi tạo. diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d09b3d71..ef09f7bd 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -257,15 +257,8 @@ 餘額 - 你目前有 你可以把信用額兌換為美元然後到交易所提取。<a href=\"https://lbry.com/faq/exchanges\">了解更多</a>。 <a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">在Bittrex上轉換美元</a> - 你同時有 - 你累計 - 於小費 - 為發佈押金 - 你支持的內容 - 上傳酷酷的影片以獲得更多小費 背景程式執行初始化中…… 背景程式仍在初始化。與此同時,你可以探索和觀看內容。 你目前還不能執行這動作,因為背景程式仍在初始化。 diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 00000000..6ecc4827 --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 4ab4520f..e7aef495 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -5,4 +5,7 @@ 8dp 176dp 16dp + 14sp + 12sp + 12sp \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2f2ce179..e79fe536 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -277,15 +277,19 @@ Balance - You currently have + Your total balance. + Your total balance. All of this is yours, but some credits are in use on channels and content right now. You can convert your credits to USD and withdraw the converted amount using an exchange. <a href="https://lbry.com/faq/exchanges">Learn more</a>. <a href="https://bittrex.com/Account/Register?referralCode=4M1-P30-BON">Convert credits to USD on Bittrex</a> - You also have - You staked - in tips - in your publishes - in your supports - Earn more tips by uploading cool videos + immediately spendable + boosting content + View more + …earned from others + …on initial publishes + …supporting content + (Unlock to spend) + (Delete or edit past content to spend) + (Delete supports to spend) The background service is initializing… The background service is still initializing. You can explore and watch content in the mean time. You cannot do this right now because the background service is still initializing. -- 2.45.2 From dabe9fe691f126eec88d42eae53fba6edf30347c Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Mon, 15 Mar 2021 20:08:18 +0100 Subject: [PATCH 4/7] Disable Javascript (#1171) --- .../java/io/lbry/browser/ui/findcontent/FileViewFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3382854c..ecadbc56 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 @@ -565,7 +565,7 @@ public class FileViewFragment extends BaseFragment implements webView.setWebViewClient(new LbryWebViewClient(ctx)); WebSettings webSettings = webView.getSettings(); webSettings.setAllowFileAccess(true); - webSettings.setJavaScriptEnabled(true); + webSettings.setJavaScriptEnabled(false); } if (!webViewAdded && root != null) { -- 2.45.2 From 24862550a1b29efc5180b5551bf3abe81c39ed42 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 16 Mar 2021 09:24:33 +0100 Subject: [PATCH 5/7] bumpversion 0.16.14 --> 0.17.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b14249ab..89ae00ea 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "io.lbry.browser" minSdkVersion 21 targetSdkVersion 29 - versionCode 1614 - versionName "0.16.14" + versionCode 1700 + versionName "0.17.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -- 2.45.2 From e520c3694a0bbb25b405f8cbe468825ff3798c44 Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Tue, 16 Mar 2021 17:35:43 +0100 Subject: [PATCH 6/7] Decode URL encoded links and unit test it --- .../java/io/lbry/browser/utils/LbryUri.java | 15 +++++++++-- .../io/lbry/browser/utils/LbryUriTest.java | 27 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/utils/LbryUri.java b/app/src/main/java/io/lbry/browser/utils/LbryUri.java index d903cdb5..01ba875b 100644 --- a/app/src/main/java/io/lbry/browser/utils/LbryUri.java +++ b/app/src/main/java/io/lbry/browser/utils/LbryUri.java @@ -1,5 +1,7 @@ package io.lbry.browser.utils; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -8,6 +10,8 @@ import java.util.regex.Pattern; import io.lbry.browser.exceptions.LbryUriException; import lombok.Data; +import static org.apache.commons.codec.CharEncoding.UTF_8; + @Data public class LbryUri { public static final String LBRY_TV_BASE_URL = "https://lbry.tv/"; @@ -117,10 +121,17 @@ public class LbryUri { } } - String streamOrChannelName = components.get(2); + String streamOrChannelName = null; + String possibleStreamName = null; + try { + // Using java.net.URLDecoder to be able to quickly unit test + streamOrChannelName = URLDecoder.decode(components.get(2), UTF_8); + possibleStreamName = URLDecoder.decode(components.get(6), UTF_8); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } String primaryModSeparator = components.get(3); String primaryModValue = components.get(4); - String possibleStreamName = components.get(6); String secondaryModSeparator = components.get(7); String secondaryModValue = components.get(8); diff --git a/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java b/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java index 1a5730e6..2a3a3a72 100644 --- a/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java +++ b/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java @@ -113,6 +113,33 @@ public class LbryUriTest { assertEquals(expectedForChannel, obtained); } + @Test + public void parseLbryTvWithEncodedChars() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("https://lbry.tv/@Content_I_Like:1/DR.-ASTRID-ST%C3%9CCKELBERGER:2",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + expected = new LbryUri(); + expected.setChannelName("@Content_I_Like"); + expected.setStreamName("DR.-ASTRID-STÜCKELBERGER"); + + try { + LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "1"); + LbryUri.UriModifier secondaryMod = LbryUri.UriModifier.parse("#", "2"); + expected.setChannelClaimId(primaryMod.getClaimId()); + expected.setStreamClaimId(secondaryMod.getClaimId()); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals(expected, obtained); + + } + @Test public void lbryToTvString() { LbryUri obtained = new LbryUri(); -- 2.45.2 From e49f675266edae4609e1e42d278b20c28f71f3c7 Mon Sep 17 00:00:00 2001 From: Javi Rueda Date: Tue, 16 Mar 2021 19:07:11 +0100 Subject: [PATCH 7/7] Encode UTF8 characters on LBRY.TV links and unit test it --- .../java/io/lbry/browser/utils/LbryUri.java | 24 +++++++++++++++-- .../io/lbry/browser/utils/LbryUriTest.java | 27 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/lbry/browser/utils/LbryUri.java b/app/src/main/java/io/lbry/browser/utils/LbryUri.java index 01ba875b..a55dd0f2 100644 --- a/app/src/main/java/io/lbry/browser/utils/LbryUri.java +++ b/app/src/main/java/io/lbry/browser/utils/LbryUri.java @@ -2,6 +2,7 @@ package io.lbry.browser.utils; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -199,7 +200,18 @@ public class LbryUri { if (channelName != null) { formattedChannelName = channelName.startsWith("@") ? channelName : String.format("@%s", channelName); } - String primaryClaimName = claimName; + String primaryClaimName = null; + + if (protocol.equals(LBRY_TV_BASE_URL) && Helper.isNullOrEmpty(formattedChannelName)) { + try { + primaryClaimName = URLEncoder.encode(claimName, UTF_8); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } else { + primaryClaimName = claimName; + } + if (Helper.isNullOrEmpty(primaryClaimName)) { primaryClaimName = contentName; } @@ -229,7 +241,15 @@ public class LbryUri { secondaryClaimName = contentName; } if (Helper.isNullOrEmpty(secondaryClaimName)) { - secondaryClaimName = !Helper.isNullOrEmpty(formattedChannelName) ? streamName : null; + if (protocol.equals(LBRY_TV_BASE_URL)) { + try { + secondaryClaimName = !Helper.isNullOrEmpty(formattedChannelName) ? URLEncoder.encode(streamName, UTF_8) : null; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } else { + secondaryClaimName = !Helper.isNullOrEmpty(formattedChannelName) ? streamName : null; + } } String secondaryClaimId = !Helper.isNullOrEmpty(secondaryClaimName) ? streamClaimId : null; diff --git a/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java b/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java index 2a3a3a72..7dfa46af 100644 --- a/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java +++ b/app/src/test/java/io/lbry/browser/utils/LbryUriTest.java @@ -137,7 +137,6 @@ public class LbryUriTest { } assertEquals(expected, obtained); - } @Test @@ -153,6 +152,32 @@ public class LbryUriTest { assertEquals("https://lbry.tv/@lbry:3f/lbryturns4:6", obtained.toTvString()); } + @Test + public void lbryToTvStringWithEncodedChars() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("lbry://La-Peur,-Nos-Attentats,-c'est-VOTRE-Sécurité!-Les-Guignols#6",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals("https://lbry.tv/La-Peur%2C-Nos-Attentats%2C-c%27est-VOTRE-Se%CC%81curite%CC%81%21-Les-Guignols:6", obtained.toTvString()); + } + + @Test + public void lbryToTvStringWithChannelAndEncodedChars() { + LbryUri obtained = new LbryUri(); + + try { + obtained = LbryUri.parse("lbry://@test#1/La-Peur,-Nos-Attentats,-c'est-VOTRE-Sécurité!-Les-Guignols#6",false); + } catch (LbryUriException e) { + e.printStackTrace(); + } + + assertEquals("https://lbry.tv/@test:1/La-Peur%2C-Nos-Attentats%2C-c%27est-VOTRE-Se%CC%81curite%CC%81%21-Les-Guignols:6", obtained.toTvString()); + } + @NotNull private LbryUri sinthesizeExpected() { LbryUri expectedForChannel = new LbryUri(); -- 2.45.2