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

View file

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

View file

@ -16,6 +16,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatSpinner; import androidx.appcompat.widget.AppCompatSpinner;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -78,6 +79,7 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
private View progressLoadingInviteByEmail; private View progressLoadingInviteByEmail;
private View progressLoadingStatus; private View progressLoadingStatus;
private CardView rewardDriverCard;
private View inlineChannelCreator; private View inlineChannelCreator;
private TextInputEditText inlineChannelCreatorInputName; private TextInputEditText inlineChannelCreatorInputName;
private TextInputEditText inlineChannelCreatorInputDeposit; private TextInputEditText inlineChannelCreatorInputDeposit;
@ -95,6 +97,7 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
layoutSdkInitializing = root.findViewById(R.id.container_sdk_initializing); layoutSdkInitializing = root.findViewById(R.id.container_sdk_initializing);
textLearnMoreLink = root.findViewById(R.id.invites_account_driver_learn_more); textLearnMoreLink = root.findViewById(R.id.invites_account_driver_learn_more);
buttonGetStarted = root.findViewById(R.id.invites_get_started_button); 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); textInviteLink = root.findViewById(R.id.invites_invite_link);
buttonCopyInviteLink = root.findViewById(R.id.invites_copy_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); layoutSdkInitializing.setVisibility(Lbry.SDK_READY ? View.GONE : View.VISIBLE);
Helper.applyHtmlForTextView(textLearnMoreLink); 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() { inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override @Override
public void onFocusChange(View view, boolean hasFocus) { 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++) { for (int i = 0; i < files.size(); i++) {
LbryFile file = files.get(i); LbryFile file = files.get(i);
// remove own claims as well // remove own claims as well
if (file.getClaim() != null && Lbry.ownClaims.contains(file.getClaim())) { if (Lbry.ownClaims != null && Lbry.ownClaims.size() > 0) {
continue; for (Claim own : Lbry.ownClaims) {
if (own.getClaimId().equalsIgnoreCase(file.getClaimId())) {
continue;
}
}
} }
if (!Helper.isNullOrEmpty(file.getDownloadPath())) { if (!Helper.isNullOrEmpty(file.getDownloadPath())) {
filtered.add(file); filtered.add(file);