Compare commits
118
Commits
unlock-tips
...
0.15.16
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b86444478 | ||
|
|
74c7a1de4d | ||
|
|
88a43dc679 | ||
|
|
1bb5ce72fa | ||
|
|
b4ce544965 | ||
|
|
1ec6f6173a | ||
|
|
8ee19b3f5c | ||
|
|
1055392b7f | ||
|
|
c772cf2ead | ||
|
|
481c50f465 | ||
|
|
71bc969f2a | ||
|
|
e4edebfed7 | ||
|
|
e8a5ab8307 | ||
|
|
3738f3af21 | ||
|
|
74d10e4199 | ||
|
|
080e00becf | ||
|
|
049d905d7d | ||
|
|
33094f8c88 | ||
|
|
6c44e503db | ||
|
|
fa78c80592 | ||
|
|
07630ca97b | ||
|
|
a2b6d4e570 | ||
|
|
9d6b3ddf81 | ||
|
|
0a2769859a | ||
|
|
c4a1ed801a | ||
|
|
453394bf1b | ||
|
|
4b7dfba5a1 | ||
|
|
e699fcf0b3 | ||
|
|
7e80f707e0 | ||
|
|
467f037170 | ||
|
|
89d5b40e5f | ||
|
|
34fba010e1 | ||
|
|
d7396bb044 | ||
|
|
fda0817ad1 | ||
|
|
895ca75506 | ||
|
|
a04448ebe8 | ||
|
|
26ccbf2709 | ||
|
|
7d6c11a88c | ||
|
|
8742913c33 | ||
|
|
8e6e0f0099 | ||
|
|
a4585de807 | ||
|
|
6c24749ad5 | ||
|
|
c73509a4ca | ||
|
|
673b85b2aa | ||
|
|
fe6e60cd67 | ||
|
|
8bcee90d68 | ||
|
|
084407e129 | ||
|
|
4a3db5ae20 | ||
|
|
b36813ebe6 | ||
|
|
cc1ddfa16e | ||
|
|
5f1775d478 | ||
|
|
288e35dd64 | ||
|
|
d4af28d1c5 | ||
|
|
37cf85a5f6 | ||
|
|
c2cbd76f49 | ||
|
|
3d874435c3 | ||
|
|
9ed8864f23 | ||
|
|
61263dd59d | ||
|
|
2707e135c6 | ||
|
|
f9de0d7937 | ||
|
|
f03d58d648 | ||
|
|
f49a3570e9 | ||
|
|
1d97f9008d | ||
|
|
e85ca9114c | ||
|
|
85ed2da518 | ||
|
|
dcc91f75cc | ||
|
|
a40c160ac6 | ||
|
|
e6861c8436 | ||
|
|
e6a5d97fb8 | ||
|
|
ddeb209d51 | ||
|
|
3283b3a607 | ||
|
|
83a41ca6ce | ||
|
|
6c63eb7d66 | ||
|
|
7cf9de8c2a | ||
|
|
a859682954 | ||
|
|
c844c4f896 | ||
|
|
a49cfe91da | ||
|
|
2bacba2c87 | ||
|
|
e473981063 | ||
|
|
34ea4f216c | ||
|
|
52e34b3027 | ||
|
|
c6a6ea0445 | ||
|
|
59ae6340e1 | ||
|
|
cbf2aa2311 | ||
|
|
94b0c7bc01 | ||
|
|
4c50ffac19 | ||
|
|
551e736651 | ||
|
|
0380e35966 | ||
|
|
5de0906fc1 | ||
|
|
c2f17b6230 | ||
|
|
6a3bbe6c0d | ||
|
|
82307c9f98 | ||
|
|
d2ec0e2aa1 | ||
|
|
3951b1080d | ||
|
|
ef7caeeead | ||
|
|
7ef8e2029e | ||
|
|
aaec6ac6a3 | ||
|
|
731960da7c | ||
|
|
ac282d2667 | ||
|
|
7a79601cfc | ||
|
|
d1167e4d2b | ||
|
|
613634adcf | ||
|
|
acbe33c66d | ||
|
|
053ebbd70b | ||
|
|
f5dc4fa4e7 | ||
|
|
343270b757 | ||
|
|
65f5626aba | ||
|
|
a051a73c2b | ||
|
|
6840997793 | ||
|
|
2c98ed2d8d | ||
|
|
6a083c4152 | ||
|
|
b60b5d16c3 | ||
|
|
52cfe8dc12 | ||
|
|
737afca031 | ||
|
|
456f41d28d | ||
|
|
238f59ad71 | ||
|
|
cf6d567193 | ||
|
|
20f8f3852d |
No files matched your search
@@ -2,7 +2,7 @@
|
||||
[](https://ci.lbry.tech/lbry/lbry-android/commits/master)
|
||||
[](https://github.com/lbryio/lbry-android/blob/master/LICENSE)
|
||||
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network. This app bundles [LBRY SDK](https://github.com/lbryio/lbry) as a background service with a UI layer built with React Native.
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network.
|
||||
|
||||
|
||||
<img src="https://spee.ch/@lbry:3f/android-08-homepage.gif" alt="LBRY Android GIF" width="384px" />
|
||||
@@ -18,7 +18,7 @@ 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
|
||||
Please refer to https://github.com/lbryio/lbry-react-native/blob/master/README.md
|
||||
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.
|
||||
|
||||
## Contributing
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing
|
||||
|
||||
+14
-10
@@ -1,3 +1,5 @@
|
||||
import com.google.gms.googleservices.GoogleServicesPlugin
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
@@ -14,8 +16,8 @@ android {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1503
|
||||
versionName "0.15.3"
|
||||
versionCode 1516
|
||||
versionName "0.15.16"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -52,9 +54,9 @@ task printVersionName {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0-rc01'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.2.0-alpha06'
|
||||
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'
|
||||
@@ -62,16 +64,18 @@ dependencies {
|
||||
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-alpha02'
|
||||
implementation 'androidx.webkit:webkit:1.3.0-alpha03'
|
||||
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 'com.github.bumptech.glide:glide:4.11.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||
implementation 'com.google.firebase:firebase-analytics:17.4.0'
|
||||
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.1.6'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.2.0'
|
||||
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
|
||||
@@ -97,9 +101,9 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
__32bitImplementation files('libs/lbrysdk-0.74.0-release__arm.aar')
|
||||
__64bitImplementation files('libs/lbrysdk-0.74.0-release__arm64.aar')
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.79.1'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.79.1'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
|
||||
GoogleServicesPlugin.config.disableVersionCheck = true
|
||||
Binary file not shown.
Binary file not shown.
@@ -56,6 +56,13 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="lbry" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="https" android:host="open.lbry.com"/>
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
||||
Binary file not shown.
@@ -10,20 +10,21 @@ import android.os.Bundle;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import io.lbry.browser.utils.LbryAnalytics;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
|
||||
public class FirstRunActivity extends AppCompatActivity {
|
||||
|
||||
private BroadcastReceiver sdkReadyReceiver;
|
||||
private BroadcastReceiver sdkReceiver;
|
||||
private BroadcastReceiver authReceiver;
|
||||
|
||||
@Override
|
||||
@@ -45,19 +46,26 @@ public class FirstRunActivity extends AppCompatActivity {
|
||||
registerAuthReceiver();
|
||||
if (!Lbry.SDK_READY) {
|
||||
findViewById(R.id.welcome_wait_container).setVisibility(View.VISIBLE);
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(MainActivity.ACTION_SDK_READY);
|
||||
sdkReadyReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// authenticate after we receive the sdk ready event
|
||||
authenticate();
|
||||
}
|
||||
};
|
||||
registerReceiver(sdkReadyReceiver, filter);
|
||||
} else {
|
||||
authenticate();
|
||||
}
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(MainActivity.ACTION_SDK_READY);
|
||||
filter.addAction(LbrynetService.ACTION_STOP_SERVICE);
|
||||
sdkReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (MainActivity.ACTION_SDK_READY.equals(action)) {
|
||||
// authenticate after we receive the sdk ready event
|
||||
authenticate();
|
||||
} else if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
registerReceiver(sdkReceiver, filter);
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
@@ -97,7 +105,8 @@ public class FirstRunActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void handleAuthenticationFailed() {
|
||||
Toast.makeText(this, "Authentication failed.", Toast.LENGTH_LONG).show();
|
||||
findViewById(R.id.welcome_progress_bar).setVisibility(View.GONE);
|
||||
((TextView) findViewById(R.id.welcome_wait_text)).setText(R.string.startup_failed);
|
||||
}
|
||||
|
||||
private void authenticate() {
|
||||
@@ -121,7 +130,7 @@ public class FirstRunActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Helper.unregisterReceiver(authReceiver, this);
|
||||
Helper.unregisterReceiver(sdkReadyReceiver, this);
|
||||
Helper.unregisterReceiver(sdkReceiver, this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -131,7 +140,11 @@ public class FirstRunActivity extends AppCompatActivity {
|
||||
this.context = context;
|
||||
}
|
||||
protected Void doInBackground(Void... params) {
|
||||
Lbryio.authenticate(context);
|
||||
try {
|
||||
Lbryio.authenticate(context);
|
||||
} catch (AuthTokenInvalidatedException ex) {
|
||||
// pass
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.lbry.browser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Notification;
|
||||
@@ -16,6 +17,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
@@ -44,9 +46,14 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.ext.cast.CastPlayer;
|
||||
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
|
||||
import com.google.android.exoplayer2.ui.PlayerNotificationManager;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.upstream.cache.Cache;
|
||||
import com.google.android.gms.cast.framework.CastContext;
|
||||
@@ -56,6 +63,7 @@ import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
import com.google.firebase.iid.InstanceIdResult;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
@@ -109,12 +117,14 @@ import io.lbry.browser.adapter.NavigationMenuAdapter;
|
||||
import io.lbry.browser.adapter.UrlSuggestionListAdapter;
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
import io.lbry.browser.dialog.ContentScopeDialogFragment;
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.listener.CameraPermissionListener;
|
||||
import io.lbry.browser.listener.DownloadActionListener;
|
||||
import io.lbry.browser.listener.FetchChannelsListener;
|
||||
import io.lbry.browser.listener.FetchClaimsListener;
|
||||
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.StoragePermissionListener;
|
||||
@@ -190,7 +200,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static SimpleExoPlayer appPlayer;
|
||||
public static Cache playerCache;
|
||||
public static boolean playerReassigned;
|
||||
public static CastContext castContext;
|
||||
public CastContext castContext;
|
||||
public static CastPlayer castPlayer;
|
||||
public static Claim nowPlayingClaim;
|
||||
public static String nowPlayingClaimUrl;
|
||||
@@ -198,10 +208,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static boolean startingShareActivity = false;
|
||||
public static boolean startingPermissionRequest = false;
|
||||
public static boolean startingSignInFlowActivity = false;
|
||||
|
||||
|
||||
@Getter
|
||||
private boolean enteringPIPMode = false;
|
||||
private boolean fullSyncInProgress = false;
|
||||
private int queuedSyncCount = 0;
|
||||
private String cameraOutputFilename;
|
||||
private Bitmap nowPlayingClaimBitmap;
|
||||
|
||||
@Setter
|
||||
private BackPressInterceptor backPressInterceptor;
|
||||
@@ -254,6 +268,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static final String ACTION_USER_AUTHENTICATION_FAILED = "io.lbry.browser.Broadcast.UserAuthenticationFailed";
|
||||
public static final String ACTION_NOW_PLAYING_CLAIM_UPDATED = "io.lbry.browser.Broadcast.NowPlayingClaimUpdated";
|
||||
public static final String ACTION_NOW_PLAYING_CLAIM_CLEARED = "io.lbry.browser.Broadcast.NowPlayingClaimCleared";
|
||||
public static final String ACTION_PUBLISH_SUCCESSFUL = "io.lbry.browser.Broadcast.PublishSuccessful";
|
||||
public static final String ACTION_OPEN_ALL_CONTENT_TAG = "io.lbry.browser.Broadcast.OpenAllContentTag";
|
||||
public static final String ACTION_WALLET_BALANCE_UPDATED = "io.lbry.browser.Broadcast.WalletBalanceUpdated";
|
||||
public static final String ACTION_OPEN_CHANNEL_URL = "io.lbry.browser.Broadcast.OpenChannelUrl";
|
||||
@@ -262,6 +277,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static final String ACTION_SAVE_SHARED_USER_STATE = "io.lbry.browser.Broadcast.SaveSharedUserState";
|
||||
|
||||
// preference keys
|
||||
public static final String PREFERENCE_KEY_BACKGROUND_PLAYBACK = "io.lbry.browser.preference.userinterface.BackgroundPlayback";
|
||||
public static final String PREFERENCE_KEY_DARK_MODE = "io.lbry.browser.preference.userinterface.DarkMode";
|
||||
public static final String PREFERENCE_KEY_SHOW_MATURE_CONTENT = "io.lbry.browser.preference.userinterface.ShowMatureContent";
|
||||
public static final String PREFERENCE_KEY_SHOW_URL_SUGGESTIONS = "io.lbry.browser.preference.userinterface.UrlSuggestions";
|
||||
@@ -278,6 +294,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static final String PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS = "io.lbry.browser.preference.internal.WalletReceiveAddress";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_REWARDS_NOT_INTERESTED = "io.lbry.browser.preference.internal.RewardsNotInterested";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_NEW_ANDROID_REWARD_CLAIMED = "io.lbry.browser.preference.internal.NewAndroidRewardClaimed";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE = "io.lbry.browser.preference.internal.InitialSubscriptionMergeDone";
|
||||
|
||||
public static final String PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED = "io.lbry.browser.preference.internal.FirstRunCompleted";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_FIRST_AUTH_COMPLETED = "io.lbry.browser.preference.internal.FirstAuthCompleted";
|
||||
@@ -287,8 +304,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static final String PREFERENCE_KEY_AUTH_TOKEN = "io.lbry.browser.Preference.AuthToken";
|
||||
|
||||
public static final String SECURE_VALUE_KEY_SAVED_PASSWORD = "io.lbry.browser.PX";
|
||||
public static final String SECURE_VALUE_FIRST_RUN_PASSWORD = "firstRunPassword";
|
||||
|
||||
private static final String TAG = "io.lbry.browser.Main";
|
||||
private static final String TAG = "LbryMain";
|
||||
|
||||
private NavigationMenuAdapter navMenuAdapter;
|
||||
private UrlSuggestionListAdapter urlSuggestionListAdapter;
|
||||
@@ -302,6 +320,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
private static boolean appStarted;
|
||||
private boolean serviceRunning;
|
||||
private CheckSdkReadyTask checkSdkReadyTask;
|
||||
private PlayerNotificationManager playerNotificationManager;
|
||||
private MediaSessionCompat mediaSession;
|
||||
private boolean receivedStopService;
|
||||
private ActionBarDrawerToggle toggle;
|
||||
@@ -313,6 +332,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
private List<CameraPermissionListener> cameraPermissionListeners;
|
||||
private List<DownloadActionListener> downloadActionListeners;
|
||||
private List<FilePickerListener> filePickerListeners;
|
||||
private List<PIPModeListener> pipModeListeners;
|
||||
private List<ScreenOrientationListener> screenOrientationListeners;
|
||||
private List<SdkStatusListener> sdkStatusListeners;
|
||||
private List<StoragePermissionListener> storagePermissionListeners;
|
||||
@@ -340,15 +360,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
private static final int STARTUP_STAGE_SUBSCRIPTIONS_LOADED = 6;
|
||||
private static final int STARTUP_STAGE_SUBSCRIPTIONS_RESOLVED = 7;
|
||||
|
||||
public boolean isDarkMode() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_DARK_MODE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// workaround to fix dark theme because https://issuetracker.google.com/issues/37124582
|
||||
new WebView(this);
|
||||
try {
|
||||
new WebView(this);
|
||||
} catch (Exception ex) {
|
||||
// pass (don't fail initialization on some _weird_ device implementations)
|
||||
}
|
||||
AppCompatDelegate.setDefaultNightMode(isDarkMode() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
|
||||
|
||||
initKeyStore();
|
||||
@@ -360,17 +379,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
initSpecialRouteMap();
|
||||
|
||||
LbryAnalytics.init(this);
|
||||
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
||||
@Override
|
||||
public void onComplete(Task<InstanceIdResult> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
return;
|
||||
try {
|
||||
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
||||
@Override
|
||||
public void onComplete(Task<InstanceIdResult> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
return;
|
||||
}
|
||||
// Get new Instance ID token
|
||||
firebaseMessagingToken = task.getResult().getToken();
|
||||
}
|
||||
|
||||
// Get new Instance ID token
|
||||
firebaseMessagingToken = task.getResult().getToken();
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
dbHelper = new DatabaseHelper(this);
|
||||
@@ -379,6 +401,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
playerNotificationManager = new PlayerNotificationManager(
|
||||
this, LbrynetService.NOTIFICATION_CHANNEL_ID, PLAYBACK_NOTIFICATION_ID, new PlayerNotificationDescriptionAdapter());
|
||||
|
||||
// TODO: Check Google Play Services availability
|
||||
// castContext = CastContext.getSharedInstance(this);
|
||||
|
||||
@@ -390,7 +415,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
return ViewCompat.onApplyWindowInsets(v,
|
||||
insets.replaceSystemWindowInsets(
|
||||
insets.getSystemWindowInsetLeft(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
insets.getSystemWindowInsetBottom()));
|
||||
@@ -423,6 +448,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
fetchChannelsListeners = new ArrayList<>();
|
||||
fetchClaimsListeners = new ArrayList<>();
|
||||
filePickerListeners = new ArrayList<>();
|
||||
pipModeListeners = new ArrayList<>();
|
||||
screenOrientationListeners = new ArrayList<>();
|
||||
sdkStatusListeners = new ArrayList<>();
|
||||
storagePermissionListeners = new ArrayList<>();
|
||||
@@ -470,6 +496,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
stopExoplayer();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
nowPlayingClaim = null;
|
||||
nowPlayingClaimUrl = null;
|
||||
nowPlayingClaimBitmap = null;
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
@@ -515,6 +543,21 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isDarkMode() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_DARK_MODE, false);
|
||||
}
|
||||
|
||||
public boolean isBackgroundPlaybackEnabled() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_BACKGROUND_PLAYBACK, false);
|
||||
}
|
||||
|
||||
public boolean initialSubscriptionMergeDone() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE, false);
|
||||
}
|
||||
|
||||
private void initSpecialRouteMap() {
|
||||
specialRouteFragmentClassMap = new HashMap<>();
|
||||
specialRouteFragmentClassMap.put("about", AboutFragment.class);
|
||||
@@ -528,6 +571,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
specialRouteFragmentClassMap.put("following", FollowingFragment.class);
|
||||
specialRouteFragmentClassMap.put("rewards", RewardsFragment.class);
|
||||
specialRouteFragmentClassMap.put("settings", SettingsFragment.class);
|
||||
specialRouteFragmentClassMap.put("subscription", FollowingFragment.class);
|
||||
specialRouteFragmentClassMap.put("subscriptions", FollowingFragment.class);
|
||||
specialRouteFragmentClassMap.put("wallet", WalletFragment.class);
|
||||
specialRouteFragmentClassMap.put("discover", FollowingFragment.class);
|
||||
@@ -594,6 +638,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
filePickerListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addPIPModeListener(PIPModeListener listener) {
|
||||
if (!pipModeListeners.contains(listener)) {
|
||||
pipModeListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePIPModeListener(PIPModeListener listener) {
|
||||
pipModeListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addCameraPermissionListener(CameraPermissionListener listener) {
|
||||
if (!cameraPermissionListeners.contains(listener)) {
|
||||
cameraPermissionListeners.add(listener);
|
||||
@@ -722,8 +776,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
public void openPublishesOnSuccessfulPublish() {
|
||||
// close publish form
|
||||
getSupportFragmentManager().popBackStack();
|
||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
try {
|
||||
onBackPressed();
|
||||
} catch (IllegalStateException iex) {
|
||||
// if this fails on some devices. what's the solution?
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void openPublishForm(Claim claim) {
|
||||
@@ -804,10 +872,15 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(true);
|
||||
hideActionBar();
|
||||
|
||||
for (PIPModeListener listener : pipModeListeners) {
|
||||
listener.onEnterPIPMode();
|
||||
}
|
||||
|
||||
View pipPlayerContainer = findViewById(R.id.pip_player_container);
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.VISIBLE);
|
||||
pipPlayer.setPlayer(appPlayer);
|
||||
pipPlayer.setUseController(false);
|
||||
pipPlayerContainer.setVisibility(View.VISIBLE);
|
||||
playerReassigned = true;
|
||||
}
|
||||
private void renderFullMode() {
|
||||
@@ -818,19 +891,30 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
|
||||
findViewById(R.id.content_main).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.floating_balance_main_container).setVisibility(inFullscreenMode ? View.INVISIBLE : View.VISIBLE);
|
||||
|
||||
Fragment fragment = getCurrentFragment();
|
||||
boolean canShowFloatingBalance = fragment == null ||
|
||||
fragment instanceof FollowingFragment ||
|
||||
fragment instanceof FileViewFragment ||
|
||||
fragment instanceof ChannelFragment ||
|
||||
fragment instanceof EditorsChoiceFragment ||
|
||||
fragment instanceof AllContentFragment ||
|
||||
fragment instanceof LibraryFragment ||
|
||||
fragment instanceof SearchFragment;
|
||||
findViewById(R.id.floating_balance_main_container).setVisibility(!canShowFloatingBalance || inFullscreenMode ? View.INVISIBLE : View.VISIBLE);
|
||||
if (!(fragment instanceof FileViewFragment) && !inFullscreenMode) {
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!Lbry.SDK_READY && !inFullscreenMode) {
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE);
|
||||
}
|
||||
for (PIPModeListener listener : pipModeListeners) {
|
||||
listener.onExitPIPMode();
|
||||
}
|
||||
|
||||
View pipPlayerContainer = findViewById(R.id.pip_player_container);
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.INVISIBLE);
|
||||
pipPlayer.setPlayer(null);
|
||||
pipPlayerContainer.setVisibility(View.INVISIBLE);
|
||||
playerReassigned = true;
|
||||
}
|
||||
|
||||
@@ -844,12 +928,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
if (dbHelper != null) {
|
||||
dbHelper.close();
|
||||
}
|
||||
if (mediaSession != null) {
|
||||
if (mediaSession != null && !isBackgroundPlaybackEnabled()) {
|
||||
mediaSession.release();
|
||||
}
|
||||
stopExoplayer();
|
||||
nowPlayingClaim = null;
|
||||
nowPlayingClaimUrl = null;
|
||||
if (!isBackgroundPlaybackEnabled()) {
|
||||
playerNotificationManager.setPlayer(null);
|
||||
stopExoplayer();
|
||||
nowPlayingClaim = null;
|
||||
nowPlayingClaimUrl = null;
|
||||
nowPlayingClaimBitmap = null;
|
||||
}
|
||||
appStarted = false;
|
||||
|
||||
if (!keepSdkBackground()) {
|
||||
@@ -905,11 +993,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
enteringPIPMode = false;
|
||||
|
||||
applyNavbarSigninPadding();
|
||||
checkFirstRun();
|
||||
checkNowPlaying();
|
||||
fetchRewards();
|
||||
|
||||
// check (and start) the LBRY SDK service
|
||||
serviceRunning = isServiceRunning(this, LbrynetService.class);
|
||||
@@ -947,7 +1035,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (!enteringPIPMode && appPlayer != null) {
|
||||
if (!enteringPIPMode && !inPictureInPictureMode && appPlayer != null && !isBackgroundPlaybackEnabled()) {
|
||||
appPlayer.setPlayWhenReady(false);
|
||||
}
|
||||
super.onPause();
|
||||
@@ -985,7 +1073,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
public boolean canShowUrlSuggestions() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_URL_SUGGESTIONS, false);
|
||||
return sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_URL_SUGGESTIONS, true);
|
||||
}
|
||||
|
||||
public boolean keepSdkBackground() {
|
||||
@@ -1357,6 +1445,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
|
||||
lockDrawer();
|
||||
|
||||
View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(
|
||||
@@ -1393,6 +1482,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
if (actionBar != null) {
|
||||
actionBar.show();
|
||||
}
|
||||
unlockDrawer();
|
||||
inFullscreenMode = false;
|
||||
}
|
||||
|
||||
@@ -1410,13 +1500,18 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean firstRunCompleted = sp.getBoolean(PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED, false);
|
||||
if (!firstRunCompleted) {
|
||||
findViewById(R.id.drawer_layout).setVisibility(View.INVISIBLE);
|
||||
startActivity(new Intent(this, FirstRunActivity.class));
|
||||
} else if (!appStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!appStarted) {
|
||||
// first run completed, startup
|
||||
startup();
|
||||
return;
|
||||
}
|
||||
|
||||
fetchRewards();
|
||||
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
||||
openFragment(FollowingFragment.class, false, NavMenuItem.ID_ITEM_FOLLOWING);
|
||||
}
|
||||
@@ -1472,7 +1567,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
|
||||
syncWalletAndLoadPreferences();
|
||||
scheduleWalletBalanceUpdate();
|
||||
scheduleWalletSyncTask();
|
||||
fetchOwnChannels();
|
||||
@@ -1480,7 +1574,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
initFloatingWalletBalance();
|
||||
|
||||
checkAndClaimNewAndroidReward();
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean firstRunCompleted = sp.getBoolean(PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED, false);
|
||||
if (firstRunCompleted) {
|
||||
checkAndClaimNewAndroidReward();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkAndClaimNewAndroidReward() {
|
||||
@@ -1527,6 +1625,66 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
mediaSession.setActive(true);
|
||||
}
|
||||
|
||||
private static final String CHANNEL_ID_PLAYBACK = "io.lbry.browser.LBRY_PLAYBACK_CHANNEL";
|
||||
private static final int PLAYBACK_NOTIFICATION_ID = 3;
|
||||
|
||||
public void initPlaybackNotification() {
|
||||
if (isBackgroundPlaybackEnabled()) {
|
||||
playerNotificationManager.setPlayer(MainActivity.appPlayer);
|
||||
if (mediaSession != null) {
|
||||
playerNotificationManager.setMediaSessionToken(mediaSession.getSessionToken());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PlayerNotificationDescriptionAdapter implements PlayerNotificationManager.MediaDescriptionAdapter {
|
||||
|
||||
@Override
|
||||
public CharSequence getCurrentContentTitle(Player player) {
|
||||
return nowPlayingClaim != null ? nowPlayingClaim.getTitle() : "";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PendingIntent createCurrentContentIntent(Player player) {
|
||||
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 null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getCurrentContentText(Player player) {
|
||||
return nowPlayingClaim != null && nowPlayingClaim.getSigningChannel() != null ? nowPlayingClaim.getSigningChannel().getTitleOrName() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback) {
|
||||
if (nowPlayingClaimBitmap == null &&
|
||||
nowPlayingClaim != null &&
|
||||
!Helper.isNullOrEmpty(nowPlayingClaim.getThumbnailUrl())) {
|
||||
Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl()).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
nowPlayingClaimBitmap = resource;
|
||||
callback.onBitmap(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
return nowPlayingClaimBitmap;
|
||||
}
|
||||
}
|
||||
|
||||
public void showFloatingWalletBalance() {
|
||||
findViewById(R.id.floating_balance_main_container).setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -1625,17 +1783,25 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
// reload subscriptions if wallet fragment is FollowingFragment
|
||||
//openNavFragments.get
|
||||
MergeSubscriptionsTask mergeTask = new MergeSubscriptionsTask(
|
||||
subscriptions, MainActivity.this, new MergeSubscriptionsTask.MergeSubscriptionsHandler() {
|
||||
subscriptions,
|
||||
initialSubscriptionMergeDone(),
|
||||
MainActivity.this, new MergeSubscriptionsTask.MergeSubscriptionsHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Subscription> subscriptions, List<Subscription> diff) {
|
||||
Lbryio.subscriptions = new ArrayList<>(subscriptions);
|
||||
if (diff != null && diff.size() > 0) {
|
||||
saveSharedUserState();
|
||||
}
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
|
||||
sp.edit().putBoolean(PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE, true).apply();
|
||||
Lbryio.cacheResolvedSubscriptions.clear();
|
||||
|
||||
for (Fragment fragment : openNavFragments.values()) {
|
||||
if (fragment instanceof FollowingFragment) {
|
||||
// reload local subscriptions
|
||||
((FollowingFragment) fragment).fetchLoadedSubscriptions(true);
|
||||
FollowingFragment followingFragment = (FollowingFragment) fragment;
|
||||
followingFragment.fetchLoadedSubscriptions(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1773,7 +1939,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public void onSyncGetSuccess(WalletSync walletSync) {
|
||||
Lbryio.lastWalletSync = walletSync;
|
||||
Lbryio.lastRemoteHash = walletSync.getHash();
|
||||
loadSharedUserState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1831,6 +1996,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
intentFilter.addAction(ACTION_OPEN_CHANNEL_URL);
|
||||
intentFilter.addAction(ACTION_OPEN_WALLET_PAGE);
|
||||
intentFilter.addAction(ACTION_OPEN_REWARDS_PAGE);
|
||||
intentFilter.addAction(ACTION_PUBLISH_SUCCESSFUL);
|
||||
intentFilter.addAction(ACTION_SAVE_SHARED_USER_STATE);
|
||||
requestsReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
@@ -1850,6 +2016,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
pendingOpenRewardsPage = true;
|
||||
} else if (ACTION_SAVE_SHARED_USER_STATE.equalsIgnoreCase(action)) {
|
||||
saveSharedUserState();
|
||||
} else if (ACTION_PUBLISH_SUCCESSFUL.equalsIgnoreCase(action)) {
|
||||
openPublishesOnSuccessfulPublish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2160,6 +2328,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private void startup() {
|
||||
final Context context = this;
|
||||
Lbry.startupInit();
|
||||
@@ -2181,6 +2350,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
hideActionBar();
|
||||
lockDrawer();
|
||||
findViewById(R.id.splash_view).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.drawer_layout).setVisibility(View.VISIBLE);
|
||||
LbryAnalytics.setCurrentScreen(MainActivity.this, "Splash", "Splash");
|
||||
initStartupStages();
|
||||
}
|
||||
@@ -2215,7 +2385,13 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
startupStages.put(STARTUP_STAGE_EXCHANGE_RATE_LOADED, true);
|
||||
|
||||
Lbryio.authenticate(context);
|
||||
try {
|
||||
Lbryio.authenticate(context);
|
||||
} catch (AuthTokenInvalidatedException ex) {
|
||||
// if this happens, attempt to authenticate again, so that we can obtain a new auth token
|
||||
// this will also result in the user having to sign in again
|
||||
Lbryio.authenticate(context);
|
||||
}
|
||||
if (Lbryio.currentUser == null) {
|
||||
throw new Exception("Did not retrieve authenticated user.");
|
||||
}
|
||||
@@ -2381,6 +2557,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
inPictureInPictureMode = false;
|
||||
renderFullMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2436,14 +2615,15 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
!startingFilePickerActivity &&
|
||||
!startingSignInFlowActivity) {
|
||||
enteringPIPMode = true;
|
||||
|
||||
getSupportActionBar().hide();
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
findViewById(R.id.pip_player).setVisibility(View.VISIBLE);
|
||||
|
||||
PictureInPictureParams params = new PictureInPictureParams.Builder().build();
|
||||
enterPictureInPictureMode(params);
|
||||
return true;
|
||||
|
||||
try {
|
||||
enterPictureInPictureMode(params);
|
||||
return true;
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
enteringPIPMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -2464,7 +2644,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_LBRY_NOTIFICATION_OPEN, bundle);
|
||||
}
|
||||
|
||||
|
||||
private void registerServiceActionsReceiver() {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(DownloadManager.ACTION_DOWNLOAD_EVENT);
|
||||
@@ -2593,6 +2772,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public void clearNowPlayingClaim() {
|
||||
nowPlayingClaim = null;
|
||||
nowPlayingClaimUrl = null;
|
||||
nowPlayingClaimBitmap = null;
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
((TextView) findViewById(R.id.global_now_playing_title)).setText(null);
|
||||
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(null);
|
||||
@@ -2625,9 +2805,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
JSONObject startupStatus = status.getJSONObject("startup_status");
|
||||
sdkReady = startupStatus.getBoolean("file_manager") && startupStatus.getBoolean("wallet");
|
||||
}
|
||||
} catch (ConnectException ex) {
|
||||
// pass
|
||||
} catch (JSONException ex) {
|
||||
} catch (ConnectException | JSONException ex) {
|
||||
// pass
|
||||
}
|
||||
|
||||
@@ -2719,7 +2897,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
|
||||
protected void onStop() {
|
||||
if (appPlayer != null && inPictureInPictureMode) {
|
||||
if (appPlayer != null && inPictureInPictureMode && !isBackgroundPlaybackEnabled()) {
|
||||
appPlayer.setPlayWhenReady(false);
|
||||
}
|
||||
super.onStop();
|
||||
@@ -2873,16 +3051,25 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
public static void requestPermission(String permission, int requestCode, String rationale, Context context, boolean forceRequest) {
|
||||
if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
if (!forceRequest && ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
|
||||
Toast.makeText(context, rationale, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(rationale);
|
||||
}
|
||||
} else if (forceRequest) {
|
||||
startingPermissionRequest = true;
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode);
|
||||
} else {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showError(rationale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasPermission(String permission, Context context) {
|
||||
if (context == null) {
|
||||
return false;
|
||||
}
|
||||
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package io.lbry.browser;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
@@ -18,8 +21,10 @@ import io.lbry.browser.listener.SignInListener;
|
||||
import io.lbry.browser.listener.WalletSyncListener;
|
||||
import io.lbry.browser.model.lbryinc.User;
|
||||
import io.lbry.browser.tasks.lbryinc.FetchCurrentUserTask;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.LbryAnalytics;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
|
||||
public class VerificationActivity extends FragmentActivity implements SignInListener, WalletSyncListener {
|
||||
|
||||
@@ -27,6 +32,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 BroadcastReceiver sdkReceiver;
|
||||
private String email;
|
||||
private boolean signedIn;
|
||||
private int flow;
|
||||
@@ -54,6 +60,19 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
return;
|
||||
}
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(LbrynetService.ACTION_STOP_SERVICE);
|
||||
sdkReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
registerReceiver(sdkReceiver, filter);
|
||||
|
||||
setContentView(R.layout.activity_verification);
|
||||
ViewPager2 viewPager = findViewById(R.id.verification_pager);
|
||||
viewPager.setUserInputEnabled(false);
|
||||
@@ -148,7 +167,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
|
||||
// only sign in required, don't do anything else
|
||||
showLoading();
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(this, new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
Lbryio.currentUser = user;
|
||||
@@ -158,7 +177,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showFetchUserError(error.getMessage());
|
||||
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||
hideLoading();
|
||||
}
|
||||
});
|
||||
@@ -166,7 +185,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
} else {
|
||||
// change pager view depending on flow
|
||||
showLoading();
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(this, new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
hideLoading();
|
||||
@@ -194,7 +213,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
}
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showFetchUserError(error.getMessage());
|
||||
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||
hideLoading();
|
||||
}
|
||||
});
|
||||
@@ -210,7 +229,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
@Override
|
||||
public void onPhoneVerified() {
|
||||
showLoading();
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(this, new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
Lbryio.currentUser = user;
|
||||
@@ -231,7 +250,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showFetchUserError(error.getMessage());
|
||||
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||
hideLoading();
|
||||
}
|
||||
});
|
||||
@@ -269,4 +288,10 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
public void onWalletSyncFailed(Exception error) {
|
||||
findViewById(R.id.verification_close_button).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Helper.unregisterReceiver(sdkReceiver, this);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -61,7 +60,13 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
public ClaimListAdapter(List<Claim> items, Context context) {
|
||||
this.context = context;
|
||||
this.items = new ArrayList<>(items);
|
||||
this.items = new ArrayList<>();
|
||||
for (Claim item : items) {
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
this.selectedItems = new ArrayList<>();
|
||||
quickClaimIdMap = new HashMap<>();
|
||||
quickClaimUrlMap = new HashMap<>();
|
||||
@@ -140,7 +145,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
public void addItems(List<Claim> claims) {
|
||||
for (Claim claim : claims) {
|
||||
if (!items.contains(claim)) {
|
||||
if (claim != null && !items.contains(claim)) {
|
||||
items.add(claim);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +155,12 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public void setItems(List<Claim> claims) {
|
||||
items = new ArrayList<>(claims);
|
||||
items = new ArrayList<>();
|
||||
for (Claim claim : claims) {
|
||||
if (claim != null) {
|
||||
items.add(claim);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -298,22 +308,19 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
return new ClaimListAdapter.ViewHolder(v);
|
||||
}
|
||||
|
||||
public int getScaledValue(int value) {
|
||||
return (int) (value * scale + 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ClaimListAdapter.ViewHolder vh, int position) {
|
||||
int type = getItemViewType(position);
|
||||
int paddingTop = position == 0 ? 16 : 8;
|
||||
int paddingBottom = position == getItemCount() - 1 ? 16 : 8;
|
||||
int paddingTopScaled = getScaledValue(paddingTop);
|
||||
int paddingBottomScaled = getScaledValue(paddingBottom);
|
||||
int paddingTopScaled = Helper.getScaledValue(paddingTop, scale);
|
||||
int paddingBottomScaled = Helper.getScaledValue(paddingBottom, scale);
|
||||
vh.itemView.setPadding(vh.itemView.getPaddingLeft(), paddingTopScaled, vh.itemView.getPaddingRight(), paddingBottomScaled);
|
||||
|
||||
Claim original = items.get(position);
|
||||
boolean isRepost = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType());
|
||||
final Claim item = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType()) ? original.getRepostedClaim() : original;
|
||||
final Claim item = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType()) ?
|
||||
(original.getRepostedClaim() != null ? original.getRepostedClaim() : original): original;
|
||||
Claim.GenericMetadata metadata = item.getValue();
|
||||
Claim signingChannel = item.getSigningChannel();
|
||||
Claim.StreamMetadata streamMetadata = null;
|
||||
@@ -328,14 +335,17 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
}
|
||||
|
||||
boolean isPending = item.getConfirmations() == 0;
|
||||
boolean isSelected = isClaimSelected(item);
|
||||
boolean isSelected = isClaimSelected(original);
|
||||
vh.itemView.setSelected(isSelected);
|
||||
vh.selectedOverlayView.setVisibility(isSelected ? View.VISIBLE : View.GONE);
|
||||
vh.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isPending) {
|
||||
Snackbar.make(vh.itemView, R.string.item_pending_blockchain, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar snackbar = Snackbar.make(vh.itemView, R.string.item_pending_blockchain, Snackbar.LENGTH_LONG);
|
||||
TextView snackbarText = snackbar.getView().findViewById(com.google.android.material.R.id.snackbar_text);
|
||||
snackbarText.setMaxLines(5);
|
||||
snackbar.show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +366,10 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
}
|
||||
|
||||
if (isPending) {
|
||||
Snackbar.make(vh.itemView, R.string.item_pending_blockchain, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar snackbar = Snackbar.make(vh.itemView, R.string.item_pending_blockchain, Snackbar.LENGTH_LONG);
|
||||
TextView snackbarText = snackbar.getView().findViewById(com.google.android.material.R.id.snackbar_text);
|
||||
snackbarText.setMaxLines(5);
|
||||
snackbar.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -382,7 +395,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
vh.publishTimeView.setVisibility(!isPending ? View.VISIBLE : View.GONE);
|
||||
vh.pendingTextView.setVisibility(isPending ? View.VISIBLE : View.GONE);
|
||||
vh.repostInfoView.setVisibility(isRepost ? View.VISIBLE : View.GONE);
|
||||
vh.repostInfoView.setVisibility(isRepost && type != VIEW_TYPE_FEATURED ? View.VISIBLE : View.GONE);
|
||||
vh.repostChannelView.setText(isRepost ? original.getSigningChannel().getName() : null);
|
||||
vh.repostChannelView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -413,6 +426,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
long duration = item.getDuration();
|
||||
if (!Helper.isNullOrEmpty(thumbnailUrl)) {
|
||||
Glide.with(context.getApplicationContext()).
|
||||
asBitmap().
|
||||
load(thumbnailUrl).
|
||||
centerCrop().
|
||||
placeholder(R.drawable.bg_thumbnail_placeholder).
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
package io.lbry.browser.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.ClaimCacheKey;
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
import lombok.Setter;
|
||||
|
||||
public class CommentListAdapter extends RecyclerView.Adapter<CommentListAdapter.ViewHolder> {
|
||||
private List<Comment> items;
|
||||
private Context context;
|
||||
private boolean nested;
|
||||
private float scale;
|
||||
@Setter
|
||||
private ClaimListAdapter.ClaimListItemListener listener;
|
||||
@Setter
|
||||
private ReplyClickListener replyListener;
|
||||
|
||||
public CommentListAdapter(List<Comment> items, Context context) {
|
||||
this(items, context, false);
|
||||
}
|
||||
|
||||
public CommentListAdapter(List<Comment> items, Context context, boolean nested) {
|
||||
this.items = new ArrayList<>(items);
|
||||
this.context = context;
|
||||
this.nested = nested;
|
||||
if (context != null) {
|
||||
scale = context.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
for (Comment item : this.items) {
|
||||
ClaimCacheKey key = new ClaimCacheKey();
|
||||
key.setClaimId(item.getChannelId());
|
||||
if (Lbry.claimCache.containsKey(key)) {
|
||||
item.setPoster(Lbry.claimCache.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearItems() {
|
||||
items.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items != null ? items.size() : 0;
|
||||
}
|
||||
|
||||
public List<String> getClaimUrlsToResolve() {
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Comment item = items.get(i);
|
||||
if (item.getPoster() == null) {
|
||||
LbryUri url = LbryUri.tryParse(String.format("%s#%s", item.getChannelName(), item.getChannelId()));
|
||||
if (url != null && !urls.contains(url.toString())) {
|
||||
urls.add(url.toString());
|
||||
}
|
||||
}
|
||||
if (item.getReplies().size() > 0) {
|
||||
for (int j = 0; j < item.getReplies().size(); j++) {
|
||||
Comment reply = item.getReplies().get(j);
|
||||
if (reply.getPoster() == null) {
|
||||
LbryUri url = LbryUri.tryParse(String.format("%s#%s", reply.getChannelName(), reply.getChannelId()));
|
||||
if (url != null && !urls.contains(url.toString())) {
|
||||
urls.add(url.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected TextView channelName;
|
||||
protected TextView commentText;
|
||||
protected ImageView thumbnailView;
|
||||
protected View noThumbnailView;
|
||||
protected TextView alphaView;
|
||||
protected TextView commentTimeView;
|
||||
protected View replyLink;
|
||||
protected RecyclerView repliesList;
|
||||
|
||||
public ViewHolder (View v) {
|
||||
super(v);
|
||||
channelName = v.findViewById(R.id.comment_channel_name);
|
||||
commentTimeView = v.findViewById(R.id.comment_time);
|
||||
commentText = v.findViewById(R.id.comment_text);
|
||||
replyLink = v.findViewById(R.id.comment_reply_link);
|
||||
thumbnailView = v.findViewById(R.id.comment_thumbnail);
|
||||
noThumbnailView = v.findViewById(R.id.comment_no_thumbnail);
|
||||
alphaView = v.findViewById(R.id.comment_thumbnail_alpha);
|
||||
repliesList = v.findViewById(R.id.comment_replies);
|
||||
}
|
||||
}
|
||||
|
||||
public void insert(int index, Comment comment) {
|
||||
if (!items.contains(comment)) {
|
||||
items.add(index, comment);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void addReply(Comment comment) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Comment parent = items.get(i);
|
||||
if (parent.getId().equalsIgnoreCase(comment.getParentId())) {
|
||||
parent.addReply(comment);
|
||||
notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePosterForComment(String channelId, Claim channel) {
|
||||
for (int i = 0 ; i < items.size(); i++) {
|
||||
Comment item = items.get(i);
|
||||
List<Comment> replies = item.getReplies();
|
||||
if (replies != null && replies.size() > 0) {
|
||||
for (int j = 0; j < replies.size(); j++) {
|
||||
Comment reply = item.getReplies().get(j);
|
||||
if (channelId.equalsIgnoreCase(reply.getChannelId())) {
|
||||
reply.setPoster(channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (channelId.equalsIgnoreCase(item.getChannelId())) {
|
||||
item.setPoster(channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(context).inflate(R.layout.list_item_comment, parent, false);
|
||||
return new CommentListAdapter.ViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
Comment comment = items.get(position);
|
||||
holder.itemView.setPadding(
|
||||
nested ? Helper.getScaledValue(56, scale) : holder.itemView.getPaddingLeft(),
|
||||
holder.itemView.getPaddingTop(),
|
||||
nested ? 0 : holder.itemView.getPaddingRight(),
|
||||
holder.itemView.getPaddingBottom());
|
||||
|
||||
holder.channelName.setText(comment.getChannelName());
|
||||
holder.commentTimeView.setText(DateUtils.getRelativeTimeSpanString(
|
||||
(comment.getTimestamp() * 1000), System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
|
||||
holder.commentText.setText(comment.getText());
|
||||
holder.replyLink.setVisibility(!nested ? View.VISIBLE : View.GONE);
|
||||
|
||||
boolean hasThumbnail = comment.getPoster() != null && !Helper.isNullOrEmpty(comment.getPoster().getThumbnailUrl());
|
||||
holder.thumbnailView.setVisibility(hasThumbnail ? View.VISIBLE : View.INVISIBLE);
|
||||
holder.noThumbnailView.setVisibility(!hasThumbnail ? View.VISIBLE : View.INVISIBLE);
|
||||
int bgColor = Helper.generateRandomColorForValue(comment.getChannelId());
|
||||
Helper.setIconViewBackgroundColor(holder.noThumbnailView, bgColor, false, context);
|
||||
if (hasThumbnail) {
|
||||
Glide.with(context.getApplicationContext()).asBitmap().load(comment.getPoster().getThumbnailUrl()).
|
||||
apply(RequestOptions.circleCropTransform()).into(holder.thumbnailView);
|
||||
}
|
||||
holder.alphaView.setText(comment.getChannelName() != null ? comment.getChannelName().substring(1, 2).toUpperCase() : null);
|
||||
List<Comment> replies = comment.getReplies();
|
||||
boolean hasReplies = replies != null && replies.size() > 0;
|
||||
if (hasReplies) {
|
||||
holder.repliesList.setLayoutManager(new LinearLayoutManager(context));
|
||||
holder.repliesList.setAdapter(new CommentListAdapter(replies, context, true));
|
||||
} else {
|
||||
holder.repliesList.setAdapter(null);
|
||||
}
|
||||
|
||||
holder.channelName.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null && comment.getPoster() != null) {
|
||||
listener.onClaimClicked(comment.getPoster());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
holder.replyLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (replyListener != null) {
|
||||
replyListener.onReplyClicked(comment);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface ReplyClickListener {
|
||||
void onReplyClicked(Comment comment);
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,7 @@ public class EditorsChoiceItemAdapter extends RecyclerView.Adapter<EditorsChoice
|
||||
vh.descriptionView.setText(item.getDescription());
|
||||
if (!Helper.isNullOrEmpty(item.getThumbnailUrl())) {
|
||||
Glide.with(context.getApplicationContext()).
|
||||
asBitmap().
|
||||
load(item.getThumbnailUrl()).
|
||||
centerCrop().
|
||||
placeholder(R.drawable.bg_thumbnail_placeholder).
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.widget.SpinnerAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
@@ -40,11 +41,30 @@ public class InlineChannelSpinnerAdapter extends ArrayAdapter<Claim> {
|
||||
channels.add(1, anonymous);
|
||||
}
|
||||
}
|
||||
public void addAnonymousPlaceholder() {
|
||||
Claim anonymous = new Claim();
|
||||
anonymous.setPlaceholderAnonymous(true);
|
||||
insert(anonymous, 0);
|
||||
channels.add(0, anonymous);
|
||||
}
|
||||
|
||||
public void addAll(Collection<? extends Claim> collection) {
|
||||
for (Claim claim : collection) {
|
||||
if (!channels.contains(claim)) {
|
||||
channels.add(claim);
|
||||
}
|
||||
}
|
||||
super.addAll(collection);
|
||||
}
|
||||
public void clear() {
|
||||
channels.clear();
|
||||
super.clear();
|
||||
}
|
||||
|
||||
public int getItemPosition(Claim item) {
|
||||
for (int i = 0; i < channels.size(); i++) {
|
||||
Claim channel = channels.get(i);
|
||||
if (item.getClaimId().equalsIgnoreCase(channel.getClaimId())) {
|
||||
if (item.getClaimId() != null && item.getClaimId().equalsIgnoreCase(channel.getClaimId())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +168,10 @@ public class RewardListAdapter extends RecyclerView.Adapter<RewardListAdapter.Vi
|
||||
return;
|
||||
}
|
||||
|
||||
if (vh.inputCustomCode != null && !vh.inputCustomCode.hasFocus()) {
|
||||
vh.inputCustomCode.requestFocus();
|
||||
}
|
||||
|
||||
if (clickListener != null) {
|
||||
clickListener.onRewardClicked(reward, vh.loading);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionList
|
||||
vh.claimView.setText(item.getClaim());
|
||||
vh.feeView.setText(context.getString(R.string.tx_list_fee, TX_LIST_AMOUNT_FORMAT.format(item.getFee().doubleValue())));
|
||||
vh.txidLinkView.setText(item.getTxid().substring(0, 7));
|
||||
vh.dateView.setText(TX_LIST_DATE_FORMAT.format(item.getTxDate()));
|
||||
vh.dateView.setVisibility(item.getConfirmations() > 0 ? View.VISIBLE : View.GONE);
|
||||
vh.dateView.setText(item.getConfirmations() > 0 ? TX_LIST_DATE_FORMAT.format(item.getTxDate()) : null);
|
||||
vh.pendingView.setVisibility(item.getConfirmations() == 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
vh.infoFeeContainer.setVisibility(!Helper.isNullOrEmpty(item.getClaim()) || Math.abs(item.getFee().doubleValue()) > 0 ?
|
||||
View.VISIBLE : View.GONE);
|
||||
@@ -111,6 +113,7 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionList
|
||||
protected TextView feeView;
|
||||
protected TextView txidLinkView;
|
||||
protected TextView dateView;
|
||||
protected TextView pendingView;
|
||||
protected View infoFeeContainer;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
@@ -121,6 +124,7 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionList
|
||||
feeView = v.findViewById(R.id.transaction_fee);
|
||||
txidLinkView = v.findViewById(R.id.transaction_id_link);
|
||||
dateView = v.findViewById(R.id.transaction_date);
|
||||
pendingView = v.findViewById(R.id.transaction_pending_text);
|
||||
infoFeeContainer = v.findViewById(R.id.transaction_info_fee_container);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
};
|
||||
|
||||
private static final String SQL_INSERT_SUBSCRIPTION = "REPLACE INTO subscriptions (channel_name, url) VALUES (?, ?)";
|
||||
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";
|
||||
|
||||
@@ -230,6 +231,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
public static void deleteSubscription(Subscription subscription, SQLiteDatabase db) {
|
||||
db.execSQL(SQL_DELETE_SUBSCRIPTION, new Object[] { subscription.getUrl() });
|
||||
}
|
||||
public static void clearSubscriptions(SQLiteDatabase db) {
|
||||
db.execSQL(SQL_CLEAR_SUBSCRIPTIONS);
|
||||
}
|
||||
public static List<Subscription> getSubscriptions(SQLiteDatabase db) {
|
||||
List<Subscription> subscriptions = new ArrayList<>();
|
||||
Cursor cursor = null;
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
package io.lbry.browser.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListTask;
|
||||
import io.lbry.browser.tasks.wallet.SupportCreateTask;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import lombok.Setter;
|
||||
|
||||
public class CreateSupportDialogFragment extends BottomSheetDialogFragment implements WalletBalanceListener {
|
||||
public static final String TAG = "CreateSupportDialog";
|
||||
|
||||
private MaterialButton sendButton;
|
||||
private View cancelLink;
|
||||
private TextInputEditText inputAmount;
|
||||
private View inlineBalanceContainer;
|
||||
private TextView inlineBalanceValue;
|
||||
private ProgressBar sendProgress;
|
||||
|
||||
private InlineChannelSpinnerAdapter channelSpinnerAdapter;
|
||||
private AppCompatSpinner channelSpinner;
|
||||
private SwitchMaterial switchTip;
|
||||
|
||||
private boolean fetchingChannels;
|
||||
private ProgressBar progressLoadingChannels;
|
||||
|
||||
|
||||
@Setter
|
||||
private CreateSupportListener listener;
|
||||
@Setter
|
||||
private Claim claim;
|
||||
|
||||
public static CreateSupportDialogFragment newInstance() {
|
||||
return new CreateSupportDialogFragment();
|
||||
}
|
||||
|
||||
private void disableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
}
|
||||
channelSpinner.setEnabled(false);
|
||||
switchTip.setEnabled(false);
|
||||
sendButton.setEnabled(false);
|
||||
cancelLink.setEnabled(false);
|
||||
}
|
||||
private void enableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
channelSpinner.setEnabled(true);
|
||||
switchTip.setEnabled(true);
|
||||
sendButton.setEnabled(true);
|
||||
cancelLink.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_create_support, container, false);
|
||||
|
||||
inputAmount = view.findViewById(R.id.create_support_input_amount);
|
||||
inlineBalanceContainer = view.findViewById(R.id.create_support_inline_balance_container);
|
||||
inlineBalanceValue = view.findViewById(R.id.create_support_inline_balance_value);
|
||||
sendProgress = view.findViewById(R.id.create_support_progress);
|
||||
cancelLink = view.findViewById(R.id.create_support_cancel_link);
|
||||
sendButton = view.findViewById(R.id.create_support_send);
|
||||
|
||||
channelSpinner = view.findViewById(R.id.create_support_channel_spinner);
|
||||
switchTip = view.findViewById(R.id.create_support_make_tip_switch);
|
||||
progressLoadingChannels = view.findViewById(R.id.create_support_channel_progress);
|
||||
|
||||
inputAmount.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
inputAmount.setHint(hasFocus ? getString(R.string.zero) : "");
|
||||
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
inputAmount.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
updateSendButtonText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
updateInfoText();
|
||||
updateSendButtonText();
|
||||
|
||||
String channel = null;
|
||||
if (Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType())) {
|
||||
channel = claim.getTitleOrName();
|
||||
} else if (claim.getSigningChannel() != null) {
|
||||
channel = claim.getPublisherTitle();
|
||||
}
|
||||
TextView titleView = view.findViewById(R.id.create_support_title);
|
||||
String tipTitleText = Helper.isNullOrEmpty(channel) ? getString(R.string.send_a_tip) : getString(R.string.send_a_tip_to, channel);
|
||||
titleView.setText(tipTitleText);
|
||||
|
||||
switchTip.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
if (checked) {
|
||||
// show tip info
|
||||
titleView.setText(tipTitleText);
|
||||
updateSendButtonText();
|
||||
} else {
|
||||
// show support info
|
||||
titleView.setText(R.string.support_this_content);
|
||||
sendButton.setText(R.string.send_revocable_support);
|
||||
}
|
||||
updateInfoText();
|
||||
}
|
||||
});
|
||||
|
||||
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
if (Helper.isNullOrEmpty(amountString)) {
|
||||
showError(getString(R.string.invalid_amount));
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(amountString);
|
||||
if (amount.doubleValue() > Lbry.walletBalance.getAvailable().doubleValue()) {
|
||||
showError(getString(R.string.insufficient_balance));
|
||||
return;
|
||||
}
|
||||
if (amount.doubleValue() < Helper.MIN_SPEND) {
|
||||
showError(getString(R.string.min_spend_required));
|
||||
return;
|
||||
}
|
||||
|
||||
Claim selectedChannel = (Claim) channelSpinner.getSelectedItem();
|
||||
String channelId = !fetchingChannels && selectedChannel != null ? selectedChannel.getClaimId() : null;
|
||||
boolean isTip = switchTip.isChecked();
|
||||
SupportCreateTask task = new SupportCreateTask(
|
||||
claim.getClaimId(), channelId, amount, isTip, sendProgress, new GenericTaskHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
disableControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
enableControls();
|
||||
if (listener != null) {
|
||||
listener.onSupportCreated(amount, isTip);
|
||||
}
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showError(error.getMessage());
|
||||
enableControls();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
cancelLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
onWalletBalanceUpdated(Lbry.walletBalance);
|
||||
updateInfoText();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void updateSendButtonText() {
|
||||
boolean isTip = switchTip.isChecked();
|
||||
if (!isTip) {
|
||||
sendButton.setText(R.string.send_revocable_support);
|
||||
} else {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
double parsedAmount = Helper.parseDouble(amountString, 0);
|
||||
sendButton.setText(parsedAmount == 0 ? getString(R.string.send_a_tip) : getString(R.string.send_lbc_tip, amountString));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateInfoText() {
|
||||
View view = getView();
|
||||
if (view != null && switchTip != null) {
|
||||
TextView infoText = view.findViewById(R.id.create_support_info);
|
||||
boolean isTip = switchTip.isChecked();
|
||||
|
||||
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if (!isTip) {
|
||||
infoText.setText(HtmlCompat.fromHtml(getString(R.string.support_info), HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
} else if (claim != null) {
|
||||
infoText.setText(HtmlCompat.fromHtml(
|
||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchChannels() {
|
||||
if (Lbry.ownChannels != null && Lbry.ownChannels.size() > 0) {
|
||||
updateChannelList(Lbry.ownChannels);
|
||||
return;
|
||||
}
|
||||
|
||||
fetchingChannels = true;
|
||||
disableChannelSpinner();
|
||||
ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, progressLoadingChannels, new ClaimListResultHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims) {
|
||||
Lbry.ownChannels = new ArrayList<>(claims);
|
||||
updateChannelList(Lbry.ownChannels);
|
||||
enableChannelSpinner();
|
||||
fetchingChannels = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
enableChannelSpinner();
|
||||
fetchingChannels = false;
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
private void disableChannelSpinner() {
|
||||
Helper.setViewEnabled(channelSpinner, false);
|
||||
}
|
||||
private void enableChannelSpinner() {
|
||||
Helper.setViewEnabled(channelSpinner, true);
|
||||
}
|
||||
|
||||
private void updateChannelList(List<Claim> channels) {
|
||||
if (channelSpinnerAdapter == null) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, new ArrayList<>(channels));
|
||||
channelSpinnerAdapter.addAnonymousPlaceholder();
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
channelSpinnerAdapter.clear();
|
||||
channelSpinnerAdapter.addAll(channels);
|
||||
channelSpinnerAdapter.addAnonymousPlaceholder();
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
if (channelSpinner != null) {
|
||||
channelSpinner.setAdapter(channelSpinnerAdapter);
|
||||
}
|
||||
|
||||
if (channelSpinnerAdapter != null && channelSpinner != null) {
|
||||
if (channelSpinnerAdapter.getCount() > 1) {
|
||||
channelSpinner.setSelection(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
updateInfoText();
|
||||
fetchChannels();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).removeWalletBalanceListener(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
|
||||
if (walletBalance != null && inlineBalanceValue != null) {
|
||||
inlineBalanceValue.setText(Helper.shortCurrencyFormat(walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
}
|
||||
|
||||
public interface CreateSupportListener {
|
||||
void onSupportCreated(BigDecimal amount, boolean isTip);
|
||||
}
|
||||
}
|
||||
@@ -192,14 +192,16 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||
private void loadChannels(List<Claim> channels) {
|
||||
if (channelSpinnerAdapter == null) {
|
||||
Context context = getContext();
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
if (context != null) {
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
channelSpinnerAdapter.clear();
|
||||
channelSpinnerAdapter.addAll(channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (channelSpinner != null) {
|
||||
if (channelSpinner != null && channelSpinnerAdapter != null) {
|
||||
channelSpinner.setAdapter(channelSpinnerAdapter);
|
||||
}
|
||||
}
|
||||
@@ -229,8 +231,18 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||
showError(getString(R.string.insufficient_balance));
|
||||
return;
|
||||
}
|
||||
if (bid.doubleValue() < Helper.MIN_DEPOSIT) {
|
||||
String message = getResources().getQuantityString(R.plurals.min_deposit_required, 2, String.valueOf(Helper.MIN_DEPOSIT));
|
||||
showError(message);
|
||||
return;
|
||||
}
|
||||
|
||||
Claim channel = (Claim) channelSpinner.getSelectedItem();
|
||||
if (channel == null) {
|
||||
showError(getString(R.string.please_select_repost_channel));
|
||||
return;
|
||||
}
|
||||
|
||||
StreamRepostTask task = new StreamRepostTask(name, bid, claim.getClaimId(), channel.getClaimId(), repostProgress, new ClaimResultHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
@@ -256,10 +268,13 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
View view = getView();
|
||||
if (view != null && !Helper.isNullOrEmpty(message)) {
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
private void startLoading() {
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
package io.lbry.browser.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.tasks.wallet.SupportCreateTask;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import lombok.Setter;
|
||||
|
||||
public class SendTipDialogFragment extends BottomSheetDialogFragment implements WalletBalanceListener {
|
||||
public static final String TAG = "SendTipDialog";
|
||||
|
||||
private MaterialButton sendButton;
|
||||
private View cancelLink;
|
||||
private TextInputEditText inputAmount;
|
||||
private View inlineBalanceContainer;
|
||||
private TextView inlineBalanceValue;
|
||||
private ProgressBar sendProgress;
|
||||
|
||||
@Setter
|
||||
private SendTipListener listener;
|
||||
@Setter
|
||||
private Claim claim;
|
||||
|
||||
public static SendTipDialogFragment newInstance() {
|
||||
return new SendTipDialogFragment();
|
||||
}
|
||||
|
||||
private void disableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
}
|
||||
sendButton.setEnabled(false);
|
||||
cancelLink.setEnabled(false);
|
||||
}
|
||||
private void enableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
sendButton.setEnabled(true);
|
||||
cancelLink.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_send_tip, container, false);
|
||||
|
||||
inputAmount = view.findViewById(R.id.tip_input_amount);
|
||||
inlineBalanceContainer = view.findViewById(R.id.tip_inline_balance_container);
|
||||
inlineBalanceValue = view.findViewById(R.id.tip_inline_balance_value);
|
||||
sendProgress = view.findViewById(R.id.tip_send_progress);
|
||||
cancelLink = view.findViewById(R.id.tip_cancel_link);
|
||||
sendButton = view.findViewById(R.id.tip_send);
|
||||
|
||||
inputAmount.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
inputAmount.setHint(hasFocus ? getString(R.string.zero) : "");
|
||||
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
TextView infoText = view.findViewById(R.id.tip_info);
|
||||
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
infoText.setText(HtmlCompat.fromHtml(
|
||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
|
||||
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
if (Helper.isNullOrEmpty(amountString)) {
|
||||
showError(getString(R.string.invalid_amount));
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(amountString);
|
||||
if (amount.doubleValue() > Lbry.walletBalance.getAvailable().doubleValue()) {
|
||||
showError(getString(R.string.insufficient_balance));
|
||||
return;
|
||||
}
|
||||
|
||||
SupportCreateTask task = new SupportCreateTask(claim.getClaimId(), amount, true, sendProgress, new GenericTaskHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
disableControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
enableControls();
|
||||
if (listener != null) {
|
||||
listener.onTipSent(amount);
|
||||
}
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showError(error.getMessage());
|
||||
enableControls();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
cancelLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
String channel = null;
|
||||
if (Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType())) {
|
||||
channel = claim.getTitleOrName();
|
||||
} else if (claim.getSigningChannel() != null) {
|
||||
channel = claim.getPublisherTitle();
|
||||
}
|
||||
((TextView) view.findViewById(R.id.tip_send_title)).setText(
|
||||
Helper.isNullOrEmpty(channel) ? getString(R.string.send_a_tip) : getString(R.string.send_a_tip_to, channel)
|
||||
);
|
||||
|
||||
onWalletBalanceUpdated(Lbry.walletBalance);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).removeWalletBalanceListener(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
|
||||
if (walletBalance != null && inlineBalanceValue != null) {
|
||||
inlineBalanceValue.setText(Helper.shortCurrencyFormat(walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
}
|
||||
|
||||
public interface SendTipListener {
|
||||
void onTipSent(BigDecimal amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package io.lbry.browser.exceptions;
|
||||
|
||||
public class AuthTokenInvalidatedException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package io.lbry.browser.listener;
|
||||
|
||||
public interface PIPModeListener {
|
||||
void onEnterPIPMode();
|
||||
void onExitPIPMode();
|
||||
}
|
||||
@@ -289,6 +289,9 @@ public class Claim {
|
||||
Claim signingChannel = new Claim();
|
||||
signingChannel.setClaimId(viewHistory.getPublisherClaimId());
|
||||
signingChannel.setName(viewHistory.getPublisherName());
|
||||
|
||||
LbryUri channelUrl = LbryUri.tryParse(String.format("%s#%s", signingChannel.getName(), signingChannel.getClaimId()));
|
||||
signingChannel.setPermanentUrl(channelUrl != null ? channelUrl.toString() : null);
|
||||
if (!Helper.isNullOrEmpty(viewHistory.getPublisherTitle())) {
|
||||
GenericMetadata channelValue = new GenericMetadata();
|
||||
channelValue.setTitle(viewHistory.getPublisherTitle());
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package io.lbry.browser.model;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Comment {
|
||||
public static final double LBC_COST = 1;
|
||||
public static final int MAX_LENGTH = 2000;
|
||||
|
||||
private Claim poster;
|
||||
private String claimId;
|
||||
private List<Comment> replies;
|
||||
private long timestamp;
|
||||
private String channelId;
|
||||
private String channelName, text, id, parentId;
|
||||
|
||||
public Comment(String channelId, String channelName, String text, String id, String parentId) {
|
||||
this.channelId = channelId;
|
||||
this.channelName = channelName;
|
||||
this.text = text;
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
|
||||
this.replies = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Comment() {
|
||||
replies = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addReply(Comment reply) {
|
||||
if (replies == null) {
|
||||
replies = new ArrayList<>();
|
||||
}
|
||||
if (!replies.contains(reply)) {
|
||||
replies.add(reply);
|
||||
}
|
||||
}
|
||||
|
||||
public static Comment fromJSONObject(JSONObject jsonObject) {
|
||||
try {
|
||||
String parentId = null;
|
||||
if (jsonObject.has("parent_id")) {
|
||||
parentId = jsonObject.getString("parent_id");
|
||||
}
|
||||
|
||||
Comment comment = new Comment(
|
||||
Helper.getJSONString("channel_id", null, jsonObject),
|
||||
jsonObject.getString("channel_name"),
|
||||
jsonObject.getString("comment"),
|
||||
jsonObject.getString("comment_id"),
|
||||
parentId
|
||||
);
|
||||
comment.setClaimId(Helper.getJSONString("claim_id", null, jsonObject));
|
||||
comment.setTimestamp(Helper.getJSONLong("timestamp", 0, jsonObject));
|
||||
return comment;
|
||||
} catch (JSONException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
@@ -53,13 +55,22 @@ public class Transaction {
|
||||
|
||||
int descStringId = -1;
|
||||
TransactionInfo info = null;
|
||||
List<TransactionInfo> infos = new ArrayList<>();
|
||||
try {
|
||||
if (jsonObject.has("abandon_info")) {
|
||||
JSONArray array = jsonObject.getJSONArray("abandon_info");
|
||||
if (array.length() > 0) {
|
||||
info = TransactionInfo.fromJSONObject(array.getJSONObject(0));
|
||||
descStringId = R.string.abandon;
|
||||
transaction.setAbandonInfo(info);
|
||||
if (array.length() == 1) {
|
||||
info = TransactionInfo.fromJSONObject(array.getJSONObject(0));
|
||||
descStringId = info.getBalanceDelta().doubleValue() == info.getAmount().doubleValue() ? R.string.unlock : R.string.abandon;
|
||||
transaction.setAbandonInfo(info);
|
||||
} else {
|
||||
// multiple abandon infos (txo_spend unlock tip)
|
||||
descStringId = R.string.unlock;
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
infos.add(TransactionInfo.fromJSONObject(array.getJSONObject(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info == null && jsonObject.has("claim_info")) {
|
||||
@@ -94,8 +105,18 @@ public class Transaction {
|
||||
// pass
|
||||
}
|
||||
|
||||
if (transaction.getValue().doubleValue() == 0 && info != null && info.getBalanceDelta().doubleValue() != 0) {
|
||||
transaction.setValue(info.getBalanceDelta());
|
||||
|
||||
|
||||
if (transaction.getValue().doubleValue() == 0) {
|
||||
if (info != null && info.getBalanceDelta().doubleValue() != 0) {
|
||||
transaction.setValue(info.getBalanceDelta());
|
||||
} else if (infos.size() > 0) {
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
for (TransactionInfo txInfo : infos) {
|
||||
total = total.add(txInfo.getAmount());
|
||||
}
|
||||
transaction.setValue(total);
|
||||
}
|
||||
}
|
||||
|
||||
if (descStringId == -1) {
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class BufferEventTask extends AsyncTask<Void, Void, Void> {
|
||||
private static final String TAG = "LbryBufferEvent";
|
||||
private static final String ENDPOINT = "https://collector-service.api.lbry.tv/api/v1/events/video";
|
||||
|
||||
private String streamUrl;
|
||||
private String userIdHash;
|
||||
private long streamDuration;
|
||||
private long streamPosition;
|
||||
private long bufferDuration;
|
||||
|
||||
public BufferEventTask(String streamUrl, long streamDuration, long streamPosition, long bufferDuration, String userIdHash) {
|
||||
this.streamUrl = streamUrl;
|
||||
this.bufferDuration = bufferDuration;
|
||||
this.streamDuration = streamDuration;
|
||||
this.streamPosition = streamPosition;
|
||||
this.userIdHash = userIdHash;
|
||||
}
|
||||
|
||||
protected Void doInBackground(Void... params) {
|
||||
JSONObject requestBody = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.put("url", streamUrl);
|
||||
data.put("position", streamPosition);
|
||||
data.put("stream_duration", streamDuration);
|
||||
//data.put("duration", bufferDuration);
|
||||
|
||||
requestBody.put("device", "android");
|
||||
requestBody.put("type", "buffering");
|
||||
requestBody.put("client", userIdHash);
|
||||
requestBody.put("data", data);
|
||||
|
||||
RequestBody body = RequestBody.create(requestBody.toString(), Helper.JSON_MEDIA_TYPE);
|
||||
Request request = new Request.Builder().url(ENDPOINT).post(body).build();
|
||||
OkHttpClient client = new OkHttpClient.Builder().
|
||||
writeTimeout(60, TimeUnit.SECONDS).
|
||||
readTimeout(60, TimeUnit.SECONDS).
|
||||
build();
|
||||
|
||||
Response response = client.newCall(request).execute();
|
||||
String responseString = response.body().string();
|
||||
Log.d(TAG, String.format("buffer event sent: %s", responseString));
|
||||
} catch (Exception ex) {
|
||||
// we don't want to fail if a buffer event fails to register
|
||||
Log.d(TAG, String.format("buffer event log failed: %s", ex.getMessage()), ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.lbry.browser.exceptions.ApiCallException;
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class CommentCreateWithTipTask 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) {
|
||||
this.comment = comment;
|
||||
this.amount = amount;
|
||||
this.progressView = progressView;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
protected void onPreExecute() {
|
||||
Helper.setViewVisibility(progressView, View.VISIBLE);
|
||||
}
|
||||
|
||||
public Comment doInBackground(Void... params) {
|
||||
Comment createdComment = null;
|
||||
try {
|
||||
// check comments status endpoint
|
||||
Request request = new Request.Builder().url(STATUS_ENDPOINT).build();
|
||||
OkHttpClient client = new OkHttpClient.Builder().
|
||||
writeTimeout(30, TimeUnit.SECONDS).
|
||||
readTimeout(30, TimeUnit.SECONDS).
|
||||
build();
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject status = new JSONObject(response.body().string());
|
||||
String statusText = Helper.getJSONString("text", null, status);
|
||||
boolean isRunning = Helper.getJSONBoolean("is_running", false, status);
|
||||
if (!"ok".equalsIgnoreCase(statusText) || !isRunning) {
|
||||
throw new ApiCallException("The comment server is not available at this time. Please try again later.");
|
||||
}
|
||||
|
||||
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());
|
||||
options.put("channel_name", comment.getChannelName());
|
||||
if (!Helper.isNullOrEmpty(comment.getParentId())) {
|
||||
options.put("parent_id", comment.getParentId());
|
||||
}
|
||||
JSONObject jsonObject = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_COMMENT_CREATE, options);
|
||||
createdComment = Comment.fromJSONObject(jsonObject);
|
||||
} catch (ApiCallException | ClassCastException | IOException | JSONException ex) {
|
||||
error = ex;
|
||||
}
|
||||
|
||||
return createdComment;
|
||||
}
|
||||
|
||||
protected void onPostExecute(Comment createdComment) {
|
||||
Helper.setViewVisibility(progressView, View.GONE);
|
||||
if (handler != null) {
|
||||
if (createdComment != null) {
|
||||
handler.onSuccess(createdComment);
|
||||
} else {
|
||||
handler.onError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface CommentCreateWithTipHandler {
|
||||
void onSuccess(Comment createdComment);
|
||||
void onError(Exception error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.model.Comment;
|
||||
|
||||
public interface CommentListHandler {
|
||||
void onSuccess(List<Comment> comments, boolean hasReachedEnd);
|
||||
void onError(Exception error);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
|
||||
private final int page;
|
||||
private final int pageSize;
|
||||
private final String claim;
|
||||
private ProgressBar progressBar;
|
||||
private CommentListHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public CommentListTask(int page, int pageSize, String claim, ProgressBar progressBar, CommentListHandler handler) {
|
||||
this.page = page;
|
||||
this.pageSize = pageSize;
|
||||
this.claim = claim;
|
||||
this.progressBar = progressBar;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
protected void onPreExecute() {
|
||||
Helper.setViewVisibility(progressBar, View.VISIBLE);
|
||||
}
|
||||
|
||||
protected List<Comment> doInBackground(Void... voids) {
|
||||
List<Comment> comments = null;
|
||||
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
|
||||
options.put("claim_id", claim);
|
||||
options.put("page", page);
|
||||
options.put("page_size", pageSize);
|
||||
options.put("include_replies", false);
|
||||
options.put("is_channel_signature_valid", true);
|
||||
options.put("visible", true);
|
||||
options.put("hidden", false);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_COMMENT_LIST, options);
|
||||
JSONArray items = result.getJSONArray("items");
|
||||
|
||||
List<Comment> children = new ArrayList<>();
|
||||
comments = new ArrayList<>();
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
Comment comment = Comment.fromJSONObject(items.getJSONObject(i));
|
||||
if (comment != null) {
|
||||
if (!Helper.isNullOrEmpty(comment.getParentId())) {
|
||||
children.add(comment);
|
||||
} else {
|
||||
comments.add(comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Comment child : children) {
|
||||
for (Comment parent : comments) {
|
||||
if (parent.getId().equalsIgnoreCase(child.getParentId())) {
|
||||
parent.addReply(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
}
|
||||
return comments;
|
||||
}
|
||||
|
||||
protected void onPostExecute(List<Comment> comments) {
|
||||
Helper.setViewVisibility(progressBar, View.GONE);
|
||||
if (handler != null) {
|
||||
if (comments != null) {
|
||||
handler.onSuccess(comments, comments.size() < pageSize);
|
||||
} else {
|
||||
handler.onError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,11 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
private List<Subscription> diff;
|
||||
private MergeSubscriptionsHandler handler;
|
||||
private Exception error;
|
||||
private boolean replaceLocal;
|
||||
|
||||
public MergeSubscriptionsTask(List<Subscription> base, Context context, MergeSubscriptionsHandler handler) {
|
||||
public MergeSubscriptionsTask(List<Subscription> base, boolean replaceLocal, Context context, MergeSubscriptionsHandler handler) {
|
||||
this.base = base;
|
||||
this.replaceLocal = replaceLocal;
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
}
|
||||
@@ -53,10 +55,17 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
db = ((MainActivity) context).getDbHelper().getWritableDatabase();
|
||||
}
|
||||
if (db != null) {
|
||||
localSubs = DatabaseHelper.getSubscriptions(db);
|
||||
for (Subscription sub : localSubs) {
|
||||
if (!combined.contains(sub)) {
|
||||
combined.add(sub);
|
||||
if (replaceLocal) {
|
||||
DatabaseHelper.clearSubscriptions(db);
|
||||
for (Subscription sub : base) {
|
||||
DatabaseHelper.createOrUpdateSubscription(sub, db);
|
||||
}
|
||||
} else {
|
||||
localSubs = DatabaseHelper.getSubscriptions(db);
|
||||
for (Subscription sub : localSubs) {
|
||||
if (!combined.contains(sub)) {
|
||||
combined.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +73,7 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
// fetch remote subscriptions
|
||||
JSONArray array = (JSONArray) Lbryio.parseResponse(Lbryio.call("subscription", "list", context));
|
||||
if (array != null) {
|
||||
// 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);
|
||||
String claimId = item.getString("claim_id");
|
||||
@@ -77,35 +87,39 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < combined.size(); i++) {
|
||||
Subscription local = combined.get(i);
|
||||
if (!remoteSubs.contains(local)) {
|
||||
// add to remote subscriptions
|
||||
try {
|
||||
LbryUri uri = LbryUri.parse(local.getUrl());
|
||||
List<Subscription> remoteUnsubs = new ArrayList<>();
|
||||
List<Subscription> finalRemoteSubs = new ArrayList<>();
|
||||
if (remoteSubs.size() > 0) {
|
||||
for (int i = 0; i < remoteSubs.size(); i++) {
|
||||
Subscription sub = remoteSubs.get(i);
|
||||
if (!combined.contains(sub)) {
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("claim_id", uri.getChannelClaimId());
|
||||
options.put("channel_name", Helper.normalizeChannelName(local.getChannelName()));
|
||||
Lbryio.parseResponse(Lbryio.call("subscription", "new", options, context));
|
||||
} catch (LbryUriException | LbryioRequestException | LbryioResponseException ex) {
|
||||
// pass
|
||||
Log.e(TAG, String.format("subscription/new failed: %s", ex.getMessage()), ex);
|
||||
LbryUri uri = LbryUri.tryParse(sub.getUrl());
|
||||
if (uri != null) {
|
||||
options.put("claim_id", uri.getChannelClaimId());
|
||||
Lbryio.parseResponse(Lbryio.call("subscription", "delete", options, context));
|
||||
remoteUnsubs.add(sub);
|
||||
} else {
|
||||
finalRemoteSubs.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < localSubs.size(); i++) {
|
||||
Subscription local = localSubs.get(i);
|
||||
if (!base.contains(local) && !diff.contains(local)) {
|
||||
diff.add(local);
|
||||
if (!replaceLocal) {
|
||||
for (int i = 0; i < localSubs.size(); i++) {
|
||||
Subscription local = localSubs.get(i);
|
||||
if (!base.contains(local) && !diff.contains(local)) {
|
||||
diff.add(local);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < remoteSubs.size(); i++) {
|
||||
Subscription remote = remoteSubs.get(i);
|
||||
if (!combined.contains(remote)) {
|
||||
combined.add(remote);
|
||||
if (!diff.contains(remote)) {
|
||||
diff.add(remote);
|
||||
for (int i = 0; i < finalRemoteSubs.size(); i++) {
|
||||
Subscription remote = finalRemoteSubs.get(i);
|
||||
if (!combined.contains(remote)) {
|
||||
combined.add(remote);
|
||||
if (!diff.contains(remote)) {
|
||||
diff.add(remote);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +45,15 @@ public class UpdateSuggestedTagsTask extends AsyncTask<Void, Void, List<Tag>> {
|
||||
if (suggestedTagsAdapter != null && !clearPrevious) {
|
||||
tags = new ArrayList<>(suggestedTagsAdapter.getTags());
|
||||
}
|
||||
while (tags.size() < limit) {
|
||||
Tag randomTag = Lbry.knownTags.get(random.nextInt(Lbry.knownTags.size()));
|
||||
if (excludeMature && randomTag.isMature()) {
|
||||
continue;
|
||||
}
|
||||
if (!Lbry.followedTags.contains(randomTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(randomTag))) {
|
||||
tags.add(randomTag);
|
||||
if (Lbry.knownTags.size() > 0) {
|
||||
while (tags.size() < limit) {
|
||||
Tag randomTag = Lbry.knownTags.get(random.nextInt(Lbry.knownTags.size()));
|
||||
if (excludeMature && randomTag.isMature()) {
|
||||
continue;
|
||||
}
|
||||
if (!Lbry.followedTags.contains(randomTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(randomTag))) {
|
||||
tags.add(randomTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -64,10 +66,15 @@ public class UpdateSuggestedTagsTask extends AsyncTask<Void, Void, List<Tag>> {
|
||||
if (excludeMature && knownTag.isMature()) {
|
||||
continue;
|
||||
}
|
||||
if ((knownTag.getLowercaseName().startsWith(filter) || knownTag.getLowercaseName().matches(filter)) &&
|
||||
(!tags.contains(knownTag) &&
|
||||
!Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))) {
|
||||
tags.add(knownTag);
|
||||
try {
|
||||
if ((knownTag.getLowercaseName().startsWith(filter) ||
|
||||
knownTag.getLowercaseName().matches(filter)) &&
|
||||
(!tags.contains(knownTag) && !Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))
|
||||
) {
|
||||
tags.add(knownTag);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ public class ClaimListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
Helper.setViewVisibility(progressView, View.GONE);
|
||||
if (handler != null) {
|
||||
if (claims != null) {
|
||||
handler.onSuccess(claims);
|
||||
// TODO: Add fix for handling invalid reposts in ClaimListAdapter
|
||||
handler.onSuccess(Helper.filterInvalidReposts(claims));
|
||||
} else {
|
||||
handler.onError(error);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ClaimSearchTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
}
|
||||
protected List<Claim> doInBackground(Void... params) {
|
||||
try {
|
||||
return Helper.filterInvalidReposts(Lbry.claimSearch(options, connectionString));
|
||||
return Lbry.claimSearch(options, connectionString);
|
||||
} catch (ApiCallException ex) {
|
||||
error = ex;
|
||||
return null;
|
||||
@@ -39,7 +39,7 @@ public class ClaimSearchTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
Helper.setViewVisibility(progressView, View.GONE);
|
||||
if (handler != null) {
|
||||
if (claims != null) {
|
||||
handler.onSuccess(claims, claims.size() < Helper.parseInt(options.get("page_size"), 0));
|
||||
handler.onSuccess(Helper.filterInvalidReposts(claims), claims.size() < Helper.parseInt(options.get("page_size"), 0));
|
||||
} else {
|
||||
handler.onError(error);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,14 @@ public class PublishClaimTask extends AsyncTask<Void, Void, Claim> {
|
||||
options.put("license_url", metadata.getLicenseUrl());
|
||||
}
|
||||
|
||||
if (metadata.getReleaseTime() > 0) {
|
||||
options.put("release_time", metadata.getReleaseTime());
|
||||
} else if (claim.getTimestamp() > 0) {
|
||||
options.put("release_time", claim.getTimestamp());
|
||||
} else {
|
||||
options.put("release_time", Double.valueOf(Math.floor(System.currentTimeMillis() / 1000.0)).intValue());
|
||||
}
|
||||
|
||||
Claim claimResult = null;
|
||||
try {
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PUBLISH, options);
|
||||
|
||||
@@ -18,12 +18,19 @@ import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private String claimId;
|
||||
private int page;
|
||||
private int pageSize;
|
||||
private ClaimSearchResultHandler handler;
|
||||
private View progressView;
|
||||
private Exception error;
|
||||
|
||||
public PurchaseListTask(String claimId, View progressView, ClaimSearchResultHandler handler) {
|
||||
this.claimId = claimId;
|
||||
this.progressView = progressView;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public PurchaseListTask(int page, int pageSize, View progressView, ClaimSearchResultHandler handler) {
|
||||
this.page = page;
|
||||
this.pageSize = pageSize;
|
||||
@@ -38,8 +45,15 @@ public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
List<Claim> claims = null;
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
options.put("page", page);
|
||||
options.put("page_size", pageSize);
|
||||
if (!Helper.isNullOrEmpty(claimId)) {
|
||||
options.put("claim_id", claimId);
|
||||
}
|
||||
if (page > 0) {
|
||||
options.put("page", page);
|
||||
}
|
||||
if (pageSize > 0) {
|
||||
options.put("page_size", pageSize);
|
||||
}
|
||||
options.put("resolve", true);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PURCHASE_LIST, options);
|
||||
@@ -47,9 +61,10 @@ public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
claims = new ArrayList<>();
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
Claim claim = Claim.fromJSONObject(items.getJSONObject(i).getJSONObject("claim"));
|
||||
claims.add(claim);
|
||||
|
||||
Lbry.addClaimToCache(claim);
|
||||
if (!Helper.isNullOrEmpty(claim.getClaimId())) {
|
||||
claims.add(claim);
|
||||
Lbry.addClaimToCache(claim);
|
||||
}
|
||||
}
|
||||
} catch (ApiCallException | JSONException | ClassCastException ex) {
|
||||
error = ex;
|
||||
|
||||
@@ -4,9 +4,12 @@ import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -14,6 +17,8 @@ import io.lbry.browser.R;
|
||||
import io.lbry.browser.exceptions.ApiCallException;
|
||||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.lbryinc.Reward;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
@@ -43,6 +48,15 @@ public class ClaimRewardTask extends AsyncTask<Void, Void, String> {
|
||||
public String doInBackground(Void... params) {
|
||||
String message = null;
|
||||
try {
|
||||
String txid = null;
|
||||
if (Reward.TYPE_FIRST_CHANNEL.equalsIgnoreCase(type)) {
|
||||
// fetch a channel
|
||||
txid = fetchSingleClaimTxid(Claim.TYPE_CHANNEL);
|
||||
} else if (Reward.TYPE_FIRST_PUBLISH.equalsIgnoreCase(type)) {
|
||||
// fetch a publish
|
||||
txid = fetchSingleClaimTxid(Claim.TYPE_STREAM);
|
||||
}
|
||||
|
||||
// Get a new wallet address for the reward
|
||||
String address = (String) Lbry.genericApiCall(Lbry.METHOD_ADDRESS_UNUSED);
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -50,8 +64,11 @@ public class ClaimRewardTask extends AsyncTask<Void, Void, String> {
|
||||
options.put("wallet_address", address);
|
||||
if (!Helper.isNullOrEmpty(rewardCode)) {
|
||||
options.put("code", rewardCode);
|
||||
|
||||
}
|
||||
if (!Helper.isNullOrEmpty(txid)) {
|
||||
options.put("transaction_id", txid);
|
||||
}
|
||||
|
||||
JSONObject reward = (JSONObject) Lbryio.parseResponse(
|
||||
Lbryio.call("reward", "claim", options, Helper.METHOD_POST, null));
|
||||
amountClaimed = Helper.getJSONDouble("reward_amount", 0, reward);
|
||||
@@ -61,7 +78,7 @@ public class ClaimRewardTask extends AsyncTask<Void, Void, String> {
|
||||
amountClaimed == 1 ? 1 : 2,
|
||||
new DecimalFormat(Helper.LBC_CURRENCY_FORMAT_PATTERN).format(amountClaimed)) : "";
|
||||
message = Helper.getJSONString("reward_notification", defaultMessage, reward);
|
||||
} catch (ApiCallException | LbryioRequestException | LbryioResponseException ex) {
|
||||
} catch (ApiCallException | JSONException | LbryioRequestException | LbryioResponseException ex) {
|
||||
error = ex;
|
||||
}
|
||||
|
||||
@@ -79,6 +96,23 @@ public class ClaimRewardTask extends AsyncTask<Void, Void, String> {
|
||||
}
|
||||
}
|
||||
|
||||
private String fetchSingleClaimTxid(String claimType) throws ApiCallException, JSONException {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
options.put("claim_type", claimType);
|
||||
options.put("page", 1);
|
||||
options.put("page_size", 1);
|
||||
options.put("resolve", true);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_CLAIM_LIST, options);
|
||||
JSONArray items = result.getJSONArray("items");
|
||||
if (items.length() > 0) {
|
||||
Claim claim = Claim.fromJSONObject(items.getJSONObject(0));
|
||||
return claim.getTxid();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public interface ClaimRewardHandler {
|
||||
void onSuccess(double amountClaimed, String message);
|
||||
void onError(Exception error);
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
package io.lbry.browser.tasks.lbryinc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import io.lbry.browser.model.lbryinc.User;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class FetchCurrentUserTask extends AsyncTask<Void, Void, User> {
|
||||
private Context context;
|
||||
private Exception error;
|
||||
private FetchUserTaskHandler handler;
|
||||
|
||||
public FetchCurrentUserTask(FetchUserTaskHandler handler) {
|
||||
public FetchCurrentUserTask(Context context, FetchUserTaskHandler handler) {
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
}
|
||||
protected User doInBackground(Void... params) {
|
||||
try {
|
||||
return Lbryio.fetchCurrentUser(null);
|
||||
return Lbryio.fetchCurrentUser(context);
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
return null;
|
||||
|
||||
@@ -54,24 +54,25 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
|
||||
cursor = resolver.query(
|
||||
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
|
||||
projection, null, null,
|
||||
String.format("%s DESC", MediaStore.MediaColumns.DATE_MODIFIED));
|
||||
while (cursor.moveToNext()) {
|
||||
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
|
||||
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
||||
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
||||
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
||||
String.format("%s DESC LIMIT 150", MediaStore.MediaColumns.DATE_MODIFIED));
|
||||
if (cursor != null) {
|
||||
while (cursor.moveToNext()) {
|
||||
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
|
||||
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
||||
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
||||
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
||||
|
||||
GalleryItem item = new GalleryItem();
|
||||
item.setId(cursor.getString(idColumn));
|
||||
item.setName(cursor.getString(nameColumn));
|
||||
item.setType(cursor.getString(typeColumn));
|
||||
item.setFilePath(cursor.getString(pathColumn));
|
||||
item.setDuration(cursor.getLong(durationColumn));
|
||||
items.add(item);
|
||||
GalleryItem item = new GalleryItem();
|
||||
item.setId(cursor.getString(idColumn));
|
||||
item.setName(cursor.getString(nameColumn));
|
||||
item.setType(cursor.getString(typeColumn));
|
||||
item.setFilePath(cursor.getString(pathColumn));
|
||||
item.setDuration(cursor.getLong(durationColumn));
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
} catch (SQLiteException ex) {
|
||||
|
||||
// failed to load videos. log and pass
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
} finally {
|
||||
|
||||
+11
-3
@@ -1,20 +1,28 @@
|
||||
package io.lbry.browser.tasks.verification;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.model.lbryinc.User;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class CheckUserEmailVerifiedTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Context context;
|
||||
private CheckUserEmailVerifiedHandler handler;
|
||||
|
||||
public CheckUserEmailVerifiedTask(CheckUserEmailVerifiedHandler handler) {
|
||||
public CheckUserEmailVerifiedTask(Context context, CheckUserEmailVerifiedHandler handler) {
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
User user = Lbryio.fetchCurrentUser(null);
|
||||
return user != null && user.isHasVerifiedEmail();
|
||||
try {
|
||||
User user = Lbryio.fetchCurrentUser(context);
|
||||
return user != null && user.isHasVerifiedEmail();
|
||||
} catch (AuthTokenInvalidatedException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute(Boolean result) {
|
||||
|
||||
@@ -91,7 +91,11 @@ public class LoadSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
if (tags != null) {
|
||||
if (db != null && tags.length() > 0) {
|
||||
DatabaseHelper.setAllTagsUnfollowed(db);
|
||||
try {
|
||||
DatabaseHelper.setAllTagsUnfollowed(db);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
followedTags = new ArrayList<>();
|
||||
@@ -105,7 +109,7 @@ public class LoadSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
if (db != null) {
|
||||
DatabaseHelper.createOrUpdateTag(tag, db);
|
||||
}
|
||||
} catch (SQLiteException ex) {
|
||||
} catch (SQLiteException | IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,16 @@ import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class SupportCreateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String claimId;
|
||||
private String channelId;
|
||||
private BigDecimal amount;
|
||||
private boolean tip;
|
||||
private View progressView;
|
||||
private GenericTaskHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public SupportCreateTask(String claimId, BigDecimal amount, boolean tip, View progressView, GenericTaskHandler handler) {
|
||||
public SupportCreateTask(String claimId, String channelId, BigDecimal amount, boolean tip, View progressView, GenericTaskHandler handler) {
|
||||
this.claimId = claimId;
|
||||
this.channelId = channelId;
|
||||
this.amount = amount;
|
||||
this.tip = tip;
|
||||
this.progressView = progressView;
|
||||
@@ -40,9 +42,13 @@ public class SupportCreateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
options.put("blocking", true);
|
||||
options.put("claim_id", claimId);
|
||||
options.put("amount", new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).format(amount.doubleValue()));
|
||||
options.put("tip", tip);
|
||||
if (!Helper.isNullOrEmpty(channelId)) {
|
||||
options.put("channel_id", channelId);
|
||||
}
|
||||
Lbry.genericApiCall(Lbry.METHOD_SUPPORT_CREATE, options);
|
||||
} catch (ApiCallException ex) {
|
||||
error = ex;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SyncGetTask extends AsyncTask<Void, Void, WalletSync> {
|
||||
if (applySyncChanges) {
|
||||
if (applySyncSuccessful) {
|
||||
handler.onSyncApplySuccess(syncHash, syncData);
|
||||
} else {
|
||||
} else if (syncApplyError != null) {
|
||||
handler.onSyncApplyError(syncApplyError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class UnlockTipsTask extends AsyncTask<Void, Void, Boolean> {
|
||||
public Boolean doInBackground(Void... params) {
|
||||
|
||||
List<String> txids = new ArrayList<>();
|
||||
List<String> claimIds = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
@@ -42,18 +41,16 @@ public class UnlockTipsTask extends AsyncTask<Void, Void, Boolean> {
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
JSONObject item = items.getJSONObject(i);
|
||||
String txid = Helper.getJSONString("txid", null, item);
|
||||
String claimId = Helper.getJSONString("claim_id", null, item);
|
||||
if (!Helper.isNullOrEmpty(txid) && !Helper.isNullOrEmpty(claimId)) {
|
||||
if (!Helper.isNullOrEmpty(txid)) {
|
||||
txids.add(txid);
|
||||
claimIds.add(claimId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (txids.size() > 0 && txids.size() == claimIds.size()) {
|
||||
if (txids.size() > 0) {
|
||||
options = new HashMap<>();
|
||||
options.put("txid", txids);
|
||||
options.put("claim_id", claimIds);
|
||||
options.put("blocking", true);
|
||||
Lbry.genericApiCall(Lbry.METHOD_TXO_SPEND, options);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class WalletBalanceTask extends AsyncTask<Void, Void, WalletBalance> {
|
||||
}
|
||||
|
||||
protected WalletBalance doInBackground(Void... params) {
|
||||
WalletBalance balance = new WalletBalance();
|
||||
WalletBalance balance;
|
||||
try {
|
||||
JSONObject json = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_WALLET_BALANCE);
|
||||
balance = WalletBalance.fromJSONObject(json);
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
package io.lbry.browser.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.BuildConfig;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimResultHandler;
|
||||
import io.lbry.browser.tasks.lbryinc.LogPublishTask;
|
||||
import io.lbry.browser.ui.wallet.RewardsFragment;
|
||||
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 lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -47,6 +65,7 @@ public class BaseFragment extends Fragment {
|
||||
MainActivity.resumeGlobalPlayer(context);
|
||||
}
|
||||
}
|
||||
rewardDriverClickListenerSet = false;
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@@ -65,7 +84,7 @@ public class BaseFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkRewardsDriverCard(String rewardDriverText) {
|
||||
public void checkRewardsDriverCard(String rewardDriverText, double minCost) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
View rewardDriverCard = root.findViewById(R.id.reward_driver_card);
|
||||
@@ -85,9 +104,139 @@ public class BaseFragment extends Fragment {
|
||||
|
||||
// only apply to fragments that have the card present
|
||||
((TextView) rewardDriverCard.findViewById(R.id.reward_driver_text)).setText(rewardDriverText);
|
||||
boolean showRewardsDriver = Lbry.walletBalance == null || Lbry.walletBalance.getAvailable().doubleValue() <= 0;
|
||||
boolean showRewardsDriver = Lbry.walletBalance == null ||
|
||||
minCost == 0 && Lbry.walletBalance.getAvailable().doubleValue() == 0 |
|
||||
Lbry.walletBalance.getAvailable().doubleValue() < Math.max(minCost, Helper.MIN_DEPOSIT);
|
||||
rewardDriverCard.setVisibility(showRewardsDriver ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showError(String message) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void setupInlineChannelCreator(
|
||||
View container,
|
||||
TextInputEditText inputChannelName,
|
||||
TextInputEditText inputDeposit,
|
||||
View inlineBalanceView,
|
||||
TextView inlineBalanceValue,
|
||||
View linkCancel,
|
||||
MaterialButton buttonCreate,
|
||||
View progressView,
|
||||
AppCompatSpinner channelSpinner,
|
||||
InlineChannelSpinnerAdapter channelSpinnerAdapter) {
|
||||
inputDeposit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
Helper.setViewVisibility(inlineBalanceView, hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
linkCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Helper.setViewText(inputChannelName, null);
|
||||
Helper.setViewText(inputDeposit, null);
|
||||
Helper.setViewVisibility(container, View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
buttonCreate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// validate deposit and channel name
|
||||
String channelNameString = Helper.normalizeChannelName(Helper.getValue(inputChannelName.getText()));
|
||||
Claim claimToSave = new Claim();
|
||||
claimToSave.setName(channelNameString);
|
||||
String channelName = claimToSave.getName().startsWith("@") ? claimToSave.getName().substring(1) : claimToSave.getName();
|
||||
String depositString = Helper.getValue(inputDeposit.getText());
|
||||
if ("@".equals(channelName) || Helper.isNullOrEmpty(channelName)) {
|
||||
showError(getString(R.string.please_enter_channel_name));
|
||||
return;
|
||||
}
|
||||
if (!LbryUri.isNameValid(channelName)) {
|
||||
showError(getString(R.string.channel_name_invalid_characters));
|
||||
return;
|
||||
}
|
||||
if (Helper.channelExists(channelName)) {
|
||||
showError(getString(R.string.channel_name_already_created));
|
||||
return;
|
||||
}
|
||||
|
||||
double depositAmount = 0;
|
||||
try {
|
||||
depositAmount = Double.valueOf(depositString);
|
||||
} catch (NumberFormatException ex) {
|
||||
// pass
|
||||
showError(getString(R.string.please_enter_valid_deposit));
|
||||
return;
|
||||
}
|
||||
if (depositAmount == 0) {
|
||||
String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT));
|
||||
showError(error);
|
||||
return;
|
||||
}
|
||||
if (Lbry.walletBalance == null || Lbry.walletBalance.getAvailable().doubleValue() < depositAmount) {
|
||||
showError(getString(R.string.deposit_more_than_balance));
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelCreateUpdateTask task = new ChannelCreateUpdateTask(
|
||||
claimToSave, new BigDecimal(depositString), false, progressView, new ClaimResultHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
Helper.setViewEnabled(inputChannelName, false);
|
||||
Helper.setViewEnabled(inputDeposit, false);
|
||||
Helper.setViewEnabled(buttonCreate, false);
|
||||
Helper.setViewEnabled(linkCancel, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Claim claimResult) {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
LogPublishTask logPublishTask = new LogPublishTask(claimResult);
|
||||
logPublishTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
// channel created
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("claim_id", claimResult.getClaimId());
|
||||
bundle.putString("claim_name", claimResult.getName());
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_CHANNEL_CREATE, bundle);
|
||||
|
||||
// add the claim to the channel list and set it as the selected item
|
||||
if (channelSpinnerAdapter != null) {
|
||||
channelSpinnerAdapter.add(claimResult);
|
||||
}
|
||||
if (channelSpinner != null && channelSpinnerAdapter != null) {
|
||||
channelSpinner.setSelection(channelSpinnerAdapter.getCount() - 1);
|
||||
}
|
||||
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
showError(error.getMessage());
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
Helper.setViewText(inlineBalanceValue, Helper.shortCurrencyFormat(Lbry.walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,717 @@
|
||||
package io.lbry.browser.ui.channel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.BuildConfig;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.ClaimListAdapter;
|
||||
import io.lbry.browser.adapter.CommentListAdapter;
|
||||
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
|
||||
import io.lbry.browser.listener.SdkStatusListener;
|
||||
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.CommentListHandler;
|
||||
import io.lbry.browser.tasks.CommentListTask;
|
||||
import io.lbry.browser.tasks.claim.ChannelCreateUpdateTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||
import io.lbry.browser.tasks.lbryinc.LogPublishTask;
|
||||
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 {
|
||||
|
||||
@Setter
|
||||
private Claim claim;
|
||||
private CommentListAdapter commentListAdapter;
|
||||
|
||||
private Comment replyToComment;
|
||||
private View containerReplyToComment;
|
||||
private TextView textReplyingTo;
|
||||
private TextView textReplyToBody;
|
||||
private View buttonClearReplyToComment;
|
||||
|
||||
private boolean postingComment;
|
||||
private boolean fetchingChannels;
|
||||
private View progressLoadingChannels;
|
||||
private View progressPostComment;
|
||||
private InlineChannelSpinnerAdapter commentChannelSpinnerAdapter;
|
||||
private AppCompatSpinner commentChannelSpinner;
|
||||
private TextInputEditText inputComment;
|
||||
private TextView textCommentLimit;
|
||||
private MaterialButton buttonPostComment;
|
||||
private ImageView commentPostAsThumbnail;
|
||||
private View commentPostAsNoThumbnail;
|
||||
private TextView commentPostAsAlpha;
|
||||
|
||||
private View inlineChannelCreator;
|
||||
private TextInputEditText inlineChannelCreatorInputName;
|
||||
private TextInputEditText inlineChannelCreatorInputDeposit;
|
||||
private View inlineChannelCreatorInlineBalance;
|
||||
private TextView inlineChannelCreatorInlineBalanceValue;
|
||||
private View inlineChannelCreatorCancelLink;
|
||||
private View inlineChannelCreatorProgress;
|
||||
private MaterialButton inlineChannelCreatorCreateButton;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
View root = inflater.inflate(R.layout.fragment_channel_comments, container, false);
|
||||
|
||||
containerReplyToComment = root.findViewById(R.id.comment_form_reply_to_container);
|
||||
textReplyingTo = root.findViewById(R.id.comment_form_replying_to_text);
|
||||
textReplyToBody = root.findViewById(R.id.comment_form_reply_to_body);
|
||||
buttonClearReplyToComment = root.findViewById(R.id.comment_form_clear_reply_to);
|
||||
|
||||
commentChannelSpinner = root.findViewById(R.id.comment_form_channel_spinner);
|
||||
progressLoadingChannels = root.findViewById(R.id.comment_form_channels_loading);
|
||||
progressPostComment = root.findViewById(R.id.comment_form_post_progress);
|
||||
inputComment = root.findViewById(R.id.comment_form_body);
|
||||
textCommentLimit = root.findViewById(R.id.comment_form_text_limit);
|
||||
buttonPostComment = root.findViewById(R.id.comment_form_post);
|
||||
commentPostAsThumbnail = root.findViewById(R.id.comment_form_thumbnail);
|
||||
commentPostAsNoThumbnail = root.findViewById(R.id.comment_form_no_thumbnail);
|
||||
commentPostAsAlpha = root.findViewById(R.id.comment_form_thumbnail_alpha);
|
||||
|
||||
inlineChannelCreator = root.findViewById(R.id.container_inline_channel_form_create);
|
||||
inlineChannelCreatorInputName = root.findViewById(R.id.inline_channel_form_input_name);
|
||||
inlineChannelCreatorInputDeposit = root.findViewById(R.id.inline_channel_form_input_deposit);
|
||||
inlineChannelCreatorInlineBalance = root.findViewById(R.id.inline_channel_form_inline_balance_container);
|
||||
inlineChannelCreatorInlineBalanceValue = root.findViewById(R.id.inline_channel_form_inline_balance_value);
|
||||
inlineChannelCreatorProgress = root.findViewById(R.id.inline_channel_form_create_progress);
|
||||
inlineChannelCreatorCancelLink = root.findViewById(R.id.inline_channel_form_cancel_link);
|
||||
inlineChannelCreatorCreateButton = root.findViewById(R.id.inline_channel_form_create_button);
|
||||
|
||||
RecyclerView commentList = root.findViewById(R.id.channel_comments_list);
|
||||
commentList.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
initCommentForm(root);
|
||||
setupInlineChannelCreator(
|
||||
inlineChannelCreator,
|
||||
inlineChannelCreatorInputName,
|
||||
inlineChannelCreatorInputDeposit,
|
||||
inlineChannelCreatorInlineBalance,
|
||||
inlineChannelCreatorInlineBalanceValue,
|
||||
inlineChannelCreatorCancelLink,
|
||||
inlineChannelCreatorCreateButton,
|
||||
inlineChannelCreatorProgress,
|
||||
commentChannelSpinner,
|
||||
commentChannelSpinnerAdapter
|
||||
);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (!Lbry.SDK_READY) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addSdkStatusListener(this);
|
||||
}
|
||||
} else {
|
||||
onSdkReady();
|
||||
}
|
||||
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
checkCommentSdkInitializing();
|
||||
}
|
||||
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
activity.removeSdkStatusListener(this);
|
||||
activity.removeWalletBalanceListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCommentSdkInitializing() {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
TextView commentsSDKInitializing = root.findViewById(R.id.channel_comments_sdk_initializing);
|
||||
Helper.setViewVisibility(commentsSDKInitializing, Lbry.SDK_READY ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSdkReady() {
|
||||
fetchChannels();
|
||||
checkAndLoadComments();
|
||||
}
|
||||
|
||||
private void checkAndLoadComments() {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
checkCommentSdkInitializing();
|
||||
RecyclerView commentsList = root.findViewById(R.id.channel_comments_list);
|
||||
if (commentsList == null || commentsList.getAdapter() == null || commentsList.getAdapter().getItemCount() == 0) {
|
||||
loadComments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadComments() {
|
||||
View root = getView();
|
||||
ProgressBar relatedLoading = root.findViewById(R.id.channel_comments_progress);
|
||||
if (claim != null && root != null) {
|
||||
CommentListTask task = new CommentListTask(1, 500, claim.getClaimId(), relatedLoading, new CommentListHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Comment> comments, boolean hasReachedEnd) {
|
||||
Context ctx = getContext();
|
||||
View root = getView();
|
||||
if (ctx != null && root != null) {
|
||||
commentListAdapter = new CommentListAdapter(comments, ctx);
|
||||
commentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
if (!Helper.isNullOrEmpty(claim.getName()) &&
|
||||
claim.getName().startsWith("@") &&
|
||||
ctx instanceof MainActivity) {
|
||||
((MainActivity) ctx).openChannelClaim(claim);
|
||||
}
|
||||
}
|
||||
});
|
||||
commentListAdapter.setReplyListener(new CommentListAdapter.ReplyClickListener() {
|
||||
@Override
|
||||
public void onReplyClicked(Comment comment) {
|
||||
setReplyToComment(comment);
|
||||
}
|
||||
});
|
||||
|
||||
RecyclerView relatedContentList = root.findViewById(R.id.channel_comments_list);
|
||||
relatedContentList.setAdapter(commentListAdapter);
|
||||
commentListAdapter.notifyDataSetChanged();
|
||||
|
||||
checkNoComments();
|
||||
resolveCommentPosters();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
// pass
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
private void resolveCommentPosters() {
|
||||
if (commentListAdapter != null) {
|
||||
List<String> urlsToResolve = new ArrayList<>(commentListAdapter.getClaimUrlsToResolve());
|
||||
if (urlsToResolve.size() > 0) {
|
||||
ResolveTask task = new ResolveTask(urlsToResolve, Lbry.SDK_CONNECTION_STRING, null, new ClaimListResultHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims) {
|
||||
if (commentListAdapter != null) {
|
||||
for (Claim claim : claims) {
|
||||
if (claim.getClaimId() != null) {
|
||||
commentListAdapter.updatePosterForComment(claim.getClaimId(), claim);
|
||||
}
|
||||
}
|
||||
commentListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
// pass
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
|
||||
if (walletBalance != null && inlineChannelCreatorInlineBalanceValue != null) {
|
||||
inlineChannelCreatorInlineBalanceValue.setText(Helper.shortCurrencyFormat(walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchChannels() {
|
||||
if (Lbry.ownChannels != null && Lbry.ownChannels.size() > 0) {
|
||||
updateChannelList(Lbry.ownChannels);
|
||||
return;
|
||||
}
|
||||
|
||||
fetchingChannels = true;
|
||||
disableChannelSpinner();
|
||||
ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, progressLoadingChannels, new ClaimListResultHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims) {
|
||||
Lbry.ownChannels = new ArrayList<>(claims);
|
||||
updateChannelList(Lbry.ownChannels);
|
||||
enableChannelSpinner();
|
||||
fetchingChannels = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
enableChannelSpinner();
|
||||
fetchingChannels = false;
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
private void disableChannelSpinner() {
|
||||
Helper.setViewEnabled(commentChannelSpinner, false);
|
||||
hideInlineChannelCreator();
|
||||
}
|
||||
private void enableChannelSpinner() {
|
||||
Helper.setViewEnabled(commentChannelSpinner, true);
|
||||
if (commentChannelSpinner != null) {
|
||||
Claim selectedClaim = (Claim) commentChannelSpinner.getSelectedItem();
|
||||
if (selectedClaim != null) {
|
||||
if (selectedClaim.isPlaceholder()) {
|
||||
showInlineChannelCreator();
|
||||
} else {
|
||||
hideInlineChannelCreator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void showInlineChannelCreator() {
|
||||
Helper.setViewVisibility(inlineChannelCreator, View.VISIBLE);
|
||||
}
|
||||
private void hideInlineChannelCreator() {
|
||||
Helper.setViewVisibility(inlineChannelCreator, View.GONE);
|
||||
}
|
||||
|
||||
private void updateChannelList(List<Claim> channels) {
|
||||
if (commentChannelSpinnerAdapter == null) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
commentChannelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, new ArrayList<>(channels));
|
||||
commentChannelSpinnerAdapter.addPlaceholder(false);
|
||||
commentChannelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
commentChannelSpinnerAdapter.clear();
|
||||
commentChannelSpinnerAdapter.addAll(channels);
|
||||
commentChannelSpinnerAdapter.addPlaceholder(false);
|
||||
commentChannelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
if (commentChannelSpinner != null) {
|
||||
commentChannelSpinner.setAdapter(commentChannelSpinnerAdapter);
|
||||
}
|
||||
|
||||
if (commentChannelSpinnerAdapter != null && commentChannelSpinner != null) {
|
||||
if (commentChannelSpinnerAdapter.getCount() > 1) {
|
||||
commentChannelSpinner.setSelection(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
clearReplyToComment();
|
||||
}
|
||||
});
|
||||
|
||||
buttonPostComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (!Lbry.SDK_READY) {
|
||||
Snackbar.make(root.findViewById(R.id.channel_comments_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
validateAndCheckPostComment(amount);
|
||||
}
|
||||
});
|
||||
|
||||
inputComment.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
int len = charSequence.length();
|
||||
textCommentLimit.setText(String.format("%d / %d", len, Comment.MAX_LENGTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
commentChannelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
|
||||
Object item = adapterView.getItemAtPosition(position);
|
||||
if (item instanceof Claim) {
|
||||
Claim claim = (Claim) item;
|
||||
if (claim.isPlaceholder()) {
|
||||
if (!fetchingChannels) {
|
||||
showInlineChannelCreator();
|
||||
}
|
||||
} else {
|
||||
hideInlineChannelCreator();
|
||||
updatePostAsChannel(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void validateAndCheckPostComment(double amount) {
|
||||
String comment = Helper.getValue(inputComment.getText());
|
||||
Claim channel = (Claim) commentChannelSpinner.getSelectedItem();
|
||||
|
||||
if (Helper.isNullOrEmpty(comment)) {
|
||||
showError(getString(R.string.please_enter_comment));
|
||||
return;
|
||||
}
|
||||
if (channel == null || Helper.isNullOrEmpty(channel.getClaimId())) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePostAsChannel(Claim channel) {
|
||||
boolean hasThumbnail = !Helper.isNullOrEmpty(channel.getThumbnailUrl());
|
||||
Helper.setViewVisibility(commentPostAsThumbnail, hasThumbnail ? View.VISIBLE : View.INVISIBLE);
|
||||
Helper.setViewVisibility(commentPostAsNoThumbnail, !hasThumbnail ? View.VISIBLE : View.INVISIBLE);
|
||||
Helper.setViewText(commentPostAsAlpha, channel.getName() != null ? channel.getName().substring(1, 2).toUpperCase() : null);
|
||||
|
||||
Context context = getContext();
|
||||
int bgColor = Helper.generateRandomColorForValue(channel.getClaimId());
|
||||
Helper.setIconViewBackgroundColor(commentPostAsNoThumbnail, bgColor, false, context);
|
||||
|
||||
if (hasThumbnail && context != null) {
|
||||
Glide.with(context.getApplicationContext()).
|
||||
asBitmap().
|
||||
load(channel.getThumbnailUrl()).
|
||||
apply(RequestOptions.circleCropTransform()).
|
||||
into(commentPostAsThumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
private void beforePostComment() {
|
||||
postingComment = true;
|
||||
Helper.setViewEnabled(commentChannelSpinner, false);
|
||||
Helper.setViewEnabled(inputComment, false);
|
||||
Helper.setViewEnabled(buttonClearReplyToComment, false);
|
||||
Helper.setViewEnabled(buttonPostComment, false);
|
||||
}
|
||||
|
||||
private void afterPostComment() {
|
||||
Helper.setViewEnabled(commentChannelSpinner, true);
|
||||
Helper.setViewEnabled(inputComment, true);
|
||||
Helper.setViewEnabled(buttonClearReplyToComment, true);
|
||||
Helper.setViewEnabled(buttonPostComment, true);
|
||||
postingComment = false;
|
||||
}
|
||||
|
||||
private Comment buildPostComment() {
|
||||
Comment comment = new Comment();
|
||||
Claim channel = (Claim) commentChannelSpinner.getSelectedItem();
|
||||
comment.setClaimId(claim.getClaimId());
|
||||
comment.setChannelId(channel.getClaimId());
|
||||
comment.setChannelName(channel.getName());
|
||||
comment.setText(Helper.getValue(inputComment.getText()));
|
||||
comment.setPoster(channel);
|
||||
if (replyToComment != null) {
|
||||
comment.setParentId(replyToComment.getId());
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
private void setReplyToComment(Comment comment) {
|
||||
replyToComment = comment;
|
||||
Helper.setViewText(textReplyingTo, getString(R.string.replying_to, comment.getChannelName()));
|
||||
Helper.setViewText(textReplyToBody, comment.getText());
|
||||
Helper.setViewVisibility(containerReplyToComment, View.VISIBLE);
|
||||
|
||||
inputComment.requestFocus();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(inputComment, InputMethodManager.SHOW_FORCED);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearReplyToComment() {
|
||||
Helper.setViewText(textReplyingTo, null);
|
||||
Helper.setViewText(textReplyToBody, null);
|
||||
Helper.setViewVisibility(containerReplyToComment, View.GONE);
|
||||
replyToComment = null;
|
||||
}
|
||||
|
||||
private void postComment(double tipAmount) {
|
||||
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() {
|
||||
@Override
|
||||
public void onSuccess(Comment createdComment) {
|
||||
inputComment.setText(null);
|
||||
clearReplyToComment();
|
||||
|
||||
if (commentListAdapter != null) {
|
||||
createdComment.setPoster(comment.getPoster());
|
||||
if (!Helper.isNullOrEmpty(createdComment.getParentId())) {
|
||||
commentListAdapter.addReply(createdComment);
|
||||
} else {
|
||||
commentListAdapter.insert(0, createdComment);
|
||||
}
|
||||
}
|
||||
afterPostComment();
|
||||
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);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(R.string.comment_posted);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
try {
|
||||
showError(error != null ? error.getMessage() : getString(R.string.comment_error));
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
afterPostComment();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showError(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNoComments() {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Helper.setViewVisibility(root.findViewById(R.id.channel_no_comments),
|
||||
commentListAdapter == null || commentListAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupInlineChannelCreator(
|
||||
View container,
|
||||
TextInputEditText inputChannelName,
|
||||
TextInputEditText inputDeposit,
|
||||
View inlineBalanceView,
|
||||
TextView inlineBalanceValue,
|
||||
View linkCancel,
|
||||
MaterialButton buttonCreate,
|
||||
View progressView,
|
||||
AppCompatSpinner channelSpinner,
|
||||
InlineChannelSpinnerAdapter channelSpinnerAdapter) {
|
||||
inputDeposit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
Helper.setViewVisibility(inlineBalanceView, hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
linkCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Helper.setViewText(inputChannelName, null);
|
||||
Helper.setViewText(inputDeposit, null);
|
||||
Helper.setViewVisibility(container, View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
buttonCreate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// validate deposit and channel name
|
||||
String channelNameString = Helper.normalizeChannelName(Helper.getValue(inputChannelName.getText()));
|
||||
Claim claimToSave = new Claim();
|
||||
claimToSave.setName(channelNameString);
|
||||
String channelName = claimToSave.getName().startsWith("@") ? claimToSave.getName().substring(1) : claimToSave.getName();
|
||||
String depositString = Helper.getValue(inputDeposit.getText());
|
||||
if ("@".equals(channelName) || Helper.isNullOrEmpty(channelName)) {
|
||||
showError(getString(R.string.please_enter_channel_name));
|
||||
return;
|
||||
}
|
||||
if (!LbryUri.isNameValid(channelName)) {
|
||||
showError(getString(R.string.channel_name_invalid_characters));
|
||||
return;
|
||||
}
|
||||
if (Helper.channelExists(channelName)) {
|
||||
showError(getString(R.string.channel_name_already_created));
|
||||
return;
|
||||
}
|
||||
|
||||
double depositAmount = 0;
|
||||
try {
|
||||
depositAmount = Double.valueOf(depositString);
|
||||
} catch (NumberFormatException ex) {
|
||||
// pass
|
||||
showError(getString(R.string.please_enter_valid_deposit));
|
||||
return;
|
||||
}
|
||||
if (depositAmount == 0) {
|
||||
String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT));
|
||||
showError(error);
|
||||
return;
|
||||
}
|
||||
if (Lbry.walletBalance == null || Lbry.walletBalance.getAvailable().doubleValue() < depositAmount) {
|
||||
showError(getString(R.string.deposit_more_than_balance));
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelCreateUpdateTask task = new ChannelCreateUpdateTask(
|
||||
claimToSave, new BigDecimal(depositString), false, progressView, new ClaimResultHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
Helper.setViewEnabled(inputChannelName, false);
|
||||
Helper.setViewEnabled(inputDeposit, false);
|
||||
Helper.setViewEnabled(buttonCreate, false);
|
||||
Helper.setViewEnabled(linkCancel, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Claim claimResult) {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
LogPublishTask logPublishTask = new LogPublishTask(claimResult);
|
||||
logPublishTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
// channel created
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("claim_id", claimResult.getClaimId());
|
||||
bundle.putString("claim_name", claimResult.getName());
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_CHANNEL_CREATE, bundle);
|
||||
|
||||
// add the claim to the channel list and set it as the selected item
|
||||
if (channelSpinnerAdapter != null) {
|
||||
channelSpinnerAdapter.add(claimResult);
|
||||
}
|
||||
if (channelSpinner != null && channelSpinnerAdapter != null) {
|
||||
channelSpinner.setSelection(channelSpinnerAdapter.getCount() - 1);
|
||||
}
|
||||
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
showError(error.getMessage());
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
Helper.setViewText(inlineBalanceValue, Helper.shortCurrencyFormat(Lbry.walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -64,7 +65,7 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
View root = inflater.inflate(R.layout.fragment_channel_content, container, false);
|
||||
|
||||
currentSortBy = ContentSortDialogFragment.ITEM_SORT_BY_TRENDING;
|
||||
currentSortBy = ContentSortDialogFragment.ITEM_SORT_BY_NEW;
|
||||
currentContentFrom = ContentFromDialogFragment.ITEM_FROM_PAST_WEEK;
|
||||
|
||||
sortLink = root.findViewById(R.id.channel_content_sort_link);
|
||||
@@ -219,10 +220,10 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
|
||||
}
|
||||
|
||||
return Lbry.buildClaimSearchOptions(
|
||||
null,
|
||||
(List) null,
|
||||
null,
|
||||
canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),
|
||||
Arrays.asList(channelId),
|
||||
!Helper.isNullOrEmpty(channelId) ? Arrays.asList(channelId) : null,
|
||||
null,
|
||||
getContentSortOrder(),
|
||||
contentReleaseTime,
|
||||
@@ -232,7 +233,7 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
|
||||
|
||||
private List<String> getContentSortOrder() {
|
||||
if (contentSortOrder == null) {
|
||||
return Arrays.asList(Claim.ORDER_BY_RELEASE_TIME);
|
||||
return Collections.singletonList(Claim.ORDER_BY_RELEASE_TIME);
|
||||
}
|
||||
return contentSortOrder;
|
||||
}
|
||||
@@ -258,22 +259,25 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
|
||||
if (contentListAdapter == null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, getContext());
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, context);
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
contentListAdapter.addItems(claims);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,6 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
Context context = getContext();
|
||||
FlexboxLayoutManager flm1 = new FlexboxLayoutManager(context);
|
||||
FlexboxLayoutManager flm2 = new FlexboxLayoutManager(context);
|
||||
FlexboxLayoutManager flm3 = new FlexboxLayoutManager(context);
|
||||
addedTagsList = root.findViewById(R.id.form_added_tags);
|
||||
addedTagsList.setLayoutManager(flm1);
|
||||
suggestedTagsList = root.findViewById(R.id.form_suggested_tags);
|
||||
@@ -211,7 +210,7 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (uploading) {
|
||||
Snackbar.make(getView(), R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(view, R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,6 +221,11 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
buttonSave.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (uploading) {
|
||||
Snackbar.make(view, R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
Claim claimToSave = buildChannelClaimToSave();
|
||||
validateAndSaveClaim(claimToSave);
|
||||
}
|
||||
@@ -249,7 +253,13 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
|
||||
private void checkParams() {
|
||||
Map<String, Object> params = getParams();
|
||||
if (params.containsKey("claim")) {
|
||||
if (params == null) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).onBackPressed();
|
||||
return;
|
||||
}
|
||||
} else if (params.containsKey("claim")) {
|
||||
Claim claim = (Claim) params.get("claim");
|
||||
if (claim != null && !claim.equals(this.currentClaim)) {
|
||||
this.currentClaim = claim;
|
||||
@@ -315,7 +325,7 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
showError(getString(R.string.please_enter_valid_deposit));
|
||||
return;
|
||||
}
|
||||
if (depositAmount == 0) {
|
||||
if (depositAmount < Helper.MIN_DEPOSIT) {
|
||||
String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT));
|
||||
showError(error);
|
||||
return;
|
||||
@@ -366,13 +376,6 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkPermissionsAndLaunchFilePicker(boolean isCover) {
|
||||
Context context = getContext();
|
||||
if (MainActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, context)) {
|
||||
@@ -697,7 +700,7 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
if (ctx != null) {
|
||||
String rewardsDriverText = String.format("%s\n%s",
|
||||
getString(R.string.channel_creation_requires_credits), getString(R.string.tap_here_to_get_some));
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, Helper.MIN_DEPOSIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -36,7 +35,7 @@ import java.util.Map;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.dialog.SendTipDialogFragment;
|
||||
import io.lbry.browser.dialog.CreateSupportDialogFragment;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.listener.FetchChannelsListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
@@ -50,6 +49,7 @@ import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||
import io.lbry.browser.tasks.lbryinc.FetchStatCountTask;
|
||||
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.findcontent.FollowingFragment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
@@ -81,7 +81,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
private View buttonTip;
|
||||
private View buttonFollowUnfollow;
|
||||
private int subCount;
|
||||
private SolidIconView iconFollowUnfollow;
|
||||
private OutlineIconView iconFollow;
|
||||
private SolidIconView iconUnfollow;
|
||||
private View layoutNothingAtLocation;
|
||||
private View layoutLoadingState;
|
||||
|
||||
@@ -106,7 +107,8 @@ 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);
|
||||
iconFollowUnfollow = root.findViewById(R.id.channel_view_icon_follow_unfollow);
|
||||
iconFollow = root.findViewById(R.id.channel_view_icon_follow);
|
||||
iconUnfollow = root.findViewById(R.id.channel_view_icon_unfollow);
|
||||
|
||||
tabPager = root.findViewById(R.id.channel_view_pager);
|
||||
tabLayout = root.findViewById(R.id.channel_view_tabs);
|
||||
@@ -174,21 +176,24 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
SendTipDialogFragment dialog = SendTipDialogFragment.newInstance();
|
||||
CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance();
|
||||
dialog.setClaim(claim);
|
||||
dialog.setListener(new SendTipDialogFragment.SendTipListener() {
|
||||
dialog.setListener(new CreateSupportDialogFragment.CreateSupportListener() {
|
||||
@Override
|
||||
public void onTipSent(BigDecimal amount) {
|
||||
public void onSupportCreated(BigDecimal amount, boolean isTip) {
|
||||
double sentAmount = amount.doubleValue();
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.you_sent_a_tip, sentAmount == 1.0 ? 1 : 2,
|
||||
new DecimalFormat("#,###.##").format(sentAmount));
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
String message = getResources().getQuantityString(
|
||||
isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2,
|
||||
new DecimalFormat("#,###.##").format(sentAmount));
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
dialog.show(((MainActivity) context).getSupportFragmentManager(), SendTipDialogFragment.TAG);
|
||||
dialog.show(((MainActivity) context).getSupportFragmentManager(), CreateSupportDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +263,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
} else {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Snackbar.make(root, R.string.channel_failed_delete, Toast.LENGTH_LONG).
|
||||
Snackbar.make(root, R.string.channel_failed_delete, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
@@ -272,13 +277,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
private void checkIsFollowing() {
|
||||
if (claim != null) {
|
||||
boolean isFollowing = Lbryio.isFollowing(claim);
|
||||
if (iconFollowUnfollow != null) {
|
||||
iconFollowUnfollow.setText(isFollowing ? R.string.fa_heart_broken : R.string.fa_heart);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
iconFollowUnfollow.setTextColor(ContextCompat.getColor(context, isFollowing ? R.color.foreground : R.color.red));
|
||||
}
|
||||
}
|
||||
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,19 +322,21 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
boolean updateRequired = false;
|
||||
Map<String, Object> params = getParams();
|
||||
|
||||
if (params.containsKey("claim")) {
|
||||
Claim claim = (Claim) params.get("claim");
|
||||
if (claim != null && !claim.equals(this.claim)) {
|
||||
this.claim = claim;
|
||||
updateRequired = true;
|
||||
if (params != null) {
|
||||
if (params.containsKey("claim")) {
|
||||
Claim claim = (Claim) params.get("claim");
|
||||
if (claim != null && !claim.equals(this.claim)) {
|
||||
this.claim = claim;
|
||||
updateRequired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (params.containsKey("url")) {
|
||||
String newUrl = params.get("url").toString();
|
||||
if (claim == null || !newUrl.equalsIgnoreCase(url)) {
|
||||
this.claim = null;
|
||||
this.url = newUrl;
|
||||
updateRequired = true;
|
||||
if (params.containsKey("url")) {
|
||||
String newUrl = params.get("url").toString();
|
||||
if (claim == null || !newUrl.equalsIgnoreCase(url)) {
|
||||
this.claim = null;
|
||||
this.url = newUrl;
|
||||
updateRequired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,16 +443,20 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
if (tabPager.getAdapter() == null && context instanceof MainActivity) {
|
||||
tabPager.setAdapter(new ChannelPagerAdapter(claim, (MainActivity) context));
|
||||
}
|
||||
new TabLayoutMediator(tabLayout, tabPager, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||
@Override
|
||||
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||
switch (position) {
|
||||
case 0: tab.setText(R.string.content); break;
|
||||
case 1: tab.setText(R.string.about); break;
|
||||
case 2: tab.setText(R.string.comments); break;
|
||||
}
|
||||
}
|
||||
}).attach();
|
||||
} catch (IllegalStateException ex) {
|
||||
// TODO: Fix why this is happening
|
||||
// pass
|
||||
}
|
||||
new TabLayoutMediator(tabLayout, tabPager, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||
@Override
|
||||
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||
tab.setText(position == 0 ? R.string.content : R.string.about);
|
||||
}
|
||||
}).attach();
|
||||
}
|
||||
|
||||
private void resetSubCount() {
|
||||
@@ -514,6 +520,13 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
// pass
|
||||
}
|
||||
return aboutFragment;
|
||||
|
||||
case 2:
|
||||
ChannelCommentsFragment commentsFragment = ChannelCommentsFragment.class.newInstance();
|
||||
if (channelClaim != null) {
|
||||
commentsFragment.setClaim(channelClaim);
|
||||
}
|
||||
return commentsFragment;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -525,7 +538,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,21 +149,23 @@ public class ChannelManagerFragment extends BaseFragment implements ActionMode.C
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims) {
|
||||
Lbry.ownChannels = Helper.filterDeletedClaims(new ArrayList<>(claims));
|
||||
Context context = getContext();
|
||||
if (adapter == null) {
|
||||
adapter = new ClaimListAdapter(claims, context);
|
||||
adapter.setCanEnterSelectionMode(true);
|
||||
adapter.setSelectionModeListener(ChannelManagerFragment.this);
|
||||
adapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openChannelClaim(claim);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
adapter = new ClaimListAdapter(claims, context);
|
||||
adapter.setCanEnterSelectionMode(true);
|
||||
adapter.setSelectionModeListener(ChannelManagerFragment.this);
|
||||
adapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openChannelClaim(claim);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (channelList != null) {
|
||||
channelList.setAdapter(adapter);
|
||||
}
|
||||
});
|
||||
if (channelList != null) {
|
||||
channelList.setAdapter(adapter);
|
||||
}
|
||||
} else {
|
||||
adapter.setItems(claims);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package io.lbry.browser.ui.controls;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
public class OutlineIconView extends AppCompatTextView {
|
||||
private Context context;
|
||||
|
||||
public OutlineIconView(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
init();
|
||||
}
|
||||
|
||||
public OutlineIconView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setGravity(Gravity.CENTER);
|
||||
setTypeface(Typeface.createFromAsset(context.getAssets(), "font_awesome_5_free_regular.otf"));
|
||||
}
|
||||
}
|
||||
@@ -407,7 +407,7 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
|
||||
}
|
||||
|
||||
return Lbry.buildClaimSearchOptions(
|
||||
null,
|
||||
(List) null,
|
||||
(currentContentScope == ContentScopeDialogFragment.ITEM_EVERYONE) ? null : tags,
|
||||
canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),
|
||||
null,
|
||||
@@ -446,22 +446,25 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
|
||||
if (contentListAdapter == null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, getContext());
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, context);
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
contentListAdapter.addItems(claims);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -248,6 +248,8 @@ public class FollowingFragment extends BaseFragment implements
|
||||
discoverLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
Helper.setViewEnabled(discoverLink, false);
|
||||
buildChannelIdsAndUrls();
|
||||
currentSuggestedPage = 1;
|
||||
discoverDialog = DiscoverDialogFragment.newInstance();
|
||||
@@ -268,6 +270,7 @@ public class FollowingFragment extends BaseFragment implements
|
||||
if (suggestedChannelAdapter != null) {
|
||||
suggestedChannelAdapter.clearItems();
|
||||
}
|
||||
Helper.setViewEnabled(discoverLink, true);
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
@@ -424,7 +427,7 @@ public class FollowingFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
return Lbry.buildClaimSearchOptions(
|
||||
Claim.TYPE_STREAM,
|
||||
Arrays.asList(Claim.TYPE_STREAM, Claim.TYPE_REPOST),
|
||||
null,
|
||||
canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),
|
||||
getChannelIds(),
|
||||
@@ -438,7 +441,7 @@ public class FollowingFragment extends BaseFragment implements
|
||||
private List<String> getChannelIds() {
|
||||
if (channelFilterListAdapter != null) {
|
||||
Claim selected = channelFilterListAdapter.getSelectedItem();
|
||||
if (selected != null) {
|
||||
if (selected != null && !Helper.isNullOrEmpty(selected.getClaimId())) {
|
||||
return Arrays.asList(selected.getClaimId());
|
||||
}
|
||||
}
|
||||
@@ -487,6 +490,11 @@ public class FollowingFragment extends BaseFragment implements
|
||||
String url = subscription.getUrl();
|
||||
LbryUri uri = LbryUri.parse(url);
|
||||
String claimId = uri.getClaimId();
|
||||
if (Helper.isNullOrEmpty(claimId) || Helper.isNullOrEmpty(url)) {
|
||||
// don't add null / empty claim IDs or URLs
|
||||
continue;
|
||||
}
|
||||
|
||||
channelIds.add(claimId);
|
||||
channelUrls.add(url);
|
||||
} catch (LbryUriException ex) {
|
||||
@@ -524,8 +532,9 @@ public class FollowingFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
private void updateChannelFilterListAdapter(List<Claim> resolvedSubs, boolean reset) {
|
||||
if (channelFilterListAdapter == null) {
|
||||
channelFilterListAdapter = new ChannelFilterListAdapter(getContext());
|
||||
Context context = getContext();
|
||||
if (channelFilterListAdapter == null && context != null) {
|
||||
channelFilterListAdapter = new ChannelFilterListAdapter(context);
|
||||
channelFilterListAdapter.setListener(new ChannelItemSelectionListener() {
|
||||
@Override
|
||||
public void onChannelItemSelected(Claim claim) {
|
||||
@@ -560,14 +569,16 @@ public class FollowingFragment extends BaseFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
if (horizontalChannelList != null && horizontalChannelList.getAdapter() == null) {
|
||||
horizontalChannelList.setAdapter(channelFilterListAdapter);
|
||||
if (channelFilterListAdapter != null) {
|
||||
if (horizontalChannelList != null && horizontalChannelList.getAdapter() == null) {
|
||||
horizontalChannelList.setAdapter(channelFilterListAdapter);
|
||||
}
|
||||
if (reset) {
|
||||
channelFilterListAdapter.clearClaims();
|
||||
channelFilterListAdapter.setSelectedItem(null);
|
||||
}
|
||||
channelFilterListAdapter.addClaims(resolvedSubs);
|
||||
}
|
||||
if (reset) {
|
||||
channelFilterListAdapter.clearClaims();
|
||||
channelFilterListAdapter.setSelectedItem(null);
|
||||
}
|
||||
channelFilterListAdapter.addClaims(resolvedSubs);
|
||||
}
|
||||
|
||||
private void fetchClaimSearchContent() {
|
||||
@@ -587,22 +598,25 @@ public class FollowingFragment extends BaseFragment implements
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
|
||||
if (contentListAdapter == null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, getContext());
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, context);
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
contentListAdapter.addItems(claims);
|
||||
}
|
||||
@@ -626,11 +640,12 @@ public class FollowingFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
private void updateSuggestedDoneButtonText() {
|
||||
int selected = suggestedChannelAdapter == null ? 0 : suggestedChannelAdapter.getSelectedCount();
|
||||
int remaining = MIN_SUGGESTED_SUBSCRIBE_COUNT - selected;
|
||||
String buttonText = remaining <= 0 ? getString(R.string.done) : getString(R.string.n_remaining, remaining);
|
||||
if (suggestedDoneButton != null) {
|
||||
suggestedDoneButton.setText(buttonText);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
int selected = suggestedChannelAdapter == null ? 0 : suggestedChannelAdapter.getSelectedCount();
|
||||
int remaining = MIN_SUGGESTED_SUBSCRIBE_COUNT - selected;
|
||||
String buttonText = remaining <= 0 ? getString(R.string.done) : getString(R.string.n_remaining, remaining);
|
||||
Helper.setViewText(suggestedDoneButton, buttonText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ public class SearchFragment extends BaseFragment implements
|
||||
}
|
||||
if (resolved.isMature() && !canShowMatureContent) {
|
||||
resultListAdapter.removeFeaturedItem();
|
||||
} else {
|
||||
} else if (unresolved != null) {
|
||||
// only set the values we need
|
||||
unresolved.setClaimId(resolved.getClaimId());
|
||||
unresolved.setName(resolved.getName());
|
||||
@@ -201,6 +201,7 @@ public class SearchFragment extends BaseFragment implements
|
||||
unresolved.setPermanentUrl(resolved.getPermanentUrl());
|
||||
unresolved.setValue(resolved.getValue());
|
||||
unresolved.setSigningChannel(resolved.getSigningChannel());
|
||||
unresolved.setRepostedClaim(resolved.getRepostedClaim());
|
||||
unresolved.setUnresolved(false);
|
||||
unresolved.setConfirmations(resolved.getConfirmations());
|
||||
}
|
||||
@@ -239,31 +240,36 @@ public class SearchFragment extends BaseFragment implements
|
||||
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
|
||||
contentHasReachedEnd = hasReachedEnd;
|
||||
searchLoading = false;
|
||||
|
||||
if (resultListAdapter == null) {
|
||||
resultListAdapter = new ClaimListAdapter(claims, getContext());
|
||||
resultListAdapter.addFeaturedItem(buildFeaturedItem(query));
|
||||
resolveFeaturedItem(buildVanityUrl(query));
|
||||
resultListAdapter.setListener(SearchFragment.this);
|
||||
if (resultList != null) {
|
||||
resultList.setAdapter(resultListAdapter);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
if (resultListAdapter == null) {
|
||||
resultListAdapter = new ClaimListAdapter(claims, context);
|
||||
resultListAdapter.addFeaturedItem(buildFeaturedItem(query));
|
||||
resolveFeaturedItem(buildVanityUrl(query));
|
||||
resultListAdapter.setListener(SearchFragment.this);
|
||||
if (resultList != null) {
|
||||
resultList.setAdapter(resultListAdapter);
|
||||
}
|
||||
} else {
|
||||
resultListAdapter.addItems(claims);
|
||||
}
|
||||
} else {
|
||||
resultListAdapter.addItems(claims);
|
||||
}
|
||||
|
||||
int itemCount = resultListAdapter.getItemCount();
|
||||
noQueryView.setVisibility(View.GONE);
|
||||
noResultsView.setVisibility(itemCount == 0 ? View.VISIBLE : View.GONE);
|
||||
noResultsView.setText(getString(R.string.search_no_results, currentQuery));
|
||||
int itemCount = resultListAdapter.getItemCount();
|
||||
Helper.setViewVisibility(noQueryView, View.GONE);
|
||||
Helper.setViewVisibility(noResultsView, itemCount == 0 ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewText(noResultsView, getString(R.string.search_no_results, currentQuery));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Context context = getContext();
|
||||
int itemCount = resultListAdapter == null ? 0 : resultListAdapter.getItemCount();
|
||||
noQueryView.setVisibility(View.GONE);
|
||||
noResultsView.setVisibility(itemCount == 0 ? View.VISIBLE : View.GONE);
|
||||
noResultsView.setText(getString(R.string.search_no_results, currentQuery));
|
||||
Helper.setViewVisibility(noQueryView, View.GONE);
|
||||
Helper.setViewVisibility(noResultsView, itemCount == 0 ? View.VISIBLE : View.GONE);
|
||||
if (context != null) {
|
||||
Helper.setViewText(noResultsView, getString(R.string.search_no_results, currentQuery));
|
||||
}
|
||||
searchLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -213,6 +213,7 @@ public class LibraryFragment extends BaseFragment implements
|
||||
super.onResume();
|
||||
|
||||
Context context = getContext();
|
||||
Helper.setWunderbarValue(null, context);
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
LbryAnalytics.setCurrentScreen(activity, "Library", "Library");
|
||||
@@ -267,6 +268,7 @@ public class LibraryFragment extends BaseFragment implements
|
||||
checkStatsLink();
|
||||
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
|
||||
currentPage = 1;
|
||||
currentFiles = new ArrayList<>();
|
||||
if (Lbry.SDK_READY) {
|
||||
if (!initialOwnClaimsFetched) {
|
||||
fetchOwnClaimsAndShowDownloads();
|
||||
@@ -312,7 +314,7 @@ public class LibraryFragment extends BaseFragment implements
|
||||
if (contentListAdapter != null) {
|
||||
contentListAdapter.setHideFee(true);
|
||||
contentListAdapter.clearItems();
|
||||
contentListAdapter.setCanEnterSelectionMode(true);
|
||||
contentListAdapter.setCanEnterSelectionMode(false);
|
||||
}
|
||||
listReachedEnd = false;
|
||||
|
||||
@@ -350,24 +352,27 @@ public class LibraryFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
private void initContentListAdapter(List<Claim> claims) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, getContext());
|
||||
contentListAdapter.setCanEnterSelectionMode(true);
|
||||
contentListAdapter.setSelectionModeListener(this);
|
||||
contentListAdapter.setHideFee(currentFilter != FILTER_PURCHASES);
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) getContext();
|
||||
if (claim.getName().startsWith("@")) {
|
||||
activity.openChannelUrl(claim.getPermanentUrl());
|
||||
} else {
|
||||
activity.openFileUrl(claim.getPermanentUrl());
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
contentListAdapter = new ClaimListAdapter(claims, context);
|
||||
contentListAdapter.setCanEnterSelectionMode(currentFilter == FILTER_DOWNLOADS);
|
||||
contentListAdapter.setSelectionModeListener(this);
|
||||
contentListAdapter.setHideFee(currentFilter != FILTER_PURCHASES);
|
||||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
activity.openChannelUrl(claim.getPermanentUrl());
|
||||
} else {
|
||||
activity.openFileUrl(claim.getPermanentUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchDownloads() {
|
||||
@@ -380,7 +385,6 @@ public class LibraryFragment extends BaseFragment implements
|
||||
listReachedEnd = hasReachedEnd;
|
||||
List<LbryFile> filteredFiles = Helper.filterDownloads(files);
|
||||
List<Claim> claims = Helper.claimsFromFiles(filteredFiles);
|
||||
|
||||
addFiles(filteredFiles);
|
||||
updateStats();
|
||||
checkStatsLink();
|
||||
@@ -390,7 +394,7 @@ public class LibraryFragment extends BaseFragment implements
|
||||
} else {
|
||||
contentListAdapter.addItems(claims);
|
||||
}
|
||||
if (contentList.getAdapter() == null) {
|
||||
if (contentListAdapter != null && contentList.getAdapter() == null) {
|
||||
contentList.setAdapter(contentListAdapter);
|
||||
}
|
||||
resolveMissingChannelNames(buildUrlsToResolve(claims));
|
||||
@@ -422,7 +426,7 @@ public class LibraryFragment extends BaseFragment implements
|
||||
} else {
|
||||
contentListAdapter.addItems(claims);
|
||||
}
|
||||
if (contentList.getAdapter() == null) {
|
||||
if (contentListAdapter != null && contentList.getAdapter() == null) {
|
||||
contentList.setAdapter(contentListAdapter);
|
||||
}
|
||||
checkListEmpty();
|
||||
@@ -458,7 +462,7 @@ public class LibraryFragment extends BaseFragment implements
|
||||
} else {
|
||||
contentListAdapter.addItems(claims);
|
||||
}
|
||||
if (contentList.getAdapter() == null) {
|
||||
if (contentListAdapter != null && contentList.getAdapter() == null) {
|
||||
contentList.setAdapter(contentListAdapter);
|
||||
}
|
||||
checkListEmpty();
|
||||
@@ -636,18 +640,21 @@ public class LibraryFragment extends BaseFragment implements
|
||||
public boolean onActionItemClicked(androidx.appcompat.view.ActionMode actionMode, MenuItem menuItem) {
|
||||
if (R.id.action_delete == menuItem.getItemId()) {
|
||||
if (contentListAdapter != null && contentListAdapter.getSelectedCount() > 0) {
|
||||
final List<Claim> selectedClaims = new ArrayList<>(contentListAdapter.getSelectedItems());
|
||||
String message = getResources().getQuantityString(R.plurals.confirm_delete_files, selectedClaims.size());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
||||
setTitle(R.string.delete_selection).
|
||||
setMessage(message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
handleDeleteSelectedClaims(selectedClaims);
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
final List<Claim> selectedClaims = new ArrayList<>(contentListAdapter.getSelectedItems());
|
||||
String message = getResources().getQuantityString(R.plurals.confirm_delete_files, selectedClaims.size());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||
setTitle(R.string.delete_selection).
|
||||
setMessage(message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
handleDeleteSelectedClaims(selectedClaims);
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
private static final int MAX_VIDEO_DIMENSION = 1920;
|
||||
private static final int MAX_BITRATE = 5000000; // 5mbps
|
||||
|
||||
private boolean storageRefusedOnce;
|
||||
private static final int SUGGESTED_LIMIT = 8;
|
||||
|
||||
private boolean editMode;
|
||||
@@ -428,10 +429,10 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (uploading) {
|
||||
Snackbar.make(view, R.string.publish_no_thumbnail, Snackbar.LENGTH_LONG).show();
|
||||
Snackbar.make(view, R.string.publish_thumbnail_in_progress, Snackbar.LENGTH_LONG).show();
|
||||
return;
|
||||
} else if (Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
|
||||
showError(getString(R.string.publish_thumbnail_in_progress));
|
||||
showError(getString(R.string.publish_no_thumbnail));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -474,6 +475,8 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
}
|
||||
});
|
||||
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(getContext(), R.layout.spinner_item_channel, new ArrayList<>());
|
||||
channelSpinnerAdapter.addPlaceholder(false);
|
||||
setupInlineChannelCreator(
|
||||
inlineChannelCreator,
|
||||
inlineChannelCreatorInputName,
|
||||
@@ -482,7 +485,9 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
inlineChannelCreatorInlineBalanceValue,
|
||||
inlineChannelCreatorCancelLink,
|
||||
inlineChannelCreatorCreateButton,
|
||||
inlineChannelCreatorProgress
|
||||
inlineChannelCreatorProgress,
|
||||
channelSpinner,
|
||||
channelSpinnerAdapter
|
||||
);
|
||||
}
|
||||
|
||||
@@ -580,58 +585,63 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
private void updateFieldsFromCurrentClaim() {
|
||||
if (currentClaim != null && !editFieldsLoaded) {
|
||||
Context context = getContext();
|
||||
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||
uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
|
||||
if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
|
||||
Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail);
|
||||
}
|
||||
|
||||
inputTitle.setText(currentClaim.getTitle());
|
||||
inputDescription.setText(currentClaim.getDescription());
|
||||
if (addedTagsAdapter != null && currentClaim.getTagObjects() != null) {
|
||||
addedTagsAdapter.addTags(currentClaim.getTagObjects());
|
||||
updateSuggestedTags(currentFilter, SUGGESTED_LIMIT, true);
|
||||
}
|
||||
|
||||
if (metadata.getFee() != null) {
|
||||
Fee fee = metadata.getFee();
|
||||
switchPrice.setChecked(true);
|
||||
inputPrice.setText(fee.getAmount());
|
||||
priceCurrencySpinner.setSelection("lbc".equalsIgnoreCase(fee.getCurrency()) ? 0 : 1);
|
||||
}
|
||||
|
||||
inputAddress.setText(currentClaim.getName());
|
||||
inputDeposit.setText(currentClaim.getAmount());
|
||||
|
||||
if (metadata.getLanguages() != null && metadata.getLanguages().size() > 0) {
|
||||
// get the first language
|
||||
String langCode = metadata.getLanguages().get(0);
|
||||
int langCodePosition = ((LanguageSpinnerAdapter) languageSpinner.getAdapter()).getItemPosition(langCode);
|
||||
if (langCodePosition > -1) {
|
||||
languageSpinner.setSelection(langCodePosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(metadata.getLicense())) {
|
||||
LicenseSpinnerAdapter adapter = (LicenseSpinnerAdapter) licenseSpinner.getAdapter();
|
||||
int licPosition = adapter.getItemPosition(metadata.getLicense());
|
||||
if (licPosition == -1) {
|
||||
licPosition = adapter.getItemPosition(Predefined.LICENSE_OTHER);
|
||||
}
|
||||
if (licPosition > -1) {
|
||||
licenseSpinner.setSelection(licPosition);
|
||||
try {
|
||||
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||
uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
|
||||
if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
|
||||
Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail);
|
||||
}
|
||||
|
||||
License selectedLicense = (License) licenseSpinner.getSelectedItem();
|
||||
boolean otherLicense = Arrays.asList(
|
||||
Predefined.LICENSE_COPYRIGHTED.toLowerCase(),
|
||||
Predefined.LICENSE_OTHER.toLowerCase()).contains(selectedLicense.getName().toLowerCase());
|
||||
inputOtherLicenseDescription.setText(otherLicense ? metadata.getLicense() : null);
|
||||
}
|
||||
inputTitle.setText(currentClaim.getTitle());
|
||||
inputDescription.setText(currentClaim.getDescription());
|
||||
if (addedTagsAdapter != null && currentClaim.getTagObjects() != null) {
|
||||
addedTagsAdapter.addTags(currentClaim.getTagObjects());
|
||||
updateSuggestedTags(currentFilter, SUGGESTED_LIMIT, true);
|
||||
}
|
||||
|
||||
inputAddress.setEnabled(false);
|
||||
editMode = true;
|
||||
editFieldsLoaded = true;
|
||||
if (metadata.getFee() != null) {
|
||||
Fee fee = metadata.getFee();
|
||||
switchPrice.setChecked(true);
|
||||
inputPrice.setText(fee.getAmount());
|
||||
priceCurrencySpinner.setSelection("lbc".equalsIgnoreCase(fee.getCurrency()) ? 0 : 1);
|
||||
}
|
||||
|
||||
inputAddress.setText(currentClaim.getName());
|
||||
inputDeposit.setText(currentClaim.getAmount());
|
||||
|
||||
if (metadata.getLanguages() != null && metadata.getLanguages().size() > 0) {
|
||||
// get the first language
|
||||
String langCode = metadata.getLanguages().get(0);
|
||||
int langCodePosition = ((LanguageSpinnerAdapter) languageSpinner.getAdapter()).getItemPosition(langCode);
|
||||
if (langCodePosition > -1) {
|
||||
languageSpinner.setSelection(langCodePosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(metadata.getLicense())) {
|
||||
LicenseSpinnerAdapter adapter = (LicenseSpinnerAdapter) licenseSpinner.getAdapter();
|
||||
int licPosition = adapter.getItemPosition(metadata.getLicense());
|
||||
if (licPosition == -1) {
|
||||
licPosition = adapter.getItemPosition(Predefined.LICENSE_OTHER);
|
||||
}
|
||||
if (licPosition > -1) {
|
||||
licenseSpinner.setSelection(licPosition);
|
||||
}
|
||||
|
||||
License selectedLicense = (License) licenseSpinner.getSelectedItem();
|
||||
boolean otherLicense = Arrays.asList(
|
||||
Predefined.LICENSE_COPYRIGHTED.toLowerCase(),
|
||||
Predefined.LICENSE_OTHER.toLowerCase()).contains(selectedLicense.getName().toLowerCase());
|
||||
inputOtherLicenseDescription.setText(otherLicense ? metadata.getLicense() : null);
|
||||
}
|
||||
|
||||
inputAddress.setEnabled(false);
|
||||
editMode = true;
|
||||
editFieldsLoaded = true;
|
||||
} catch (ClassCastException ex) {
|
||||
// invalid claim value type
|
||||
cancelOnFatalCondition(getString(R.string.publish_invalid_claim_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,7 +728,10 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
|
||||
private void uploadThumbnail(String thumbnailPath) {
|
||||
if (uploading) {
|
||||
Snackbar.make(getView(), R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -781,73 +794,75 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
Context context = getContext();
|
||||
String outputPath = String.format("%s/videos", Utils.getAppInternalStorageDir(context));
|
||||
File dir = new File(outputPath);
|
||||
if (!dir.isDirectory()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
if (context != null) {
|
||||
String outputPath = String.format("%s/videos", Utils.getAppInternalStorageDir(context));
|
||||
File dir = new File(outputPath);
|
||||
if (!dir.isDirectory()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
boolean hasFullDuration = videoInformation != null && videoInformation.getDurationSeconds() > 0;
|
||||
Helper.setViewVisibility(optimizationRealProgress, hasFullDuration ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(optimizationProgress, hasFullDuration ? View.GONE : View.VISIBLE);
|
||||
boolean hasFullDuration = videoInformation != null && videoInformation.getDurationSeconds() > 0;
|
||||
Helper.setViewVisibility(optimizationRealProgress, hasFullDuration ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(optimizationProgress, hasFullDuration ? View.GONE : View.VISIBLE);
|
||||
|
||||
File sourceFile = new File(filePath);
|
||||
String filename = sourceFile.getName();
|
||||
if (!filename.endsWith(".mp4")) {
|
||||
int lastDotIndex = filename.lastIndexOf('.');
|
||||
filename = String.format("%s.mp4", lastDotIndex > -1 ? filename.substring(0, lastDotIndex) : filename);
|
||||
}
|
||||
File sourceFile = new File(filePath);
|
||||
String filename = sourceFile.getName();
|
||||
if (!filename.endsWith(".mp4")) {
|
||||
int lastDotIndex = filename.lastIndexOf('.');
|
||||
filename = String.format("%s.mp4", lastDotIndex > -1 ? filename.substring(0, lastDotIndex) : filename);
|
||||
}
|
||||
|
||||
String videoFilePath = String.format("%s/%s", outputPath, filename);
|
||||
File targetFile = new File(videoFilePath);
|
||||
if (targetFile.exists()) {
|
||||
targetFile.delete();
|
||||
}
|
||||
String videoFilePath = String.format("%s/%s", outputPath, filename);
|
||||
File targetFile = new File(videoFilePath);
|
||||
if (targetFile.exists()) {
|
||||
targetFile.delete();
|
||||
}
|
||||
|
||||
transcodeInProgress = true;
|
||||
videoTranscodeTask = new VideoTranscodeTask(filePath, videoFilePath, scalePart, transcodeRequired, new VideoTranscodeTask.VideoTranscodeHandler() {
|
||||
@Override
|
||||
public void onProgress(int time) {
|
||||
if (context != null) {
|
||||
int currentDuration = Double.valueOf(time / 1000.0).intValue();
|
||||
int fullDuration = videoInformation != null ? videoInformation.getDurationSeconds() : 0;
|
||||
long elapsed = System.currentTimeMillis() - transcodeStartTime;
|
||||
String completedDurationText = Helper.formatDuration(currentDuration);
|
||||
if (fullDuration > 0) {
|
||||
completedDurationText = String.format("%s / %s", completedDurationText, Helper.formatDuration(fullDuration));
|
||||
int percentComplete = Double.valueOf(Math.ceil((double) currentDuration / (double) fullDuration * 100.0)).intValue();
|
||||
optimizationRealProgress.setProgress(percentComplete);
|
||||
transcodeInProgress = true;
|
||||
videoTranscodeTask = new VideoTranscodeTask(filePath, videoFilePath, scalePart, transcodeRequired, new VideoTranscodeTask.VideoTranscodeHandler() {
|
||||
@Override
|
||||
public void onProgress(int time) {
|
||||
if (context != null) {
|
||||
int currentDuration = Double.valueOf(time / 1000.0).intValue();
|
||||
int fullDuration = videoInformation != null ? videoInformation.getDurationSeconds() : 0;
|
||||
long elapsed = System.currentTimeMillis() - transcodeStartTime;
|
||||
String completedDurationText = Helper.formatDuration(currentDuration);
|
||||
if (fullDuration > 0) {
|
||||
completedDurationText = String.format("%s / %s", completedDurationText, Helper.formatDuration(fullDuration));
|
||||
int percentComplete = Double.valueOf(Math.ceil((double) currentDuration / (double) fullDuration * 100.0)).intValue();
|
||||
optimizationRealProgress.setProgress(percentComplete);
|
||||
}
|
||||
|
||||
|
||||
String text = context.getString(R.string.completed_video_duration, completedDurationText);
|
||||
Helper.setViewText(textOptimizationProgress, text);
|
||||
Helper.setViewText(textOptimizationElapsed, Helper.formatDuration(Double.valueOf(elapsed / 1000.0).longValue()));
|
||||
}
|
||||
|
||||
|
||||
String text = context.getString(R.string.completed_video_duration, completedDurationText);
|
||||
Helper.setViewText(textOptimizationProgress, text);
|
||||
Helper.setViewText(textOptimizationElapsed, Helper.formatDuration(Double.valueOf(elapsed / 1000.0).longValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String outputFilePath) {
|
||||
transcodedFilePath = outputFilePath;
|
||||
transcodeInProgress = false;
|
||||
Helper.setViewText(textOptimizationStatus, R.string.video_optimized);
|
||||
Helper.setViewVisibility(optimizationRealProgress, View.GONE);
|
||||
Helper.setViewVisibility(optimizationProgress, View.GONE);
|
||||
Helper.setViewVisibility(textOptimizationProgress, View.GONE);
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(String outputFilePath) {
|
||||
transcodedFilePath = outputFilePath;
|
||||
transcodeInProgress = false;
|
||||
Helper.setViewText(textOptimizationStatus, R.string.video_optimized);
|
||||
Helper.setViewVisibility(optimizationRealProgress, View.GONE);
|
||||
Helper.setViewVisibility(optimizationProgress, View.GONE);
|
||||
Helper.setViewVisibility(textOptimizationProgress, View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorOrCancelled() {
|
||||
transcodeInProgress = false;
|
||||
Helper.setViewText(textOptimizationStatus, R.string.video_optimize_failed);
|
||||
Helper.setViewVisibility(optimizationRealProgress, View.GONE);
|
||||
Helper.setViewVisibility(optimizationProgress, View.GONE);
|
||||
Helper.setViewVisibility(textOptimizationProgress, View.GONE);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onErrorOrCancelled() {
|
||||
transcodeInProgress = false;
|
||||
Helper.setViewText(textOptimizationStatus, R.string.video_optimize_failed);
|
||||
Helper.setViewVisibility(optimizationRealProgress, View.GONE);
|
||||
Helper.setViewVisibility(optimizationProgress, View.GONE);
|
||||
Helper.setViewVisibility(textOptimizationProgress, View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
transcodeStartTime = System.currentTimeMillis();
|
||||
videoTranscodeTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
transcodeStartTime = System.currentTimeMillis();
|
||||
videoTranscodeTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelOnFatalCondition(String message) {
|
||||
@@ -968,8 +983,8 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
}
|
||||
} else {
|
||||
channelSpinnerAdapter.clear();
|
||||
channelSpinnerAdapter.addAll(channels);
|
||||
channelSpinnerAdapter.addPlaceholder(true);
|
||||
channelSpinnerAdapter.addAll(channels);
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -978,12 +993,14 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
if (channelSpinnerAdapter != null && channelSpinner != null) {
|
||||
if (editMode && currentClaim.getSigningChannel() != null && !editChannelSpinnerLoaded) {
|
||||
int position = channelSpinnerAdapter.getItemPosition(currentClaim.getSigningChannel());
|
||||
if (position > -1) {
|
||||
channelSpinner.setSelection(position);
|
||||
if (editMode) {
|
||||
if (currentClaim.getSigningChannel() != null && !editChannelSpinnerLoaded) {
|
||||
int position = channelSpinnerAdapter.getItemPosition(currentClaim.getSigningChannel());
|
||||
if (position > -1) {
|
||||
channelSpinner.setSelection(position);
|
||||
}
|
||||
editChannelSpinnerLoaded = true;
|
||||
}
|
||||
editChannelSpinnerLoaded = true;
|
||||
} else {
|
||||
if (channelSpinnerAdapter.getCount() > 2) {
|
||||
// if anonymous displayed, select first channel if available
|
||||
@@ -1037,6 +1054,16 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
metadata.setLicenseUrl(selectedLicense.getUrl());
|
||||
}
|
||||
|
||||
// set release time from current claim (on edit)
|
||||
if (currentClaim != null) {
|
||||
Claim.StreamMetadata currentMetadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||
metadata.setReleaseTime(currentMetadata.getReleaseTime());
|
||||
if (metadata.getReleaseTime() == 0) {
|
||||
metadata.setReleaseTime(currentClaim.getTimestamp());
|
||||
}
|
||||
claim.setTimestamp(currentClaim.getTimestamp());
|
||||
}
|
||||
|
||||
claim.setValueType(Claim.TYPE_STREAM);
|
||||
claim.setValue(metadata);
|
||||
|
||||
@@ -1088,6 +1115,7 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
|
||||
// Run the logPublish task
|
||||
if (!BuildConfig.DEBUG) {
|
||||
claimResult.setSigningChannel(claim.getSigningChannel());
|
||||
LogPublishTask logPublish = new LogPublishTask(claimResult);
|
||||
logPublish.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
@@ -1096,13 +1124,13 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("claim_id", claimResult.getClaimId());
|
||||
bundle.putString("claim_name", claimResult.getName());
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_PUBLISH, bundle);
|
||||
LbryAnalytics.logEvent(editMode ? LbryAnalytics.EVENT_PUBLISH_UPDATE : LbryAnalytics.EVENT_PUBLISH, bundle);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
activity.showMessage(R.string.publish_successful);
|
||||
activity.openPublishesOnSuccessfulPublish();
|
||||
activity.sendBroadcast(new Intent(MainActivity.ACTION_PUBLISH_SUCCESSFUL));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,128 +1286,6 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
checkRewardsDriver();
|
||||
}
|
||||
|
||||
private void setupInlineChannelCreator(
|
||||
View container,
|
||||
TextInputEditText inputChannelName,
|
||||
TextInputEditText inputDeposit,
|
||||
View inlineBalanceView,
|
||||
TextView inlineBalanceValue,
|
||||
View linkCancel,
|
||||
MaterialButton buttonCreate,
|
||||
View progressView) {
|
||||
inputDeposit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
Helper.setViewVisibility(inlineBalanceView, hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
linkCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Helper.setViewText(inputChannelName, null);
|
||||
Helper.setViewText(inputDeposit, null);
|
||||
Helper.setViewVisibility(container, View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
buttonCreate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// validate deposit and channel name
|
||||
String channelNameString = Helper.normalizeChannelName(Helper.getValue(inputChannelName.getText()));
|
||||
Claim claimToSave = new Claim();
|
||||
claimToSave.setName(channelNameString);
|
||||
String channelName = claimToSave.getName().startsWith("@") ? claimToSave.getName().substring(1) : claimToSave.getName();
|
||||
String depositString = Helper.getValue(inputDeposit.getText());
|
||||
if ("@".equals(channelName) || Helper.isNullOrEmpty(channelName)) {
|
||||
showError(getString(R.string.please_enter_channel_name));
|
||||
return;
|
||||
}
|
||||
if (!LbryUri.isNameValid(channelName)) {
|
||||
showError(getString(R.string.channel_name_invalid_characters));
|
||||
return;
|
||||
}
|
||||
if (Helper.channelExists(channelName)) {
|
||||
showError(getString(R.string.channel_name_already_created));
|
||||
return;
|
||||
}
|
||||
|
||||
double depositAmount = 0;
|
||||
try {
|
||||
depositAmount = Double.valueOf(depositString);
|
||||
} catch (NumberFormatException ex) {
|
||||
// pass
|
||||
showError(getString(R.string.please_enter_valid_deposit));
|
||||
return;
|
||||
}
|
||||
if (depositAmount == 0) {
|
||||
String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT));
|
||||
showError(error);
|
||||
return;
|
||||
}
|
||||
if (Lbry.walletBalance == null || Lbry.walletBalance.getAvailable().doubleValue() < depositAmount) {
|
||||
showError(getString(R.string.deposit_more_than_balance));
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelCreateUpdateTask task = new ChannelCreateUpdateTask(
|
||||
claimToSave, new BigDecimal(depositString), false, progressView, new ClaimResultHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
Helper.setViewEnabled(inputChannelName, false);
|
||||
Helper.setViewEnabled(inputDeposit, false);
|
||||
Helper.setViewEnabled(buttonCreate, false);
|
||||
Helper.setViewEnabled(linkCancel, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Claim claimResult) {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
LogPublishTask logPublishTask = new LogPublishTask(claimResult);
|
||||
logPublishTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
// channel created
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("claim_id", claimResult.getClaimId());
|
||||
bundle.putString("claim_name", claimResult.getName());
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_CHANNEL_CREATE, bundle);
|
||||
|
||||
// add the claim to the channel list and set it as the selected item
|
||||
channelSpinnerAdapter.add(claimResult);
|
||||
channelSpinner.setSelection(channelSpinnerAdapter.getCount() - 1);
|
||||
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
showError(error.getMessage());
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
Helper.setViewText(inlineBalanceValue, Helper.shortCurrencyFormat(Lbry.walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUploadButton() {
|
||||
|
||||
}
|
||||
@@ -1394,15 +1300,25 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
|
||||
@Override
|
||||
public void onStoragePermissionRefused() {
|
||||
showError(getString(R.string.storage_permission_rationale_images));
|
||||
if (!storageRefusedOnce) {
|
||||
try {
|
||||
showError(getString(R.string.storage_permission_rationale_images));
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
storageRefusedOnce = true;
|
||||
}
|
||||
launchPickerPending = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFilePicked(String filePath) {
|
||||
if (Helper.isNullOrEmpty(filePath)) {
|
||||
Snackbar.make(getView(), R.string.undetermined_image_filepath, Snackbar.LENGTH_LONG).setBackgroundTint(
|
||||
ContextCompat.getColor(getContext(), R.color.red)).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.undetermined_image_filepath, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1430,7 +1346,7 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
if (ctx != null) {
|
||||
String rewardsDriverText = String.format("%s\n%s",
|
||||
getString(R.string.publishing_requires_credits), getString(R.string.tap_here_to_get_some));
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, Helper.MIN_DEPOSIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.camera.core.Camera;
|
||||
@@ -52,6 +51,8 @@ import io.lbry.browser.utils.LbryAnalytics;
|
||||
public class PublishFragment extends BaseFragment implements
|
||||
CameraPermissionListener, FilePickerListener, StoragePermissionListener {
|
||||
|
||||
private boolean cameraPreviewInitialized;
|
||||
private boolean storagePermissionRefusedOnce;
|
||||
private PreviewView cameraPreview;
|
||||
private RecyclerView galleryGrid;
|
||||
private GalleryGridAdapter adapter;
|
||||
@@ -122,7 +123,7 @@ public class PublishFragment extends BaseFragment implements
|
||||
|
||||
private void displayPreviewWithCameraX() {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
if (context != null && MainActivity.hasPermission(Manifest.permission.CAMERA, context)) {
|
||||
cameraProviderFuture = ProcessCameraProvider.getInstance(context);
|
||||
cameraProviderFuture.addListener(new Runnable() {
|
||||
@Override
|
||||
@@ -137,8 +138,9 @@ public class PublishFragment extends BaseFragment implements
|
||||
|
||||
Camera camera = cameraProvider.bindToLifecycle((LifecycleOwner) context, cameraSelector, preview);
|
||||
preview.setSurfaceProvider(cameraPreview.createSurfaceProvider(camera.getCameraInfo()));
|
||||
cameraPreviewInitialized = true;
|
||||
}
|
||||
} catch (ExecutionException | InterruptedException ex) {
|
||||
} catch (ExecutionException | IllegalArgumentException | InterruptedException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
@@ -252,7 +254,9 @@ public class PublishFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
checkStoragePermissionAndLoadVideos();
|
||||
if (!storagePermissionRefusedOnce) {
|
||||
checkStoragePermissionAndLoadVideos();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@@ -267,7 +271,9 @@ public class PublishFragment extends BaseFragment implements
|
||||
activity.removeFilePickerListener(this);
|
||||
}
|
||||
}
|
||||
CameraX.unbindAll();
|
||||
if (cameraPreviewInitialized) {
|
||||
CameraX.unbindAll();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@@ -361,13 +367,13 @@ public class PublishFragment extends BaseFragment implements
|
||||
public void onCameraPermissionRefused() {
|
||||
if (takePhotoPending) {
|
||||
takePhotoPending = false;
|
||||
Snackbar.make(getView(), R.string.camera_permission_rationale_photo, Toast.LENGTH_LONG).
|
||||
Snackbar.make(getView(), R.string.camera_permission_rationale_photo, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
return;
|
||||
}
|
||||
|
||||
recordPending = false;
|
||||
Snackbar.make(getView(), R.string.camera_permission_rationale_record, Toast.LENGTH_LONG).
|
||||
Snackbar.make(getView(), R.string.camera_permission_rationale_record, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
|
||||
@@ -395,9 +401,15 @@ public class PublishFragment extends BaseFragment implements
|
||||
|
||||
@Override
|
||||
public void onStoragePermissionRefused() {
|
||||
Snackbar.make(getView(), R.string.storage_permission_rationale_videos, Snackbar.LENGTH_LONG).setBackgroundTint(
|
||||
ContextCompat.getColor(getContext(), R.color.red)
|
||||
).show();
|
||||
storagePermissionRefusedOnce = true;
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Snackbar.make(root, R.string.storage_permission_rationale_videos, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
Helper.setViewText(noVideosLoaded, R.string.storage_permission_rationale_videos);
|
||||
}
|
||||
|
||||
checkNoVideosLoaded();
|
||||
}
|
||||
|
||||
public String getSuggestedPublishUrl() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -150,21 +151,28 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims) {
|
||||
Lbry.ownClaims = Helper.filterDeletedClaims(new ArrayList<>(claims));
|
||||
Context context = getContext();
|
||||
if (adapter == null) {
|
||||
adapter = new ClaimListAdapter(claims, context);
|
||||
adapter.setCanEnterSelectionMode(true);
|
||||
adapter.setSelectionModeListener(PublishesFragment.this);
|
||||
adapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openFileClaim(claim);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
adapter = new ClaimListAdapter(claims, context);
|
||||
adapter.setCanEnterSelectionMode(true);
|
||||
adapter.setSelectionModeListener(PublishesFragment.this);
|
||||
adapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
activity.openChannelClaim(claim);
|
||||
} else {
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (contentList != null) {
|
||||
contentList.setAdapter(adapter);
|
||||
}
|
||||
});
|
||||
if (contentList != null) {
|
||||
contentList.setAdapter(adapter);
|
||||
}
|
||||
} else {
|
||||
adapter.setItems(claims);
|
||||
@@ -234,7 +242,8 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba
|
||||
@Override
|
||||
public boolean onPrepareActionMode(androidx.appcompat.view.ActionMode actionMode, Menu menu) {
|
||||
int selectionCount = adapter != null ? adapter.getSelectedCount() : 0;
|
||||
menu.findItem(R.id.action_edit).setVisible(selectionCount == 1);
|
||||
menu.findItem(R.id.action_edit).setVisible(selectionCount == 1 &&
|
||||
Claim.TYPE_STREAM.equalsIgnoreCase(adapter.getSelectedItems().get(0).getValueType()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package io.lbry.browser.ui.verification;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -67,8 +70,12 @@ public class EmailVerificationFragment extends Fragment {
|
||||
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
String layoutHint = !hasFocus ? "" : getString(R.string.email);
|
||||
inputLayoutEmail.setHint(layoutHint);
|
||||
try {
|
||||
String layoutHint = !hasFocus ? "" : getString(R.string.email);
|
||||
inputLayoutEmail.setHint(layoutHint);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
});
|
||||
buttonContinue.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -95,12 +102,21 @@ public class EmailVerificationFragment extends Fragment {
|
||||
|
||||
private void addEmail() {
|
||||
currentEmail = Helper.getValue(inputEmail.getText());
|
||||
if (Helper.isNullOrEmpty(currentEmail) || currentEmail.indexOf("@") == -1) {
|
||||
Snackbar.make(getView(), R.string.provide_valid_email, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
if (Helper.isNullOrEmpty(currentEmail) || !currentEmail.contains("@")) {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.provide_valid_email, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(inputEmail.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
EmailNewTask task = new EmailNewTask(currentEmail, emailAddProgress, new EmailNewTask.EmailNewHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
@@ -127,8 +143,11 @@ public class EmailVerificationFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
View view = getView();
|
||||
if (view != null && error != null) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
};
|
||||
Helper.setViewVisibility(buttonContinue, View.VISIBLE);
|
||||
}
|
||||
});
|
||||
@@ -146,7 +165,8 @@ public class EmailVerificationFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void checkEmailVerified() {
|
||||
CheckUserEmailVerifiedTask task = new CheckUserEmailVerifiedTask(new CheckUserEmailVerifiedTask.CheckUserEmailVerifiedHandler() {
|
||||
Context context = getContext();
|
||||
CheckUserEmailVerifiedTask task = new CheckUserEmailVerifiedTask(context, new CheckUserEmailVerifiedTask.CheckUserEmailVerifiedHandler() {
|
||||
@Override
|
||||
public void onUserEmailVerified() {
|
||||
if (listener != null) {
|
||||
@@ -185,14 +205,20 @@ public class EmailVerificationFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Snackbar.make(getView(), R.string.please_follow_instructions, Snackbar.LENGTH_LONG).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.please_follow_instructions, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
Helper.setViewEnabled(buttonResend, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
View view = getView();
|
||||
if (view != null && error != null) {
|
||||
Snackbar.make(view, error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
Helper.setViewEnabled(buttonResend, true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.lbry.browser.ui.verification;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
@@ -7,6 +8,7 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
@@ -79,6 +81,12 @@ public class PhoneVerificationFragment extends Fragment {
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(inputPhoneNumber.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
addPhoneNumber();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package io.lbry.browser.ui.verification;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -59,6 +63,13 @@ public class WalletVerificationFragment extends Fragment {
|
||||
showError(getString(R.string.please_enter_your_password));
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(inputPassword.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
listener.onWalletSyncProcessing();
|
||||
}
|
||||
@@ -89,9 +100,14 @@ public class WalletVerificationFragment extends Fragment {
|
||||
verificationStarted = true;
|
||||
Helper.setViewVisibility(loading, View.VISIBLE);
|
||||
Helper.setViewVisibility(textLoading, View.VISIBLE);
|
||||
// attempt to load secure value from versions pre-0.15.0
|
||||
String prevVersionPassword = Utils.getSecureValue(MainActivity.SECURE_VALUE_FIRST_RUN_PASSWORD, getContext(), Lbry.KEYSTORE);
|
||||
String password = Utils.getSecureValue(MainActivity.SECURE_VALUE_KEY_SAVED_PASSWORD, getContext(), Lbry.KEYSTORE);
|
||||
// start verification process
|
||||
SyncGetTask task = new SyncGetTask(password, false, null, new DefaultSyncTaskHandler() {
|
||||
SyncGetTask task = new SyncGetTask(!Helper.isNullOrEmpty(prevVersionPassword) ? prevVersionPassword : password,
|
||||
false,
|
||||
null,
|
||||
new DefaultSyncTaskHandler() {
|
||||
@Override
|
||||
public void onSyncGetSuccess(WalletSync walletSync) {
|
||||
currentWalletSync = walletSync;
|
||||
@@ -228,8 +244,10 @@ public class WalletVerificationFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).setBackgroundTint(
|
||||
getResources().getColor(R.color.red)
|
||||
).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -78,6 +79,7 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
private View progressLoadingInviteByEmail;
|
||||
private View progressLoadingStatus;
|
||||
|
||||
private CardView rewardDriverCard;
|
||||
private View inlineChannelCreator;
|
||||
private TextInputEditText inlineChannelCreatorInputName;
|
||||
private TextInputEditText inlineChannelCreatorInputDeposit;
|
||||
@@ -95,6 +97,7 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
layoutSdkInitializing = root.findViewById(R.id.container_sdk_initializing);
|
||||
textLearnMoreLink = root.findViewById(R.id.invites_account_driver_learn_more);
|
||||
buttonGetStarted = root.findViewById(R.id.invites_get_started_button);
|
||||
rewardDriverCard = root.findViewById(R.id.reward_driver_card);
|
||||
|
||||
textInviteLink = root.findViewById(R.id.invites_invite_link);
|
||||
buttonCopyInviteLink = root.findViewById(R.id.invites_copy_invite_link);
|
||||
@@ -131,6 +134,16 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
|
||||
Helper.applyHtmlForTextView(textLearnMoreLink);
|
||||
|
||||
rewardDriverCard.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openRewards();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
@@ -235,6 +248,8 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
}
|
||||
});
|
||||
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(getContext(), R.layout.spinner_item_channel, new ArrayList<>());
|
||||
channelSpinnerAdapter.addPlaceholder(false);
|
||||
setupInlineChannelCreator(
|
||||
inlineChannelCreator,
|
||||
inlineChannelCreatorInputName,
|
||||
@@ -243,7 +258,9 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
inlineChannelCreatorInlineBalanceValue,
|
||||
inlineChannelCreatorCancelLink,
|
||||
inlineChannelCreatorCreateButton,
|
||||
inlineChannelCreatorProgress
|
||||
inlineChannelCreatorProgress,
|
||||
channelSpinner,
|
||||
channelSpinnerAdapter
|
||||
);
|
||||
}
|
||||
|
||||
@@ -442,120 +459,6 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void setupInlineChannelCreator(
|
||||
View container,
|
||||
TextInputEditText inputChannelName,
|
||||
TextInputEditText inputDeposit,
|
||||
View inlineBalanceView,
|
||||
TextView inlineBalanceValue,
|
||||
View linkCancel,
|
||||
MaterialButton buttonCreate,
|
||||
View progressView) {
|
||||
inputDeposit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
Helper.setViewVisibility(inlineBalanceView, hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
linkCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Helper.setViewText(inputChannelName, null);
|
||||
Helper.setViewText(inputDeposit, null);
|
||||
Helper.setViewVisibility(container, View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
buttonCreate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// validate deposit and channel name
|
||||
String channelNameString = Helper.normalizeChannelName(Helper.getValue(inputChannelName.getText()));
|
||||
Claim claimToSave = new Claim();
|
||||
claimToSave.setName(channelNameString);
|
||||
String channelName = claimToSave.getName().startsWith("@") ? claimToSave.getName().substring(1) : claimToSave.getName();
|
||||
String depositString = Helper.getValue(inputDeposit.getText());
|
||||
if ("@".equals(channelName) || Helper.isNullOrEmpty(channelName)) {
|
||||
showError(getString(R.string.please_enter_channel_name));
|
||||
return;
|
||||
}
|
||||
if (!LbryUri.isNameValid(channelName)) {
|
||||
showError(getString(R.string.channel_name_invalid_characters));
|
||||
return;
|
||||
}
|
||||
if (Helper.channelExists(channelName)) {
|
||||
showError(getString(R.string.channel_name_already_created));
|
||||
return;
|
||||
}
|
||||
|
||||
double depositAmount = 0;
|
||||
try {
|
||||
depositAmount = Double.valueOf(depositString);
|
||||
} catch (NumberFormatException ex) {
|
||||
// pass
|
||||
showError(getString(R.string.please_enter_valid_deposit));
|
||||
return;
|
||||
}
|
||||
if (depositAmount == 0) {
|
||||
String error = getResources().getQuantityString(R.plurals.min_deposit_required, depositAmount == 1 ? 1 : 2, String.valueOf(Helper.MIN_DEPOSIT));
|
||||
showError(error);
|
||||
return;
|
||||
}
|
||||
if (Lbry.walletBalance == null || Lbry.walletBalance.getAvailable().doubleValue() < depositAmount) {
|
||||
showError(getString(R.string.deposit_more_than_balance));
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelCreateUpdateTask task = new ChannelCreateUpdateTask(
|
||||
claimToSave, new BigDecimal(depositString), false, progressView, new ClaimResultHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
Helper.setViewEnabled(inputChannelName, false);
|
||||
Helper.setViewEnabled(inputDeposit, false);
|
||||
Helper.setViewEnabled(buttonCreate, false);
|
||||
Helper.setViewEnabled(linkCancel, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Claim claimResult) {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
LogPublishTask logPublishTask = new LogPublishTask(claimResult);
|
||||
logPublishTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
// channel created
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("claim_id", claimResult.getClaimId());
|
||||
bundle.putString("claim_name", claimResult.getName());
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_CHANNEL_CREATE, bundle);
|
||||
|
||||
// add the claim to the channel list and set it as the selected item
|
||||
channelSpinnerAdapter.add(claimResult);
|
||||
channelSpinner.setSelection(channelSpinnerAdapter.getCount() - 1);
|
||||
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Helper.setViewEnabled(inputChannelName, true);
|
||||
Helper.setViewEnabled(inputDeposit, true);
|
||||
Helper.setViewEnabled(buttonCreate, true);
|
||||
Helper.setViewEnabled(linkCancel, true);
|
||||
showError(error.getMessage());
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
Helper.setViewText(inlineBalanceValue, Helper.shortCurrencyFormat(Lbry.walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
|
||||
if (walletBalance != null && inlineChannelCreatorInlineBalanceValue != null) {
|
||||
@@ -564,19 +467,11 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
||||
checkRewardsDriver();
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkRewardsDriver() {
|
||||
Context ctx = getContext();
|
||||
if (ctx != null) {
|
||||
String rewardsDriverText = getString(R.string.earn_credits_for_inviting);
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
View root = getView();
|
||||
if (ctx != null && root != null) {
|
||||
Helper.setViewText(root.findViewById(R.id.reward_driver_text), R.string.earn_credits_for_inviting);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,8 +286,10 @@ public class RewardsFragment extends BaseFragment implements RewardListAdapter.R
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
View view = getView();
|
||||
if (view != null && error != null && !Helper.isNullOrEmpty(error.getMessage())) {
|
||||
Snackbar.make(view, error.getMessage(), Snackbar.LENGTH_LONG).setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
Helper.setViewEnabled(buttonClaim, true);
|
||||
Helper.setViewEnabled(inputClaimCode, true);
|
||||
rewardClaimInProgress = false;
|
||||
|
||||
@@ -103,16 +103,20 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
||||
TransactionListTask task = new TransactionListTask(currentTransactionPage, TRANSACTION_PAGE_LIMIT, loading, new TransactionListTask.TransactionListHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
|
||||
Context context = getContext();
|
||||
|
||||
transactionsLoading = false;
|
||||
transactionsHaveReachedEnd = hasReachedEnd;
|
||||
if (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, getContext());
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
if (context != null) {
|
||||
if (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, context);
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
}
|
||||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
checkNoTransactions();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -19,6 +21,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.browser.customtabs.CustomTabsIntent;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
@@ -30,12 +33,20 @@ import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.TransactionListAdapter;
|
||||
@@ -57,6 +68,10 @@ import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class WalletFragment extends BaseFragment implements SdkStatusListener, WalletBalanceListener {
|
||||
|
||||
private static final String MOONPAY_KEY = "c2tfbGl2ZV9ueVJqVXNDbE5pcnVSdnlCMkJLWW5JcFA5VnA3dWU=";
|
||||
private static final String MOONPAY_URL_FORMAT =
|
||||
"https://buy.moonpay.io?apiKey=pk_live_xNFffrN5NWKy6fu0ggbV8VQIwRieRzy&colorCode=%%232F9176¤cyCode=LBC&showWalletAddressForm=true&walletAddress=%s&externalCustomerId=%s";
|
||||
|
||||
private View layoutAccountRecommended;
|
||||
private View layoutSdkInitializing;
|
||||
private View linkSkipAccount;
|
||||
@@ -75,6 +90,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
private View inlineBalanceContainer;
|
||||
private TextView textWalletInlineBalance;
|
||||
private MaterialButton buttonSignUp;
|
||||
private MaterialButton buttonBuyLBC;
|
||||
private RecyclerView recentTransactionsList;
|
||||
private View linkViewAll;
|
||||
private TextView textConvertCredits;
|
||||
@@ -125,6 +141,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
recentTransactionsList = root.findViewById(R.id.wallet_recent_transactions_list);
|
||||
linkViewAll = root.findViewById(R.id.wallet_link_view_all);
|
||||
textNoRecentTransactions = root.findViewById(R.id.wallet_no_recent_transactions);
|
||||
buttonBuyLBC = root.findViewById(R.id.wallet_buy_lbc_button);
|
||||
textConvertCredits = root.findViewById(R.id.wallet_hint_convert_credits);
|
||||
textConvertCreditsBittrex = root.findViewById(R.id.wallet_hint_convert_credits_bittrex);
|
||||
textEarnMoreTips = root.findViewById(R.id.wallet_hint_earn_more_tips);
|
||||
@@ -313,6 +330,13 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
}
|
||||
});
|
||||
|
||||
buttonBuyLBC.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
launchMoonpayFlow();
|
||||
}
|
||||
});
|
||||
|
||||
inputSendAddress.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
@@ -407,29 +431,53 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
|
||||
private void sendCredits() {
|
||||
// wallet_send task
|
||||
View view = getView();
|
||||
String recipientAddress = Helper.getValue(inputSendAddress.getText());
|
||||
String amountString = Helper.getValue(inputSendAmount.getText());
|
||||
String amount = new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).
|
||||
format(new BigDecimal(amountString).doubleValue());
|
||||
String amount = null;
|
||||
try {
|
||||
amount = new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).
|
||||
format(new BigDecimal(amountString).doubleValue());
|
||||
} catch (NumberFormatException ex) {
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.invalid_amount, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
double actualSendAmount = Double.valueOf(amount);
|
||||
if (actualSendAmount < Helper.MIN_SPEND) {
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.min_spend_required, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
disableSendControls();
|
||||
WalletSendTask task = new WalletSendTask(recipientAddress, amount, walletSendProgress, new WalletSendTask.WalletSendHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
double sentAmount = Double.valueOf(amount);
|
||||
double sentAmount = actualSendAmount;
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2,
|
||||
new DecimalFormat("#,###.##").format(sentAmount));
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).show();
|
||||
inputSendAddress.setText(null);
|
||||
inputSendAmount.setText(null);
|
||||
Helper.setViewText(inputSendAddress, null);
|
||||
Helper.setViewText(inputSendAmount, null);
|
||||
if (view != null) {
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
enableSendControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Snackbar.make(getView(), R.string.send_credit_error, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.send_credit_error, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
enableSendControls();
|
||||
}
|
||||
});
|
||||
@@ -457,6 +505,48 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
return sp.getBoolean(MainActivity.PREFERENCE_KEY_INTERNAL_SKIP_WALLET_ACCOUNT, false);
|
||||
}
|
||||
|
||||
public void launchMoonpayFlow() {
|
||||
Context context = getContext();
|
||||
String receiveAddress = null;
|
||||
if (context != null) {
|
||||
try {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
receiveAddress = sp.getString(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS, null);
|
||||
if (Helper.isNullOrEmpty(receiveAddress)) {
|
||||
showError(getString(R.string.receive_address_not_set));
|
||||
return;
|
||||
}
|
||||
|
||||
long userId = Lbryio.currentUser != null ? Lbryio.currentUser.getId() : 0;
|
||||
String url = String.format(MOONPAY_URL_FORMAT, receiveAddress,
|
||||
URLEncoder.encode(String.format("android-%d", userId), StandardCharsets.UTF_8.name()));
|
||||
String email = Lbryio.getSignedInEmail();
|
||||
if (!Helper.isNullOrEmpty(email)) {
|
||||
url = String.format("%s&email=%s", url, URLEncoder.encode(email, StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
// Sign the URL
|
||||
String query = url.substring(url.indexOf("?"));
|
||||
Mac hmacSHA256 = Mac.getInstance("HmacSHA256");
|
||||
|
||||
SecretKeySpec secretKey = new SecretKeySpec(
|
||||
new String(Base64.decode(MOONPAY_KEY, Base64.NO_WRAP), StandardCharsets.UTF_8.name()).getBytes(), "HmacSHA256");
|
||||
hmacSHA256.init(secretKey);
|
||||
String signature = new String(
|
||||
Base64.encode(hmacSHA256.doFinal(query.getBytes(StandardCharsets.UTF_8.name())), Base64.NO_WRAP),
|
||||
StandardCharsets.UTF_8.name());
|
||||
url = String.format("%s&signature=%s", url, URLEncoder.encode(signature, StandardCharsets.UTF_8.name()));
|
||||
|
||||
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder().setToolbarColor(
|
||||
ContextCompat.getColor(context, R.color.lbryGreen)
|
||||
);
|
||||
CustomTabsIntent intent = builder.build();
|
||||
intent.launchUrl(context, Uri.parse(url));
|
||||
} catch (UnsupportedEncodingException | NoSuchAlgorithmException | InvalidKeyException ex) {
|
||||
showError(getString(R.string.hash_not_supported));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
@@ -530,8 +620,11 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(String newAddress) {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
sp.edit().putString(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS, newAddress).apply();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
sp.edit().putString(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS, newAddress).apply();
|
||||
}
|
||||
Helper.setViewText(textWalletReceiveAddress, newAddress);
|
||||
Helper.setViewEnabled(buttonGetNewAddress, true);
|
||||
}
|
||||
@@ -604,7 +697,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
Lbryio.totalUnclaimedRewardAmount == 1 ? 1 : 2,
|
||||
Helper.shortCurrencyFormat(Lbryio.totalUnclaimedRewardAmount));
|
||||
}
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,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.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -37,6 +39,9 @@ import org.json.JSONObject;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -70,6 +75,8 @@ public final class Helper {
|
||||
public static final MediaType JSON_MEDIA_TYPE = MediaType.get("application/json; charset=utf-8");
|
||||
public static final int CONTENT_PAGE_SIZE = 25;
|
||||
public static final double MIN_DEPOSIT = 0.001;
|
||||
public static final double MIN_SPEND = 0.0001;
|
||||
public static final String PLAIN_CURRENCY_FORMAT_PATTERN = "####.##";
|
||||
public static final String LBC_CURRENCY_FORMAT_PATTERN = "#,###.##";
|
||||
public static final String FILE_SIZE_FORMAT_PATTERN = "#,###.#";
|
||||
public static final DecimalFormat LBC_CURRENCY_FORMAT = new DecimalFormat(LBC_CURRENCY_FORMAT_PATTERN);
|
||||
@@ -322,7 +329,7 @@ public final class Helper {
|
||||
}
|
||||
|
||||
public static String getValue(CharSequence cs) {
|
||||
return cs != null ? cs.toString() : "";
|
||||
return cs != null ? cs.toString().trim() : "";
|
||||
}
|
||||
|
||||
public static List<String> buildContentSortOrder(int sortBy) {
|
||||
@@ -550,7 +557,11 @@ public final class Helper {
|
||||
split[1]
|
||||
};
|
||||
|
||||
return getDataColumn(context, contentUri, selection, selectionArgs);
|
||||
try {
|
||||
return getDataColumn(context, contentUri, selection, selectionArgs);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// MediaStore (and general)
|
||||
@@ -660,8 +671,12 @@ public final class Helper {
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
LbryFile file = files.get(i);
|
||||
// remove own claims as well
|
||||
if (file.getClaim() != null && Lbry.ownClaims.contains(file.getClaim())) {
|
||||
continue;
|
||||
if (Lbry.ownClaims != null && Lbry.ownClaims.size() > 0) {
|
||||
for (Claim own : Lbry.ownClaims) {
|
||||
if (own.getClaimId().equalsIgnoreCase(file.getClaimId())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Helper.isNullOrEmpty(file.getDownloadPath())) {
|
||||
filtered.add(file);
|
||||
@@ -705,6 +720,9 @@ public final class Helper {
|
||||
}
|
||||
}
|
||||
public static String normalizeChannelName(String channelName) {
|
||||
if (Helper.isNullOrEmpty(channelName)) {
|
||||
return "";
|
||||
}
|
||||
if (!channelName.startsWith("@")) {
|
||||
return String.format("@%s", channelName);
|
||||
}
|
||||
@@ -753,4 +771,14 @@ public final class Helper {
|
||||
}
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import java.io.IOException;
|
||||
import java.security.KeyStore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -88,6 +89,8 @@ public final class Lbry {
|
||||
public static final String METHOD_PREFERENCE_GET = "preference_get";
|
||||
public static final String METHOD_PREFERENCE_SET = "preference_set";
|
||||
|
||||
public static final String METHOD_COMMENT_CREATE = "comment_create";
|
||||
|
||||
public static final String METHOD_TXO_LIST = "txo_list";
|
||||
public static final String METHOD_TXO_SPEND = "txo_spend";
|
||||
|
||||
@@ -101,6 +104,8 @@ public final class Lbry {
|
||||
public static final String METHOD_STREAM_ABANDON = "stream_abandon";
|
||||
public static final String METHOD_STREAM_REPOST = "stream_repost";
|
||||
|
||||
public static final String METHOD_COMMENT_LIST = "comment_list";
|
||||
|
||||
public static KeyStore KEYSTORE;
|
||||
public static boolean SDK_READY = false;
|
||||
|
||||
@@ -374,8 +379,30 @@ public final class Lbry {
|
||||
String releaseTime,
|
||||
int page,
|
||||
int pageSize) {
|
||||
return buildClaimSearchOptions(
|
||||
Collections.singletonList(claimType),
|
||||
anyTags,
|
||||
notTags,
|
||||
channelIds,
|
||||
notChannelIds,
|
||||
orderBy,
|
||||
releaseTime,
|
||||
page,
|
||||
pageSize);
|
||||
}
|
||||
|
||||
public static Map<String, Object> buildClaimSearchOptions(
|
||||
List<String> claimType,
|
||||
List<String> anyTags,
|
||||
List<String> notTags,
|
||||
List<String> channelIds,
|
||||
List<String> notChannelIds,
|
||||
List<String> orderBy,
|
||||
String releaseTime,
|
||||
int page,
|
||||
int pageSize) {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
if (!Helper.isNullOrEmpty(claimType)) {
|
||||
if (claimType != null && claimType.size() > 0) {
|
||||
options.put("claim_type", claimType);
|
||||
}
|
||||
options.put("no_totals", true);
|
||||
|
||||
@@ -8,8 +8,10 @@ import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
public class LbryAnalytics {
|
||||
|
||||
public static final String EVENT_APP_EXCEPTION = "app_exception";
|
||||
public static final String EVENT_APP_ERROR = "app_error";
|
||||
public static final String EVENT_APP_LAUNCH = "app_launch";
|
||||
public static final String EVENT_COMMENT_CREATE = "comment_create";
|
||||
public static final String EVENT_BUFFER = "buffer";
|
||||
public static final String EVENT_EMAIL_ADDED = "email_added";
|
||||
public static final String EVENT_EMAIL_VERIFIED = "email_verified";
|
||||
public static final String EVENT_FIRST_RUN_COMPLETED = "first_run_completed";
|
||||
@@ -23,6 +25,7 @@ public class LbryAnalytics {
|
||||
public static final String EVENT_TAG_FOLLOW = "tag_follow";
|
||||
public static final String EVENT_TAG_UNFOLLOW = "tag_unfollow";
|
||||
public static final String EVENT_PUBLISH = "publish";
|
||||
public static final String EVENT_PUBLISH_UPDATE = "publish_update";
|
||||
public static final String EVENT_CHANNEL_CREATE = "channel_create";
|
||||
public static final String EVENT_SEARCH = "search";
|
||||
|
||||
@@ -32,8 +35,17 @@ public class LbryAnalytics {
|
||||
analytics = FirebaseAnalytics.getInstance(context);
|
||||
}
|
||||
|
||||
public static void checkInitAnalytics(Context context) {
|
||||
if (analytics == null && context != null) {
|
||||
analytics = FirebaseAnalytics.getInstance(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setCurrentScreen(Activity activity, String name, String className) {
|
||||
analytics.setCurrentScreen(activity, name, className);
|
||||
checkInitAnalytics(activity);
|
||||
if (analytics != null) {
|
||||
analytics.setCurrentScreen(activity, name, className);
|
||||
}
|
||||
}
|
||||
|
||||
public static void logEvent(String name) {
|
||||
@@ -41,13 +53,15 @@ public class LbryAnalytics {
|
||||
}
|
||||
|
||||
public static void logEvent(String name, Bundle bundle) {
|
||||
analytics.logEvent(name, bundle);
|
||||
if (analytics != null) {
|
||||
analytics.logEvent(name, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
public static void logException(String message, String exceptionName) {
|
||||
public static void logError(String message, String exceptionName) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("message", message);
|
||||
bundle.putString("name", exceptionName);
|
||||
logEvent("app_exception", bundle);
|
||||
logEvent(EVENT_APP_ERROR, bundle);
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,12 @@ public class LbryUri {
|
||||
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|r)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$";
|
||||
public static final String REGEX_ADDRESS = "^(b)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$";
|
||||
public static final int CHANNEL_NAME_MIN_LENGTH = 1;
|
||||
public static final int CLAIM_ID_MAX_LENGTH = 40;
|
||||
|
||||
private static final String REGEX_PART_PROTOCOL = "^((?:lbry://)?)";
|
||||
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_STREAM_OR_CHANNEL_NAME = "([^:$#/]*)";
|
||||
private static final String REGEX_PART_MODIFIER_SEPARATOR = "([:$#]?)([^/]*)";
|
||||
private static final String QUERY_STRING_BREAKER = "^([\\S]+)([?][\\S]*)";
|
||||
@@ -58,14 +59,19 @@ public class LbryUri {
|
||||
return parse(url, false);
|
||||
}
|
||||
public static LbryUri parse(String url, boolean requireProto) throws LbryUriException {
|
||||
Pattern componentsPattern = Pattern.compile(String.format("%s%s%s(/?)%s%s",
|
||||
Pattern componentsPattern = Pattern.compile(String.format("%s%s%s%s(/?)%s%s",
|
||||
REGEX_PART_PROTOCOL,
|
||||
REGEX_PART_HOST,
|
||||
REGEX_PART_STREAM_OR_CHANNEL_NAME,
|
||||
REGEX_PART_MODIFIER_SEPARATOR,
|
||||
REGEX_PART_STREAM_OR_CHANNEL_NAME,
|
||||
REGEX_PART_MODIFIER_SEPARATOR));
|
||||
|
||||
String cleanUrl = url, queryString = null;
|
||||
if (Helper.isNullOrEmpty(url)) {
|
||||
throw new LbryUriException("Invalid url parameter.");
|
||||
}
|
||||
|
||||
Matcher qsMatcher = PATTERN_SEPARATE_QUERY_STRING.matcher(url);
|
||||
if (qsMatcher.matches()) {
|
||||
queryString = qsMatcher.group(2);
|
||||
@@ -89,37 +95,48 @@ public class LbryUri {
|
||||
}
|
||||
|
||||
// components[0] = proto
|
||||
// components[1] = streamNameOrChannelName
|
||||
// components[2] = primaryModSeparator
|
||||
// components[3] = primaryModValue
|
||||
// components[4] = pathSep
|
||||
// components[5] = possibleStreamName
|
||||
// components[6] = secondaryModSeparator
|
||||
// components[7] = secondaryModValue
|
||||
// components[1] = host
|
||||
// components[2] = streamNameOrChannelName
|
||||
// components[3] = primaryModSeparator
|
||||
// components[4] = primaryModValue
|
||||
// components[5] = pathSep
|
||||
// components[6] = possibleStreamName
|
||||
// components[7] = secondaryModSeparator
|
||||
// components[8] = secondaryModValue
|
||||
if (requireProto && Helper.isNullOrEmpty(components.get(0))) {
|
||||
throw new LbryUriException("LBRY URLs must include a protocol prefix (lbry://).");
|
||||
}
|
||||
|
||||
if (Helper.isNullOrEmpty(components.get(1))) {
|
||||
if (Helper.isNullOrEmpty(components.get(2))) {
|
||||
throw new LbryUriException("URL does not include name.");
|
||||
}
|
||||
|
||||
for (String component : components.subList(1, components.size())) {
|
||||
for (String component : components.subList(2, components.size())) {
|
||||
if (component.indexOf(' ') > -1) {
|
||||
throw new LbryUriException("URL cannot include a space.");
|
||||
}
|
||||
}
|
||||
|
||||
String streamOrChannelName = components.get(1);
|
||||
String primaryModSeparator = components.get(2);
|
||||
String primaryModValue = components.get(3);
|
||||
String possibleStreamName = components.get(5);
|
||||
String secondaryModSeparator = components.get(6);
|
||||
String secondaryModValue = components.get(7);
|
||||
String streamOrChannelName = components.get(2);
|
||||
String primaryModSeparator = components.get(3);
|
||||
String primaryModValue = components.get(4);
|
||||
String possibleStreamName = components.get(6);
|
||||
String secondaryModSeparator = components.get(7);
|
||||
String secondaryModValue = components.get(8);
|
||||
|
||||
boolean includesChannel = streamOrChannelName.startsWith("@");
|
||||
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/")) {
|
||||
if (primaryModSeparator.equals(":"))
|
||||
primaryModSeparator = "#";
|
||||
if (secondaryModSeparator.equals(":"))
|
||||
secondaryModSeparator = "#";
|
||||
}
|
||||
|
||||
if (includesChannel) {
|
||||
if (Helper.isNullOrEmpty(channelName)) {
|
||||
throw new LbryUriException("No channel name after @.");
|
||||
@@ -143,7 +160,7 @@ public class LbryUri {
|
||||
|
||||
LbryUri uri = new LbryUri();
|
||||
uri.setChannel(isChannel);
|
||||
uri.setPath(Helper.join(components.subList(1, components.size()), ""));
|
||||
uri.setPath(Helper.join(components.subList(2, components.size()), ""));
|
||||
uri.setStreamName(streamName);
|
||||
uri.setStreamClaimId(streamClaimId);
|
||||
uri.setChannelName(channelName);
|
||||
|
||||
@@ -2,17 +2,19 @@ package io.lbry.browser.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -24,8 +26,11 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.lbry.browser.BuildConfig;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.Claim;
|
||||
@@ -33,6 +38,7 @@ import io.lbry.browser.model.WalletSync;
|
||||
import io.lbry.browser.model.lbryinc.Reward;
|
||||
import io.lbry.browser.model.lbryinc.Subscription;
|
||||
import io.lbry.browser.model.lbryinc.User;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
import lombok.Data;
|
||||
import okhttp3.OkHttpClient;
|
||||
@@ -43,9 +49,6 @@ import okhttp3.Response;
|
||||
@Data
|
||||
public final class Lbryio {
|
||||
|
||||
// TODO: Get this from the bundled aar
|
||||
public static String SDK_VERSION = "0.74.0";
|
||||
|
||||
public static User currentUser;
|
||||
public static boolean userHasSyncedWallet = false;
|
||||
public static String lastRemoteHash;
|
||||
@@ -81,6 +84,10 @@ public final class Lbryio {
|
||||
authToken = getAuthToken(context);
|
||||
}
|
||||
|
||||
/*if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, String.format("Using authToken for request: %s", authToken));
|
||||
}*/
|
||||
|
||||
String url = String.format("%s/%s/%s", CONNECTION_STRING, resource, action);
|
||||
if (Helper.METHOD_GET.equalsIgnoreCase(method)) {
|
||||
Uri.Builder uriBuilder = Uri.parse(url).buildUpon();
|
||||
@@ -94,6 +101,9 @@ public final class Lbryio {
|
||||
}
|
||||
url = uriBuilder.build().toString();
|
||||
}
|
||||
/*if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, String.format("Request Method: %s, Sending request to URL: %s", method, url));
|
||||
}*/
|
||||
|
||||
Request.Builder builder = new Request.Builder().url(url);
|
||||
if (Helper.METHOD_POST.equalsIgnoreCase(method)) {
|
||||
@@ -102,7 +112,10 @@ public final class Lbryio {
|
||||
}
|
||||
|
||||
Request request = builder.build();
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
OkHttpClient client = new OkHttpClient.Builder().
|
||||
writeTimeout(120, TimeUnit.SECONDS).
|
||||
readTimeout(120, TimeUnit.SECONDS).
|
||||
build();
|
||||
try {
|
||||
return client.newCall(request).execute();
|
||||
} catch (IOException ex) {
|
||||
@@ -139,6 +152,9 @@ public final class Lbryio {
|
||||
}
|
||||
|
||||
generatingAuthToken = true;
|
||||
/*if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "Generating a new auth token");
|
||||
}*/
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("auth_token", "");
|
||||
@@ -147,6 +163,9 @@ public final class Lbryio {
|
||||
Response response = Lbryio.call("user", "new", options, "post", context);
|
||||
try {
|
||||
JSONObject json = (JSONObject) parseResponse(response);
|
||||
/*if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, String.format("/user/new response: %s", json.toString(2)));
|
||||
}*/
|
||||
if (!json.has(AUTH_TOKEN_PARAM)) {
|
||||
throw new LbryioResponseException("auth_token was not set in the response");
|
||||
}
|
||||
@@ -154,6 +173,7 @@ public final class Lbryio {
|
||||
AUTH_TOKEN = json.getString(AUTH_TOKEN_PARAM);
|
||||
broadcastAuthTokenGenerated(context);
|
||||
} catch (JSONException | ClassCastException ex) {
|
||||
LbryAnalytics.logError(String.format("/user/new failed: %s", ex.getMessage()), ex.getClass().getName());
|
||||
throw new LbryioResponseException("auth_token was not set in the response", ex);
|
||||
} finally {
|
||||
generatingAuthToken = false;
|
||||
@@ -184,7 +204,7 @@ public final class Lbryio {
|
||||
}
|
||||
}
|
||||
|
||||
public static User fetchCurrentUser(Context context) {
|
||||
public static User fetchCurrentUser(Context context) throws AuthTokenInvalidatedException {
|
||||
try {
|
||||
Response response = Lbryio.call("user", "me", context);
|
||||
JSONObject object = (JSONObject) parseResponse(response);
|
||||
@@ -193,7 +213,23 @@ public final class Lbryio {
|
||||
User user = gson.fromJson(object.toString(), type);
|
||||
return user;
|
||||
} catch (LbryioRequestException | LbryioResponseException | ClassCastException | IllegalStateException ex) {
|
||||
LbryAnalytics.logException(String.format("/user/me failed: %s", ex.getMessage()), ex.getClass().getName());
|
||||
LbryAnalytics.logError(String.format("/user/me failed: %s", ex.getMessage()), ex.getClass().getName());
|
||||
|
||||
if (ex instanceof LbryioResponseException) {
|
||||
LbryioResponseException error = (LbryioResponseException) ex;
|
||||
if (error.getStatusCode() == 403) {
|
||||
// auth token invalidated
|
||||
AUTH_TOKEN = null;
|
||||
// remove the cached auth token
|
||||
if (context != null) {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
sp.edit().remove(MainActivity.PREFERENCE_KEY_AUTH_TOKEN).apply();
|
||||
}
|
||||
|
||||
throw new AuthTokenInvalidatedException();
|
||||
}
|
||||
}
|
||||
|
||||
android.util.Log.e(TAG, "Could not retrieve the current user", ex);
|
||||
return null;
|
||||
}
|
||||
@@ -221,7 +257,7 @@ public final class Lbryio {
|
||||
options.put("app_version", appVersion);
|
||||
options.put("app_id", Lbry.INSTALLATION_ID);
|
||||
options.put("node_id", "");
|
||||
options.put("daemon_version", SDK_VERSION);
|
||||
options.put("daemon_version", LbrynetService.LBRY_SDK_VERSION);
|
||||
options.put("operating_system", "android");
|
||||
options.put("platform", String.format("Android %s (API %d)", Utils.getAndroidRelease(), Utils.getAndroidSdk()));
|
||||
try {
|
||||
@@ -240,7 +276,7 @@ public final class Lbryio {
|
||||
return currentUser != null && currentUser.isHasVerifiedEmail();
|
||||
}
|
||||
|
||||
public static void authenticate(Context context) {
|
||||
public static void authenticate(Context context) throws AuthTokenInvalidatedException {
|
||||
User user = fetchCurrentUser(context);
|
||||
if (user != null) {
|
||||
currentUser = user;
|
||||
|
||||
@@ -40,9 +40,11 @@ public class Lighthouse {
|
||||
Uri.Builder uriBuilder = Uri.parse(String.format("%s/search", CONNECTION_STRING)).buildUpon().
|
||||
appendQueryParameter("s", rawQuery).
|
||||
appendQueryParameter("resolve", "true").
|
||||
appendQueryParameter("nsfw", String.valueOf(nsfw).toLowerCase()).
|
||||
appendQueryParameter("size", String.valueOf(size)).
|
||||
appendQueryParameter("from", String.valueOf(from));
|
||||
if (!nsfw) {
|
||||
uriBuilder.appendQueryParameter("nsfw", String.valueOf(nsfw).toLowerCase());
|
||||
}
|
||||
if (!Helper.isNullOrEmpty(relatedTo)) {
|
||||
uriBuilder.appendQueryParameter("related_to", relatedTo);
|
||||
}
|
||||
|
||||
@@ -1878,7 +1878,8 @@ public final class Predefined {
|
||||
new Language("no", "Norwegian", R.string.norwegian),
|
||||
new Language("ro", "Romanian", R.string.romanian),
|
||||
new Language("hi", "Hindi", R.string.hindi),
|
||||
new Language("el", "Greek", R.string.greek)
|
||||
new Language("el", "Greek", R.string.greek),
|
||||
new Language("ca", "Catalan", R.string.catalan)
|
||||
);
|
||||
|
||||
public static final String LICENSE_COPYRIGHTED = "Copyrighted";
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
android:id="@+id/welcome_wait_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
android:visibility="gone">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@@ -23,14 +24,16 @@
|
||||
android:id="@+id/welcome_progress_bar"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<TextView
|
||||
android:id="@+id/welcome_wait_text"
|
||||
android:fontFamily="@font/inter"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/welcome_please_wait"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textColor="@color/white"
|
||||
android:textFontWeight="300" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
android:id="@+id/splash_view"
|
||||
android:visibility="gone"
|
||||
android:background="@color/lbryGreen"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:enabled="false"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/invite" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_toRightOf="@id/reward_driver_icon"
|
||||
android:fontFamily="@font/inter"
|
||||
android:lineHeight="18dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textColor="@color/white"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -69,11 +69,22 @@
|
||||
android:textFontWeight="300" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/wallet_buy_lbc_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/buy_lbc"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_hint_convert_credits"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="@font/inter"
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionNext" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -95,11 +96,12 @@
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/wallet_send"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/send"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -0,0 +1,187 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/comment_form_card"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/comment_as"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300" />
|
||||
<ProgressBar
|
||||
android:id="@+id/comment_form_channels_loading"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/comment_form_channel_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<include layout="@layout/container_inline_channel_form" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/comment_form_reply_to_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
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" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginRight="40dp">
|
||||
<TextView
|
||||
android:id="@+id/comment_form_replying_to_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/replying_to"
|
||||
android:textColor="@color/lightGrey"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_form_reply_to_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:lineSpacingMultiplier="1.05"
|
||||
android:fontFamily="@font/inter"
|
||||
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_alignParentRight="true"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_close"
|
||||
android:tint="@color/foreground" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp">
|
||||
<RelativeLayout
|
||||
android:id="@+id/comment_form_avatar_container"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp">
|
||||
<RelativeLayout
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bg_channel_icon"
|
||||
android:id="@+id/comment_form_no_thumbnail"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:visibility="invisible">
|
||||
<TextView
|
||||
android:id="@+id/comment_form_thumbnail_alpha"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:textFontWeight="300" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:layout_centerInParent="true"
|
||||
android:id="@+id/comment_form_thumbnail"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/comment_form_avatar_container"
|
||||
android:layout_marginLeft="16dp">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/comment_form_body"
|
||||
android:hint="@string/comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="300"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLength="2000"
|
||||
android:singleLine="false"
|
||||
android:scrollbars="vertical"
|
||||
android:textSize="14sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_form_text_limit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="2dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/lightGrey"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<RelativeLayout
|
||||
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" />
|
||||
<ProgressBar
|
||||
android:id="@+id/comment_form_post_progress"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/comment_form_post"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -115,6 +115,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/create"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -128,12 +128,18 @@
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/pip_player"
|
||||
<RelativeLayout
|
||||
android:id="@+id/pip_player_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/black"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="invisible" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/pip_player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
+60
-19
@@ -9,7 +9,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
<TextView
|
||||
android:id="@+id/tip_send_title"
|
||||
android:id="@+id/create_support_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
@@ -22,19 +22,58 @@
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/divider"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="4dp" />
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_support_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send_tip_info_content"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/lightDivider"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/channel_to_show_support_as" />
|
||||
<ProgressBar
|
||||
android:id="@+id/create_support_channel_progress"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/create_support_channel_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/tip_input_layout_amount"
|
||||
android:id="@+id/create_support_input_layout_amount"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/amount">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/tip_input_amount"
|
||||
android:id="@+id/create_support_input_amount"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="match_parent"
|
||||
@@ -43,8 +82,8 @@
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip_input_currency"
|
||||
android:layout_toRightOf="@id/tip_input_layout_amount"
|
||||
android:id="@+id/create_support_input_currency"
|
||||
android:layout_toRightOf="@id/create_support_input_layout_amount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
@@ -56,8 +95,8 @@
|
||||
android:textFontWeight="300" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tip_inline_balance_container"
|
||||
android:layout_toRightOf="@id/tip_input_currency"
|
||||
android:id="@+id/create_support_inline_balance_container"
|
||||
android:layout_toRightOf="@id/create_support_input_currency"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -69,7 +108,7 @@
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<TextView
|
||||
android:id="@+id/tip_inline_balance_value"
|
||||
android:id="@+id/create_support_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
@@ -78,14 +117,15 @@
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip_info"
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/create_support_make_tip_switch"
|
||||
android:checked="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/make_this_a_tip"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send_tip_info_content"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -93,7 +133,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/tip_cancel_link"
|
||||
android:id="@+id/create_support_cancel_link"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -105,19 +145,20 @@
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/tip_send_progress"
|
||||
android:id="@+id/create_support_progress"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_toLeftOf="@id/tip_send"
|
||||
android:layout_toLeftOf="@id/create_support_send"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tip_send"
|
||||
android:id="@+id/create_support_send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/send"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send_lbc_tip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
@@ -182,6 +182,7 @@
|
||||
android:id="@+id/repost_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/repost"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
@@ -95,7 +95,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:tabGravity="center" />
|
||||
android:paddingLeft="110dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="scrollable"/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/channel_view_icon_container"
|
||||
android:layout_width="80dp"
|
||||
@@ -208,14 +210,22 @@
|
||||
android:clickable="true"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/channel_view_icon_follow_unfollow"
|
||||
<io.lbry.browser.ui.controls.OutlineIconView
|
||||
android:id="@+id/channel_view_icon_follow"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/channel_view_icon_unfollow"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textSize="20dp"
|
||||
android:visibility="invisible"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
<ProgressBar
|
||||
android:id="@+id/channel_comments_progress"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/channel_comments_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/container_comment_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/channel_no_comments"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/no_comments"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/channel_comments_sdk_initializing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/sdk_initializing_comments"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/channel_comments_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
@@ -37,7 +37,6 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_claim_display_area"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
@@ -45,8 +44,7 @@
|
||||
android:id="@+id/file_view_media_container"
|
||||
android:background="@color/mediaContainerBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3.55">
|
||||
android:layout_height="246dp">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_media_meta_container"
|
||||
android:clickable="true"
|
||||
@@ -67,6 +65,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:visibility="invisible"
|
||||
android:text="@string/play" />
|
||||
<LinearLayout
|
||||
@@ -165,8 +165,7 @@
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/file_view_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="6.45"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
@@ -296,7 +295,7 @@
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/tip"
|
||||
android:text="@string/support"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
@@ -469,49 +468,111 @@
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_name_area"
|
||||
android:id="@+id/file_view_publisher_info_area"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_name"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:layout_toLeftOf="@id/file_view_icon_follow">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="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">
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_thumbnail_alpha"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:textFontWeight="300" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:layout_centerHorizontal="true"
|
||||
android:id="@+id/file_view_publisher_thumbnail"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_name_area"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="600" />
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textFontWeight="600"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_follow_unfollow"
|
||||
|
||||
<io.lbry.browser.ui.controls.OutlineIconView
|
||||
android:id="@+id/file_view_icon_follow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_unfollow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textSize="20dp"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
@@ -568,7 +629,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_related_content_area"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp">
|
||||
<RelativeLayout
|
||||
@@ -587,7 +648,7 @@
|
||||
android:id="@+id/file_view_related_content_progress"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
@@ -609,6 +670,76 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@color/divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_comments_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
<ProgressBar
|
||||
android:id="@+id/file_view_comments_progress"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/comments"
|
||||
android:textSize="16sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/container_comment_form" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_no_comments"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/no_comments"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_comments_sdk_initializing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/sdk_initializing_comments"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/file_view_comments_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
@@ -616,6 +747,7 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_imageviewer_container"
|
||||
android:background="@android:color/black"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
@@ -194,6 +194,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
<include layout="@layout/card_reward_driver"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp" />
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<include layout="@layout/card_invites_by_link" />
|
||||
|
||||
|
||||
@@ -100,14 +100,13 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/publish_upload_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="148.5dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toRightOf="@id/publish_vertical_divider"
|
||||
android:clickable="true"
|
||||
android:background="@android:color/black"
|
||||
android:clickable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/publish_photo_upload_divider"
|
||||
android:layout_toRightOf="@id/publish_vertical_divider">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -576,8 +576,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/publish"
|
||||
android:fontFamily="@font/inter" />
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/publish" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/gerbil_happy" />
|
||||
<TextView
|
||||
android:text="@string/no_channel_created"
|
||||
android:text="@string/no_publishes_created"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
android:id="@+id/verification_email_continue_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/continue_text" />
|
||||
<ProgressBar
|
||||
android:id="@+id/verification_email_add_progress"
|
||||
@@ -132,6 +133,7 @@
|
||||
android:layout_weight="3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/resend" />
|
||||
|
||||
<View
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/continue_text" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -67,6 +67,7 @@
|
||||
android:id="@+id/verification_phone_continue_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/continue_text" />
|
||||
<ProgressBar
|
||||
android:id="@+id/verification_phone_new_progress"
|
||||
@@ -129,6 +130,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/verify" />
|
||||
<ProgressBar
|
||||
android:id="@+id/verification_phone_verify_progress"
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/done" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/comment_avatar_container"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp">
|
||||
<RelativeLayout
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bg_channel_icon"
|
||||
android:id="@+id/comment_no_thumbnail"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp">
|
||||
<TextView
|
||||
android:id="@+id/comment_thumbnail_alpha"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/white"
|
||||
android:textFontWeight="300" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:layout_centerHorizontal="true"
|
||||
android:id="@+id/comment_thumbnail"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/comment_avatar_container"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/comment_channel_name"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/comment_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/lightGrey"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="300"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_reply_link"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/reply"
|
||||
android:textFontWeight="300"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/comment_replies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
@@ -53,7 +53,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:lineHeight="14dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:fontFamily="@font/inter"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="8"
|
||||
|
||||
@@ -102,6 +102,22 @@
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/lightGrey"
|
||||
android:textSize="12sp"
|
||||
android:textFontWeight="300" />
|
||||
android:textFontWeight="300"
|
||||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/transaction_pending_text"
|
||||
android:gravity="right"
|
||||
android:layout_weight="4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/inter"
|
||||
android:singleLine="true"
|
||||
android:text="@string/pending"
|
||||
android:textColor="@color/lightGrey"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="italic"
|
||||
android:textFontWeight="300"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,4 +1,4 @@
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<string name="app_name">LBRY</string>
|
||||
<string name="navigation_drawer_open">Maak navigasie-laai oop</string>
|
||||
<string name="navigation_drawer_close">Maak navigasielade toe</string>
|
||||
@@ -59,6 +59,10 @@
|
||||
<string name="report">Rapporteer</string>
|
||||
<string name="loading_decentralized_data">Laai gedesentraliseerde data...</string>
|
||||
<string name="related_content">Verwante Content</string>
|
||||
<string name="comments">Kommentaar</string>
|
||||
<string name="no_comments">Op die oomblik is daar geen kommentaar om te vertoon nie.</string>
|
||||
<string name="sdk_initializing_comments">Opmerkings sal vertoon word nadat die agtergronddiens geïnialiseer is.</string>
|
||||
<string name="comment_error">U opmerking kon tans nie geplaas word nie. Probeer asseblief weer later.</string>
|
||||
<string name="share_lbry_content">Deel LBRY-inhoud</string>
|
||||
<string name="view">Beskou</string>
|
||||
<string name="play">Speel</string>
|
||||
@@ -78,6 +82,26 @@
|
||||
<string name="confirm_delete_content_message">Is u seker dat u hierdie inhoud wil publiseer? Geen lêers sal van u toestel verwyder word nie.</string>
|
||||
<string name="content_deleted">Die inhoud is suksesvol uit die blockchain verwyder.</string>
|
||||
<string name="content_failed_delete">Die inhoud kon tans nie uitgevee word nie. Probeer asseblief weer later.</string>
|
||||
<string name="comment">Kommentaar</string>
|
||||
<string name="comment_as">Lewer kommentaar as</string>
|
||||
<string name="please_enter_comment">Voer \'n opmerking in om te plaas.</string>
|
||||
<string name="please_select_channel">Kies \'n kanaal om u kommentaar as.</string>
|
||||
<string name="comment_posted">U kommentaar is suksesvol geplaas.</string>
|
||||
<string name="please_select_repost_channel">Kies \'n kanaal om weer op te plaas.</string>
|
||||
<string name="reply">Antwoord</string>
|
||||
<string name="replying_to">Antwoord op %1$s</string>
|
||||
<plurals name="post_and_tip">
|
||||
<item quantity="one">Post en fooi %1$s krediete?</item>
|
||||
<item quantity="other">Post en fooi %1$s krediete?</item>
|
||||
</plurals>
|
||||
<plurals name="post_for_credits">
|
||||
<item quantity="one">Pos vir %1$s krediete</item>
|
||||
<item quantity="other">Pos vir %1$s krediete</item>
|
||||
</plurals>
|
||||
<plurals name="confirm_post_comment">
|
||||
<item quantity="one">Dit lewer u kommentaar met \'n fooi van %1$s krediete vir %2$s</item>
|
||||
<item quantity="other">Dit lewer u kommentaar met \'n fooi van %1$s krediete vir %2$s</item>
|
||||
</plurals>
|
||||
<plurals name="view_count">
|
||||
<item quantity="one">%1$s uitsig</item>
|
||||
<item quantity="other">%1$s uitsig</item>
|
||||
@@ -98,6 +122,7 @@
|
||||
</plurals>
|
||||
|
||||
<!-- Publish -->
|
||||
<string name="no_publishes_created">Dit lyk asof u nog nie inhoud aan LBRY gepubliseer het nie.</string>
|
||||
<string name="record">Rekord</string>
|
||||
<string name="take_photo">Neem \'n Foto</string>
|
||||
<string name="upload_file">Laai \'n lêer op</string>
|
||||
@@ -120,6 +145,7 @@
|
||||
<string name="show_extra_fields">Toon ekstra velde</string>
|
||||
<string name="hide_extra_fields">Steek ekstra velde weg</string>
|
||||
<string name="no_file_found">Geen lêer gevind om te publiseer nie.</string>
|
||||
<string name="publish_invalid_claim_type">Ongeldige eis gespesifiseer vir redigering.</string>
|
||||
<string name="video_optimization">Videooptimalisering</string>
|
||||
<string name="thumbnail_creation_failed">\'N Kleinkiekie kan nie outomaties vanuit u inhoudslêer geskep word nie.</string>
|
||||
<string name="video_being_optimized">U video word geoptimaliseer vir beter ondersteuning op \'n wye verskeidenheid toestelle. U kan die oorblywende velde hieronder invul terwyl dit aan die gang is.</string>
|
||||
@@ -168,7 +194,6 @@
|
||||
<string name="romanian">Roemeens</string>
|
||||
<string name="hindi">Hindi</string>
|
||||
<string name="greek">Griekse</string>
|
||||
|
||||
<string name="none">Geen</string>
|
||||
<string name="public_domain">Publieke Domein</string>
|
||||
<string name="copyrighted">Kopiereg</string>
|
||||
@@ -208,6 +233,7 @@
|
||||
<!-- Settings -->
|
||||
<string name="user_interface">Inhoud & Gebruikerskoppelvlak</string>
|
||||
<string name="other">Ander</string>
|
||||
<string name="enable_background_playback">Aktiveer agtergrondweergawe</string>
|
||||
<string name="enable_dark_mode">Aktiveer donker tema</string>
|
||||
<string name="show_mature_content">Wys volwasse inhoud</string>
|
||||
<string name="show_url_suggestions">Wys URL-voorstelle</string>
|
||||
@@ -301,6 +327,11 @@
|
||||
<string name="tx_list_fee">belasting %1$s</string>
|
||||
<string name="transaction_history">Transaksiegeskiedenis</string>
|
||||
|
||||
<string name="unlock">Ontsluit</string>
|
||||
<string name="unlock_tips">Ontsluit wenke?</string>
|
||||
<string name="confirm_unlock_tips">Is u seker dat u al u wenke wil ontsluit?</string>
|
||||
<string name="min_spend_required">Voer \'n bedrag van meer as 0,0001 krediete in.</string>
|
||||
|
||||
<plurals name="you_sent_credits">
|
||||
<item quantity="one">U het %1$s krediete gestuur</item>
|
||||
<item quantity="other">U het %1$s krediete gestuur</item>
|
||||
@@ -384,6 +415,7 @@
|
||||
<string name="verify">Verifieer</string>
|
||||
<string name="please_enter_valid_phone">Voer \'n geldige telefoonnommer in.</string>
|
||||
<string name="please_enter_verification_code">Voer die verifikasiekode in wat na u telefoonnommer gestuur is.</string>
|
||||
<string name="fetch_current_user_error">Gebruikersrekening kon op hierdie stadium nie opgespoor word nie. Probeer asseblief weer later.</string>
|
||||
|
||||
<!-- Forms -->
|
||||
<string name="no_added_tags">U het nog geen merkers bygevoeg nie. Voeg etikette by om die ontdekking te verbeter.</string>
|
||||
@@ -463,6 +495,22 @@
|
||||
<item quantity="other">%1$s beskikbare krediete</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Reward drivers -->
|
||||
<string name="publishing_requires_credits">Uitgewerswese vereis krediete.</string>
|
||||
<string name="channel_creation_requires_credits">Skepping van kanale vereis krediete.</string>
|
||||
<string name="earn_rewards_for_inviting">Verdien belonings vir die uitnodiging van u vriende.</string>
|
||||
<string name="earn_some_credits_to_access">Verdien krediete om toegang tot hierdie inhoud te verkry.</string>
|
||||
<string name="tap_here_to_get_some">Tik hier om gratis te kry.</string>
|
||||
<string name="free_credits_available">Gratis krediete beskikbaar in belonings.</string>
|
||||
<plurals name="wallet_signed_in_free_credits">
|
||||
<item quantity="one">%1$s gratis krediete beskikbaar in belonings.</item>
|
||||
<item quantity="other">%1$s gratis krediete beskikbaar in belonings.</item>
|
||||
</plurals>
|
||||
<plurals name="wallet_get_free_credits">
|
||||
<item quantity="one">Kry %1$s gratis krediete nadat u \'n account geskep het.</item>
|
||||
<item quantity="other">Kry %1$s gratis krediete nadat u \'n account geskep het.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Invites -->
|
||||
<string name="lbry_invite_program">LBRY Uitnodigingsprogram</string>
|
||||
<string name="earn_extra_credits_invites">U kan ekstra krediete verdien vir elke persoon wat u uitnooi om LBRY te gebruik.</string>
|
||||
|
||||
@@ -0,0 +1,613 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<string name="app_name">LBRY</string>
|
||||
<string name="navigation_drawer_open">Obre el menú de navegació</string>
|
||||
<string name="navigation_drawer_close">Tanca el menú de navegació</string>
|
||||
|
||||
<!-- Nav menu -->
|
||||
<string name="find_content">Explora continguts</string>
|
||||
<string name="your_content">El teu contingut</string>
|
||||
<string name="wallet">Cartera</string>
|
||||
<string name="following">Seguint</string>
|
||||
<string name="editors_choice">Selecció de l\'editor</string>
|
||||
<string name="your_tags">Les teves etiquetes</string>
|
||||
<string name="all_content">Tot el contingut</string>
|
||||
<string name="channels">Canals</string>
|
||||
<string name="library">Llibreria</string>
|
||||
<string name="publishes">Publicacions</string>
|
||||
<string name="new_publish">Nova publicació</string>
|
||||
<string name="rewards">Recompenses</string>
|
||||
<string name="invites">Invitacions</string>
|
||||
<string name="settings">Configuració</string>
|
||||
<string name="about">Quant a</string>
|
||||
<string name="sign_in">Inicia sessió</string>
|
||||
<string name="startup_failed">Error en iniciar l\'aplicació. Sisplau, comprova la teva connexió i torna a intentar-ho. Si el problema persisteix, sisplau envia un correu a hello@lbry.com</string>
|
||||
<string name="no_claim_search_content">No hi ha contingut per mostrar en aquest moment. Sisplau, canvia la teva selecció o comprova-ho més tard.</string>
|
||||
|
||||
<!-- Welcome Page -->
|
||||
<string name="welcome_to_lbry">Benvingut a LBRY</string>
|
||||
<string name="welcome_paragraph">LBRY és una plataforma de contingut controlada per la comunitat on pots trobar i publicar vídeos, música, llibres i més.</string>
|
||||
<string name="welcome_tos">En continuar, accepto les <a href=\"https://lbry.com/termsofservice\">Condicions de Servei</a> i confirmo que tinc més de 13 anys.</string>
|
||||
<string name="welcome_please_wait">Sisplau, espera mentre preparem algunes coses...</string>
|
||||
<string name="use_lbry">Empra LBRY »</string>
|
||||
|
||||
<!-- URI bar -->
|
||||
<string name="uri_placeholder">Cerca vídeos, música i més</string>
|
||||
|
||||
<!-- Following page -->
|
||||
<string name="find_channels_to_follow">Troba canals per seguir</string>
|
||||
<string name="channels_you_follow">Canals que segueixes</string>
|
||||
<string name="discover">Descobreix</string>
|
||||
<string name="lbry_works_better">LBRY funciona millor si segueixes almenys 5 creadors que t\'agradin. Inicia la sessió per mostrar els creadors que segueixes si ja tens un compte.</string>
|
||||
<string name="select_five_subscriptions">Sisplau, selecciona fins a 5 creadors per continuar.</string>
|
||||
<string name="n_remaining">%1$d restant...</string>
|
||||
<string name="done">Fet</string>
|
||||
<string name="all">Tot</string>
|
||||
<string name="discover_channels">Descobreix canals nous</string>
|
||||
|
||||
<!-- Claim lists -->
|
||||
<string name="anonymous">Anònim</string>
|
||||
|
||||
<!-- File view -->
|
||||
<string name="tags">Etiquetes</string>
|
||||
<string name="share">Comparteix</string>
|
||||
<string name="repost">Republica</string>
|
||||
<string name="tip">Propina</string>
|
||||
<string name="edit">Edita</string>
|
||||
<string name="delete">Elimina</string>
|
||||
<string name="download">Descarrega</string>
|
||||
<string name="open">Obre</string>
|
||||
<string name="report">Denuncia</string>
|
||||
<string name="loading_decentralized_data">Carregant dades descentralitzades...</string>
|
||||
<string name="related_content">Contingut relacionat</string>
|
||||
<string name="comments">Comentaris</string>
|
||||
<string name="no_comments">No hi ha comentaris per mostrar en aquest moment.</string>
|
||||
<string name="sdk_initializing_comments">Els comentaris es mostraran quan el servei s\'hagi inicialitzat en segon pla.</string>
|
||||
<string name="comment_error">El teu comentari no s\'ha pogut publicar en aquest moment. Sisplau, torna a intentar-ho més tard.</string>
|
||||
<string name="share_lbry_content">Comparteix contingut de LBRY</string>
|
||||
<string name="view">Visualitza</string>
|
||||
<string name="play">Reprodueix</string>
|
||||
<string name="unsupported_content">Contingut no suportat</string>
|
||||
<string name="unsupported_content_desc">Ho sentim, no podem mostrar aquest contingut a l\'aplicació. Pots trobar el fitxer %1$s a la teva carpeta de descàrregues.</string>
|
||||
<string name="nothing_at_this_location">No hi ha res aquí.</string>
|
||||
<string name="publish_something_here">Publica quelcom aquí</string>
|
||||
<string name="cannot_view_claim">No es pot accedir a aquest contingut en aquest moment. Sisplau, prova-ho més tard.</string>
|
||||
<string name="zero_duration">0:00</string>
|
||||
<string name="claim_file_not_found">El fitxer a \"%1$s\" no existeix.</string>
|
||||
<string name="confirm_purchase">Confirma la compra</string>
|
||||
<string name="delete_file">Elimina el fitxer</string>
|
||||
<string name="confirm_delete_file_message">Segur que vols esborrar aquest fitxer del teu dispositiu?</string>
|
||||
<string name="unable_to_view_url">Error en carregar %1$s. Sisplau, torna a intentar-ho més tard.</string>
|
||||
<string name="no_cast_session_available">No hi ha cap sessió de cast disponible en aquest moment.</string>
|
||||
<string name="delete_content">Eliminar contingut?</string>
|
||||
<string name="confirm_delete_content_message">Segur que vols deixar de publicar aquest contingut? No s\'esborrarà cap fitxer del teu dispositiu.</string>
|
||||
<string name="content_deleted">El contingut s\'ha eliminat correctament de la cadena de blocs</string>
|
||||
<string name="content_failed_delete">El contingut no s\'ha pogut eliminar en aquest moment. Sisplau, intenta-ho més tard.</string>
|
||||
<string name="comment">Comenta</string>
|
||||
<string name="comment_as">Comenta com a</string>
|
||||
<string name="please_enter_comment">Sisplau, introdueix un comentari per publicar.</string>
|
||||
<string name="please_select_channel">Sisplau, selecciona un canal amb el qual publicar el teu comentari.</string>
|
||||
<string name="comment_posted">El teu comentari s\'ha publicat correctament.</string>
|
||||
<string name="please_select_repost_channel">Sisplau, selecciona un canal on republicar.</string>
|
||||
<string name="reply">Respon</string>
|
||||
<string name="replying_to">Responent a %1$s</string>
|
||||
<plurals name="post_and_tip">
|
||||
<item quantity="one">Publicar i donar %1$s crèdit en propina?</item>
|
||||
<item quantity="other">Publicar i donar %1$s crèdits en propina?</item>
|
||||
</plurals>
|
||||
<plurals name="post_for_credits">
|
||||
<item quantity="one">Publica per %1$s crèdit</item>
|
||||
<item quantity="other">Publica per %1$s crèdits</item>
|
||||
</plurals>
|
||||
<plurals name="confirm_post_comment">
|
||||
<item quantity="one">Així es publicarà el teu comentari amb una propina de %1$s crèdits per %2$s</item>
|
||||
<item quantity="other">Així es publicarà el teu comentari amb una propina de %1$s crèdits per %2$s</item>
|
||||
</plurals>
|
||||
<plurals name="view_count">
|
||||
<item quantity="one">%1$s visualització</item>
|
||||
<item quantity="other">%1$s visualitzacions</item>
|
||||
</plurals>
|
||||
<plurals name="confirm_purchase_message">
|
||||
<item quantity="one">Així es comprarà \"%1$s\" per %2$s crèdit</item>
|
||||
<item quantity="other">Així es comprarà \"%1$s\" per %2$s crèdits</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Channel view -->
|
||||
<string name="no_channel_info">Encara no hi ha res aquí.\nSisplau, mira-ho més tard.</string>
|
||||
<string name="content">Contingut</string>
|
||||
<string name="website">Lloc web</string>
|
||||
<string name="reposted">republicat</string>
|
||||
<plurals name="follower_count">
|
||||
<item quantity="one">%1$s seguidor</item>
|
||||
<item quantity="other">%1$s seguidors</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Publish -->
|
||||
<string name="no_publishes_created">Sembla que encara no has publicat contingut a LBRY.</string>
|
||||
<string name="record">Enregistra</string>
|
||||
<string name="take_photo">Fes una foto</string>
|
||||
<string name="upload_file">Puja un fitxer</string>
|
||||
<string name="no_videos_found">No trobat cap vídeo al teu dispositiu. Fes una foto o enregistra un vídeo per començar.</string>
|
||||
<string name="loading_videos">Sisplau, espera mentre carreguem els teus vídeos...</string>
|
||||
<string name="storage_permission_rationale_videos">LBRY necessita accés per poder mostrar i publicar els teus vídeos, imatges i altres fitxer des del teu dispositiu.</string>
|
||||
<string name="camera_permission_rationale_record">LBRY necessita tenir accés a la teva càmera per enregistrar vídeos.</string>
|
||||
<string name="camera_permission_rationale_photo">LBRY necessita tenir accés a la teva càmera per fer fotos. </string>
|
||||
<string name="edit_content">Edita contingut</string>
|
||||
<string name="mature_tags">Etiquetes per a adults</string>
|
||||
<string name="price">Preu</string>
|
||||
<string name="free_publish">El teu contingut serà gratis. Pitja el botó per establir-ne un preu</string>
|
||||
<string name="content_address">Adreça de contingut</string>
|
||||
<string name="randomize">Aleatoritza</string>
|
||||
<string name="address">Adreça</string>
|
||||
<string name="content_address_desc">L\'adreça en la qual la gent pot trobar el teu contingut (ex. lbry://elmeuvideo)</string>
|
||||
<string name="license">Llicència</string>
|
||||
<string name="license_desc">Descripció de la llicència</string>
|
||||
<string name="additional_options">Opcions addicionals</string>
|
||||
<string name="show_extra_fields">Mostra camps addicionals</string>
|
||||
<string name="hide_extra_fields">Amaga camps addicionals</string>
|
||||
<string name="no_file_found">No s\'ha trobat fitxer per publicar.</string>
|
||||
<string name="publish_invalid_claim_type">Reclamació invàlida especificada per editar.</string>
|
||||
<string name="video_optimization">Optimització de vídeo</string>
|
||||
<string name="thumbnail_creation_failed">No s\'ha pogut crear automàticament una miniatura del teu fitxer de contingut.</string>
|
||||
<string name="video_being_optimized">El teu vídeo s\'està optimitzant per un suport millor en un ample ventall de dispositius. Pots omplir els camps a sota mentre dura aquest procés.</string>
|
||||
<string name="video_optimized">El teu vídeo s\'ha optimitzat correctament per una millor reproducció en tants dispositius com sigui possible. Sisplau, continua per publicar el teu contingut.</string>
|
||||
<string name="video_optimize_failed">El teu vídeo no s\'ha pogut optimitzar. El fitxer es pujarà sense cap canvi.</string>
|
||||
<string name="completed_video_duration">Durada del vídeo complet: %1$s</string>
|
||||
<string name="sdk_initializing_publish">No pots publicar contingut ara mateix perquè el servei encara s\'està inicialitzant en segon pla.</string>
|
||||
<string name="publish_successful">El teu contingut s\'ha publicat correctament. Pot trigar uns moments a aparèixer a la cadena de blocs.</string>
|
||||
<string name="transcode_in_progress">L\'optimització del vídeo està en progrés. Si vols cancel·lar, pitja Cancel·la al final de la pàgina.</string>
|
||||
<string name="optimization_in_progress">L\'optimització del vídeo està en progrés.</string>
|
||||
<string name="cannot_capture_video">No hi ha cap aplicació de càmera disponible per enregistrar vídeos en aquest dispositiu.</string>
|
||||
<string name="cannot_take_photo">No hi ha cap aplicació de càmera per fer fotos en aquest dispositiu.</string>
|
||||
|
||||
<string name="please_provide_title">Sisplau, proporciona un títol.</string>
|
||||
<string name="please_specify_address">Sisplau, especifica una adreça en la qual la gent pugui trobar el teu contingut.</string>
|
||||
<string name="address_invalid_characters">La teva adreça de contingut conté caràcters invàlids.</string>
|
||||
<string name="address_already_used">Ja has publicat a l\'adreça de contingut especificada. Sisplau, introdueix una adreça nova.</string>
|
||||
<string name="no_file_selected">No s\'ha seleccionat cap fitxer. Sisplau, tria un vídeo, fes una foto, o selecciona un fitxer abans de publicar.</string>
|
||||
<string name="price_amount_not_set">Sisplau, introdueix un preu o desactiva el botó per fer que el teu contingut sigui gratis.</string>
|
||||
<string name="publish_no_thumbnail">Sisplau, selecciona una miniatura per pujar abans de publicar.</string>
|
||||
<string name="publish_thumbnail_in_progress">Sisplau, espera que s\'acabi de carregar la miniatura abans de publicar.</string>
|
||||
|
||||
<string name="language">Idioma</string>
|
||||
<string name="english">Anglès</string>
|
||||
<string name="chinese">Xinès</string>
|
||||
<string name="french">Francès</string>
|
||||
<string name="german">Alemany</string>
|
||||
<string name="japanese">Japonès</string>
|
||||
<string name="russian">Rus</string>
|
||||
<string name="spanish">Castellà</string>
|
||||
<string name="indonesian">Indonesi</string>
|
||||
<string name="italian">Italià</string>
|
||||
<string name="dutch">Neerlandès</string>
|
||||
<string name="turkish">Turc</string>
|
||||
<string name="polish">Polac</string>
|
||||
<string name="malay">Malai</string>
|
||||
<string name="portuguese">Portuguès</string>
|
||||
<string name="vietnamese">Vietnamita</string>
|
||||
<string name="thai">Tailandès</string>
|
||||
<string name="arabic">Àrab</string>
|
||||
<string name="czech">Txec</string>
|
||||
<string name="croatian">Croat</string>
|
||||
<string name="cambodian">Khmer</string>
|
||||
<string name="korean">Coreà</string>
|
||||
<string name="norwegian">Noruec</string>
|
||||
<string name="romanian">Romanès</string>
|
||||
<string name="hindi">Hindi</string>
|
||||
<string name="greek">Grec</string>
|
||||
<string name="none">Cap</string>
|
||||
<string name="public_domain">Domini públic</string>
|
||||
<string name="copyrighted">Amb Copyright</string>
|
||||
<string name="cca_4_0_international">Creative Commons Attribution 4.0 International</string>
|
||||
<string name="cca_sa_4_0_international">Creative Commons Attribution-ShareAlike 4.0 International</string>
|
||||
<string name="cca_nd_4_0_international">Creative Commons Attribution-NoDerivatives 4.0 International</string>
|
||||
<string name="cca_nc_4_0_international">Creative Commons Attribution-NonCommercial 4.0 International</string>
|
||||
<string name="cca_nc_sa_4_0_international">Creative Commons Attribution-NonCommercial 4.0 International</string>
|
||||
<string name="cca_nc_nd_4_0_international">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International</string>
|
||||
|
||||
<string-array name="publish_currencies">
|
||||
<item>LBC</item>
|
||||
<item>USD</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Publishes -->
|
||||
<string name="one_or_more_publishes_failed_abandon">Un o més ítems de contingut no s\'han pogut eliminar en aquest moment. Sisplau, torna a intentar-ho més tard.</string>
|
||||
<plurals name="confirm_delete_publishes">
|
||||
<item quantity="one">Segur que vols eliminar l\'ítem de contingut seleccionat?</item>
|
||||
<item quantity="other">Segur que vols eliminar els ítems de contingut seleccionats?</item>
|
||||
</plurals>
|
||||
<plurals name="publishes_deleted">
|
||||
<item quantity="one">L\'ítem de contingut seleccionat s\'ha eliminat correctament.</item>
|
||||
<item quantity="other">Els ítems de contingut seleccionats s\'han eliminat correctament.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Splash -->
|
||||
<string name="oops_something_went_wrong">Ups! Alguna cosa ha anat malament.</string>
|
||||
<string name="installation_id_loaded">ID d\'instal·lació carregada.</string>
|
||||
<string name="known_tags_loaded">S\'han carregat les etiquetes conegudes i seguides.</string>
|
||||
<string name="exchange_rate_loaded">S\'ha carregat la taxa d\'intercanvi LBC/USD.</string>
|
||||
<string name="user_authenticated">Usuari autenticat.</string>
|
||||
<string name="installation_registered">Instal·lació registrada.</string>
|
||||
<string name="subscriptions_loaded">Subscripcions carregades.</string>
|
||||
<string name="subscriptions_resolved">Subscripcions resoltes.</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="user_interface">Contingut i interfície d\'usuari</string>
|
||||
<string name="other">Altres</string>
|
||||
<string name="enable_background_playback">Habilita la reproducció en segon pla</string>
|
||||
<string name="enable_dark_mode">Activa el mode fosc</string>
|
||||
<string name="show_mature_content">Mostra contingut per a adults</string>
|
||||
<string name="show_url_suggestions">Mostra suggerències d\'URL</string>
|
||||
<string name="notifications">Notificacions</string>
|
||||
<string name="subscriptions">Subscripcions</string>
|
||||
<string name="content_interests">Contingut interessant</string>
|
||||
|
||||
<string name="keep_sdk_in_background">Deixa el servei de LBRY executant-se en segon pla per millorar el rendiment de la cartera i de la xarxa</string>
|
||||
<string name="participate_in_data_network">Participa en la xarxa de dades (requereix reiniciar l\'aplicació i el servei en segon pla)</string>
|
||||
|
||||
<!-- URL suggestions -->
|
||||
<string name="search_url_title">%1$s - Cercar</string>
|
||||
<string name="tag_url_title">%1$s - Etiqueta</string>
|
||||
<string name="search_url_desc">Cerca per \'%1$s\'</string>
|
||||
<string name="explore_tag_url_desc">Explora l\'etiqueta \'%1$s\'</string>
|
||||
<string name="view_file_url_desc">Visualitza el contingut a %1$s</string>
|
||||
<string name="view_channel_url_desc">Visualitza el canal %1$s</string>
|
||||
|
||||
<!-- Search -->
|
||||
<string name="search_no_results">No s\'han trobat resultats per \'%1$s\', Sisplau, introdueix termes de cerca diferents.</string>
|
||||
<string name="search_no_query">Pots cercar qualsevol cosa, incloent pel·lícules, música, ebooks, software i més.</string>
|
||||
<string name="no_related_content">No hi ha contingut relacionat per mostrar en aquest moment.</string>
|
||||
|
||||
<!-- Wallet -->
|
||||
<string name="balance">Balanç</string>
|
||||
<string name="you_currently_have">Ara tens</string>
|
||||
<string name="convert_credits">Pots convertir els teus crèdits a USD i retirar la quantitat convertida emprant un intercanvi. <a href=\"https://lbry.com/faq/exchanges\">Aprèn-ne més</a>.</string>
|
||||
<string name="convert_credits_bittrex"><a href=\"https://bittrex.com/Account/Register?referralCode=4M1-P30-BON\">Converteix crèdits a USD a Bittrex</a></string>
|
||||
<string name="you_also_have">També tens</string>
|
||||
<string name="you_staked">Has invertit</string>
|
||||
<string name="in_tips">en propines</string>
|
||||
<string name="in_your_publishes">en les teves publicacions</string>
|
||||
<string name="in_your_supports">en els teus suports</string>
|
||||
<string name="earn_more_tips">Obtén més propines pujant vídeos genials</string>
|
||||
<string name="sdk_initializing">El servei en segon pla s\'està inicialitzant...</string>
|
||||
<string name="sdk_still_initializing">El servei en segon pla encara s\'està inicialitzant. Pots explorar i veure contingut mentrestant.</string>
|
||||
<string name="sdk_initializing_functionality">No pots fer això ara perquè el servei en segon pla encara s\'està inicialitzant.</string>
|
||||
|
||||
<string name="backup_synced">Una còpia de seguretat de la teva cartera està sincronitzada amb lbry.tv.</string>
|
||||
<string name="backup_notsynced">La teva cartera no està sincronitzada amb lbry.tv ara mateix. Ets responsable de mantenir les còpies de seguretat de la teva cartera.</string>
|
||||
<string name="synced_what_does_this_mean"><a href=\"https://lbry.com/faq/account-sync\">Què vol dir això?</a></string>
|
||||
<string name="backup_what_does_this_mean"><a href=\"https://lbry.com/faq/how-to-backup-wallet#android\">Què vol dir això?</a></string>
|
||||
|
||||
<string name="receive_credits">Rep crèdits</string>
|
||||
<string name="use_this_address_hint">Empra aquesta adreça de la cartera per rebre crèdits enviats per un altre usuari (o tu mateix).</string>
|
||||
<string name="get_new_address">Obtén una adreça nova</string>
|
||||
<string name="generate_address_hint">Pots generar una adreça nova en qualsevol moment, i qualsevol adreça anterior seguirà funcionant. Emprar diverses adreces pot ajudar-te a fer un seguiment de pagaments rebuts des de diverses fonts.</string>
|
||||
|
||||
<string name="send_credits">Envia crèdits</string>
|
||||
<string name="recipient_address">Adreça del destinatari</string>
|
||||
<string name="recipient_address_placeholder">bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs</string>
|
||||
<string name="amount">Quantitat</string>
|
||||
<string name="send">Enviat</string>
|
||||
|
||||
<string name="recent_transactions">Transaccions recents</string>
|
||||
<string name="view_all">Visualitza-ho tot</string>
|
||||
<string name="receive">Rep</string>
|
||||
<string name="spend">Gasta</string>
|
||||
<string name="publish">Publica</string>
|
||||
<string name="support">Suport</string>
|
||||
<string name="abandon">Abandona</string>
|
||||
<string name="channel">Canal</string>
|
||||
<string name="channel_update">Actualització del canal</string>
|
||||
<string name="publish_update">Actualització de la publicació</string>
|
||||
|
||||
<string name="wallet_sync">Sincronització de la cartera</string>
|
||||
<string name="sync_status">Estat de la sincronització</string>
|
||||
<string name="on">Activada</string>
|
||||
<string name="off">Desactivada</string>
|
||||
<string name="email">Correu electrònic</string>
|
||||
<string name="no_connected_email">Cap correu electrònic connectat</string>
|
||||
<string name="manual_backup"><a href=\"https://lbry.com/faq/how-to-backup-wallet#android\">Còpia manual</a></string>
|
||||
<string name="sync_faq"><a href=\"https://lbry.com/faq/how-to-backup-wallet#sync\">FAQs de sincronització</a></string>
|
||||
<string name="zero">0</string>
|
||||
<string name="lbc">LBC</string>
|
||||
|
||||
<string name="account_recommended">Quantitat recomanada</string>
|
||||
<string name="wallet_account_desc">Un compte de lbry.tv et permet obtenir recompenses, fer còpies de seguretat de la teva cartera, i tenir-ho tot sincronitzat.</string>
|
||||
<string name="wallet_without_account">Sense un compte, assumeixes tota la responsabilitat d\'assegurar la teva cartera i dades de LBRY.</string>
|
||||
<string name="skip_account">Ometre compte</string>
|
||||
<string name="sign_up">Registra\'t</string>
|
||||
<string name="address_copied">Adreça copiada</string>
|
||||
|
||||
<string name="invalid_recipient_address">Sisplau, introdueix una adreça vàlida per enviar-hi crèdits</string>
|
||||
<string name="insufficient_balance">Balanç insuficient</string>
|
||||
<string name="invalid_amount">Sisplau, introdueix una quantitat vàlida</string>
|
||||
<string name="send_credit_error">Els teus crèdits no s\'han pogut enviar en aquest moment. Sisplau, torna a intentar-ho més tard.</string>
|
||||
<string name="loading_transactions">Carregant transaccions...</string>
|
||||
<string name="no_recent_transactions">No hi ha transaccions recents per mostrar.</string>
|
||||
<string name="no_transactions">No hi ha transaccions per mostrar en aquest moment.</string>
|
||||
<string name="tx_list_fee">quota %1$s</string>
|
||||
<string name="transaction_history">Historial de transaccions</string>
|
||||
|
||||
<string name="unlock">Desbloca</string>
|
||||
<string name="unlock_tips">Desblocar propines?</string>
|
||||
<string name="confirm_unlock_tips">Segur que vols desblocar totes les teves propines?</string>
|
||||
<string name="min_spend_required">Sisplau, introdueix una quantitat mínima de 0.0001 crèdits.</string>
|
||||
|
||||
<plurals name="you_sent_credits">
|
||||
<item quantity="one">Has enviat %1$s crèdit</item>
|
||||
<item quantity="other">Has enviat %1$s crèdits</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Dialogs -->
|
||||
<string name="customize_your_tags">Presonalitza les teves etiquetes</string>
|
||||
<string name="sort_content_by">Ordena el contingut per</string>
|
||||
<string name="content_from">Contingut de</string>
|
||||
<string name="trending_content">Contingut tendència</string>
|
||||
<string name="new_content">Contingut nou</string>
|
||||
<string name="top_content">Contingut destacat</string>
|
||||
<string name="trending">Tendència</string>
|
||||
<string name="top">Destacat</string>
|
||||
<string name="new_text">Nou</string>
|
||||
<string name="past_24_hours">Últimes 24 hores</string>
|
||||
<string name="past_week">Última setmana</string>
|
||||
<string name="past_month">Últim mes</string>
|
||||
<string name="past_year">Últim any</string>
|
||||
<string name="all_time">Per sempre</string>
|
||||
<string name="from">des de</string>
|
||||
<string name="for_text">per</string>
|
||||
<string name="filter_for">Filtra per</string>
|
||||
<string name="everyone">Tothom</string>
|
||||
<string name="tags_you_follow">Etiquetes que segueixes</string>
|
||||
<string name="customize">Personalitza</string>
|
||||
<string name="not_yet_implemented">La vista seleccionada encara no està disponible</string>
|
||||
<string name="customize_tags_hint">Sembla que encara no segueixes cap etiqueta.</string>
|
||||
<string name="search_for_more_tags">Cerca més etiquetes</string>
|
||||
<string name="no_followed_tags">No segueixes cap etiqueta encara. Comença afegint les etiquetes que t\'interessin!</string>
|
||||
<string name="no_tag_results">No hem pogut trobar etiquetes noves que no estiguis seguint.</string>
|
||||
<string name="tag_already_added">L\'etiqueta \'%1$s\' ja s\'ha afegit.</string>
|
||||
<string name="tag_limit_reached">No pots afegir més de 5 etiquetes.</string>
|
||||
<string name="send_a_tip">Envia una propina</string>
|
||||
<string name="send_a_tip_to">Envia una propina a %1$s</string>
|
||||
<string name="send_tip_info_content">Això apareixerà com una propina per %1$s, i n\'augmentarà l\'habilitat de ser descobert mentre estigui activa. <a href=\"https://lbry.com/faq/tipping\">Aprèn-ne més</a>.</string>
|
||||
<string name="send_tip_info_channel">Això apareixerà com una propina per %1$s, i augmentarà l\'habilitat del canal de ser descobert mentre estigui activa. <a href=\"https://lbry.com/faq/tipping\">Aprèn-ne més</a>.</string>
|
||||
<string name="cancel">Cancel·la</string>
|
||||
<string name="repost_title">Republica %1$s</string>
|
||||
<string name="repost_your_favorite">Republica el teu contingut preferit per ajudar més gent a descobrir-lo!</string>
|
||||
<string name="channel_to_post_on">Canal per publicar</string>
|
||||
<string name="show_advanced">Mostra avançat</string>
|
||||
<string name="hide_advanced">Amaga avançat</string>
|
||||
<string name="name">Nom</string>
|
||||
<string name="min_deposit">0.001</string>
|
||||
<string name="content_successfully_reposted">El contingut s\'ha republicat correctament!</string>
|
||||
<string name="repost_name_invalid_characters">El nom de republicació conté caràcters invàlids.</string>
|
||||
<plurals name="you_sent_a_tip">
|
||||
<item quantity="one">Has enviat %1$s crèdit com a propina. Mahalo!</item>
|
||||
<item quantity="other">Has enviat %1$s crèdits com a propina, Mahalo!</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Verification -->
|
||||
<string name="provide_email_address">Sisplau, introdueix una direcció de correu electrònic.</string>
|
||||
<string name="email_placeholder">tu@exemple.com</string>
|
||||
<string name="email_sent_to">S\'ha enviat un correu a</string>
|
||||
<string name="please_click_link">Sisplau, fes clic a l\'enllaç del missatge per completar l\'inici de sessió.</string>
|
||||
<string name="resend">Reenvia</string>
|
||||
<string name="continue_text">Continua</string>
|
||||
<string name="provide_valid_email">Sisplau, introdueix una direcció de correu electrònic vàlida</string>
|
||||
<string name="please_follow_instructions">Sisplau, segueix les instruccions al correu que hem enviat a la teva direcció per continuar.</string>
|
||||
<string name="sign_in_successful">Has iniciat sessió a lbry.tv correctament</string>
|
||||
<string name="retrieving_account_information">Obtenint la informació del teu compte...</string>
|
||||
<string name="apply_wallet_data">Aplicant dades de la cartera...</string>
|
||||
<string name="please_enter_your_password">Sisplau, introdueix la contrasenya que has emprat per protegir la teva cartera.</string>
|
||||
<string name="please_enter_a_password">Sisplau, introdueix una contrasenya per protegir la teva cartera.</string>
|
||||
<string name="wallet_security_purposes">Nota: per qüestions de seguretat, LBRY no pot restablir la teva contrasenya.</string>
|
||||
<string name="password">Contrasenya</string>
|
||||
<string name="enable_sync">Permet sincronització</string>
|
||||
<string name="wallet_sync_op_failed">No s\'ha pogut completar la sincronització de la cartera. Sisplau, torna a intentar-ho més tard. Si el problema persisteix, et preguem que enviïs un correu a hello@lbry.com.</string>
|
||||
<string name="phone_number">Número de telèfon</string>
|
||||
<string name="enter_phone_number">Sisplau, introdueix el teu número de telèfon.</string>
|
||||
<string name="not_interested">No m\'interessa</string>
|
||||
<string name="manual_reward_verification">Verificació de recompenses manual</string>
|
||||
<string name="account_undergo_review">Aquest compte ha de passar per una revissió abans que puguis participar en el programa de recompenses. Això pot trigar des d\'uns minuts fins a alguns dies.</string>
|
||||
<string name="request_to_be_verified">Si segueixes veient aquest missatge, sol·licita que et verifiquin al <a href=\"https://discordapp.com/invite/Z3bERWA\">servidor de LBRY a Discord</a>.</string>
|
||||
<string name="enjoy_free_content">Gaudeix del contingut gratis mentrestant!</string>
|
||||
<string name="verify_phone_number">Verifica el número de telèfon</string>
|
||||
<string name="enter_phone_verify_code">Sisplau, introdueix el codi de verificació enviat a %1$s</string>
|
||||
<string name="code_placeholder">0000</string>
|
||||
<string name="verify">Verifica</string>
|
||||
<string name="please_enter_valid_phone">Sisplau, introdueix un número de telèfon vàlid.</string>
|
||||
<string name="please_enter_verification_code">Sisplau, introdueix el codi de verificació enviat al teu número de telèfon.</string>
|
||||
<string name="fetch_current_user_error">El compte d\'usuari no s\'ha pogut recuperar. Sisplau, torna a internar-ho més tard.</string>
|
||||
|
||||
<!-- Forms -->
|
||||
<string name="no_added_tags">No has afegit cap etiqueta encara. Afegeix etiquetes per millorar la descoberta.</string>
|
||||
<string name="form_no_tag_results">No hem pogut trobar etiquetes noves que no s\'hagin afegit encara.</string>
|
||||
|
||||
<!-- Channels -->
|
||||
<string name="no_channel_created">No has creat cap canal,\nComença ara creant un canal!</string>
|
||||
<string name="create_a_channel">Crea un canal</string>
|
||||
<string name="create_a_channel_item">Crea un canal...</string>
|
||||
<string name="edit_channel">Edita el canal</string>
|
||||
<string name="delete_selection">Eliminar selecció?</string>
|
||||
<string name="delete_channel">Eliminar el canal?</string>
|
||||
<string name="confirm_delete_channel">Segur que vols eliminar aquest canal?</string>
|
||||
<string name="channel_deleted">El canal s\'ha eliminat correctament.</string>
|
||||
<string name="channel_failed_delete">No s\'ha pogut eliminar el canal en aquest moment. Sisplau, torna a intentar-ho més tard.</string>
|
||||
<string name="description">Descripció</string>
|
||||
<string name="yes">Sí</string>
|
||||
<string name="no">No</string>
|
||||
<string name="show_optional_fields">Mostra camps opcionals</string>
|
||||
<string name="hide_optional_fields">Amaga camps opcionals</string>
|
||||
<string name="save">Desa</string>
|
||||
<string name="channel_name">Canvia el nom</string>
|
||||
<string name="title">Títol</string>
|
||||
<string name="at">\@</string>
|
||||
<string name="deposit">Dipòsit</string>
|
||||
<string name="deposit_remains_yours">Aquests LBC seguiran sent teus. Això és un dipòsit per reservar el nom i pots revertir-lo en qualsevol moment.</string>
|
||||
<string name="storage_permission_rationale_download">LBRY necessita accés per descarregar contingut al teu dispositiu.</string>
|
||||
<string name="storage_permission_rationale_images">LBRY necessita accés per carregar imatges des de l\'emmagatzemament del teu dispositiu.</string>
|
||||
<string name="select_thumbnail">Selecciona miniatura</string>
|
||||
<string name="select_cover">Selecciona la imatge de portada</string>
|
||||
<string name="undetermined_image_filepath">La direcció del fitxer no s\'ha pogut determinar per la imatge seleccionada. Sisplau, selecciona una imatge en una altra ubicació.</string>
|
||||
<string name="wait_for_upload">Sisplau, espera que la pujada actual acabi.</string>
|
||||
<string name="image_upload_failed">La petició per pujar la imatge ha fallat. Sisplau, torna a intentar-ho.</string>
|
||||
<string name="uploading">Pujant...</string>
|
||||
<string name="please_enter_channel_name">Sisplau, introdueix un nom de canal.</string>
|
||||
<string name="channel_name_invalid_characters">El nom del teu canal conté caràcters invàlids.</string>
|
||||
<string name="channel_name_already_created">Ja has creat un canal amb el mateix nom.</string>
|
||||
<string name="please_enter_valid_deposit">Sisplau, introdueix una quantitat vàlida pel dipòsit.</string>
|
||||
<string name="deposit_more_than_balance">El dipòsit no pot ser major que el teu balanç.</string>
|
||||
<string name="channel_save_failed">La petició per desar aquest canal ha fallat. Sisplau, torna a intentar-ho.</string>
|
||||
<string name="channel_save_successful">El canal s\'ha desat correctament.</string>
|
||||
<string name="item_pending_blockchain">La reclamació està pendent de publicar-se a la cadena de blocs. Podràs accedir-hi o editar-la d\'aquí uns moments.</string>
|
||||
<string name="pending">Pendent</string>
|
||||
<string name="create">Crea</string>
|
||||
<string name="one_or_more_channels_failed_abandon">Un o més canals no s\'han pogut eliminar en aquest moment. Sisplau, torna a intentar-ho més tard.</string>
|
||||
<plurals name="min_deposit_required">
|
||||
<item quantity="one">Es necessita un dipòsit mínim d\'%1$s crèdit. </item>
|
||||
<item quantity="other">Es necessita un dipòsit mínim de %1$s crèdits.</item>
|
||||
</plurals>
|
||||
<plurals name="confirm_delete_channels">
|
||||
<item quantity="one">Segur que vols eliminar el canal seleccionat?</item>
|
||||
<item quantity="other">Segur que vols eliminar els canals seleccionats?</item>
|
||||
</plurals>
|
||||
<plurals name="channels_deleted">
|
||||
<item quantity="one">El canal s\'ha eliminat correctament.</item>
|
||||
<item quantity="other">Els canals s\'han eliminat correctament.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Rewards -->
|
||||
<string name="lbry_credits_allow">Els crèdits de LBRY et permeten publicar o comprar contingut.</string>
|
||||
<string name="free_credits_worth">Pots obtenir crèdits gratuïtament per valor de %1$s després de donar una adreça de correu electrònic.</string>
|
||||
<string name="rewards_learn_more"><a href=\"https://lbry.com/faq/earn-credits\">Aprèn-ne més</a>.</string>
|
||||
<string name="get_started">Comença</string>
|
||||
<string name="reward_code_placeholder">abc123</string>
|
||||
<string name="claim">Reclama</string>
|
||||
<string name="please_enter_claim_code">Sisplau, introdueix un codi de recompensa personalitzat per reclamar.</string>
|
||||
<string name="unclaimed">No reclamat</string>
|
||||
<string name="custom_reward_title">Codi personalitzat</string>
|
||||
<string name="up_to">fins a</string>
|
||||
<string name="custom_reward_description">Ets un supermodel o una estrella del rock que ha rebut un codi de recompensa personalitzat? Reclama\'l aquí.</string>
|
||||
<plurals name="claim_reward_message">
|
||||
<item quantity="one">Has reclamat %1$s crèdit com a recompensa.</item>
|
||||
<item quantity="other">Has reclamat %1$s crèdits com a recompensa.</item>
|
||||
</plurals>
|
||||
<plurals name="available_credits">
|
||||
<item quantity="one">%1$s crèdit disponible</item>
|
||||
<item quantity="other">%1$s crèdits disponibles</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Reward drivers -->
|
||||
<string name="publishing_requires_credits">Necessites crèdits per publicar.</string>
|
||||
<string name="channel_creation_requires_credits">Necessites crèdits per crear un canal.</string>
|
||||
<string name="earn_rewards_for_inviting">Guanya recompenses per invitar els teus amics.</string>
|
||||
<string name="earn_some_credits_to_access">Obtén alguns crèdits per poder accedir a aquest contingut.</string>
|
||||
<string name="tap_here_to_get_some">Pica aquí per aconseguir-ne gratis.</string>
|
||||
<string name="free_credits_available">Crèdits gratis disponibles en recompenses.</string>
|
||||
<plurals name="wallet_signed_in_free_credits">
|
||||
<item quantity="one">%1$s crèdit gratis disponible en recompenses.</item>
|
||||
<item quantity="other">%1$s crèdits gratis disponibles en recompenses.</item>
|
||||
</plurals>
|
||||
<plurals name="wallet_get_free_credits">
|
||||
<item quantity="one">Obtén %1$s crèdit gratis després de crear un compte.</item>
|
||||
<item quantity="other">Obtén %1$s crèdits gratis després de crear un compte</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Invites -->
|
||||
<string name="lbry_invite_program">Programa d\'invitació de LBRY</string>
|
||||
<string name="earn_extra_credits_invites">Pots guanyar més crèdits per cada persona que invitis a emprar LBRY.</string>
|
||||
<string name="invites_learn_more"><a href=\"https://lbry.com/faq/invites\">Aprèn-ne més</a>.</string>
|
||||
<string name="invite_link">Enllaç d\'invitació</string>
|
||||
<string name="share_this_link">Comparteix aquest enllaç amb amics (o enemics) i obtén crèdits quan s\'uneixin a lbry.tv.</string>
|
||||
<string name="your_invite_link">El teu enllaç d\'invitació.</string>
|
||||
<string name="customize_invite_link">Personalitza l\'enllaç d\'invitació</string>
|
||||
<string name="invite_by_email">Invita per correu</string>
|
||||
<string name="invite_someone">Invita algú que coneguis per correu i guanyaràs crèdits quan s\'uneixin a lbry.tv.</string>
|
||||
<string name="invite_email_placeholder">amic@imaginari.com</string>
|
||||
<string name="invite">Invita</string>
|
||||
<string name="invite_history">Historial d\'invitacions</string>
|
||||
<string name="earn_credits_for_inviting">Guanya crèdits per invitar un amic, un enemic, o un amidversari. Tothom necessita llibertat de continguts.</string>
|
||||
<string name="reward">Recompensa</string>
|
||||
<string name="claimed">Reclamat</string>
|
||||
<string name="claimable">Reclamable</string>
|
||||
<string name="unclaimable">No reclamable</string>
|
||||
<string name="invite_link_copied">Enllaç d\'invitació copiat.</string>
|
||||
<string name="invite_sent_to">Invitació enviada a %1$s</string>
|
||||
|
||||
<!-- Library -->
|
||||
<string name="downloads">Descàrregues</string>
|
||||
<string name="purchases">Compres</string>
|
||||
<string name="history">Historial</string>
|
||||
<string name="library_no_downloads">No has descarregat cap contingut a aquest dispositiu.</string>
|
||||
<string name="library_no_history">No has visualitzat cap contingut en aquest dispositiu,</string>
|
||||
<string name="library_no_purchases">No has comprat cap contingut amb el teu compte.</string>
|
||||
<string name="hide">Amaga</string>
|
||||
<string name="stats">Estadístiques</string>
|
||||
<string name="video">Vídeo</string>
|
||||
<string name="audio">Audio</string>
|
||||
<string name="images">Imatges</string>
|
||||
<string name="mb">MB</string>
|
||||
<string name="kb">KB</string>
|
||||
<string name="gb">GB</string>
|
||||
<string name="zero_mb">0MB</string>
|
||||
<plurals name="confirm_delete_files">
|
||||
<item quantity="one">Segur que vols eliminar el fitxer seleccionat del teu dispositiu?</item>
|
||||
<item quantity="other">Segur que vols eliminar els fitxers seleccionats del teu dispositiu?</item>
|
||||
</plurals>
|
||||
<plurals name="files_deleted">
|
||||
<item quantity="one">El fitxer s\'ha eliminat correctament.</item>
|
||||
<item quantity="other">Els fitxers s\'han eliminat correctament.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- About -->
|
||||
<string name="about_lbry">Quant a LBRY</string>
|
||||
<string name="content_freedom">Llibertat de continguts</string>
|
||||
<string name="about_paragraph">LBRY és un mercat digital lliure, obert i mantingut per la comunitat. És una plataforma d\'igual-a-igual descentralitzada de distribució de contiguts per a creadors per pujar i compartir continguts, i obtenir crèdits de LBRY pels seus esforços. Els usuaris poden trobar una ampla selecció de vídeos, música, ebooks i altres continguts digitals que puguin interessar-los.</string>
|
||||
<string name="get_social">Comença a socialitzar</string>
|
||||
<string name="social_paragraph">Pots interactuar amb l\'equip de LBRY i membres de la comunitat a Discord, Facebook, Instagram, Twitter o Reddit.</string>
|
||||
<string name="app_info">Informació de l\'aplicació</string>
|
||||
<string name="loading">Carregant...</string>
|
||||
<string name="about_link_what_is_lbry"><a href=\"https://lbry.com/faq/what-is-lbry\">Què és LBRY?</a></string>
|
||||
<string name="about_link_android_basics"><a href=\"https://lbry.com/faq/android-basics\">Bàsic d\'Android</a></string>
|
||||
<string name="about_link_faq"><a href=\"https://lbry.com/faq\">FAQs</a></string>
|
||||
<string name="about_link_discord"><a href=\"https://discordapp.com/invite/Z3bERWA\">Discord</a></string>
|
||||
<string name="about_link_facebook"><a href=\"https://www.facebook.com/LBRYio\">Facebook</a></string>
|
||||
<string name="about_link_instagram"><a href=\"https://www.instagram.com/LBRYio\">Instagram</a></string>
|
||||
<string name="about_link_reddit"><a href=\"https://reddit.com/r/lbry\">Reddit</a></string>
|
||||
<string name="about_link_telegram"><a href=\"https://t.me/lbryofficial\">Telegram</a></string>
|
||||
<string name="about_link_twitter"><a href=\"https://twitter.com/LBRYio\">Twitter</a></string>
|
||||
<string name="update_mailing_preferences">Actualitza la configuració de correu</string>
|
||||
<string name="app_version">Versió de l\'aplicació</string>
|
||||
<string name="lbry_sdk">SDK de LBRY</string>
|
||||
<string name="platform">Plataforma</string>
|
||||
<string name="installation_id">ID d\'instal·lació</string>
|
||||
<string name="firebase_token">Token de Firebase</string>
|
||||
<string name="logs">Registres</string>
|
||||
<string name="send_log">Envia registres</string>
|
||||
<string name="connected_email">Correu electrònic connectat</string>
|
||||
<string name="unknown">Desconegut</string>
|
||||
<string name="cannot_find_lbrynet_log">No s\'ha pogut trobar el fitxer lbrynet.log.</string>
|
||||
<string name="cannot_share_lbrynet_log">El fitxer lbrynet.log no s\'ha pogut compartir per manca de permisos.</string>
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<string name="fa_gift"></string>
|
||||
<string name="fa_lock"></string>
|
||||
<string name="fa_coins"></string>
|
||||
<string name="fa_file"></string>
|
||||
<string name="fa_hashtag"></string>
|
||||
<string name="fa_search"></string>
|
||||
<string name="fa_at"></string>
|
||||
|
||||
<string name="fa_heart"></string>
|
||||
<string name="fa_heart_broken"></string>
|
||||
<string name="fa_star"></string>
|
||||
<string name="fa_globe_americas"></string>
|
||||
<string name="fa_upload"></string>
|
||||
<string name="fa_download"></string>
|
||||
<string name="fa_cloud_upload"></string>
|
||||
<string name="fa_wallet"></string>
|
||||
<string name="fa_award"></string>
|
||||
<string name="fa_user_friends"></string>
|
||||
<string name="fa_cog"></string>
|
||||
<string name="fa_mobile_alt"></string>
|
||||
<string name="fa_repost"></string>
|
||||
<string name="fa_folder_open"></string>
|
||||
</resources>
|
||||
Loaded 100 of 116 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user