This commit is contained in:
Javi Rueda 2020-10-09 17:05:21 +02:00
commit 2c0f07031b
31 changed files with 322 additions and 117 deletions

View file

@ -11,8 +11,8 @@ An Android browser and wallet for the [LBRY](https://lbry.com) network.
## Installation ## Installation
The minimum supported Android version is 5.0 Lollipop. There are two ways to install: The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
1. Via the Google Play Store. Anyone can join the [open beta](https://play.google.com/apps/testing/io.lbry.browser) in order to install the app from the Play Store. 1. Via the F-Droid Android app. Search for LBRY and install the version you prefer.
1. Direct APK install available at [http://build.lbry.io/android/latest.apk](http://build.lbry.io/android/latest.apk). You will need to enable installation from third-party sources on your device in order to install from this source. 1. Download the LBRY file from [the F-Droid website](https://f-droid.org). Search for LBRY on F-Droid's website, it should be listed as LBRY FDroid, download the APK file and install it on your device.
## Usage ## Usage
The app can be launched by opening **LBRY** from the device's app drawer or via the shortcut on the home screen if that was created upon installation. The app can be launched by opening **LBRY** from the device's app drawer or via the shortcut on the home screen if that was created upon installation.

View file

@ -68,9 +68,9 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha01' implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.navigation:navigation-fragment:2.2.2' implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.2.2' implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.1.1'
@ -80,6 +80,7 @@ dependencies {
implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03' implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03'
implementation 'androidx.camera:camera-view:1.0.0-alpha10' implementation 'androidx.camera:camera-view:1.0.0-alpha10'
implementation 'androidx.browser:browser:1.2.0' implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.squareup.okhttp3:okhttp:4.4.1' implementation 'com.squareup.okhttp3:okhttp:4.4.1'
@ -111,10 +112,10 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
__32bitImplementation 'io.lbry:lbrysdk32:0.81.0' __32bitImplementation 'io.lbry:lbrysdk32:0.82.0'
// __64bitImplementation 'io.lbry:lbrysdk64:0.81.0' // __64bitImplementation 'io.lbry:lbrysdk64:0.82.0'
} }

View file

@ -57,6 +57,10 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<data android:scheme="https" android:host="open.lbry.com"/> <data android:scheme="https" android:host="open.lbry.com"/>
<data android:scheme="https" android:host="lbry.tv"/>
<data android:scheme="https" android:host="lbry.lat"/>
<data android:scheme="https" android:host="lbry.fr"/>
<data android:scheme="https" android:host="lbry.in"/>
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>

View file

@ -201,7 +201,6 @@ public class FirstRunActivity extends AppCompatActivity {
try { try {
writer = new BufferedWriter(new FileWriter(file)); writer = new BufferedWriter(new FileWriter(file));
writer.write(installId); writer.write(installId);
android.util.Log.d("LbryMain", "Generated install ID=" + installId);
} catch (IOException ex) { } catch (IOException ex) {
return false; return false;
} finally { } finally {

View file

@ -990,7 +990,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
fragment instanceof LibraryFragment || fragment instanceof LibraryFragment ||
fragment instanceof SearchFragment; fragment instanceof SearchFragment;
findViewById(R.id.floating_balance_main_container).setVisibility(!canShowFloatingBalance || inFullscreenMode ? View.INVISIBLE : View.VISIBLE); findViewById(R.id.floating_balance_main_container).setVisibility(!canShowFloatingBalance || inFullscreenMode ? View.INVISIBLE : View.VISIBLE);
if (!(fragment instanceof FileViewFragment) && !(fragment instanceof ShuffleFragment) && !inFullscreenMode) { if (!(fragment instanceof FileViewFragment) && !(fragment instanceof ShuffleFragment) && !inFullscreenMode && nowPlayingClaim != null) {
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE); findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
} }
/*if (!Lbry.SDK_READY && !inFullscreenMode) { /*if (!Lbry.SDK_READY && !inFullscreenMode) {
@ -2772,9 +2772,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
try { try {
LbryUri uri = LbryUri.parse(url); LbryUri uri = LbryUri.parse(url);
if (uri.isChannel()) { if (uri.isChannel()) {
openChannelUrl(url); openChannelUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
} else { } else {
openFileUrl(url); openFileUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
} }
} catch (LbryUriException ex) { } catch (LbryUriException ex) {
// pass // pass
@ -3040,6 +3040,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// TODO: Broadcast startup status changes // TODO: Broadcast startup status changes
JSONObject startupStatus = status.getJSONObject("startup_status"); JSONObject startupStatus = status.getJSONObject("startup_status");
android.util.Log.d(TAG, startupStatus.toString(2));
sdkReady = startupStatus.getBoolean("file_manager") && startupStatus.getBoolean("wallet"); sdkReady = startupStatus.getBoolean("file_manager") && startupStatus.getBoolean("wallet");
} }
} catch (ConnectException | JSONException ex) { } catch (ConnectException | JSONException ex) {

View file

@ -225,9 +225,10 @@ public class CreateSupportDialogFragment extends BottomSheetDialogFragment imple
if (!isTip) { if (!isTip) {
sendButton.setText(R.string.send_revocable_support); sendButton.setText(R.string.send_revocable_support);
} else { } else {
String amountString = Helper.getValue(inputAmount.getText()); String amountString = Helper.getValue(inputAmount.getText(), "0");
double parsedAmount = Helper.parseDouble(amountString, 0); double parsedAmount = Helper.parseDouble(amountString, 0);
sendButton.setText(parsedAmount == 0 ? getString(R.string.send_a_tip) : getString(R.string.send_lbc_tip, amountString)); String text = getResources().getQuantityString(R.plurals.send_lbc_tip, parsedAmount == 1.0 ? 1 : 2, amountString);
sendButton.setText(text);
} }
} }

View file

@ -28,6 +28,7 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
@ -1015,30 +1016,39 @@ public class FileViewFragment extends BaseFragment implements
} }
if (claim != null) { if (claim != null) {
boolean isOwnClaim = Lbry.ownClaims.contains(claim); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
if (isOwnClaim) { setTitle(R.string.delete_file).
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()). setMessage(R.string.confirm_delete_file_message)
setTitle(R.string.delete_content). .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
setMessage(R.string.confirm_delete_content_message) @Override
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) {
@Override deleteClaimFile();
public void onClick(DialogInterface dialogInterface, int i) { }
deleteCurrentClaim(); }).setNegativeButton(R.string.no, null);
} builder.show();
}).setNegativeButton(R.string.no, null); }
builder.show(); }
} else { });
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_file). root.findViewById(R.id.file_view_action_unpublish).setOnClickListener(new View.OnClickListener() {
setMessage(R.string.confirm_delete_file_message) @Override
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(View view) {
@Override if (!Lbry.SDK_READY) {
public void onClick(DialogInterface dialogInterface, int i) { Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
deleteClaimFile(); return;
} }
}).setNegativeButton(R.string.no, null);
builder.show(); if (claim != null) {
} AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_content).
setMessage(R.string.confirm_delete_content_message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
deleteCurrentClaim();
}
}).setNegativeButton(R.string.no, null);
builder.show();
} }
} }
}); });
@ -2778,10 +2788,13 @@ public class FileViewFragment extends BaseFragment implements
boolean isOwnClaim = Lbry.ownClaims.contains(claim); boolean isOwnClaim = Lbry.ownClaims.contains(claim);
View root = getView(); View root = getView();
if (root != null) { if (root != null) {
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_download), isOwnClaim ? View.GONE : View.VISIBLE);
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_report), isOwnClaim ? View.GONE : View.VISIBLE); Helper.setViewVisibility(root.findViewById(R.id.file_view_action_report), isOwnClaim ? View.GONE : View.VISIBLE);
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_edit), isOwnClaim ? View.VISIBLE : View.GONE); Helper.setViewVisibility(root.findViewById(R.id.file_view_action_edit), isOwnClaim ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_delete), isOwnClaim ? View.VISIBLE : View.GONE); Helper.setViewVisibility(root.findViewById(R.id.file_view_action_unpublish), isOwnClaim ? View.VISIBLE : View.GONE);
LinearLayout fileViewActionsArea = root.findViewById(R.id.file_view_actions_area);
fileViewActionsArea.setWeightSum(isOwnClaim ? 6 : 5);
} }
} }
} }

View file

@ -348,6 +348,10 @@ public final class Helper {
return cs != null ? cs.toString().trim() : ""; return cs != null ? cs.toString().trim() : "";
} }
public static String getValue(CharSequence cs, String defaultValue) {
return cs != null && !Helper.isNullOrEmpty(cs.toString()) ? cs.toString().trim() : defaultValue;
}
public static List<String> buildContentSortOrder(int sortBy) { public static List<String> buildContentSortOrder(int sortBy) {
List<String> sortOrder = new ArrayList<>(); List<String> sortOrder = new ArrayList<>();
switch (sortBy) { switch (sortBy) {

View file

@ -18,7 +18,7 @@ public class LbryUri {
public static final int CLAIM_ID_MAX_LENGTH = 40; public static final int CLAIM_ID_MAX_LENGTH = 40;
private static final String REGEX_PART_PROTOCOL = "^((?:lbry://|https://)?)"; private static final String REGEX_PART_PROTOCOL = "^((?:lbry://|https://)?)";
private static final String REGEX_PART_HOST = "((?:open.lbry.com/)?)"; private static final String REGEX_PART_HOST = "((?:open.lbry.com/|lbry.tv/|lbry.lat/|lbry.fr/|lbry.in/)?)";
private static final String REGEX_PART_STREAM_OR_CHANNEL_NAME = "([^:$#/]*)"; private static final String REGEX_PART_STREAM_OR_CHANNEL_NAME = "([^:$#/]*)";
private static final String REGEX_PART_MODIFIER_SEPARATOR = "([:$#]?)([^/]*)"; private static final String REGEX_PART_MODIFIER_SEPARATOR = "([:$#]?)([^/]*)";
private static final String QUERY_STRING_BREAKER = "^([\\S]+)([?][\\S]*)"; private static final String QUERY_STRING_BREAKER = "^([\\S]+)([?][\\S]*)";
@ -128,9 +128,14 @@ public class LbryUri {
boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName); boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName);
String channelName = includesChannel && streamOrChannelName.length() > 1 ? streamOrChannelName.substring(1) : null; String channelName = includesChannel && streamOrChannelName.length() > 1 ? streamOrChannelName.substring(1) : null;
// It would have thrown already on the RegEx parser if protocol value was incorrect /*
// open.lbry.com uses ':' as ModSeparators while lbry:// expects '#' * It would have thrown already on the RegEx parser if protocol value was incorrect
if (components.get(1).equals("open.lbry.com/")) { * or HTTPS host was unknown to us.
*
* [https://] hosts use ':' as ModSeparators while [lbry://] protocol expects '#'
*/
if (!components.get(1).isEmpty()) {
if (primaryModSeparator.equals(":")) if (primaryModSeparator.equals(":"))
primaryModSeparator = "#"; primaryModSeparator = "#";
if (secondaryModSeparator.equals(":")) if (secondaryModSeparator.equals(":"))

View file

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF"
android:alpha="0.8">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13L7,13v-2h10v2z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

View file

@ -72,10 +72,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible"> android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="18dp" android:layout_width="12dp"
android:layout_height="18dp" android:layout_height="12dp"
android:text="@string/fa_coins" /> android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView <TextView
android:id="@+id/wallet_inline_balance_value" android:id="@+id/wallet_inline_balance_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -62,10 +62,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible"> android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="18dp" android:layout_width="12dp"
android:layout_height="18dp" android:layout_height="12dp"
android:text="@string/fa_coins" /> android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView <TextView
android:id="@+id/inline_channel_form_inline_balance_value" android:id="@+id/inline_channel_form_inline_balance_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -103,10 +103,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible"> android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="18dp" android:layout_width="12dp"
android:layout_height="18dp" android:layout_height="12dp"
android:text="@string/fa_coins" /> android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView <TextView
android:id="@+id/create_support_inline_balance_value" android:id="@+id/create_support_inline_balance_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -158,7 +159,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:text="@string/send_lbc_tip"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" /> android:layout_centerVertical="true" />
</RelativeLayout> </RelativeLayout>

View file

@ -127,10 +127,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible"> android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="18dp" android:layout_width="12dp"
android:layout_height="18dp" android:layout_height="12dp"
android:text="@string/fa_coins" /> android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView <TextView
android:id="@+id/repost_inline_balance_value" android:id="@+id/repost_inline_balance_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -56,13 +56,11 @@
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:paddingStart="12dp" android:paddingStart="12dp"
android:paddingEnd="16dp"> android:paddingEnd="16dp">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="16dp" android:layout_width="12dp"
android:layout_height="16dp" android:layout_height="12dp"
android:textSize="10dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="@color/white" android:src="@drawable/ic_credits" />
android:text="@string/fa_coins" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -215,10 +215,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible"> android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="18dp" android:layout_width="12dp"
android:layout_height="18dp" android:layout_height="12dp"
android:text="@string/fa_coins" /> android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView <TextView
android:id="@+id/channel_form_inline_balance_value" android:id="@+id/channel_form_inline_balance_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/file_view_global_layout" android:id="@+id/file_view_global_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -83,13 +84,11 @@
android:paddingStart="6dp" android:paddingStart="6dp"
android:paddingEnd="7dp" android:paddingEnd="7dp"
android:visibility="gone"> android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="12dp" android:layout_width="12dp"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textSize="8dp" android:src="@drawable/ic_credits" />
android:text="@string/fa_coins"
android:textColor="@android:color/black" />
<TextView <TextView
android:id="@+id/file_view_fee" android:id="@+id/file_view_fee"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -433,6 +432,36 @@
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_unpublish"
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">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_unpublish" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/unpublish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/file_view_action_report" android:id="@+id/file_view_action_report"
android:clickable="true" android:clickable="true"
@ -578,52 +607,56 @@
<LinearLayout <LinearLayout
android:id="@+id/file_view_description_area" android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:id="@+id/file_view_description" android:id="@+id/file_view_description"
android:textSize="12sp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/inter" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:autoLink="all" android:autoLink="all"
android:fontFamily="@font/inter"
android:textColorLink="@color/lbryGreen" android:textColorLink="@color/lbryGreen"
android:textFontWeight="300" android:textFontWeight="300"
android:layout_marginStart="16dp" android:textSize="12sp" />
android:layout_marginEnd="16dp" />
<LinearLayout <LinearLayout
android:id="@+id/file_view_tag_area" android:id="@+id/file_view_tag_area"
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="10"
android:paddingTop="36dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"> android:layout_marginEnd="16dp"
android:layout_weight="10"
android:orientation="horizontal"
android:paddingTop="36dp">
<TextView <TextView
android:layout_weight="2"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:text="@string/tags" android:text="@string/tags"
android:textSize="12sp" android:textFontWeight="600"
android:textFontWeight="600" /> android:textSize="12sp" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list" android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginStart="8dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="8" />
</LinearLayout> </LinearLayout>
<View <View
android:background="@color/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_height="0.5dp" /> android:background="@color/divider" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -751,4 +784,5 @@
android:visibility="gone"> android:visibility="gone">
</RelativeLayout> </RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -436,10 +436,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible"> android:visibility="invisible">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="18dp" android:layout_width="12dp"
android:layout_height="18dp" android:layout_height="12dp"
android:text="@string/fa_coins" /> android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView <TextView
android:id="@+id/publish_form_inline_balance_value" android:id="@+id/publish_form_inline_balance_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -91,12 +91,11 @@
android:paddingStart="2dp" android:paddingStart="2dp"
android:paddingEnd="2dp" android:paddingEnd="2dp"
android:visibility="gone"> android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="16dp" android:layout_width="12dp"
android:layout_height="16dp" android:layout_height="12dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textSize="12dp" android:src="@drawable/ic_credits" />
android:text="@string/fa_coins" />
<TextView <TextView
android:id="@+id/claim_fee" android:id="@+id/claim_fee"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -101,13 +101,11 @@
android:paddingStart="6dp" android:paddingStart="6dp"
android:paddingEnd="7dp" android:paddingEnd="7dp"
android:visibility="gone"> android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="12dp" android:layout_width="12dp"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textSize="8dp" android:src="@drawable/ic_credits" />
android:text="@string/fa_coins"
android:textColor="@android:color/black"/>
<TextView <TextView
android:id="@+id/claim_fee" android:id="@+id/claim_fee"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -106,13 +106,11 @@
android:paddingStart="6dp" android:paddingStart="6dp"
android:paddingEnd="7dp" android:paddingEnd="7dp"
android:visibility="gone"> android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView <ImageView
android:layout_width="12dp" android:layout_width="12dp"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textSize="8dp" android:src="@drawable/ic_credits" />
android:text="@string/fa_coins"
android:textColor="@android:color/black"/>
<TextView <TextView
android:id="@+id/claim_fee" android:id="@+id/claim_fee"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -208,7 +208,7 @@
<string name="cca_nc_nd_4_0_international">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International</string> <string name="cca_nc_nd_4_0_international">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International</string>
<string-array name="publish_currencies"> <string-array name="publish_currencies">
<item>LBC</item> <item>LBRY Credits</item>
<item>USD</item> <item>USD</item>
</string-array> </string-array>
@ -227,7 +227,7 @@
<string name="oops_something_went_wrong">Oops! Something went wrong.</string> <string name="oops_something_went_wrong">Oops! Something went wrong.</string>
<string name="installation_id_loaded">Loaded Installation ID.</string> <string name="installation_id_loaded">Loaded Installation ID.</string>
<string name="known_tags_loaded">Loaded local known and followed tags.</string> <string name="known_tags_loaded">Loaded local known and followed tags.</string>
<string name="exchange_rate_loaded">Loaded LBC/USD exchange rate.</string> <string name="exchange_rate_loaded">Loaded LBRY Credits/USD exchange rate.</string>
<string name="user_authenticated">User authenticated.</string> <string name="user_authenticated">User authenticated.</string>
<string name="installation_registered">Installation registered.</string> <string name="installation_registered">Installation registered.</string>
<string name="subscriptions_loaded">Loaded subscriptions.</string> <string name="subscriptions_loaded">Loaded subscriptions.</string>
@ -298,6 +298,7 @@
<string name="receive">Receive</string> <string name="receive">Receive</string>
<string name="spend">Spend</string> <string name="spend">Spend</string>
<string name="publish">Publish</string> <string name="publish">Publish</string>
<string name="unpublish">Unpublish</string>
<string name="support">Support</string> <string name="support">Support</string>
<string name="abandon">Abandon</string> <string name="abandon">Abandon</string>
<string name="channel">Channel</string> <string name="channel">Channel</string>
@ -313,7 +314,7 @@
<string name="manual_backup">&lt;a href="https://lbry.com/faq/how-to-backup-wallet#android"&gt;Manual backup&lt;/a&gt;</string> <string name="manual_backup">&lt;a href="https://lbry.com/faq/how-to-backup-wallet#android"&gt;Manual backup&lt;/a&gt;</string>
<string name="sync_faq">&lt;a href="https://lbry.com/faq/how-to-backup-wallet#sync"&gt;Sync FAQ&lt;/a&gt;</string> <string name="sync_faq">&lt;a href="https://lbry.com/faq/how-to-backup-wallet#sync"&gt;Sync FAQ&lt;/a&gt;</string>
<string name="zero">0</string> <string name="zero">0</string>
<string name="lbc">LBC</string> <string name="lbc" translatable="false">Credits</string>
<string name="account_recommended">Account Recommended</string> <string name="account_recommended">Account Recommended</string>
<string name="wallet_account_desc">A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.</string> <string name="wallet_account_desc">A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.</string>
@ -337,7 +338,7 @@
<string name="confirm_unlock_tips">Are you sure you want to unlock all your tips?</string> <string name="confirm_unlock_tips">Are you sure you want to unlock all your tips?</string>
<string name="min_spend_required">Please enter an amount more than 0.0001 credits.</string> <string name="min_spend_required">Please enter an amount more than 0.0001 credits.</string>
<string name="buy_lbc">Buy LBC</string> <string name="buy_lbc">Buy LBRY Credits</string>
<string name="hash_not_supported">Your device does not support the minimum requirements for securing your purchase request.</string> <string name="hash_not_supported">Your device does not support the minimum requirements for securing your purchase request.</string>
<string name="receive_address_not_set">You do not have a wallet address set. Please generate a new address and try again.</string> <string name="receive_address_not_set">You do not have a wallet address set. Please generate a new address and try again.</string>
@ -381,7 +382,10 @@
<string name="channel_to_show_support_as">Channel to show support as</string> <string name="channel_to_show_support_as">Channel to show support as</string>
<string name="make_this_a_tip">Make this a tip</string> <string name="make_this_a_tip">Make this a tip</string>
<string name="send_revocable_support">Send Revocable Support</string> <string name="send_revocable_support">Send Revocable Support</string>
<string name="send_lbc_tip">Send a %1$s LBC Tip</string> <plurals name="send_lbc_tip">
<item quantity="one">Tip %1$s Credit</item>
<item quantity="other">Tip %1$s Credits</item>
</plurals>
<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_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="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> <string name="cancel">Cancel</string>
@ -464,7 +468,7 @@
<string name="title">Title</string> <string name="title">Title</string>
<string name="at">\@</string> <string name="at">\@</string>
<string name="deposit">Deposit</string> <string name="deposit">Deposit</string>
<string name="deposit_remains_yours">This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.</string> <string name="deposit_remains_yours">The credits remains yours. It is a deposit to reserve the name and can be undone at any time.</string>
<string name="storage_permission_rationale_download">LBRY requires access to download content to your device.</string> <string name="storage_permission_rationale_download">LBRY requires access to download content to your device.</string>
<string name="storage_permission_rationale_images">LBRY requires access to load images from your device storage.</string> <string name="storage_permission_rationale_images">LBRY requires access to load images from your device storage.</string>
<string name="select_thumbnail">Select thumbnail</string> <string name="select_thumbnail">Select thumbnail</string>
@ -498,7 +502,7 @@
</plurals> </plurals>
<!-- Rewards --> <!-- Rewards -->
<string name="lbry_credits_allow">LBRY credits allow you to publish or purchase content.</string> <string name="lbry_credits_allow">LBRY Credits allow you to publish or purchase content.</string>
<string name="free_credits_worth">You can obtain free credits worth $%1$s after you provide an email address.</string> <string name="free_credits_worth">You can obtain free credits worth $%1$s after you provide an email address.</string>
<string name="rewards_learn_more">&lt;a href="https://lbry.com/faq/earn-credits"&gt;Learn more&lt;/a&gt;.</string> <string name="rewards_learn_more">&lt;a href="https://lbry.com/faq/earn-credits"&gt;Learn more&lt;/a&gt;.</string>
<string name="get_started">Get started</string> <string name="get_started">Get started</string>

View file

@ -0,0 +1,130 @@
package io.lbry.browser.utils;
import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Test;
import io.lbry.browser.exceptions.LbryUriException;
import static org.junit.Assert.assertEquals;
public class LbryUriTest {
private LbryUri expected;
/*
* Create an LbryUri object and assign fields manually using class methods. This object will be
* compared with LbryUri.parse() returned object on each test.
*/
@Before
public void createExpected() {
expected = new LbryUri();
expected.setChannelName("@lbry");
expected.setStreamName("lbryturns4");
try {
LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "3f");
LbryUri.UriModifier secondaryMod = LbryUri.UriModifier.parse("#", "6");
expected.setChannelClaimId(primaryMod.getClaimId());
expected.setStreamClaimId(secondaryMod.getClaimId());
} catch (LbryUriException e) {
e.printStackTrace();
}
}
@Test
public void parseOpenLbryComWithChannel() {
LbryUri obtained = new LbryUri();
try {
obtained = LbryUri.parse("https://open.lbry.com/@lbry:3f/lbryturns4:6",false);
} catch (LbryUriException e) {
e.printStackTrace();
}
assertEquals(expected, obtained);
}
@Test
public void parseLbryTvWithChannel() {
LbryUri obtained = new LbryUri();
try {
obtained = LbryUri.parse("https://lbry.tv/@lbry:3f/lbryturns4:6",false);
} catch (LbryUriException e) {
e.printStackTrace();
}
assertEquals(expected, obtained);
}
@Test
public void parseLbryAlterWithChannel() {
LbryUri obtained = new LbryUri();
try {
obtained = LbryUri.parse("https://lbry.lat/@lbry:3f/lbryturns4:6",false);
} catch (LbryUriException e) {
e.printStackTrace();
}
assertEquals(expected, obtained);
}
@Test
public void parseLbryProtocolWithChannel() {
LbryUri obtained = new LbryUri();
try {
obtained = LbryUri.parse("lbry://@lbry#3f/lbryturns4#6",false);
} catch (LbryUriException e) {
e.printStackTrace();
}
assertEquals(expected, obtained);
}
@Test
public void parseLbryProtocolOnlyChannel() {
LbryUri expectedForChannel = sinthesizeExpected();
LbryUri obtained = new LbryUri();
try {
obtained = LbryUri.parse("lbry://@UCBerkeley#d",false);
} catch (LbryUriException e) {
e.printStackTrace();
}
assertEquals(expectedForChannel, obtained);
}
@Test
public void parseLbryTvProtocolOnlyChannel() {
LbryUri expectedForChannel = sinthesizeExpected();
LbryUri obtained = new LbryUri();
try {
obtained = LbryUri.parse("https://lbry.tv/@UCBerkeley:d",false);
} catch (LbryUriException e) {
e.printStackTrace();
}
assertEquals(expectedForChannel, obtained);
}
@NotNull
private LbryUri sinthesizeExpected() {
LbryUri expectedForChannel = new LbryUri();
expectedForChannel.setChannelName("@UCBerkeley");
expectedForChannel.setChannel(true);
try {
LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "d");
expectedForChannel.setChannelClaimId(primaryMod.getClaimId());
} catch (LbryUriException e) {
e.printStackTrace();
}
return expectedForChannel;
}
}