Compare commits

..
80 Commits
Author SHA1 Message Date
Akinwale Ariwodola fb560f8f01 fix last resource build error 2020-12-29 07:20:46 +01:00
Akinwale Ariwodola ef80c9f7fd fix resource build error 2020-12-29 07:13:57 +01:00
Akinwale Ariwodola 99a4a0a22f Remove comment post confirmation. Fix resources build error. 2020-12-29 07:07:53 +01:00
Akinwale Ariwodola 136853853a bumpversion 0.16.11 --> 0.16.12 2020-12-29 07:02:13 +01:00
Akinwale Ariwodola ebf3299c30 add scrollbars attribute to listview 2020-12-29 07:00:45 +01:00
Akinwale Ariwodola 036b49a871 Merge pull request #1097 from kekkyojin/remove_stages_scrollbar
Avoid showing vertical scroll bar on stage error listview
2020-12-29 07:00:02 +01:00
Akinwale Ariwodola 67d5f88d34 Merge pull request #1100 from clay53/master
Changed wallet send notification to accept 4 digit decimal
2020-12-29 06:52:16 +01:00
Akinwale Ariwodola b1e0b9af33 sdk 0.87.0. Show confirmation for unfollow. 2020-12-29 06:47:10 +01:00
Clayton Hickey c30b012787 Changed wallet send notification to accept 4 digit decimal 2020-12-27 03:54:36 -05:00
Javi Rueda c8c6305757 Avoid showing vertical scroll bar on stage error listview 2020-12-22 02:26:37 +01:00
Akinwale Ariwodola ee1d090e62 Merge pull request #1068 from kekkyojin/fix-lintproblems
Some fixes for lint
2020-12-21 19:43:08 +01:00
Javi Rueda 9e56a86492 Some fixes for lint 2020-12-18 14:30:48 +01:00
Akinwale Ariwodola e6b83877f1 Merge pull request #1063 from clay53/1042
Removed comment tips
2020-12-18 13:01:49 +01:00
Akinwale Ariwodola b567e39aef Merge pull request #1069 from kekkyojin/add-twitter-instructions
Provide instructions to add dummy Twitter API credentials
2020-12-18 12:22:03 +01:00
Akinwale Ariwodola ae62dba0a6 Merge pull request #1071 from kekkyojin/sha256-unittest
Add unit test for Helper.SHA256(String)
2020-12-18 12:21:39 +01:00
Akinwale Ariwodola df1e8abf50 Merge pull request #1067 from kekkyojin/use-apache-hex
Replace Hex class from GMS with the one from Apache
2020-12-18 12:20:42 +01:00
Javi Rueda 31cfb26c3b Add unit test for Helper.SHA256(String) 2020-12-15 13:45:32 +01:00
Javi Rueda e5f34dc464 Provide instructions to add dummy Twitter API credentials 2020-12-14 20:38:57 +01:00
Javi Rueda 601031e55d Replace Hex class from GMS with the one from Apache 2020-12-14 18:17:13 +01:00
Akinwale Ariwodola a9aadbe6a8 bumpversion 0.16.10 --> 0.16.11 2020-12-13 18:08:10 +01:00
Akinwale Ariwodola f9a4b71037 fix crash error when following doesn't exist in shared user state 2020-12-13 18:07:19 +01:00
Clayton Hickey 0f10e9dc1f Removed comment tips 2020-12-12 20:11:00 -05:00
Akinwale Ariwodola 0647deb06c Merge pull request #1061 from kekkyojin/startupstage-listview
Use ListView to show startup stage errors
2020-12-12 23:16:17 +01:00
Akinwale Ariwodola b2f5fec293 make the channel filter name alphabet uppercase 2020-12-10 09:57:27 +01:00
Javi Rueda daf4e5aca2 Use ListView to show startup stage errors 2020-12-09 21:05:21 +01:00
Akinwale Ariwodola c1324efb41 bumpversion 0.16.9 --> 0.16.10 2020-12-09 11:47:58 +01:00
Akinwale Ariwodola 6221de2d3c sync notificationsDisabled states for followed channels 2020-12-09 11:31:13 +01:00
Akinwale Ariwodola 983bc68af2 Merge branch 'master' of https://github.com/lbryio/lbry-android 2020-12-09 11:00:25 +01:00
Akinwale Ariwodola f1b167693d SDK 0.86.1. is_seen vs is_read swap. Fix error condition where wallet sync starts if the wallet is not ready. 2020-12-09 10:59:25 +01:00
Akinwale Ariwodola 68ac64b534 Merge pull request #1057 from kekkyojin/sort-commentreplies
Sort replies from oldest to newest
2020-12-05 04:32:41 +01:00
Javi Rueda 6819ae46f9 Sort replies from oldest to newest 2020-12-01 04:58:48 +01:00
Akinwale Ariwodola 6c406c5a85 share_usage_data setting 2020-11-29 05:07:54 +01:00
Akinwale Ariwodola c179243d22 update dependencies 2020-11-26 00:04:37 +01:00
Akinwale Ariwodola d0f5504c80 LbryUri parsing improvements. Remove duplicate code. 2020-11-15 09:11:50 +01:00
Akinwale Ariwodola 896c566a02 Merge pull request #1045 from kekkyojin/open-file-external
Offer opening unsupported filetypes with external app
2020-11-13 15:42:59 +01:00
Javi Rueda da9352cc68 Offer opening unsupported filetypes with external app 2020-10-27 14:28:15 +01:00
Akinwale Ariwodola b8d2375e20 Merge pull request #1044 from ycohen-dev/fix_issue_1043
Fix floating wallet/rewards bar for RTL layout
2020-10-23 13:25:07 +01:00
Akinwale Ariwodola dd52ff9d07 Merge pull request #1033 from kekkyojin/md-text-rendering
Fix for text not rendering after # in markdown
2020-10-23 13:23:15 +01:00
yuval d9891f8a8a Floating wallet balance/rewards now visible in RTL layout
(Fix issue #1043)
2020-10-22 22:22:44 +03:00
Akinwale Ariwodola ea5fe6842d Merge pull request #1041 from ycohen-dev/fix_issue_1040
fix issue 1040
2020-10-21 00:15:36 +01:00
Akinwale Ariwodola fc649187df Merge pull request #1039 from ycohen-dev/fix_issue_1038
fix issue 1038
2020-10-21 00:14:15 +01:00
yuval b0f7c41885 fix issue 1040
Transaction amount text Direction changed to LTR.
Transaction amount pinned to end of view
2020-10-17 22:18:14 +03:00
yuval 45935717c8 fix issue 1038
Replaced gravity pinning to "end" instead of "right"
Pinned claim id which could be in rtl and ltr scripts to the start of the layout
2020-10-16 23:40:28 +03:00
Akinwale Ariwodola ac5e666369 bumpversion 0.16.8 --> 0.16.9 2020-10-16 06:58:57 +01:00
Akinwale Ariwodola ffeb72a383 Publish mature tags. String resource updates. 2020-10-16 06:53:08 +01:00
Akinwale Ariwodola 0ec09d751c Merge pull request #1036 from ycohen-dev/fix_issue_1034
Fix issue #1034
2020-10-16 06:39:45 +01:00
Akinwale Ariwodola b8e4fcff92 Merge pull request #1037 from lbryio/follow-text
add follow text beside follow icon
2020-10-16 06:37:50 +01:00
Akinwale Ariwodola b79f0f4820 add follow text beside follow icon 2020-10-16 06:36:36 +01:00
yuval a1cd58a214 Fix issue #1034
Hide notifications when entering PiP mode
2020-10-16 00:11:08 +03:00
Javi Rueda cfca8facbe Use '%23' instead of '#' when rendering #hashtag style text from markdown 2020-10-15 01:49:53 +02:00
Akinwale Ariwodola 066a0a099c Merge pull request #1032 from lbryio/wallet-balance-page
use credits icon on wallet balance page
2020-10-14 15:33:25 +01:00
Akinwale Ariwodola afeee2e5df use credits icon on wallet balance page 2020-10-14 15:30:59 +01:00
Akinwale Ariwodola 76036acfc7 Merge branch 'master' of https://github.com/lbryio/lbry-android 2020-10-14 15:17:35 +01:00
Akinwale Ariwodola 897bfdaffd fix build error 2020-10-14 15:16:45 +01:00
Akinwale Ariwodola 7475ae323c Merge pull request #1031 from ycohen-dev/fix_issue_1030
Fix issue #1030
2020-10-14 15:12:34 +01:00
Akinwale Ariwodola faf7f3ccbf make credits translatable 2020-10-14 15:11:36 +01:00
Akinwale Ariwodola 4940d1ca33 Merge branch 'master' of https://github.com/lbryio/lbry-android 2020-10-14 15:10:25 +01:00
Akinwale Ariwodola 3d48fa5741 also check pending when checking if item is a placeholder 2020-10-14 15:09:59 +01:00
yuval f9887cffae Fix issue #1030
Dismiss all active dialog fragment when entering PiP mode
So that PiP window contain the video only
2020-10-13 23:17:58 +03:00
Akinwale Ariwodola 6644907665 Merge pull request #1027 from ycohen-dev/fix_issue_1025
Fix issue #1025
2020-10-12 19:25:48 +01:00
Akinwale Ariwodola 5f850685d6 bumpversion 0.16.7 --> 0.16.8 2020-10-12 11:48:24 +01:00
Akinwale Ariwodola 5f9674e49c do not open lbry.*/$/verify links in the app 2020-10-12 11:47:45 +01:00
yuval 0d185c6db3 Fix issue #1025
Increased size of currency selection spinner in publish form fragment
Now spinner is in proper size to display "LBRY Credits" default value
2020-10-10 16:58:29 +03:00
Akinwale Ariwodola 53d22dd22d remove debug logs 2020-10-09 07:43:38 +01:00
Akinwale Ariwodola ff8ffda3c6 bumpversion 0.16.6 --> 0.16.7 2020-10-09 07:39:46 +01:00
Akinwale Ariwodola 64bd540322 In-app notification options (#1023)
* pull-down to refresh in-app notifications
* support deleting notifications
2020-10-09 07:38:47 +01:00
Akinwale Ariwodola 919f9a48f3 Merge pull request #1022 from lbryio/bell-icon
per-channel subscribe notification toggle
2020-10-09 06:58:08 +01:00
Akinwale Ariwodola 746d442051 per-channel subscribe notification toggle 2020-10-09 06:56:13 +01:00
Akinwale Ariwodola 1877b75188 fix strings.xml 2020-10-06 07:14:42 +01:00
Akinwale Ariwodola 6e8c38cace update module versions 2020-10-05 16:56:17 +01:00
Akinwale Ariwodola eab7bab267 Credits icon (#1021)
* new credits icon
* remove references to LBC
2020-10-05 16:50:39 +01:00
Akinwale Ariwodola aab648c3cf Fix errors with deep link handling (#1019) 2020-10-02 12:39:37 +01:00
Javi Rueda f79ff509bd Support some lbry hosts to deep links. Add unit tests (#1008)
* Support lbry.tv and other supported hosts for deep links. Add unit tests for LbryUri parse() method
* add unit test for lbry protocol schema
* Add unit test for lbry.tv deep-link with only channel
2020-10-02 12:34:38 +01:00
Akinwale Ariwodola 1197e990ca cleanup debug logging 2020-10-02 12:09:33 +01:00
Akinwale Ariwodola dce1c0715e move Unpublish button 2020-10-02 12:08:33 +01:00
Akinwale Ariwodola 6a0263c5bc Merge pull request #1013 from clay53/987
Add ability to download & delete your own videos and move unpublish button to description
2020-10-02 11:05:44 +01:00
Akinwale Ariwodola ca64db0499 sdk 0.82.0 2020-10-01 12:42:48 +01:00
Akinwale Ariwodola a5d4eda4d1 bumpversion 0.16.5 --> 0.16.6 2020-09-25 14:45:48 +01:00
Akinwale Ariwodola 5d210961c1 apply mature filter to Editor's Choice 2020-09-25 14:41:40 +01:00
Clayton Hickey 39a289e7f1 Add ability to download & delete your own videos and move unpublish button to description 2020-09-16 14:31:03 -04:00
83 changed files with 1851 additions and 926 deletions

No files matched your search

+11 -1
View File
@@ -18,7 +18,17 @@ The minimum supported Android version is 5.0 Lollipop. There are two ways to ins
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.
## Running from Source
Clone the repository and open the project in Android Studio. Android Studio will automatically run the initial build process. Click the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
Clone the repository and open the project in Android Studio. Android Studio will automatically run the initial build process.
Create file 'twitter.properties' in app/ folder with the following content:
```
twitterConsumerKey=XXXXXX
twitterConsumerSecret=XXXXXX
```
Click the Sync button and when process finishes, the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
## Contributing
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing
+16 -14
View File
@@ -16,8 +16,8 @@ android {
applicationId "io.lbry.browser"
minSdkVersion 21
targetSdkVersion 29
versionCode 1605
versionName "0.16.5"
versionCode 1612
versionName "0.16.12"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -80,27 +80,28 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment:2.3.1'
implementation 'androidx.navigation:navigation-ui:2.3.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.webkit:webkit:1.3.0-alpha03'
implementation 'androidx.webkit:webkit:1.4.0-rc01'
implementation 'androidx.camera:camera-core:1.0.0-beta03'
implementation 'androidx.camera:camera-camera2:1.0.0-beta03'
implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03'
implementation 'androidx.camera:camera-view:1.0.0-alpha10'
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.squareup.okhttp3:okhttp:4.4.1'
implementation 'com.google.firebase:firebase-analytics:17.4.2'
implementation 'com.google.android.gms:play-services-base:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.google.android.gms:play-services-base:17.5.0'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.oauth-client:google-oauth-client:1.30.4'
implementation 'com.android.billingclient:billing:3.0.0'
implementation 'com.android.billingclient:billing:3.0.2'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
@@ -118,6 +119,7 @@ dependencies {
implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.3.1.LTS'
implementation 'commons-codec:commons-codec:1.15'
implementation 'org.bitcoinj:bitcoinj-tools:0.14.7'
implementation 'org.java-websocket:Java-WebSocket:1.5.1'
@@ -126,11 +128,11 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
__32bitImplementation 'io.lbry:lbrysdk32:0.81.0'
__64bitImplementation 'io.lbry:lbrysdk64:0.81.0'
__32bitImplementation 'io.lbry:lbrysdk32:0.87.0'
__64bitImplementation 'io.lbry:lbrysdk64:0.87.0'
}
apply plugin: 'com.google.gms.google-services'
+12
View File
@@ -68,6 +68,18 @@
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" android:host="open.lbry.com"/>
<data android:scheme="https" android:host="lbry.tv" android:pathPattern="/..*/*" />
<data android:scheme="https" android:host="lbry.tv" android:pathPattern="/.*:.*" />
<data android:scheme="https" android:host="lbry.tv" android:pathPattern="/.*#.*" />
<data android:scheme="https" android:host="lbry.lat" android:pathPattern="/..*/*" />
<data android:scheme="https" android:host="lbry.lat" android:pathPattern="/.*:.*" />
<data android:scheme="https" android:host="lbry.lat" android:pathPattern="/.*#.*" />
<data android:scheme="https" android:host="lbry.fr" android:pathPattern="/..*/*" />
<data android:scheme="https" android:host="lbry.fr" android:pathPattern="/.*:.*" />
<data android:scheme="https" android:host="lbry.fr" android:pathPattern="/.*#.*" />
<data android:scheme="https" android:host="lbry.in" android:pathPattern="/..*/*" />
<data android:scheme="https" android:host="lbry.in" android:pathPattern="/.*:.*" />
<data android:scheme="https" android:host="lbry.in" android:pathPattern="/.*#.*" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@@ -201,7 +201,6 @@ public class FirstRunActivity extends AppCompatActivity {
try {
writer = new BufferedWriter(new FileWriter(file));
writer.write(installId);
android.util.Log.d("LbryMain", "Generated install ID=" + installId);
} catch (IOException ex) {
return false;
} finally {
@@ -100,7 +100,7 @@ public class LbrynetMessagingService extends FirebaseMessagingService {
@Override
public void onNewToken(String token) {
Log.d(TAG, "Refreshed token: " + token);
//Log.d(TAG, "Refreshed token: " + token);
// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
@@ -11,6 +11,7 @@ import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
@@ -36,14 +37,17 @@ import android.text.style.TypefaceSpan;
import android.util.Base64;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.view.Menu;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@@ -68,14 +72,15 @@ import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.firebase.messaging.FirebaseMessaging;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.view.ActionMode;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationCompat;
@@ -88,6 +93,7 @@ import androidx.core.view.GravityCompat;
import androidx.core.view.OnApplyWindowInsetsListener;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@@ -98,9 +104,11 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -108,7 +116,9 @@ import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.ConnectException;
import java.net.URI;
import java.text.DecimalFormat;
@@ -129,6 +139,7 @@ import javax.net.ssl.SSLParameters;
import io.lbry.browser.adapter.NavigationMenuAdapter;
import io.lbry.browser.adapter.NotificationListAdapter;
import io.lbry.browser.adapter.StartupStageAdapter;
import io.lbry.browser.adapter.UrlSuggestionListAdapter;
import io.lbry.browser.data.DatabaseHelper;
import io.lbry.browser.dialog.ContentScopeDialogFragment;
@@ -142,11 +153,13 @@ import io.lbry.browser.listener.FilePickerListener;
import io.lbry.browser.listener.PIPModeListener;
import io.lbry.browser.listener.ScreenOrientationListener;
import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.SelectionModeListener;
import io.lbry.browser.listener.StoragePermissionListener;
import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.ClaimCacheKey;
import io.lbry.browser.model.NavMenuItem;
import io.lbry.browser.model.StartupStage;
import io.lbry.browser.model.Tag;
import io.lbry.browser.model.UrlSuggestion;
import io.lbry.browser.model.WalletBalance;
@@ -165,6 +178,7 @@ import io.lbry.browser.tasks.lbryinc.FetchRewardsTask;
import io.lbry.browser.tasks.LighthouseAutoCompleteTask;
import io.lbry.browser.tasks.MergeSubscriptionsTask;
import io.lbry.browser.tasks.claim.ResolveTask;
import io.lbry.browser.tasks.lbryinc.NotificationDeleteTask;
import io.lbry.browser.tasks.lbryinc.NotificationListTask;
import io.lbry.browser.tasks.lbryinc.NotificationUpdateTask;
import io.lbry.browser.tasks.localdata.FetchRecentUrlHistoryTask;
@@ -209,7 +223,11 @@ import lombok.Setter;
import lombok.SneakyThrows;
import okhttp3.OkHttpClient;
public class MainActivity extends AppCompatActivity implements SdkStatusListener, SharedPreferences.OnSharedPreferenceChangeListener {
import static android.os.Build.VERSION_CODES.M;
public class MainActivity extends AppCompatActivity implements SdkStatusListener,
SharedPreferences.OnSharedPreferenceChangeListener,
ActionMode.Callback, SelectionModeListener {
private static final String CHANNEL_ID_PLAYBACK = "io.lbry.browser.LBRY_PLAYBACK_CHANNEL";
private static final int PLAYBACK_NOTIFICATION_ID = 3;
private static final String SPECIAL_URL_PREFIX = "lbry://?";
@@ -244,6 +262,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static boolean startingPermissionRequest = false;
public static boolean startingSignInFlowActivity = false;
private ActionMode actionMode;
private BillingClient billingClient;
@Getter
private boolean enteringPIPMode = false;
@@ -329,6 +348,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static final String PREFERENCE_KEY_KEEP_SDK_BACKGROUND = "io.lbry.browser.preference.other.KeepSdkInBackground";
public static final String PREFERENCE_KEY_PARTICIPATE_DATA_NETWORK = "io.lbry.browser.preference.other.ParticipateInDataNetwork";
public static final String PREFERENCE_KEY_SEND_BUFFERING_EVENTS = "io.lbry.browser.preference.other.SendBufferingEvents";
public static final String PREFERENCE_KEY_SHARE_USAGE_DATA = "io.lbry.browser.preference.other.ShareUsageData";
// Internal flags / setting preferences
public static final String PREFERENCE_KEY_INTERNAL_SKIP_WALLET_ACCOUNT = "io.lbry.browser.preference.internal.WalletSkipAccount";
@@ -366,6 +386,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
private MediaSessionCompat mediaSession;
private boolean receivedStopService;
private ActionBarDrawerToggle toggle;
private SwipeRefreshLayout notificationsSwipeContainer;
private SyncSetTask syncSetTask = null;
private List<WalletSync> pendingSyncSetQueue;
@Getter
@@ -417,21 +438,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
initKeyStore();
loadAuthToken();
if (!isDarkMode()) {
if (Build.VERSION.SDK_INT >= M && !isDarkMode()) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
initSpecialRouteMap();
LbryAnalytics.init(this);
try {
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(Task<InstanceIdResult> task) {
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
return;
}
// Get new Instance ID token
firebaseMessagingToken = task.getResult().getToken();
firebaseMessagingToken = task.getResult();
}
});
} catch (IllegalStateException ex) {
@@ -503,7 +523,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// setup uri bar
setupUriBar();
initNotificationsPage();
loadUnreadNotificationsCount();
loadUnseenNotificationsCount();
// other
pendingSyncSetQueue = new ArrayList<>();
@@ -581,6 +601,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
});
notificationsSwipeContainer = findViewById(R.id.notifications_list_swipe_container);
notificationsSwipeContainer.setColorSchemeResources(R.color.nextLbryGreen);
notificationsSwipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
notificationsSwipeContainer.setRefreshing(true);
loadRemoteNotifications(false);
}
});
findViewById(R.id.global_now_playing_card).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -1010,7 +1040,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
//findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(true);
hideNotifications();
hideActionBar();
dismissActiveDialogs();
for (PIPModeListener listener : pipModeListeners) {
listener.onEnterPIPMode();
@@ -1023,6 +1055,15 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
pipPlayerContainer.setVisibility(View.VISIBLE);
playerReassigned = true;
}
private void dismissActiveDialogs() {
for( Fragment fragment: getSupportFragmentManager().getFragments() ){
if (fragment instanceof DialogFragment){
((DialogFragment) fragment).dismiss();
}
}
}
private void renderFullMode() {
if (!inFullscreenMode) {
showActionBar();
@@ -1041,7 +1082,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
fragment instanceof LibraryFragment ||
fragment instanceof SearchFragment;
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);
}
/*if (!Lbry.SDK_READY && !inFullscreenMode) {
@@ -1278,7 +1319,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
private void toggleUrlSuggestions(boolean visible) {
View container = findViewById(R.id.url_suggestions_container);
View closeIcon = findViewById(R.id.wunderbar_close);
EditText wunderbar = findViewById(R.id.wunderbar);
//EditText wunderbar = findViewById(R.id.wunderbar);
//wunderbar.setPadding(0, 0, visible ? getScaledValue(36) : 0, 0);
container.setVisibility(visible ? View.VISIBLE : View.GONE);
@@ -1791,6 +1832,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
//findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
checkAndEnableShareUsageData();
scheduleWalletBalanceUpdate();
scheduleWalletSyncTask();
@@ -1825,17 +1867,13 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
new DecimalFormat(Helper.LBC_CURRENCY_FORMAT_PATTERN).format(amountClaimed));
}
Snackbar.make(findViewById(R.id.content_main), message, Snackbar.LENGTH_LONG).show();
if (sp != null) {
sp.edit().putBoolean(PREFERENCE_KEY_INTERNAL_NEW_ANDROID_REWARD_CLAIMED, true).apply();
}
sp.edit().putBoolean(PREFERENCE_KEY_INTERNAL_NEW_ANDROID_REWARD_CLAIMED, true).apply();
}
@Override
public void onError(Exception error) {
// pass. fail silently
if (sp != null) {
sp.edit().putBoolean(PREFERENCE_KEY_INTERNAL_NEW_ANDROID_REWARD_CLAIMED, true).apply();
}
sp.edit().putBoolean(PREFERENCE_KEY_INTERNAL_NEW_ANDROID_REWARD_CLAIMED, true).apply();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -1874,6 +1912,103 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
}
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
this.actionMode = mode;
if (isDarkMode()) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
actionMode.getMenuInflater().inflate(R.menu.menu_notification, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return true;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if (R.id.action_delete == item.getItemId()) {
if (notificationListAdapter != null && notificationListAdapter.getSelectedCount() > 0) {
final List<LbryNotification> selectedNotifications = new ArrayList<>(notificationListAdapter.getSelectedItems());
String message = getResources().getQuantityString(R.plurals.confirm_delete_notifications, selectedNotifications.size());
AlertDialog.Builder builder = new AlertDialog.Builder(this).
setTitle(R.string.delete_selection).
setMessage(message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
handleDeleteSelectedNotifications(selectedNotifications);
}
}).setNegativeButton(R.string.no, null);
builder.show();
return true;
}
}
return false;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
if (notificationListAdapter != null) {
notificationListAdapter.clearSelectedItems();
notificationListAdapter.setInSelectionMode(false);
notificationListAdapter.notifyDataSetChanged();
}
if (Build.VERSION.SDK_INT >= M && isDarkMode()) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
this.actionMode = null;
}
@Override
public void onEnterSelectionMode() {
startSupportActionMode(this);
}
@Override
public void onExitSelectionMode() {
if (actionMode != null) {
actionMode.finish();
}
}
@Override
public void onItemSelectionToggled() {
if (actionMode != null) {
actionMode.setTitle(notificationListAdapter != null ? String.valueOf(notificationListAdapter.getSelectedCount()) : "");
actionMode.invalidate();
}
}
private void handleDeleteSelectedNotifications(List<LbryNotification> notifications) {
List<Long> remoteIds = new ArrayList<>();
for (LbryNotification notification : notifications) {
remoteIds.add(notification.getRemoteId());
}
(new AsyncTask<Void, Void, Void>() {
protected Void doInBackground(Void... params) {
try {
SQLiteDatabase db = dbHelper.getWritableDatabase();
DatabaseHelper.deleteNotifications(notifications, db);
} catch (Exception ex) {
// pass
}
return null;
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new NotificationDeleteTask(remoteIds).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (notificationListAdapter != null) {
notificationListAdapter.removeNotifications(notifications);
}
if (actionMode != null) {
actionMode.finish();
}
}
private class PlayerNotificationDescriptionAdapter implements PlayerNotificationManager.MediaDescriptionAdapter {
@Override
@@ -1887,8 +2022,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (nowPlayingClaimUrl != null) {
Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(nowPlayingClaimUrl));
launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(MainActivity.this, 0, launchIntent, 0);
return intent;
return PendingIntent.getActivity(MainActivity.this, 0, launchIntent, 0);
}
return null;
}
@@ -2101,8 +2235,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override
public void onSyncSetSuccess(String hash) {
Lbryio.lastRemoteHash = hash;
WalletSync walletSync = new WalletSync(hash, data);
Lbryio.lastWalletSync = walletSync;
Lbryio.lastWalletSync = new WalletSync(hash, data);
if (pendingSyncSetQueue.size() > 0) {
fullSyncInProgress = true;
@@ -2282,8 +2415,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
pendingFollowingReload = true;
}
private void handleOpenChannelUrl(Intent intent) {
String url = intent.getStringExtra("url");
pendingChannelUrl = url;
pendingChannelUrl = intent.getStringExtra("url");
}
};
registerReceiver(requestsReceiver, intentFilter);
@@ -2317,7 +2449,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
if (notificationListAdapter != null) {
markNotificationsRead();
markNotificationsSeen();
}
}
@@ -2326,17 +2458,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
findViewById(R.id.notifications_container).setVisibility(View.GONE);
}
private void markNotificationsRead() {
private void markNotificationsSeen() {
List<LbryNotification> all = notificationListAdapter != null ? notificationListAdapter.getItems() : null;
if (all != null) {
List<Long> unreadIds = new ArrayList<>();
List<Long> unseenIds = new ArrayList<>();
for (LbryNotification notification : all) {
if (!notification.isRead() && notification.getRemoteId() > 0) {
unreadIds.add(notification.getRemoteId());
if (!notification.isSeen() && notification.getRemoteId() > 0) {
unseenIds.add(notification.getRemoteId());
}
}
if (unreadIds.size() > 0) {
NotificationUpdateTask task = new NotificationUpdateTask(unreadIds, true);
if (unseenIds.size() > 0) {
NotificationUpdateTask task = new NotificationUpdateTask(unseenIds, true);
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@@ -2346,14 +2478,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
protected Void doInBackground(Void... params) {
try {
SQLiteDatabase db = dbHelper.getWritableDatabase();
DatabaseHelper.markNotificationsRead(db);
DatabaseHelper.markNotificationsSeen(db);
} catch (Exception ex) {
// pass
}
return null;
}
protected void onPostExecute(Void result) {
loadUnreadNotificationsCount();
loadUnseenNotificationsCount();
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -2443,7 +2575,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NotNull String[] permissions, @NotNull int[] grantResults) {
switch (requestCode) {
case REQUEST_STORAGE_PERMISSION:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
@@ -2478,7 +2610,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_FILE_PICKER) {
startingFilePickerActivity = false;
if (resultCode == RESULT_OK) {
if (resultCode == RESULT_OK && data != null) {
Uri fileUri = data.getData();
String filePath = Helper.getRealPathFromURI_API19(this, fileUri);
for (FilePickerListener listener : filePickerListeners) {
@@ -2589,8 +2721,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
int backCount = getSupportFragmentManager().getBackStackEntryCount();
if (backCount > 0) {
try {
Fragment fragment = getSupportFragmentManager().getFragments().get(backCount - 1);
return fragment;
return getSupportFragmentManager().getFragments().get(backCount - 1);
} catch (IndexOutOfBoundsException ex) {
return null;
}
@@ -2610,23 +2741,28 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
actionBar.show();
}
}
private void renderStartupFailed(Map<Integer, Boolean> startupStages) {
Map<Integer, Integer> startupStageIconIds = new HashMap<>();
startupStageIconIds.put(STARTUP_STAGE_INSTALL_ID_LOADED, R.id.startup_stage_icon_install_id);
startupStageIconIds.put(STARTUP_STAGE_KNOWN_TAGS_LOADED, R.id.startup_stage_icon_known_tags);
startupStageIconIds.put(STARTUP_STAGE_EXCHANGE_RATE_LOADED, R.id.startup_stage_icon_exchange_rate);
startupStageIconIds.put(STARTUP_STAGE_USER_AUTHENTICATED, R.id.startup_stage_icon_user_authenticated);
startupStageIconIds.put(STARTUP_STAGE_NEW_INSTALL_DONE, R.id.startup_stage_icon_install_new);
startupStageIconIds.put(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, R.id.startup_stage_icon_subscriptions_loaded);
startupStageIconIds.put(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, R.id.startup_stage_icon_subscriptions_resolved);
private void renderStartupFailed(List<StartupStage> startupStages) {
ListView listView = findViewById(R.id.startup_stage_error_listview);
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
listView.setAdapter(adapter);
for (Integer key : startupStages.keySet()) {
boolean stageDone = startupStages.get(key);
ImageView icon = findViewById(startupStageIconIds.get(key));
icon.setImageResource(stageDone ? R.drawable.ic_check : R.drawable.ic_close);
icon.setColorFilter(stageDone ? Color.WHITE : Color.RED);
// Add 1 pixel to listview height
int listHeight = Math.round(getResources().getDisplayMetrics().density);
for (int i = 0; i < startupStages.size(); i++) {
View item = adapter.getView(i, null, listView);
item.measure(0, 0);
listHeight += item.getMeasuredHeight();
}
// Properly set listview height by adding all seven items and the divider heights
// and the additional 1 pixel so no vertical scroll bar is shown
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = listHeight + (listView.getCount() + 1) * listView.getDividerHeight();
listView.setLayoutParams(params);
listView.invalidate();
listView.requestLayout();
findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE);
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
}
@@ -2638,16 +2774,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// perform some tasks before launching
(new AsyncTask<Void, Void, Boolean>() {
private Map<Integer, Boolean> startupStages = new HashMap<>();
private final List<StartupStage> startupStages = new ArrayList<>(7);
private void initStartupStages() {
startupStages.put(STARTUP_STAGE_INSTALL_ID_LOADED, false);
startupStages.put(STARTUP_STAGE_KNOWN_TAGS_LOADED, false);
startupStages.put(STARTUP_STAGE_EXCHANGE_RATE_LOADED, false);
startupStages.put(STARTUP_STAGE_USER_AUTHENTICATED, false);
startupStages.put(STARTUP_STAGE_NEW_INSTALL_DONE, false);
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, false);
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, false);
startupStages.add(new StartupStage(STARTUP_STAGE_INSTALL_ID_LOADED, false));
startupStages.add(new StartupStage(STARTUP_STAGE_KNOWN_TAGS_LOADED, false));
startupStages.add(new StartupStage(STARTUP_STAGE_EXCHANGE_RATE_LOADED, false));
startupStages.add(new StartupStage(STARTUP_STAGE_USER_AUTHENTICATED, false));
startupStages.add(new StartupStage(STARTUP_STAGE_NEW_INSTALL_DONE, false));
startupStages.add(new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, false));
startupStages.add(new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, false));
}
protected void onPreExecute() {
hideActionBar();
@@ -2667,26 +2803,26 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
String installId = reader.readLine();
if (Helper.isNullOrEmpty(installId)) {
// no install_id found (first run didn't start the sdk successfully?)
startupStages.put(STARTUP_STAGE_INSTALL_ID_LOADED, false);
startupStages.set(STARTUP_STAGE_INSTALL_ID_LOADED - 1, new StartupStage(STARTUP_STAGE_INSTALL_ID_LOADED, false));
return false;
}
Lbry.INSTALLATION_ID = installId;
startupStages.put(STARTUP_STAGE_INSTALL_ID_LOADED, true);
startupStages.set(STARTUP_STAGE_INSTALL_ID_LOADED - 1, new StartupStage(STARTUP_STAGE_INSTALL_ID_LOADED, true));
SQLiteDatabase db = dbHelper.getReadableDatabase();
List<Tag> fetchedTags = DatabaseHelper.getTags(db);
Lbry.knownTags = Helper.mergeKnownTags(fetchedTags);
Collections.sort(Lbry.knownTags, new Tag());
Lbry.followedTags = Helper.filterFollowedTags(Lbry.knownTags);
startupStages.put(STARTUP_STAGE_KNOWN_TAGS_LOADED, true);
startupStages.set(STARTUP_STAGE_KNOWN_TAGS_LOADED - 1, new StartupStage(STARTUP_STAGE_KNOWN_TAGS_LOADED, true));
// load the exchange rate
Lbryio.loadExchangeRate();
if (Lbryio.LBCUSDRate == 0) {
return false;
}
startupStages.put(STARTUP_STAGE_EXCHANGE_RATE_LOADED, true);
startupStages.set(STARTUP_STAGE_EXCHANGE_RATE_LOADED - 1, new StartupStage(STARTUP_STAGE_EXCHANGE_RATE_LOADED, true));
try {
Lbryio.authenticate(context);
@@ -2698,10 +2834,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (Lbryio.currentUser == null) {
throw new Exception("Did not retrieve authenticated user.");
}
startupStages.put(STARTUP_STAGE_USER_AUTHENTICATED, true);
startupStages.set(STARTUP_STAGE_USER_AUTHENTICATED - 1, new StartupStage(STARTUP_STAGE_USER_AUTHENTICATED, true));
Lbryio.newInstall(context);
startupStages.put(STARTUP_STAGE_NEW_INSTALL_DONE, true);
startupStages.set(STARTUP_STAGE_NEW_INSTALL_DONE - 1, new StartupStage(STARTUP_STAGE_NEW_INSTALL_DONE, true));
// (light) fetch subscriptions
if (Lbryio.subscriptions.size() == 0) {
@@ -2713,31 +2849,31 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
JSONObject item = array.getJSONObject(i);
String claimId = item.getString("claim_id");
String channelName = item.getString("channel_name");
boolean isNotificationsDisabled = item.getBoolean("is_notifications_disabled");
LbryUri url = new LbryUri();
url.setChannelName(channelName);
url.setClaimId(claimId);
subscriptions.add(new Subscription(channelName, url.toString()));
subscriptions.add(new Subscription(channelName, url.toString(), isNotificationsDisabled));
subUrls.add(url.toString());
}
Lbryio.subscriptions = subscriptions;
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, true);
startupStages.set(STARTUP_STAGE_SUBSCRIPTIONS_LOADED - 1, new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, true));
// resolve subscriptions
if (subUrls.size() > 0 && Lbryio.cacheResolvedSubscriptions.size() != Lbryio.subscriptions.size()) {
List<Claim> resolvedSubs = Lbry.resolve(subUrls, Lbry.LBRY_TV_CONNECTION_STRING);
Lbryio.cacheResolvedSubscriptions = resolvedSubs;
Lbryio.cacheResolvedSubscriptions = Lbry.resolve(subUrls, Lbry.LBRY_TV_CONNECTION_STRING);
}
// if no exceptions occurred here, subscriptions have been loaded and resolved
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, true);
startupStages.set(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED - 1, new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, true));
} else {
// user has not subscribed to anything
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, true);
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, true);
startupStages.set(STARTUP_STAGE_SUBSCRIPTIONS_LOADED - 1, new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, true));
startupStages.set(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED - 1, new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, true));
}
} else {
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, true);
startupStages.put(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, true);
startupStages.set(STARTUP_STAGE_SUBSCRIPTIONS_LOADED - 1, new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_LOADED, true));
startupStages.set(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED - 1, new StartupStage(STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED, true));
}
} catch (Exception ex) {
// nopecd
@@ -2854,9 +2990,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
try {
LbryUri uri = LbryUri.parse(url);
if (uri.isChannel()) {
openChannelUrl(url);
openChannelUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
} else {
openFileUrl(url);
openFileUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
}
} catch (LbryUriException ex) {
// pass
@@ -2973,6 +3109,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
String action = intent.getAction();
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
MainActivity.this.receivedStopService = true;
// STOP is meant to close everything,
// So destroy the player at this point (even with background play enabled)
if (appPlayer != null) {
playerNotificationManager.setPlayer(null);
stopExoplayer();
nowPlayingClaim = null;
nowPlayingClaimUrl = null;
nowPlayingClaimBitmap = null;
}
MainActivity.this.finish();
} else if (LbrynetService.LBRY_SDK_SERVICE_STARTED.equals(action)) {
// Rebuild the service notification
@@ -3352,7 +3499,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void displayUnreadNotificationCount(int count) {
private void displayUnseenNotificationCount(int count) {
String text = count > 99 ? "99+" : String.valueOf(count);
TextView badge = findViewById(R.id.notifications_badge_count);
@@ -3360,19 +3507,19 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
badge.setText(text);
}
private void loadUnreadNotificationsCount() {
private void loadUnseenNotificationsCount() {
(new AsyncTask<Void, Void, Integer>() {
@Override
protected Integer doInBackground(Void... params) {
try {
SQLiteDatabase db = dbHelper.getReadableDatabase();
return DatabaseHelper.getUnreadNotificationsCount(db);
return DatabaseHelper.getUnseenNotificationsCount(db);
} catch (Exception ex) {
return 0;
}
}
protected void onPostExecute(Integer count) {
displayUnreadNotificationCount(count);
displayUnseenNotificationCount(count);
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -3384,10 +3531,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onSuccess(List<LbryNotification> notifications) {
remoteNotifcationsLastLoaded = new Date();
loadUnreadNotificationsCount();
loadUnseenNotificationsCount();
loadLocalNotifications();
if (markRead && findViewById(R.id.notifications_container).getVisibility() == View.VISIBLE) {
markNotificationsRead();
markNotificationsSeen();
}
if (notificationsSwipeContainer != null) {
notificationsSwipeContainer.setRefreshing(false);
}
}
@@ -3396,6 +3547,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// pass
Log.e(TAG, "error loading remote notifications", exception);
loadLocalNotifications();
if (notificationsSwipeContainer != null) {
notificationsSwipeContainer.setRefreshing(false);
}
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -3421,10 +3575,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
protected void onPostExecute(List<LbryNotification> notifications) {
findViewById(R.id.notification_list_empty_container).setVisibility(notifications.size() == 0 ? View.VISIBLE : View.GONE);
findViewById(R.id.notifications_progress).setVisibility(View.GONE);
loadUnreadNotificationsCount();
loadUnseenNotificationsCount();
if (notificationListAdapter == null) {
notificationListAdapter = new NotificationListAdapter(notifications, MainActivity.this);
notificationListAdapter.setSelectionModeListener(MainActivity.this);
((RecyclerView) findViewById(R.id.notifications_list)).setAdapter(notificationListAdapter);
} else {
notificationListAdapter.addNotifications(notifications);
@@ -3477,7 +3632,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return null;
}
protected void onPostExecute() {
loadUnreadNotificationsCount();
loadUnseenNotificationsCount();
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -3591,6 +3746,51 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
}
private void checkAndEnableShareUsageData() {
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
boolean shareUsageData = sp.getBoolean(PREFERENCE_KEY_SHARE_USAGE_DATA, false);
if (shareUsageData) {
return;
}
(new AsyncTask<Void, Void, Void>() {
protected Void doInBackground(Void... params) {
PrintStream out = null;
try {
String fileContent = "true";
String path = String.format("%s/sud", Utils.getAppInternalStorageDir(MainActivity.this));
out = new PrintStream(new FileOutputStream(path));
out.print(fileContent);
} catch (Exception ex) {
// pass
} finally {
Helper.closeCloseable(out);
}
return null;
}
protected void onPostExecute(Void result) {
updateSdkSetting("share_usage_data", true);
sp.edit().putBoolean(PREFERENCE_KEY_SHARE_USAGE_DATA, true).apply();
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public void updateSdkSetting(String key, Object value) {
(new Thread() {
public void run() {
Map<String, Object> params = new HashMap<>();
params.put(key, value);
try {
Lbry.parseResponse(Lbry.apiCall("settings_set", params, Lbry.SDK_CONNECTION_STRING));
} catch (Exception ex) {
// pass
Log.d(TAG, ex.getMessage(), ex);
}
}
}).start();
}
public interface BackPressInterceptor {
boolean onBackPressed();
}
@@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.List;
import io.lbry.browser.adapter.VerificationPagerAdapter;
import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.SignInListener;
import io.lbry.browser.listener.WalletSyncListener;
import io.lbry.browser.model.lbryinc.RewardVerified;
@@ -48,6 +49,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
public static final int VERIFICATION_FLOW_REWARDS = 2;
public static final int VERIFICATION_FLOW_WALLET = 3;
private List<SdkStatusListener> sdkStatusListeners;
private BillingClient billingClient;
private BroadcastReceiver sdkReceiver;
private String email;
@@ -105,6 +107,8 @@ public class VerificationActivity extends FragmentActivity implements SignInList
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sdkStatusListeners = new ArrayList<>();
signedIn = Lbryio.isSignedIn();
Intent intent = getIntent();
if (intent != null) {
@@ -126,11 +130,18 @@ public class VerificationActivity extends FragmentActivity implements SignInList
IntentFilter filter = new IntentFilter();
filter.addAction(LbrynetService.ACTION_STOP_SERVICE);
filter.addAction(MainActivity.ACTION_SDK_READY);
sdkReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
if (MainActivity.ACTION_SDK_READY.equals(action)) {
for (SdkStatusListener listener : sdkStatusListeners) {
if (listener != null) {
listener.onSdkReady();
}
}
} else if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
finish();
}
}
@@ -436,4 +447,14 @@ public class VerificationActivity extends FragmentActivity implements SignInList
Helper.unregisterReceiver(sdkReceiver, this);
super.onDestroy();
}
public void addSdkStatusListener(SdkStatusListener listener) {
if (!sdkStatusListeners.contains(listener)) {
sdkStatusListeners.add(listener);
}
}
public void removeSdkStatusListener(SdkStatusListener listener) {
sdkStatusListeners.remove(listener);
}
}
@@ -101,7 +101,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
}
vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE);
vh.thumbnailView.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.GONE : View.VISIBLE);
vh.alphaView.setText(claim.isPlaceholder() ? null : claim.getName() != null ? claim.getName().substring(1, 2) : "");
vh.alphaView.setText(claim.isPlaceholder() ? null : claim.getName() != null ? claim.getName().substring(1, 2).toUpperCase() : "");
int bgColor = Helper.generateRandomColorForValue(claim.getClaimId());
Helper.setIconViewBackgroundColor(vh.alphaContainer, bgColor, claim.isPlaceholder(), context);
@@ -430,7 +430,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
Helper.setViewVisibility(vh.loadingTextPlaceholder2, item.isLoadingPlaceholder() ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(vh.titleView, !item.isLoadingPlaceholder() ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(vh.publisherView, !item.isLoadingPlaceholder() ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(vh.publishTimeView, !item.isLoadingPlaceholder() ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(vh.publishTimeView, !item.isLoadingPlaceholder() && !isPending ? View.VISIBLE : View.GONE);
if (type == VIEW_TYPE_FEATURED && item.isUnresolved()) {
vh.durationView.setVisibility(View.GONE);
@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.Calendar;
@@ -24,6 +25,7 @@ import java.util.List;
import java.util.TimeZone;
import io.lbry.browser.R;
import io.lbry.browser.listener.SelectionModeListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.lbryinc.LbryNotification;
import io.lbry.browser.ui.controls.SolidIconView;
@@ -43,15 +45,19 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
private Context context;
private List<LbryNotification> items;
private List<LbryNotification> selectedItems;
@Setter
private NotificationClickListener clickListener;
@Getter
@Setter
private int customizeMode;
private boolean inSelectionMode;
@Setter
private SelectionModeListener selectionModeListener;
public NotificationListAdapter(List<LbryNotification> notifications, Context context) {
this.context = context;
this.items = new ArrayList<>(notifications);
this.selectedItems = new ArrayList<>();
Collections.sort(items, Collections.reverseOrder(new LbryNotification()));
}
@@ -62,6 +68,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
protected TextView timeView;
protected SolidIconView iconView;
protected ImageView thumbnailView;
protected View selectedOverlayView;
public ViewHolder(View v) {
super(v);
layoutView = v.findViewById(R.id.notification_layout);
@@ -70,12 +77,25 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
timeView = v.findViewById(R.id.notification_time);
iconView = v.findViewById(R.id.notification_icon);
thumbnailView = v.findViewById(R.id.notification_author_thumbnail);
selectedOverlayView = v.findViewById(R.id.notification_selected_overlay);
}
}
public int getItemCount() {
return items != null ? items.size() : 0;
}
public List<LbryNotification> getSelectedItems() {
return this.selectedItems;
}
public int getSelectedCount() {
return selectedItems != null ? selectedItems.size() : 0;
}
public void clearSelectedItems() {
this.selectedItems.clear();
}
public boolean isNotificationSelected(LbryNotification notification) {
return selectedItems.contains(notification);
}
public void insertNotification(LbryNotification notification, int index) {
if (!items.contains(notification)) {
@@ -90,6 +110,12 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
}
notifyDataSetChanged();
}
public void removeNotifications(List<LbryNotification> notifications) {
for (LbryNotification notification : notifications) {
items.remove(notification);
}
notifyDataSetChanged();
}
public List<String> getAuthorUrls() {
List<String> urls = new ArrayList<>();
@@ -158,9 +184,8 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
@Override
public void onBindViewHolder(NotificationListAdapter.ViewHolder vh, int position) {
LbryNotification notification = items.get(position);
vh.layoutView.setBackgroundColor(ContextCompat.getColor(context, notification.isSeen() ? android.R.color.transparent : R.color.nextLbryGreenSemiTransparent));
vh.selectedOverlayView.setVisibility(isNotificationSelected(notification) ? View.VISIBLE : View.GONE);
vh.titleView.setVisibility(!Helper.isNullOrEmpty(notification.getTitle()) ? View.VISIBLE : View.GONE);
vh.titleView.setText(notification.getTitle());
@@ -181,11 +206,49 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
vh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clickListener != null) {
clickListener.onNotificationClicked(notification);
if (inSelectionMode) {
toggleSelectedNotification(notification);
} else {
if (clickListener != null) {
clickListener.onNotificationClicked(notification);
}
}
}
});
vh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (!inSelectionMode) {
inSelectionMode = true;
if (selectionModeListener != null) {
selectionModeListener.onEnterSelectionMode();
}
}
toggleSelectedNotification(notification);
return true;
}
});
}
private void toggleSelectedNotification(LbryNotification notification) {
if (selectedItems.contains(notification)) {
selectedItems.remove(notification);
} else {
selectedItems.add(notification);
}
if (selectionModeListener != null) {
selectionModeListener.onItemSelectionToggled();
}
if (selectedItems.size() == 0) {
inSelectionMode = false;
if (selectionModeListener != null) {
selectionModeListener.onExitSelectionMode();
}
}
notifyDataSetChanged();
}
private long getLocalNotificationTime(LbryNotification notification) {
@@ -0,0 +1,68 @@
package io.lbry.browser.adapter;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import io.lbry.browser.R;
import io.lbry.browser.model.StartupStage;
public class StartupStageAdapter extends BaseAdapter {
private final List<StartupStage> list;
private final LayoutInflater inflater;
private final String[] stagesString;
public StartupStageAdapter(Context ctx, List<StartupStage> rows) {
this.list = rows;
this.inflater = LayoutInflater.from(ctx);
stagesString = new String[7];
stagesString[0] = ctx.getResources().getString(R.string.installation_id_loaded);
stagesString[1] = ctx.getResources().getString(R.string.known_tags_loaded);
stagesString[2] = ctx.getResources().getString(R.string.exchange_rate_loaded);
stagesString[3] = ctx.getResources().getString(R.string.user_authenticated);
stagesString[4] = ctx.getResources().getString(R.string.installation_registered);
stagesString[5] = ctx.getResources().getString(R.string.subscriptions_loaded);
stagesString[6] = ctx.getResources().getString(R.string.subscriptions_resolved);
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
if (view == null) {
view = inflater.inflate(R.layout.list_item_startupstage, viewGroup, false);
ImageView iconView = view.findViewById(R.id.startup_stage_icon);
TextView textView = view.findViewById(R.id.startup_stage_text);
StartupStage item = (StartupStage) getItem(i);
iconView.setImageResource(item.stageDone ? R.drawable.ic_check : R.drawable.ic_close);
iconView.setColorFilter(item.stageDone ? Color.WHITE : Color.RED);
textView.setText(stagesString[item.stage - 1]);
}
return view;
}
}
@@ -6,6 +6,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.math.BigDecimal;
import java.sql.SQLInput;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -21,13 +22,13 @@ import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.LbryUri;
public class DatabaseHelper extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 7;
public static final int DATABASE_VERSION = 8;
public static final String DATABASE_NAME = "LbryApp.db";
private static DatabaseHelper instance;
private static final String[] SQL_CREATE_TABLES = {
// local subscription store
"CREATE TABLE subscriptions (url TEXT PRIMARY KEY NOT NULL, channel_name TEXT NOT NULL)",
"CREATE TABLE subscriptions (url TEXT PRIMARY KEY NOT NULL, channel_name TEXT NOT NULL, is_notifications_disabled INTEGER DEFAULT 0 NOT NULL)",
// url entry / suggestion history
"CREATE TABLE url_history (id INTEGER PRIMARY KEY NOT NULL, value TEXT NOT NULL, url TEXT, type INTEGER NOT NULL, timestamp TEXT NOT NULL)",
// tags (known and followed)
@@ -105,11 +106,15 @@ public class DatabaseHelper extends SQLiteOpenHelper {
"CREATE TABLE shuffle_watched (id INTEGER PRIMARY KEY NOT NULL, claim_id TEXT NOT NULL)",
"CREATE UNIQUE INDEX idx_shuffle_watched_claim ON shuffle_watched (claim_id)"
};
private static final String[] SQL_V7_V8_UPGRADE = {
"AlTER TABLE subscriptions ADD COLUMN is_notifications_disabled INTEGER DEFAULT 0 NOT NULL"
};
private static final String SQL_INSERT_SUBSCRIPTION = "REPLACE INTO subscriptions (channel_name, url) VALUES (?, ?)";
private static final String SQL_INSERT_SUBSCRIPTION = "REPLACE INTO subscriptions (channel_name, url, is_notifications_disabled) VALUES (?, ?, ?)";
private static final String SQL_UPDATE_SUBSCRIPTION_NOTIFICATION = "UPDATE subscriptions SET is_notification_disabled = ? WHERE url = ?";
private static final String SQL_CLEAR_SUBSCRIPTIONS = "DELETE FROM subscriptions";
private static final String SQL_DELETE_SUBSCRIPTION = "DELETE FROM subscriptions WHERE url = ?";
private static final String SQL_GET_SUBSCRIPTIONS = "SELECT channel_name, url FROM subscriptions";
private static final String SQL_GET_SUBSCRIPTIONS = "SELECT channel_name, url, is_notifications_disabled FROM subscriptions";
private static final String SQL_INSERT_URL_HISTORY = "REPLACE INTO url_history (value, url, type, timestamp) VALUES (?, ?, ?, ?)";
private static final String SQL_CLEAR_URL_HISTORY = "DELETE FROM url_history";
@@ -119,7 +124,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
private static final String SQL_INSERT_NOTIFICATION = "REPLACE INTO notifications (remote_id, author_url, title, description, rule, target_url, is_read, is_seen, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
private static final String SQL_GET_NOTIFICATIONS = "SELECT id, remote_id, author_url, title, description, rule, target_url, is_read, is_seen, timestamp FROM notifications ORDER BY timestamp DESC LIMIT 500";
private static final String SQL_GET_UNREAD_NOTIFICATIONS_COUNT = "SELECT COUNT(id) FROM notifications WHERE is_read <> 1";
private static final String SQL_GET_UNSEEN_NOTIFICATIONS_COUNT = "SELECT COUNT(id) FROM notifications WHERE is_seen <> 1";
private static final String SQL_MARK_NOTIFICATIONS_READ = "UPDATE notifications SET is_read = 1 WHERE is_read = 0";
private static final String SQL_MARK_NOTIFICATIONS_SEEN = "UPDATE notifications SET is_seen = 1 WHERE is_seen = 0";
private static final String SQL_MARK_NOTIFICATION_READ_AND_SEEN = "UPDATE notifications SET is_read = 1, is_seen = 1 WHERE id = ?";
private static final String SQL_INSERT_SHUFFLE_WATCHED = "REPLACE INTO shuffle_watched (claim_id) VALUES (?)";
@@ -188,6 +195,11 @@ public class DatabaseHelper extends SQLiteOpenHelper {
db.execSQL(sql);
}
}
if (oldVersion < 8) {
for (String sql : SQL_V7_V8_UPGRADE) {
db.execSQL(sql);
}
}
}
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
@@ -304,7 +316,14 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
public static void createOrUpdateSubscription(Subscription subscription, SQLiteDatabase db) {
db.execSQL(SQL_INSERT_SUBSCRIPTION, new Object[] { subscription.getChannelName(), subscription.getUrl() });
db.execSQL(SQL_INSERT_SUBSCRIPTION, new Object[] {
subscription.getChannelName(),
subscription.getUrl(),
subscription.isNotificationsDisabled() ? 1 : 0
});
}
public static void setSubscriptionNotificationDisabled(boolean flag, String url, SQLiteDatabase db) {
db.execSQL(SQL_UPDATE_SUBSCRIPTION_NOTIFICATION, new Object[] { flag ? 1 : 0, url });
}
public static void deleteSubscription(Subscription subscription, SQLiteDatabase db) {
db.execSQL(SQL_DELETE_SUBSCRIPTION, new Object[] { subscription.getUrl() });
@@ -321,6 +340,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
Subscription subscription = new Subscription();
subscription.setChannelName(cursor.getString(0));
subscription.setUrl(cursor.getString(1));
subscription.setNotificationsDisabled(cursor.getInt(2) == 1);
subscriptions.add(subscription);
}
} finally {
@@ -372,6 +392,20 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
return notifications;
}
public static void deleteNotifications(List<LbryNotification> notifications, SQLiteDatabase db) {
StringBuilder sb = new StringBuilder("DELETE FROM notifications WHERE remote_id IN (");
List<Object> remoteIds = new ArrayList<>();
String delim = "";
for (int i = 0; i < notifications.size(); i++) {
remoteIds.add(String.valueOf(notifications.get(i).getRemoteId()));
sb.append(delim).append("?");
delim = ",";
}
sb.append(")");
String sql = sb.toString();
db.execSQL(sql, remoteIds.toArray());
}
public static int getUnreadNotificationsCount(SQLiteDatabase db) {
int count = 0;
Cursor cursor = null;
@@ -385,6 +419,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
return count;
}
public static int getUnseenNotificationsCount(SQLiteDatabase db) {
int count = 0;
Cursor cursor = null;
try {
cursor = db.rawQuery(SQL_GET_UNSEEN_NOTIFICATIONS_COUNT, null);
if (cursor.moveToNext()) {
count = cursor.getInt(0);
}
} finally {
Helper.closeCursor(cursor);
}
return count;
}
public static void markNotificationsSeen(SQLiteDatabase db) {
db.execSQL(SQL_MARK_NOTIFICATIONS_SEEN);
}
public static void markNotificationsRead(SQLiteDatabase db) {
db.execSQL(SQL_MARK_NOTIFICATIONS_READ);
}
@@ -225,9 +225,10 @@ public class CreateSupportDialogFragment extends BottomSheetDialogFragment imple
if (!isTip) {
sendButton.setText(R.string.send_revocable_support);
} else {
String amountString = Helper.getValue(inputAmount.getText());
String amountString = Helper.getValue(inputAmount.getText(), "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);
}
}
@@ -11,8 +11,7 @@ import io.lbry.browser.utils.Helper;
import lombok.Data;
@Data
public class Comment {
public static final double LBC_COST = 1;
public class Comment implements Comparable<Comment> {
public static final int MAX_LENGTH = 2000;
private Claim poster;
@@ -66,4 +65,9 @@ public class Comment {
return null;
}
}
@Override
public int compareTo(Comment comment) {
return (int)(this.getTimestamp() - comment.getTimestamp());
}
}
@@ -0,0 +1,11 @@
package io.lbry.browser.model;
public class StartupStage {
public Integer stage;
public Boolean stageDone;
public StartupStage(Integer stage, Boolean stageDone) {
this.stage = stage;
this.stageDone = stageDone;
}
}
@@ -11,17 +11,21 @@ public class Subscription {
@Getter
@Setter
private String url;
@Getter
@Setter
private boolean isNotificationsDisabled;
public Subscription() {
}
public Subscription(String channelName, String url) {
public Subscription(String channelName, String url, boolean isNotificationsDisabled) {
this.channelName = channelName;
this.url = url;
this.isNotificationsDisabled = isNotificationsDisabled;
}
public static Subscription fromClaim(Claim claim) {
return new Subscription(claim.getName(), claim.getPermanentUrl());
return new Subscription(claim.getName(), claim.getPermanentUrl(), false);
}
public String toString() {
return url;
@@ -24,18 +24,16 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class CommentCreateWithTipTask extends AsyncTask<Void, Void, Comment> {
public class CommentCreateTask extends AsyncTask<Void, Void, Comment> {
private static final String STATUS_ENDPOINT = "https://comments.lbry.com";
private Comment comment;
private BigDecimal amount;
private View progressView;
private CommentCreateWithTipHandler handler;
private Exception error;
public CommentCreateWithTipTask(Comment comment, BigDecimal amount, View progressView, CommentCreateWithTipHandler handler) {
public CommentCreateTask(Comment comment, View progressView, CommentCreateWithTipHandler handler) {
this.comment = comment;
this.amount = amount;
this.progressView = progressView;
this.handler = handler;
}
@@ -62,13 +60,6 @@ public class CommentCreateWithTipTask extends AsyncTask<Void, Void, Comment> {
}
Map<String, Object> options = new HashMap<>();
options.put("blocking", true);
options.put("claim_id", comment.getClaimId());
options.put("amount", new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).format(amount.doubleValue()));
options.put("tip", true);
Lbry.genericApiCall(Lbry.METHOD_SUPPORT_CREATE, options);
options = new HashMap<>();
options.put("comment", comment.getText());
options.put("claim_id", comment.getClaimId());
options.put("channel_id", comment.getChannelId());
@@ -8,6 +8,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -52,7 +53,6 @@ public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
options.put("visible", true);
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_COMMENT_LIST, options);
android.util.Log.d("LbryMain", result.toString(2));
JSONArray items = result.getJSONArray("items");
List<Comment> children = new ArrayList<>();
@@ -68,6 +68,9 @@ public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
}
}
// Sort all replies from oldest to newest at once
Collections.sort(children);
for (Comment child : children) {
for (Comment parent : comments) {
if (parent.getId().equalsIgnoreCase(child.getParentId())) {
@@ -78,7 +81,6 @@ public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
}
} catch (Exception ex) {
error = ex;
android.util.Log.d("LbryMain", ex.toString(), ex);
}
return comments;
}
@@ -76,13 +76,15 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
// check for any remote subs that may have been removed, and unsubscribe from them
for (int i = 0; i < array.length(); i++) {
JSONObject item = array.getJSONObject(i);
// TODO: Refactor by creating static Subscription.fromJSON method
String claimId = item.getString("claim_id");
String channelName = item.getString("channel_name");
boolean isNotificationsDisabled = item.getBoolean("is_notifications_disabled");
LbryUri url = new LbryUri();
url.setChannelName(channelName);
url.setClaimId(claimId);
Subscription subscription = new Subscription(channelName, url.toString());
Subscription subscription = new Subscription(channelName, url.toString(), isNotificationsDisabled);
remoteSubs.add(subscription);
}
}
@@ -51,11 +51,11 @@ public class ChannelSubscribeTask extends AsyncTask<Void, Void, Boolean> {
options.put("claim_id", channelClaimId);
if (!isUnsubscribing) {
options.put("channel_name", subscription.getChannelName());
options.put("notifications_disabled", String.valueOf(subscription.isNotificationsDisabled()).toLowerCase());
}
String action = isUnsubscribing ? "delete" : "new";
Lbryio.call("subscription", action, options, context);
Object response = Lbryio.parseResponse(Lbryio.call("subscription", action, options, context));
if (!isUnsubscribing) {
Lbryio.addSubscription(subscription);
} else {
@@ -49,11 +49,12 @@ public class FetchSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
JSONObject item = array.getJSONObject(i);
String claimId = item.getString("claim_id");
String channelName = item.getString("channel_name");
boolean isNotificationsDisabled = item.getBoolean("is_notifications_disabled");
LbryUri url = new LbryUri();
url.setChannelName(channelName);
url.setClaimId(claimId);
Subscription subscription = new Subscription(channelName, url.toString());
Subscription subscription = new Subscription(channelName, url.toString(), isNotificationsDisabled);
subscriptions.add(subscription);
// Persist the subscription locally if it doesn't exist
if (db != null) {
@@ -0,0 +1,33 @@
package io.lbry.browser.tasks.lbryinc;
import android.os.AsyncTask;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.lbry.browser.exceptions.LbryioRequestException;
import io.lbry.browser.exceptions.LbryioResponseException;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbryio;
public class NotificationDeleteTask extends AsyncTask<Void, Void, Boolean> {
private List<Long> ids;
public NotificationDeleteTask(List<Long> ids) {
this.ids = ids;
}
protected Boolean doInBackground(Void... params) {
Map<String, String> options = new HashMap<>();
options.put("notification_ids", Helper.joinL(ids, ","));
try {
Object result = Lbryio.parseResponse(Lbryio.call("notification", "delete", options, null));
return "ok".equalsIgnoreCase(result.toString());
} catch (LbryioResponseException | LbryioRequestException ex) {
// pass
}
return false;
}
}
@@ -15,25 +15,25 @@ public class NotificationUpdateTask extends AsyncTask<Void, Void, Boolean> {
private List<Long> ids;
private boolean seen;
private boolean read;
private boolean updateSeen;
private boolean updateRead;
public NotificationUpdateTask(List<Long> ids, boolean read) {
this(ids, read, false, false);
public NotificationUpdateTask(List<Long> ids, boolean seen) {
this(ids, false, true, false);
}
public NotificationUpdateTask(List<Long> ids, boolean read, boolean seen, boolean updateSeen) {
public NotificationUpdateTask(List<Long> ids, boolean read, boolean seen, boolean updateRead) {
this.ids = ids;
this.read = read;
this.seen = seen;
this.updateSeen = updateSeen;
this.updateRead = updateRead;
}
protected Boolean doInBackground(Void... params) {
Map<String, String> options = new HashMap<>();
options.put("notification_ids", Helper.joinL(ids, ","));
options.put("is_read", String.valueOf(read));
if (updateSeen) {
options.put("is_seen", String.valueOf(seen));
options.put("is_seen", String.valueOf(seen));
if (updateRead) {
options.put("is_read", String.valueOf(read));
}
try {
@@ -18,6 +18,7 @@ import io.lbry.browser.exceptions.ApiCallException;
import io.lbry.browser.exceptions.LbryUriException;
import io.lbry.browser.model.Tag;
import io.lbry.browser.model.lbryinc.Subscription;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryUri;
@@ -69,6 +70,8 @@ public class LoadSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
value.has("subscriptions") && !value.isNull("subscriptions") ? value.getJSONArray("subscriptions") : null;
JSONArray tags =
value.has("tags") && !value.isNull("tags") ? value.getJSONArray("tags") : null;
JSONArray following =
value.has("following") && !value.isNull("following") ? value.getJSONArray("following") : null;
if (subscriptionUrls != null) {
subscriptions = new ArrayList<>();
@@ -78,7 +81,8 @@ public class LoadSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
LbryUri uri = LbryUri.parse(LbryUri.normalize(url));
Subscription subscription = new Subscription();
subscription.setChannelName(uri.getChannelName());
subscription.setUrl(url);
subscription.setUrl(uri.toString());
subscription.setNotificationsDisabled(isNotificationsDisabledForSubUrl(uri.toString(), following));
subscriptions.add(subscription);
if (db != null) {
DatabaseHelper.createOrUpdateSubscription(subscription, db);
@@ -125,6 +129,28 @@ public class LoadSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
return false;
}
protected boolean isNotificationsDisabledForSubUrl(String url, JSONArray following) {
if (following == null) {
return true;
}
try {
for (int i = 0; i < following.length(); i++) {
JSONObject item = following.getJSONObject(i);
String itemUrl = Helper.getJSONString("url", null, item);
boolean notificationsDisabled = Helper.getJSONBoolean("notificationsDisabled", true, item);
if (url.equalsIgnoreCase(itemUrl)) {
return notificationsDisabled;
}
}
} catch (JSONException ex) {
// pass
}
// always default notifications disabled to true
return true;
}
protected void onPostExecute(Boolean result) {
if (handler != null) {
if (result) {
@@ -2,6 +2,7 @@ package io.lbry.browser.tasks.wallet;
import android.os.AsyncTask;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -11,9 +12,11 @@ import java.util.List;
import java.util.Map;
import io.lbry.browser.exceptions.ApiCallException;
import io.lbry.browser.exceptions.LbryUriException;
import io.lbry.browser.model.lbryinc.Subscription;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryUri;
import io.lbry.browser.utils.Lbryio;
/*
@@ -40,9 +43,16 @@ public class SaveSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
protected Boolean doInBackground(Void... params) {
// data to save
// current subscriptions
List<Subscription> subs = new ArrayList<>(Lbryio.subscriptions);
List<String> subscriptionUrls = new ArrayList<>();
for (Subscription subscription : Lbryio.subscriptions) {
subscriptionUrls.add(subscription.getUrl());
try {
for (Subscription subscription : subs) {
LbryUri uri = LbryUri.parse(LbryUri.normalize(subscription.getUrl()));
subscriptionUrls.add(uri.toString());
}
} catch (LbryUriException ex) {
error = ex;
return false;
}
// followed tags
@@ -62,6 +72,7 @@ public class SaveSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
JSONObject value = shared.getJSONObject("value");
value.put("subscriptions", Helper.jsonArrayFromList(subscriptionUrls));
value.put("tags", Helper.jsonArrayFromList(followedTags));
value.put("following", buildUpdatedNotificationsDisabledStates(subs));
sharedObject = shared;
}
}
@@ -71,6 +82,7 @@ public class SaveSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
JSONObject value = new JSONObject();
value.put("subscriptions", Helper.jsonArrayFromList(subscriptionUrls));
value.put("tags", Helper.jsonArrayFromList(followedTags));
value.put("following", buildUpdatedNotificationsDisabledStates(subs));
sharedObject = new JSONObject();
sharedObject.put("type", "object");
@@ -91,6 +103,26 @@ public class SaveSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
return false;
}
private static JSONArray buildUpdatedNotificationsDisabledStates(List<Subscription> subscriptions) {
JSONArray states = new JSONArray();
for (Subscription subscription : subscriptions) {
if (!Helper.isNullOrEmpty(subscription.getUrl())) {
try {
JSONObject item = new JSONObject();
LbryUri uri = LbryUri.parse(LbryUri.normalize(subscription.getUrl()));
item.put("uri", uri.toString());
item.put("notificationsDisabled", subscription.isNotificationsDisabled());
states.put(item);
} catch (JSONException | LbryUriException ex) {
// pass
}
}
}
return states;
}
protected void onPostExecute(Boolean result) {
if (handler != null) {
if (result) {
@@ -33,6 +33,7 @@ public class WalletSendTask extends AsyncTask<Void, Void, Boolean> {
Map<String, Object> options = new HashMap<>();
options.put("addresses", Arrays.asList(recipientAddress));
options.put("amount", amount);
options.put("blocking", true);
Lbry.genericApiCall(Lbry.METHOD_WALLET_SEND, options);
} catch (ApiCallException ex) {
error = ex;
@@ -30,7 +30,6 @@ import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
@@ -45,7 +44,7 @@ import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.Comment;
import io.lbry.browser.model.WalletBalance;
import io.lbry.browser.tasks.CommentCreateWithTipTask;
import io.lbry.browser.tasks.CommentCreateTask;
import io.lbry.browser.tasks.CommentListHandler;
import io.lbry.browser.tasks.CommentListTask;
import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask;
@@ -58,7 +57,6 @@ import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryAnalytics;
import io.lbry.browser.utils.LbryUri;
import io.lbry.browser.utils.Lbryio;
import lombok.Setter;
public class ChannelCommentsFragment extends Fragment implements SdkStatusListener, WalletBalanceListener {
@@ -367,9 +365,6 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
}
private void initCommentForm(View root) {
double amount = Comment.LBC_COST;
String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount));
buttonPostComment.setText(buttonText);
textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH));
buttonClearReplyToComment.setOnClickListener(new View.OnClickListener() {
@@ -387,7 +382,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
return;
}
validateAndCheckPostComment(amount);
validateAndCheckPostComment();
}
});
@@ -433,7 +428,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
});
}
private void validateAndCheckPostComment(double amount) {
private void validateAndCheckPostComment() {
String comment = Helper.getValue(inputComment.getText());
Claim channel = (Claim) commentChannelSpinner.getSelectedItem();
@@ -445,33 +440,8 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
showError(getString(R.string.please_select_channel));
return;
}
if (Lbry.walletBalance == null || amount > Lbry.walletBalance.getAvailable().doubleValue()) {
showError(getString(R.string.insufficient_balance));
return;
}
Context context = getContext();
if (context != null) {
String titleText = getResources().getQuantityString(
R.plurals.post_and_tip,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount));
String confirmText = getResources().getQuantityString(
R.plurals.confirm_post_comment,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount),
claim.getTitleOrName());
AlertDialog.Builder builder = new AlertDialog.Builder(context).
setTitle(titleText).
setMessage(confirmText)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
postComment(amount);
}
}).setNegativeButton(R.string.no, null);
builder.show();
}
postComment();
}
private void updatePostAsChannel(Claim channel) {
@@ -545,17 +515,15 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
replyToComment = null;
}
private void postComment(double tipAmount) {
private void postComment() {
if (postingComment) {
return;
}
Comment comment = buildPostComment();
// only use 2 decimal places
BigDecimal amount = new BigDecimal(String.valueOf(tipAmount));
beforePostComment();
CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() {
CommentCreateTask task = new CommentCreateTask(comment, progressPostComment, new CommentCreateTask.CommentCreateWithTipHandler() {
@Override
public void onSuccess(Comment createdComment) {
inputComment.setText(null);
@@ -573,7 +541,6 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
checkNoComments();
Bundle bundle = new Bundle();
bundle.putDouble("amount", amount.doubleValue());
bundle.putString("claim_id", claim != null ? claim.getClaimId() : null);
bundle.putString("claim_name", claim != null ? claim.getName() : null);
LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle);
@@ -80,7 +80,10 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
private View buttonShare;
private View buttonTip;
private View buttonFollowUnfollow;
private View buttonBell;
private SolidIconView iconBell;
private int subCount;
private TextView textFollow;
private OutlineIconView iconFollow;
private SolidIconView iconUnfollow;
private View layoutNothingAtLocation;
@@ -110,8 +113,11 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
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);
textFollow = root.findViewById(R.id.channel_view_text_follow);
iconFollow = root.findViewById(R.id.channel_view_icon_follow);
iconUnfollow = root.findViewById(R.id.channel_view_icon_unfollow);
buttonBell = root.findViewById(R.id.channel_view_subscribe_notify);
iconBell = root.findViewById(R.id.channel_view_icon_bell);
tabPager = root.findViewById(R.id.channel_view_pager);
tabLayout = root.findViewById(R.id.channel_view_tabs);
@@ -202,6 +208,42 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
}
});
buttonBell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (claim != null) {
boolean isNotificationsDisabled = Lbryio.isNotificationsDisabled(claim);
final Subscription subscription = Subscription.fromClaim(claim);
subscription.setNotificationsDisabled(!isNotificationsDisabled);
view.setEnabled(false);
Context context = getContext();
new ChannelSubscribeTask(context, claim.getClaimId(), subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
view.setEnabled(true);
Lbryio.updateSubscriptionNotificationsDisabled(subscription);
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).showMessage(subscription.isNotificationsDisabled() ?
R.string.receive_no_notifications : R.string.receive_all_notifications);
}
checkIsFollowing();
if (context != null) {
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
}
}
@Override
public void onError(Exception exception) {
view.setEnabled(true);
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});
buttonFollowUnfollow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -210,39 +252,22 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
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.removeCachedResolvedSubscription(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);
if (isFollowing) {
Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context).
setTitle(R.string.confirm_unfollow).
setMessage(R.string.confirm_unfollow_message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
doFollowUnfollow(isFollowing, view);
}
}).setNegativeButton(R.string.no, null);
builder.show();
} else {
doFollowUnfollow(isFollowing, view);
}
}
}
});
@@ -250,6 +275,39 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
return root;
}
private void doFollowUnfollow(boolean isFollowing, View view) {
subscribing = true;
Subscription subscription = Subscription.fromClaim(claim);
view.setEnabled(false);
new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
if (isFollowing) {
Lbryio.removeSubscription(subscription);
Lbryio.removeCachedResolvedSubscription(claim);
} else {
Lbryio.addSubscription(subscription);
Lbryio.addCachedResolvedSubscription(claim);
}
buttonFollowUnfollow.setEnabled(true);
subscribing = false;
checkIsFollowing();
FollowingFragment.resetClaimSearchContent = true;
Context context = getContext();
if (context != null) {
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
}
}
@Override
public void onError(Exception exception) {
buttonFollowUnfollow.setEnabled(true);
subscribing = false;
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void deleteCurrentClaim() {
if (claim != null) {
Helper.setViewVisibility(layoutDisplayArea, View.GONE);
@@ -280,8 +338,15 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
private void checkIsFollowing() {
if (claim != null) {
boolean isFollowing = Lbryio.isFollowing(claim);
boolean notificationsDisabled = Lbryio.isNotificationsDisabled(claim);
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(textFollow, !isFollowing ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(buttonBell, isFollowing ? View.VISIBLE : View.GONE);
if (iconBell != null) {
iconBell.setText(notificationsDisabled ? R.string.fa_bell : R.string.fa_bell_slash);
}
}
}
@@ -32,6 +32,7 @@ import io.lbry.browser.ui.BaseFragment;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryAnalytics;
import io.lbry.browser.utils.Predefined;
public class EditorsChoiceFragment extends BaseFragment {
@@ -72,7 +73,7 @@ public class EditorsChoiceFragment extends BaseFragment {
return Lbry.buildClaimSearchOptions(
Claim.TYPE_REPOST,
null,
null, /*canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),*/
canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),
new ArrayList<>(titleChannelIdsMap.values()),
null,
Arrays.asList(Claim.ORDER_BY_RELEASE_TIME),
@@ -28,6 +28,7 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -91,6 +92,8 @@ import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
@@ -120,7 +123,7 @@ import io.lbry.browser.model.WalletBalance;
import io.lbry.browser.model.lbryinc.Reward;
import io.lbry.browser.model.lbryinc.Subscription;
import io.lbry.browser.tasks.BufferEventTask;
import io.lbry.browser.tasks.CommentCreateWithTipTask;
import io.lbry.browser.tasks.CommentCreateTask;
import io.lbry.browser.tasks.CommentListHandler;
import io.lbry.browser.tasks.CommentListTask;
import io.lbry.browser.tasks.GenericTaskHandler;
@@ -142,7 +145,6 @@ import io.lbry.browser.tasks.lbryinc.ClaimRewardTask;
import io.lbry.browser.tasks.lbryinc.FetchStatCountTask;
import io.lbry.browser.tasks.lbryinc.LogFileViewTask;
import io.lbry.browser.ui.BaseFragment;
import io.lbry.browser.ui.controls.OutlineIconView;
import io.lbry.browser.ui.controls.SolidIconView;
import io.lbry.browser.ui.publish.PublishFragment;
import io.lbry.browser.utils.Helper;
@@ -784,30 +786,28 @@ public class FileViewFragment extends BaseFragment implements
}
}
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
private View.OnClickListener bellIconListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (claim != null && claim.getSigningChannel() != null) {
Claim publisher = claim.getSigningChannel();
boolean isFollowing = Lbryio.isFollowing(publisher);
Subscription subscription = Subscription.fromClaim(publisher);
boolean isNotificationsDisabled = Lbryio.isNotificationsDisabled(publisher);
final Subscription subscription = Subscription.fromClaim(publisher);
subscription.setNotificationsDisabled(!isNotificationsDisabled);
view.setEnabled(false);
Context context = getContext();
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
if (isFollowing) {
Lbryio.removeSubscription(subscription);
Lbryio.removeCachedResolvedSubscription(publisher);
} else {
Lbryio.addSubscription(subscription);
Lbryio.addCachedResolvedSubscription(publisher);
}
view.setEnabled(true);
Lbryio.updateSubscriptionNotificationsDisabled(subscription);
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).showMessage(subscription.isNotificationsDisabled() ?
R.string.receive_no_notifications : R.string.receive_all_notifications);
}
checkIsFollowing();
FollowingFragment.resetClaimSearchContent = true;
// Save shared user state
if (context != null) {
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
}
@@ -822,6 +822,66 @@ public class FileViewFragment extends BaseFragment implements
}
};
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
@Override
public void onClick(final View view) {
if (claim != null && claim.getSigningChannel() != null) {
Claim publisher = claim.getSigningChannel();
boolean isFollowing = Lbryio.isFollowing(publisher);
if (isFollowing) {
// show unfollow confirmation
Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context).
setTitle(R.string.confirm_unfollow).
setMessage(R.string.confirm_unfollow_message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
doFollowUnfollow(isFollowing, view);
}
}).setNegativeButton(R.string.no, null);
builder.show();
} else {
doFollowUnfollow(isFollowing, view);
}
}
}
};
private void doFollowUnfollow(boolean isFollowing, View view) {
if (claim != null && claim.getSigningChannel() != null) {
Claim publisher = claim.getSigningChannel();
Subscription subscription = Subscription.fromClaim(publisher);
view.setEnabled(false);
Context context = getContext();
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
if (isFollowing) {
Lbryio.removeSubscription(subscription);
Lbryio.removeCachedResolvedSubscription(publisher);
} else {
Lbryio.addSubscription(subscription);
Lbryio.addCachedResolvedSubscription(publisher);
}
view.setEnabled(true);
checkIsFollowing();
FollowingFragment.resetClaimSearchContent = true;
// Save shared user state
if (context != null) {
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
}
}
@Override
public void onError(Exception exception) {
view.setEnabled(true);
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
private void resolveUrl(String url) {
resolving = true;
Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE);
@@ -1015,30 +1075,39 @@ public class FileViewFragment extends BaseFragment implements
}
if (claim != null) {
boolean isOwnClaim = Lbry.ownClaims.contains(claim);
if (isOwnClaim) {
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();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_file).
setMessage(R.string.confirm_delete_file_message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
deleteClaimFile();
}
}).setNegativeButton(R.string.no, null);
builder.show();
}
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_file).
setMessage(R.string.confirm_delete_file_message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
deleteClaimFile();
}
}).setNegativeButton(R.string.no, null);
builder.show();
}
}
});
root.findViewById(R.id.file_view_action_unpublish).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!Lbry.SDK_READY) {
Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
return;
}
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();
}
}
});
@@ -1160,8 +1229,10 @@ public class FileViewFragment extends BaseFragment implements
View buttonFollow = root.findViewById(R.id.file_view_icon_follow);
View buttonUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
View buttonBell = root.findViewById(R.id.file_view_icon_bell);
buttonFollow.setOnClickListener(followUnfollowListener);
buttonUnfollow.setOnClickListener(followUnfollowListener);
buttonBell.setOnClickListener(bellIconListener);
commentChannelSpinnerAdapter = new InlineChannelSpinnerAdapter(getContext(), R.layout.spinner_item_channel, new ArrayList<>());
commentChannelSpinnerAdapter.addPlaceholder(false);
@@ -1477,6 +1548,12 @@ public class FileViewFragment extends BaseFragment implements
onMainActionButtonClicked();
}
});
root.findViewById(R.id.file_view_open_external_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openClaimExternally(claim, claim.getMediaType());
}
});
if (metadata instanceof Claim.StreamMetadata) {
Claim.StreamMetadata streamMetadata = (Claim.StreamMetadata) metadata;
@@ -2024,6 +2101,8 @@ public class FileViewFragment extends BaseFragment implements
}
handled = true;
}
} else {
openClaimExternally(claim, mediaType);
}
}
@@ -2062,7 +2141,17 @@ public class FileViewFragment extends BaseFragment implements
@Override
public void onSuccess(String text) {
String html = buildMarkdownHtml(text);
if (webView != null) {
// Due to a change to Chrome, WebView only displays '#' -and everything after it-
// if it is '%23' instead. Problem appears in text like '#2' or #hashtags.
Pattern pattern = Pattern.compile("#(\\S+)");
Matcher matcher = pattern.matcher(html);
if (matcher.find()) {
html = html.replaceAll(pattern.toString(), "&%2335;" + matcher.group(1));
}
webView.loadData(html, "text/html", "utf-8");
}
}
@@ -2100,6 +2189,17 @@ public class FileViewFragment extends BaseFragment implements
" </html>";
}
private void openClaimExternally(Claim claim, String mediaType) {
Uri fileUri = Uri.parse(claim.getFile().getDownloadPath());
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(fileUri, mediaType.toLowerCase());
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Intent chooser = Intent.createChooser(intent, getString(R.string.choose_app));
startActivityForResult(chooser, 419);
}
public void showError(String message) {
View root = getView();
if (root != null) {
@@ -2514,13 +2614,18 @@ public class FileViewFragment extends BaseFragment implements
private void checkIsFollowing() {
if (claim != null && claim.getSigningChannel() != null) {
boolean isFollowing = Lbryio.isFollowing(claim.getSigningChannel());
boolean notificationsDisabled = Lbryio.isNotificationsDisabled(claim.getSigningChannel());
Context context = getContext();
View root = getView();
if (context != null && root != null) {
OutlineIconView iconFollow = root.findViewById(R.id.file_view_icon_follow);
View iconFollow = root.findViewById(R.id.file_view_icon_follow);
SolidIconView iconUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE: View.INVISIBLE);
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.INVISIBLE);
SolidIconView iconBell = root.findViewById(R.id.file_view_icon_bell);
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE: View.GONE);
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.GONE);
Helper.setViewVisibility(iconBell, isFollowing ? View.VISIBLE : View.GONE);
iconBell.setText(notificationsDisabled ? R.string.fa_bell : R.string.fa_bell_slash);
}
}
}
@@ -2778,10 +2883,13 @@ public class FileViewFragment extends BaseFragment implements
boolean isOwnClaim = Lbry.ownClaims.contains(claim);
View root = getView();
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_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);
}
}
}
@@ -2902,9 +3010,6 @@ public class FileViewFragment extends BaseFragment implements
}
private void initCommentForm(View root) {
double amount = Comment.LBC_COST;
String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount));
buttonPostComment.setText(buttonText);
textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH));
buttonClearReplyToComment.setOnClickListener(new View.OnClickListener() {
@@ -2922,7 +3027,7 @@ public class FileViewFragment extends BaseFragment implements
return;
}
validateAndCheckPostComment(amount);
validateAndCheckPostComment();
}
});
@@ -2968,7 +3073,7 @@ public class FileViewFragment extends BaseFragment implements
});
}
private void validateAndCheckPostComment(double amount) {
private void validateAndCheckPostComment() {
String comment = Helper.getValue(inputComment.getText());
Claim channel = (Claim) commentChannelSpinner.getSelectedItem();
@@ -2980,33 +3085,8 @@ public class FileViewFragment extends BaseFragment implements
showError(getString(R.string.please_select_channel));
return;
}
if (Lbry.walletBalance == null || amount > Lbry.walletBalance.getAvailable().doubleValue()) {
showError(getString(R.string.insufficient_balance));
return;
}
Context context = getContext();
if (context != null) {
String titleText = getResources().getQuantityString(
R.plurals.post_and_tip,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount));
String confirmText = getResources().getQuantityString(
R.plurals.confirm_post_comment,
amount == 1 ? 1 : 2,
Helper.LBC_CURRENCY_FORMAT.format(amount),
claim.getTitleOrName());
AlertDialog.Builder builder = new AlertDialog.Builder(context).
setTitle(titleText).
setMessage(confirmText)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
postComment(amount);
}
}).setNegativeButton(R.string.no, null);
builder.show();
}
postComment();
}
private void updatePostAsChannel(Claim channel) {
@@ -3080,17 +3160,15 @@ public class FileViewFragment extends BaseFragment implements
replyToComment = null;
}
private void postComment(double tipAmount) {
private void postComment() {
if (postingComment) {
return;
}
Comment comment = buildPostComment();
// only use 2 decimal places
BigDecimal amount = new BigDecimal(String.valueOf(tipAmount));
beforePostComment();
CommentCreateWithTipTask task = new CommentCreateWithTipTask(comment, amount, progressPostComment, new CommentCreateWithTipTask.CommentCreateWithTipHandler() {
CommentCreateTask task = new CommentCreateTask(comment, progressPostComment, new CommentCreateTask.CommentCreateWithTipHandler() {
@Override
public void onSuccess(Comment createdComment) {
inputComment.setText(null);
@@ -3108,7 +3186,6 @@ public class FileViewFragment extends BaseFragment implements
checkNoComments();
Bundle bundle = new Bundle();
bundle.putDouble("amount", amount.doubleValue());
bundle.putString("claim_id", claim != null ? claim.getClaimId() : null);
bundle.putString("claim_name", claim != null ? claim.getName() : null);
LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle);
@@ -257,7 +257,7 @@ public class PublishFormFragment extends BaseFragment implements
suggestedTagsAdapter.setClickListener(this);
suggestedTagsList.setAdapter(suggestedTagsAdapter);
matureTagsAdapter = new TagListAdapter(Helper.getTagObjectsForTags(Predefined.MATURE_TAGS), context);
matureTagsAdapter = new TagListAdapter(Helper.getTagObjectsForTags(Predefined.PUBLISH_MATURE_TAGS), context);
matureTagsAdapter.setCustomizeMode(TagListAdapter.CUSTOMIZE_MODE_ADD);
matureTagsAdapter.setClickListener(this);
matureTagsList.setAdapter(matureTagsAdapter);
@@ -21,6 +21,8 @@ import com.google.android.material.textfield.TextInputEditText;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.VerificationActivity;
import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.WalletSyncListener;
import io.lbry.browser.model.WalletSync;
import io.lbry.browser.tasks.wallet.DefaultSyncTaskHandler;
@@ -33,7 +35,7 @@ import io.lbry.browser.utils.Lbryio;
import io.lbry.lbrysdk.Utils;
import lombok.Setter;
public class WalletVerificationFragment extends Fragment {
public class WalletVerificationFragment extends Fragment implements SdkStatusListener {
@Setter
private WalletSyncListener listener = null;
@@ -86,6 +88,30 @@ public class WalletVerificationFragment extends Fragment {
@Override
public void onResume() {
super.onResume();
if (!Lbry.SDK_READY) {
Context context = getContext();
if (context instanceof VerificationActivity) {
VerificationActivity activity = (VerificationActivity) context;
activity.addSdkStatusListener(this);
}
Helper.setViewVisibility(loading, View.VISIBLE);
Helper.setViewVisibility(textLoading, View.VISIBLE);
} else {
onSdkReady();
}
}
@Override
public void onStop() {
Context context = getContext();
if (context instanceof VerificationActivity) {
VerificationActivity activity = (VerificationActivity) context;
activity.removeSdkStatusListener(this);
}
super.onStop();
}
public void onSdkReady() {
start();
}
@@ -463,7 +463,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
double sentAmount = actualSendAmount;
String message = getResources().getQuantityString(
R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2,
new DecimalFormat("#,###.##").format(sentAmount));
new DecimalFormat("#,###.####").format(sentAmount));
Helper.setViewText(inputSendAddress, null);
Helper.setViewText(inputSendAmount, null);
if (view != null) {
@@ -29,9 +29,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.common.util.Hex;
import org.apache.commons.codec.binary.Hex;
import org.bitcoinj.core.Base58;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -39,7 +38,7 @@ import org.json.JSONObject;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
@@ -348,6 +347,10 @@ public final class Helper {
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) {
List<String> sortOrder = new ArrayList<>();
switch (sortBy) {
@@ -791,9 +794,9 @@ public final class Helper {
public static String SHA256(String value) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(value.getBytes("UTF-8"));
return Hex.bytesToStringLowercase(hash);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
byte[] hash = digest.digest(value.getBytes(StandardCharsets.UTF_8));
return Hex.encodeHexString(hash, true);
} catch (NoSuchAlgorithmException ex) {
return null;
}
}
@@ -10,7 +10,7 @@ import lombok.Data;
@Data
public class LbryUri {
public static final String LBRY_TV_BASE_URL = "https://lbry.tv";
public static final String LBRY_TV_BASE_URL = "https://lbry.tv/";
public static final String PROTO_DEFAULT = "lbry://";
public static final String REGEX_INVALID_URI = "[ =&#:$@%?;/\\\\\"<>%\\{\\}|^~\\[\\]`\u0000-\u0008\u000b-\u000c\u000e-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]";
public static final String REGEX_ADDRESS = "^(b)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$";
@@ -18,7 +18,7 @@ public class LbryUri {
public static final int CLAIM_ID_MAX_LENGTH = 40;
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_MODIFIER_SEPARATOR = "([:$#]?)([^/]*)";
private static final String QUERY_STRING_BREAKER = "^([\\S]+)([?][\\S]*)";
@@ -128,9 +128,14 @@ public class LbryUri {
boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName);
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 '#'
if (components.get(1).equals("open.lbry.com/")) {
/*
* It would have thrown already on the RegEx parser if protocol value was incorrect
* or HTTPS host was unknown to us.
*
* [https://] hosts use ':' as ModSeparators while [lbry://] protocol expects '#'
*/
if (!components.get(1).isEmpty()) {
if (primaryModSeparator.equals(":"))
primaryModSeparator = "#";
if (secondaryModSeparator.equals(":"))
@@ -178,7 +183,7 @@ public class LbryUri {
return uri;
}
public String build(boolean includeProto, String protoDefault, boolean vanity) {
public String build(boolean includeProto, String protocol, boolean vanity) {
String formattedChannelName = null;
if (channelName != null) {
formattedChannelName = channelName.startsWith("@") ? channelName : String.format("@%s", channelName);
@@ -201,7 +206,7 @@ public class LbryUri {
StringBuilder sb = new StringBuilder();
if (includeProto) {
sb.append(protoDefault);
sb.append(protocol);
}
sb.append(primaryClaimName);
if (vanity) {
@@ -219,79 +224,34 @@ public class LbryUri {
if (!Helper.isNullOrEmpty(primaryClaimId)) {
sb.append('#').append(primaryClaimId);
}
if (primaryClaimSequence > 0) {
} else if (primaryClaimSequence > 0) {
sb.append(':').append(primaryClaimSequence);
}
if (primaryBidPosition > 0) {
} else if (primaryBidPosition > 0) {
sb.append('$').append(primaryBidPosition);
}
if (!Helper.isNullOrEmpty(secondaryClaimName)) {
sb.append('/').append(secondaryClaimName);
}
if (!Helper.isNullOrEmpty(secondaryClaimId)) {
sb.append('#').append(secondaryClaimId);
}
if (secondaryClaimSequence > 0) {
} else if (secondaryClaimSequence > 0) {
sb.append(':').append(secondaryClaimSequence);
}
if (secondaryBidPosition > 0) {
} else if (secondaryBidPosition > 0) {
sb.append('$').append(secondaryBidPosition);
}
return sb.toString();
}
public String toTvString() {
String formattedChannelName = null;
if (channelName != null) {
formattedChannelName = channelName.startsWith("@") ? channelName : String.format("@%s", channelName);
}
String primaryClaimName = claimName;
if (Helper.isNullOrEmpty(primaryClaimName)) {
primaryClaimName = contentName;
}
if (Helper.isNullOrEmpty(primaryClaimName)) {
primaryClaimName = formattedChannelName;
}
if (Helper.isNullOrEmpty(primaryClaimName)) {
primaryClaimName = streamName;
}
String primaryClaimId = claimId;
if (Helper.isNullOrEmpty(primaryClaimId)) {
primaryClaimId = !Helper.isNullOrEmpty(formattedChannelName) ? channelClaimId : streamClaimId;
}
StringBuilder sb = new StringBuilder();
sb.append(LBRY_TV_BASE_URL).append('/');
sb.append(primaryClaimName);
String secondaryClaimName = null;
if (Helper.isNullOrEmpty(claimName) && !Helper.isNullOrEmpty(contentName)) {
secondaryClaimName = contentName;
}
if (Helper.isNullOrEmpty(secondaryClaimName)) {
secondaryClaimName = !Helper.isNullOrEmpty(formattedChannelName) ? streamName : null;
}
String secondaryClaimId = !Helper.isNullOrEmpty(secondaryClaimName) ? streamClaimId : null;
if (!Helper.isNullOrEmpty(primaryClaimId)) {
sb.append(':').append(primaryClaimId);
}
if (!Helper.isNullOrEmpty(secondaryClaimName)) {
sb.append('/').append(secondaryClaimName);
}
if (!Helper.isNullOrEmpty(secondaryClaimId)) {
sb.append(':').append(secondaryClaimId);
}
return sb.toString();
}
public static String normalize(String url) throws LbryUriException {
return parse(url).toString();
}
public String toTvString() {
return build(true, LBRY_TV_BASE_URL, false);
}
public String toVanityString() {
return build(true, PROTO_DEFAULT, true);
}
@@ -333,6 +333,15 @@ public final class Lbryio {
}
}
public static void updateSubscriptionNotificationsDisabled(Subscription subscription) {
synchronized (lock) {
int index = subscriptions.indexOf(subscription);
if (index > -1) {
subscriptions.get(index).setNotificationsDisabled(subscription.isNotificationsDisabled());
}
}
}
public static void addSubscription(Subscription subscription) {
synchronized (lock) {
if (!subscriptions.contains(subscription)) {
@@ -364,6 +373,15 @@ public final class Lbryio {
public static boolean isFollowing(Claim claim) {
return subscriptions.contains(Subscription.fromClaim(claim));
}
public static boolean isNotificationsDisabled(Claim claim) {
Subscription sub = Subscription.fromClaim(claim);
int index = subscriptions.indexOf(sub);
if (index > -1) {
Subscription actual = subscriptions.get(subscriptions.indexOf(sub));
return actual.isNotificationsDisabled();
}
return false;
}
public static void updateRewardsLists(List<Reward> rewards) {
synchronized (lock) {
@@ -493,7 +493,35 @@ public final class Predefined {
"covidcuts",
"covid-19"
);
public static final List<String> MATURE_TAGS = Arrays.asList("mature", "nsfw", "porn", "xxx");
public static final List<String> MATURE_TAGS = Arrays.asList(
"porn",
"porno",
"nsfw",
"mature",
"xxx",
"sex",
"creampie",
"blowjob",
"handjob",
"vagina",
"boobs",
"big boobs",
"big dick",
"pussy",
"cumshot",
"anal",
"hard fucking",
"ass",
"fuck",
"hentai"
);
// Subset of mature tags to be displayed on the publish page
public static final List<String> PUBLISH_MATURE_TAGS = Arrays.asList(
"porn",
"nsfw",
"mature",
"xxx"
);
public static final List<String> ADJECTIVES = Arrays.asList(
"aback",
"abaft",
@@ -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

@@ -31,7 +31,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_close"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
<ProgressBar
+10 -166
View File
@@ -62,7 +62,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_close"
android:tint="@color/actionBarForeground" />
app:tint="@color/actionBarForeground" />
</LinearLayout>
<RelativeLayout
@@ -79,7 +79,7 @@
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_notifications"
android:tint="@color/actionBarForeground" />
app:tint="@color/actionBarForeground" />
<TextView
android:id="@+id/notifications_badge_count"
android:layout_width="wrap_content"
@@ -156,173 +156,17 @@
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
<LinearLayout
<ListView
android:id="@+id/startup_stage_error_listview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_install_id"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/installation_id_loaded"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
android:divider="@android:color/transparent"
android:dividerHeight="8dp"
android:scrollbars="none"
tools:listitem="@layout/list_item_startupstage">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_known_tags"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/known_tags_loaded"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_exchange_rate"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/exchange_rate_loaded"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_user_authenticated"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/user_authenticated"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_install_new"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/installation_registered"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_subscriptions_loaded"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/subscriptions_loaded"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/startup_stage_icon_subscriptions_resolved"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tint="@color/white"
android:src="@drawable/ic_check" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/subscriptions_resolved"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
</ListView>
</LinearLayout>
</RelativeLayout>
+24 -36
View File
@@ -38,6 +38,12 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_above="@id/wallet_balance_usd_value">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/wallet_balance_value"
android:layout_width="wrap_content"
@@ -48,15 +54,6 @@
android:textSize="36sp"
android:textFontWeight="300"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:fontFamily="@font/inter"
android:text="@string/lbc"
android:textColor="@color/white"
android:textSize="16sp"
android:textFontWeight="300" />
</LinearLayout>
<TextView
android:id="@+id/wallet_balance_usd_value"
@@ -145,6 +142,12 @@
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits"
android:layout_marginEnd="4dp" />
<TextView
android:id="@+id/wallet_balance_tips"
android:layout_width="wrap_content"
@@ -152,15 +155,6 @@
android:fontFamily="@font/inter"
android:text="0"
android:textSize="24sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:fontFamily="@font/inter"
android:text="@string/lbc"
android:textAllCaps="true"
android:textSize="10sp"
android:textFontWeight="300" />
</LinearLayout>
<TextView
@@ -248,6 +242,12 @@
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits"
android:layout_marginEnd="4dp" />
<TextView
android:id="@+id/wallet_balance_staked_publishes"
android:layout_width="wrap_content"
@@ -255,15 +255,6 @@
android:fontFamily="@font/inter"
android:text="0"
android:textSize="24sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:fontFamily="@font/inter"
android:text="@string/lbc"
android:textAllCaps="true"
android:textSize="10sp"
android:textFontWeight="300" />
</LinearLayout>
<TextView
@@ -278,6 +269,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits"
android:layout_marginEnd="4dp" />
<TextView
android:id="@+id/wallet_balance_staked_supports"
android:layout_width="wrap_content"
@@ -285,15 +282,6 @@
android:fontFamily="@font/inter"
android:text="0"
android:textSize="24sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:fontFamily="@font/inter"
android:text="@string/lbc"
android:textAllCaps="true"
android:textSize="10sp"
android:textFontWeight="300" />
</LinearLayout>
<TextView
@@ -72,10 +72,11 @@
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" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/wallet_inline_balance_value"
android:layout_width="wrap_content"
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/comment_form_card"
android:orientation="vertical"
android:layout_width="match_parent"
@@ -47,22 +48,25 @@
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:visibility="gone">
<View
android:id="@+id/comment_form_reply_to_vertical_bar"
android:layout_width="3dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/nextLbryGreen" />
android:background="@color/nextLbryGreen"
android:orientation="vertical" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="40dp">
android:layout_marginEnd="40dp"
android:orientation="vertical">
<TextView
android:id="@+id/comment_form_replying_to_text"
android:layout_width="wrap_content"
@@ -77,25 +81,26 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:lineSpacingMultiplier="1.05"
android:fontFamily="@font/inter"
android:lineSpacingMultiplier="1.05"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/comment_form_clear_reply_to"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_alignParentEnd="true"
android:layout_width="36dp"
android:layout_height="36dp">
android:layout_height="36dp"
android:layout_alignParentEnd="true"
android:background="?attr/selectableItemBackground"
android:clickable="true">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_close"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
@@ -168,12 +173,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/comment_form_post"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter" />
android:layout_centerVertical="true"
android:fontFamily="@font/inter"
android:text="@string/comment_form_post" />
<ProgressBar
android:id="@+id/comment_form_post_progress"
android:layout_width="20dp"
@@ -62,10 +62,11 @@
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" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/inline_channel_form_inline_balance_value"
android:layout_width="wrap_content"
+13 -8
View File
@@ -71,13 +71,18 @@
android:textSize="16sp"
android:textAlignment="center" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notifications_list"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/notifications_list_swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:clipToPadding="false"
/>
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notifications_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:clipToPadding="false"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</RelativeLayout>
<include layout="@layout/floating_wallet_balance" />
@@ -169,9 +174,9 @@
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground"
android:src="@drawable/ic_close"
android:layout_centerInParent="true"/>
android:layout_centerInParent="true"
app:tint="@color/foreground" />
</RelativeLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
+11 -10
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -44,8 +45,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -70,8 +71,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -96,8 +97,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -122,8 +123,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -148,7 +149,7 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
</LinearLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -53,8 +54,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -88,7 +89,7 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
</LinearLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -35,7 +36,7 @@
android:layout_height="18dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_trending"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
<TextView
android:layout_toEndOf="@+id/sort_by_trending_item_icon"
android:layout_width="wrap_content"
@@ -53,8 +54,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -70,7 +71,7 @@
android:layout_height="18dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_new"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
<TextView
android:layout_toEndOf="@+id/sort_by_new_item_icon"
android:layout_width="wrap_content"
@@ -88,8 +89,8 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout
@@ -105,7 +106,7 @@
android:layout_height="18dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_top"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
<TextView
android:layout_toEndOf="@+id/sort_by_top_item_icon"
android:layout_width="wrap_content"
@@ -123,7 +124,7 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_check"
android:tint="@color/lbryGreen"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/lbryGreen" />
</RelativeLayout>
</LinearLayout>
@@ -103,10 +103,11 @@
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" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/create_support_inline_balance_value"
android:layout_width="wrap_content"
@@ -158,7 +159,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/send_lbc_tip"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" />
</RelativeLayout>
@@ -127,10 +127,11 @@
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" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/repost_inline_balance_value"
android:layout_width="wrap_content"
@@ -22,7 +22,7 @@
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_replay_10"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
@@ -74,7 +74,7 @@
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_forward_10"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
@@ -92,7 +92,7 @@
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_cast"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
@@ -133,7 +133,7 @@
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_fullscreen"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
@@ -8,7 +8,7 @@
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:elevation="4dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:id="@+id/floating_reward_container"
@@ -50,19 +50,17 @@
android:foreground="?attr/selectableItemBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/floating_reward_container"
android:layout_toEndOf="@id/floating_reward_container"
android:layout_marginStart="-36dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="12dp"
android:paddingEnd="16dp">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="16dp"
android:layout_height="16dp"
android:textSize="10dp"
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textColor="@color/white"
android:text="@string/fa_coins" />
android:src="@drawable/ic_credits" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -79,7 +79,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
<TextView
@@ -120,7 +120,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
<TextView
@@ -161,7 +161,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
</LinearLayout>
+40 -8
View File
@@ -157,8 +157,8 @@
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground"
android:src="@drawable/ic_edit" />
android:src="@drawable/ic_edit"
app:tint="@color/foreground" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_delete"
@@ -172,8 +172,8 @@
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground"
android:src="@drawable/ic_delete" />
android:src="@drawable/ic_delete"
app:tint="@color/foreground" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_share"
@@ -186,8 +186,8 @@
android:layout_centerInParent="true"
android:layout_width="22dp"
android:layout_height="22dp"
android:tint="@color/foreground"
android:src="@drawable/ic_share" />
android:src="@drawable/ic_share"
app:tint="@color/foreground" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_tip"
@@ -208,13 +208,27 @@
android:id="@+id/channel_view_follow_unfollow"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="36dp"
android:layout_width="wrap_content"
android:layout_height="36dp">
<TextView
android:id="@+id/channel_view_text_follow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:fontFamily="@font/inter"
android:text="@string/follow"
android:textSize="12sp"
android:textStyle="bold"
android:textAllCaps="true" />
<io.lbry.browser.ui.controls.OutlineIconView
android:id="@+id/channel_view_icon_follow"
android:layout_centerInParent="true"
android:layout_toRightOf="@id/channel_view_text_follow"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:text="@string/fa_heart"
android:textColor="@color/red"
android:textSize="20dp" />
@@ -224,9 +238,27 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:text="@string/fa_heart_broken"
android:textColor="@color/foreground"
android:textSize="20dp"
android:visibility="invisible"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/channel_view_subscribe_notify"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/channel_view_icon_bell"
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:text="@string/fa_bell_slash"
android:textColor="@color/foreground"
android:textSize="20dp"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
@@ -56,7 +56,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
<LinearLayout
@@ -85,7 +85,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
</LinearLayout>
@@ -38,7 +38,7 @@
android:layout_height="16dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
@@ -112,7 +112,7 @@
android:layout_height="16dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
@@ -215,10 +215,11 @@
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" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/channel_form_inline_balance_value"
android:layout_width="wrap_content"
+331 -191
View File
@@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/file_view_global_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -36,60 +37,66 @@
<LinearLayout
android:id="@+id/file_view_claim_display_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
<RelativeLayout
android:id="@+id/file_view_media_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="246dp">
android:layout_height="246dp"
android:background="@color/mediaContainerBackground">
<RelativeLayout
android:id="@+id/file_view_media_meta_container"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:clickable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
android:id="@+id/file_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/file_view_main_action_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true" />
<com.google.android.material.button.MaterialButton
android:id="@+id/file_view_main_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/inter"
android:text="@string/play"
android:textSize="14sp"
android:visibility="invisible"
android:text="@string/play" />
android:visibility="invisible" />
<LinearLayout
android:id="@+id/file_view_fee_container"
android:background="@drawable/bg_stream_cost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentEnd="true"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:background="@drawable/bg_stream_cost"
android:orientation="horizontal"
android:paddingStart="6dp"
android:paddingTop="2dp"
android:paddingEnd="7dp"
android:paddingBottom="2dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textSize="8dp"
android:text="@string/fa_coins"
android:textColor="@android:color/black" />
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/file_view_fee"
android:layout_width="wrap_content"
@@ -98,22 +105,24 @@
android:layout_marginStart="1dp"
android:fontFamily="@font/inter"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textFontWeight="300" />
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
</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:background="@android:color/black"
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"
app:controller_layout_id="@layout/exo_playback_control_view"/>
app:controller_layout_id="@layout/exo_playback_control_view" />
<ProgressBar
android:id="@+id/player_buffering_progress"
android:layout_width="36dp"
@@ -124,40 +133,52 @@
<RelativeLayout
android:id="@+id/file_view_unsupported_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/mediaContainerBackground"
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_height="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content" />
android:src="@drawable/gerbil_happy" />
<LinearLayout
android:layout_toEndOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="24dp"
android:layout_centerVertical="true">
android:layout_toEndOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/unsupported_content"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/unsupported_content" />
android:textSize="18sp" />
<TextView
android:id="@+id/file_view_unsupported_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/unsupported_content_desc"
android:textColor="@color/white"
android:textSize="14sp"
android:textFontWeight="300"
android:textSize="14sp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/file_view_open_external_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/open"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
@@ -167,31 +188,37 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/card_reward_driver"
android:visibility="gone"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
layout="@layout/card_reward_driver"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/file_view_title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clickable="true"
android:paddingStart="16dp"
android:paddingEnd="4dp">
android:paddingTop="8dp"
android:paddingEnd="4dp"
android:paddingBottom="8dp">
<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_marginEnd="48dp">
android:layout_centerVertical="true"
android:layout_marginEnd="48dp"
android:orientation="vertical">
<TextView
android:id="@+id/file_view_title"
android:layout_width="wrap_content"
@@ -199,39 +226,42 @@
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">
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:orientation="horizontal">
<TextView
android:id="@+id/file_view_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300"
android:textSize="12sp"
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" />
android:textFontWeight="300"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/file_view_desc_toggle_arrow"
android:src="@drawable/ic_arrow_dropdown"
android:layout_toStartOf="@+id/file_view_title_layout"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground" />
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/file_view_title_layout"
android:src="@drawable/ic_arrow_dropdown"
app:tint="@color/foreground" />
</RelativeLayout>
<LinearLayout
@@ -240,235 +270,291 @@
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:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
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_share" />
android:src="@drawable/ic_share"
app:tint="@color/foreground" />
</RelativeLayout>
<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" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/share"
android:textSize="12sp" />
</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_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:textSize="20dp"
android:text="@string/fa_gift"/>
android:text="@string/fa_gift"
android:textColor="@color/foreground"
android:textSize="20dp" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/support"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/support"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_repost"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_repost"/>
android:text="@string/fa_repost"
android:textColor="@color/foreground"
android:textSize="20dp" />
</RelativeLayout>
<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" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/repost"
android:textSize="12sp" />
</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:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<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_edit" />
android:src="@drawable/ic_edit"
app:tint="@color/foreground" />
</RelativeLayout>
<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" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/edit"
android:textSize="12sp" />
</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:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ProgressBar
android:id="@+id/file_view_download_progress"
style="?android:progressBarStyleHorizontal"
android:layout_width="36dp"
android:layout_height="36dp"
style="?android:progressBarStyleHorizontal"
android:progressDrawable="@drawable/determinate_progress_circle"
android:visibility="gone" />
<ImageView
android:id="@+id/file_view_action_download_icon"
android:tint="@color/foreground"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_download" />
android:src="@drawable/ic_download"
app:tint="@color/foreground" />
</RelativeLayout>
<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" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/download"
android:textSize="12sp" />
</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:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<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_delete" />
android:src="@drawable/ic_delete"
app:tint="@color/foreground" />
</RelativeLayout>
<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" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/delete"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_unpublish"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
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:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_unpublish"
app:tint="@color/foreground" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/unpublish"
android:textSize="12sp" />
</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:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
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_report" />
android:src="@drawable/ic_report"
app:tint="@color/foreground" />
</RelativeLayout>
<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" />
android:layout_gravity="center_horizontal"
android:fontFamily="@font/inter"
android:text="@string/report"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="12dp"
android:layout_height="0.5dp" />
android:background="@color/divider" />
<RelativeLayout
android:id="@+id/file_view_publisher_area"
@@ -477,14 +563,15 @@
<LinearLayout
android:id="@+id/file_view_publisher_info_area"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:layout_toStartOf="@id/file_view_publisher_area_actions"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:paddingStart="16dp"
android:paddingBottom="12dp"
android:layout_toStartOf="@id/file_view_icon_follow">
android:paddingTop="12dp"
android:paddingBottom="12dp">
<RelativeLayout
android:id="@+id/file_view_publisher_avatar"
android:layout_width="50dp"
@@ -492,28 +579,31 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:visibility="gone">
<RelativeLayout
android:layout_centerHorizontal="true"
android:background="@drawable/bg_channel_icon"
android:id="@+id/file_view_publisher_no_thumbnail"
android:layout_width="50dp"
android:layout_height="50dp">
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:background="@drawable/bg_channel_icon">
<TextView
android:id="@+id/file_view_publisher_thumbnail_alpha"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/inter"
android:textAllCaps="true"
android:textSize="24sp"
android:textColor="@color/white"
android:textFontWeight="300" />
android:textFontWeight="300"
android:textSize="24sp" />
</RelativeLayout>
<ImageView
android:layout_centerHorizontal="true"
android:id="@+id/file_view_publisher_thumbnail"
android:layout_width="50dp"
android:layout_height="50dp" />
android:layout_height="50dp"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<LinearLayout
@@ -522,6 +612,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/file_view_publisher_title"
android:layout_width="wrap_content"
@@ -530,6 +621,7 @@
android:textFontWeight="300"
android:textSize="14sp"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publisher_name"
android:layout_width="wrap_content"
@@ -541,109 +633,153 @@
</LinearLayout>
</LinearLayout>
<io.lbry.browser.ui.controls.OutlineIconView
android:id="@+id/file_view_icon_follow"
android:clickable="true"
android:background="?attr/selectableItemBackground"
<LinearLayout
android:id="@+id/file_view_publisher_area_actions"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/fa_heart"
android:textColor="@color/red"
android:textSize="20dp" />
android:orientation="horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_unfollow"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/fa_heart_broken"
android:textSize="20dp"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/file_view_icon_follow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:orientation="horizontal"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:fontFamily="@font/inter"
android:text="@string/follow"
android:textAllCaps="true"
android:textSize="12sp"
android:textStyle="bold" />
<io.lbry.browser.ui.controls.OutlineIconView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/fa_heart"
android:textColor="@color/red"
android:textSize="20dp" />
</LinearLayout>
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_unfollow"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:text="@string/fa_heart_broken"
android:textColor="@color/foreground"
android:textSize="20dp"
android:visibility="gone" />
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_bell"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:text="@string/fa_bell_slash"
android:textColor="@color/foreground"
android:textSize="20dp"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
android:background="@color/divider" />
<LinearLayout
android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
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:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:autoLink="all"
android:fontFamily="@font/inter"
android:textColorLink="@color/lbryGreen"
android:textFontWeight="300"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" />
android:textSize="12sp" />
<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:paddingTop="36dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
android:layout_marginEnd="16dp"
android:layout_weight="10"
android:orientation="horizontal"
android:paddingTop="36dp">
<TextView
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:fontFamily="@font/inter"
android:text="@string/tags"
android:textSize="12sp"
android:textFontWeight="600" />
android:textFontWeight="600"
android:textSize="12sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginStart="8dp"
android:layout_width="0dp"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="8" />
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
android:background="@color/divider" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_related_content_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
android:layout_marginBottom="8dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/related_content"
android:layout_centerVertical="true"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:layout_centerVertical="true" />
android:text="@string/related_content"
android:textSize="16sp" />
<ProgressBar
android:id="@+id/file_view_related_content_progress"
android:layout_width="16dp"
@@ -652,23 +788,25 @@
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_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_related_content"
android:textSize="14sp"
android:textFontWeight="300"
android:textSize="14sp"
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_height="wrap_content"
android:overScrollMode="never" />
</LinearLayout>
<View
@@ -681,14 +819,15 @@
android:id="@+id/file_view_comments_area"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:orientation="vertical">
android:orientation="vertical"
android:paddingBottom="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
<ProgressBar
android:id="@+id/file_view_comments_progress"
android:layout_width="16dp"
@@ -713,8 +852,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_comments"
android:textFontWeight="300"
@@ -751,4 +890,5 @@
android:visibility="gone">
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -82,7 +82,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
<LinearLayout
@@ -110,7 +110,7 @@
android:layout_marginStart="2dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_dropdown"
android:tint="@color/foreground" />
app:tint="@color/foreground" />
</LinearLayout>
<TextView
+1 -2
View File
@@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.gallery.GalleryFragment">
android:layout_height="match_parent">
<TextView
android:id="@+id/text_gallery"
+1 -2
View File
@@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">
android:layout_height="match_parent">
<TextView
android:id="@+id/text_home"
+6 -6
View File
@@ -36,8 +36,8 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:tint="@color/white"
android:src="@drawable/ic_record" />
android:src="@drawable/ic_record"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -76,8 +76,8 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:tint="@color/white"
android:src="@drawable/ic_photo" />
android:src="@drawable/ic_photo"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -116,8 +116,8 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:tint="@color/white"
android:src="@drawable/ic_upload" />
android:src="@drawable/ic_upload"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/pageBackground">
@@ -48,7 +49,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:fontFamily="@font/inter"
android:text="@string/uploading"
android:text="@string/uploading_thumbnail"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="12sp" />
@@ -67,7 +68,7 @@
android:layout_height="16dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
app:tint="@color/white" />
</RelativeLayout>
</RelativeLayout>
@@ -316,7 +317,7 @@
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/publish_form_currency_spinner"
android:entries="@array/publish_currencies"
android:layout_width="110dp"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/publish_form_price_layout"
android:layout_marginStart="4dp"
@@ -436,10 +437,11 @@
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" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/publish_form_inline_balance_value"
android:layout_width="wrap_content"
+2 -2
View File
@@ -80,8 +80,8 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:tint="@color/white"
android:src="@drawable/ic_share" />
android:src="@drawable/ic_share"
app:tint="@color/white" />
</RelativeLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -91,12 +92,11 @@
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="16dp"
android:layout_height="16dp"
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textSize="12dp"
android:text="@string/fa_coins" />
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/claim_fee"
android:layout_width="wrap_content"
@@ -119,7 +119,7 @@
android:layout_height="36dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_check"
android:tint="@color/nextLbryGreen" />
app:tint="@color/nextLbryGreen" />
</RelativeLayout>
</RelativeLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
@@ -101,13 +102,11 @@
android:paddingStart="6dp"
android:paddingEnd="7dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textSize="8dp"
android:text="@string/fa_coins"
android:textColor="@android:color/black"/>
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/claim_fee"
android:layout_width="wrap_content"
@@ -131,7 +130,7 @@
android:layout_height="36dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_check"
android:tint="@color/nextLbryGreen" />
app:tint="@color/nextLbryGreen" />
</RelativeLayout>
</RelativeLayout>
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="match_parent"
@@ -28,6 +29,20 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:visibility="invisible" />
<RelativeLayout
android:layout_centerHorizontal="true"
android:background="@drawable/bg_channel_overlay_icon"
android:id="@+id/notification_selected_overlay"
android:layout_width="48dp"
android:layout_height="48dp"
android:visibility="gone">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_check"
app:tint="@color/nextLbryGreen" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
+3 -2
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:layout_width="match_parent"
@@ -23,9 +24,9 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerInParent="true"
android:tint="@color/lbryGreen"
android:src="@drawable/ic_check_circle"
android:visibility="invisible" />
android:visibility="invisible"
app:tint="@color/lbryGreen" />
<ProgressBar
android:id="@+id/reward_item_loading"
android:layout_centerInParent="true"
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/startup_stage_icon"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_check"
app:tint="@color/white" />
<TextView
android:id="@+id/startup_stage_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
tools:text="@string/installation_id_loaded"
android:textColor="@color/white"
android:textFontWeight="300"
android:textSize="14sp" />
</LinearLayout>
+4 -5
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -106,13 +107,11 @@
android:paddingStart="6dp"
android:paddingEnd="7dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textSize="8dp"
android:text="@string/fa_coins"
android:textColor="@android:color/black"/>
android:src="@drawable/ic_credits" />
<TextView
android:id="@+id/claim_fee"
android:layout_width="wrap_content"
@@ -136,7 +135,7 @@
android:layout_height="36dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_check"
android:tint="@color/nextLbryGreen" />
app:tint="@color/nextLbryGreen" />
</RelativeLayout>
<LinearLayout
android:id="@+id/claim_thumbnail_placeholder"
+2 -1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -18,7 +19,7 @@
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="4dp"
android:tint="@color/darkForeground" />
app:tint="@color/darkForeground" />
<TextView
android:id="@+id/tag_name"
android:layout_width="wrap_content"
@@ -26,7 +26,7 @@
/>
<TextView
android:id="@+id/transaction_amount"
android:gravity="right"
android:gravity="end"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -34,7 +34,9 @@
android:fontFamily="@font/inter"
android:singleLine="true"
android:textSize="14sp"
android:textFontWeight="300" />
android:textFontWeight="300"
android:textAlignment="viewEnd"
android:textDirection="ltr"/>
</LinearLayout>
<LinearLayout
@@ -60,7 +62,7 @@
/>
<TextView
android:id="@+id/transaction_fee"
android:gravity="right"
android:gravity="end"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -90,10 +92,11 @@
android:textColor="@color/lbryGreen"
android:textSize="12sp"
android:textFontWeight="300"
android:textAlignment="viewStart"
/>
<TextView
android:id="@+id/transaction_date"
android:gravity="right"
android:gravity="end"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -106,7 +109,7 @@
android:visibility="gone" />
<TextView
android:id="@+id/transaction_pending_text"
android:gravity="right"
android:gravity="end"
android:layout_weight="4"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_delete"
android:icon="@drawable/ic_delete"
android:title="@string/delete"
app:iconTint="@color/actionBarForeground"
app:showAsAction="always" />
</menu>
+46 -26
View File
@@ -28,7 +28,7 @@
<string name="welcome_to_lbry">Welcome to LBRY.</string>
<string name="welcome_paragraph">LBRY is a community-controlled content platform where you can find and publish videos, music, books, and more.</string>
<string name="welcome_tos">By continuing, I agree to the &lt;a href="https://lbry.com/termsofservice"&gt;Terms of Service&lt;/a&gt; and confirm I am over the age of 13.</string>
<string name="welcome_please_wait">Please wait while we get some things ready...</string>
<string name="welcome_please_wait">Please wait while we get some things ready…</string>
<string name="use_lbry">Use LBRY »</string>
<!-- URI bar -->
@@ -40,7 +40,7 @@
<string name="discover">Discover</string>
<string name="lbry_works_better">LBRY works better if you follow at least 5 creators you like. Sign in to show creators you follow if you already have an account.</string>
<string name="select_five_subscriptions">Please select up to 5 creators to continue.</string>
<string name="n_remaining">%1$d remaining...</string>
<string name="n_remaining">%1$d remaining…</string>
<string name="done">Done</string>
<string name="all">All</string>
<string name="discover_channels">Discover new channels</string>
@@ -58,7 +58,7 @@
<string name="download">Download</string>
<string name="open">Open</string>
<string name="report">Report</string>
<string name="loading_decentralized_data">Loading decentralized data...</string>
<string name="loading_decentralized_data">Loading decentralized data…</string>
<string name="related_content">Related Content</string>
<string name="comments">Comments</string>
<string name="no_comments">No comments to display at this time.</string>
@@ -87,10 +87,20 @@
<string name="comment_as">Comment as</string>
<string name="please_enter_comment">Please enter a comment to post.</string>
<string name="please_select_channel">Please select a channel to post your comment as.</string>
<string name="comment_form_post">Post</string>
<string name="comment_posted">Your comment was successfully posted.</string>
<string name="please_select_repost_channel">Please select a channel to repost on.</string>
<string name="reply">Reply</string>
<string name="replying_to">Replying to %1$s</string>
<string name="choose_app">Choose app</string>
<plurals name="view_count">
<item quantity="one">%1$s view</item>
<item quantity="other">%1$s views</item>
</plurals>
<plurals name="confirm_purchase_message">
<item quantity="one">This will purchase "%1$s" for %2$s credit</item>
<item quantity="other">This will purchase "%1$s" for %2$s credits</item>
</plurals>
<plurals name="post_and_tip">
<item quantity="one">Post and tip %1$s credit?</item>
<item quantity="other">Post and tip %1$s credits?</item>
@@ -103,20 +113,16 @@
<item quantity="one">This will post your comment with a tip of %1$s credit for %2$s</item>
<item quantity="other">This will post your comment with a tip of %1$s credits for %2$s</item>
</plurals>
<plurals name="view_count">
<item quantity="one">%1$s view</item>
<item quantity="other">%1$s views</item>
</plurals>
<plurals name="confirm_purchase_message">
<item quantity="one">This will purchase "%1$s" for %2$s credit</item>
<item quantity="other">This will purchase "%1$s" for %2$s credits</item>
</plurals>
<!-- Channel view -->
<string name="no_channel_info">There\'s nothing here yet.\nPlease check back later.</string>
<string name="content">Content</string>
<string name="website">Website</string>
<string name="reposted">reposted</string>
<string name="receive_all_notifications">You will receive all notifications</string>
<string name="receive_no_notifications">You will not receive notifications for this channel</string>
<string name="confirm_unfollow">Stop following channel?</string>
<string name="confirm_unfollow_message">Are you sure you want to stop following this channel?</string>
<plurals name="follower_count">
<item quantity="one">%1$s follower</item>
<item quantity="other">%1$s followers</item>
@@ -128,7 +134,7 @@
<string name="take_photo">Take a Photo</string>
<string name="upload_file">Upload a file</string>
<string name="no_videos_found">We could not find any videos on your device. Take a photo or record a video to get started.</string>
<string name="loading_videos">Please wait while we load your videos...</string>
<string name="loading_videos">Please wait while we load your videos…</string>
<string name="storage_permission_rationale_videos">LBRY requires access to be able to display and publish your videos, images and other files from your device.</string>
<string name="camera_permission_rationale_record">LBRY requires access to your camera to record videos.</string>
<string name="camera_permission_rationale_photo">LBRY requires access to your camera to take photos.</string>
@@ -208,7 +214,7 @@
<string name="cca_nc_nd_4_0_international">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International</string>
<string-array name="publish_currencies">
<item>LBC</item>
<item>LBRY Credits</item>
<item>USD</item>
</string-array>
@@ -227,7 +233,7 @@
<string name="oops_something_went_wrong">Oops! Something went wrong.</string>
<string name="installation_id_loaded">Loaded Installation ID.</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="installation_registered">Installation registered.</string>
<string name="subscriptions_loaded">Loaded subscriptions.</string>
@@ -273,7 +279,7 @@
<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 initializing...</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>
@@ -298,6 +304,7 @@
<string name="receive">Receive</string>
<string name="spend">Spend</string>
<string name="publish">Publish</string>
<string name="unpublish">Unpublish</string>
<string name="support">Support</string>
<string name="abandon">Abandon</string>
<string name="channel">Channel</string>
@@ -313,7 +320,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="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="lbc">LBC</string>
<string name="lbc">Credits</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>
@@ -326,7 +333,7 @@
<string name="insufficient_balance">Insufficient balance</string>
<string name="invalid_amount">Please enter a valid amount</string>
<string name="send_credit_error">Your credits could not be sent at this time. Please try again later.</string>
<string name="loading_transactions">Loading transactions...</string>
<string name="loading_transactions">Loading transactions…</string>
<string name="no_recent_transactions">There are no recent transactions to display.</string>
<string name="no_transactions">There are no transactions to display at this time.</string>
<string name="tx_list_fee">fee %1$s</string>
@@ -337,7 +344,7 @@
<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="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="receive_address_not_set">You do not have a wallet address set. Please generate a new address and try again.</string>
@@ -381,7 +388,11 @@
<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="send_revocable_support">Send Revocable Support</string>
<string name="send_lbc_tip">Send a %1$s LBC Tip</string>
<string name="send_lbc_tip">Tip %1$s</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_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>
@@ -413,8 +424,8 @@
<string name="provide_valid_email">Please enter a valid email address</string>
<string name="please_follow_instructions">Please follow the instructions in the email sent to your address to continue.</string>
<string name="sign_in_successful">You have successfully signed in to lbry.tv</string>
<string name="retrieving_account_information">Retrieving account information...</string>
<string name="apply_wallet_data">Applying wallet data...</string>
<string name="retrieving_account_information">Retrieving account information…</string>
<string name="apply_wallet_data">Applying wallet data…</string>
<string name="please_enter_your_password">Please enter the password you used to secure your wallet.</string>
<string name="please_enter_a_password">Please enter a password to secure your wallet.</string>
<string name="wallet_security_purposes">Note: for wallet security purposes, LBRY is unable to reset your password.</string>
@@ -459,7 +470,7 @@
<!-- Channels -->
<string name="no_channel_created">You have not created a channel.\nStart now by creating a new channel!</string>
<string name="create_a_channel">Create a channel</string>
<string name="create_a_channel_item">Create a channel...</string>
<string name="create_a_channel_item">Create a channel…</string>
<string name="edit_channel">Edit channel</string>
<string name="delete_selection">Delete selection?</string>
<string name="delete_channel">Delete channel?</string>
@@ -467,6 +478,7 @@
<string name="channel_deleted">The channel was successfully deleted.</string>
<string name="channel_failed_delete">The channel could not be deleted at this time. Please try again later.</string>
<string name="description">Description</string>
<string name="follow">Follow</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="show_optional_fields">Show optional fields</string>
@@ -476,7 +488,7 @@
<string name="title">Title</string>
<string name="at">\@</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_images">LBRY requires access to load images from your device storage.</string>
<string name="select_thumbnail">Select thumbnail</string>
@@ -484,7 +496,8 @@
<string name="undetermined_image_filepath">The file path could not be determined for the selected image. Please select an image in a different location.</string>
<string name="wait_for_upload">Please wait for the current upload to finish.</string>
<string name="image_upload_failed">The image upload request failed. Please try again.</string>
<string name="uploading">Uploading...</string>
<string name="uploading">Uploading…</string>
<string name="uploading_thumbnail">Uploading thumbnail…</string>
<string name="please_enter_channel_name">Please enter a channel name.</string>
<string name="channel_name_invalid_characters">Your channel name contains invalid characters.</string>
<string name="channel_name_already_created">You have already created a channel with the same name.</string>
@@ -510,7 +523,7 @@
</plurals>
<!-- 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="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>
@@ -599,7 +612,7 @@
<string name="get_social">Get Social</string>
<string name="social_paragraph">You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.</string>
<string name="app_info">App info</string>
<string name="loading">Loading...</string>
<string name="loading">Loading…</string>
<string name="about_link_what_is_lbry">&lt;a href="https://lbry.com/faq/what-is-lbry"&gt;What is LBRY?&lt;/a&gt;</string>
<string name="about_link_android_basics">&lt;a href="https://lbry.com/faq/android-basics"&gt;Android Basics&lt;/a&gt;</string>
<string name="about_link_faq">&lt;a href="https://lbry.com/faq"&gt;FAQ&lt;/a&gt;</string>
@@ -624,6 +637,10 @@
<!-- Notifications -->
<string name="no_notifications">It\'s quiet here! New notifications will be displayed when you receive them.</string>
<plurals name="confirm_delete_notifications">
<item quantity="one">Are you sure you want to remove the selected notification?</item>
<item quantity="other">Are you sure you want to remove the selected notifications?</item>
</plurals>
<!-- Font Awesome -->
<string name="fa_gift" translatable="false">&#xf06b;</string>
@@ -653,4 +670,7 @@
<string name="fa_comment_alt" translatable="false">&#xf27a;</string>
<string name="fa_broadcast_tower" translatable="false">&#xf519;</string>
<string name="fa_random" translatable="false">&#xf074;</string>
<string name="fa_bell" translatable="false">&#xf0f3;</string>
<string name="fa_bell_slash" translatable="false">&#xf1f6;</string>
</resources>
@@ -0,0 +1,11 @@
package io.lbry.browser.utils;
import junit.framework.TestCase;
public class HelperTest extends TestCase {
public void testSHA256() {
// Using a fake user id, which is a long.
assertEquals("de9edb2044d012f04553e49b04d54cbec8e8a46a40ad5a19bc5dcce1da00ecfd", Helper.SHA256(String.valueOf(12345678912345L)));
}
}
@@ -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;
}
}