Send tip dialog. Channel page share and follow/unfollow.

This commit is contained in:
Akinwale Ariwodola 2020-05-03 13:46:31 +01:00
parent 8cb51f5c17
commit 78dd587901
20 changed files with 1201 additions and 479 deletions

View file

@ -18,7 +18,6 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import androidx.preference.PreferenceManager;
@ -35,12 +34,16 @@ import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
import com.google.android.flexbox.FlexboxLayoutManager;
import com.google.android.material.snackbar.Snackbar;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import io.lbry.browser.adapter.ClaimListAdapter;
import io.lbry.browser.adapter.TagListAdapter;
import io.lbry.browser.dialog.SendTipDialogFragment;
import io.lbry.browser.exceptions.LbryUriException;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.ClaimCacheKey;
@ -62,12 +65,13 @@ public class FileViewActivity extends AppCompatActivity {
private static boolean startingShareActivity;
private SimpleExoPlayer player;
private boolean hasLoadedFirstBalance;
private boolean loadFilePending;
private boolean resolving;
private Claim claim;
private ClaimListAdapter relatedContentAdapter;
private File file;
private BroadcastReceiver sdkReadyReceiver;
private BroadcastReceiver sdkReceiver;
private Player.EventListener fileViewPlayerListener;
private View buttonShareAction;
@ -117,7 +121,7 @@ public class FileViewActivity extends AppCompatActivity {
resolveUrl(url);
}
registerSdkReadyReceiver();
registerSdkReceiver();
fileViewPlayerListener = new Player.EventListener() {
@Override
@ -129,6 +133,7 @@ public class FileViewActivity extends AppCompatActivity {
};
initUi();
onWalletBalanceUpdated();
renderClaim();
}
@ -181,19 +186,38 @@ public class FileViewActivity extends AppCompatActivity {
}
}
private void registerSdkReadyReceiver() {
private void registerSdkReceiver() {
IntentFilter filter = new IntentFilter();
filter.addAction(MainActivity.ACTION_SDK_READY);
sdkReadyReceiver = new BroadcastReceiver() {
filter.addAction(MainActivity.ACTION_WALLET_BALANCE_UPDATED);
sdkReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// authenticate after we receive the sdk ready event
if (loadFilePending) {
loadFile();
String action = intent.getAction();
if (action.equalsIgnoreCase(MainActivity.ACTION_SDK_READY)) {
// authenticate after we receive the sdk ready event
if (loadFilePending) {
loadFile();
}
} else if (action.equalsIgnoreCase(MainActivity.ACTION_WALLET_BALANCE_UPDATED)) {
onWalletBalanceUpdated();
}
}
};
registerReceiver(sdkReadyReceiver, filter);
registerReceiver(sdkReceiver, filter);
}
private void onWalletBalanceUpdated() {
if (Lbry.SDK_READY) {
if (!hasLoadedFirstBalance) {
findViewById(R.id.floating_balance_loading).setVisibility(View.GONE);
findViewById(R.id.floating_balance_value).setVisibility(View.VISIBLE);
hasLoadedFirstBalance = true;
}
((TextView) findViewById(R.id.floating_balance_value)).setText(
Helper.shortCurrencyFormat(Lbry.walletBalance.getAvailable().doubleValue()));
}
}
private String getStreamingUrl() {
@ -308,6 +332,32 @@ public class FileViewActivity extends AppCompatActivity {
}
});
findViewById(R.id.file_view_action_tip).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!Lbry.SDK_READY) {
Snackbar.make(findViewById(R.id.file_view_claim_display_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
return;
}
if (claim != null) {
SendTipDialogFragment dialog = SendTipDialogFragment.newInstance();
dialog.setClaim(claim);
dialog.setListener(new SendTipDialogFragment.SendTipListener() {
@Override
public void onTipSent(BigDecimal amount) {
double sentAmount = amount.doubleValue();
String message = getResources().getQuantityString(
R.plurals.you_sent_a_tip, sentAmount == 1.0 ? 1 : 2,
new DecimalFormat("#,###.##").format(sentAmount));
Snackbar.make(findViewById(R.id.file_view_claim_display_area), message, Snackbar.LENGTH_LONG).show();
}
});
dialog.show(getSupportFragmentManager(), SendTipDialogFragment.TAG);
}
}
});
RecyclerView relatedContentList = findViewById(R.id.file_view_related_content_list);
relatedContentList.setNestedScrollingEnabled(false);
LinearLayoutManager llm = new LinearLayoutManager(this);
@ -506,7 +556,7 @@ public class FileViewActivity extends AppCompatActivity {
}
protected void onDestroy() {
Helper.unregisterReceiver(sdkReadyReceiver, this);
Helper.unregisterReceiver(sdkReceiver, this);
if (MainActivity.appPlayer != null && fileViewPlayerListener != null) {
MainActivity.appPlayer.removeListener(fileViewPlayerListener);
}

View file

@ -118,6 +118,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static SimpleExoPlayer appPlayer;
public static Claim nowPlayingClaim;
public static boolean startingShareActivity = false;
public static boolean startingFileViewActivity = false;
public static boolean mainActive = false;
private boolean enteringPIPMode = false;
@ -147,6 +148,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static final String ACTION_NOW_PLAYING_CLAIM_UPDATED = "io.lbry.browser.Broadcast.NowPlayingClaimUpdated";
public static final String ACTION_NOW_PLAYING_CLAIM_CLEARED = "io.lbry.browser.Broadcast.NowPlayingClaimCleared";
public static final String ACTION_OPEN_ALL_CONTENT_TAG = "io.lbry.browser.Broadcast.OpenAllContentTag";
public static final String ACTION_WALLET_BALANCE_UPDATED = "io.lbry.browser.Broadcast.WalletBalanceUpdated";
// preference keys
public static final String PREFERENCE_KEY_DARK_MODE = "io.lbry.browser.preference.userinterface.DarkMode";
@ -385,7 +387,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
params.put("url", url);
params.put("claim", getCachedClaimForUrl(url));
openFragment(ChannelFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
setWunderbarValue(url);
setWunderbarValue(url); // TODO: Move this to fragment onResume
}
private Claim getCachedClaimForUrl(String url) {
@ -502,6 +504,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
Lbry.walletBalance = walletBalance;
updateFloatingWalletBalance();
sendBroadcast(new Intent(ACTION_WALLET_BALANCE_UPDATED));
}
@Override
@ -1354,6 +1358,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override
protected void onUserLeaveHint() {
if (startingShareActivity) {
// share activity triggered this, so reset the flag at this point
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startingShareActivity = false;
}
}, 1000);
return;
}
enterPIPMode();
}

View file

@ -0,0 +1,186 @@
package io.lbry.browser.dialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.core.text.HtmlCompat;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.WalletBalance;
import io.lbry.browser.tasks.GenericTaskHandler;
import io.lbry.browser.tasks.wallet.SupportCreateTask;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import lombok.Setter;
public class SendTipDialogFragment extends BottomSheetDialogFragment implements WalletBalanceListener {
public static final String TAG = "SendTipDialog";
private MaterialButton sendButton;
private View cancelLink;
private TextInputEditText inputAmount;
private View inlineBalanceContainer;
private TextView inlineBalanceValue;
private ProgressBar sendProgress;
@Setter
private SendTipListener listener;
@Setter
private Claim claim;
public static SendTipDialogFragment newInstance() {
return new SendTipDialogFragment();
}
private void disableControls() {
getDialog().setCanceledOnTouchOutside(false);
sendButton.setEnabled(false);
cancelLink.setEnabled(false);
}
private void enableControls() {
getDialog().setCanceledOnTouchOutside(true);
sendButton.setEnabled(true);
cancelLink.setEnabled(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_send_tip, container, false);
inputAmount = view.findViewById(R.id.tip_input_amount);
inlineBalanceContainer = view.findViewById(R.id.tip_inline_balance_container);
inlineBalanceValue = view.findViewById(R.id.tip_inline_balance_value);
sendProgress = view.findViewById(R.id.tip_send_progress);
cancelLink = view.findViewById(R.id.tip_cancel_link);
sendButton = view.findViewById(R.id.tip_send);
inputAmount.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
inputAmount.setHint(hasFocus ? getString(R.string.zero) : "");
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
}
});
TextView infoText = view.findViewById(R.id.tip_info);
infoText.setMovementMethod(LinkMovementMethod.getInstance());
infoText.setText(HtmlCompat.fromHtml(
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
HtmlCompat.FROM_HTML_MODE_LEGACY));
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String amountString = Helper.getValue(inputAmount.getText());
if (Helper.isNullOrEmpty(amountString)) {
showError(getString(R.string.invalid_amount));
return;
}
BigDecimal amount = new BigDecimal(amountString);
if (amount.doubleValue() > Lbry.walletBalance.getAvailable().doubleValue()) {
showError(getString(R.string.insufficient_balance));
return;
}
SupportCreateTask task = new SupportCreateTask(claim.getClaimId(), amount, true, sendProgress, new GenericTaskHandler() {
@Override
public void beforeStart() {
disableControls();
}
@Override
public void onSuccess() {
enableControls();
if (listener != null) {
listener.onTipSent(amount);
}
dismiss();
}
@Override
public void onError(Exception error) {
showError(error.getMessage());
enableControls();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
cancelLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
String channel = null;
if (Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType())) {
channel = claim.getTitleOrName();
} else if (claim.getSigningChannel() != null) {
channel = claim.getPublisherTitle();
}
((TextView) view.findViewById(R.id.tip_send_title)).setText(
Helper.isNullOrEmpty(channel) ? getString(R.string.send_a_tip) : getString(R.string.send_a_tip_to, channel)
);
onWalletBalanceUpdated(Lbry.walletBalance);
return view;
}
public void onResume() {
super.onResume();
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).addWalletBalanceListener(this);
}
}
public void onPause() {
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).removeWalletBalanceListener(this);
}
super.onPause();
}
@Override
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
if (walletBalance != null && inlineBalanceValue != null) {
inlineBalanceValue.setText(Helper.shortCurrencyFormat(walletBalance.getAvailable().doubleValue()));
}
}
private void showError(String message) {
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).setBackgroundTint(
ContextCompat.getColor(getContext(), R.color.red)).show();
}
public interface SendTipListener {
void onTipSent(BigDecimal amount);
}
}

View file

@ -125,6 +125,7 @@ public class Claim {
return "Anonymous";
}
public List<String> getTags() {
return (value != null && value.getTags() != null) ? new ArrayList<>(value.getTags()) : new ArrayList<>();
}
@ -142,6 +143,9 @@ public class Claim {
public String getTitle() {
return (value != null) ? value.getTitle() : null;
}
public String getTitleOrName() {
return (value != null) ? value.getTitle() : getName();
}
public long getDuration() {
if (value instanceof StreamMetadata) {

View file

@ -1,5 +1,6 @@
package io.lbry.browser.model.lbryinc;
import io.lbry.browser.model.Claim;
import lombok.Getter;
import lombok.Setter;
@ -19,6 +20,13 @@ public class Subscription {
this.url = url;
}
public static Subscription fromClaim(Claim claim) {
return new Subscription(claim.getName(), claim.getPermanentUrl());
}
public String toString() {
return url;
}
public boolean equals(Object o) {
return (o instanceof Subscription) && url.equalsIgnoreCase(((Subscription) o).getUrl());
}

View file

@ -0,0 +1,63 @@
package io.lbry.browser.tasks.wallet;
import android.os.AsyncTask;
import android.view.View;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import io.lbry.browser.exceptions.ApiCallException;
import io.lbry.browser.tasks.GenericTaskHandler;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
public class SupportCreateTask extends AsyncTask<Void, Void, Boolean> {
private String claimId;
private BigDecimal amount;
private boolean tip;
private View progressView;
private GenericTaskHandler handler;
private Exception error;
public SupportCreateTask(String claimId, BigDecimal amount, boolean tip, View progressView, GenericTaskHandler handler) {
this.claimId = claimId;
this.amount = amount;
this.tip = tip;
this.progressView = progressView;
this.handler = handler;
}
protected void onPreExecute() {
if (handler != null) {
handler.beforeStart();
}
Helper.setViewVisibility(progressView, View.VISIBLE);
}
protected Boolean doInBackground(Void... params) {
try {
Map<String, Object> options = new HashMap<>();
options.put("claim_id", claimId);
options.put("amount", new DecimalFormat(Helper.SDK_AMOUNT_FORMAT).format(amount.doubleValue()));
options.put("tip", tip);
Lbry.genericApiCall(Lbry.METHOD_SUPPORT_CREATE, options);
} catch (ApiCallException ex) {
error = ex;
return false;
}
return true;
}
protected void onPostExecute(Boolean result) {
Helper.setViewVisibility(progressView, View.GONE);
if (handler != null) {
if (result) {
handler.onSuccess();
} else {
handler.onError(error);
}
}
}
}

View file

@ -1,6 +1,7 @@
package io.lbry.browser.ui.channel;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -10,6 +11,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@ -19,24 +21,35 @@ import androidx.viewpager2.widget.ViewPager2;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.dialog.SendTipDialogFragment;
import io.lbry.browser.exceptions.LbryUriException;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.lbryinc.Subscription;
import io.lbry.browser.tasks.ChannelSubscribeTask;
import io.lbry.browser.tasks.ResolveTask;
import io.lbry.browser.ui.BaseFragment;
import io.lbry.browser.ui.controls.SolidIconView;
import io.lbry.browser.ui.following.FollowingFragment;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryUri;
import io.lbry.browser.utils.Lbryio;
import lombok.SneakyThrows;
public class ChannelFragment extends BaseFragment {
private Claim claim;
private boolean resolving;
private boolean subscribing;
private String url;
private View layoutResolving;
@ -50,6 +63,11 @@ public class ChannelFragment extends BaseFragment {
private TabLayout tabLayout;
private ViewPager2 tabPager;
private View buttonShare;
private View buttonTip;
private View buttonFollowUnfollow;
private SolidIconView iconFollowUnfollow;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_channel, container, false);
@ -64,13 +82,125 @@ public class ChannelFragment extends BaseFragment {
textTitle = root.findViewById(R.id.channel_view_title);
textFollowerCount = root.findViewById(R.id.channel_view_follower_count);
buttonShare = root.findViewById(R.id.channel_view_share);
buttonTip = root.findViewById(R.id.channel_view_tip);
buttonFollowUnfollow = root.findViewById(R.id.channel_view_follow_unfollow);
iconFollowUnfollow = root.findViewById(R.id.channel_view_icon_follow_unfollow);
tabPager = root.findViewById(R.id.channel_view_pager);
tabLayout = root.findViewById(R.id.channel_view_tabs);
tabPager.setSaveEnabled(false);
buttonShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (claim != null) {
try {
String shareUrl = LbryUri.parse(
!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl()).toTvString();
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, shareUrl);
MainActivity.startingShareActivity = true;
Intent shareUrlIntent = Intent.createChooser(shareIntent, getString(R.string.share_lbry_content));
shareUrlIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(shareUrlIntent);
} catch (LbryUriException ex) {
// pass
}
}
}
});
buttonTip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!Lbry.SDK_READY) {
Snackbar.make(getView(), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
return;
}
if (claim != null) {
SendTipDialogFragment dialog = SendTipDialogFragment.newInstance();
dialog.setClaim(claim);
dialog.setListener(new SendTipDialogFragment.SendTipListener() {
@Override
public void onTipSent(BigDecimal amount) {
double sentAmount = amount.doubleValue();
String message = getResources().getQuantityString(
R.plurals.you_sent_a_tip, sentAmount == 1.0 ? 1 : 2,
new DecimalFormat("#,###.##").format(sentAmount));
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).show();
}
});
Context context = getContext();
if (context instanceof MainActivity) {
dialog.show(((MainActivity) context).getSupportFragmentManager(), SendTipDialogFragment.TAG);
}
}
}
});
buttonFollowUnfollow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (claim != null) {
if (subscribing) {
return;
}
subscribing = true;
boolean isFollowing = Lbryio.isFollowing(claim);
Subscription subscription = Subscription.fromClaim(claim);
buttonFollowUnfollow.setEnabled(false);
new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
if (isFollowing) {
Lbryio.removeSubscription(subscription);
Lbryio.addCachedResolvedSubscription(claim);
} else {
Lbryio.addSubscription(subscription);
Lbryio.addCachedResolvedSubscription(claim);
}
buttonFollowUnfollow.setEnabled(true);
subscribing = false;
checkIsFollowing();
FollowingFragment.resetClaimSearchContent = true;
if (Lbry.SDK_READY) {
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).saveSharedUserState();
}
}
}
@Override
public void onError(Exception exception) {
buttonFollowUnfollow.setEnabled(true);
subscribing = false;
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});
return root;
}
private void checkIsFollowing() {
if (claim != null) {
boolean isFollowing = Lbryio.isFollowing(claim);
if (iconFollowUnfollow != null) {
iconFollowUnfollow.setText(isFollowing ? R.string.fa_heart_broken : R.string.fa_heart);
iconFollowUnfollow.setTextColor(ContextCompat.getColor(getContext(), isFollowing ? R.color.foreground : R.color.red));
}
}
}
public void onResume() {
super.onResume();
checkParams();
@ -148,6 +278,7 @@ public class ChannelFragment extends BaseFragment {
return;
}
checkIsFollowing();
layoutDisplayArea.setVisibility(View.VISIBLE);
String thumbnailUrl = claim.getThumbnailUrl();
@ -169,7 +300,14 @@ public class ChannelFragment extends BaseFragment {
textAlpha.setText(claim.getName().substring(1, 2));
}
tabPager.setAdapter(new ChannelPagerAdapter(claim, (MainActivity) getContext()));
try {
if (tabPager.getAdapter() == null) {
tabPager.setAdapter(new ChannelPagerAdapter(claim, (MainActivity) getContext()));
}
} catch (IllegalStateException ex) {
// TODO: Fix why this is happening
// pass
}
new TabLayoutMediator(tabLayout, tabPager, new TabLayoutMediator.TabConfigurationStrategy() {
@Override
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {

View file

@ -53,6 +53,7 @@ public class FollowingFragment extends BaseFragment implements
FetchSubscriptionsTask.FetchSubscriptionsHandler,
ChannelItemSelectionListener, SharedPreferences.OnSharedPreferenceChangeListener {
public static boolean resetClaimSearchContent;
private static final int SUGGESTED_PAGE_SIZE = 45;
private static final int MIN_SUGGESTED_SUBSCRIBE_COUNT = 5;
@ -353,7 +354,9 @@ public class FollowingFragment extends BaseFragment implements
} else {
fetchAndResolveChannelList();
}
fetchClaimSearchContent();
fetchClaimSearchContent(resetClaimSearchContent);
resetClaimSearchContent = false;
showSubscribedContent();
}

View file

@ -28,6 +28,7 @@ import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.google.android.material.textfield.TextInputEditText;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.List;
@ -341,13 +342,16 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
// wallet_send task
String recipientAddress = Helper.getValue(inputSendAddress.getText());
String amountString = Helper.getValue(inputSendAmount.getText());
String amount = String.valueOf(Double.valueOf(amountString));
String amount = new DecimalFormat(Helper.SDK_AMOUNT_FORMAT).format(new BigDecimal(amountString).doubleValue());
disableSendControls();
WalletSendTask task = new WalletSendTask(recipientAddress, amount, walletSendProgress, new WalletSendTask.WalletSendHandler() {
@Override
public void onSuccess() {
String message = getResources().getQuantityString(R.plurals.you_sent_credits, Double.valueOf(amount) == 1.0 ? 1 : 2, amountString);
double sentAmount = Double.valueOf(amount);
String message = getResources().getQuantityString(
R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2,
new DecimalFormat("#,###.##").format(sentAmount));
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).show();
inputSendAddress.setText(null);
inputSendAmount.setText(null);

View file

@ -39,6 +39,7 @@ public final class Helper {
public static final String METHOD_GET = "GET";
public static final String METHOD_POST = "POST";
public static final String ISO_DATE_FORMAT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS";
public static final String SDK_AMOUNT_FORMAT = "0.0#######";
public static final MediaType FORM_MEDIA_TYPE = MediaType.parse("application/x-www-form-urlencoded");
public static final MediaType JSON_MEDIA_TYPE = MediaType.get("application/json; charset=utf-8");
public static final int CONTENT_PAGE_SIZE = 25;

View file

@ -80,6 +80,7 @@ public final class Lbry {
public static final String METHOD_ADDRESS_LIST = "address_list";
public static final String METHOD_TRANSACTION_LIST = "transaction_list";
public static final String METHOD_UTXO_RELEASE = "utxo_release";
public static final String METHOD_SUPPORT_CREATE = "support_create";
public static final String METHOD_SUPPORT_ABANDON = "support_abandon";
public static final String METHOD_SYNC_HASH = "sync_hash";
public static final String METHOD_SYNC_APPLY = "sync_apply";
@ -148,7 +149,11 @@ public final class Lbry {
if (value instanceof List) {
value = Helper.jsonArrayFromList((List) value);
}
jsonParams.put(param.getKey(), value);
if (value instanceof Double) {
jsonParams.put(param.getKey(), (double) value);
} else {
jsonParams.put(param.getKey(), value);
}
}
} catch (JSONException ex) {
// pass
@ -412,7 +417,7 @@ public final class Lbry {
try {
response = parseResponse(apiCall(method, params));
} catch (LbryRequestException | LbryResponseException ex) {
throw new ApiCallException(String.format("Could not execute %s call", method), ex);
throw new ApiCallException(String.format("Could not execute %s call: %s", method, ex.getMessage()), ex);
}
return response;
}

View file

@ -293,4 +293,23 @@ public final class Lbryio {
subscriptions.remove(subscription);
}
}
public static void addCachedResolvedSubscription(Claim claim) {
synchronized (lock) {
if (!cacheResolvedSubscriptions.contains(claim)) {
cacheResolvedSubscriptions.add(claim);
}
}
}
public static void removeCachedResolvedSubscription(Claim claim) {
synchronized (lock) {
cacheResolvedSubscriptions.remove(claim);
}
}
public static boolean isFollowing(Subscription subscription) {
return subscriptions.contains(subscription);
}
public static boolean isFollowing(Claim claim) {
return subscriptions.contains(Subscription.fromClaim(claim));
}
}

View file

@ -6,452 +6,366 @@
android:layout_height="match_parent"
android:background="@color/pageBackground"
android:fitsSystemWindows="true">
<RelativeLayout
android:id="@+id/file_view_loading_state"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/file_view_loading_container"
android:visibility="gone"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ProgressBar
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical" />
<TextView
<RelativeLayout
android:id="@+id/file_view_loading_state"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/file_view_loading_container"
android:visibility="gone"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/loading_decentralized_data"
android:textSize="16sp"
android:textFontWeight="300" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_claim_display_area"
android:orientation="vertical"
android:layout_weight="10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout
android:id="@+id/file_view_media_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3.25">
<!--RelativeLayout
android:id="@+id/file_view_media_meta_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout-->
<RelativeLayout
android:id="@+id/file_view_exoplayer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/file_view_exoplayer_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.exoplayer2.ui.PlayerControlView
android:id="@+id/file_view_exoplayer_control_view"
android:layout_width="match_parent"
android:layout_centerInParent="true">
<ProgressBar
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_unsupported_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="36dp"
android:visibility="gone">
<ImageView
android:id="@+id/file_view_unsupported_gerbil"
android:src="@drawable/gerbil_happy"
android:layout_width="64dp"
android:layout_centerVertical="true"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_toRightOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_centerVertical="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/unsupported_content" />
<TextView
android:fontFamily="@font/inter"
android:text="@string/unsupported_content_desc"
android:textColor="@color/white"
android:textSize="14sp"
android:textFontWeight="300"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/loading_decentralized_data"
android:textSize="16sp"
android:textFontWeight="300" />
</LinearLayout>
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/file_view_scroll_view"
<LinearLayout
android:id="@+id/file_view_claim_display_area"
android:orientation="vertical"
android:layout_weight="10"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6.75"
android:clipToPadding="false">
<LinearLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout
android:id="@+id/file_view_media_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/file_view_title_area"
android:layout_height="0dp"
android:layout_weight="3.25">
<!--RelativeLayout
android:id="@+id/file_view_media_meta_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="4dp">
<LinearLayout
android:id="@+id/file_view_title_layout"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_height="match_parent">
</RelativeLayout-->
<RelativeLayout
android:id="@+id/file_view_exoplayer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/file_view_exoplayer_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.exoplayer2.ui.PlayerControlView
android:id="@+id/file_view_exoplayer_control_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="48dp">
<TextView
android:id="@+id/file_view_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publish_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300" />
</LinearLayout>
</LinearLayout>
android:layout_alignParentBottom="true" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_unsupported_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="36dp"
android:visibility="gone">
<ImageView
android:id="@+id/file_view_desc_toggle_arrow"
android:src="@drawable/ic_arrow_dropdown"
android:layout_toLeftOf="@+id/file_view_title_layout"
android:layout_alignParentRight="true"
android:id="@+id/file_view_unsupported_gerbil"
android:src="@drawable/gerbil_happy"
android:layout_width="64dp"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground" />
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_actions_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5">
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/file_view_action_share"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_share" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_vew_action_tip"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_gift"/>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_vew_action_repost"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_repost"/>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/repost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_edit"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone"
>
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_edit" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_delete"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_delete" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_download"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_download" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_report"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_report" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="1dp" />
<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">
<LinearLayout
android:id="@+id/file_view_publisher_name_area"
android:clickable="true"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_centerVertical="true">
<TextView
android:id="@+id/file_view_publisher_name"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/lbryGreen"
android:fontFamily="@font/inter"
android:textFontWeight="600" />
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/unsupported_content" />
<TextView
android:fontFamily="@font/inter"
android:text="@string/unsupported_content_desc"
android:textColor="@color/white"
android:textSize="14sp"
android:textFontWeight="300"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageButton
android:background="@null"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_following"
android:tint="@color/red" />
</RelativeLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="1dp" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/file_view_scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6.75"
android:clipToPadding="false">
<LinearLayout
android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:id="@+id/file_view_description"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:autoLink="all"
android:textFontWeight="300"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
<LinearLayout
android:id="@+id/file_view_tag_area"
android:orientation="horizontal"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/file_view_title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginTop="36dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_weight="2"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="4dp">
<LinearLayout
android:id="@+id/file_view_title_layout"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="48dp">
<TextView
android:id="@+id/file_view_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publish_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/file_view_desc_toggle_arrow"
android:src="@drawable/ic_arrow_dropdown"
android:layout_toLeftOf="@+id/file_view_title_layout"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground" />
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_actions_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5">
<LinearLayout
android:id="@+id/file_view_action_share"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/tags"
android:textSize="12sp"
android:textFontWeight="600" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginLeft="8dp"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_share" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_tip"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_gift"/>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_vew_action_repost"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_repost"/>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/repost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_edit"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone"
>
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_edit" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_delete"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_delete" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_download"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_download" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_report"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_report" />
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
<View
@ -460,53 +374,145 @@
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="1dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_related_content_area"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<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">
<TextView
<LinearLayout
android:id="@+id/file_view_publisher_name_area"
android:clickable="true"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_publisher_name"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/lbryGreen"
android:fontFamily="@font/inter"
android:textFontWeight="600" />
</LinearLayout>
<ImageButton
android:background="@null"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/related_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:layout_centerVertical="true" />
<ProgressBar
android:id="@+id/file_view_related_content_progress"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" />
android:src="@drawable/ic_following"
android:tint="@color/red" />
</RelativeLayout>
<TextView
android:id="@+id/file_view_no_related_content"
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="1dp" />
<LinearLayout
android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:id="@+id/file_view_description"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:autoLink="all"
android:textFontWeight="300"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
<LinearLayout
android:id="@+id/file_view_tag_area"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginTop="36dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/tags"
android:textSize="12sp"
android:textFontWeight="600" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginLeft="8dp"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="1dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_related_content_area"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_related_content"
android:textSize="14sp"
android:textFontWeight="300"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_related_content_list"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_marginBottom="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/related_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:layout_centerVertical="true" />
<ProgressBar
android:id="@+id/file_view_related_content_progress"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/file_view_no_related_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_related_content"
android:textSize="14sp"
android:textFontWeight="300"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_related_content_list"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
<include layout="@layout/floating_wallet_balance" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -19,6 +19,7 @@
<RelativeLayout
android:id="@+id/url_suggestions_container"
android:background="@color/pageBackground"
android:elevation="6dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">

View file

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/tip_send_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:fontFamily="@font/inter"
android:singleLine="true"
android:text="@string/send_a_tip"
android:textSize="20sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp" />
<RelativeLayout
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tip_input_layout_amount"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:hint="@string/amount">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tip_input_amount"
android:fontFamily="@font/inter"
android:textSize="14sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/tip_input_currency"
android:layout_toRightOf="@id/tip_input_layout_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="30dp"
android:fontFamily="@font/inter"
android:text="@string/lbc"
android:textAllCaps="true"
android:textSize="10sp"
android:textFontWeight="300" />
<LinearLayout
android:id="@+id/tip_inline_balance_container"
android:layout_toRightOf="@id/tip_input_currency"
android:layout_marginLeft="24dp"
android:layout_marginTop="28dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="18dp"
android:layout_height="18dp"
android:text="@string/fa_coins" />
<TextView
android:id="@+id/tip_inline_balance_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textFontWeight="300"
android:layout_marginLeft="2dp" />
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/tip_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:fontFamily="@font/inter"
android:text="@string/send_tip_info_content"
android:textFontWeight="300"
android:textSize="14sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tip_cancel_link"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:fontFamily="@font/inter"
android:text="@string/cancel"
android:textFontWeight="300"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/tip_send_progress"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_toLeftOf="@id/tip_send"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:visibility="gone" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tip_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -123,14 +123,95 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_actions"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/channel_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:elevation="4dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="8dp">
<RelativeLayout
android:id="@+id/channel_view_edit"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginRight="8dp"
android:visibility="gone">
<ImageView
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground"
android:src="@drawable/ic_edit" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_delete"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginRight="8dp"
android:visibility="gone">
<ImageView
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground"
android:src="@drawable/ic_delete" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_share"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginRight="8dp">
<ImageView
android:layout_centerInParent="true"
android:layout_width="22dp"
android:layout_height="22dp"
android:tint="@color/foreground"
android:src="@drawable/ic_share" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_tip"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginRight="8dp">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:text="@string/fa_gift"
android:textColor="@color/foreground"
android:textSize="20dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_follow_unfollow"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="36dp"
android:layout_height="36dp">
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/channel_view_icon_follow_unfollow"
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:text="@string/fa_heart"
android:textColor="@color/red"
android:textSize="20dp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/channel_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -32,7 +32,8 @@
<androidx.core.widget.NestedScrollView
android:id="@+id/channel_about_info_area"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginTop="48dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -42,6 +43,7 @@
android:id="@+id/channel_about_website_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
@ -60,7 +62,7 @@
</LinearLayout>
<LinearLayout
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:id="@+id/channel_about_email_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -86,7 +88,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:layout_marginTop="16dp"
android:fontFamily="@font/inter"
android:textSize="14sp"
android:textFontWeight="300" />

View file

@ -95,7 +95,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true" />
android:layout_centerHorizontal="true" />
</RelativeLayout>
<TextView

View file

@ -49,7 +49,7 @@
android:adjustViewBounds="true"
android:src="@drawable/gerbil_happy" />
<TextView
android:text="@string/sdk_initializing"
android:text="@string/sdk_still_initializing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"

View file

@ -106,7 +106,9 @@
<string name="in_your_publishes">in your publishes</string>
<string name="in_your_supports">in your supports</string>
<string name="earn_more_tips">Earn more tips by uploading cool videos</string>
<string name="sdk_initializing">The background service is still initializing. You can explore and watch content in the mean time.</string>
<string name="sdk_initializing">The background service is initializing...</string>
<string name="sdk_still_initializing">The background service is still initializing. You can explore and watch content in the mean time.</string>
<string name="sdk_initializing_functionality">You cannot do this right now because the background service is still initializing.</string>
<string name="backup_synced">A backup of your wallet is synced with lbry.tv</string>
<string name="backup_notsynced">Your wallet is not currently synced with lbry.tv. You are responsible for backing up your wallet.</string>
@ -193,6 +195,16 @@
<string name="no_followed_tags">You have not followed any tags yet. Get started by adding tags that you are interested in!</string>
<string name="no_tag_results">We could not find new tags that you\'re not following.</string>
<string name="tag_already_followed">The \'%1$s\' tag has already been added.</string>
<string name="send_a_tip">Send a tip</string>
<string name="send_a_tip_to">Send a tip to %1$s</string>
<string name="send_tip_info_content">This will appear as a tip for %1$s, which will boost its ability to be discovered while active. &lt;a href="https://lbry.com/faq/tipping"&gt;Learn more&lt;/a&gt;.</string>
<string name="send_tip_info_channel">This will appear as a tip for %1$s, which will boost the channel\'s ability to be discovered while active. &lt;a href="https://lbry.com/faq/tipping"&gt;Learn more&lt;/a&gt;.</string>
<string name="cancel">Cancel</string>
<plurals name="you_sent_a_tip">
<item quantity="one">You sent %1$s credit as a tip, Mahalo!</item>
<item quantity="other">You sent %1$s credits as a tip, Mahalo!</item>
</plurals>
<!-- Verification -->
<string name="provide_email_address">Please provide an email address.</string>
@ -223,6 +235,7 @@
<string name="fa_at">&#xf1fa;</string>
<string name="fa_heart">&#xf004;</string>
<string name="fa_heart_broken">&#xf7a9;</string>
<string name="fa_star">&#xf005;</string>
<string name="fa_globe_americas">&#xf57d;</string>
<string name="fa_upload">&#xf093;</string>