Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3972 implement fill selection #3973

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
import static com.amaze.filemanager.ui.fragments.preferencefragments.PreferencesConstants.PREFERENCE_USE_CIRCULAR_IMAGES;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -379,6 +381,19 @@ public void toggleSameDates() {
}
}

public void toggleFill() {
ArrayList<Integer> checkedItemsIndexes = getCheckedItemsIndex();
Collections.sort(checkedItemsIndexes);
if (checkedItemsIndexes.size() >= 2) {
for (int i = checkedItemsIndexes.get(0);
i < checkedItemsIndexes.get(checkedItemsIndexes.size() - 1);
i++) {
Objects.requireNonNull(getItemsDigested()).get(i).setChecked(true);
notifyItemChanged(i);
}
}
}

public void toggleSimilarNames() {
ArrayList<Integer> checkedItemsIndexes = getCheckedItemsIndex();
for (int i = 0; i < checkedItemsIndexes.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicLong;

import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class SelectionPopupMenu(
popupMenu.menu.findItem(R.id.select_similar).isVisible = false
}
}
if (recyclerAdapter.checkedItems.size < 2) {
popupMenu.menu.findItem(R.id.select_fill).isVisible = false
}
popupMenu.setOnMenuItemClickListener(popupMenu)
popupMenu.show()
}
Expand Down Expand Up @@ -99,6 +102,9 @@ class SelectionPopupMenu(
R.id.select_similar -> {
recyclerAdapter.toggleSimilarNames()
}
R.id.select_fill -> {
recyclerAdapter.toggleFill()
}
}
actionModeView.invalidate()
actionModeView.findViewById<AppCompatTextView>(R.id.item_count).text = recyclerAdapter
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/menu/selection_criteria.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
android:id="@+id/select_similar"
android:title="@string/select_similar"
/>
<item
android:id="@+id/select_fill"
android:title="@string/select_fill"
/>
</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ You only need to do this once, until the next time you select a new location for
<string name="select_by_type">Select by type</string>
<string name="select_by_date">Select by date</string>
<string name="select_similar">Select similar</string>
<string name="select_fill">Select fill</string>
<string name="error_fetching_google_play_product_list">Error fetching product list from Google Play.</string>
<string name="grant_all_files_permission"><html><body>Since Android 11, Google requests File Managers to request user permission for managing all files on the device. Details <a href="https://developer.android.com/training/data-storage/manage-all-files" target="_blank">here</a>.
\n\nAmaze File Manager needs this permission too. After pressing &quot;Grant&quot;here, please select <b>Allow access to manage all files</b> option on the next screen.
Expand Down
9 changes: 7 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
android.enableJetifier=true
android.useAndroidX=true

org.gradle.jvmargs=-Xmx4608M -XX:+UseParallelGC
org.gradle.jvmargs=-Xmx4608M -XX:+UseParallelGC \
VishalNehra marked this conversation as resolved.
Show resolved Hide resolved
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand All @@ -22,4 +27,4 @@ org.gradle.parallel=true
# https://github.com/usefulness/easylauncher-gradle-plugin/issues/408
android.disableResourceValidation=true
# for macs, omit for other operating systems
#org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/Contents/Home
# org.gradle.java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home