Limit gallery items to 150. Download filtering. Open rewards page from Invites reward driver card.

This commit is contained in:
Akinwale Ariwodola 2020-05-25 00:04:40 +01:00
parent 053ebbd70b
commit acbe33c66d
4 changed files with 21 additions and 5 deletions

View file

@ -54,7 +54,7 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
cursor = resolver.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
projection, null, null,
String.format("%s DESC", MediaStore.MediaColumns.DATE_MODIFIED));
String.format("%s DESC LIMIT 150", MediaStore.MediaColumns.DATE_MODIFIED));
while (cursor.moveToNext()) {
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
@ -71,7 +71,6 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
items.add(item);
}
} catch (SQLiteException ex) {
// failed to load videos. log and pass
Log.e(TAG, ex.getMessage(), ex);
} finally {

View file

@ -268,6 +268,7 @@ public class LibraryFragment extends BaseFragment implements
checkStatsLink();
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
currentPage = 1;
currentFiles = new ArrayList<>();
if (Lbry.SDK_READY) {
if (!initialOwnClaimsFetched) {
fetchOwnClaimsAndShowDownloads();
@ -381,7 +382,6 @@ public class LibraryFragment extends BaseFragment implements
listReachedEnd = hasReachedEnd;
List<LbryFile> filteredFiles = Helper.filterDownloads(files);
List<Claim> claims = Helper.claimsFromFiles(filteredFiles);
addFiles(filteredFiles);
updateStats();
checkStatsLink();

View file

@ -16,6 +16,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -78,6 +79,7 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
private View progressLoadingInviteByEmail;
private View progressLoadingStatus;
private CardView rewardDriverCard;
private View inlineChannelCreator;
private TextInputEditText inlineChannelCreatorInputName;
private TextInputEditText inlineChannelCreatorInputDeposit;
@ -95,6 +97,7 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
layoutSdkInitializing = root.findViewById(R.id.container_sdk_initializing);
textLearnMoreLink = root.findViewById(R.id.invites_account_driver_learn_more);
buttonGetStarted = root.findViewById(R.id.invites_get_started_button);
rewardDriverCard = root.findViewById(R.id.reward_driver_card);
textInviteLink = root.findViewById(R.id.invites_invite_link);
buttonCopyInviteLink = root.findViewById(R.id.invites_copy_invite_link);
@ -131,6 +134,16 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
Helper.applyHtmlForTextView(textLearnMoreLink);
rewardDriverCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).openRewards();
}
}
});
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {

View file

@ -660,8 +660,12 @@ public final class Helper {
for (int i = 0; i < files.size(); i++) {
LbryFile file = files.get(i);
// remove own claims as well
if (file.getClaim() != null && Lbry.ownClaims.contains(file.getClaim())) {
continue;
if (Lbry.ownClaims != null && Lbry.ownClaims.size() > 0) {
for (Claim own : Lbry.ownClaims) {
if (own.getClaimId().equalsIgnoreCase(file.getClaimId())) {
continue;
}
}
}
if (!Helper.isNullOrEmpty(file.getDownloadPath())) {
filtered.add(file);