Compare commits

..
5 Commits
54 changed files with 2394 additions and 1559 deletions

No files matched your search

+2 -2
View File
@@ -14,8 +14,8 @@ android {
applicationId "io.lbry.browser"
minSdkVersion 21
targetSdkVersion 29
versionCode 1501
versionName "0.15.1"
versionCode 1502
versionName "0.15.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Binary file not shown.
Binary file not shown.
-7
View File
@@ -67,13 +67,6 @@
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBarTranslucent"
android:windowSoftInputMode="adjustResize" />
<activity
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout"
android:name=".FileViewActivity"
android:launchMode="singleTask"
android:parentActivityName=".MainActivity"
android:supportsPictureInPicture="true"
android:theme="@style/AppTheme.NoActionBarBlack" />
<service
android:name="io.lbry.browser.LbrynetMessagingService"
@@ -16,6 +16,7 @@ import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
@@ -29,6 +30,7 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
@@ -39,8 +41,8 @@ import android.widget.Toast;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ext.cast.CastPlayer;
import com.google.android.exoplayer2.offline.Download;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
@@ -81,7 +83,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
@@ -96,6 +97,7 @@ import io.lbry.browser.exceptions.LbryUriException;
import io.lbry.browser.listener.DownloadActionListener;
import io.lbry.browser.listener.FetchChannelsListener;
import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.StoragePermissionListener;
import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.ClaimCacheKey;
@@ -125,6 +127,7 @@ import io.lbry.browser.ui.channel.ChannelFormFragment;
import io.lbry.browser.ui.channel.ChannelFragment;
import io.lbry.browser.ui.channel.ChannelManagerFragment;
import io.lbry.browser.ui.editorschoice.EditorsChoiceFragment;
import io.lbry.browser.ui.following.FileViewFragment;
import io.lbry.browser.ui.following.FollowingFragment;
import io.lbry.browser.ui.library.LibraryFragment;
import io.lbry.browser.ui.other.AboutFragment;
@@ -144,21 +147,28 @@ import io.lbry.lbrysdk.LbrynetService;
import io.lbry.lbrysdk.ServiceHelper;
import io.lbry.lbrysdk.Utils;
import lombok.Getter;
import lombok.Setter;
public class MainActivity extends AppCompatActivity implements SdkStatusListener {
private Map<String, Class> specialRouteFragmentClassMap;
private boolean inPictureInPictureMode;
public static SimpleExoPlayer appPlayer;
public static Cache playerCache;
public static boolean playerReassigned;
public static CastContext castContext;
public static CastPlayer castPlayer;
public static Claim nowPlayingClaim;
public static boolean startingFilePickerActivity = false;
public static boolean startingShareActivity = false;
public static boolean startingFileViewActivity = false;
public static boolean startingStoragePermissionRequest = false;
public static boolean startingSignInFlowActivity = false;
public static boolean mainActive = false;
private boolean enteringPIPMode = false;
private boolean fullSyncInProgress = false;
private int queuedSyncCount = 0;
@Setter
private BackPressInterceptor backPressInterceptor;
@Getter
private String firebaseMessagingToken;
@@ -171,6 +181,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
fragmentClassNavIdMap.put(AllContentFragment.class, NavMenuItem.ID_ITEM_ALL_CONTENT);
fragmentClassNavIdMap.put(ChannelManagerFragment.class, NavMenuItem.ID_ITEM_CHANNELS);
fragmentClassNavIdMap.put(LibraryFragment.class, NavMenuItem.ID_ITEM_LIBRARY);
fragmentClassNavIdMap.put(WalletFragment.class, NavMenuItem.ID_ITEM_WALLET);
fragmentClassNavIdMap.put(RewardsFragment.class, NavMenuItem.ID_ITEM_REWARDS);
@@ -180,11 +191,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
fragmentClassNavIdMap.put(AboutFragment.class, NavMenuItem.ID_ITEM_ABOUT);
// Internal (sub-)pages
fragmentClassNavIdMap.put(FileViewFragment.class, NavMenuItem.ID_ITEM_FOLLOWING);
fragmentClassNavIdMap.put(ChannelFragment.class, NavMenuItem.ID_ITEM_FOLLOWING);
fragmentClassNavIdMap.put(SearchFragment.class, NavMenuItem.ID_ITEM_FOLLOWING);
}
public static final int REQUEST_STORAGE_PERMISSION = 1001;
public static final int REQUEST_SIMPLE_SIGN_IN = 2001;
public static final int REQUEST_WALLET_SYNC_SIGN_IN = 2002;
@@ -243,18 +254,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// broadcast receivers
private BroadcastReceiver serviceActionsReceiver;
private BroadcastReceiver requestsReceiver;
private BroadcastReceiver userActionsReceiver;
private static boolean appStarted;
private boolean serviceRunning;
private CheckSdkReadyTask checkSdkReadyTask;
private boolean receivedStopService;
private ActionBarDrawerToggle toggle;
private SyncSetTask syncSetTask = null;
private List<WalletSync> pendingSyncSetQueue;
@Getter
private DatabaseHelper dbHelper;
private int selectedMenuItemId = -1;
private List<DownloadActionListener> downloadActionListeners;
private List<SdkStatusListener> sdkStatusListeners;
private List<StoragePermissionListener> storagePermissionListeners;
private List<WalletBalanceListener> walletBalanceListeners;
private List<FetchChannelsListener> fetchChannelsListeners;
@Getter
@@ -338,15 +351,44 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// register receivers
registerRequestsReceiver();
registerServiceActionsReceiver();
registerUserActionsReceiver();
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
// not fullscreen
View appBarMainContainer = findViewById(R.id.app_bar_main_container);
appBarMainContainer.setPadding(
appBarMainContainer.getPaddingLeft(), appBarMainContainer.getPaddingTop(), appBarMainContainer.getPaddingRight(), 0);
appBarMainContainer.setFitsSystemWindows(true);
}
}
});
// setup uri bar
setupUriBar();
/*View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
findViewById(R.id.drawer_layout).setFitsSystemWindows(false);
} else {
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(true);
findViewById(R.id.drawer_layout).setFitsSystemWindows(true);
}
}
});*/
// other
pendingSyncSetQueue = new ArrayList<>();
openNavFragments = new HashMap<>();
downloadActionListeners = new ArrayList<>();
sdkStatusListeners = new ArrayList<>();
storagePermissionListeners = new ArrayList<>();
walletBalanceListeners = new ArrayList<>();
fetchChannelsListeners = new ArrayList<>();
@@ -400,12 +442,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override
public void onClick(View view) {
if (nowPlayingClaim != null) {
Intent intent = new Intent(MainActivity.this, FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("claimId", nowPlayingClaim.getClaimId());
intent.putExtra("url", nowPlayingClaim.getPermanentUrl());
startingFileViewActivity = true;
startActivity(intent);
openFileUrl(!Helper.isNullOrEmpty(nowPlayingClaim.getShortUrl()) ? nowPlayingClaim.getShortUrl() : nowPlayingClaim.getPermanentUrl());
}
}
});
@@ -438,7 +475,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
});
navItemsView.setAdapter(navMenuAdapter);
findViewById(R.id.sign_in_button).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.sign_in_button_container).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
walletSyncSignIn();
@@ -490,6 +527,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
sdkStatusListeners.remove(listener);
}
public void addStoragePermissionListener(StoragePermissionListener listener) {
if (!storagePermissionListeners.contains(listener)) {
storagePermissionListeners.add(listener);
}
}
public void removeStoragePermissionListener(StoragePermissionListener listener) {
storagePermissionListeners.remove(listener);
}
public void addWalletBalanceListener(WalletBalanceListener listener) {
if (!walletBalanceListeners.contains(listener)) {
walletBalanceListeners.add(listener);
@@ -501,7 +548,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
public void removeNavFragment(Class fragmentClass, int navItemId) {
String key = buildNavFragmentKey(fragmentClass, navItemId);
String key = buildNavFragmentKey(fragmentClass, navItemId, null);
if (openNavFragments.containsKey(key)) {
openNavFragments.remove(key);
}
@@ -589,27 +636,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
wunderbar.setSelection(0);
}
private void openAllContentFragmentWithTag(String tag) {
public void openAllContentFragmentWithTag(String tag) {
Map<String, Object> params = new HashMap<>();
params.put("singleTag", tag);
openFragment(AllContentFragment.class, true, NavMenuItem.ID_ITEM_ALL_CONTENT, params);
}
public static void openFileUrl(String url, Context context) {
Intent intent = new Intent(context, FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("url", url);
startingFileViewActivity = true;
context.startActivity(intent);
public void openFileUrl(String url) {
Map<String, Object> params = new HashMap<>();
params.put("url", url);
openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
}
public static void openFileClaim(Claim claim, Context context) {
Intent intent = new Intent(context, FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("claimId", claim.getClaimId());
intent.putExtra("url", !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
startingFileViewActivity = true;
context.startActivity(intent);
public void openFileClaim(Claim claim) {
Map<String, Object> params = new HashMap<>();
params.put("claimId", claim.getClaimId());
params.put("url", !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
}
private FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() {
@@ -636,21 +679,31 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
findViewById(R.id.content_main).setVisibility(View.GONE);
findViewById(R.id.floating_balance_main_container).setVisibility(View.GONE);
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
getSupportActionBar().hide();
PlayerView pipPlayer = findViewById(R.id.pip_player);
pipPlayer.setVisibility(View.VISIBLE);
pipPlayer.setPlayer(appPlayer);
pipPlayer.setUseController(false);
playerReassigned = true;
}
private void renderFullMode() {
getSupportActionBar().show();
findViewById(R.id.content_main).setVisibility(View.VISIBLE);
findViewById(R.id.floating_balance_main_container).setVisibility(View.VISIBLE);
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
Fragment fragment = getCurrentFragment();
if (!(fragment instanceof FileViewFragment)) {
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
}
if (!Lbry.SDK_READY) {
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE);
}
PlayerView pipPlayer = findViewById(R.id.pip_player);
pipPlayer.setVisibility(View.INVISIBLE);
pipPlayer.setPlayer(null);
playerReassigned = true;
}
@Override
@@ -673,6 +726,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
appPlayer.release();
appPlayer = null;
}
if (playerCache != null) {
playerCache.release();
playerCache = null;
}
}
@Override
@@ -709,8 +766,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override
protected void onResume() {
super.onResume();
mainActive = true;
applyNavbarSigninPadding();
checkFirstRun();
checkNowPlaying();
@@ -750,7 +807,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override
protected void onPause() {
mainActive = false;
if (!enteringPIPMode && appPlayer != null) {
appPlayer.setPlayWhenReady(false);
}
super.onPause();
}
@@ -764,7 +823,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
closeIcon.setVisibility(visible ? View.VISIBLE : View.GONE);
}
private int getScaledValue(int value) {
public int getScaledValue(int value) {
float scale = getResources().getDisplayMetrics().density;
return (int) (value * scale + 0.5f);
}
@@ -824,7 +883,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
clearWunderbarFocus(wunderbar);
handled = true;
} else {
openFileUrl(uri.toString(), MainActivity.this);
openFileUrl(uri.toString());
clearWunderbarFocus(wunderbar);
handled = true;
}
@@ -849,7 +908,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
urlSuggestionListAdapter.setListener(new UrlSuggestionListAdapter.UrlSuggestionClickListener() {
@Override
public void onUrlSuggestionClicked(UrlSuggestion urlSuggestion) {
Context context = MainActivity.this;
switch (urlSuggestion.getType()) {
case UrlSuggestion.TYPE_CHANNEL:
// open channel page
@@ -861,9 +919,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
break;
case UrlSuggestion.TYPE_FILE:
if (urlSuggestion.getClaim() != null) {
openFileClaim(urlSuggestion.getClaim(), context);
openFileClaim(urlSuggestion.getClaim());
} else {
openFileUrl(urlSuggestion.getUri().toString(), context);
openFileUrl(urlSuggestion.getUri().toString());
}
break;
case UrlSuggestion.TYPE_SEARCH:
@@ -1091,7 +1149,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return suggestions;
}
private void checkNowPlaying() {
public void checkNowPlaying() {
Fragment fragment = getCurrentFragment();
if (fragment instanceof FileViewFragment) {
return;
}
if (nowPlayingClaim != null) {
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
@@ -1102,11 +1165,64 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
playerView.setPlayer(null);
playerView.setPlayer(appPlayer);
playerView.setUseController(false);
playerReassigned = true;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
public void hideGlobalNowPlaying() {
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
}
public void unsetFitsSystemWindows(View view) {
view.setFitsSystemWindows(false);
}
public void enterFullScreenMode() {
hideFloatingWalletBalance();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
public int getStatusBarHeight() {
int height = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
height = getResources().getDimensionPixelSize(resourceId);
}
return height;
}
public void exitFullScreenMode() {
View decorView = getWindow().getDecorView();
int flags = isDarkMode() ? (View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE) :
(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE);
decorView.setSystemUiVisibility(flags);
if (!Lbry.SDK_READY) {
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE);
}
showFloatingWalletBalance();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.show();
}
}
private void initKeyStore() {
try {
Lbry.KEYSTORE = Utils.initKeyStore(this);
@@ -1296,7 +1412,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof FollowingFragment) {
// reload local subscriptions
((FollowingFragment) fragment).fetchLoadedSubscriptions();
((FollowingFragment) fragment).fetchLoadedSubscriptions(true);
}
}
}
@@ -1353,11 +1469,81 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return walletSyncEnabled && Lbryio.isSignedIn();
}
public void syncSet(String hash, String data) {
if (syncSetTask == null || syncSetTask.getStatus() == AsyncTask.Status.FINISHED) {
syncSetTask = new SyncSetTask(Lbryio.lastRemoteHash, hash, data, new DefaultSyncTaskHandler() {
@Override
public void onSyncSetSuccess(String hash) {
Lbryio.lastRemoteHash = hash;
WalletSync walletSync = new WalletSync(hash, data);
Lbryio.lastWalletSync = walletSync;
if (pendingSyncSetQueue.size() > 0) {
fullSyncInProgress = true;
WalletSync nextSync = pendingSyncSetQueue.remove(0);
syncSet(nextSync.getHash(), nextSync.getData());
} else if (queuedSyncCount > 0) {
queuedSyncCount--;
syncApplyAndSet();
}
fullSyncInProgress = false;
}
@Override
public void onSyncSetError(Exception error) {
// log app exceptions
if (pendingSyncSetQueue.size() > 0) {
WalletSync nextSync = pendingSyncSetQueue.remove(0);
syncSet(nextSync.getHash(), nextSync.getData());
} else if (queuedSyncCount > 0) {
queuedSyncCount--;
syncApplyAndSet();
}
fullSyncInProgress = false;
}
});
syncSetTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
WalletSync pending = new WalletSync(hash, data);
pendingSyncSetQueue.add(pending);
}
}
public void syncApplyAndSet() {
fullSyncInProgress = true;
String password = Utils.getSecureValue(SECURE_VALUE_KEY_SAVED_PASSWORD, this, Lbry.KEYSTORE);
SyncApplyTask fetchTask = new SyncApplyTask(true, password, new DefaultSyncTaskHandler() {
@Override
public void onSyncApplySuccess(String hash, String data) {
if (!hash.equalsIgnoreCase(Lbryio.lastRemoteHash)) {
syncSet(hash, data);
} else {
fullSyncInProgress = false;
queuedSyncCount = 0;
}
}
@Override
public void onSyncApplyError(Exception error) {
fullSyncInProgress = false;
if (queuedSyncCount > 0) {
queuedSyncCount--;
syncApplyAndSet();
}
}
});
fetchTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public void syncWalletAndLoadPreferences() {
if (!userSyncEnabled()) {
return;
}
if (fullSyncInProgress) {
queuedSyncCount++;
}
fullSyncInProgress = true;
String password = Utils.getSecureValue(SECURE_VALUE_KEY_SAVED_PASSWORD, this, Lbry.KEYSTORE);
SyncGetTask task = new SyncGetTask(password, true, null, new DefaultSyncTaskHandler() {
@Override
@@ -1376,13 +1562,21 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onSyncGetError(Exception error) {
// pass
Log.e(TAG, String.format("sync get failed: %s", error != null ? error.getMessage() : "no error message"), error);
fullSyncInProgress = false;
if (queuedSyncCount > 0) {
queuedSyncCount--;
syncApplyAndSet();
}
}
@Override
public void onSyncApplySuccess(String hash, String data) {
if (!hash.equalsIgnoreCase(Lbryio.lastRemoteHash)) {
SyncSetTask setTask = new SyncSetTask(Lbryio.lastRemoteHash, hash, data, null);
setTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
syncSet(hash, data);
} else {
fullSyncInProgress = false;
queuedSyncCount = 0;
}
loadSharedUserState();
@@ -1392,6 +1586,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onSyncApplyError(Exception error) {
// pass
Log.e(TAG, String.format("sync apply failed: %s", error != null ? error.getMessage() : "no error message"), error);
fullSyncInProgress = false;
if (queuedSyncCount > 0) {
queuedSyncCount--;
syncApplyAndSet();
}
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -1458,70 +1657,43 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
}
}
private void registerUserActionsReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_NOW_PLAYING_CLAIM_UPDATED);
intentFilter.addAction(ACTION_NOW_PLAYING_CLAIM_CLEARED);
userActionsReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ACTION_NOW_PLAYING_CLAIM_UPDATED.equals(action)) {
handleNowPlayingClaimUpdated();
} else if (ACTION_NOW_PLAYING_CLAIM_CLEARED.equals(action)) {
handleNowPlayingClaimCleared();
}
}
private void handleNowPlayingClaimUpdated() {
if (nowPlayingClaim != null) {
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(nowPlayingClaim.getPublisherTitle());
}
}
private void handleNowPlayingClaimCleared() {
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
((TextView) findViewById(R.id.global_now_playing_title)).setText(null);
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(null);
if (MainActivity.appPlayer != null) {
MainActivity.appPlayer.setPlayWhenReady(false);
}
}
};
registerReceiver(userActionsReceiver, intentFilter);
}
public void showMessage(int stringResourceId) {
Snackbar.make(findViewById(R.id.content_main), stringResourceId, Snackbar.LENGTH_LONG).show();
}
public void showMessage(String message) {
Snackbar.make(findViewById(R.id.content_main), message, Snackbar.LENGTH_LONG).show();
}
public void showError(String message) {
Snackbar.make(findViewById(R.id.content_main), message, Snackbar.LENGTH_LONG).
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
}
@Override
public void onBackPressed() {
if (findViewById(R.id.url_suggestions_container).getVisibility() == View.VISIBLE) {
clearWunderbarFocus(findViewById(R.id.wunderbar));
return;
}
if (backPressInterceptor != null && backPressInterceptor.onBackPressed()) {
return;
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
boolean handled = false;
if (findViewById(R.id.url_suggestions_container).getVisibility() == View.VISIBLE) {
clearWunderbarFocus(findViewById(R.id.wunderbar));
ChannelFormFragment channelFormFragment = null;
for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof ChannelFormFragment) {
channelFormFragment = ((ChannelFormFragment) fragment);
break;
}
}
if (channelFormFragment != null && channelFormFragment.isSaveInProgress()) {
handled = true;
} else {
ChannelFormFragment channelFormFragment = null;
for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof ChannelFormFragment) {
channelFormFragment = ((ChannelFormFragment) fragment);
break;
}
}
if (channelFormFragment != null && channelFormFragment.isSaveInProgress()) {
handled = true;
return;
}
return;
}
if (!handled) {
@@ -1563,24 +1735,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case REQUEST_STORAGE_PERMISSION:
ChannelFormFragment channelFormFragment = null;
//PublishFormFragment publishFormFragment = null;
for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof ChannelFormFragment) {
channelFormFragment = ((ChannelFormFragment) fragment);
break;
}
}
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (channelFormFragment != null) {
channelFormFragment.onStoragePermissionGranted();
for (StoragePermissionListener listener : storagePermissionListeners) {
listener.onStoragePermissionGranted();
}
} else {
if (channelFormFragment != null) {
channelFormFragment.onStoragePermissionRefused();
for (StoragePermissionListener listener : storagePermissionListeners) {
listener.onStoragePermissionRefused();
}
}
startingStoragePermissionRequest = false;
break;
}
@@ -1631,9 +1795,18 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
}
private void applyNavbarSigninPadding() {
int statusBarHeight = getStatusBarHeight();
View signInButton = findViewById(R.id.sign_in_button_container);
View signedInEmailContainer = findViewById(R.id.signed_in_email_container);
signInButton.setPadding(0, statusBarHeight, 0, 0);
signedInEmailContainer.setPadding(0, statusBarHeight, 0, 0);
}
private void showSignedInUser() {
if (Lbryio.isSignedIn()) {
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_in_button_container).setVisibility(View.GONE);
findViewById(R.id.signed_in_email_container).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.signed_in_email)).setText(Lbryio.getSignedInEmail());
findViewById(R.id.sign_in_header_divider).setBackgroundColor(getResources().getColor(R.color.lightDivider));
@@ -1891,7 +2064,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (uri.isChannel()) {
openChannelUrl(uri.toString());
} else {
openFileUrl(uri.toString(), this);
openFileUrl(uri.toString());
}
} catch (LbryUriException ex) {
// pass
@@ -1936,6 +2109,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}, 1000);
return;
}
if (startingStoragePermissionRequest) {
return;
}
enterPIPMode();
}
@@ -1946,8 +2122,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
appPlayer != null &&
FileViewActivity.instance == null &&
!startingFileViewActivity &&
!startingFilePickerActivity &&
!startingSignInFlowActivity) {
enteringPIPMode = true;
@@ -2024,7 +2198,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
private void unregisterReceivers() {
Helper.unregisterReceiver(requestsReceiver, this);
Helper.unregisterReceiver(serviceActionsReceiver, this);
Helper.unregisterReceiver(userActionsReceiver, this);
}
private Notification buildServiceNotification() {
@@ -2097,14 +2270,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return flatMenu;
}
public static void setNowPlayingClaim(Claim claim, Context context) {
public void setNowPlayingClaim(Claim claim) {
nowPlayingClaim = claim;
context.sendBroadcast(new Intent(ACTION_NOW_PLAYING_CLAIM_UPDATED));
if (claim != null) {
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(nowPlayingClaim.getPublisherTitle());
}
}
public static void clearNowPlayingClaim(Context context) {
public void clearNowPlayingClaim() {
nowPlayingClaim = null;
context.sendBroadcast(new Intent(ACTION_NOW_PLAYING_CLAIM_CLEARED));
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
((TextView) findViewById(R.id.global_now_playing_title)).setText(null);
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(null);
if (appPlayer != null) {
appPlayer.setPlayWhenReady(false);
}
}
private static class CheckSdkReadyTask extends AsyncTask<Void, Void, Boolean> {
@@ -2225,7 +2406,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
protected void onStop() {
if (!MainActivity.startingFileViewActivity && appPlayer != null && inPictureInPictureMode) {
if (appPlayer != null && inPictureInPictureMode) {
appPlayer.setPlayWhenReady(false);
}
super.onStop();
@@ -2253,13 +2434,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
openFragment(fragmentClass, allowNavigateBack, navItemId, null);
}
private static String buildNavFragmentKey(Class fragmentClass, int navItemId) {
private static String buildNavFragmentKey(Class fragmentClass, int navItemId, Map<String, Object> params) {
if (params != null && params.containsKey("url")) {
return String.format("%s-%d-%s", fragmentClass.getName(), navItemId, params.get("url").toString());
}
return String.format("%s-%d", fragmentClass.getName(), navItemId);
}
public void openFragment(Class fragmentClass, boolean allowNavigateBack, int navItemId, Map<String, Object> params) {
try {
String key = buildNavFragmentKey(fragmentClass, navItemId);
String key = buildNavFragmentKey(fragmentClass, navItemId, params);
Fragment fragment = openNavFragments.containsKey(key) ? openNavFragments.get(key) : (Fragment) fragmentClass.newInstance();
if (fragment instanceof BaseFragment) {
((BaseFragment) fragment).setParams(params);
@@ -2327,6 +2512,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (!forceRequest && ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
Toast.makeText(context, rationale, Toast.LENGTH_LONG).show();
} else {
startingStoragePermissionRequest = true;
ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode);
}
}
@@ -2335,4 +2521,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static boolean hasPermission(String permission, Context context) {
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
}
public interface BackPressInterceptor {
boolean onBackPressed();
}
}
@@ -101,7 +101,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
}
vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE);
vh.thumbnailView.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.GONE : View.VISIBLE);
vh.alphaView.setText(claim.isPlaceholder() ? null : claim.getName().substring(1, 2));
vh.alphaView.setText(claim.isPlaceholder() ? null : claim.getName() != null ? claim.getName().substring(1, 2) : "");
int bgColor = Helper.generateRandomColorForValue(claim.getClaimId());
Helper.setIconViewBackgroundColor(vh.alphaContainer, bgColor, claim.isPlaceholder(), context);
@@ -22,6 +22,7 @@ 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;
@@ -54,6 +55,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
private boolean inSelectionMode;
@Setter
private SelectionModeListener selectionModeListener;
private float scale;
public ClaimListAdapter(List<Claim> items, Context context) {
this.context = context;
@@ -63,6 +65,9 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
quickClaimUrlMap = new HashMap<>();
notFoundClaimIdMap = new HashMap<>();
notFoundClaimUrlMap = new HashMap<>();
if (context != null) {
scale = context.getResources().getDisplayMetrics().density;
}
}
public List<Claim> getSelectedItems() {
@@ -87,6 +92,10 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
return null;
}
public List<Claim> getItems() {
return new ArrayList<>(this.items);
}
public void clearItems() {
clearSelectedItems();
this.items.clear();
@@ -97,6 +106,10 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
notifyDataSetChanged();
}
public Claim getLastItem() {
return items.size() > 0 ? items.get(items.size() - 1) : null;
}
public void addFeaturedItem(Claim claim) {
items.add(0, claim);
notifyDataSetChanged();
@@ -118,6 +131,11 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
notifyDataSetChanged();
}
public void removeItems(List<Claim> claims) {
items.removeAll(claims);
notifyDataSetChanged();
}
public void removeItem(Claim claim) {
items.remove(claim);
selectedItems.remove(claim);
@@ -257,9 +275,18 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
return new ClaimListAdapter.ViewHolder(v);
}
public int getScaledValue(int value) {
return (int) (value * scale + 0.5f);
}
@Override
public void onBindViewHolder(ClaimListAdapter.ViewHolder vh, int position) {
int type = getItemViewType(position);
int paddingTop = position == 0 ? 16 : 8;
int paddingBottom = position == getItemCount() - 1 ? 16 : 8;
int paddingTopScaled = getScaledValue(paddingTop);
int paddingBottomScaled = getScaledValue(paddingBottom);
vh.itemView.setPadding(vh.itemView.getPaddingLeft(), paddingTopScaled, vh.itemView.getPaddingRight(), paddingBottomScaled);
Claim original = items.get(position);
boolean isRepost = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType());
@@ -56,6 +56,11 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
public int getSelectedCount() { return selectedItems.size(); }
public void clearItems() {
items.clear();
notifyDataSetChanged();
}
public List<Claim> getSelectedItems() {
return this.selectedItems;
}
@@ -84,10 +84,16 @@ public class DiscoverDialogFragment extends BottomSheetDialogFragment {
dialogActionsListener.onResume();
}
}
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
super.onDismiss(dialog);
if (dialogActionsListener != null) {
dialogActionsListener.onCancel();
}
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
if (dialogActionsListener != null) {
dialogActionsListener.onCancel();
}
@@ -24,7 +24,6 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
@@ -147,16 +146,16 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
public void onResume() {
super.onResume();
Context context = getContext();
if (context instanceof FileViewActivity) {
((FileViewActivity) context).addWalletBalanceListener(this);
if (context instanceof MainActivity) {
((MainActivity) context).addWalletBalanceListener(this);
}
fetchChannels();
}
public void onPause() {
Context context = getContext();
if (context instanceof FileViewActivity) {
((FileViewActivity) context).removeWalletBalanceListener(this);
if (context instanceof MainActivity) {
((MainActivity) context).removeWalletBalanceListener(this);
}
inputDeposit.clearFocus();
super.onPause();
@@ -178,8 +177,8 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
public void onError(Exception error) {
// could not fetch channels
Context context = getContext();
if (context instanceof FileViewActivity) {
((FileViewActivity) context).showError(error.getMessage());
if (context instanceof MainActivity) {
((MainActivity) context).showError(error.getMessage());
}
dismiss();
}
@@ -23,7 +23,6 @@ import com.google.android.material.textfield.TextInputEditText;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.listener.WalletBalanceListener;
@@ -164,15 +163,15 @@ public class SendTipDialogFragment extends BottomSheetDialogFragment implements
public void onResume() {
super.onResume();
Context context = getContext();
if (context instanceof FileViewActivity) {
((FileViewActivity) context).addWalletBalanceListener(this);
if (context instanceof MainActivity) {
((MainActivity) context).addWalletBalanceListener(this);
}
}
public void onPause() {
Context context = getContext();
if (context instanceof FileViewActivity) {
((FileViewActivity) context).removeWalletBalanceListener(this);
if (context instanceof MainActivity) {
((MainActivity) context).removeWalletBalanceListener(this);
}
super.onPause();
}
@@ -0,0 +1,6 @@
package io.lbry.browser.listener;
public interface StoragePermissionListener {
void onStoragePermissionGranted();
void onStoragePermissionRefused();
}
@@ -118,10 +118,10 @@ public class Claim {
if (fee != null) {
double amount = Helper.parseDouble(fee.getAmount(), 0);
if ("usd".equalsIgnoreCase(fee.getCurrency())) {
return new BigDecimal(String.valueOf(amount / usdRate)).multiply(new BigDecimal(100000000)); // deweys
return new BigDecimal(String.valueOf(amount / usdRate));
}
return new BigDecimal(String.valueOf(amount));
return new BigDecimal(String.valueOf(amount)).divide(new BigDecimal(100000000)); // deweys
}
return new BigDecimal(0);
@@ -8,9 +8,13 @@ public class WalletSync {
private String data;
private boolean changed;
public WalletSync(String hash, String data, boolean changed) {
public WalletSync(String hash, String data) {
this.hash = hash;
this.data = data;
}
public WalletSync(String hash, String data, boolean changed) {
this(hash, data);
this.changed = changed;
}
}
@@ -24,6 +24,19 @@ public class User {
private String primaryEmail;
private String rewardStatusChangeTrigger;
private String updatedAt;
private List<String> youtubeChannels;
private List<YoutubeChannel> youtubeChannels;
private List<String> deviceTypes;
@Data
public static class YoutubeChannel {
String ytChannelName;
String lbryChannelName;
String channelClaimId;
String syncStatus;
String statusToken;
boolean transferable;
String transferState;
List<String> publishToAddress;
String publicKey;
}
}
@@ -0,0 +1,45 @@
package io.lbry.browser.tasks;
import android.os.AsyncTask;
import java.util.HashMap;
import java.util.Map;
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 Exception error;
public SetSdkSettingTask(String key, String value, GenericTaskHandler handler) {
this.key = key;
this.value = value;
this.handler = handler;
}
@Override
protected Boolean doInBackground(Void... params) {
try {
Map<String, Object> options = new HashMap<>();
options.put("key", key);
options.put("value", value);
Lbry.genericApiCall("setting_set", options);
return true;
} catch (ApiCallException ex) {
error = ex;
return false;
}
}
protected void onPostExecute(Boolean result) {
if (handler != null) {
if (result) {
handler.onSuccess();
} else {
handler.onError(error);
}
}
}
}
@@ -0,0 +1,63 @@
package io.lbry.browser.tasks.claim;
import android.os.AsyncTask;
import android.view.View;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
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 List<String> successfulClaimIds;
private List<String> failedClaimIds;
private List<Exception> failedExceptions;
private View progressView;
private AbandonHandler handler;
public AbandonChannelTask(List<String> claimIds, View progressView, AbandonHandler handler) {
this.claimIds = claimIds;
this.progressView = progressView;
this.handler = handler;
}
protected void onPreExecute() {
Helper.setViewVisibility(progressView, View.VISIBLE);
}
public Boolean doInBackground(Void... params) {
successfulClaimIds = new ArrayList<>();
failedClaimIds = new ArrayList<>();
failedExceptions = new ArrayList<>();
for (String claimId : claimIds) {
try {
Map<String, Object> options = new HashMap<>();
options.put("claim_id", claimId);
options.put("blocking", false);
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_CHANNEL_ABANDON, options);
successfulClaimIds.add(claimId);
} catch (ApiCallException ex) {
failedClaimIds.add(claimId);
failedExceptions.add(ex);
}
}
return true;
}
protected void onPostExecute(Boolean result) {
Helper.setViewVisibility(progressView, View.GONE);
if (handler != null) {
handler.onComplete(successfulClaimIds, failedClaimIds, failedExceptions);
}
}
}
@@ -0,0 +1,7 @@
package io.lbry.browser.tasks.claim;
import java.util.List;
public interface AbandonHandler {
void onComplete(List<String> successfulClaimIds, List<String> failedClaimIds, List<Exception> errors);
}
@@ -0,0 +1,32 @@
package io.lbry.browser.tasks.file;
import android.os.AsyncTask;
import java.util.HashMap;
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;
public BulkDeleteFilesTask(List<String> claimIds) {
this.claimIds = claimIds;
}
protected Boolean doInBackground(Void... params) {
for (String claimId : claimIds) {
try {
Map<String, Object> options = new HashMap<>();
options.put("claim_id", claimId);
options.put("delete_from_download_dir", true);
Lbry.genericApiCall(Lbry.METHOD_FILE_DELETE, options);
} catch (ApiCallException ex) {
// pass
}
}
return true;
}
}
@@ -26,6 +26,7 @@ public class DeleteFileTask extends AsyncTask<Void, Void, Boolean> {
options.put("delete_from_download_dir", true);
return (boolean) Lbry.genericApiCall(Lbry.METHOD_FILE_DELETE, options);
} catch (ApiCallException ex) {
error = ex;
return false;
}
}
@@ -45,7 +45,7 @@ public class SyncSetTask extends AsyncTask<Void, Void, String> {
if (handler != null) {
if (!Helper.isNullOrEmpty(hash)) {
handler.onSyncSetSuccess(hash);
} else if (error != null) {
} else {
handler.onSyncSetError(error);
}
}
@@ -7,6 +7,7 @@ import androidx.fragment.app.Fragment;
import java.util.Map;
import io.lbry.browser.MainActivity;
import io.lbry.browser.ui.following.FileViewFragment;
import lombok.Getter;
import lombok.Setter;
@@ -19,7 +20,15 @@ public class BaseFragment extends Fragment {
super.onResume();
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).setSelectedMenuItemForFragment(this);
MainActivity activity = (MainActivity) context;
activity.setSelectedMenuItemForFragment(this);
if (this instanceof FileViewFragment) {
activity.hideGlobalNowPlaying();
} else {
activity.checkNowPlaying();
}
}
}
}
@@ -26,7 +26,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.ClaimListAdapter;
@@ -213,6 +212,7 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
singleTagView = true;
tags = Arrays.asList(tagName);
titleView.setText(Helper.capitalize(tagName));
Helper.setViewVisibility(customizeLink, View.GONE);
} else {
singleTagView = false;
// default to followed Tags scope if any tags are followed
@@ -224,8 +224,8 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
titleView.setText(getString(R.string.all_content));
}
forPrefix.setVisibility(singleTagView ? View.GONE : View.VISIBLE);
scopeLink.setVisibility(singleTagView ? View.GONE : View.VISIBLE);
Helper.setViewVisibility(forPrefix, singleTagView ? View.GONE : View.VISIBLE);
Helper.setViewVisibility(scopeLink, singleTagView ? View.GONE : View.VISIBLE);
if (reload) {
fetchClaimSearchContent(true);
@@ -451,22 +451,15 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override
public void onClaimClicked(Claim claim) {
String claimId = claim.getClaimId();
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl();
if (claim.getName().startsWith("@")) {
// channel claim
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).openChannelClaim(claim);
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (claim.getName().startsWith("@")) {
// channel claim
activity.openChannelClaim(claim);
} else {
activity.openFileClaim(claim);
}
} else {
Intent intent = new Intent(getContext(), FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("claimId", claimId);
intent.putExtra("url", url);
MainActivity.startingFileViewActivity = true;
startActivity(intent);
}
}
});
@@ -24,7 +24,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.ClaimListAdapter;
@@ -263,21 +262,15 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override
public void onClaimClicked(Claim claim) {
String claimId = claim.getClaimId();
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl();
if (claim.getName().startsWith("@")) {
// channel claim
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).openChannelClaim(claim);
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (claim.getName().startsWith("@")) {
// channel claim
activity.openChannelClaim(claim);
} else {
activity.openFileClaim(claim);
}
} else {
Intent intent = new Intent(getContext(), FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("claimId", claimId);
intent.putExtra("url", url);
MainActivity.startingFileViewActivity = true;
startActivity(intent);
}
}
});
@@ -37,6 +37,7 @@ import io.lbry.browser.BuildConfig;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.TagListAdapter;
import io.lbry.browser.listener.StoragePermissionListener;
import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.NavMenuItem;
@@ -54,7 +55,8 @@ import io.lbry.browser.utils.LbryAnalytics;
import io.lbry.browser.utils.LbryUri;
import lombok.Getter;
public class ChannelFormFragment extends BaseFragment implements WalletBalanceListener, TagListAdapter.TagClickListener {
public class ChannelFormFragment extends BaseFragment implements
StoragePermissionListener, TagListAdapter.TagClickListener, WalletBalanceListener {
private static final int SUGGESTED_LIMIT = 8;
@@ -326,6 +328,14 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
logPublish.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
if (!editMode) {
// channel created
Bundle bundle = new Bundle();
bundle.putString("claim_id", claimResult.getClaimId());
bundle.putString("claim_name", claimResult.getName());
LbryAnalytics.logEvent(LbryAnalytics.EVENT_CHANNEL_CREATE, bundle);
}
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
@@ -436,6 +446,12 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
Snackbar.make(getView(), R.string.image_upload_failed, Snackbar.LENGTH_LONG).setBackgroundTint(
ContextCompat.getColor(context, R.color.red)
).show();
if (coverFilePickerActive) {
// cover selected
imageCover.setImageResource(R.drawable.default_channel_cover);
} else if (thumbnailFilePickerActive) {
imageThumbnail.setImageDrawable(null);
}
coverFilePickerActive = false;
thumbnailFilePickerActive = false;
uploading = false;
@@ -490,6 +506,7 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) getContext();
activity.removeStoragePermissionListener(this);
activity.removeWalletBalanceListener(this);
activity.restoreToggle();
activity.showFloatingWalletBalance();
@@ -509,6 +526,7 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
activity.addStoragePermissionListener(this);
if (editMode) {
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
@@ -288,14 +288,15 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
updateRequired = true;
}
}
if (!updateRequired && params.containsKey("url")) {
if (params.containsKey("url")) {
String newUrl = params.get("url").toString();
if (!newUrl.equalsIgnoreCase(url) || claim == null) {
if (claim == null || !newUrl.equalsIgnoreCase(url)) {
this.claim = null;
this.url = newUrl;
updateRequired = true;
}
}
if (updateRequired) {
resetSubCount();
if (!Helper.isNullOrEmpty(url)) {
@@ -2,6 +2,7 @@ package io.lbry.browser.ui.channel;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -19,6 +20,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.HashMap;
@@ -32,6 +34,8 @@ import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.SelectionModeListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.NavMenuItem;
import io.lbry.browser.tasks.claim.AbandonChannelTask;
import io.lbry.browser.tasks.claim.AbandonHandler;
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
import io.lbry.browser.tasks.claim.ClaimListTask;
import io.lbry.browser.ui.BaseFragment;
@@ -144,7 +148,7 @@ public class ChannelManagerFragment extends BaseFragment implements ActionMode.C
ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, getLoading(), new ClaimListResultHandler() {
@Override
public void onSuccess(List<Claim> claims) {
Lbry.ownChannels = new ArrayList<>(claims);
Lbry.ownChannels = Helper.filterDeletedClaims(new ArrayList<>(claims));
Context context = getContext();
if (adapter == null) {
adapter = new ClaimListAdapter(claims, context);
@@ -260,7 +264,7 @@ public class ChannelManagerFragment extends BaseFragment implements ActionMode.C
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//handleDeleteSelectedClaims(selectedClaims);
handleDeleteSelectedClaims(selectedClaims);
}
}).setNegativeButton(R.string.no, null);
builder.show();
@@ -270,4 +274,48 @@ public class ChannelManagerFragment extends BaseFragment implements ActionMode.C
return false;
}
private void handleDeleteSelectedClaims(List<Claim> selectedClaims) {
List<String> claimIds = new ArrayList<>();
for (Claim claim : selectedClaims) {
claimIds.add(claim.getClaimId());
}
if (actionMode != null) {
actionMode.finish();
}
Helper.setViewVisibility(channelList, View.INVISIBLE);
Helper.setViewVisibility(fabNewChannel, View.INVISIBLE);
AbandonChannelTask task = new AbandonChannelTask(claimIds, bigLoading, new AbandonHandler() {
@Override
public void onComplete(List<String> successfulClaimIds, List<String> failedClaimIds, List<Exception> errors) {
View root = getView();
if (root != null) {
if (failedClaimIds.size() > 0) {
Snackbar.make(root, R.string.one_or_more_channels_failed_abandon, Snackbar.LENGTH_LONG).
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
} else if (successfulClaimIds.size() == claimIds.size()) {
try {
String message = getResources().getQuantityString(R.plurals.channels_deleted, successfulClaimIds.size());
Snackbar.make(root, message, Snackbar.LENGTH_LONG).show();
} catch (IllegalStateException ex) {
// pass
}
}
}
Lbry.abandonedClaimIds.addAll(successfulClaimIds);
if (adapter != null) {
adapter.setItems(Helper.filterDeletedClaims(adapter.getItems()));
}
Helper.setViewVisibility(channelList, View.VISIBLE);
Helper.setViewVisibility(fabNewChannel, View.VISIBLE);
checkNoChannels();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@@ -22,7 +22,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.EditorsChoiceItemAdapter;
@@ -116,12 +115,10 @@ public class EditorsChoiceFragment extends BaseFragment {
@Override
public void onEditorsChoiceItemClicked(EditorsChoiceItem item) {
String url = item.getPermanentUrl();
Intent intent = new Intent(getContext(), FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("url", url);
MainActivity.startingFileViewActivity = true;
startActivity(intent);
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).openFileUrl(url);
}
}
});
} else {
@@ -28,7 +28,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.ChannelFilterListAdapter;
@@ -90,6 +89,7 @@ public class FollowingFragment extends BaseFragment implements
private boolean contentClaimSearchLoading = false;
private boolean suggestedClaimSearchLoading = false;
private View noContentView;
private boolean subscriptionsShown;
private List<Integer> queuedContentPages = new ArrayList<>();
private List<Integer> queuedSuggestedPages = new ArrayList<>();
@@ -249,8 +249,8 @@ public class FollowingFragment extends BaseFragment implements
@Override
public void onClick(View view) {
buildChannelIdsAndUrls();
currentSuggestedPage = 1;
discoverDialog = DiscoverDialogFragment.newInstance();
excludeChannelIdsForDiscover = channelIds != null ? new ArrayList<>(channelIds) : null;
discoverDialog.setAdapter(suggestedChannelAdapter);
discoverDialog.setDialogActionsListener(new DiscoverDialogFragment.DiscoverDialogListener() {
@Override
@@ -265,6 +265,9 @@ public class FollowingFragment extends BaseFragment implements
public void onCancel() {
discoverDialog = null;
excludeChannelIdsForDiscover = null;
if (suggestedChannelAdapter != null) {
suggestedChannelAdapter.clearItems();
}
}
@Override
public void onResume() {
@@ -353,7 +356,7 @@ public class FollowingFragment extends BaseFragment implements
}
if (Lbryio.subscriptions != null && Lbryio.subscriptions.size() > 0) {
fetchLoadedSubscriptions();
fetchLoadedSubscriptions(true);
} else {
fetchSubscriptions();
}
@@ -366,7 +369,7 @@ public class FollowingFragment extends BaseFragment implements
PreferenceManager.getDefaultSharedPreferences(context).unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
public void fetchLoadedSubscriptions() {
public void fetchLoadedSubscriptions(boolean showSubscribed) {
subscriptionsList = new ArrayList<>(Lbryio.subscriptions);
buildChannelIdsAndUrls();
if (Lbryio.cacheResolvedSubscriptions.size() > 0) {
@@ -377,7 +380,9 @@ public class FollowingFragment extends BaseFragment implements
fetchClaimSearchContent(resetClaimSearchContent);
resetClaimSearchContent = false;
showSubscribedContent();
if (showSubscribed && subscriptionsList.size() > 0) {
showSubscribedContent();
}
}
public void loadFollowing() {
@@ -458,6 +463,7 @@ public class FollowingFragment extends BaseFragment implements
}
private void showSubscribedContent() {
subscriptionsShown = true;
Helper.setViewText(titleView, R.string.channels_you_follow);
Helper.setViewVisibility(horizontalChannelList, View.VISIBLE);
@@ -484,6 +490,8 @@ public class FollowingFragment extends BaseFragment implements
}
}
}
excludeChannelIdsForDiscover = channelIds != null ? new ArrayList<>(channelIds) : null;
}
private void fetchAndResolveChannelList() {
@@ -579,22 +587,15 @@ public class FollowingFragment extends BaseFragment implements
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override
public void onClaimClicked(Claim claim) {
String claimId = claim.getClaimId();
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl();
if (claim.getName().startsWith("@")) {
// channel claim
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).openChannelClaim(claim);
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (claim.getName().startsWith("@")) {
// channel claim
activity.openChannelClaim(claim);
} else {
activity.openFileClaim(claim);
}
} else {
Intent intent = new Intent(getContext(), FileViewActivity.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("claimId", claimId);
intent.putExtra("url", url);
MainActivity.startingFileViewActivity = true;
startActivity(intent);
}
}
});
@@ -718,12 +719,11 @@ public class FollowingFragment extends BaseFragment implements
ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
if (discoverDialog != null) {
Lbryio.addSubscription(subscription);
Lbryio.addCachedResolvedSubscription(claim);
resetClaimSearchContent = true;
fetchLoadedSubscriptions();
}
Lbryio.addSubscription(subscription);
Lbryio.addCachedResolvedSubscription(claim);
resetClaimSearchContent = true;
fetchLoadedSubscriptions(subscriptionsShown);
saveSharedUserState();
}
@@ -740,12 +740,11 @@ public class FollowingFragment extends BaseFragment implements
ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, true, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override
public void onSuccess() {
if (discoverDialog != null) {
Lbryio.removeSubscription(subscription);
Lbryio.removeCachedResolvedSubscription(claim);
resetClaimSearchContent = true;
fetchLoadedSubscriptions();
}
Lbryio.removeSubscription(subscription);
Lbryio.removeCachedResolvedSubscription(claim);
resetClaimSearchContent = true;
fetchLoadedSubscriptions(subscriptionsShown);
saveSharedUserState();
}
@@ -1,10 +1,13 @@
package io.lbry.browser.ui.library;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
@@ -12,16 +15,23 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ActionMode;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import org.json.JSONException;
import org.json.JSONObject;
import java.nio.channels.AsynchronousChannel;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
@@ -29,22 +39,31 @@ import io.lbry.browser.adapter.ClaimListAdapter;
import io.lbry.browser.data.DatabaseHelper;
import io.lbry.browser.listener.DownloadActionListener;
import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.SelectionModeListener;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.LbryFile;
import io.lbry.browser.model.NavMenuItem;
import io.lbry.browser.model.ViewHistory;
import io.lbry.browser.tasks.claim.AbandonChannelTask;
import io.lbry.browser.tasks.claim.AbandonHandler;
import io.lbry.browser.tasks.file.BulkDeleteFilesTask;
import io.lbry.browser.tasks.file.DeleteFileTask;
import io.lbry.browser.tasks.file.FileListTask;
import io.lbry.browser.tasks.localdata.FetchViewHistoryTask;
import io.lbry.browser.ui.BaseFragment;
import io.lbry.browser.ui.channel.ChannelFormFragment;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.LbryAnalytics;
public class LibraryFragment extends BaseFragment implements DownloadActionListener, SdkStatusListener {
public class LibraryFragment extends BaseFragment implements
ActionMode.Callback, DownloadActionListener, SelectionModeListener, SdkStatusListener {
private static final int FILTER_DOWNLOADS = 1;
private static final int FILTER_HISTORY = 2;
private static final int PAGE_SIZE = 50;
private ActionMode actionMode;
private int currentFilter;
private List<LbryFile> currentFiles;
private View layoutSdkInitializing;
@@ -58,6 +77,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
private int currentPage;
private Date lastDate;
private boolean listReachedEnd;
private boolean contentListLoading;
private CardView cardStats;
private TextView linkStats;
@@ -114,6 +134,32 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
showHistory();
}
});
contentList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (contentListLoading) {
return;
}
LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
if (lm != null) {
int visibleItemCount = lm.getChildCount();
int totalItemCount = lm.getItemCount();
int pastVisibleItems = lm.findFirstVisibleItemPosition();
if (pastVisibleItems + visibleItemCount >= totalItemCount) {
if (!listReachedEnd) {
// load more
if (currentFilter == FILTER_DOWNLOADS) {
currentPage++;
fetchDownloads();
} else if (currentFilter == FILTER_HISTORY) {
fetchHistory();
}
}
}
}
}
});
// stats
linkStats = root.findViewById(R.id.library_show_stats);
@@ -203,6 +249,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
contentListAdapter.clearItems();
contentListAdapter.setCanEnterSelectionMode(true);
}
listReachedEnd = false;
checkStatsLink();
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
@@ -216,10 +263,14 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
currentFilter = FILTER_HISTORY;
linkFilterDownloads.setTypeface(null, Typeface.NORMAL);
linkFilterHistory.setTypeface(null, Typeface.BOLD);
if (actionMode != null) {
actionMode.finish();
}
if (contentListAdapter != null) {
contentListAdapter.clearItems();
contentListAdapter.setCanEnterSelectionMode(false);
}
listReachedEnd = false;
cardStats.setVisibility(View.GONE);
checkStatsLink();
@@ -232,6 +283,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
private void initContentListAdapter(List<Claim> claims) {
contentListAdapter = new ClaimListAdapter(claims, getContext());
contentListAdapter.setCanEnterSelectionMode(true);
contentListAdapter.setSelectionModeListener(this);
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override
public void onClaimClicked(Claim claim) {
@@ -241,7 +293,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
if (claim.getName().startsWith("@")) {
activity.openChannelUrl(claim.getPermanentUrl());
} else {
MainActivity.openFileUrl(claim.getPermanentUrl(), context);
activity.openFileUrl(claim.getPermanentUrl());
}
}
}
@@ -249,6 +301,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
}
private void fetchDownloads() {
contentListLoading = true;
Helper.setViewVisibility(linkStats, View.GONE);
Helper.setViewVisibility(layoutListEmpty, View.GONE);
FileListTask task = new FileListTask(currentPage, PAGE_SIZE, true, listLoading, new FileListTask.FileListResultHandler() {
@@ -269,6 +322,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
}
contentList.setAdapter(contentListAdapter);
checkListEmpty();
contentListLoading = false;
}
@Override
@@ -276,12 +330,14 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
// pass
checkStatsLink();
checkListEmpty();
contentListLoading = false;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void fetchHistory() {
contentListLoading = true;
Helper.setViewVisibility(layoutListEmpty, View.GONE);
DatabaseHelper dbHelper = DatabaseHelper.getInstance();
if (dbHelper != null) {
@@ -289,6 +345,10 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
@Override
public void onSuccess(List<ViewHistory> history, boolean hasReachedEnd) {
listReachedEnd = hasReachedEnd;
if (history.size() > 0) {
lastDate = history.get(history.size() - 1).getTimestamp();
}
List<Claim> claims = Helper.claimsFromViewHistory(history);
if (contentListAdapter == null) {
initContentListAdapter(claims);
@@ -297,11 +357,13 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
}
contentList.setAdapter(contentListAdapter);
checkListEmpty();
contentListLoading = false;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
checkListEmpty();
contentListLoading = false;
}
}
@@ -420,4 +482,104 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
currentFilter == FILTER_HISTORY ?
View.GONE : View.VISIBLE);
}
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
this.actionMode = actionMode;
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (!activity.isDarkMode()) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
actionMode.getMenuInflater().inflate(R.menu.menu_claim_list, menu);
return true;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
if (contentListAdapter != null) {
contentListAdapter.clearSelectedItems();
contentListAdapter.setInSelectionMode(false);
contentListAdapter.notifyDataSetChanged();
}
Context context = getContext();
if (context != null) {
MainActivity activity = (MainActivity) context;
if (!activity.isDarkMode()) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
this.actionMode = null;
}
@Override
public boolean onPrepareActionMode(androidx.appcompat.view.ActionMode actionMode, Menu menu) {
menu.findItem(R.id.action_edit).setVisible(false);
return true;
}
@Override
public boolean onActionItemClicked(androidx.appcompat.view.ActionMode actionMode, MenuItem menuItem) {
if (R.id.action_delete == menuItem.getItemId()) {
if (contentListAdapter != null && contentListAdapter.getSelectedCount() > 0) {
final List<Claim> selectedClaims = new ArrayList<>(contentListAdapter.getSelectedItems());
String message = getResources().getQuantityString(R.plurals.confirm_delete_files, selectedClaims.size());
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
setTitle(R.string.delete_selection).
setMessage(message)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
handleDeleteSelectedClaims(selectedClaims);
}
}).setNegativeButton(R.string.no, null);
builder.show();
return true;
}
}
return false;
}
private void handleDeleteSelectedClaims(List<Claim> selectedClaims) {
List<String> claimIds = new ArrayList<>();
for (Claim claim : selectedClaims) {
claimIds.add(claim.getClaimId());
}
new BulkDeleteFilesTask(claimIds).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Lbry.unsetFilesForCachedClaims(claimIds);
if (currentFilter == FILTER_DOWNLOADS) {
contentListAdapter.removeItems(selectedClaims);
}
if (actionMode != null) {
actionMode.finish();
}
View root = getView();
if (root != null) {
String message = getResources().getQuantityString(R.plurals.files_deleted, claimIds.size());
Snackbar.make(root, message, Snackbar.LENGTH_LONG).show();
}
}
public void onEnterSelectionMode() {
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
activity.startSupportActionMode(this);
}
}
public void onItemSelectionToggled() {
if (actionMode != null) {
actionMode.setTitle(String.valueOf(contentListAdapter.getSelectedCount()));
actionMode.invalidate();
}
}
public void onExitSelectionMode() {
if (actionMode != null) {
actionMode.finish();
}
}
}
@@ -193,7 +193,7 @@ public class AboutFragment extends BaseFragment implements SdkStatusListener {
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
LbryAnalytics.setCurrentScreen(activity, "Settings", "Settings");
LbryAnalytics.setCurrentScreen(activity, "About", "About");
if (!Lbry.SDK_READY) {
activity.addSdkStatusListener(this);
@@ -265,7 +265,7 @@ public class SearchFragment extends BaseFragment implements
((MainActivity) getContext()).openChannelUrl(claim.getPermanentUrl());
} else {
// not a channel
MainActivity.openFileClaim(claim, getContext());
((MainActivity) getContext()).openFileClaim(claim);
}
}
@@ -248,7 +248,10 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
}
private void updateInviteLink(Claim claim) {
String link = String.format(INVITE_LINK_FORMAT, claim.getName(), claim.getClaimId());
LbryUri canonical = LbryUri.tryParse(claim.getCanonicalUrl());
String link = String.format(INVITE_LINK_FORMAT,
canonical != null ? String.format("@%s", canonical.getChannelName()) : claim.getName(),
canonical != null ? canonical.getChannelClaimId() : claim.getClaimId());
textInviteLink.setText(link);
}
private void copyInviteLink() {
@@ -523,6 +526,12 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
logPublishTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
// channel created
Bundle bundle = new Bundle();
bundle.putString("claim_id", claimResult.getClaimId());
bundle.putString("claim_name", claimResult.getName());
LbryAnalytics.logEvent(LbryAnalytics.EVENT_CHANNEL_CREATE, bundle);
// add the claim to the channel list and set it as the selected item
channelSpinnerAdapter.add(claimResult);
channelSpinner.setSelection(channelSpinnerAdapter.getCount() - 1);
@@ -161,7 +161,7 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
if (uri.isChannel()) {
activity.openChannelUrl(uri.toString());
} else {
MainActivity.openFileUrl(uri.toString(), context);
activity.openFileUrl(uri.toString());
}
}
}
@@ -285,21 +285,22 @@ public final class Helper {
}
public static String shortCurrencyFormat(double value) {
DecimalFormat format = new DecimalFormat("#,###.#");
if (value > 1000000000.00) {
return String.format("%.1fB", value / 1000000000.0);
return String.format("%sB", format.format(value / 1000000000.0));
}
if (value > 1000000.0) {
return String.format("%.1fM", value / 1000000.0);
return String.format("%sM",format.format( value / 1000000.0));
}
if (value > 1000.0) {
return String.format("%.1fK", value / 1000.0);
return String.format("%sK", format.format(value / 1000.0));
}
if (value == 0) {
return "0";
}
return new DecimalFormat("###.##").format(value);
return format.format(value);
}
public static String getValue(CharSequence cs) {
@@ -401,6 +402,15 @@ public final class Helper {
}
return followedTags;
}
public static List<Claim> filterDeletedClaims(List<Claim> claims) {
List<Claim> filtered = new ArrayList<>();
for (Claim claim : claims) {
if (!Lbry.abandonedClaimIds.contains(claim.getClaimId())) {
filtered.add(claim);
}
}
return filtered;
}
public static void setWunderbarValue(String value, Context context) {
if (context instanceof MainActivity) {
@@ -8,6 +8,7 @@ import java.io.IOException;
import java.security.KeyStore;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -26,6 +27,9 @@ import io.lbry.browser.model.Tag;
import io.lbry.browser.model.Transaction;
import io.lbry.browser.model.WalletBalance;
import io.lbry.lbrysdk.Utils;
import kotlin.Pair;
import okhttp3.CacheControl;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
@@ -40,6 +44,7 @@ public final class Lbry {
public static List<Tag> followedTags = new ArrayList<>();
public static List<Claim> ownClaims = new ArrayList<>();
public static List<Claim> ownChannels = new ArrayList<>(); // Make this a subset of ownClaims?
public static List<String> abandonedClaimIds = new ArrayList<>();
public static final int TTL_CLAIM_SEARCH_VALUE = 120000; // 2-minute TTL for cache
public static final String SDK_CONNECTION_STRING = "http://127.0.0.1:5279";
@@ -93,6 +98,7 @@ public final class Lbry {
public static boolean SDK_READY = false;
public static void startupInit() {
abandonedClaimIds = new ArrayList<>();
ownChannels = new ArrayList<>();
ownClaims = new ArrayList<>();
knownTags = new ArrayList<>();
@@ -161,7 +167,7 @@ public final class Lbry {
if (value instanceof Double) {
jsonParams.put(param.getKey(), (double) value);
} else {
jsonParams.put(param.getKey(), value);
jsonParams.put(param.getKey(), value == null ? JSONObject.NULL : value);
}
}
} catch (JSONException ex) {
@@ -313,10 +319,10 @@ public final class Lbry {
if (!Helper.isNullOrEmpty(claimId)) {
params.put("claim_id", claimId);
}
/*if (downloads) {
params.put("file_name", null);
if (downloads) {
params.put("download_path", null);
params.put("comparison", "ne");
}*/
}
if (page > 0) {
params.put("page", page);
}
@@ -470,4 +476,14 @@ public final class Lbry {
claimCache.put(shortUrlKey, claim);
}
}
public static void unsetFilesForCachedClaims(List<String> claimIds) {
for (String claimId : claimIds) {
ClaimCacheKey key = new ClaimCacheKey();
key.setClaimId(claimId);
if (claimCache.containsKey(key)) {
claimCache.get(key).setFile(null);
}
}
}
}
@@ -192,8 +192,9 @@ public final class Lbryio {
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
User user = gson.fromJson(object.toString(), type);
return user;
} catch (LbryioRequestException | LbryioResponseException | ClassCastException ex) {
android.util.Log.e(TAG, "Cannot retrieve the current user", ex);
} catch (LbryioRequestException | LbryioResponseException | ClassCastException | IllegalStateException ex) {
LbryAnalytics.logException(String.format("/user/me failed: %s", ex.getMessage()), ex.getClass().getName());
android.util.Log.e(TAG, "Could not retrieve the current user", ex);
return null;
}
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/smallIconBackground" />
<corners android:radius="24dp" />
</shape>
@@ -1,646 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/pageBackground">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/file_view_global_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/file_view_loading_state"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/file_view_loading_container"
android:visibility="gone"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ProgressBar
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/loading_decentralized_data"
android:textSize="16sp"
android:textFontWeight="300" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_claim_display_area"
android:orientation="vertical"
android:layout_weight="10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout
android:id="@+id/file_view_media_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3.25">
<RelativeLayout
android:id="@+id/file_view_media_meta_container"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/file_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/file_view_main_action_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true" />
<com.google.android.material.button.MaterialButton
android:id="@+id/file_view_main_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="invisible"
android:text="@string/play" />
<LinearLayout
android:id="@+id/file_view_fee_container"
android:background="@drawable/bg_stream_cost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingLeft="6dp"
android:paddingRight="7dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textSize="8dp"
android:text="@string/fa_coins"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/file_view_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="1dp"
android:fontFamily="@font/inter"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textFontWeight="300" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_exoplayer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/file_view_exoplayer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/exo_playback_control_view"/>
<ProgressBar
android:id="@+id/player_buffering_progress"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_unsupported_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="36dp"
android:visibility="gone">
<ImageView
android:id="@+id/file_view_unsupported_gerbil"
android:src="@drawable/gerbil_happy"
android:layout_width="64dp"
android:layout_centerVertical="true"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_toRightOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_centerVertical="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/unsupported_content" />
<TextView
android:id="@+id/file_view_unsupported_text"
android:fontFamily="@font/inter"
android:text="@string/unsupported_content_desc"
android:textColor="@color/white"
android:textSize="14sp"
android:textFontWeight="300"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<com.google.android.exoplayer2.ui.PlayerControlView android:id="@+id/file_view_cast_control_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:repeat_toggle_modes="all|one"
app:show_timeout="-1"/>
<androidx.core.widget.NestedScrollView
android:id="@+id/file_view_scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6.75"
android:clipToPadding="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/file_view_title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="4dp">
<LinearLayout
android:id="@+id/file_view_title_layout"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="48dp">
<TextView
android:id="@+id/file_view_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publish_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/file_view_desc_toggle_arrow"
android:src="@drawable/ic_arrow_dropdown"
android:layout_toLeftOf="@+id/file_view_title_layout"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground" />
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_actions_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5">
<LinearLayout
android:id="@+id/file_view_action_share"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_share" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_tip"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:textSize="20dp"
android:text="@string/fa_gift"/>
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_repost"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_repost"/>
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/repost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_edit"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_download"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ProgressBar
android:id="@+id/file_view_download_progress"
android:layout_width="36dp"
android:layout_height="36dp"
style="?android:progressBarStyleHorizontal"
android:progressDrawable="@drawable/determinate_progress_circle"
android:visibility="gone" />
<ImageView
android:id="@+id/file_view_action_download_icon"
android:tint="@color/foreground"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_download" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_delete"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_delete" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_report"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_report" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
<RelativeLayout
android:id="@+id/file_view_publisher_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<LinearLayout
android:id="@+id/file_view_publisher_name_area"
android:clickable="true"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_publisher_name"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/lbryGreen"
android:fontFamily="@font/inter"
android:textFontWeight="600" />
</LinearLayout>
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_follow_unfollow"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_alignParentRight="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:text="@string/fa_heart"
android:textColor="@color/red"
android:textSize="20dp" />
</RelativeLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
<LinearLayout
android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:id="@+id/file_view_description"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:autoLink="all"
android:textColorLink="@color/lbryGreen"
android:textFontWeight="300"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
<LinearLayout
android:id="@+id/file_view_tag_area"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginTop="36dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/tags"
android:textSize="12sp"
android:textFontWeight="600" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginLeft="8dp"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_related_content_area"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/related_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:layout_centerVertical="true" />
<ProgressBar
android:id="@+id/file_view_related_content_progress"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/file_view_no_related_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_related_content"
android:textSize="14sp"
android:textFontWeight="300"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_related_content_list"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
<RelativeLayout
android:id="@+id/file_view_imageviewer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/file_view_imageviewer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_webview_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<WebView
android:id="@+id/file_view_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<include layout="@layout/floating_wallet_balance" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -5,7 +5,6 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
+1
View File
@@ -2,6 +2,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/app_bar_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
+1
View File
@@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
@@ -64,7 +64,7 @@
android:paddingRight="4dp">
<TextView
android:id="@+id/player_duration_elapsed"
android:layout_width="wrap_content"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:fontFamily="@font/inter"
@@ -77,18 +77,19 @@
android:layout_toRightOf="@id/player_duration_elapsed"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_centerVertical="true"
app:scrubber_color="@color/scrubberColor"
app:played_color="@color/playedColor"
app:buffered_color="@color/bufferedColor" />
<TextView
android:id="@+id/player_duration_total"
android:layout_width="wrap_content"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:gravity="end"
android:fontFamily="@font/inter"
android:text="@string/zero_duration"
android:textColor="@color/white"
@@ -54,6 +54,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_above="@+id/channel_view_tabs"
android:layout_toRightOf="@id/channel_view_icon_container"
android:orientation="vertical">
@@ -66,7 +67,9 @@
android:paddingRight="4dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:ellipsize="end"
android:fontFamily="@font/inter"
android:maxLines="2"
android:textSize="20sp"
android:textColor="@color/white" />
<TextView
@@ -25,15 +25,22 @@
android:layout_height="match_parent"
android:src="@drawable/default_channel_cover"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/channel_form_cover_edit_icon"
android:layout_width="16dp"
android:layout_height="16dp"
<RelativeLayout
android:background="@drawable/bg_small_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="16dp"
android:layout_alignParentBottom="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
android:layout_alignParentBottom="true">
<ImageView
android:id="@+id/channel_form_cover_edit_icon"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
</RelativeLayout>
<LinearLayout
android:id="@+id/channel_form_upload_progress"
@@ -92,14 +99,21 @@
android:id="@+id/channel_form_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
<RelativeLayout
android:background="@drawable/bg_small_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="16dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
android:layout_centerHorizontal="true">
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit"
android:tint="@color/white" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
@@ -0,0 +1,641 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/file_view_global_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/file_view_loading_state"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/file_view_loading_container"
android:visibility="gone"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ProgressBar
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:fontFamily="@font/inter"
android:text="@string/loading_decentralized_data"
android:textSize="16sp"
android:textFontWeight="300" />
</LinearLayout>
<include layout="@layout/container_nothing_at_location" />
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_claim_display_area"
android:orientation="vertical"
android:layout_weight="10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout
android:id="@+id/file_view_media_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3.25">
<RelativeLayout
android:id="@+id/file_view_media_meta_container"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/file_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/file_view_main_action_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true" />
<com.google.android.material.button.MaterialButton
android:id="@+id/file_view_main_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="invisible"
android:text="@string/play" />
<LinearLayout
android:id="@+id/file_view_fee_container"
android:background="@drawable/bg_stream_cost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingLeft="6dp"
android:paddingRight="7dp"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textSize="8dp"
android:text="@string/fa_coins"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/file_view_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="1dp"
android:fontFamily="@font/inter"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textFontWeight="300" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_exoplayer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/file_view_exoplayer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/exo_playback_control_view"/>
<ProgressBar
android:id="@+id/player_buffering_progress"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_unsupported_container"
android:background="@color/mediaContainerBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="36dp"
android:visibility="gone">
<ImageView
android:id="@+id/file_view_unsupported_gerbil"
android:src="@drawable/gerbil_happy"
android:layout_width="64dp"
android:layout_centerVertical="true"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_toRightOf="@id/file_view_unsupported_gerbil"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_centerVertical="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/unsupported_content" />
<TextView
android:id="@+id/file_view_unsupported_text"
android:fontFamily="@font/inter"
android:text="@string/unsupported_content_desc"
android:textColor="@color/white"
android:textSize="14sp"
android:textFontWeight="300"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<com.google.android.exoplayer2.ui.PlayerControlView android:id="@+id/file_view_cast_control_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:repeat_toggle_modes="all|one"
app:show_timeout="-1"/>
<androidx.core.widget.NestedScrollView
android:id="@+id/file_view_scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6.75"
android:clipToPadding="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/file_view_title_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="4dp">
<LinearLayout
android:id="@+id/file_view_title_layout"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="48dp">
<TextView
android:id="@+id/file_view_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_marginTop="4dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_view_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300"
android:visibility="gone" />
<TextView
android:id="@+id/file_view_publish_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="12sp"
android:textFontWeight="300" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/file_view_desc_toggle_arrow"
android:src="@drawable/ic_arrow_dropdown"
android:layout_toLeftOf="@+id/file_view_title_layout"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/foreground" />
</RelativeLayout>
<LinearLayout
android:id="@+id/file_view_actions_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5">
<LinearLayout
android:id="@+id/file_view_action_share"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_share" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_tip"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:textSize="20dp"
android:text="@string/fa_gift"/>
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_repost"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<io.lbry.browser.ui.controls.SolidIconView
android:textColor="@color/foreground"
android:layout_centerInParent="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:text="@string/fa_repost"/>
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/repost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_edit"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_edit" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_download"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ProgressBar
android:id="@+id/file_view_download_progress"
android:layout_width="36dp"
android:layout_height="36dp"
style="?android:progressBarStyleHorizontal"
android:progressDrawable="@drawable/determinate_progress_circle"
android:visibility="gone" />
<ImageView
android:id="@+id/file_view_action_download_icon"
android:tint="@color/foreground"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_download" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_delete"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:visibility="gone">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_delete" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_action_report"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<RelativeLayout
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal">
<ImageView
android:tint="@color/foreground"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_report" />
</RelativeLayout>
<TextView
android:fontFamily="@font/inter"
android:textSize="12sp"
android:text="@string/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
<RelativeLayout
android:id="@+id/file_view_publisher_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<LinearLayout
android:id="@+id/file_view_publisher_name_area"
android:clickable="true"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/file_view_publisher_name"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/lbryGreen"
android:fontFamily="@font/inter"
android:textFontWeight="600" />
</LinearLayout>
<io.lbry.browser.ui.controls.SolidIconView
android:id="@+id/file_view_icon_follow_unfollow"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:layout_alignParentRight="true"
android:layout_width="24dp"
android:layout_height="24dp"
android:text="@string/fa_heart"
android:textColor="@color/red"
android:textSize="20dp" />
</RelativeLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
<LinearLayout
android:id="@+id/file_view_description_area"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:id="@+id/file_view_description"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:autoLink="all"
android:textColorLink="@color/lbryGreen"
android:textFontWeight="300"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
<LinearLayout
android:id="@+id/file_view_tag_area"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginTop="36dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:text="@string/tags"
android:textSize="12sp"
android:textFontWeight="600" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_tag_list"
android:layout_weight="8"
android:layout_marginLeft="8dp"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:background="@color/divider"
android:layout_width="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_height="0.5dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/file_view_related_content_area"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/related_content"
android:fontFamily="@font/inter"
android:textSize="16sp"
android:layout_centerVertical="true" />
<ProgressBar
android:id="@+id/file_view_related_content_progress"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/file_view_no_related_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:fontFamily="@font/inter"
android:text="@string/no_related_content"
android:textSize="14sp"
android:textFontWeight="300"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/file_view_related_content_list"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
<RelativeLayout
android:id="@+id/file_view_imageviewer_container"
android:background="@android:color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/file_view_imageviewer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/file_view_webview_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<WebView
android:id="@+id/file_view_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+1 -3
View File
@@ -300,9 +300,7 @@
android:clipToPadding="false"
android:layout_below="@id/library_storage_stats_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="12dp"
android:paddingBottom="16dp" />
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/library_empty_container"
@@ -53,10 +53,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_centerVertical="true"
android:lineHeight="14dp"
android:fontFamily="@font/inter"
android:ellipsize="end"
android:maxLines="6"
android:maxLines="8"
android:textFontWeight="300"
android:textSize="12sp" />
</RelativeLayout>
+2 -1
View File
@@ -9,7 +9,8 @@
android:paddingBottom="8dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
android:foreground="?attr/selectableItemBackground"
android:background="@drawable/bg_selected_list_item">
<LinearLayout
android:id="@+id/claim_repost_info"
android:layout_width="match_parent"
+43 -33
View File
@@ -2,32 +2,38 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="86dp"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="vertical"
android:background="@color/pageBackground"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<RelativeLayout
android:id="@+id/sign_in_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:id="@+id/sign_in_button_container"
android:background="@color/lbryGreen"
android:clickable="true"
android:paddingTop="38dp"
android:foreground="?attr/selectableItemBackground"
android:background="@color/lbryGreen">
<TextView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:gravity="center"
android:text="@string/sign_in"
android:fontFamily="@font/inter"
android:textSize="14sp"
android:textFontWeight="600"
android:textAllCaps="true" />
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/sign_in_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/lbryGreen"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/sign_in"
android:fontFamily="@font/inter"
android:textSize="14sp"
android:textFontWeight="600"
android:textAllCaps="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
@@ -35,22 +41,26 @@
android:background="@color/drawerBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="38dp"
android:visibility="gone">
<TextView
android:id="@+id/signed_in_email"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:ellipsize="middle"
android:fontFamily="@font/inter"
android:gravity="center"
android:singleLine="true"
android:textSize="14sp"
android:textAllCaps="true"
android:textColor="@color/menuItemForeground"
android:textFontWeight="300" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@+id/signed_in_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:ellipsize="middle"
android:fontFamily="@font/inter"
android:gravity="center"
android:singleLine="true"
android:textSize="14sp"
android:textAllCaps="true"
android:textColor="@color/menuItemForeground"
android:textFontWeight="300" />
</RelativeLayout>
</RelativeLayout>
<View
+1
View File
@@ -12,6 +12,7 @@
<color name="menuItemForeground">#AAAAAA</color>
<color name="selectedNavItem">#0E0E0E</color>
<color name="channelCoverBackground">#CC000000</color>
<color name="smallIconBackground">#55000000</color>
<color name="costBackground">#F4E866</color>
<color name="playerControlsBackground">#33000000</color>
+1
View File
@@ -12,6 +12,7 @@
<color name="menuItemForeground">#444444</color>
<color name="selectedNavItem">#F1F1F1</color>
<color name="channelCoverBackground">#CC000000</color>
<color name="smallIconBackground">#55000000</color>
<color name="costBackground">#F4E866</color>
<color name="playerControlsBackground">#33000000</color>
+15 -1
View File
@@ -67,7 +67,7 @@
<string name="nothing_at_this_location">There\'s nothing at this location.</string>
<string name="publish_something_here">Publish something here</string>
<string name="cannot_view_claim">This content cannot be accessed at this time. Please try again later.</string>
<string name="zero_duration">00:00</string>
<string name="zero_duration">0:00</string>
<string name="claim_file_not_found">The file at "%1$s" does not exist.</string>
<string name="confirm_purchase">Confirm Purchase</string>
<string name="delete_file">Delete file</string>
@@ -305,6 +305,7 @@
<string name="at">\@</string>
<string name="deposit">Deposit</string>
<string name="deposit_remains_yours">This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.</string>
<string name="storage_permission_rationale_download">LBRY requires access to download content to your device.</string>
<string name="storage_permission_rationale_images">LBRY requires access to load images from your device storage.</string>
<string name="select_thumbnail">Select thumbnail</string>
<string name="select_cover">Select cover image</string>
@@ -322,6 +323,7 @@
<string name="item_pending_blockchain">The claim is pending publish on the blockchain. You will be able to access or edit the claim in a few moments.</string>
<string name="pending">Pending</string>
<string name="create">Create</string>
<string name="one_or_more_channels_failed_abandon">One or moe channels could not be deleted at this time. Please try again later.</string>
<plurals name="min_deposit_required">
<item quantity="one">A minimum deposit of %1$s credit is required.</item>
<item quantity="other">A minimum deposit of %1$s credits is required.</item>
@@ -330,6 +332,10 @@
<item quantity="one">Are you sure you want to delete the selected channel?</item>
<item quantity="other">Are you sure you want to delete the selected channels?</item>
</plurals>
<plurals name="channels_deleted">
<item quantity="one">The channel was successfully deleted.</item>
<item quantity="other">The channels were successfully deleted.</item>
</plurals>
<!-- Rewards -->
<string name="lbry_credits_allow">LBRY credits allow you to publish or purchase content.</string>
@@ -387,6 +393,14 @@
<string name="kb">KB</string>
<string name="gb">GB</string>
<string name="zero_mb">0MB</string>
<plurals name="confirm_delete_files">
<item quantity="one">Are you sure you want to remove the selected file from your device?</item>
<item quantity="other">Are you sure you want to remove the selected files from your device?</item>
</plurals>
<plurals name="files_deleted">
<item quantity="one">The file was successfully deleted.</item>
<item quantity="other">The files were successfully deleted.</item>
</plurals>
<!-- About -->
<string name="about_lbry">About LBRY</string>