Compare commits
51 commits
Author | SHA1 | Date | |
---|---|---|---|
|
fdd759b241 | ||
|
57cd649c02 | ||
|
7250435d7f | ||
|
b81abf74a1 | ||
|
208e2c2d42 | ||
|
a5bdd1c042 | ||
|
1e3a74cae1 | ||
|
ca08f71a72 | ||
|
b60ca39df1 | ||
|
696bc86b7c | ||
|
4c163c6244 | ||
|
2ad49ca281 | ||
|
56caeef72b | ||
|
84bb014557 | ||
|
9278e74e85 | ||
|
cf6f09c60d | ||
|
f2cbed48d9 | ||
|
f1ead0c247 | ||
|
5f2c72ec4d | ||
|
a6869eb2e6 | ||
|
cbae6c476a | ||
|
48d257ceaf | ||
|
5355456498 | ||
|
1436895ace | ||
|
6e32f7724f | ||
|
3f5104d60a | ||
|
d8fdb3b818 | ||
|
5c187e7a8d | ||
|
24862550a1 | ||
|
146fced44e | ||
|
d535ed8c98 | ||
|
b675dbad9b | ||
|
dabe9fe691 | ||
|
9ac216504d | ||
|
911ca998e7 | ||
|
36c105d3a7 | ||
|
a655d0112b | ||
|
493c771e94 | ||
|
e9d70dbf87 | ||
|
0849ce2b66 | ||
|
d0a8b3b218 | ||
|
a8cdc4a771 | ||
|
67b883660f | ||
|
f328efb831 | ||
|
b2f56364d6 | ||
|
2761857fe8 | ||
|
d439260d69 | ||
|
f0f0a5028b | ||
|
13e170cb61 | ||
|
127d8052ca | ||
|
1b3086572f |
190 changed files with 1986 additions and 1284 deletions
1
.github/workflows/deploy.yml
vendored
Normal file
1
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -66,3 +66,4 @@ app/twitter.properties
|
|||
*.hprof
|
||||
app/build
|
||||
bin
|
||||
app/debuglib
|
||||
|
|
|
@ -9,8 +9,8 @@ build apk:
|
|||
image: lbry/android-base:platform-28
|
||||
before_script:
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' >> /etc/apt/sources.list
|
||||
- wget -qO - 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' | apt-key add -
|
||||
- apt-get -y update && apt-get -y install build-essential ca-certificates curl git gpg-agent openjdk-8-jdk software-properties-common wget zipalign git-secret
|
||||
- git secret reveal
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
|
@ -36,8 +36,8 @@ deploy build.lbry.io:
|
|||
before_script:
|
||||
- apt-get -y update && apt-get -y install apt-transport-https
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' >> /etc/apt/sources.list
|
||||
- wget -qO - 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' | apt-key add -
|
||||
- apt-get -y update && apt-get -y install openjdk-8-jdk git git-secret
|
||||
- pip install awscli
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
|
@ -60,8 +60,8 @@ release apk:
|
|||
before_script:
|
||||
- apt-get -y update && apt-get -y install apt-transport-https
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' >> /etc/apt/sources.list
|
||||
- wget -qO - 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' | apt-key add -
|
||||
- apt-get -y update && apt-get -y install openjdk-8-jdk git git-secret
|
||||
- pip install awscli githubrelease
|
||||
- git secret reveal
|
||||
|
|
|
@ -28,6 +28,8 @@ twitterConsumerKey=XXXXXX
|
|||
twitterConsumerSecret=XXXXXX
|
||||
```
|
||||
|
||||
Copy the file 'google-services.sample.json' to 'google-services.json' in the app/ folder.
|
||||
|
||||
Click the Sync button and when process finishes, the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
|
||||
|
||||
## Contributing
|
||||
|
@ -37,7 +39,7 @@ Contributions to this project are welcome, encouraged, and compensated. For more
|
|||
This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it.
|
||||
|
||||
## Contact
|
||||
The primary contact for this project is [@akinwale](https://github.com/akinwale) (akinwale@lbry.com)
|
||||
|
|
|
@ -4,7 +4,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.1"
|
||||
buildToolsVersion "29.0.2"
|
||||
flavorDimensions "default"
|
||||
|
||||
compileOptions {
|
||||
|
@ -16,13 +16,12 @@ android {
|
|||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1614
|
||||
versionName "0.16.14"
|
||||
|
||||
versionCode 1701
|
||||
versionName "0.17.1"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
packagingOptions {
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'lib/x86_64/darwin/libscrypt.dylib'
|
||||
}
|
||||
|
@ -123,6 +122,9 @@ dependencies {
|
|||
implementation 'org.bitcoinj:bitcoinj-tools:0.14.7'
|
||||
implementation 'org.java-websocket:Java-WebSocket:1.5.1'
|
||||
|
||||
implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.10'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.10'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||
|
@ -133,8 +135,9 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.88.0'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.88.0'
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.102.0'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.102.0'
|
||||
//__64bitImplementation(name: 'lbrysdk', ext: 'aar')
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.lbry.browser"
|
||||
android:installLocation="auto">
|
||||
|
||||
|
@ -13,6 +14,8 @@
|
|||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
@ -98,6 +101,11 @@
|
|||
android:theme="@style/AppTheme.NoActionBarTranslucent"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
|
||||
<activity
|
||||
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||
android:screenOrientation="fullSensor"
|
||||
tools:replace="screenOrientation" />
|
||||
|
||||
<service
|
||||
android:name="io.lbry.browser.LbrynetMessagingService"
|
||||
android:exported="false">
|
||||
|
|
|
@ -172,8 +172,8 @@ public class FirstRunActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private static class CheckInstallIdTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Context context;
|
||||
private InstallIdHandler handler;
|
||||
private final Context context;
|
||||
private final InstallIdHandler handler;
|
||||
public CheckInstallIdTask(Context context, InstallIdHandler handler) {
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
|
@ -236,7 +236,7 @@ public class FirstRunActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private static class AuthenticateTask extends AsyncTask<Void, Void, Void> {
|
||||
private Context context;
|
||||
private final Context context;
|
||||
public AuthenticateTask(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class LbrynetMessagingService extends FirebaseMessagingService {
|
|||
String name = payload.get("name"); // notification name
|
||||
String hash = payload.get("hash"); // comment hash
|
||||
|
||||
if (type != null && getEnabledTypes().indexOf(type) > -1 && body != null && body.trim().length() > 0) {
|
||||
if (type != null && getEnabledTypes().contains(type) && body != null && body.trim().length() > 0) {
|
||||
// only log the receive event for valid notifications received
|
||||
if (firebaseAnalytics != null) {
|
||||
Bundle bundle = new Bundle();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.lbry.browser;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
|
@ -121,6 +122,7 @@ import java.io.InputStreamReader;
|
|||
import java.io.PrintStream;
|
||||
import java.net.ConnectException;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -224,6 +226,7 @@ import lombok.SneakyThrows;
|
|||
import okhttp3.OkHttpClient;
|
||||
|
||||
import static android.os.Build.VERSION_CODES.M;
|
||||
import static android.os.Build.VERSION_CODES.P;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements SdkStatusListener,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
|
@ -260,7 +263,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
public static boolean startingFilePickerActivity = false;
|
||||
public static boolean startingShareActivity = false;
|
||||
public static boolean startingPermissionRequest = false;
|
||||
public static boolean startingSignInFlowActivity = false;
|
||||
public static final boolean startingSignInFlowActivity = false;
|
||||
|
||||
private ActionMode actionMode;
|
||||
private BillingClient billingClient;
|
||||
|
@ -336,6 +339,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
|
||||
// preference keys
|
||||
public static final String PREFERENCE_KEY_BACKGROUND_PLAYBACK = "io.lbry.browser.preference.userinterface.BackgroundPlayback";
|
||||
public static final String PREFERENCE_KEY_MEDIA_AUTOPLAY = "io.lbry.browser.preference.userinterface.MediaAutoplay";
|
||||
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";
|
||||
|
@ -403,7 +407,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
private List<FetchClaimsListener> fetchClaimsListeners;
|
||||
private List<FetchChannelsListener> fetchChannelsListeners;
|
||||
@Getter
|
||||
private ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
private boolean walletBalanceUpdateScheduled;
|
||||
private boolean shouldOpenUserSelectedMenuItem;
|
||||
private boolean walletSyncScheduled;
|
||||
|
@ -680,6 +684,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return sp.getBoolean(PREFERENCE_KEY_BACKGROUND_PLAYBACK, true);
|
||||
}
|
||||
|
||||
public boolean isMediaAutoplayEnabled() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_MEDIA_AUTOPLAY, true);
|
||||
}
|
||||
|
||||
public boolean initialSubscriptionMergeDone() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE, false);
|
||||
|
@ -818,11 +827,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
walletBalanceListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void restoreWalletContainerPosition() {
|
||||
View floatingBalance = findViewById(R.id.floating_balance_main_container);
|
||||
|
||||
ObjectAnimator animation = ObjectAnimator.ofFloat(floatingBalance, "translationY", 0f);
|
||||
animation.setDuration(250).start();
|
||||
}
|
||||
|
||||
public void translateFloatingWallet(float initialY) {
|
||||
if (findViewById(R.id.floating_balance_main_container).getY() == initialY) {
|
||||
ObjectAnimator animation = ObjectAnimator.ofFloat(findViewById(R.id.floating_balance_main_container), "translationY", 2 * findViewById(R.id.floating_balance_main_container).getHeight());
|
||||
animation.setDuration(300).start();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeNavFragment(Class fragmentClass, int navItemId) {
|
||||
String key = buildNavFragmentKey(fragmentClass, navItemId, null);
|
||||
if (openNavFragments.containsKey(key)) {
|
||||
openNavFragments.remove(key);
|
||||
}
|
||||
openNavFragments.remove(key);
|
||||
}
|
||||
|
||||
public void addFetchChannelsListener(FetchChannelsListener listener) {
|
||||
|
@ -1016,7 +1037,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
openFragment(RewardsFragment.class, true, NavMenuItem.ID_ITEM_REWARDS);
|
||||
}
|
||||
|
||||
private FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() {
|
||||
private final FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() {
|
||||
@Override
|
||||
public void onBackStackChanged() {
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
|
@ -1250,7 +1271,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return sp.getBoolean(PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED, false);
|
||||
}
|
||||
|
||||
private void checkPurchases() {
|
||||
public void checkPurchases() {
|
||||
if (billingClient != null) {
|
||||
Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
|
||||
if (result.getPurchasesList() != null) {
|
||||
|
@ -1261,6 +1282,24 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}
|
||||
}
|
||||
|
||||
public void checkPurchases(GenericTaskHandler handler) {
|
||||
boolean purchaseFound = false;
|
||||
if (billingClient != null) {
|
||||
Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
|
||||
if (result.getPurchasesList() != null) {
|
||||
for (Purchase purchase : result.getPurchasesList()) {
|
||||
handlePurchase(purchase, handler);
|
||||
purchaseFound = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!purchaseFound) {
|
||||
handler.onError(new Exception(getString(R.string.skip_queue_purchase_not_found)));
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePurchase(Purchase purchase) {
|
||||
handleBillingPurchase(purchase, billingClient, MainActivity.this, null, new RewardVerifiedHandler() {
|
||||
@Override
|
||||
|
@ -1277,6 +1316,28 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
});
|
||||
}
|
||||
|
||||
private void handlePurchase(Purchase purchase, GenericTaskHandler handler) {
|
||||
handleBillingPurchase(purchase, billingClient, MainActivity.this, null, new RewardVerifiedHandler() {
|
||||
@Override
|
||||
public void onSuccess(RewardVerified rewardVerified) {
|
||||
if (Lbryio.currentUser != null) {
|
||||
Lbryio.currentUser.setRewardApproved(rewardVerified.isRewardApproved());
|
||||
}
|
||||
|
||||
if (handler != null) {
|
||||
handler.onSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
if (handler != null) {
|
||||
handler.onError(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkPendingOpens() {
|
||||
if (pendingFollowingReload) {
|
||||
loadFollowingContent();
|
||||
|
@ -1803,7 +1864,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
if (!Helper.isNullOrEmpty(encryptedAuthToken)) {
|
||||
try {
|
||||
Lbryio.AUTH_TOKEN = new String(Utils.decrypt(
|
||||
Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), "UTF8");
|
||||
Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), StandardCharsets.UTF_8);
|
||||
} catch (Exception ex) {
|
||||
// pass. A new auth token would have to be generated if the old one cannot be decrypted
|
||||
Log.e(TAG, "Could not decrypt existing auth token.", ex);
|
||||
|
@ -2041,7 +2102,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
if (nowPlayingClaimBitmap == null &&
|
||||
nowPlayingClaim != null &&
|
||||
!Helper.isNullOrEmpty(nowPlayingClaim.getThumbnailUrl())) {
|
||||
Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl()).into(new CustomTarget<Bitmap>() {
|
||||
Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl(0, 0, 75)).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
nowPlayingClaimBitmap = resource;
|
||||
|
@ -2720,15 +2781,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}
|
||||
|
||||
private Fragment getCurrentFragment() {
|
||||
int backCount = getSupportFragmentManager().getBackStackEntryCount();
|
||||
if (backCount > 0) {
|
||||
try {
|
||||
return getSupportFragmentManager().getFragments().get(backCount - 1);
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return getSupportFragmentManager().findFragmentById(R.id.content_main);
|
||||
}
|
||||
|
||||
public void hideActionBar() {
|
||||
|
@ -3003,10 +3056,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
} else {
|
||||
try {
|
||||
LbryUri uri = LbryUri.parse(url);
|
||||
String checkedURL = url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString();
|
||||
if (uri.isChannel()) {
|
||||
openChannelUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
|
||||
openChannelUrl(checkedURL);
|
||||
} else {
|
||||
openFileUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
|
||||
openFileUrl(checkedURL);
|
||||
}
|
||||
} catch (LbryUriException ex) {
|
||||
// pass
|
||||
|
@ -3262,8 +3316,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}
|
||||
|
||||
private static class CheckSdkReadyTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Context context;
|
||||
private List<SdkStatusListener> listeners;
|
||||
private final Context context;
|
||||
private final List<SdkStatusListener> listeners;
|
||||
|
||||
public CheckSdkReadyTask(Context context, List<SdkStatusListener> listeners) {
|
||||
this.context = context;
|
||||
|
@ -3433,6 +3487,18 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return;
|
||||
}
|
||||
|
||||
if (currentFragment != null && ((BaseFragment) currentFragment).getParams() != null
|
||||
&& ((BaseFragment) currentFragment).getParams().containsKey("source")
|
||||
&& ((BaseFragment) currentFragment).getParams().get("source").equals("notification")) {
|
||||
|
||||
Map<String, Object> currentParams = new HashMap<>(1);
|
||||
|
||||
if (((BaseFragment) currentFragment).getParams().containsKey("url"))
|
||||
currentParams.put("url", ((BaseFragment) currentFragment).getParams().get("url"));
|
||||
|
||||
((BaseFragment) currentFragment).setParams(currentParams);
|
||||
}
|
||||
|
||||
//fragment.setRetainInstance(true);
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction().replace(R.id.content_main, fragment);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
|||
private boolean signedIn;
|
||||
private int flow;
|
||||
|
||||
private PurchasesUpdatedListener purchasesUpdatedListener = new PurchasesUpdatedListener() {
|
||||
private final PurchasesUpdatedListener purchasesUpdatedListener = new PurchasesUpdatedListener() {
|
||||
@Override
|
||||
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> purchases) {
|
||||
int responseCode = billingResult.getResponseCode();
|
||||
|
@ -204,15 +204,16 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
|||
} else if (flow == VERIFICATION_FLOW_REWARDS) {
|
||||
User user = Lbryio.currentUser;
|
||||
// disable phone verification for now
|
||||
/*if (!user.isIdentityVerified()) {
|
||||
if (!user.isIdentityVerified()) {
|
||||
// phone number verification required
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
|
||||
flowHandled = true;
|
||||
} else */
|
||||
if (!user.isRewardApproved()) {
|
||||
// manual verification required
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
|
||||
flowHandled = true;
|
||||
} else {
|
||||
if (!user.isRewardApproved()) {
|
||||
// manual verification required
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
|
||||
flowHandled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,6 +226,11 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
|||
}
|
||||
}
|
||||
|
||||
public void showPhoneVerification() {
|
||||
ViewPager2 viewPager = findViewById(R.id.verification_pager);
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
|
||||
}
|
||||
|
||||
public void showLoading() {
|
||||
findViewById(R.id.verification_loading_progress).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.verification_pager).setVisibility(View.INVISIBLE);
|
||||
|
@ -238,8 +244,12 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// ignore back press
|
||||
return;
|
||||
ViewPager2 viewPager = findViewById(R.id.verification_pager);
|
||||
|
||||
if (viewPager.getCurrentItem() != VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL)
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL);
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void onEmailAdded(String email) {
|
||||
|
@ -296,20 +306,18 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
|||
ViewPager2 viewPager = findViewById(R.id.verification_pager);
|
||||
// for rewards, (show phone verification if not done, or manual verification if required)
|
||||
if (flow == VERIFICATION_FLOW_REWARDS) {
|
||||
// skipping phone verification
|
||||
/*if (!user.isIdentityVerified()) {
|
||||
if (!user.isIdentityVerified()) {
|
||||
// phone number verification required
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
|
||||
} else
|
||||
*/
|
||||
if (!user.isRewardApproved()) {
|
||||
|
||||
// manual verification required
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
|
||||
} else {
|
||||
// fully verified
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
if (!user.isRewardApproved()) {
|
||||
// manual verification required
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
|
||||
} else {
|
||||
// fully verified
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
} else if (flow == VERIFICATION_FLOW_WALLET) {
|
||||
// for wallet sync, if password unlock is required, show password entry page
|
||||
|
@ -347,6 +355,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
|||
return;
|
||||
}
|
||||
|
||||
findViewById(R.id.verification_close_button).setVisibility(View.VISIBLE);
|
||||
// show manual verification page if the user is still not reward approved
|
||||
ViewPager2 viewPager = findViewById(R.id.verification_pager);
|
||||
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
|
||||
|
|
|
@ -23,7 +23,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilterListAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private final Context context;
|
||||
private List<Claim> items;
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -42,12 +42,12 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected View mediaContainer;
|
||||
protected View alphaContainer;
|
||||
protected View allView;
|
||||
protected ImageView thumbnailView;
|
||||
protected TextView alphaView;
|
||||
protected TextView titleView;
|
||||
protected final View mediaContainer;
|
||||
protected final View alphaContainer;
|
||||
protected final View allView;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final TextView alphaView;
|
||||
protected final TextView titleView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
mediaContainer = v.findViewById(R.id.channel_filter_media_container);
|
||||
|
@ -95,7 +95,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
|
|||
vh.allView.setVisibility(claim.isPlaceholder() ? View.VISIBLE : View.GONE);
|
||||
|
||||
vh.titleView.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
|
||||
String thumbnailUrl = claim.getThumbnailUrl();
|
||||
String thumbnailUrl = claim.getThumbnailUrl(vh.thumbnailView.getLayoutParams().width, vh.thumbnailView.getLayoutParams().height, 85);
|
||||
if (!Helper.isNullOrEmpty(thumbnailUrl) && context != null) {
|
||||
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.listener.SelectionModeListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
|
@ -37,18 +36,18 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
|||
private static final int VIEW_TYPE_CHANNEL = 2;
|
||||
private static final int VIEW_TYPE_FEATURED = 3; // featured search result
|
||||
|
||||
private Map<String, Claim> quickClaimIdMap;
|
||||
private Map<String, Claim> quickClaimUrlMap;
|
||||
private Map<String, Boolean> notFoundClaimIdMap;
|
||||
private Map<String, Boolean> notFoundClaimUrlMap;
|
||||
private final Map<String, Claim> quickClaimIdMap;
|
||||
private final Map<String, Claim> quickClaimUrlMap;
|
||||
private final Map<String, Boolean> notFoundClaimIdMap;
|
||||
private final Map<String, Boolean> notFoundClaimUrlMap;
|
||||
|
||||
@Setter
|
||||
private boolean hideFee;
|
||||
@Setter
|
||||
private boolean canEnterSelectionMode;
|
||||
private Context context;
|
||||
private final Context context;
|
||||
private List<Claim> items;
|
||||
private List<Claim> selectedItems;
|
||||
private final List<Claim> selectedItems;
|
||||
@Setter
|
||||
private ClaimListItemListener listener;
|
||||
@Getter
|
||||
|
@ -176,27 +175,27 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected View feeContainer;
|
||||
protected TextView feeView;
|
||||
protected ImageView thumbnailView;
|
||||
protected View noThumbnailView;
|
||||
protected TextView alphaView;
|
||||
protected TextView vanityUrlView;
|
||||
protected TextView durationView;
|
||||
protected TextView titleView;
|
||||
protected TextView publisherView;
|
||||
protected TextView publishTimeView;
|
||||
protected TextView pendingTextView;
|
||||
protected View repostInfoView;
|
||||
protected TextView repostChannelView;
|
||||
protected View selectedOverlayView;
|
||||
protected TextView fileSizeView;
|
||||
protected ProgressBar downloadProgressView;
|
||||
protected TextView deviceView;
|
||||
protected final View feeContainer;
|
||||
protected final TextView feeView;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final View noThumbnailView;
|
||||
protected final TextView alphaView;
|
||||
protected final TextView vanityUrlView;
|
||||
protected final TextView durationView;
|
||||
protected final TextView titleView;
|
||||
protected final TextView publisherView;
|
||||
protected final TextView publishTimeView;
|
||||
protected final TextView pendingTextView;
|
||||
protected final View repostInfoView;
|
||||
protected final TextView repostChannelView;
|
||||
protected final View selectedOverlayView;
|
||||
protected final TextView fileSizeView;
|
||||
protected final ProgressBar downloadProgressView;
|
||||
protected final TextView deviceView;
|
||||
|
||||
protected View loadingImagePlaceholder;
|
||||
protected View loadingTextPlaceholder1;
|
||||
protected View loadingTextPlaceholder2;
|
||||
protected final View loadingImagePlaceholder;
|
||||
protected final View loadingTextPlaceholder1;
|
||||
protected final View loadingTextPlaceholder2;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
feeContainer = v.findViewById(R.id.claim_fee_container);
|
||||
|
@ -335,7 +334,8 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
|||
if (metadata instanceof Claim.StreamMetadata) {
|
||||
streamMetadata = (Claim.StreamMetadata) metadata;
|
||||
}
|
||||
String thumbnailUrl = item.getThumbnailUrl();
|
||||
|
||||
String thumbnailUrl = item.getThumbnailUrl(vh.thumbnailView.getLayoutParams().width, vh.thumbnailView.getLayoutParams().height, 85);
|
||||
long publishTime = (streamMetadata != null && streamMetadata.getReleaseTime() > 0) ? streamMetadata.getReleaseTime() * 1000 : item.getTimestamp() * 1000;
|
||||
int bgColor = Helper.generateRandomColorForValue(item.getClaimId());
|
||||
if (bgColor == 0) {
|
||||
|
|
|
@ -27,9 +27,9 @@ 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 final List<Comment> items;
|
||||
private final Context context;
|
||||
private final boolean nested;
|
||||
private float scale;
|
||||
@Setter
|
||||
private ClaimListAdapter.ClaimListItemListener listener;
|
||||
|
@ -102,14 +102,14 @@ public class CommentListAdapter extends RecyclerView.Adapter<CommentListAdapter.
|
|||
}
|
||||
|
||||
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;
|
||||
protected final TextView channelName;
|
||||
protected final TextView commentText;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final View noThumbnailView;
|
||||
protected final TextView alphaView;
|
||||
protected final TextView commentTimeView;
|
||||
protected final View replyLink;
|
||||
protected final RecyclerView repliesList;
|
||||
|
||||
public ViewHolder (View v) {
|
||||
super(v);
|
||||
|
@ -190,7 +190,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<CommentListAdapter.
|
|||
int bgColor = Helper.generateRandomColorForValue(comment.getChannelId());
|
||||
Helper.setIconViewBackgroundColor(holder.noThumbnailView, bgColor, false, context);
|
||||
if (hasThumbnail) {
|
||||
Glide.with(context.getApplicationContext()).asBitmap().load(comment.getPoster().getThumbnailUrl()).
|
||||
Glide.with(context.getApplicationContext()).asBitmap().load(comment.getPoster().getThumbnailUrl(holder.thumbnailView.getLayoutParams().width, holder.thumbnailView.getLayoutParams().height, 85)).
|
||||
apply(RequestOptions.circleCropTransform()).into(holder.thumbnailView);
|
||||
}
|
||||
holder.alphaView.setText(comment.getChannelName() != null ? comment.getChannelName().substring(1, 2).toUpperCase() : null);
|
||||
|
|
|
@ -23,8 +23,8 @@ public class EditorsChoiceItemAdapter extends RecyclerView.Adapter<EditorsChoice
|
|||
private static final int VIEW_TYPE_HEADER = 1;
|
||||
private static final int VIEW_TYPE_CONTENT = 2;
|
||||
|
||||
private Context context;
|
||||
private List<EditorsChoiceItem> items;
|
||||
private final Context context;
|
||||
private final List<EditorsChoiceItem> items;
|
||||
@Setter
|
||||
private EditorsChoiceItemListener listener;
|
||||
|
||||
|
@ -48,11 +48,11 @@ public class EditorsChoiceItemAdapter extends RecyclerView.Adapter<EditorsChoice
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected ImageView thumbnailView;
|
||||
protected TextView descriptionView;
|
||||
protected TextView headerView;
|
||||
protected TextView titleView;
|
||||
protected View cardView;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final TextView descriptionView;
|
||||
protected final TextView headerView;
|
||||
protected final TextView titleView;
|
||||
protected final View cardView;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
|
|
|
@ -21,8 +21,8 @@ import io.lbry.browser.utils.Helper;
|
|||
import lombok.Setter;
|
||||
|
||||
public class GalleryGridAdapter extends RecyclerView.Adapter<GalleryGridAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<GalleryItem> items;
|
||||
private final Context context;
|
||||
private final List<GalleryItem> items;
|
||||
@Setter
|
||||
private GalleryItemClickListener listener;
|
||||
|
||||
|
@ -32,8 +32,8 @@ public class GalleryGridAdapter extends RecyclerView.Adapter<GalleryGridAdapter.
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected ImageView thumbnailView;
|
||||
protected TextView durationView;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final TextView durationView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
thumbnailView = v.findViewById(R.id.gallery_item_thumbnail);
|
||||
|
@ -96,8 +96,8 @@ public class GalleryGridAdapter extends RecyclerView.Adapter<GalleryGridAdapter.
|
|||
|
||||
public static class GalleryGridItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private int spanCount;
|
||||
private int spacing;
|
||||
private final int spanCount;
|
||||
private final int spacing;
|
||||
|
||||
public GalleryGridItemDecoration(int spanCount, int spacing) {
|
||||
this.spanCount = spanCount;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package io.lbry.browser.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.DataSetObserver;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -18,9 +16,9 @@ import io.lbry.browser.model.Claim;
|
|||
|
||||
public class InlineChannelSpinnerAdapter extends ArrayAdapter<Claim> {
|
||||
|
||||
private List<Claim> channels;
|
||||
private int layoutResourceId;
|
||||
private LayoutInflater inflater;
|
||||
private final List<Claim> channels;
|
||||
private final int layoutResourceId;
|
||||
private final LayoutInflater inflater;
|
||||
|
||||
public InlineChannelSpinnerAdapter(Context context, int resource, List<Claim> channels) {
|
||||
super(context, resource, 0, channels);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package io.lbry.browser.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -11,21 +9,16 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.lbryinc.Invitee;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
import lombok.Setter;
|
||||
|
||||
public class InviteeListAdapter extends RecyclerView.Adapter<InviteeListAdapter.ViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private List<Invitee> items;
|
||||
private final Context context;
|
||||
private final List<Invitee> items;
|
||||
|
||||
public InviteeListAdapter(List<Invitee> invitees, Context context) {
|
||||
this.context = context;
|
||||
|
@ -80,8 +73,8 @@ public class InviteeListAdapter extends RecyclerView.Adapter<InviteeListAdapter.
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected TextView emailView;
|
||||
protected TextView rewardView;
|
||||
protected final TextView emailView;
|
||||
protected final TextView rewardView;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
|
|
|
@ -10,13 +10,12 @@ import android.widget.TextView;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.Language;
|
||||
import io.lbry.browser.utils.Predefined;
|
||||
|
||||
public class LanguageSpinnerAdapter extends ArrayAdapter<Language> {
|
||||
private int layoutResourceId;
|
||||
private LayoutInflater inflater;
|
||||
private final int layoutResourceId;
|
||||
private final LayoutInflater inflater;
|
||||
|
||||
public LanguageSpinnerAdapter(Context context, int resource) {
|
||||
super(context, resource, 0, Predefined.PUBLISH_LANGUAGES);
|
||||
|
|
|
@ -10,13 +10,12 @@ import android.widget.TextView;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.Language;
|
||||
import io.lbry.browser.model.License;
|
||||
import io.lbry.browser.utils.Predefined;
|
||||
|
||||
public class LicenseSpinnerAdapter extends ArrayAdapter<License> {
|
||||
private int layoutResourceId;
|
||||
private LayoutInflater inflater;
|
||||
private final int layoutResourceId;
|
||||
private final LayoutInflater inflater;
|
||||
|
||||
public LicenseSpinnerAdapter(Context context, int resource) {
|
||||
super(context, resource, 0, Predefined.LICENSES);
|
||||
|
|
|
@ -2,10 +2,8 @@ package io.lbry.browser.adapter;
|
|||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -17,15 +15,14 @@ import io.lbry.browser.R;
|
|||
import io.lbry.browser.model.NavMenuItem;
|
||||
import io.lbry.browser.ui.controls.SolidIconView;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class NavigationMenuAdapter extends RecyclerView.Adapter<NavigationMenuAdapter.ViewHolder> {
|
||||
private static final int TYPE_GROUP = 1;
|
||||
private static final int TYPE_ITEM = 2;
|
||||
|
||||
private Context context;
|
||||
private List<NavMenuItem> menuItems;
|
||||
private final Context context;
|
||||
private final List<NavMenuItem> menuItems;
|
||||
private NavMenuItem currentItem;
|
||||
@Setter
|
||||
private NavigationMenuItemClickListener listener;
|
||||
|
@ -65,8 +62,8 @@ public class NavigationMenuAdapter extends RecyclerView.Adapter<NavigationMenuAd
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected SolidIconView iconView;
|
||||
protected TextView titleView;
|
||||
protected final SolidIconView iconView;
|
||||
protected final TextView titleView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
titleView = v.findViewById(R.id.nav_menu_title);
|
||||
|
|
|
@ -14,12 +14,10 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
@ -34,7 +32,6 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
@ -43,9 +40,9 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
private static final String RULE_CREATOR_SUBSCRIBER = "creator_subscriber";
|
||||
private static final String RULE_COMMENT = "comment";
|
||||
|
||||
private Context context;
|
||||
private List<LbryNotification> items;
|
||||
private List<LbryNotification> selectedItems;
|
||||
private final Context context;
|
||||
private final List<LbryNotification> items;
|
||||
private final List<LbryNotification> selectedItems;
|
||||
@Setter
|
||||
private NotificationClickListener clickListener;
|
||||
@Getter
|
||||
|
@ -62,13 +59,13 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected View layoutView;
|
||||
protected TextView titleView;
|
||||
protected TextView bodyView;
|
||||
protected TextView timeView;
|
||||
protected SolidIconView iconView;
|
||||
protected ImageView thumbnailView;
|
||||
protected View selectedOverlayView;
|
||||
protected final View layoutView;
|
||||
protected final TextView titleView;
|
||||
protected final TextView bodyView;
|
||||
protected final TextView timeView;
|
||||
protected final SolidIconView iconView;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final View selectedOverlayView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
layoutView = v.findViewById(R.id.notification_layout);
|
||||
|
@ -196,7 +193,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
|||
vh.thumbnailView.setVisibility(notification.getCommentAuthor() == null ? View.INVISIBLE : View.VISIBLE);
|
||||
if (notification.getCommentAuthor() != null) {
|
||||
Glide.with(context.getApplicationContext()).load(
|
||||
notification.getCommentAuthor().getThumbnailUrl()).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
notification.getCommentAuthor().getThumbnailUrl(vh.thumbnailView.getLayoutParams().width, vh.thumbnailView.getLayoutParams().height, 85)).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
|
||||
}
|
||||
|
||||
vh.iconView.setVisibility(notification.getCommentAuthor() != null ? View.INVISIBLE : View.VISIBLE);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class RewardListAdapter extends RecyclerView.Adapter<RewardListAdapter.Vi
|
|||
public static final int DISPLAY_MODE_ALL = 1;
|
||||
public static final int DISPLAY_MODE_UNCLAIMED = 2;
|
||||
|
||||
private Context context;
|
||||
private final Context context;
|
||||
@Setter
|
||||
private List<Reward> all;
|
||||
private List<Reward> items;
|
||||
|
@ -85,16 +85,16 @@ public class RewardListAdapter extends RecyclerView.Adapter<RewardListAdapter.Vi
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected View iconClaimed;
|
||||
protected View loading;
|
||||
protected View upTo;
|
||||
protected TextView textTitle;
|
||||
protected TextView textDescription;
|
||||
protected TextView textLbcValue;
|
||||
protected TextView textUsdValue;
|
||||
protected TextView textLinkTransaction;
|
||||
protected EditText inputCustomCode;
|
||||
protected MaterialButton buttonClaimCustom;
|
||||
protected final View iconClaimed;
|
||||
protected final View loading;
|
||||
protected final View upTo;
|
||||
protected final TextView textTitle;
|
||||
protected final TextView textDescription;
|
||||
protected final TextView textLbcValue;
|
||||
protected final TextView textUsdValue;
|
||||
protected final TextView textLinkTransaction;
|
||||
protected final EditText inputCustomCode;
|
||||
protected final MaterialButton buttonClaimCustom;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
iconClaimed = v.findViewById(R.id.reward_item_claimed_icon);
|
||||
|
|
|
@ -22,9 +22,9 @@ import io.lbry.browser.utils.Helper;
|
|||
import lombok.Setter;
|
||||
|
||||
public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedChannelGridAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<Claim> items;
|
||||
private List<Claim> selectedItems;
|
||||
private final Context context;
|
||||
private final List<Claim> items;
|
||||
private final List<Claim> selectedItems;
|
||||
@Setter
|
||||
private ChannelItemSelectionListener listener;
|
||||
|
||||
|
@ -35,11 +35,11 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected View noThumbnailView;
|
||||
protected ImageView thumbnailView;
|
||||
protected TextView alphaView;
|
||||
protected TextView titleView;
|
||||
protected TextView tagView;
|
||||
protected final View noThumbnailView;
|
||||
protected final ImageView thumbnailView;
|
||||
protected final TextView alphaView;
|
||||
protected final TextView titleView;
|
||||
protected final TextView tagView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
noThumbnailView = v.findViewById(R.id.suggested_channel_no_thumbnail);
|
||||
|
@ -89,7 +89,8 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
|
|||
@Override
|
||||
public void onBindViewHolder(SuggestedChannelGridAdapter.ViewHolder vh, int position) {
|
||||
Claim claim = items.get(position);
|
||||
String thumbnailUrl = claim.getThumbnailUrl();
|
||||
ViewGroup.LayoutParams lp = vh.thumbnailView.getLayoutParams();
|
||||
String thumbnailUrl = claim.getThumbnailUrl(lp.width, lp.height, 85);
|
||||
|
||||
int bgColor = Helper.generateRandomColorForValue(claim.getClaimId());
|
||||
Helper.setIconViewBackgroundColor(vh.noThumbnailView, bgColor, false, context);
|
||||
|
|
|
@ -23,12 +23,13 @@ public class TagListAdapter extends RecyclerView.Adapter<TagListAdapter.ViewHold
|
|||
public static final int CUSTOMIZE_MODE_ADD = 1;
|
||||
public static final int CUSTOMIZE_MODE_REMOVE = 2;
|
||||
|
||||
private Context context;
|
||||
private final Context context;
|
||||
private List<Tag> items;
|
||||
@Setter
|
||||
private TagClickListener clickListener;
|
||||
@Getter
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private int customizeMode;
|
||||
|
||||
public TagListAdapter(List<Tag> tags, Context context) {
|
||||
|
@ -38,8 +39,8 @@ public class TagListAdapter extends RecyclerView.Adapter<TagListAdapter.ViewHold
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected ImageView iconView;
|
||||
protected TextView nameView;
|
||||
protected final ImageView iconView;
|
||||
protected final TextView nameView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
iconView = v.findViewById(R.id.tag_action);
|
||||
|
|
|
@ -26,8 +26,8 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionList
|
|||
private static final DecimalFormat TX_LIST_AMOUNT_FORMAT = new DecimalFormat("#,##0.0000");
|
||||
private static final SimpleDateFormat TX_LIST_DATE_FORMAT = new SimpleDateFormat("MMM d");
|
||||
|
||||
private Context context;
|
||||
private List<Transaction> items;
|
||||
private final Context context;
|
||||
private final List<Transaction> items;
|
||||
@Setter
|
||||
private TransactionClickListener listener;
|
||||
|
||||
|
@ -107,14 +107,14 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionList
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected TextView descView;
|
||||
protected TextView amountView;
|
||||
protected TextView claimView;
|
||||
protected TextView feeView;
|
||||
protected TextView txidLinkView;
|
||||
protected TextView dateView;
|
||||
protected TextView pendingView;
|
||||
protected View infoFeeContainer;
|
||||
protected final TextView descView;
|
||||
protected final TextView amountView;
|
||||
protected final TextView claimView;
|
||||
protected final TextView feeView;
|
||||
protected final TextView txidLinkView;
|
||||
protected final TextView dateView;
|
||||
protected final TextView pendingView;
|
||||
protected final View infoFeeContainer;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
|
|
|
@ -21,8 +21,8 @@ import io.lbry.browser.utils.LbryUri;
|
|||
import lombok.Setter;
|
||||
|
||||
public class UrlSuggestionListAdapter extends RecyclerView.Adapter<UrlSuggestionListAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<UrlSuggestion> items;
|
||||
private final Context context;
|
||||
private final List<UrlSuggestion> items;
|
||||
@Setter
|
||||
private UrlSuggestionClickListener listener;
|
||||
|
||||
|
@ -130,9 +130,9 @@ public class UrlSuggestionListAdapter extends RecyclerView.Adapter<UrlSuggestion
|
|||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected SolidIconView iconView;
|
||||
protected TextView titleView;
|
||||
protected TextView descView;
|
||||
protected final SolidIconView iconView;
|
||||
protected final TextView titleView;
|
||||
protected final TextView descView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
iconView = v.findViewById(R.id.url_suggestion_icon);
|
||||
|
|
|
@ -25,7 +25,7 @@ public class VerificationPagerAdapter extends FragmentStateAdapter {
|
|||
public static final int PAGE_VERIFICATION_WALLET = 2;
|
||||
public static final int PAGE_VERIFICATION_MANUAL = 3;
|
||||
|
||||
private FragmentActivity activity;
|
||||
private final FragmentActivity activity;
|
||||
|
||||
public VerificationPagerAdapter(FragmentActivity activity) {
|
||||
super(activity);
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
package io.lbry.browser.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.WalletDetailItem;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.views.CreditsBalanceView;
|
||||
|
||||
public class WalletDetailAdapter extends BaseAdapter {
|
||||
private final List<WalletDetailItem> list;
|
||||
private final LayoutInflater inflater;
|
||||
|
||||
public WalletDetailAdapter(Context ctx, List<WalletDetailItem> rows) {
|
||||
this.list = rows;
|
||||
this.inflater = LayoutInflater.from(ctx);
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.list_item_boosting_balance, viewGroup, false);
|
||||
|
||||
CreditsBalanceView balanceView = view.findViewById(R.id.wallet_supporting_balance);
|
||||
TextView detailTextView = view.findViewById(R.id.detail);
|
||||
TextView detailExplanationTextView = view.findViewById(R.id.detail_explanation);
|
||||
|
||||
WalletDetailItem item = (WalletDetailItem) getItem(i);
|
||||
|
||||
detailTextView.setText(item.detail);
|
||||
detailExplanationTextView.setText(item.detailDesc);
|
||||
|
||||
Helper.setViewText(balanceView, item.detailAmount);
|
||||
|
||||
ProgressBar progressUnlockTips = view.findViewById(R.id.wallet_unlock_tips_progress);
|
||||
progressUnlockTips.setVisibility(item.isInProgress ? View.VISIBLE : View.GONE);
|
||||
|
||||
ImageButton buttonLock = view.findViewById(R.id.lock_button);
|
||||
buttonLock.setVisibility((item.isUnlockable && !item.isInProgress) ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (item.isUnlockable) {
|
||||
buttonLock.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (view.getContext() != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()).
|
||||
setTitle(R.string.unlock_tips).
|
||||
setMessage(R.string.confirm_unlock_tips)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
unlockTips(view);
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
private void unlockTips(View v) {
|
||||
Context ctx = v.getContext();
|
||||
if (ctx instanceof MainActivity) {
|
||||
v.setVisibility(View.GONE);
|
||||
View progress = v.getRootView().findViewById(R.id.wallet_unlock_tips_progress);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
((MainActivity) ctx).unlockTips();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLInput;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -67,8 +67,8 @@ public class ContentFromDialogFragment extends BottomSheetDialogFragment {
|
|||
R.id.content_from_past_year_item,
|
||||
R.id.content_from_all_time_item
|
||||
};
|
||||
private BottomSheetDialogFragment dialog;
|
||||
private ContentFromListener listener;
|
||||
private final BottomSheetDialogFragment dialog;
|
||||
private final ContentFromListener listener;
|
||||
|
||||
public ContentFromItemClickListener(BottomSheetDialogFragment dialog, ContentFromListener listener) {
|
||||
this.dialog = dialog;
|
||||
|
|
|
@ -54,8 +54,8 @@ public class ContentScopeDialogFragment extends BottomSheetDialogFragment {
|
|||
private final int[] checkViewIds = {
|
||||
R.id.content_scope_everyone_item_selected, R.id.content_scope_tags_item_selected
|
||||
};
|
||||
private BottomSheetDialogFragment dialog;
|
||||
private ContentScopeListener listener;
|
||||
private final BottomSheetDialogFragment dialog;
|
||||
private final ContentScopeListener listener;
|
||||
|
||||
public ContentScopeItemClickListener(BottomSheetDialogFragment dialog, ContentScopeListener listener) {
|
||||
this.dialog = dialog;
|
||||
|
|
|
@ -57,8 +57,8 @@ public class ContentSortDialogFragment extends BottomSheetDialogFragment {
|
|||
private final int[] checkViewIds = {
|
||||
R.id.sort_by_trending_item_selected, R.id.sort_by_new_item_selected, R.id.sort_by_top_item_selected
|
||||
};
|
||||
private BottomSheetDialogFragment dialog;
|
||||
private SortByListener listener;
|
||||
private final BottomSheetDialogFragment dialog;
|
||||
private final SortByListener listener;
|
||||
|
||||
public SortByItemClickListener(BottomSheetDialogFragment dialog, SortByListener listener) {
|
||||
this.dialog = dialog;
|
||||
|
|
|
@ -13,7 +13,6 @@ 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;
|
||||
|
@ -41,7 +40,6 @@ 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";
|
||||
|
@ -61,13 +59,17 @@ public class CreateSupportDialogFragment extends BottomSheetDialogFragment imple
|
|||
private ProgressBar progressLoadingChannels;
|
||||
|
||||
|
||||
@Setter
|
||||
private CreateSupportListener listener;
|
||||
@Setter
|
||||
private Claim claim;
|
||||
private final CreateSupportListener listener;
|
||||
private final Claim claim;
|
||||
|
||||
public static CreateSupportDialogFragment newInstance() {
|
||||
return new CreateSupportDialogFragment();
|
||||
private CreateSupportDialogFragment(Claim claim, CreateSupportListener listener) {
|
||||
super();
|
||||
this.claim = claim;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public static CreateSupportDialogFragment newInstance(Claim claim, CreateSupportListener listener) {
|
||||
return new CreateSupportDialogFragment(claim, listener);
|
||||
}
|
||||
|
||||
private void disableControls() {
|
||||
|
|
|
@ -142,7 +142,7 @@ public class CustomizeTagsDialogFragment extends BottomSheetDialogFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
private TagListAdapter.TagClickListener customizeTagClickListener = new TagListAdapter.TagClickListener() {
|
||||
private final TagListAdapter.TagClickListener customizeTagClickListener = new TagListAdapter.TagClickListener() {
|
||||
@Override
|
||||
public void onTagClicked(Tag tag, int customizeMode) {
|
||||
if (customizeMode == TagListAdapter.CUSTOMIZE_MODE_ADD) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
|
|
@ -37,7 +37,6 @@ import io.lbry.browser.tasks.claim.StreamRepostTask;
|
|||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
import lombok.Setter;
|
||||
|
||||
public class RepostClaimDialogFragment extends BottomSheetDialogFragment implements WalletBalanceListener {
|
||||
public static final String TAG = "RepostClaimDialog";
|
||||
|
@ -57,13 +56,17 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
|||
private TextView linkToggleAdvanced;
|
||||
private View advancedContainer;
|
||||
|
||||
@Setter
|
||||
private RepostClaimListener listener;
|
||||
@Setter
|
||||
private Claim claim;
|
||||
private final RepostClaimListener listener;
|
||||
private final Claim claim;
|
||||
|
||||
public static RepostClaimDialogFragment newInstance() {
|
||||
return new RepostClaimDialogFragment();
|
||||
private RepostClaimDialogFragment(Claim claim, RepostClaimListener listener) {
|
||||
super();
|
||||
this.listener = listener;
|
||||
this.claim = claim;
|
||||
}
|
||||
|
||||
public static RepostClaimDialogFragment newInstance(Claim claim, RepostClaimListener listener) {
|
||||
return new RepostClaimDialogFragment(claim, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.lbry.browser.model;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
@ -15,7 +17,6 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
|
@ -138,6 +139,14 @@ public class Claim {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean hasSource() {
|
||||
if (value instanceof StreamMetadata) {
|
||||
StreamMetadata metadata = (StreamMetadata) value;
|
||||
return metadata.getSource() != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPlayable() {
|
||||
if (value instanceof StreamMetadata) {
|
||||
StreamMetadata metadata = (StreamMetadata) value;
|
||||
|
@ -177,6 +186,21 @@ public class Claim {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL from the CDN where getting the image file
|
||||
* @param width Pass zero for width and height for the full size image file
|
||||
* @param height Pass zero for width and height for the full size image file
|
||||
* @param q Desired quality for the image to be retrieved
|
||||
* @return URL from the CDN from where image can be retrieved
|
||||
*/
|
||||
public String getThumbnailUrl(int width, int height, int q) {
|
||||
if (value != null && value.getThumbnail() != null) {
|
||||
ImageCDNUrl imageCDNUrl = new ImageCDNUrl(Math.max(width, 0), Math.max(height, 0), q, null, value.getThumbnail().getUrl());
|
||||
return imageCDNUrl.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getCoverUrl() {
|
||||
if (TYPE_CHANNEL.equals(valueType) && value != null && value instanceof ChannelMetadata && ((ChannelMetadata) value).getCover() != null) {
|
||||
return ((ChannelMetadata) value).getCover().getUrl();
|
||||
|
@ -484,6 +508,30 @@ public class Claim {
|
|||
private String url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object to be instantiated. In order to get the URLto the CDN, call toString() on it
|
||||
*/
|
||||
static class ImageCDNUrl {
|
||||
private String appendedPath = "";
|
||||
|
||||
public ImageCDNUrl(int width, int height, int quality, @Nullable String format, String thumbnailUrl) {
|
||||
if (width != 0 && height != 0)
|
||||
appendedPath = "s:".concat(String.valueOf(width)).concat(":").concat(String.valueOf(height)).concat("/");
|
||||
|
||||
appendedPath = appendedPath.concat("quality:").concat(String.valueOf(quality)).concat("/");
|
||||
|
||||
appendedPath = appendedPath.concat("plain/").concat(thumbnailUrl);
|
||||
|
||||
if (format != null)
|
||||
appendedPath = appendedPath.concat("@").concat(format);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String url = "https://image-processor.vanwanet.com/optimize/";
|
||||
return url.concat(appendedPath);
|
||||
}
|
||||
}
|
||||
@Data
|
||||
public static class StreamInfo {
|
||||
private long duration; // video / audio
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ClaimCacheKey {
|
|||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == null || !(obj instanceof ClaimCacheKey)) {
|
||||
if (!(obj instanceof ClaimCacheKey)) {
|
||||
return false;
|
||||
}
|
||||
ClaimCacheKey key = (ClaimCacheKey) obj;
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
package io.lbry.browser.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class ClaimSearchCacheValue {
|
||||
@Getter
|
||||
@Setter
|
||||
private List<Claim> claims;
|
||||
private final List<Claim> claims;
|
||||
@Getter
|
||||
@Setter
|
||||
private long timestamp;
|
||||
private final long timestamp;
|
||||
|
||||
public ClaimSearchCacheValue(List<Claim> claims, long timestamp) {
|
||||
this.claims = new ArrayList<>(claims);
|
||||
|
|
|
@ -3,7 +3,6 @@ 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;
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class Language {
|
||||
private String code;
|
||||
private String name;
|
||||
private int stringResourceId;
|
||||
private final String code;
|
||||
private final String name;
|
||||
private final int stringResourceId;
|
||||
|
||||
public Language(String code, String name, int stringResourceId) {
|
||||
this.code = code;
|
||||
|
|
|
@ -4,9 +4,9 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class License {
|
||||
private String name;
|
||||
private final String name;
|
||||
private String url;
|
||||
private int stringResourceId;
|
||||
private final int stringResourceId;
|
||||
|
||||
public License(String name, int stringResourceId) {
|
||||
this.name = name;
|
||||
|
|
|
@ -2,8 +2,6 @@ package io.lbry.browser.model;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -37,8 +35,8 @@ public class NavMenuItem {
|
|||
public static final int ID_ITEM_SETTINGS = 401;
|
||||
public static final int ID_ITEM_ABOUT = 402;
|
||||
|
||||
private Context context;
|
||||
private int id;
|
||||
private final Context context;
|
||||
private final int id;
|
||||
private boolean group;
|
||||
private int icon;
|
||||
private String title;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.lbry.browser.model;
|
||||
|
||||
public class StartupStage {
|
||||
public Integer stage;
|
||||
public Boolean stageDone;
|
||||
public final Integer stage;
|
||||
public final Boolean stageDone;
|
||||
|
||||
public StartupStage(Integer stage, Boolean stageDone) {
|
||||
this.stage = stage;
|
||||
|
|
|
@ -3,9 +3,7 @@ package io.lbry.browser.model;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
|
|
@ -6,14 +6,28 @@ import java.math.BigDecimal;
|
|||
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
public class WalletBalance {
|
||||
@Setter
|
||||
@Getter
|
||||
private BigDecimal available;
|
||||
@Setter
|
||||
@Getter
|
||||
private BigDecimal reserved;
|
||||
@Setter
|
||||
@Getter
|
||||
private BigDecimal claims;
|
||||
@Setter
|
||||
@Getter
|
||||
private BigDecimal supports;
|
||||
@Setter
|
||||
@Getter
|
||||
private BigDecimal tips;
|
||||
@Setter
|
||||
@Getter
|
||||
private BigDecimal total;
|
||||
|
||||
public WalletBalance() {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package io.lbry.browser.model;
|
||||
|
||||
public class WalletDetailItem {
|
||||
public String detail;
|
||||
public String detailDesc;
|
||||
public String detailAmount;
|
||||
public boolean isUnlockable;
|
||||
public boolean isInProgress;
|
||||
|
||||
public WalletDetailItem(String detail, String detailDesc, String detailAmount, boolean isUnlockable, boolean isInProgress) {
|
||||
this.detail = detail;
|
||||
this.detailDesc = detailDesc;
|
||||
this.detailAmount = detailAmount;
|
||||
this.isUnlockable = isUnlockable;
|
||||
this.isInProgress = isInProgress;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
package io.lbry.browser.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
@Data
|
||||
public class WalletSync {
|
||||
private String hash;
|
||||
private String data;
|
||||
@Getter
|
||||
private final String hash;
|
||||
@Getter
|
||||
private final String data;
|
||||
@Getter
|
||||
private boolean changed;
|
||||
|
||||
public WalletSync(String hash, String data) {
|
||||
|
@ -17,4 +21,5 @@ public class WalletSync {
|
|||
this(hash, data);
|
||||
this.changed = changed;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.json.JSONObject;
|
|||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
@ -12,16 +12,17 @@ import okhttp3.OkHttpClient;
|
|||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
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;
|
||||
private final String streamUrl;
|
||||
private final String userIdHash;
|
||||
private final long streamDuration;
|
||||
private final long streamPosition;
|
||||
private final long bufferDuration;
|
||||
|
||||
public BufferEventTask(String streamUrl, long streamDuration, long streamPosition, long bufferDuration, String userIdHash) {
|
||||
this.streamUrl = streamUrl;
|
||||
|
@ -53,7 +54,11 @@ public class BufferEventTask extends AsyncTask<Void, Void, Void> {
|
|||
build();
|
||||
|
||||
Response response = client.newCall(request).execute();
|
||||
String responseString = response.body().string();
|
||||
ResponseBody resBody = response.body();
|
||||
String responseString = "";
|
||||
if (resBody != null) {
|
||||
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
|
||||
|
|
|
@ -7,29 +7,18 @@ 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 java.util.Objects;
|
||||
|
||||
import io.lbry.browser.exceptions.ApiCallException;
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.utils.Comments;
|
||||
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 CommentCreateTask extends AsyncTask<Void, Void, Comment> {
|
||||
private static final String STATUS_ENDPOINT = "https://comments.lbry.com";
|
||||
|
||||
private Comment comment;
|
||||
private View progressView;
|
||||
private CommentCreateWithTipHandler handler;
|
||||
private final Comment comment;
|
||||
private final View progressView;
|
||||
private final CommentCreateWithTipHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public CommentCreateTask(Comment comment, View progressView, CommentCreateWithTipHandler handler) {
|
||||
|
@ -46,29 +35,31 @@ public class CommentCreateTask extends AsyncTask<Void, Void, Comment> {
|
|||
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.");
|
||||
Comments.checkCommentsEndpointStatus();
|
||||
|
||||
JSONObject comment_body = new JSONObject();
|
||||
comment_body.put("comment", comment.getText());
|
||||
comment_body.put("claim_id", comment.getClaimId());
|
||||
if (!Helper.isNullOrEmpty(comment.getParentId())) {
|
||||
comment_body.put("parent_id", comment.getParentId());
|
||||
}
|
||||
comment_body.put("channel_id", comment.getChannelId());
|
||||
comment_body.put("channel_name", comment.getChannelName());
|
||||
|
||||
JSONObject jsonChannelSign = Comments.channelSign(comment_body, comment.getChannelId(), comment.getChannelName());
|
||||
|
||||
if (jsonChannelSign.has("signature") && jsonChannelSign.has("signing_ts")) {
|
||||
comment_body.put("signature", jsonChannelSign.getString("signature"));
|
||||
comment_body.put("signing_ts", jsonChannelSign.getString("signing_ts"));
|
||||
}
|
||||
|
||||
Map<String, Object> 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);
|
||||
Response resp = Comments.performRequest(comment_body, "comment.Create");
|
||||
String responseString = Objects.requireNonNull(resp.body()).string();
|
||||
resp.close();
|
||||
JSONObject jsonResponse = new JSONObject(responseString);
|
||||
|
||||
if (jsonResponse.has("result"))
|
||||
createdComment = Comment.fromJSONObject(jsonResponse.getJSONObject("result"));
|
||||
} catch (ApiCallException | ClassCastException | IOException | JSONException ex) {
|
||||
error = ex;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.utils.Comments;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
|
@ -21,8 +22,8 @@ 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 final ProgressBar progressBar;
|
||||
private final CommentListHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public CommentListTask(int page, int pageSize, String claim, ProgressBar progressBar, CommentListHandler handler) {
|
||||
|
@ -52,7 +53,7 @@ public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
|
|||
options.put("skip_validation", true);
|
||||
options.put("visible", true);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_COMMENT_LIST, options);
|
||||
JSONObject result = (JSONObject) Lbry.parseResponse(Comments.performRequest(Lbry.buildJsonParams(options), "comment.List"));
|
||||
JSONArray items = result.getJSONArray("items");
|
||||
|
||||
List<Comment> children = new ArrayList<>();
|
||||
|
|
|
@ -10,10 +10,10 @@ import io.lbry.browser.model.Tag;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class FollowUnfollowTagTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Tag tag;
|
||||
private boolean unfollowing;
|
||||
private Context context;
|
||||
private FollowUnfollowTagHandler handler;
|
||||
private final Tag tag;
|
||||
private final boolean unfollowing;
|
||||
private final Context context;
|
||||
private final FollowUnfollowTagHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public FollowUnfollowTagTask(Tag tag, boolean unfollowing, Context context, FollowUnfollowTagHandler handler) {
|
||||
|
|
|
@ -12,9 +12,9 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lighthouse;
|
||||
|
||||
public class LighthouseAutoCompleteTask extends AsyncTask<Void, Void, List<UrlSuggestion>> {
|
||||
private String text;
|
||||
private AutoCompleteResultHandler handler;
|
||||
private View progressView;
|
||||
private final String text;
|
||||
private final AutoCompleteResultHandler handler;
|
||||
private final View progressView;
|
||||
private Exception error;
|
||||
|
||||
public LighthouseAutoCompleteTask(String text, View progressView, AutoCompleteResultHandler handler) {
|
||||
|
|
|
@ -14,13 +14,13 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lighthouse;
|
||||
|
||||
public class LighthouseSearchTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private String rawQuery;
|
||||
private int size;
|
||||
private int from;
|
||||
private boolean nsfw;
|
||||
private String relatedTo;
|
||||
private ClaimSearchResultHandler handler;
|
||||
private ProgressBar progressBar;
|
||||
private final String rawQuery;
|
||||
private final int size;
|
||||
private final int from;
|
||||
private final boolean nsfw;
|
||||
private final String relatedTo;
|
||||
private final ClaimSearchResultHandler handler;
|
||||
private final ProgressBar progressBar;
|
||||
private Exception error;
|
||||
|
||||
public LighthouseSearchTask(String rawQuery, int size, int from, boolean nsfw, String relatedTo, ProgressBar progressBar, ClaimSearchResultHandler handler) {
|
||||
|
|
|
@ -4,22 +4,16 @@ import android.content.Context;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
import io.lbry.browser.exceptions.LbryRequestException;
|
||||
import io.lbry.browser.exceptions.LbryResponseException;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.Tag;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
|
||||
public class LoadTagsTask extends AsyncTask<Void, Void, List<Tag>> {
|
||||
private Context context;
|
||||
private LoadTagsHandler handler;
|
||||
private final Context context;
|
||||
private final LoadTagsHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public LoadTagsTask(Context context, LoadTagsHandler handler) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
@ -17,24 +16,21 @@ import java.util.Map;
|
|||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.lbryinc.Subscription;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import okhttp3.Response;
|
||||
|
||||
// background task to create a diff of local and remote subscriptions and try to merge
|
||||
public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscription>> {
|
||||
private static final String TAG = "MergeSubscriptionsTask";
|
||||
private Context context;
|
||||
private List<Subscription> base;
|
||||
private final Context context;
|
||||
private final List<Subscription> base;
|
||||
private List<Subscription> diff;
|
||||
private MergeSubscriptionsHandler handler;
|
||||
private final MergeSubscriptionsHandler handler;
|
||||
private Exception error;
|
||||
private boolean replaceLocal;
|
||||
private final boolean replaceLocal;
|
||||
|
||||
public MergeSubscriptionsTask(List<Subscription> base, boolean replaceLocal, Context context, MergeSubscriptionsHandler handler) {
|
||||
this.base = base;
|
||||
|
|
|
@ -4,18 +4,15 @@ import android.os.AsyncTask;
|
|||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.Buffer;
|
||||
|
||||
import io.lbry.browser.utils.Helper;
|
||||
|
||||
public class ReadTextFileTask extends AsyncTask<Void, Void, String> {
|
||||
private String filePath;
|
||||
private final String filePath;
|
||||
private Exception error;
|
||||
private ReadTextFileHandler handler;
|
||||
private final ReadTextFileHandler handler;
|
||||
public ReadTextFileTask(String filePath, ReadTextFileHandler handler) {
|
||||
this.filePath = filePath;
|
||||
this.handler = handler;
|
||||
|
|
|
@ -9,9 +9,9 @@ import io.lbry.browser.exceptions.ApiCallException;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class SetSdkSettingTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String key;
|
||||
private String value;
|
||||
private GenericTaskHandler handler;
|
||||
private final String key;
|
||||
private final String value;
|
||||
private final GenericTaskHandler handler;
|
||||
private Exception error;
|
||||
public SetSdkSettingTask(String key, String value, GenericTaskHandler handler) {
|
||||
this.key = key;
|
||||
|
|
|
@ -13,13 +13,13 @@ import io.lbry.browser.utils.Lbry;
|
|||
|
||||
public class UpdateSuggestedTagsTask extends AsyncTask<Void, Void, List<Tag>> {
|
||||
|
||||
private boolean clearPrevious;
|
||||
private boolean excludeMature;
|
||||
private int limit;
|
||||
private String filter;
|
||||
private TagListAdapter addedTagsAdapter;
|
||||
private TagListAdapter suggestedTagsAdapter;
|
||||
private KnownTagsHandler handler;
|
||||
private final boolean clearPrevious;
|
||||
private final boolean excludeMature;
|
||||
private final int limit;
|
||||
private final String filter;
|
||||
private final TagListAdapter addedTagsAdapter;
|
||||
private final TagListAdapter suggestedTagsAdapter;
|
||||
private final KnownTagsHandler handler;
|
||||
|
||||
public UpdateSuggestedTagsTask(
|
||||
String filter,
|
||||
|
|
|
@ -21,9 +21,9 @@ import okhttp3.RequestBody;
|
|||
import okhttp3.Response;
|
||||
|
||||
public class UploadImageTask extends AsyncTask<Void, Void, String> {
|
||||
private String filePath;
|
||||
private View progressView;
|
||||
private UploadThumbnailHandler handler;
|
||||
private final String filePath;
|
||||
private final View progressView;
|
||||
private final UploadThumbnailHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public UploadImageTask(String filePath, View progressView, UploadThumbnailHandler handler) {
|
||||
|
|
|
@ -11,17 +11,16 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.exceptions.ApiCallException;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class AbandonChannelTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private List<String> claimIds;
|
||||
private final List<String> claimIds;
|
||||
private List<String> successfulClaimIds;
|
||||
private List<String> failedClaimIds;
|
||||
private List<Exception> failedExceptions;
|
||||
private View progressView;
|
||||
private AbandonHandler handler;
|
||||
private final View progressView;
|
||||
private final AbandonHandler handler;
|
||||
|
||||
public AbandonChannelTask(List<String> claimIds, View progressView, AbandonHandler handler) {
|
||||
this.claimIds = claimIds;
|
||||
|
|
|
@ -11,17 +11,16 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.exceptions.ApiCallException;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class AbandonStreamTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private List<String> claimIds;
|
||||
private final List<String> claimIds;
|
||||
private List<String> successfulClaimIds;
|
||||
private List<String> failedClaimIds;
|
||||
private List<Exception> failedExceptions;
|
||||
private View progressView;
|
||||
private AbandonHandler handler;
|
||||
private final View progressView;
|
||||
private final AbandonHandler handler;
|
||||
|
||||
public AbandonStreamTask(List<String> claimIds, View progressView, AbandonHandler handler) {
|
||||
this.claimIds = claimIds;
|
||||
|
|
|
@ -21,12 +21,12 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class ChannelCreateUpdateTask extends AsyncTask<Void, Void, Claim> {
|
||||
private Claim claim;
|
||||
private BigDecimal deposit;
|
||||
private boolean update;
|
||||
private final Claim claim;
|
||||
private final BigDecimal deposit;
|
||||
private final boolean update;
|
||||
private Exception error;
|
||||
private ClaimResultHandler handler;
|
||||
private View progressView;
|
||||
private final ClaimResultHandler handler;
|
||||
private final View progressView;
|
||||
|
||||
public ChannelCreateUpdateTask(Claim claim, BigDecimal deposit, boolean update, View progressView, ClaimResultHandler handler) {
|
||||
this.claim = claim;
|
||||
|
|
|
@ -19,9 +19,9 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class ClaimListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private List<String> types;
|
||||
private View progressView;
|
||||
private ClaimListResultHandler handler;
|
||||
private final List<String> types;
|
||||
private final View progressView;
|
||||
private final ClaimListResultHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public ClaimListTask(String type, View progressView, ClaimListResultHandler handler) {
|
||||
|
|
|
@ -12,10 +12,10 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class ClaimSearchTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private Map<String, Object> options;
|
||||
private String connectionString;
|
||||
private ClaimSearchResultHandler handler;
|
||||
private View progressView;
|
||||
private final Map<String, Object> options;
|
||||
private final String connectionString;
|
||||
private final ClaimSearchResultHandler handler;
|
||||
private final View progressView;
|
||||
private ApiCallException error;
|
||||
|
||||
public ClaimSearchTask(Map<String, Object> options, String connectionString, View progressView, ClaimSearchResultHandler handler) {
|
||||
|
|
|
@ -21,10 +21,10 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class PublishClaimTask extends AsyncTask<Void, Void, Claim> {
|
||||
private Claim claim;
|
||||
private String filePath;
|
||||
private View progressView;
|
||||
private ClaimResultHandler handler;
|
||||
private final Claim claim;
|
||||
private final String filePath;
|
||||
private final View progressView;
|
||||
private final ClaimResultHandler handler;
|
||||
private Exception error;
|
||||
public PublishClaimTask(Claim claim, String filePath, View progressView, ClaimResultHandler handler) {
|
||||
this.claim = claim;
|
||||
|
|
|
@ -21,8 +21,8 @@ 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 final ClaimSearchResultHandler handler;
|
||||
private final View progressView;
|
||||
private Exception error;
|
||||
|
||||
public PurchaseListTask(String claimId, View progressView, ClaimSearchResultHandler handler) {
|
||||
|
|
|
@ -13,10 +13,10 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class ResolveTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private List<String> urls;
|
||||
private String connectionString;
|
||||
private ClaimListResultHandler handler;
|
||||
private View progressView;
|
||||
private final List<String> urls;
|
||||
private final String connectionString;
|
||||
private final ClaimListResultHandler handler;
|
||||
private final View progressView;
|
||||
private ApiCallException error;
|
||||
|
||||
public ResolveTask(String url, String connectionString, View progressView, ClaimListResultHandler handler) {
|
||||
|
|
|
@ -20,12 +20,12 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class StreamRepostTask extends AsyncTask<Void, Void, Claim> {
|
||||
private String name;
|
||||
private BigDecimal bid;
|
||||
private String claimId;
|
||||
private String channelId;
|
||||
private View progressView;
|
||||
private ClaimResultHandler handler;
|
||||
private final String name;
|
||||
private final BigDecimal bid;
|
||||
private final String claimId;
|
||||
private final String channelId;
|
||||
private final View progressView;
|
||||
private final ClaimResultHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public StreamRepostTask(String name, BigDecimal bid, String claimId, String channelId, View progressView, ClaimResultHandler handler) {
|
||||
|
|
|
@ -7,12 +7,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.exceptions.ApiCallException;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
// Just run delete on the specified claim IDs (no need for a handler)
|
||||
public class BulkDeleteFilesTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private List<String> claimIds;
|
||||
private final List<String> claimIds;
|
||||
public BulkDeleteFilesTask(List<String> claimIds) {
|
||||
this.claimIds = claimIds;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import io.lbry.browser.tasks.GenericTaskHandler;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class DeleteFileTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String claimId;
|
||||
private final String claimId;
|
||||
private Exception error;
|
||||
private GenericTaskHandler handler;
|
||||
private final GenericTaskHandler handler;
|
||||
|
||||
public DeleteFileTask(String claimId, GenericTaskHandler handler) {
|
||||
this.claimId = claimId;
|
||||
|
|
|
@ -11,12 +11,12 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class FileListTask extends AsyncTask<Void, Void, List<LbryFile>> {
|
||||
private String claimId;
|
||||
private final String claimId;
|
||||
private boolean downloads;
|
||||
private int page;
|
||||
private int pageSize;
|
||||
private FileListResultHandler handler;
|
||||
private View progressView;
|
||||
private final FileListResultHandler handler;
|
||||
private final View progressView;
|
||||
private ApiCallException error;
|
||||
|
||||
public FileListTask(int page, int pageSize, boolean downloads, View progressView, FileListResultHandler handler) {
|
||||
|
|
|
@ -14,10 +14,10 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class GetFileTask extends AsyncTask<Void, Void, LbryFile> {
|
||||
private String uri;
|
||||
private boolean saveFile;
|
||||
private View progressView;
|
||||
private GetFileHandler handler;
|
||||
private final String uri;
|
||||
private final boolean saveFile;
|
||||
private final View progressView;
|
||||
private final GetFileHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public GetFileTask(String uri, boolean saveFile, View progressView, GetFileHandler handler) {
|
||||
|
|
|
@ -15,18 +15,16 @@ import java.lang.reflect.Type;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.model.lbryinc.RewardVerified;
|
||||
import io.lbry.browser.tasks.RewardVerifiedHandler;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class AndroidPurchaseTask extends AsyncTask<Void, Void, RewardVerified> {
|
||||
private Context context;
|
||||
private View progressView;
|
||||
private String purchaseToken;
|
||||
private RewardVerifiedHandler handler;
|
||||
private final Context context;
|
||||
private final View progressView;
|
||||
private final String purchaseToken;
|
||||
private final RewardVerifiedHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public AndroidPurchaseTask(String purchaseToken, View progressView, Context context, RewardVerifiedHandler handler) {
|
||||
|
|
|
@ -13,16 +13,15 @@ import io.lbry.browser.data.DatabaseHelper;
|
|||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.lbryinc.Subscription;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class ChannelSubscribeTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Context context;
|
||||
private String channelClaimId;
|
||||
private Subscription subscription;
|
||||
private ChannelSubscribeHandler handler;
|
||||
private final Context context;
|
||||
private final String channelClaimId;
|
||||
private final Subscription subscription;
|
||||
private final ChannelSubscribeHandler handler;
|
||||
private Exception error;
|
||||
private boolean isUnsubscribing;
|
||||
private final boolean isUnsubscribing;
|
||||
|
||||
public ChannelSubscribeTask(Context context, String channelClaimId, Subscription subscription, boolean isUnsubscribing, ChannelSubscribeHandler handler) {
|
||||
this.context = context;
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -25,12 +24,12 @@ import io.lbry.browser.utils.Lbryio;
|
|||
|
||||
public class ClaimRewardTask extends AsyncTask<Void, Void, String> {
|
||||
|
||||
private Context context;
|
||||
private String type;
|
||||
private String rewardCode;
|
||||
private View progressView;
|
||||
private final Context context;
|
||||
private final String type;
|
||||
private final String rewardCode;
|
||||
private final View progressView;
|
||||
private double amountClaimed;
|
||||
private ClaimRewardHandler handler;
|
||||
private final ClaimRewardHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public ClaimRewardTask(String type, String rewardCode, View progressView, Context context, ClaimRewardHandler handler) {
|
||||
|
|
|
@ -7,9 +7,9 @@ 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 final Context context;
|
||||
private Exception error;
|
||||
private FetchUserTaskHandler handler;
|
||||
private final FetchUserTaskHandler handler;
|
||||
|
||||
public FetchCurrentUserTask(Context context, FetchUserTaskHandler handler) {
|
||||
this.context = context;
|
||||
|
|
|
@ -17,8 +17,8 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class FetchInviteStatusTask extends AsyncTask<Void, Void, List<Invitee>> {
|
||||
private FetchInviteStatusHandler handler;
|
||||
private View progressView;
|
||||
private final FetchInviteStatusHandler handler;
|
||||
private final View progressView;
|
||||
private Exception error;
|
||||
|
||||
public FetchInviteStatusTask(View progressView, FetchInviteStatusHandler handler) {
|
||||
|
|
|
@ -12,8 +12,8 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class FetchReferralCodeTask extends AsyncTask<Void, Void, String> {
|
||||
private FetchReferralCodeHandler handler;
|
||||
private View progressView;
|
||||
private final FetchReferralCodeHandler handler;
|
||||
private final View progressView;
|
||||
private Exception error;
|
||||
|
||||
public FetchReferralCodeTask(View progressView, FetchReferralCodeHandler handler) {
|
||||
|
|
|
@ -18,8 +18,8 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class FetchRewardsTask extends AsyncTask<Void, Void, List<Reward>> {
|
||||
private FetchRewardsHandler handler;
|
||||
private View progressView;
|
||||
private final FetchRewardsHandler handler;
|
||||
private final View progressView;
|
||||
private Exception error;
|
||||
|
||||
public FetchRewardsTask(View progressView, FetchRewardsHandler handler) {
|
||||
|
|
|
@ -15,10 +15,10 @@ public class FetchStatCountTask extends AsyncTask<Void, Void, Integer> {
|
|||
public static final int STAT_VIEW_COUNT = 1;
|
||||
public static final int STAT_SUB_COUNT = 2;
|
||||
|
||||
private String claimId;
|
||||
private int stat;
|
||||
private FetchStatCountHandler handler;
|
||||
private View progressView;
|
||||
private final String claimId;
|
||||
private final int stat;
|
||||
private final FetchStatCountHandler handler;
|
||||
private final View progressView;
|
||||
private Exception error;
|
||||
|
||||
public FetchStatCountTask(int stat, String claimId, View progressView, FetchStatCountHandler handler) {
|
||||
|
|
|
@ -23,9 +23,9 @@ import io.lbry.browser.utils.LbryUri;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class FetchSubscriptionsTask extends AsyncTask<Void, Void, List<Subscription>> {
|
||||
private Context context;
|
||||
private FetchSubscriptionsHandler handler;
|
||||
private ProgressBar progressBar;
|
||||
private final Context context;
|
||||
private final FetchSubscriptionsHandler handler;
|
||||
private final ProgressBar progressBar;
|
||||
private Exception error;
|
||||
|
||||
public FetchSubscriptionsTask(Context context, ProgressBar progressBar, FetchSubscriptionsHandler handler) {
|
||||
|
|
|
@ -14,9 +14,9 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class InviteByEmailTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String email;
|
||||
private View progressView;
|
||||
private GenericTaskHandler handler;
|
||||
private final String email;
|
||||
private final View progressView;
|
||||
private final GenericTaskHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public InviteByEmailTask(String email, View progressView, GenericTaskHandler handler) {
|
||||
|
|
|
@ -2,24 +2,21 @@ package io.lbry.browser.tasks.lbryinc;
|
|||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class LogFileViewTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String uri;
|
||||
private Claim claim;
|
||||
private final String uri;
|
||||
private final Claim claim;
|
||||
private Exception error;
|
||||
private GenericTaskHandler handler;
|
||||
private long timeToStart;
|
||||
private final GenericTaskHandler handler;
|
||||
private final long timeToStart;
|
||||
|
||||
public LogFileViewTask(String uri, Claim claim, long timeToStart, GenericTaskHandler handler) {
|
||||
this.uri = uri;
|
||||
|
|
|
@ -2,7 +2,6 @@ package io.lbry.browser.tasks.lbryinc;
|
|||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -10,10 +9,9 @@ import io.lbry.browser.exceptions.LbryioRequestException;
|
|||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class LogPublishTask extends AsyncTask<Void, Void, Void> {
|
||||
private Claim claimResult;
|
||||
private final Claim claimResult;
|
||||
public LogPublishTask(Claim claimResult) {
|
||||
this.claimResult = claimResult;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class NotificationDeleteTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private List<Long> ids;
|
||||
private final List<Long> ids;
|
||||
|
||||
public NotificationDeleteTask(List<Long> ids) {
|
||||
this.ids = ids;
|
||||
|
|
|
@ -16,8 +16,10 @@ import java.text.ParseException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
|
@ -30,9 +32,9 @@ import io.lbry.browser.utils.Lbryio;
|
|||
public class NotificationListTask extends AsyncTask<Void, Void, List<LbryNotification>> {
|
||||
private static final String TAG = "Notifications";
|
||||
|
||||
private Context context;
|
||||
private ListNotificationsHandler handler;
|
||||
private ProgressBar progressBar;
|
||||
private final Context context;
|
||||
private final ListNotificationsHandler handler;
|
||||
private final ProgressBar progressBar;
|
||||
private Exception error;
|
||||
|
||||
public NotificationListTask(Context context, ProgressBar progressBar, ListNotificationsHandler handler) {
|
||||
|
@ -47,7 +49,9 @@ public class NotificationListTask extends AsyncTask<Void, Void, List<LbryNotific
|
|||
List<LbryNotification> notifications = new ArrayList<>();
|
||||
SQLiteDatabase db = null;
|
||||
try {
|
||||
JSONArray array = (JSONArray) Lbryio.parseResponse(Lbryio.call("notification", "list", context));
|
||||
Map<String, String> parameters = new HashMap<>(1);
|
||||
parameters.put("is_app_readable", "true");
|
||||
JSONArray array = (JSONArray) Lbryio.parseResponse(Lbryio.call("notification", "list", parameters, context));
|
||||
if (array != null) {
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
|
|
|
@ -12,10 +12,10 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class NotificationUpdateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private List<Long> ids;
|
||||
private boolean seen;
|
||||
private boolean read;
|
||||
private boolean updateRead;
|
||||
private final List<Long> ids;
|
||||
private final boolean seen;
|
||||
private final boolean read;
|
||||
private final boolean updateRead;
|
||||
|
||||
public NotificationUpdateTask(List<Long> ids, boolean seen) {
|
||||
this(ids, false, true, false);
|
||||
|
|
|
@ -22,10 +22,10 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class TwitterVerifyTask extends AsyncTask<Void, Void, RewardVerified> {
|
||||
private Context context;
|
||||
private View progressView;
|
||||
private TwitterOauth twitterOauth;
|
||||
private RewardVerifiedHandler handler;
|
||||
private final Context context;
|
||||
private final View progressView;
|
||||
private final TwitterOauth twitterOauth;
|
||||
private final RewardVerifiedHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public TwitterVerifyTask(TwitterOauth twitterOauth, View progressView, Context context, RewardVerifiedHandler handler) {
|
||||
|
|
|
@ -11,8 +11,8 @@ import io.lbry.browser.data.DatabaseHelper;
|
|||
import io.lbry.browser.model.UrlSuggestion;
|
||||
|
||||
public class FetchRecentUrlHistoryTask extends AsyncTask<Void, Void, List<UrlSuggestion>> {
|
||||
private DatabaseHelper dbHelper;
|
||||
private FetchRecentUrlHistoryHandler handler;
|
||||
private final DatabaseHelper dbHelper;
|
||||
private final FetchRecentUrlHistoryHandler handler;
|
||||
public FetchRecentUrlHistoryTask(DatabaseHelper dbHelper, FetchRecentUrlHistoryHandler handler) {
|
||||
this.dbHelper = dbHelper;
|
||||
this.handler = handler;
|
||||
|
|
|
@ -10,15 +10,14 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
import io.lbry.browser.model.UrlSuggestion;
|
||||
import io.lbry.browser.model.ViewHistory;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
|
||||
public class FetchViewHistoryTask extends AsyncTask<Void, Void, List<ViewHistory>> {
|
||||
private DatabaseHelper dbHelper;
|
||||
private FetchViewHistoryHandler handler;
|
||||
private int pageSize;
|
||||
private Date lastDate;
|
||||
private final DatabaseHelper dbHelper;
|
||||
private final FetchViewHistoryHandler handler;
|
||||
private final int pageSize;
|
||||
private final Date lastDate;
|
||||
public FetchViewHistoryTask(Date lastDate, int pageSize, DatabaseHelper dbHelper, FetchViewHistoryHandler handler) {
|
||||
this.lastDate = lastDate;
|
||||
this.pageSize = pageSize;
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.database.Cursor;
|
|||
import android.database.sqlite.SQLiteException;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
@ -23,9 +22,9 @@ import io.lbry.browser.utils.Helper;
|
|||
|
||||
public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<GalleryItem>> {
|
||||
private static final String TAG = "LoadGalleryItemsTask";
|
||||
private LoadGalleryHandler handler;
|
||||
private View progressView;
|
||||
private Context context;
|
||||
private final LoadGalleryHandler handler;
|
||||
private final View progressView;
|
||||
private final Context context;
|
||||
|
||||
public LoadGalleryItemsTask(View progressView, Context context, LoadGalleryHandler handler) {
|
||||
this.progressView = progressView;
|
||||
|
@ -44,6 +43,7 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
|
|||
if (context != null) {
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
try {
|
||||
// TODO: MediaStore.Video.Media.DURATION requires API level 29
|
||||
String[] projection = {
|
||||
MediaStore.MediaColumns._ID,
|
||||
MediaStore.MediaColumns.DATA,
|
||||
|
@ -61,6 +61,7 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
|
|||
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
||||
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
||||
// TODO: MediaStore.Video.Media.DURATION requires API level 29
|
||||
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
||||
|
||||
GalleryItem item = new GalleryItem();
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package io.lbry.browser.tasks.localdata;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
import io.lbry.browser.model.UrlSuggestion;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
|
||||
public class SaveUrlHistoryTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private DatabaseHelper dbHelper;
|
||||
private UrlSuggestion suggestion;
|
||||
private SaveUrlHistoryHandler handler;
|
||||
private final DatabaseHelper dbHelper;
|
||||
private final UrlSuggestion suggestion;
|
||||
private final SaveUrlHistoryHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public SaveUrlHistoryTask(UrlSuggestion suggestion, DatabaseHelper dbHelper, SaveUrlHistoryHandler handler) {
|
||||
|
|
|
@ -7,9 +7,9 @@ import io.lbry.browser.data.DatabaseHelper;
|
|||
import io.lbry.browser.model.ViewHistory;
|
||||
|
||||
public class SaveViewHistoryTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private DatabaseHelper dbHelper;
|
||||
private ViewHistory history;
|
||||
private SaveViewHistoryHandler handler;
|
||||
private final DatabaseHelper dbHelper;
|
||||
private final ViewHistory history;
|
||||
private final SaveViewHistoryHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public SaveViewHistoryTask(ViewHistory history, DatabaseHelper dbHelper, SaveViewHistoryHandler handler) {
|
||||
|
|
|
@ -8,8 +8,8 @@ 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;
|
||||
private final Context context;
|
||||
private final CheckUserEmailVerifiedHandler handler;
|
||||
|
||||
public CheckUserEmailVerifiedTask(Context context, CheckUserEmailVerifiedHandler handler) {
|
||||
this.context = context;
|
||||
|
|
|
@ -3,8 +3,6 @@ package io.lbry.browser.tasks.verification;
|
|||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -15,9 +13,9 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class EmailNewTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String email;
|
||||
private View progressView;
|
||||
private EmailNewHandler handler;
|
||||
private final String email;
|
||||
private final View progressView;
|
||||
private final EmailNewHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public EmailNewTask(String email, View progressView, EmailNewHandler handler) {
|
||||
|
|
|
@ -13,9 +13,9 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class EmailResendTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String email;
|
||||
private View progressView;
|
||||
private GenericTaskHandler handler;
|
||||
private final String email;
|
||||
private final View progressView;
|
||||
private final GenericTaskHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public EmailResendTask(String email, View progressView, GenericTaskHandler handler) {
|
||||
|
|
|
@ -13,11 +13,11 @@ import io.lbry.browser.utils.Helper;
|
|||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class PhoneNewVerifyTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String countryCode;
|
||||
private String phoneNumber;
|
||||
private String verificationCode;
|
||||
private View progressView;
|
||||
private GenericTaskHandler handler;
|
||||
private final String countryCode;
|
||||
private final String phoneNumber;
|
||||
private final String verificationCode;
|
||||
private final View progressView;
|
||||
private final GenericTaskHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public PhoneNewVerifyTask(String countryCode, String phoneNumber, String verificationCode, View progressView, GenericTaskHandler handler) {
|
||||
|
|
|
@ -2,15 +2,9 @@ package io.lbry.browser.tasks.verification;
|
|||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.google.api.client.auth.oauth.OAuthHmacSigner;
|
||||
import com.google.api.client.auth.oauth.OAuthParameters;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
|
||||
import io.lbry.browser.VerificationActivity;
|
||||
import io.lbry.browser.model.TwitterOauth;
|
||||
import io.lbry.browser.tasks.TwitterOauthHandler;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
@ -20,8 +14,8 @@ public class TwitterAccessTokenTask extends AsyncTask<Void, Void, String> {
|
|||
private static final String ENDPOINT = "https://api.twitter.com/oauth/access_token";
|
||||
|
||||
private Exception error;
|
||||
private String oauthParams;
|
||||
private TwitterOauthHandler handler;
|
||||
private final String oauthParams;
|
||||
private final TwitterOauthHandler handler;
|
||||
|
||||
public TwitterAccessTokenTask(String oauthParams, TwitterOauthHandler handler) {
|
||||
this.oauthParams = oauthParams;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue