Native rewrite #878
37 changed files with 1939 additions and 1504 deletions
Binary file not shown.
Binary file not shown.
|
@ -67,13 +67,6 @@
|
|||
android:parentActivityName=".MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBarTranslucent"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout"
|
||||
android:name=".FileViewActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:supportsPictureInPicture="true"
|
||||
android:theme="@style/AppTheme.NoActionBarBlack" />
|
||||
|
||||
<service
|
||||
android:name="io.lbry.browser.LbrynetMessagingService"
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.content.res.Configuration;
|
|||
import android.content.res.TypedArray;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -29,6 +30,7 @@ import android.util.Log;
|
|||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Menu;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
@ -39,8 +41,8 @@ import android.widget.Toast;
|
|||
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.ext.cast.CastPlayer;
|
||||
import com.google.android.exoplayer2.offline.Download;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.upstream.cache.Cache;
|
||||
import com.google.android.gms.cast.framework.CastContext;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
@ -81,7 +83,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -96,6 +97,7 @@ import io.lbry.browser.exceptions.LbryUriException;
|
|||
import io.lbry.browser.listener.DownloadActionListener;
|
||||
import io.lbry.browser.listener.FetchChannelsListener;
|
||||
import io.lbry.browser.listener.SdkStatusListener;
|
||||
import io.lbry.browser.listener.StoragePermissionListener;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.ClaimCacheKey;
|
||||
|
@ -125,6 +127,7 @@ import io.lbry.browser.ui.channel.ChannelFormFragment;
|
|||
import io.lbry.browser.ui.channel.ChannelFragment;
|
||||
import io.lbry.browser.ui.channel.ChannelManagerFragment;
|
||||
import io.lbry.browser.ui.editorschoice.EditorsChoiceFragment;
|
||||
import io.lbry.browser.ui.following.FileViewFragment;
|
||||
import io.lbry.browser.ui.following.FollowingFragment;
|
||||
import io.lbry.browser.ui.library.LibraryFragment;
|
||||
import io.lbry.browser.ui.other.AboutFragment;
|
||||
|
@ -144,21 +147,28 @@ import io.lbry.lbrysdk.LbrynetService;
|
|||
import io.lbry.lbrysdk.ServiceHelper;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements SdkStatusListener {
|
||||
|
||||
private Map<String, Class> specialRouteFragmentClassMap;
|
||||
private boolean inPictureInPictureMode;
|
||||
public static SimpleExoPlayer appPlayer;
|
||||
public static Cache playerCache;
|
||||
public static boolean playerReassigned;
|
||||
public static CastContext castContext;
|
||||
public static CastPlayer castPlayer;
|
||||
public static Claim nowPlayingClaim;
|
||||
public static boolean startingFilePickerActivity = false;
|
||||
public static boolean startingShareActivity = false;
|
||||
public static boolean startingFileViewActivity = false;
|
||||
public static boolean startingStoragePermissionRequest = false;
|
||||
public static boolean startingSignInFlowActivity = false;
|
||||
public static boolean mainActive = false;
|
||||
private boolean enteringPIPMode = false;
|
||||
private boolean fullSyncInProgress = false;
|
||||
private int queuedSyncCount = 0;
|
||||
|
||||
@Setter
|
||||
private BackPressInterceptor backPressInterceptor;
|
||||
|
||||
@Getter
|
||||
private String firebaseMessagingToken;
|
||||
|
@ -243,18 +253,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
// broadcast receivers
|
||||
private BroadcastReceiver serviceActionsReceiver;
|
||||
private BroadcastReceiver requestsReceiver;
|
||||
private BroadcastReceiver userActionsReceiver;
|
||||
|
||||
private static boolean appStarted;
|
||||
private boolean serviceRunning;
|
||||
private CheckSdkReadyTask checkSdkReadyTask;
|
||||
private boolean receivedStopService;
|
||||
private ActionBarDrawerToggle toggle;
|
||||
private SyncSetTask syncSetTask = null;
|
||||
private List<WalletSync> pendingSyncSetQueue;
|
||||
@Getter
|
||||
private DatabaseHelper dbHelper;
|
||||
private int selectedMenuItemId = -1;
|
||||
private List<DownloadActionListener> downloadActionListeners;
|
||||
private List<SdkStatusListener> sdkStatusListeners;
|
||||
private List<StoragePermissionListener> storagePermissionListeners;
|
||||
private List<WalletBalanceListener> walletBalanceListeners;
|
||||
private List<FetchChannelsListener> fetchChannelsListeners;
|
||||
@Getter
|
||||
|
@ -338,15 +350,44 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
// register receivers
|
||||
registerRequestsReceiver();
|
||||
registerServiceActionsReceiver();
|
||||
registerUserActionsReceiver();
|
||||
|
||||
View decorView = getWindow().getDecorView();
|
||||
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
// not fullscreen
|
||||
View appBarMainContainer = findViewById(R.id.app_bar_main_container);
|
||||
appBarMainContainer.setPadding(
|
||||
appBarMainContainer.getPaddingLeft(), appBarMainContainer.getPaddingTop(), appBarMainContainer.getPaddingRight(), 0);
|
||||
appBarMainContainer.setFitsSystemWindows(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// setup uri bar
|
||||
setupUriBar();
|
||||
|
||||
/*View decorView = getWindow().getDecorView();
|
||||
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
|
||||
findViewById(R.id.drawer_layout).setFitsSystemWindows(false);
|
||||
} else {
|
||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(true);
|
||||
findViewById(R.id.drawer_layout).setFitsSystemWindows(true);
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
// other
|
||||
pendingSyncSetQueue = new ArrayList<>();
|
||||
openNavFragments = new HashMap<>();
|
||||
downloadActionListeners = new ArrayList<>();
|
||||
sdkStatusListeners = new ArrayList<>();
|
||||
storagePermissionListeners = new ArrayList<>();
|
||||
walletBalanceListeners = new ArrayList<>();
|
||||
fetchChannelsListeners = new ArrayList<>();
|
||||
|
||||
|
@ -400,12 +441,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
if (nowPlayingClaim != null) {
|
||||
Intent intent = new Intent(MainActivity.this, FileViewActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.putExtra("claimId", nowPlayingClaim.getClaimId());
|
||||
intent.putExtra("url", nowPlayingClaim.getPermanentUrl());
|
||||
startingFileViewActivity = true;
|
||||
startActivity(intent);
|
||||
openFileUrl(!Helper.isNullOrEmpty(nowPlayingClaim.getShortUrl()) ? nowPlayingClaim.getShortUrl() : nowPlayingClaim.getPermanentUrl());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -438,7 +474,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
});
|
||||
navItemsView.setAdapter(navMenuAdapter);
|
||||
|
||||
findViewById(R.id.sign_in_button).setOnClickListener(new View.OnClickListener() {
|
||||
findViewById(R.id.sign_in_button_container).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
walletSyncSignIn();
|
||||
|
@ -490,6 +526,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
sdkStatusListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addStoragePermissionListener(StoragePermissionListener listener) {
|
||||
if (!storagePermissionListeners.contains(listener)) {
|
||||
storagePermissionListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeStoragePermissionListener(StoragePermissionListener listener) {
|
||||
storagePermissionListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addWalletBalanceListener(WalletBalanceListener listener) {
|
||||
if (!walletBalanceListeners.contains(listener)) {
|
||||
walletBalanceListeners.add(listener);
|
||||
|
@ -501,7 +547,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}
|
||||
|
||||
public void removeNavFragment(Class fragmentClass, int navItemId) {
|
||||
String key = buildNavFragmentKey(fragmentClass, navItemId);
|
||||
String key = buildNavFragmentKey(fragmentClass, navItemId, null);
|
||||
if (openNavFragments.containsKey(key)) {
|
||||
openNavFragments.remove(key);
|
||||
}
|
||||
|
@ -589,27 +635,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
wunderbar.setSelection(0);
|
||||
}
|
||||
|
||||
private void openAllContentFragmentWithTag(String tag) {
|
||||
public void openAllContentFragmentWithTag(String tag) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("singleTag", tag);
|
||||
openFragment(AllContentFragment.class, true, NavMenuItem.ID_ITEM_ALL_CONTENT, params);
|
||||
}
|
||||
|
||||
public static void openFileUrl(String url, Context context) {
|
||||
Intent intent = new Intent(context, FileViewActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.putExtra("url", url);
|
||||
startingFileViewActivity = true;
|
||||
context.startActivity(intent);
|
||||
public void openFileUrl(String url) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("url", url);
|
||||
openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
|
||||
}
|
||||
|
||||
public static void openFileClaim(Claim claim, Context context) {
|
||||
Intent intent = new Intent(context, FileViewActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.putExtra("claimId", claim.getClaimId());
|
||||
intent.putExtra("url", !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
||||
startingFileViewActivity = true;
|
||||
context.startActivity(intent);
|
||||
public void openFileClaim(Claim claim) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("claimId", claim.getClaimId());
|
||||
params.put("url", !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
||||
openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params);
|
||||
}
|
||||
|
||||
private FragmentManager.OnBackStackChangedListener backStackChangedListener = new FragmentManager.OnBackStackChangedListener() {
|
||||
|
@ -636,21 +678,31 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
findViewById(R.id.content_main).setVisibility(View.GONE);
|
||||
findViewById(R.id.floating_balance_main_container).setVisibility(View.GONE);
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
getSupportActionBar().hide();
|
||||
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.VISIBLE);
|
||||
pipPlayer.setPlayer(appPlayer);
|
||||
pipPlayer.setUseController(false);
|
||||
playerReassigned = true;
|
||||
}
|
||||
private void renderFullMode() {
|
||||
getSupportActionBar().show();
|
||||
findViewById(R.id.content_main).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.floating_balance_main_container).setVisibility(View.VISIBLE);
|
||||
Fragment fragment = getCurrentFragment();
|
||||
if (!(fragment instanceof FileViewFragment)) {
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!Lbry.SDK_READY) {
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.INVISIBLE);
|
||||
pipPlayer.setPlayer(null);
|
||||
playerReassigned = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -673,6 +725,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
appPlayer.release();
|
||||
appPlayer = null;
|
||||
}
|
||||
if (playerCache != null) {
|
||||
playerCache.release();
|
||||
playerCache = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -709,8 +765,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mainActive = true;
|
||||
|
||||
applyNavbarSigninPadding();
|
||||
checkFirstRun();
|
||||
checkNowPlaying();
|
||||
|
||||
|
@ -750,7 +806,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
mainActive = false;
|
||||
if (!enteringPIPMode && appPlayer != null) {
|
||||
appPlayer.setPlayWhenReady(false);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
@ -824,7 +882,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
clearWunderbarFocus(wunderbar);
|
||||
handled = true;
|
||||
} else {
|
||||
openFileUrl(uri.toString(), MainActivity.this);
|
||||
openFileUrl(uri.toString());
|
||||
clearWunderbarFocus(wunderbar);
|
||||
handled = true;
|
||||
}
|
||||
|
@ -849,7 +907,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
urlSuggestionListAdapter.setListener(new UrlSuggestionListAdapter.UrlSuggestionClickListener() {
|
||||
@Override
|
||||
public void onUrlSuggestionClicked(UrlSuggestion urlSuggestion) {
|
||||
Context context = MainActivity.this;
|
||||
switch (urlSuggestion.getType()) {
|
||||
case UrlSuggestion.TYPE_CHANNEL:
|
||||
// open channel page
|
||||
|
@ -861,9 +918,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
break;
|
||||
case UrlSuggestion.TYPE_FILE:
|
||||
if (urlSuggestion.getClaim() != null) {
|
||||
openFileClaim(urlSuggestion.getClaim(), context);
|
||||
openFileClaim(urlSuggestion.getClaim());
|
||||
} else {
|
||||
openFileUrl(urlSuggestion.getUri().toString(), context);
|
||||
openFileUrl(urlSuggestion.getUri().toString());
|
||||
}
|
||||
break;
|
||||
case UrlSuggestion.TYPE_SEARCH:
|
||||
|
@ -1091,7 +1148,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return suggestions;
|
||||
}
|
||||
|
||||
private void checkNowPlaying() {
|
||||
public void checkNowPlaying() {
|
||||
Fragment fragment = getCurrentFragment();
|
||||
if (fragment instanceof FileViewFragment) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nowPlayingClaim != null) {
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
|
||||
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
|
||||
|
@ -1102,11 +1164,64 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
playerView.setPlayer(null);
|
||||
playerView.setPlayer(appPlayer);
|
||||
playerView.setUseController(false);
|
||||
playerReassigned = true;
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
|
||||
public void hideGlobalNowPlaying() {
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void unsetFitsSystemWindows(View view) {
|
||||
view.setFitsSystemWindows(false);
|
||||
}
|
||||
|
||||
public void enterFullScreenMode() {
|
||||
hideFloatingWalletBalance();
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
}
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
|
||||
|
||||
View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
}
|
||||
|
||||
public int getStatusBarHeight() {
|
||||
int height = 0;
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
height = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
public void exitFullScreenMode() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
int flags = isDarkMode() ? (View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE) :
|
||||
(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
decorView.setSystemUiVisibility(flags);
|
||||
|
||||
if (!Lbry.SDK_READY) {
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.VISIBLE);
|
||||
}
|
||||
showFloatingWalletBalance();
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void initKeyStore() {
|
||||
try {
|
||||
Lbry.KEYSTORE = Utils.initKeyStore(this);
|
||||
|
@ -1296,7 +1411,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
for (Fragment fragment : openNavFragments.values()) {
|
||||
if (fragment instanceof FollowingFragment) {
|
||||
// reload local subscriptions
|
||||
((FollowingFragment) fragment).fetchLoadedSubscriptions();
|
||||
((FollowingFragment) fragment).fetchLoadedSubscriptions(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1353,11 +1468,81 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return walletSyncEnabled && Lbryio.isSignedIn();
|
||||
}
|
||||
|
||||
public void syncSet(String hash, String data) {
|
||||
if (syncSetTask == null || syncSetTask.getStatus() == AsyncTask.Status.FINISHED) {
|
||||
syncSetTask = new SyncSetTask(Lbryio.lastRemoteHash, hash, data, new DefaultSyncTaskHandler() {
|
||||
@Override
|
||||
public void onSyncSetSuccess(String hash) {
|
||||
Lbryio.lastRemoteHash = hash;
|
||||
WalletSync walletSync = new WalletSync(hash, data);
|
||||
Lbryio.lastWalletSync = walletSync;
|
||||
|
||||
if (pendingSyncSetQueue.size() > 0) {
|
||||
fullSyncInProgress = true;
|
||||
WalletSync nextSync = pendingSyncSetQueue.remove(0);
|
||||
syncSet(nextSync.getHash(), nextSync.getData());
|
||||
} else if (queuedSyncCount > 0) {
|
||||
queuedSyncCount--;
|
||||
syncApplyAndSet();
|
||||
}
|
||||
|
||||
fullSyncInProgress = false;
|
||||
}
|
||||
@Override
|
||||
public void onSyncSetError(Exception error) {
|
||||
// log app exceptions
|
||||
if (pendingSyncSetQueue.size() > 0) {
|
||||
WalletSync nextSync = pendingSyncSetQueue.remove(0);
|
||||
syncSet(nextSync.getHash(), nextSync.getData());
|
||||
} else if (queuedSyncCount > 0) {
|
||||
queuedSyncCount--;
|
||||
syncApplyAndSet();
|
||||
}
|
||||
|
||||
fullSyncInProgress = false;
|
||||
}
|
||||
});
|
||||
syncSetTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
WalletSync pending = new WalletSync(hash, data);
|
||||
pendingSyncSetQueue.add(pending);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncApplyAndSet() {
|
||||
fullSyncInProgress = true;
|
||||
String password = Utils.getSecureValue(SECURE_VALUE_KEY_SAVED_PASSWORD, this, Lbry.KEYSTORE);
|
||||
SyncApplyTask fetchTask = new SyncApplyTask(true, password, new DefaultSyncTaskHandler() {
|
||||
@Override
|
||||
public void onSyncApplySuccess(String hash, String data) {
|
||||
if (!hash.equalsIgnoreCase(Lbryio.lastRemoteHash)) {
|
||||
syncSet(hash, data);
|
||||
} else {
|
||||
fullSyncInProgress = false;
|
||||
queuedSyncCount = 0;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSyncApplyError(Exception error) {
|
||||
fullSyncInProgress = false;
|
||||
if (queuedSyncCount > 0) {
|
||||
queuedSyncCount--;
|
||||
syncApplyAndSet();
|
||||
}
|
||||
}
|
||||
});
|
||||
fetchTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
public void syncWalletAndLoadPreferences() {
|
||||
if (!userSyncEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (fullSyncInProgress) {
|
||||
queuedSyncCount++;
|
||||
}
|
||||
|
||||
fullSyncInProgress = true;
|
||||
String password = Utils.getSecureValue(SECURE_VALUE_KEY_SAVED_PASSWORD, this, Lbry.KEYSTORE);
|
||||
SyncGetTask task = new SyncGetTask(password, true, null, new DefaultSyncTaskHandler() {
|
||||
@Override
|
||||
|
@ -1376,13 +1561,21 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
public void onSyncGetError(Exception error) {
|
||||
// pass
|
||||
Log.e(TAG, String.format("sync get failed: %s", error != null ? error.getMessage() : "no error message"), error);
|
||||
|
||||
fullSyncInProgress = false;
|
||||
if (queuedSyncCount > 0) {
|
||||
queuedSyncCount--;
|
||||
syncApplyAndSet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncApplySuccess(String hash, String data) {
|
||||
if (!hash.equalsIgnoreCase(Lbryio.lastRemoteHash)) {
|
||||
SyncSetTask setTask = new SyncSetTask(Lbryio.lastRemoteHash, hash, data, null);
|
||||
setTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
syncSet(hash, data);
|
||||
} else {
|
||||
fullSyncInProgress = false;
|
||||
queuedSyncCount = 0;
|
||||
}
|
||||
|
||||
loadSharedUserState();
|
||||
|
@ -1392,6 +1585,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
public void onSyncApplyError(Exception error) {
|
||||
// pass
|
||||
Log.e(TAG, String.format("sync apply failed: %s", error != null ? error.getMessage() : "no error message"), error);
|
||||
fullSyncInProgress = false;
|
||||
if (queuedSyncCount > 0) {
|
||||
queuedSyncCount--;
|
||||
syncApplyAndSet();
|
||||
}
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -1458,59 +1656,33 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void registerUserActionsReceiver() {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(ACTION_NOW_PLAYING_CLAIM_UPDATED);
|
||||
intentFilter.addAction(ACTION_NOW_PLAYING_CLAIM_CLEARED);
|
||||
userActionsReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (ACTION_NOW_PLAYING_CLAIM_UPDATED.equals(action)) {
|
||||
handleNowPlayingClaimUpdated();
|
||||
} else if (ACTION_NOW_PLAYING_CLAIM_CLEARED.equals(action)) {
|
||||
handleNowPlayingClaimCleared();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleNowPlayingClaimUpdated() {
|
||||
if (nowPlayingClaim != null) {
|
||||
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
|
||||
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(nowPlayingClaim.getPublisherTitle());
|
||||
}
|
||||
}
|
||||
|
||||
private void handleNowPlayingClaimCleared() {
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
((TextView) findViewById(R.id.global_now_playing_title)).setText(null);
|
||||
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(null);
|
||||
if (MainActivity.appPlayer != null) {
|
||||
MainActivity.appPlayer.setPlayWhenReady(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
registerReceiver(userActionsReceiver, intentFilter);
|
||||
}
|
||||
|
||||
public void showMessage(int stringResourceId) {
|
||||
Snackbar.make(findViewById(R.id.content_main), stringResourceId, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
public void showMessage(String message) {
|
||||
Snackbar.make(findViewById(R.id.content_main), message, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
public void showError(String message) {
|
||||
Snackbar.make(findViewById(R.id.content_main), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
||||
if (findViewById(R.id.url_suggestions_container).getVisibility() == View.VISIBLE) {
|
||||
clearWunderbarFocus(findViewById(R.id.wunderbar));
|
||||
return;
|
||||
}
|
||||
if (backPressInterceptor != null && backPressInterceptor.onBackPressed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
boolean handled = false;
|
||||
if (findViewById(R.id.url_suggestions_container).getVisibility() == View.VISIBLE) {
|
||||
clearWunderbarFocus(findViewById(R.id.wunderbar));
|
||||
handled = true;
|
||||
} else {
|
||||
ChannelFormFragment channelFormFragment = null;
|
||||
for (Fragment fragment : openNavFragments.values()) {
|
||||
if (fragment instanceof ChannelFormFragment) {
|
||||
|
@ -1522,7 +1694,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
// check fragment and nav history
|
||||
|
@ -1563,24 +1734,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_STORAGE_PERMISSION:
|
||||
ChannelFormFragment channelFormFragment = null;
|
||||
//PublishFormFragment publishFormFragment = null;
|
||||
for (Fragment fragment : openNavFragments.values()) {
|
||||
if (fragment instanceof ChannelFormFragment) {
|
||||
channelFormFragment = ((ChannelFormFragment) fragment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (channelFormFragment != null) {
|
||||
channelFormFragment.onStoragePermissionGranted();
|
||||
for (StoragePermissionListener listener : storagePermissionListeners) {
|
||||
listener.onStoragePermissionGranted();
|
||||
}
|
||||
} else {
|
||||
if (channelFormFragment != null) {
|
||||
channelFormFragment.onStoragePermissionRefused();
|
||||
for (StoragePermissionListener listener : storagePermissionListeners) {
|
||||
listener.onStoragePermissionRefused();
|
||||
}
|
||||
}
|
||||
startingStoragePermissionRequest = false;
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -1631,9 +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() {
|
||||
if (Lbryio.isSignedIn()) {
|
||||
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
|
||||
findViewById(R.id.sign_in_button_container).setVisibility(View.GONE);
|
||||
findViewById(R.id.signed_in_email_container).setVisibility(View.VISIBLE);
|
||||
((TextView) findViewById(R.id.signed_in_email)).setText(Lbryio.getSignedInEmail());
|
||||
findViewById(R.id.sign_in_header_divider).setBackgroundColor(getResources().getColor(R.color.lightDivider));
|
||||
|
@ -1891,7 +2063,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
if (uri.isChannel()) {
|
||||
openChannelUrl(uri.toString());
|
||||
} else {
|
||||
openFileUrl(uri.toString(), this);
|
||||
openFileUrl(uri.toString());
|
||||
}
|
||||
} catch (LbryUriException ex) {
|
||||
// pass
|
||||
|
@ -1936,6 +2108,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}, 1000);
|
||||
return;
|
||||
}
|
||||
if (startingStoragePermissionRequest) {
|
||||
return;
|
||||
}
|
||||
enterPIPMode();
|
||||
}
|
||||
|
||||
|
@ -1946,8 +2121,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
appPlayer != null &&
|
||||
FileViewActivity.instance == null &&
|
||||
!startingFileViewActivity &&
|
||||
!startingFilePickerActivity &&
|
||||
!startingSignInFlowActivity) {
|
||||
enteringPIPMode = true;
|
||||
|
@ -2024,7 +2197,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
private void unregisterReceivers() {
|
||||
Helper.unregisterReceiver(requestsReceiver, this);
|
||||
Helper.unregisterReceiver(serviceActionsReceiver, this);
|
||||
Helper.unregisterReceiver(userActionsReceiver, this);
|
||||
}
|
||||
|
||||
private Notification buildServiceNotification() {
|
||||
|
@ -2097,14 +2269,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return flatMenu;
|
||||
}
|
||||
|
||||
public static void setNowPlayingClaim(Claim claim, Context context) {
|
||||
public void setNowPlayingClaim(Claim claim) {
|
||||
nowPlayingClaim = claim;
|
||||
context.sendBroadcast(new Intent(ACTION_NOW_PLAYING_CLAIM_UPDATED));
|
||||
if (claim != null) {
|
||||
((TextView) findViewById(R.id.global_now_playing_title)).setText(nowPlayingClaim.getTitle());
|
||||
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(nowPlayingClaim.getPublisherTitle());
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearNowPlayingClaim(Context context) {
|
||||
public void clearNowPlayingClaim() {
|
||||
nowPlayingClaim = null;
|
||||
context.sendBroadcast(new Intent(ACTION_NOW_PLAYING_CLAIM_CLEARED));
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.GONE);
|
||||
((TextView) findViewById(R.id.global_now_playing_title)).setText(null);
|
||||
((TextView) findViewById(R.id.global_now_playing_channel_title)).setText(null);
|
||||
if (appPlayer != null) {
|
||||
appPlayer.setPlayWhenReady(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class CheckSdkReadyTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
@ -2225,7 +2405,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
}
|
||||
|
||||
protected void onStop() {
|
||||
if (!MainActivity.startingFileViewActivity && appPlayer != null && inPictureInPictureMode) {
|
||||
if (appPlayer != null && inPictureInPictureMode) {
|
||||
appPlayer.setPlayWhenReady(false);
|
||||
}
|
||||
super.onStop();
|
||||
|
@ -2253,13 +2433,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
openFragment(fragmentClass, allowNavigateBack, navItemId, null);
|
||||
}
|
||||
|
||||
private static String buildNavFragmentKey(Class fragmentClass, int navItemId) {
|
||||
private static String buildNavFragmentKey(Class fragmentClass, int navItemId, Map<String, Object> params) {
|
||||
if (params != null && params.containsKey("url")) {
|
||||
return String.format("%s-%d-%s", fragmentClass.getName(), navItemId, params.get("url").toString());
|
||||
}
|
||||
|
||||
return String.format("%s-%d", fragmentClass.getName(), navItemId);
|
||||
}
|
||||
|
||||
public void openFragment(Class fragmentClass, boolean allowNavigateBack, int navItemId, Map<String, Object> params) {
|
||||
try {
|
||||
String key = buildNavFragmentKey(fragmentClass, navItemId);
|
||||
String key = buildNavFragmentKey(fragmentClass, navItemId, params);
|
||||
Fragment fragment = openNavFragments.containsKey(key) ? openNavFragments.get(key) : (Fragment) fragmentClass.newInstance();
|
||||
if (fragment instanceof BaseFragment) {
|
||||
((BaseFragment) fragment).setParams(params);
|
||||
|
@ -2327,6 +2511,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
if (!forceRequest && ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
|
||||
Toast.makeText(context, rationale, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
startingStoragePermissionRequest = true;
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode);
|
||||
}
|
||||
}
|
||||
|
@ -2335,4 +2520,8 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
public static boolean hasPermission(String permission, Context context) {
|
||||
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
||||
}
|
||||
|
||||
public interface BackPressInterceptor {
|
||||
boolean onBackPressed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
|
|||
}
|
||||
vh.alphaContainer.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.VISIBLE : View.GONE);
|
||||
vh.thumbnailView.setVisibility(claim.isPlaceholder() || Helper.isNullOrEmpty(thumbnailUrl) ? View.GONE : View.VISIBLE);
|
||||
vh.alphaView.setText(claim.isPlaceholder() ? null : claim.getName().substring(1, 2));
|
||||
vh.alphaView.setText(claim.isPlaceholder() ? null : claim.getName() != null ? claim.getName().substring(1, 2) : "");
|
||||
|
||||
int bgColor = Helper.generateRandomColorForValue(claim.getClaimId());
|
||||
Helper.setIconViewBackgroundColor(vh.alphaContainer, bgColor, claim.isPlaceholder(), context);
|
||||
|
|
|
@ -97,6 +97,10 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public Claim getLastItem() {
|
||||
return items.size() > 0 ? items.get(items.size() - 1) : null;
|
||||
}
|
||||
|
||||
public void addFeaturedItem(Claim claim) {
|
||||
items.add(0, claim);
|
||||
notifyDataSetChanged();
|
||||
|
|
|
@ -56,6 +56,11 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
|
|||
|
||||
public int getSelectedCount() { return selectedItems.size(); }
|
||||
|
||||
public void clearItems() {
|
||||
items.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public List<Claim> getSelectedItems() {
|
||||
return this.selectedItems;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,16 @@ public class DiscoverDialogFragment extends BottomSheetDialogFragment {
|
|||
dialogActionsListener.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
super.onDismiss(dialog);
|
||||
if (dialogActionsListener != null) {
|
||||
dialogActionsListener.onCancel();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
if (dialogActionsListener != null) {
|
||||
dialogActionsListener.onCancel();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.math.BigDecimal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.FileViewActivity;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
|
||||
|
@ -147,16 +146,16 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof FileViewActivity) {
|
||||
((FileViewActivity) context).addWalletBalanceListener(this);
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
fetchChannels();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Context context = getContext();
|
||||
if (context instanceof FileViewActivity) {
|
||||
((FileViewActivity) context).removeWalletBalanceListener(this);
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).removeWalletBalanceListener(this);
|
||||
}
|
||||
inputDeposit.clearFocus();
|
||||
super.onPause();
|
||||
|
@ -178,8 +177,8 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
|||
public void onError(Exception error) {
|
||||
// could not fetch channels
|
||||
Context context = getContext();
|
||||
if (context instanceof FileViewActivity) {
|
||||
((FileViewActivity) context).showError(error.getMessage());
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showError(error.getMessage());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.google.android.material.textfield.TextInputEditText;
|
|||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import io.lbry.browser.FileViewActivity;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
|
@ -164,15 +163,15 @@ public class SendTipDialogFragment extends BottomSheetDialogFragment implements
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof FileViewActivity) {
|
||||
((FileViewActivity) context).addWalletBalanceListener(this);
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Context context = getContext();
|
||||
if (context instanceof FileViewActivity) {
|
||||
((FileViewActivity) context).removeWalletBalanceListener(this);
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).removeWalletBalanceListener(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package io.lbry.browser.listener;
|
||||
|
||||
public interface StoragePermissionListener {
|
||||
void onStoragePermissionGranted();
|
||||
void onStoragePermissionRefused();
|
||||
}
|
|
@ -118,10 +118,10 @@ public class Claim {
|
|||
if (fee != null) {
|
||||
double amount = Helper.parseDouble(fee.getAmount(), 0);
|
||||
if ("usd".equalsIgnoreCase(fee.getCurrency())) {
|
||||
return new BigDecimal(String.valueOf(amount / usdRate)).multiply(new BigDecimal(100000000)); // deweys
|
||||
return new BigDecimal(String.valueOf(amount / usdRate));
|
||||
}
|
||||
|
||||
return new BigDecimal(String.valueOf(amount));
|
||||
return new BigDecimal(String.valueOf(amount)).divide(new BigDecimal(100000000)); // deweys
|
||||
}
|
||||
|
||||
return new BigDecimal(0);
|
||||
|
|
|
@ -8,9 +8,13 @@ public class WalletSync {
|
|||
private String data;
|
||||
private boolean changed;
|
||||
|
||||
public WalletSync(String hash, String data, boolean changed) {
|
||||
public WalletSync(String hash, String data) {
|
||||
this.hash = hash;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public WalletSync(String hash, String data, boolean changed) {
|
||||
this(hash, data);
|
||||
this.changed = changed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ public class SyncSetTask extends AsyncTask<Void, Void, String> {
|
|||
if (handler != null) {
|
||||
if (!Helper.isNullOrEmpty(hash)) {
|
||||
handler.onSyncSetSuccess(hash);
|
||||
} else if (error != null) {
|
||||
} else {
|
||||
handler.onSyncSetError(error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import androidx.fragment.app.Fragment;
|
|||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.ui.following.FileViewFragment;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -19,7 +20,15 @@ public class BaseFragment extends Fragment {
|
|||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).setSelectedMenuItemForFragment(this);
|
||||
MainActivity activity = (MainActivity) context;
|
||||
activity.setSelectedMenuItemForFragment(this);
|
||||
|
||||
if (this instanceof FileViewFragment) {
|
||||
activity.hideGlobalNowPlaying();
|
||||
} else {
|
||||
activity.checkNowPlaying();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.FileViewActivity;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.ClaimListAdapter;
|
||||
|
@ -213,6 +212,7 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
|
|||
singleTagView = true;
|
||||
tags = Arrays.asList(tagName);
|
||||
titleView.setText(Helper.capitalize(tagName));
|
||||
Helper.setViewVisibility(customizeLink, View.GONE);
|
||||
} else {
|
||||
singleTagView = false;
|
||||
// default to followed Tags scope if any tags are followed
|
||||
|
@ -224,8 +224,8 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
|
|||
titleView.setText(getString(R.string.all_content));
|
||||
}
|
||||
|
||||
forPrefix.setVisibility(singleTagView ? View.GONE : View.VISIBLE);
|
||||
scopeLink.setVisibility(singleTagView ? View.GONE : View.VISIBLE);
|
||||
Helper.setViewVisibility(forPrefix, singleTagView ? View.GONE : View.VISIBLE);
|
||||
Helper.setViewVisibility(scopeLink, singleTagView ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (reload) {
|
||||
fetchClaimSearchContent(true);
|
||||
|
@ -451,22 +451,15 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
|
|||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
String claimId = claim.getClaimId();
|
||||
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl();
|
||||
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openChannelClaim(claim);
|
||||
}
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(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);
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.FileViewActivity;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.ClaimListAdapter;
|
||||
|
@ -263,21 +262,15 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
|
|||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
String claimId = claim.getClaimId();
|
||||
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl();
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openChannelClaim(claim);
|
||||
}
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(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);
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -37,6 +37,7 @@ import io.lbry.browser.BuildConfig;
|
|||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.TagListAdapter;
|
||||
import io.lbry.browser.listener.StoragePermissionListener;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.NavMenuItem;
|
||||
|
@ -54,7 +55,8 @@ import io.lbry.browser.utils.LbryAnalytics;
|
|||
import io.lbry.browser.utils.LbryUri;
|
||||
import lombok.Getter;
|
||||
|
||||
public class ChannelFormFragment extends BaseFragment implements WalletBalanceListener, TagListAdapter.TagClickListener {
|
||||
public class ChannelFormFragment extends BaseFragment implements
|
||||
StoragePermissionListener, TagListAdapter.TagClickListener, WalletBalanceListener {
|
||||
|
||||
private static final int SUGGESTED_LIMIT = 8;
|
||||
|
||||
|
@ -490,6 +492,7 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
|
|||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) getContext();
|
||||
activity.removeStoragePermissionListener(this);
|
||||
activity.removeWalletBalanceListener(this);
|
||||
activity.restoreToggle();
|
||||
activity.showFloatingWalletBalance();
|
||||
|
@ -509,6 +512,7 @@ public class ChannelFormFragment extends BaseFragment implements WalletBalanceLi
|
|||
if (context instanceof MainActivity) {
|
||||
MainActivity activity = (MainActivity) context;
|
||||
LbryAnalytics.setCurrentScreen(activity, "Channel Form", "ChannelForm");
|
||||
activity.addStoragePermissionListener(this);
|
||||
if (editMode) {
|
||||
ActionBar actionBar = activity.getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
|
|
|
@ -288,14 +288,15 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
|||
updateRequired = true;
|
||||
}
|
||||
}
|
||||
if (!updateRequired && params.containsKey("url")) {
|
||||
if (params.containsKey("url")) {
|
||||
String newUrl = params.get("url").toString();
|
||||
if (!newUrl.equalsIgnoreCase(url) || claim == null) {
|
||||
if (claim == null || !newUrl.equalsIgnoreCase(url)) {
|
||||
this.claim = null;
|
||||
this.url = newUrl;
|
||||
updateRequired = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (updateRequired) {
|
||||
resetSubCount();
|
||||
if (!Helper.isNullOrEmpty(url)) {
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.FileViewActivity;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.EditorsChoiceItemAdapter;
|
||||
|
@ -116,12 +115,10 @@ public class EditorsChoiceFragment extends BaseFragment {
|
|||
@Override
|
||||
public void onEditorsChoiceItemClicked(EditorsChoiceItem item) {
|
||||
String url = item.getPermanentUrl();
|
||||
|
||||
Intent intent = new Intent(getContext(), FileViewActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.putExtra("url", url);
|
||||
MainActivity.startingFileViewActivity = true;
|
||||
startActivity(intent);
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openFileUrl(url);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.FileViewActivity;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.ChannelFilterListAdapter;
|
||||
|
@ -90,6 +89,7 @@ public class FollowingFragment extends BaseFragment implements
|
|||
private boolean contentClaimSearchLoading = false;
|
||||
private boolean suggestedClaimSearchLoading = false;
|
||||
private View noContentView;
|
||||
private boolean subscriptionsShown;
|
||||
|
||||
private List<Integer> queuedContentPages = new ArrayList<>();
|
||||
private List<Integer> queuedSuggestedPages = new ArrayList<>();
|
||||
|
@ -249,8 +249,8 @@ public class FollowingFragment extends BaseFragment implements
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
buildChannelIdsAndUrls();
|
||||
currentSuggestedPage = 1;
|
||||
discoverDialog = DiscoverDialogFragment.newInstance();
|
||||
excludeChannelIdsForDiscover = channelIds != null ? new ArrayList<>(channelIds) : null;
|
||||
discoverDialog.setAdapter(suggestedChannelAdapter);
|
||||
discoverDialog.setDialogActionsListener(new DiscoverDialogFragment.DiscoverDialogListener() {
|
||||
@Override
|
||||
|
@ -265,6 +265,9 @@ public class FollowingFragment extends BaseFragment implements
|
|||
public void onCancel() {
|
||||
discoverDialog = null;
|
||||
excludeChannelIdsForDiscover = null;
|
||||
if (suggestedChannelAdapter != null) {
|
||||
suggestedChannelAdapter.clearItems();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
|
@ -353,7 +356,7 @@ public class FollowingFragment extends BaseFragment implements
|
|||
}
|
||||
|
||||
if (Lbryio.subscriptions != null && Lbryio.subscriptions.size() > 0) {
|
||||
fetchLoadedSubscriptions();
|
||||
fetchLoadedSubscriptions(true);
|
||||
} else {
|
||||
fetchSubscriptions();
|
||||
}
|
||||
|
@ -366,7 +369,7 @@ public class FollowingFragment extends BaseFragment implements
|
|||
PreferenceManager.getDefaultSharedPreferences(context).unregisterOnSharedPreferenceChangeListener(this);
|
||||
super.onPause();
|
||||
}
|
||||
public void fetchLoadedSubscriptions() {
|
||||
public void fetchLoadedSubscriptions(boolean showSubscribed) {
|
||||
subscriptionsList = new ArrayList<>(Lbryio.subscriptions);
|
||||
buildChannelIdsAndUrls();
|
||||
if (Lbryio.cacheResolvedSubscriptions.size() > 0) {
|
||||
|
@ -377,8 +380,10 @@ public class FollowingFragment extends BaseFragment implements
|
|||
|
||||
fetchClaimSearchContent(resetClaimSearchContent);
|
||||
resetClaimSearchContent = false;
|
||||
if (showSubscribed && subscriptionsList.size() > 0) {
|
||||
showSubscribedContent();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadFollowing() {
|
||||
// wrapper to just re-fetch subscriptions (upon user sign in, for example)
|
||||
|
@ -458,6 +463,7 @@ public class FollowingFragment extends BaseFragment implements
|
|||
}
|
||||
|
||||
private void showSubscribedContent() {
|
||||
subscriptionsShown = true;
|
||||
Helper.setViewText(titleView, R.string.channels_you_follow);
|
||||
|
||||
Helper.setViewVisibility(horizontalChannelList, View.VISIBLE);
|
||||
|
@ -484,6 +490,8 @@ public class FollowingFragment extends BaseFragment implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
excludeChannelIdsForDiscover = channelIds != null ? new ArrayList<>(channelIds) : null;
|
||||
}
|
||||
|
||||
private void fetchAndResolveChannelList() {
|
||||
|
@ -579,22 +587,15 @@ public class FollowingFragment extends BaseFragment implements
|
|||
contentListAdapter.setListener(new ClaimListAdapter.ClaimListItemListener() {
|
||||
@Override
|
||||
public void onClaimClicked(Claim claim) {
|
||||
String claimId = claim.getClaimId();
|
||||
String url = !Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl();
|
||||
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).openChannelClaim(claim);
|
||||
}
|
||||
MainActivity activity = (MainActivity) context;
|
||||
if (claim.getName().startsWith("@")) {
|
||||
// channel claim
|
||||
activity.openChannelClaim(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);
|
||||
activity.openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -718,12 +719,11 @@ public class FollowingFragment extends BaseFragment implements
|
|||
ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (discoverDialog != null) {
|
||||
Lbryio.addSubscription(subscription);
|
||||
Lbryio.addCachedResolvedSubscription(claim);
|
||||
resetClaimSearchContent = true;
|
||||
fetchLoadedSubscriptions();
|
||||
}
|
||||
fetchLoadedSubscriptions(subscriptionsShown);
|
||||
|
||||
saveSharedUserState();
|
||||
}
|
||||
|
||||
|
@ -740,12 +740,11 @@ public class FollowingFragment extends BaseFragment implements
|
|||
ChannelSubscribeTask task = new ChannelSubscribeTask(getContext(), channelClaimId, subscription, true, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (discoverDialog != null) {
|
||||
Lbryio.removeSubscription(subscription);
|
||||
Lbryio.removeCachedResolvedSubscription(claim);
|
||||
resetClaimSearchContent = true;
|
||||
fetchLoadedSubscriptions();
|
||||
}
|
||||
fetchLoadedSubscriptions(subscriptionsShown);
|
||||
|
||||
saveSharedUserState();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
private int currentPage;
|
||||
private Date lastDate;
|
||||
private boolean listReachedEnd;
|
||||
private boolean contentListLoading;
|
||||
|
||||
private CardView cardStats;
|
||||
private TextView linkStats;
|
||||
|
@ -114,6 +115,32 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
showHistory();
|
||||
}
|
||||
});
|
||||
contentList.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (contentListLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
if (lm != null) {
|
||||
int visibleItemCount = lm.getChildCount();
|
||||
int totalItemCount = lm.getItemCount();
|
||||
int pastVisibleItems = lm.findFirstVisibleItemPosition();
|
||||
if (pastVisibleItems + visibleItemCount >= totalItemCount) {
|
||||
if (!listReachedEnd) {
|
||||
// load more
|
||||
if (currentFilter == FILTER_DOWNLOADS) {
|
||||
currentPage++;
|
||||
fetchDownloads();
|
||||
} else if (currentFilter == FILTER_HISTORY) {
|
||||
fetchHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// stats
|
||||
linkStats = root.findViewById(R.id.library_show_stats);
|
||||
|
@ -203,6 +230,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
contentListAdapter.clearItems();
|
||||
contentListAdapter.setCanEnterSelectionMode(true);
|
||||
}
|
||||
listReachedEnd = false;
|
||||
|
||||
checkStatsLink();
|
||||
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
|
||||
|
@ -220,6 +248,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
contentListAdapter.clearItems();
|
||||
contentListAdapter.setCanEnterSelectionMode(false);
|
||||
}
|
||||
listReachedEnd = false;
|
||||
|
||||
cardStats.setVisibility(View.GONE);
|
||||
checkStatsLink();
|
||||
|
@ -241,7 +270,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
if (claim.getName().startsWith("@")) {
|
||||
activity.openChannelUrl(claim.getPermanentUrl());
|
||||
} else {
|
||||
MainActivity.openFileUrl(claim.getPermanentUrl(), context);
|
||||
activity.openFileUrl(claim.getPermanentUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,6 +278,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
}
|
||||
|
||||
private void fetchDownloads() {
|
||||
contentListLoading = true;
|
||||
Helper.setViewVisibility(linkStats, View.GONE);
|
||||
Helper.setViewVisibility(layoutListEmpty, View.GONE);
|
||||
FileListTask task = new FileListTask(currentPage, PAGE_SIZE, true, listLoading, new FileListTask.FileListResultHandler() {
|
||||
|
@ -269,6 +299,7 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
}
|
||||
contentList.setAdapter(contentListAdapter);
|
||||
checkListEmpty();
|
||||
contentListLoading = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -276,12 +307,14 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
// pass
|
||||
checkStatsLink();
|
||||
checkListEmpty();
|
||||
contentListLoading = false;
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void fetchHistory() {
|
||||
contentListLoading = true;
|
||||
Helper.setViewVisibility(layoutListEmpty, View.GONE);
|
||||
DatabaseHelper dbHelper = DatabaseHelper.getInstance();
|
||||
if (dbHelper != null) {
|
||||
|
@ -289,6 +322,10 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
@Override
|
||||
public void onSuccess(List<ViewHistory> history, boolean hasReachedEnd) {
|
||||
listReachedEnd = hasReachedEnd;
|
||||
if (history.size() > 0) {
|
||||
lastDate = history.get(history.size() - 1).getTimestamp();
|
||||
}
|
||||
|
||||
List<Claim> claims = Helper.claimsFromViewHistory(history);
|
||||
if (contentListAdapter == null) {
|
||||
initContentListAdapter(claims);
|
||||
|
@ -297,11 +334,13 @@ public class LibraryFragment extends BaseFragment implements DownloadActionListe
|
|||
}
|
||||
contentList.setAdapter(contentListAdapter);
|
||||
checkListEmpty();
|
||||
contentListLoading = false;
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
checkListEmpty();
|
||||
contentListLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ public class SearchFragment extends BaseFragment implements
|
|||
((MainActivity) getContext()).openChannelUrl(claim.getPermanentUrl());
|
||||
} else {
|
||||
// not a channel
|
||||
MainActivity.openFileClaim(claim, getContext());
|
||||
((MainActivity) getContext()).openFileClaim(claim);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
|||
if (uri.isChannel()) {
|
||||
activity.openChannelUrl(uri.toString());
|
||||
} else {
|
||||
MainActivity.openFileUrl(uri.toString(), context);
|
||||
activity.openFileUrl(uri.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,21 +285,22 @@ public final class Helper {
|
|||
}
|
||||
|
||||
public static String shortCurrencyFormat(double value) {
|
||||
DecimalFormat format = new DecimalFormat("#,###.#");
|
||||
if (value > 1000000000.00) {
|
||||
return String.format("%.1fB", value / 1000000000.0);
|
||||
return String.format("%sB", format.format(value / 1000000000.0));
|
||||
}
|
||||
if (value > 1000000.0) {
|
||||
return String.format("%.1fM", value / 1000000.0);
|
||||
return String.format("%sM",format.format( value / 1000000.0));
|
||||
}
|
||||
if (value > 1000.0) {
|
||||
return String.format("%.1fK", value / 1000.0);
|
||||
return String.format("%sK", format.format(value / 1000.0));
|
||||
}
|
||||
|
||||
if (value == 0) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
return new DecimalFormat("###.##").format(value);
|
||||
return format.format(value);
|
||||
}
|
||||
|
||||
public static String getValue(CharSequence cs) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
|||
import java.security.KeyStore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -26,6 +27,9 @@ import io.lbry.browser.model.Tag;
|
|||
import io.lbry.browser.model.Transaction;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
import kotlin.Pair;
|
||||
import okhttp3.CacheControl;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
@ -161,7 +165,7 @@ public final class Lbry {
|
|||
if (value instanceof Double) {
|
||||
jsonParams.put(param.getKey(), (double) value);
|
||||
} else {
|
||||
jsonParams.put(param.getKey(), value);
|
||||
jsonParams.put(param.getKey(), value == null ? JSONObject.NULL : value);
|
||||
}
|
||||
}
|
||||
} catch (JSONException ex) {
|
||||
|
@ -313,10 +317,10 @@ public final class Lbry {
|
|||
if (!Helper.isNullOrEmpty(claimId)) {
|
||||
params.put("claim_id", claimId);
|
||||
}
|
||||
/*if (downloads) {
|
||||
params.put("file_name", null);
|
||||
if (downloads) {
|
||||
params.put("download_path", null);
|
||||
params.put("comparison", "ne");
|
||||
}*/
|
||||
}
|
||||
if (page > 0) {
|
||||
params.put("page", page);
|
||||
}
|
||||
|
|
|
@ -1,646 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/pageBackground">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/file_view_global_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_loading_state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_loading_container"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
<ProgressBar
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_gravity="center_vertical" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/loading_decentralized_data"
|
||||
android:textSize="16sp"
|
||||
android:textFontWeight="300" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_claim_display_area"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_media_container"
|
||||
android:background="@color/mediaContainerBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3.25">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_media_meta_container"
|
||||
android:clickable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
android:id="@+id/file_view_thumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<ProgressBar
|
||||
android:id="@+id/file_view_main_action_loading"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_centerInParent="true" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/file_view_main_action_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="invisible"
|
||||
android:text="@string/play" />
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_fee_container"
|
||||
android:background="@drawable/bg_stream_cost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="7dp"
|
||||
android:visibility="gone">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="8dp"
|
||||
android:text="@string/fa_coins"
|
||||
android:textColor="@android:color/black" />
|
||||
<TextView
|
||||
android:id="@+id/file_view_fee"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_exoplayer_container"
|
||||
android:background="@android:color/black"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/file_view_exoplayer_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:controller_layout_id="@layout/exo_playback_control_view"/>
|
||||
<ProgressBar
|
||||
android:id="@+id/player_buffering_progress"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_unsupported_container"
|
||||
android:background="@color/mediaContainerBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="36dp"
|
||||
android:visibility="gone">
|
||||
<ImageView
|
||||
android:id="@+id/file_view_unsupported_gerbil"
|
||||
android:src="@drawable/gerbil_happy"
|
||||
android:layout_width="64dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:layout_toRightOf="@id/file_view_unsupported_gerbil"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_centerVertical="true">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/unsupported_content" />
|
||||
<TextView
|
||||
android:id="@+id/file_view_unsupported_text"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/unsupported_content_desc"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerControlView android:id="@+id/file_view_cast_control_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:repeat_toggle_modes="all|one"
|
||||
app:show_timeout="-1"/>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/file_view_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="6.75"
|
||||
android:clipToPadding="false">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_title_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="4dp">
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_title_layout"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="48dp">
|
||||
<TextView
|
||||
android:id="@+id/file_view_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
<LinearLayout
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/file_view_view_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:textFontWeight="300"
|
||||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/file_view_publish_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:textFontWeight="300" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/file_view_desc_toggle_arrow"
|
||||
android:src="@drawable/ic_arrow_dropdown"
|
||||
android:layout_toLeftOf="@+id/file_view_title_layout"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:tint="@color/foreground" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_actions_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="5">
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_share"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:tint="@color/foreground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_share" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/share"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_tip"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:textColor="@color/foreground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:textSize="20dp"
|
||||
android:text="@string/fa_gift"/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_repost"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:textColor="@color/foreground"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textSize="20dp"
|
||||
android:text="@string/fa_repost"/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/repost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_edit"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:visibility="gone">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:tint="@color/foreground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_edit" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_download"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<ProgressBar
|
||||
android:id="@+id/file_view_download_progress"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
style="?android:progressBarStyleHorizontal"
|
||||
android:progressDrawable="@drawable/determinate_progress_circle"
|
||||
android:visibility="gone" />
|
||||
<ImageView
|
||||
android:id="@+id/file_view_action_download_icon"
|
||||
android:tint="@color/foreground"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_download" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/download"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_delete"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:visibility="gone">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:tint="@color/foreground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_delete" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_report"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:tint="@color/foreground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_report" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/report"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_name_area"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_name"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="600" />
|
||||
</LinearLayout>
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_follow_unfollow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_description_area"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
<TextView
|
||||
android:id="@+id/file_view_description"
|
||||
android:textSize="12sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:autoLink="all"
|
||||
android:textColorLink="@color/lbryGreen"
|
||||
android:textFontWeight="300"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp" />
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_tag_area"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="10"
|
||||
android:layout_marginTop="36dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
<TextView
|
||||
android:layout_weight="2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/tags"
|
||||
android:textSize="12sp"
|
||||
android:textFontWeight="600" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/file_view_tag_list"
|
||||
android:layout_weight="8"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_related_content_area"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/related_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="16sp"
|
||||
android:layout_centerVertical="true" />
|
||||
<ProgressBar
|
||||
android:id="@+id/file_view_related_content_progress"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/file_view_no_related_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/no_related_content"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300"
|
||||
android:visibility="gone" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/file_view_related_content_list"
|
||||
android:overScrollMode="never"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_imageviewer_container"
|
||||
android:background="@android:color/black"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
<com.github.chrisbanes.photoview.PhotoView
|
||||
android:id="@+id/file_view_imageviewer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_webview_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
<WebView
|
||||
android:id="@+id/file_view_webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/floating_wallet_balance" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -5,7 +5,6 @@
|
|||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<include
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/app_bar_main_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/content_main_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
android:paddingRight="4dp">
|
||||
<TextView
|
||||
android:id="@+id/player_duration_elapsed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/inter"
|
||||
|
@ -77,18 +77,19 @@
|
|||
android:layout_toRightOf="@id/player_duration_elapsed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_centerVertical="true"
|
||||
app:scrubber_color="@color/scrubberColor"
|
||||
app:played_color="@color/playedColor"
|
||||
app:buffered_color="@color/bufferedColor" />
|
||||
<TextView
|
||||
android:id="@+id/player_duration_total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="end"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/zero_duration"
|
||||
android:textColor="@color/white"
|
||||
|
|
641
app/src/main/res/layout/fragment_file_view.xml
Normal file
641
app/src/main/res/layout/fragment_file_view.xml
Normal 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>
|
|
@ -53,10 +53,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:lineHeight="14dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="6"
|
||||
android:maxLines="8"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -2,26 +2,31 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="86dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/pageBackground"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/sign_in_button_container"
|
||||
android:background="@color/lbryGreen"
|
||||
android:clickable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<RelativeLayout
|
||||
android:id="@+id/sign_in_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:clickable="true"
|
||||
android:paddingTop="38dp"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:background="@color/lbryGreen">
|
||||
android:background="@color/lbryGreen"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/sign_in"
|
||||
android:fontFamily="@font/inter"
|
||||
|
@ -29,20 +34,24 @@
|
|||
android:textFontWeight="600"
|
||||
android:textAllCaps="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/signed_in_email_container"
|
||||
android:background="@color/drawerBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="38dp"
|
||||
android:visibility="gone">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
<TextView
|
||||
android:id="@+id/signed_in_email"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:ellipsize="middle"
|
||||
android:fontFamily="@font/inter"
|
||||
android:gravity="center"
|
||||
|
@ -52,6 +61,7 @@
|
|||
android:textColor="@color/menuItemForeground"
|
||||
android:textFontWeight="300" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/sign_in_header_divider"
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<string name="nothing_at_this_location">There\'s nothing at this location.</string>
|
||||
<string name="publish_something_here">Publish something here</string>
|
||||
<string name="cannot_view_claim">This content cannot be accessed at this time. Please try again later.</string>
|
||||
<string name="zero_duration">00:00</string>
|
||||
<string name="zero_duration">0:00</string>
|
||||
<string name="claim_file_not_found">The file at "%1$s" does not exist.</string>
|
||||
<string name="confirm_purchase">Confirm Purchase</string>
|
||||
<string name="delete_file">Delete file</string>
|
||||
|
@ -305,6 +305,7 @@
|
|||
<string name="at">\@</string>
|
||||
<string name="deposit">Deposit</string>
|
||||
<string name="deposit_remains_yours">This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.</string>
|
||||
<string name="storage_permission_rationale_download">LBRY requires access to download content to your device.</string>
|
||||
<string name="storage_permission_rationale_images">LBRY requires access to load images from your device storage.</string>
|
||||
<string name="select_thumbnail">Select thumbnail</string>
|
||||
<string name="select_cover">Select cover image</string>
|
||||
|
|
Loading…
Reference in a new issue