Make file view a fragment to prevent headaches with multiple Android task recents

This commit is contained in:
Akinwale Ariwodola 2020-05-17 15:48:07 +01:00
parent 82dc0255f1
commit f317aa2174
37 changed files with 1939 additions and 1504 deletions

View file

@ -67,13 +67,6 @@
android:parentActivityName=".MainActivity" android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBarTranslucent" android:theme="@style/AppTheme.NoActionBarTranslucent"
android:windowSoftInputMode="adjustResize" /> 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 <service
android:name="io.lbry.browser.LbrynetMessagingService" android:name="io.lbry.browser.LbrynetMessagingService"

View file

@ -16,6 +16,7 @@ import android.content.res.Configuration;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -29,6 +30,7 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.Menu; import android.view.Menu;
import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
@ -39,8 +41,8 @@ import android.widget.Toast;
import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ext.cast.CastPlayer; 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.ui.PlayerView;
import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.gms.cast.framework.CastContext; import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.Task;
@ -81,7 +83,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executors; 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.DownloadActionListener;
import io.lbry.browser.listener.FetchChannelsListener; import io.lbry.browser.listener.FetchChannelsListener;
import io.lbry.browser.listener.SdkStatusListener; import io.lbry.browser.listener.SdkStatusListener;
import io.lbry.browser.listener.StoragePermissionListener;
import io.lbry.browser.listener.WalletBalanceListener; import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim; import io.lbry.browser.model.Claim;
import io.lbry.browser.model.ClaimCacheKey; 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.ChannelFragment;
import io.lbry.browser.ui.channel.ChannelManagerFragment; import io.lbry.browser.ui.channel.ChannelManagerFragment;
import io.lbry.browser.ui.editorschoice.EditorsChoiceFragment; 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.following.FollowingFragment;
import io.lbry.browser.ui.library.LibraryFragment; import io.lbry.browser.ui.library.LibraryFragment;
import io.lbry.browser.ui.other.AboutFragment; 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.ServiceHelper;
import io.lbry.lbrysdk.Utils; import io.lbry.lbrysdk.Utils;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
public class MainActivity extends AppCompatActivity implements SdkStatusListener { public class MainActivity extends AppCompatActivity implements SdkStatusListener {
private Map<String, Class> specialRouteFragmentClassMap; private Map<String, Class> specialRouteFragmentClassMap;
private boolean inPictureInPictureMode; private boolean inPictureInPictureMode;
public static SimpleExoPlayer appPlayer; public static SimpleExoPlayer appPlayer;
public static Cache playerCache;
public static boolean playerReassigned;
public static CastContext castContext; public static CastContext castContext;
public static CastPlayer castPlayer; public static CastPlayer castPlayer;
public static Claim nowPlayingClaim; public static Claim nowPlayingClaim;
public static boolean startingFilePickerActivity = false; public static boolean startingFilePickerActivity = false;
public static boolean startingShareActivity = false; public static boolean startingShareActivity = false;
public static boolean startingFileViewActivity = false; public static boolean startingStoragePermissionRequest = false;
public static boolean startingSignInFlowActivity = false; public static boolean startingSignInFlowActivity = false;
public static boolean mainActive = false;
private boolean enteringPIPMode = false; private boolean enteringPIPMode = false;
private boolean fullSyncInProgress = false;
private int queuedSyncCount = 0;
@Setter
private BackPressInterceptor backPressInterceptor;
@Getter @Getter
private String firebaseMessagingToken; private String firebaseMessagingToken;
@ -243,18 +253,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// broadcast receivers // broadcast receivers
private BroadcastReceiver serviceActionsReceiver; private BroadcastReceiver serviceActionsReceiver;
private BroadcastReceiver requestsReceiver; private BroadcastReceiver requestsReceiver;
private BroadcastReceiver userActionsReceiver;
private static boolean appStarted; private static boolean appStarted;
private boolean serviceRunning; private boolean serviceRunning;
private CheckSdkReadyTask checkSdkReadyTask; private CheckSdkReadyTask checkSdkReadyTask;
private boolean receivedStopService; private boolean receivedStopService;
private ActionBarDrawerToggle toggle; private ActionBarDrawerToggle toggle;
private SyncSetTask syncSetTask = null;
private List<WalletSync> pendingSyncSetQueue;
@Getter @Getter
private DatabaseHelper dbHelper; private DatabaseHelper dbHelper;
private int selectedMenuItemId = -1; private int selectedMenuItemId = -1;
private List<DownloadActionListener> downloadActionListeners; private List<DownloadActionListener> downloadActionListeners;
private List<SdkStatusListener> sdkStatusListeners; private List<SdkStatusListener> sdkStatusListeners;
private List<StoragePermissionListener> storagePermissionListeners;
private List<WalletBalanceListener> walletBalanceListeners; private List<WalletBalanceListener> walletBalanceListeners;
private List<FetchChannelsListener> fetchChannelsListeners; private List<FetchChannelsListener> fetchChannelsListeners;
@Getter @Getter
@ -338,15 +350,44 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
// register receivers // register receivers
registerRequestsReceiver(); registerRequestsReceiver();
registerServiceActionsReceiver(); 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 // setup uri bar
setupUriBar(); 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 // other
pendingSyncSetQueue = new ArrayList<>();
openNavFragments = new HashMap<>(); openNavFragments = new HashMap<>();
downloadActionListeners = new ArrayList<>(); downloadActionListeners = new ArrayList<>();
sdkStatusListeners = new ArrayList<>(); sdkStatusListeners = new ArrayList<>();
storagePermissionListeners = new ArrayList<>();
walletBalanceListeners = new ArrayList<>(); walletBalanceListeners = new ArrayList<>();
fetchChannelsListeners = new ArrayList<>(); fetchChannelsListeners = new ArrayList<>();
@ -400,12 +441,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (nowPlayingClaim != null) { if (nowPlayingClaim != null) {
Intent intent = new Intent(MainActivity.this, FileViewActivity.class); openFileUrl(!Helper.isNullOrEmpty(nowPlayingClaim.getShortUrl()) ? nowPlayingClaim.getShortUrl() : nowPlayingClaim.getPermanentUrl());
//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);
} }
} }
}); });
@ -438,7 +474,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}); });
navItemsView.setAdapter(navMenuAdapter); 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 @Override
public void onClick(View view) { public void onClick(View view) {
walletSyncSignIn(); walletSyncSignIn();
@ -490,6 +526,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
sdkStatusListeners.remove(listener); 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) { public void addWalletBalanceListener(WalletBalanceListener listener) {
if (!walletBalanceListeners.contains(listener)) { if (!walletBalanceListeners.contains(listener)) {
walletBalanceListeners.add(listener); walletBalanceListeners.add(listener);
@ -501,7 +547,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
} }
public void removeNavFragment(Class fragmentClass, int navItemId) { public void removeNavFragment(Class fragmentClass, int navItemId) {
String key = buildNavFragmentKey(fragmentClass, navItemId); String key = buildNavFragmentKey(fragmentClass, navItemId, null);
if (openNavFragments.containsKey(key)) { if (openNavFragments.containsKey(key)) {
openNavFragments.remove(key); openNavFragments.remove(key);
} }
@ -589,27 +635,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
wunderbar.setSelection(0); wunderbar.setSelection(0);
} }
private void openAllContentFragmentWithTag(String tag) { public void openAllContentFragmentWithTag(String tag) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("singleTag", tag); params.put("singleTag", tag);
openFragment(AllContentFragment.class, true, NavMenuItem.ID_ITEM_ALL_CONTENT, params); openFragment(AllContentFragment.class, true, NavMenuItem.ID_ITEM_ALL_CONTENT, params);
} }
public static void openFileUrl(String url, Context context) { public void openFileUrl(String url) {
Intent intent = new Intent(context, FileViewActivity.class); Map<String, Object> params = new HashMap<>();
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); params.put("url", url);
intent.putExtra("url", url); openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
startingFileViewActivity = true;
context.startActivity(intent);
} }
public static void openFileClaim(Claim claim, Context context) { public void openFileClaim(Claim claim) {
Intent intent = new Intent(context, FileViewActivity.class); Map<String, Object> params = new HashMap<>();
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); params.put("claimId", claim.getClaimId());
intent.putExtra("claimId", claim.getClaimId()); params.put("url", !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
intent.putExtra("url", !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl()); openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
startingFileViewActivity = true;
context.startActivity(intent);
} }
private FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() { private FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() {
@ -636,21 +678,31 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
findViewById(R.id.content_main).setVisibility(View.GONE); findViewById(R.id.content_main).setVisibility(View.GONE);
findViewById(R.id.floating_balance_main_container).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_now_playing_card).setVisibility(View.GONE);
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
getSupportActionBar().hide(); getSupportActionBar().hide();
PlayerView pipPlayer = findViewById(R.id.pip_player); PlayerView pipPlayer = findViewById(R.id.pip_player);
pipPlayer.setVisibility(View.VISIBLE); pipPlayer.setVisibility(View.VISIBLE);
pipPlayer.setPlayer(appPlayer); pipPlayer.setPlayer(appPlayer);
pipPlayer.setUseController(false);
playerReassigned = true;
} }
private void renderFullMode() { private void renderFullMode() {
getSupportActionBar().show(); getSupportActionBar().show();
findViewById(R.id.content_main).setVisibility(View.VISIBLE); findViewById(R.id.content_main).setVisibility(View.VISIBLE);
findViewById(R.id.floating_balance_main_container).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); PlayerView pipPlayer = findViewById(R.id.pip_player);
pipPlayer.setVisibility(View.INVISIBLE); pipPlayer.setVisibility(View.INVISIBLE);
pipPlayer.setPlayer(null); pipPlayer.setPlayer(null);
playerReassigned = true;
} }
@Override @Override
@ -673,6 +725,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
appPlayer.release(); appPlayer.release();
appPlayer = null; appPlayer = null;
} }
if (playerCache != null) {
playerCache.release();
playerCache = null;
}
} }
@Override @Override
@ -709,8 +765,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
mainActive = true;
applyNavbarSigninPadding();
checkFirstRun(); checkFirstRun();
checkNowPlaying(); checkNowPlaying();
@ -750,7 +806,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
@Override @Override
protected void onPause() { protected void onPause() {
mainActive = false; if (!enteringPIPMode && appPlayer != null) {
appPlayer.setPlayWhenReady(false);
}
super.onPause(); super.onPause();
} }
@ -824,7 +882,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
clearWunderbarFocus(wunderbar); clearWunderbarFocus(wunderbar);
handled = true; handled = true;
} else { } else {
openFileUrl(uri.toString(), MainActivity.this); openFileUrl(uri.toString());
clearWunderbarFocus(wunderbar); clearWunderbarFocus(wunderbar);
handled = true; handled = true;
} }
@ -849,7 +907,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
urlSuggestionListAdapter.setListener(new UrlSuggestionListAdapter.UrlSuggestionClickListener() { urlSuggestionListAdapter.setListener(new UrlSuggestionListAdapter.UrlSuggestionClickListener() {
@Override @Override
public void onUrlSuggestionClicked(UrlSuggestion urlSuggestion) { public void onUrlSuggestionClicked(UrlSuggestion urlSuggestion) {
Context context = MainActivity.this;
switch (urlSuggestion.getType()) { switch (urlSuggestion.getType()) {
case UrlSuggestion.TYPE_CHANNEL: case UrlSuggestion.TYPE_CHANNEL:
// open channel page // open channel page
@ -861,9 +918,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
break; break;
case UrlSuggestion.TYPE_FILE: case UrlSuggestion.TYPE_FILE:
if (urlSuggestion.getClaim() != null) { if (urlSuggestion.getClaim() != null) {
openFileClaim(urlSuggestion.getClaim(), context); openFileClaim(urlSuggestion.getClaim());
} else { } else {
openFileUrl(urlSuggestion.getUri().toString(), context); openFileUrl(urlSuggestion.getUri().toString());
} }
break; break;
case UrlSuggestion.TYPE_SEARCH: case UrlSuggestion.TYPE_SEARCH:
@ -1091,7 +1148,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return suggestions; return suggestions;
} }
private void checkNowPlaying() { public void checkNowPlaying() {
Fragment fragment = getCurrentFragment();
if (fragment instanceof FileViewFragment) {
return;
}
if (nowPlayingClaim != null) { if (nowPlayingClaim != null) {
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE); findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle()); ((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
@ -1102,11 +1164,64 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
playerView.setPlayer(null); playerView.setPlayer(null);
playerView.setPlayer(appPlayer); playerView.setPlayer(appPlayer);
playerView.setUseController(false); playerView.setUseController(false);
playerReassigned = true;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 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() { private void initKeyStore() {
try { try {
Lbry.KEYSTORE = Utils.initKeyStore(this); Lbry.KEYSTORE = Utils.initKeyStore(this);
@ -1296,7 +1411,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
for (Fragment fragment : openNavFragments.values()) { for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof FollowingFragment) { if (fragment instanceof FollowingFragment) {
// reload local subscriptions // reload local subscriptions
((FollowingFragment) fragment).fetchLoadedSubscriptions(); ((FollowingFragment) fragment).fetchLoadedSubscriptions(true);
} }
} }
} }
@ -1353,11 +1468,81 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return walletSyncEnabled && Lbryio.isSignedIn(); 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() { public void syncWalletAndLoadPreferences() {
if (!userSyncEnabled()) { if (!userSyncEnabled()) {
return; return;
} }
if (fullSyncInProgress) {
queuedSyncCount++;
}
fullSyncInProgress = true;
String password = Utils.getSecureValue(SECURE_VALUE_KEY_SAVED_PASSWORD, this, Lbry.KEYSTORE); String password = Utils.getSecureValue(SECURE_VALUE_KEY_SAVED_PASSWORD, this, Lbry.KEYSTORE);
SyncGetTask task = new SyncGetTask(password, true, null, new DefaultSyncTaskHandler() { SyncGetTask task = new SyncGetTask(password, true, null, new DefaultSyncTaskHandler() {
@Override @Override
@ -1376,13 +1561,21 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onSyncGetError(Exception error) { public void onSyncGetError(Exception error) {
// pass // pass
Log.e(TAG, String.format("sync get failed: %s", error != null ? error.getMessage() : "no error message"), error); 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 @Override
public void onSyncApplySuccess(String hash, String data) { public void onSyncApplySuccess(String hash, String data) {
if (!hash.equalsIgnoreCase(Lbryio.lastRemoteHash)) { if (!hash.equalsIgnoreCase(Lbryio.lastRemoteHash)) {
SyncSetTask setTask = new SyncSetTask(Lbryio.lastRemoteHash, hash, data, null); syncSet(hash, data);
setTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else {
fullSyncInProgress = false;
queuedSyncCount = 0;
} }
loadSharedUserState(); loadSharedUserState();
@ -1392,6 +1585,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onSyncApplyError(Exception error) { public void onSyncApplyError(Exception error) {
// pass // pass
Log.e(TAG, String.format("sync apply failed: %s", error != null ? error.getMessage() : "no error message"), error); 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); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -1458,70 +1656,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) { public void showMessage(int stringResourceId) {
Snackbar.make(findViewById(R.id.content_main), stringResourceId, Snackbar.LENGTH_LONG).show(); Snackbar.make(findViewById(R.id.content_main), stringResourceId, Snackbar.LENGTH_LONG).show();
} }
public void showMessage(String message) { public void showMessage(String message) {
Snackbar.make(findViewById(R.id.content_main), message, Snackbar.LENGTH_LONG).show(); 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 @Override
public void onBackPressed() { 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); DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) { if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START); drawer.closeDrawer(GravityCompat.START);
} else { } else {
boolean handled = false; boolean handled = false;
if (findViewById(R.id.url_suggestions_container).getVisibility() == View.VISIBLE) { ChannelFormFragment channelFormFragment = null;
clearWunderbarFocus(findViewById(R.id.wunderbar)); for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof ChannelFormFragment) {
channelFormFragment = ((ChannelFormFragment) fragment);
break;
}
}
if (channelFormFragment != null && channelFormFragment.isSaveInProgress()) {
handled = true; handled = true;
} else { return;
ChannelFormFragment channelFormFragment = null;
for (Fragment fragment : openNavFragments.values()) {
if (fragment instanceof ChannelFormFragment) {
channelFormFragment = ((ChannelFormFragment) fragment);
break;
}
}
if (channelFormFragment != null && channelFormFragment.isSaveInProgress()) {
handled = true;
return;
}
} }
if (!handled) { if (!handled) {
@ -1563,24 +1734,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) { switch (requestCode) {
case REQUEST_STORAGE_PERMISSION: 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 (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (channelFormFragment != null) { for (StoragePermissionListener listener : storagePermissionListeners) {
channelFormFragment.onStoragePermissionGranted(); listener.onStoragePermissionGranted();
} }
} else { } else {
if (channelFormFragment != null) { for (StoragePermissionListener listener : storagePermissionListeners) {
channelFormFragment.onStoragePermissionRefused(); listener.onStoragePermissionRefused();
} }
} }
startingStoragePermissionRequest = false;
break; break;
} }
@ -1631,9 +1794,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() { private void showSignedInUser() {
if (Lbryio.isSignedIn()) { 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); findViewById(R.id.signed_in_email_container).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.signed_in_email)).setText(Lbryio.getSignedInEmail()); ((TextView) findViewById(R.id.signed_in_email)).setText(Lbryio.getSignedInEmail());
findViewById(R.id.sign_in_header_divider).setBackgroundColor(getResources().getColor(R.color.lightDivider)); findViewById(R.id.sign_in_header_divider).setBackgroundColor(getResources().getColor(R.color.lightDivider));
@ -1891,7 +2063,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (uri.isChannel()) { if (uri.isChannel()) {
openChannelUrl(uri.toString()); openChannelUrl(uri.toString());
} else { } else {
openFileUrl(uri.toString(), this); openFileUrl(uri.toString());
} }
} catch (LbryUriException ex) { } catch (LbryUriException ex) {
// pass // pass
@ -1936,6 +2108,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}, 1000); }, 1000);
return; return;
} }
if (startingStoragePermissionRequest) {
return;
}
enterPIPMode(); enterPIPMode();
} }
@ -1946,8 +2121,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
appPlayer != null && appPlayer != null &&
FileViewActivity.instance == null &&
!startingFileViewActivity &&
!startingFilePickerActivity && !startingFilePickerActivity &&
!startingSignInFlowActivity) { !startingSignInFlowActivity) {
enteringPIPMode = true; enteringPIPMode = true;
@ -2024,7 +2197,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
private void unregisterReceivers() { private void unregisterReceivers() {
Helper.unregisterReceiver(requestsReceiver, this); Helper.unregisterReceiver(requestsReceiver, this);
Helper.unregisterReceiver(serviceActionsReceiver, this); Helper.unregisterReceiver(serviceActionsReceiver, this);
Helper.unregisterReceiver(userActionsReceiver, this);
} }
private Notification buildServiceNotification() { private Notification buildServiceNotification() {
@ -2097,14 +2269,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return flatMenu; return flatMenu;
} }
public static void setNowPlayingClaim(Claim claim, Context context) { public void setNowPlayingClaim(Claim claim) {
nowPlayingClaim = 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; 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> { private static class CheckSdkReadyTask extends AsyncTask<Void, Void, Boolean> {
@ -2225,7 +2405,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
} }
protected void onStop() { protected void onStop() {
if (!MainActivity.startingFileViewActivity && appPlayer != null && inPictureInPictureMode) { if (appPlayer != null && inPictureInPictureMode) {
appPlayer.setPlayWhenReady(false); appPlayer.setPlayWhenReady(false);
} }
super.onStop(); super.onStop();
@ -2253,13 +2433,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
openFragment(fragmentClass, allowNavigateBack, navItemId, null); 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); return String.format("%s-%d", fragmentClass.getName(), navItemId);
} }
public void openFragment(Class fragmentClass, boolean allowNavigateBack, int navItemId, Map<String, Object> params) { public void openFragment(Class fragmentClass, boolean allowNavigateBack, int navItemId, Map<String, Object> params) {
try { try {
String key = buildNavFragmentKey(fragmentClass, navItemId); String key = buildNavFragmentKey(fragmentClass, navItemId, params);
Fragment fragment = openNavFragments.containsKey(key) ? openNavFragments.get(key) : (Fragment) fragmentClass.newInstance(); Fragment fragment = openNavFragments.containsKey(key) ? openNavFragments.get(key) : (Fragment) fragmentClass.newInstance();
if (fragment instanceof BaseFragment) { if (fragment instanceof BaseFragment) {
((BaseFragment) fragment).setParams(params); ((BaseFragment) fragment).setParams(params);
@ -2327,6 +2511,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (!forceRequest && ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) { if (!forceRequest && ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
Toast.makeText(context, rationale, Toast.LENGTH_LONG).show(); Toast.makeText(context, rationale, Toast.LENGTH_LONG).show();
} else { } else {
startingStoragePermissionRequest = true;
ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode); ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode);
} }
} }
@ -2335,4 +2520,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public static boolean hasPermission(String permission, Context context) { public static boolean hasPermission(String permission, Context context) {
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED); return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
} }
public interface BackPressInterceptor {
boolean onBackPressed();
}
} }

View file

@ -101,7 +101,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
} }
vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE); 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.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()); int bgColor = Helper.generateRandomColorForValue(claim.getClaimId());
Helper.setIconViewBackgroundColor(vh.alphaContainer, bgColor, claim.isPlaceholder(), context); Helper.setIconViewBackgroundColor(vh.alphaContainer, bgColor, claim.isPlaceholder(), context);

View file

@ -97,6 +97,10 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
notifyDataSetChanged(); notifyDataSetChanged();
} }
public Claim getLastItem() {
return items.size() > 0 ? items.get(items.size() - 1) : null;
}
public void addFeaturedItem(Claim claim) { public void addFeaturedItem(Claim claim) {
items.add(0, claim); items.add(0, claim);
notifyDataSetChanged(); notifyDataSetChanged();

View file

@ -56,6 +56,11 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
public int getSelectedCount() { return selectedItems.size(); } public int getSelectedCount() { return selectedItems.size(); }
public void clearItems() {
items.clear();
notifyDataSetChanged();
}
public List<Claim> getSelectedItems() { public List<Claim> getSelectedItems() {
return this.selectedItems; return this.selectedItems;
} }

View file

@ -84,10 +84,16 @@ public class DiscoverDialogFragment extends BottomSheetDialogFragment {
dialogActionsListener.onResume(); dialogActionsListener.onResume();
} }
} }
@Override @Override
public void onCancel(DialogInterface dialog) { 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) { if (dialogActionsListener != null) {
dialogActionsListener.onCancel(); dialogActionsListener.onCancel();
} }

View file

@ -24,7 +24,6 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter; import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
@ -147,16 +146,16 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Context context = getContext(); Context context = getContext();
if (context instanceof FileViewActivity) { if (context instanceof MainActivity) {
((FileViewActivity) context).addWalletBalanceListener(this); ((MainActivity) context).addWalletBalanceListener(this);
} }
fetchChannels(); fetchChannels();
} }
public void onPause() { public void onPause() {
Context context = getContext(); Context context = getContext();
if (context instanceof FileViewActivity) { if (context instanceof MainActivity) {
((FileViewActivity) context).removeWalletBalanceListener(this); ((MainActivity) context).removeWalletBalanceListener(this);
} }
inputDeposit.clearFocus(); inputDeposit.clearFocus();
super.onPause(); super.onPause();
@ -178,8 +177,8 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
public void onError(Exception error) { public void onError(Exception error) {
// could not fetch channels // could not fetch channels
Context context = getContext(); Context context = getContext();
if (context instanceof FileViewActivity) { if (context instanceof MainActivity) {
((FileViewActivity) context).showError(error.getMessage()); ((MainActivity) context).showError(error.getMessage());
} }
dismiss(); dismiss();
} }

View file

@ -23,7 +23,6 @@ import com.google.android.material.textfield.TextInputEditText;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.listener.WalletBalanceListener; import io.lbry.browser.listener.WalletBalanceListener;
@ -164,15 +163,15 @@ public class SendTipDialogFragment extends BottomSheetDialogFragment implements
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Context context = getContext(); Context context = getContext();
if (context instanceof FileViewActivity) { if (context instanceof MainActivity) {
((FileViewActivity) context).addWalletBalanceListener(this); ((MainActivity) context).addWalletBalanceListener(this);
} }
} }
public void onPause() { public void onPause() {
Context context = getContext(); Context context = getContext();
if (context instanceof FileViewActivity) { if (context instanceof MainActivity) {
((FileViewActivity) context).removeWalletBalanceListener(this); ((MainActivity) context).removeWalletBalanceListener(this);
} }
super.onPause(); super.onPause();
} }

View file

@ -0,0 +1,6 @@
package io.lbry.browser.listener;
public interface StoragePermissionListener {
void onStoragePermissionGranted();
void onStoragePermissionRefused();
}

View file

@ -118,10 +118,10 @@ public class Claim {
if (fee != null) { if (fee != null) {
double amount = Helper.parseDouble(fee.getAmount(), 0); double amount = Helper.parseDouble(fee.getAmount(), 0);
if ("usd".equalsIgnoreCase(fee.getCurrency())) { 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); return new BigDecimal(0);

View file

@ -8,9 +8,13 @@ public class WalletSync {
private String data; private String data;
private boolean changed; private boolean changed;
public WalletSync(String hash, String data, boolean changed) { public WalletSync(String hash, String data) {
this.hash = hash; this.hash = hash;
this.data = data; this.data = data;
}
public WalletSync(String hash, String data, boolean changed) {
this(hash, data);
this.changed = changed; this.changed = changed;
} }
} }

View file

@ -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);
}
}
}
}

View file

@ -45,7 +45,7 @@ public class SyncSetTask extends AsyncTask<Void, Void, String> {
if (handler != null) { if (handler != null) {
if (!Helper.isNullOrEmpty(hash)) { if (!Helper.isNullOrEmpty(hash)) {
handler.onSyncSetSuccess(hash); handler.onSyncSetSuccess(hash);
} else if (error != null) { } else {
handler.onSyncSetError(error); handler.onSyncSetError(error);
} }
} }

View file

@ -7,6 +7,7 @@ import androidx.fragment.app.Fragment;
import java.util.Map; import java.util.Map;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.ui.following.FileViewFragment;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -19,7 +20,15 @@ public class BaseFragment extends Fragment {
super.onResume(); super.onResume();
Context context = getContext(); Context context = getContext();
if (context instanceof MainActivity) { if (context instanceof MainActivity) {
((MainActivity) context).setSelectedMenuItemForFragment(this); MainActivity activity = (MainActivity) context;
activity.setSelectedMenuItemForFragment(this);
if (this instanceof FileViewFragment) {
activity.hideGlobalNowPlaying();
} else {
activity.checkNowPlaying();
}
} }
} }
} }

View file

@ -26,7 +26,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.ClaimListAdapter; import io.lbry.browser.adapter.ClaimListAdapter;
@ -213,6 +212,7 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
singleTagView = true; singleTagView = true;
tags = Arrays.asList(tagName); tags = Arrays.asList(tagName);
titleView.setText(Helper.capitalize(tagName)); titleView.setText(Helper.capitalize(tagName));
Helper.setViewVisibility(customizeLink, View.GONE);
} else { } else {
singleTagView = false; singleTagView = false;
// default to followed Tags scope if any tags are followed // 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)); titleView.setText(getString(R.string.all_content));
} }
forPrefix.setVisibility(singleTagView ? View.GONE : View.VISIBLE); Helper.setViewVisibility(forPrefix, singleTagView ? View.GONE : View.VISIBLE);
scopeLink.setVisibility(singleTagView ? View.GONE : View.VISIBLE); Helper.setViewVisibility(scopeLink, singleTagView ? View.GONE : View.VISIBLE);
if (reload) { if (reload) {
fetchClaimSearchContent(true); fetchClaimSearchContent(true);
@ -451,22 +451,15 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() { contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override @Override
public void onClaimClicked(Claim claim) { public void onClaimClicked(Claim claim) {
String claimId = claim.getClaimId(); Context context = getContext();
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl(); if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (claim.getName().startsWith("@")) { if (claim.getName().startsWith("@")) {
// channel claim // channel claim
Context context = getContext(); activity.openChannelClaim(claim);
if (context instanceof MainActivity) { } else {
((MainActivity) context).openChannelClaim(claim); 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);
} }
} }
}); });

View file

@ -24,7 +24,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.ClaimListAdapter; import io.lbry.browser.adapter.ClaimListAdapter;
@ -263,21 +262,15 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() { contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override @Override
public void onClaimClicked(Claim claim) { public void onClaimClicked(Claim claim) {
String claimId = claim.getClaimId(); Context context = getContext();
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl(); if (context instanceof MainActivity) {
if (claim.getName().startsWith("@")) { MainActivity activity = (MainActivity) context;
// channel claim if (claim.getName().startsWith("@")) {
Context context = getContext(); // channel claim
if (context instanceof MainActivity) { activity.openChannelClaim(claim);
((MainActivity) context).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);
} }
} }
}); });

View file

@ -37,6 +37,7 @@ import io.lbry.browser.BuildConfig;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.TagListAdapter; import io.lbry.browser.adapter.TagListAdapter;
import io.lbry.browser.listener.StoragePermissionListener;
import io.lbry.browser.listener.WalletBalanceListener; import io.lbry.browser.listener.WalletBalanceListener;
import io.lbry.browser.model.Claim; import io.lbry.browser.model.Claim;
import io.lbry.browser.model.NavMenuItem; import io.lbry.browser.model.NavMenuItem;
@ -54,7 +55,8 @@ import io.lbry.browser.utils.LbryAnalytics;
import io.lbry.browser.utils.LbryUri; import io.lbry.browser.utils.LbryUri;
import lombok.Getter; 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; private static final int SUGGESTED_LIMIT = 8;
@ -490,6 +492,7 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
Context context = getContext(); Context context = getContext();
if (context instanceof MainActivity) { if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) getContext(); MainActivity activity = (MainActivity) getContext();
activity.removeStoragePermissionListener(this);
activity.removeWalletBalanceListener(this); activity.removeWalletBalanceListener(this);
activity.restoreToggle(); activity.restoreToggle();
activity.showFloatingWalletBalance(); activity.showFloatingWalletBalance();
@ -509,6 +512,7 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
if (context instanceof MainActivity) { if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context; MainActivity activity = (MainActivity) context;
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm"); LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
activity.addStoragePermissionListener(this);
if (editMode) { if (editMode) {
ActionBar actionBar = activity.getSupportActionBar(); ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {

View file

@ -288,14 +288,15 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
updateRequired = true; updateRequired = true;
} }
} }
if (!updateRequired && params.containsKey("url")) { if (params.containsKey("url")) {
String newUrl = params.get("url").toString(); String newUrl = params.get("url").toString();
if (!newUrl.equalsIgnoreCase(url) || claim == null) { if (claim == null || !newUrl.equalsIgnoreCase(url)) {
this.claim = null; this.claim = null;
this.url = newUrl; this.url = newUrl;
updateRequired = true; updateRequired = true;
} }
} }
if (updateRequired) { if (updateRequired) {
resetSubCount(); resetSubCount();
if (!Helper.isNullOrEmpty(url)) { if (!Helper.isNullOrEmpty(url)) {

View file

@ -22,7 +22,6 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.EditorsChoiceItemAdapter; import io.lbry.browser.adapter.EditorsChoiceItemAdapter;
@ -116,12 +115,10 @@ public class EditorsChoiceFragment extends BaseFragment {
@Override @Override
public void onEditorsChoiceItemClicked(EditorsChoiceItem item) { public void onEditorsChoiceItemClicked(EditorsChoiceItem item) {
String url = item.getPermanentUrl(); String url = item.getPermanentUrl();
Context context = getContext();
Intent intent = new Intent(getContext(), FileViewActivity.class); if (context instanceof MainActivity) {
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); ((MainActivity) context).openFileUrl(url);
intent.putExtra("url", url); }
MainActivity.startingFileViewActivity = true;
startActivity(intent);
} }
}); });
} else { } else {

View file

@ -28,7 +28,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.ChannelFilterListAdapter; import io.lbry.browser.adapter.ChannelFilterListAdapter;
@ -90,6 +89,7 @@ public class FollowingFragment extends BaseFragment implements
private boolean contentClaimSearchLoading = false; private boolean contentClaimSearchLoading = false;
private boolean suggestedClaimSearchLoading = false; private boolean suggestedClaimSearchLoading = false;
private View noContentView; private View noContentView;
private boolean subscriptionsShown;
private List<Integer> queuedContentPages = new ArrayList<>(); private List<Integer> queuedContentPages = new ArrayList<>();
private List<Integer> queuedSuggestedPages = new ArrayList<>(); private List<Integer> queuedSuggestedPages = new ArrayList<>();
@ -249,8 +249,8 @@ public class FollowingFragment extends BaseFragment implements
@Override @Override
public void onClick(View view) { public void onClick(View view) {
buildChannelIdsAndUrls(); buildChannelIdsAndUrls();
currentSuggestedPage = 1;
discoverDialog = DiscoverDialogFragment.newInstance(); discoverDialog = DiscoverDialogFragment.newInstance();
excludeChannelIdsForDiscover = channelIds != null ? new ArrayList<>(channelIds) : null;
discoverDialog.setAdapter(suggestedChannelAdapter); discoverDialog.setAdapter(suggestedChannelAdapter);
discoverDialog.setDialogActionsListener(new DiscoverDialogFragment.DiscoverDialogListener() { discoverDialog.setDialogActionsListener(new DiscoverDialogFragment.DiscoverDialogListener() {
@Override @Override
@ -265,6 +265,9 @@ public class FollowingFragment extends BaseFragment implements
public void onCancel() { public void onCancel() {
discoverDialog = null; discoverDialog = null;
excludeChannelIdsForDiscover = null; excludeChannelIdsForDiscover = null;
if (suggestedChannelAdapter != null) {
suggestedChannelAdapter.clearItems();
}
} }
@Override @Override
public void onResume() { public void onResume() {
@ -353,7 +356,7 @@ public class FollowingFragment extends BaseFragment implements
} }
if (Lbryio.subscriptions != null && Lbryio.subscriptions.size() > 0) { if (Lbryio.subscriptions != null && Lbryio.subscriptions.size() > 0) {
fetchLoadedSubscriptions(); fetchLoadedSubscriptions(true);
} else { } else {
fetchSubscriptions(); fetchSubscriptions();
} }
@ -366,7 +369,7 @@ public class FollowingFragment extends BaseFragment implements
PreferenceManager.getDefaultSharedPreferences(context).unregisterOnSharedPreferenceChangeListener(this); PreferenceManager.getDefaultSharedPreferences(context).unregisterOnSharedPreferenceChangeListener(this);
super.onPause(); super.onPause();
} }
public void fetchLoadedSubscriptions() { public void fetchLoadedSubscriptions(boolean showSubscribed) {
subscriptionsList = new ArrayList<>(Lbryio.subscriptions); subscriptionsList = new ArrayList<>(Lbryio.subscriptions);
buildChannelIdsAndUrls(); buildChannelIdsAndUrls();
if (Lbryio.cacheResolvedSubscriptions.size() > 0) { if (Lbryio.cacheResolvedSubscriptions.size() > 0) {
@ -377,7 +380,9 @@ public class FollowingFragment extends BaseFragment implements
fetchClaimSearchContent(resetClaimSearchContent); fetchClaimSearchContent(resetClaimSearchContent);
resetClaimSearchContent = false; resetClaimSearchContent = false;
showSubscribedContent(); if (showSubscribed && subscriptionsList.size() > 0) {
showSubscribedContent();
}
} }
public void loadFollowing() { public void loadFollowing() {
@ -458,6 +463,7 @@ public class FollowingFragment extends BaseFragment implements
} }
private void showSubscribedContent() { private void showSubscribedContent() {
subscriptionsShown = true;
Helper.setViewText(titleView, R.string.channels_you_follow); Helper.setViewText(titleView, R.string.channels_you_follow);
Helper.setViewVisibility(horizontalChannelList, View.VISIBLE); 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() { private void fetchAndResolveChannelList() {
@ -579,22 +587,15 @@ public class FollowingFragment extends BaseFragment implements
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() { contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
@Override @Override
public void onClaimClicked(Claim claim) { public void onClaimClicked(Claim claim) {
String claimId = claim.getClaimId(); Context context = getContext();
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl(); if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
if (claim.getName().startsWith("@")) { if (claim.getName().startsWith("@")) {
// channel claim // channel claim
Context context = getContext(); activity.openChannelClaim(claim);
if (context instanceof MainActivity) { } else {
((MainActivity) context).openChannelClaim(claim); 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() { ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override @Override
public void onSuccess() { public void onSuccess() {
if (discoverDialog != null) { Lbryio.addSubscription(subscription);
Lbryio.addSubscription(subscription); Lbryio.addCachedResolvedSubscription(claim);
Lbryio.addCachedResolvedSubscription(claim); resetClaimSearchContent = true;
resetClaimSearchContent = true; fetchLoadedSubscriptions(subscriptionsShown);
fetchLoadedSubscriptions();
}
saveSharedUserState(); saveSharedUserState();
} }
@ -740,12 +740,11 @@ public class FollowingFragment extends BaseFragment implements
ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, true, new ChannelSubscribeTask.ChannelSubscribeHandler() { ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, true, new ChannelSubscribeTask.ChannelSubscribeHandler() {
@Override @Override
public void onSuccess() { public void onSuccess() {
if (discoverDialog != null) { Lbryio.removeSubscription(subscription);
Lbryio.removeSubscription(subscription); Lbryio.removeCachedResolvedSubscription(claim);
Lbryio.removeCachedResolvedSubscription(claim); resetClaimSearchContent = true;
resetClaimSearchContent = true; fetchLoadedSubscriptions(subscriptionsShown);
fetchLoadedSubscriptions();
}
saveSharedUserState(); saveSharedUserState();
} }

View file

@ -58,6 +58,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
private int currentPage; private int currentPage;
private Date lastDate; private Date lastDate;
private boolean listReachedEnd; private boolean listReachedEnd;
private boolean contentListLoading;
private CardView cardStats; private CardView cardStats;
private TextView linkStats; private TextView linkStats;
@ -114,6 +115,32 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
showHistory(); 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 // stats
linkStats = root.findViewById(R.id.library_show_stats); linkStats = root.findViewById(R.id.library_show_stats);
@ -203,6 +230,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
contentListAdapter.clearItems(); contentListAdapter.clearItems();
contentListAdapter.setCanEnterSelectionMode(true); contentListAdapter.setCanEnterSelectionMode(true);
} }
listReachedEnd = false;
checkStatsLink(); checkStatsLink();
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE); layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
@ -220,6 +248,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
contentListAdapter.clearItems(); contentListAdapter.clearItems();
contentListAdapter.setCanEnterSelectionMode(false); contentListAdapter.setCanEnterSelectionMode(false);
} }
listReachedEnd = false;
cardStats.setVisibility(View.GONE); cardStats.setVisibility(View.GONE);
checkStatsLink(); checkStatsLink();
@ -241,7 +270,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
if (claim.getName().startsWith("@")) { if (claim.getName().startsWith("@")) {
activity.openChannelUrl(claim.getPermanentUrl()); activity.openChannelUrl(claim.getPermanentUrl());
} else { } else {
MainActivity.openFileUrl(claim.getPermanentUrl(), context); activity.openFileUrl(claim.getPermanentUrl());
} }
} }
} }
@ -249,6 +278,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
} }
private void fetchDownloads() { private void fetchDownloads() {
contentListLoading = true;
Helper.setViewVisibility(linkStats, View.GONE); Helper.setViewVisibility(linkStats, View.GONE);
Helper.setViewVisibility(layoutListEmpty, View.GONE); Helper.setViewVisibility(layoutListEmpty, View.GONE);
FileListTask task = new FileListTask(currentPage, PAGE_SIZE, true, listLoading, new FileListTask.FileListResultHandler() { FileListTask task = new FileListTask(currentPage, PAGE_SIZE, true, listLoading, new FileListTask.FileListResultHandler() {
@ -269,6 +299,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
} }
contentList.setAdapter(contentListAdapter); contentList.setAdapter(contentListAdapter);
checkListEmpty(); checkListEmpty();
contentListLoading = false;
} }
@Override @Override
@ -276,12 +307,14 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
// pass // pass
checkStatsLink(); checkStatsLink();
checkListEmpty(); checkListEmpty();
contentListLoading = false;
} }
}); });
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
private void fetchHistory() { private void fetchHistory() {
contentListLoading = true;
Helper.setViewVisibility(layoutListEmpty, View.GONE); Helper.setViewVisibility(layoutListEmpty, View.GONE);
DatabaseHelper dbHelper = DatabaseHelper.getInstance(); DatabaseHelper dbHelper = DatabaseHelper.getInstance();
if (dbHelper != null) { if (dbHelper != null) {
@ -289,6 +322,10 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
@Override @Override
public void onSuccess(List<ViewHistory> history, boolean hasReachedEnd) { public void onSuccess(List<ViewHistory> history, boolean hasReachedEnd) {
listReachedEnd = hasReachedEnd; listReachedEnd = hasReachedEnd;
if (history.size() > 0) {
lastDate = history.get(history.size() - 1).getTimestamp();
}
List<Claim> claims = Helper.claimsFromViewHistory(history); List<Claim> claims = Helper.claimsFromViewHistory(history);
if (contentListAdapter == null) { if (contentListAdapter == null) {
initContentListAdapter(claims); initContentListAdapter(claims);
@ -297,11 +334,13 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
} }
contentList.setAdapter(contentListAdapter); contentList.setAdapter(contentListAdapter);
checkListEmpty(); checkListEmpty();
contentListLoading = false;
} }
}); });
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else { } else {
checkListEmpty(); checkListEmpty();
contentListLoading = false;
} }
} }

View file

@ -265,7 +265,7 @@ public class SearchFragment extends BaseFragment implements
((MainActivity) getContext()).openChannelUrl(claim.getPermanentUrl()); ((MainActivity) getContext()).openChannelUrl(claim.getPermanentUrl());
} else { } else {
// not a channel // not a channel
MainActivity.openFileClaim(claim, getContext()); ((MainActivity) getContext()).openFileClaim(claim);
} }
} }

View file

@ -161,7 +161,7 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
if (uri.isChannel()) { if (uri.isChannel()) {
activity.openChannelUrl(uri.toString()); activity.openChannelUrl(uri.toString());
} else { } else {
MainActivity.openFileUrl(uri.toString(), context); activity.openFileUrl(uri.toString());
} }
} }
} }

View file

@ -285,21 +285,22 @@ public final class Helper {
} }
public static String shortCurrencyFormat(double value) { public static String shortCurrencyFormat(double value) {
DecimalFormat format = new DecimalFormat("#,###.#");
if (value > 1000000000.00) { if (value > 1000000000.00) {
return String.format("%.1fB", value / 1000000000.0); return String.format("%sB", format.format(value / 1000000000.0));
} }
if (value > 1000000.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) { if (value > 1000.0) {
return String.format("%.1fK", value / 1000.0); return String.format("%sK", format.format(value / 1000.0));
} }
if (value == 0) { if (value == 0) {
return "0"; return "0";
} }
return new DecimalFormat("###.##").format(value); return format.format(value);
} }
public static String getValue(CharSequence cs) { public static String getValue(CharSequence cs) {

View file

@ -8,6 +8,7 @@ import java.io.IOException;
import java.security.KeyStore; import java.security.KeyStore;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; 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.Transaction;
import io.lbry.browser.model.WalletBalance; import io.lbry.browser.model.WalletBalance;
import io.lbry.lbrysdk.Utils; import io.lbry.lbrysdk.Utils;
import kotlin.Pair;
import okhttp3.CacheControl;
import okhttp3.Headers;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
@ -161,7 +165,7 @@ public final class Lbry {
if (value instanceof Double) { if (value instanceof Double) {
jsonParams.put(param.getKey(), (double) value); jsonParams.put(param.getKey(), (double) value);
} else { } else {
jsonParams.put(param.getKey(), value); jsonParams.put(param.getKey(), value == null ? JSONObject.NULL : value);
} }
} }
} catch (JSONException ex) { } catch (JSONException ex) {
@ -313,10 +317,10 @@ public final class Lbry {
if (!Helper.isNullOrEmpty(claimId)) { if (!Helper.isNullOrEmpty(claimId)) {
params.put("claim_id", claimId); params.put("claim_id", claimId);
} }
/*if (downloads) { if (downloads) {
params.put("file_name", null); params.put("download_path", null);
params.put("comparison", "ne"); params.put("comparison", "ne");
}*/ }
if (page > 0) { if (page > 0) {
params.put("page", page); params.put("page", page);
} }

View file

@ -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>

View file

@ -5,7 +5,6 @@
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"> tools:openDrawer="start">
<include <include

View file

@ -2,6 +2,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/app_bar_main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"

View file

@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"

View file

@ -64,7 +64,7 @@
android:paddingRight="4dp"> android:paddingRight="4dp">
<TextView <TextView
android:id="@+id/player_duration_elapsed" android:id="@+id/player_duration_elapsed"
android:layout_width="wrap_content" android:layout_width="64dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
@ -77,18 +77,19 @@
android:layout_toRightOf="@id/player_duration_elapsed" android:layout_toRightOf="@id/player_duration_elapsed"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginLeft="24dp" android:layout_marginLeft="4dp"
android:layout_marginRight="24dp" android:layout_marginRight="4dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
app:scrubber_color="@color/scrubberColor" app:scrubber_color="@color/scrubberColor"
app:played_color="@color/playedColor" app:played_color="@color/playedColor"
app:buffered_color="@color/bufferedColor" /> app:buffered_color="@color/bufferedColor" />
<TextView <TextView
android:id="@+id/player_duration_total" android:id="@+id/player_duration_total"
android:layout_width="wrap_content" android:layout_width="64dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:gravity="end"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:text="@string/zero_duration" android:text="@string/zero_duration"
android:textColor="@color/white" android:textColor="@color/white"

View file

@ -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>

View file

@ -53,10 +53,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_centerVertical="true" android:lineHeight="14dp"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="6" android:maxLines="8"
android:textFontWeight="300" android:textFontWeight="300"
android:textSize="12sp" /> android:textSize="12sp" />
</RelativeLayout> </RelativeLayout>

View file

@ -2,32 +2,38 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="86dp" android:layout_height="wrap_content"
android:gravity="bottom" android:gravity="bottom"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/pageBackground" android:background="@color/pageBackground"
android:theme="@style/ThemeOverlay.AppCompat.Dark"> android:theme="@style/ThemeOverlay.AppCompat.Dark">
<RelativeLayout <RelativeLayout
android:id="@+id/sign_in_button" android:id="@+id/sign_in_button_container"
android:layout_width="match_parent" android:background="@color/lbryGreen"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:clickable="true" android:clickable="true"
android:paddingTop="38dp"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
android:background="@color/lbryGreen"> android:layout_width="match_parent"
<TextView android:layout_height="match_parent">
android:layout_width="wrap_content" <RelativeLayout
android:layout_height="48dp" android:id="@+id/sign_in_button"
android:layout_centerHorizontal="true" android:layout_width="match_parent"
android:layout_alignParentBottom="true" android:layout_height="wrap_content"
android:gravity="center" android:layout_gravity="bottom"
android:text="@string/sign_in" android:background="@color/lbryGreen"
android:fontFamily="@font/inter" android:paddingTop="16dp"
android:textSize="14sp" android:paddingBottom="16dp">
android:textFontWeight="600" <TextView
android:textAllCaps="true" /> 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>
<RelativeLayout <RelativeLayout
@ -35,22 +41,26 @@
android:background="@color/drawerBackground" android:background="@color/drawerBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="38dp"
android:visibility="gone"> android:visibility="gone">
<TextView <RelativeLayout
android:id="@+id/signed_in_email" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="48dp" android:paddingTop="16dp"
android:layout_centerHorizontal="true" android:paddingBottom="16dp">
android:layout_alignParentBottom="true" <TextView
android:ellipsize="middle" android:id="@+id/signed_in_email"
android:fontFamily="@font/inter" android:layout_width="wrap_content"
android:gravity="center" android:layout_height="wrap_content"
android:singleLine="true" android:layout_centerInParent="true"
android:textSize="14sp" android:ellipsize="middle"
android:textAllCaps="true" android:fontFamily="@font/inter"
android:textColor="@color/menuItemForeground" android:gravity="center"
android:textFontWeight="300" /> android:singleLine="true"
android:textSize="14sp"
android:textAllCaps="true"
android:textColor="@color/menuItemForeground"
android:textFontWeight="300" />
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
<View <View

View file

@ -67,7 +67,7 @@
<string name="nothing_at_this_location">There\'s nothing at this location.</string> <string name="nothing_at_this_location">There\'s nothing at this location.</string>
<string name="publish_something_here">Publish something here</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="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="claim_file_not_found">The file at "%1$s" does not exist.</string>
<string name="confirm_purchase">Confirm Purchase</string> <string name="confirm_purchase">Confirm Purchase</string>
<string name="delete_file">Delete file</string> <string name="delete_file">Delete file</string>
@ -305,6 +305,7 @@
<string name="at">\@</string> <string name="at">\@</string>
<string name="deposit">Deposit</string> <string name="deposit">Deposit</string>
<string name="deposit_remains_yours">This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.</string> <string name="deposit_remains_yours">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="storage_permission_rationale_images">LBRY requires access to load images from your device storage.</string>
<string name="select_thumbnail">Select thumbnail</string> <string name="select_thumbnail">Select thumbnail</string>
<string name="select_cover">Select cover image</string> <string name="select_cover">Select cover image</string>