Skip to content

Commit

Permalink
Merge branch 'release/4.0' into feature/sdk33
Browse files Browse the repository at this point in the history
  • Loading branch information
VishalNehra authored Oct 30, 2023
2 parents 4432ea7 + 0fef0d4 commit faf28bb
Show file tree
Hide file tree
Showing 158 changed files with 4,569 additions and 3,029 deletions.
20 changes: 20 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Security Policy

## Supported Versions

`v3.8.5` supports Android 4.0 and above.
`v4.x.x` would only support Android 4.4 and above.

Android devices that runs Android versions less that Android 4.4
(Android KitKat) would not receive any more updates (the latest
supported version would be `v3.8.5`).

## Reporting a Vulnerability

Feel free to contact us via `[email protected]`.

Please CC the maintainers too:
- `[email protected]`
- `[email protected]`
- `[email protected]`
- `[email protected]`
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ dependencies {
testImplementation "androidx.test:rules:$androidXTestVersion"
testImplementation "androidx.test.ext:junit:$androidXTestExtVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-inline:$mockitoVersion"
testImplementation "org.mockito:mockito-inline:$mockitoInlineVersion"
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
testImplementation "org.apache.sshd:sshd-core:1.7.0"
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class AppsRecyclerAdapter(
) {
uri, mimeType, useNewStack ->
val intent = buildIntent(
fragment.requireContext(),
uri,
mimeType,
useNewStack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.widget.AppCompatImageButton;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.RecyclerView;

/** Created by Arpit on 25-01-2015 edited by Emmanuel Messulam<[email protected]> */
Expand Down Expand Up @@ -127,7 +127,7 @@ public ArrayList<Integer> getCheckedItemPositions() {
* @param position the position of the item
* @param imageView the circular {@link CircleGradientDrawable} that is to be animated
*/
private void toggleChecked(int position, ImageView imageView) {
private void toggleChecked(int position, AppCompatImageView imageView) {
compressedExplorerFragment.stopAnim();
stoppedAnimation = true;

Expand Down Expand Up @@ -204,7 +204,7 @@ public CompressedItemViewHolder onCreateViewHolder(ViewGroup parent, int viewTyp
} else if (viewType == TYPE_ITEM) {
View v = mInflater.inflate(R.layout.rowlayout, parent, false);
CompressedItemViewHolder vh = new CompressedItemViewHolder(v);
ImageButton about = v.findViewById(R.id.properties);
AppCompatImageButton about = v.findViewById(R.id.properties);
about.setVisibility(View.INVISIBLE);
return vh;
} else {
Expand Down
113 changes: 85 additions & 28 deletions app/src/main/java/com/amaze/filemanager/adapters/RecyclerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package com.amaze.filemanager.adapters;

import static com.amaze.filemanager.filesystem.compressed.CompressedHelper.*;
import static com.amaze.filemanager.filesystem.files.FileListSorter.SORT_NONE_ON_TOP;
import static com.amaze.filemanager.ui.fragments.preferencefragments.PreferencesConstants.PREFERENCE_COLORIZE_ICONS;
import static com.amaze.filemanager.ui.fragments.preferencefragments.PreferencesConstants.PREFERENCE_SHOW_FILE_SIZE;
import static com.amaze.filemanager.ui.fragments.preferencefragments.PreferencesConstants.PREFERENCE_SHOW_GOBACK_BUTTON;
Expand All @@ -31,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 All @@ -47,8 +50,10 @@
import com.amaze.filemanager.adapters.holders.SpecialViewHolder;
import com.amaze.filemanager.application.AppConfig;
import com.amaze.filemanager.fileoperations.filesystem.OpenMode;
import com.amaze.filemanager.filesystem.PasteHelper;
import com.amaze.filemanager.filesystem.files.CryptUtil;
import com.amaze.filemanager.ui.ItemPopupMenu;
import com.amaze.filemanager.ui.activities.MainActivity;
import com.amaze.filemanager.ui.activities.superclasses.PreferenceActivity;
import com.amaze.filemanager.ui.colors.ColorUtils;
import com.amaze.filemanager.ui.drag.RecyclerAdapterDragListener;
Expand All @@ -62,6 +67,7 @@
import com.amaze.filemanager.ui.views.CircleGradientDrawable;
import com.amaze.filemanager.utils.AnimUtils;
import com.amaze.filemanager.utils.GlideConstants;
import com.amaze.filemanager.utils.MainActivityActionMode;
import com.amaze.filemanager.utils.Utils;
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader;
import com.bumptech.glide.load.DataSource;
Expand All @@ -84,15 +90,16 @@
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.recyclerview.widget.RecyclerView;

/**
Expand Down Expand Up @@ -200,7 +207,7 @@ public RecyclerAdapter(
* @param position the position of the item
* @param imageView the check {@link CircleGradientDrawable} that is to be animated
*/
public void toggleChecked(int position, ImageView imageView) {
public void toggleChecked(int position, AppCompatImageView imageView) {
if (getItemsDigested().size() <= position || position < 0) {
AppConfig.toast(context, R.string.operation_not_supported);
return;
Expand Down Expand Up @@ -374,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 Expand Up @@ -605,34 +625,43 @@ private void setItems(
}

public void createHeaders(boolean invalidate, List<IconDataParcelable> uris) {
boolean[] headers = new boolean[] {false, false};
if ((mainFragment.getMainFragmentViewModel() != null
&& mainFragment.getMainFragmentViewModel().getDsort() == SORT_NONE_ON_TOP)
|| getItemsDigested() == null
|| getItemsDigested().isEmpty()) {
return;
} else {
boolean[] headers = new boolean[] {false, false};

for (int i = 0; i < getItemsDigested().size(); i++) {
for (int i = 0; i < getItemsDigested().size(); i++) {

if (getItemsDigested().get(i).layoutElementParcelable != null) {
LayoutElementParcelable nextItem = getItemsDigested().get(i).layoutElementParcelable;
if (getItemsDigested().get(i).layoutElementParcelable != null) {
LayoutElementParcelable nextItem = getItemsDigested().get(i).layoutElementParcelable;

if (!headers[0] && nextItem.isDirectory) {
headers[0] = true;
getItemsDigested().add(i, new ListItem(TYPE_HEADER_FOLDERS));
uris.add(i, null);
continue;
}
if (nextItem != null) {
if (!headers[0] && nextItem.isDirectory) {
headers[0] = true;
getItemsDigested().add(i, new ListItem(TYPE_HEADER_FOLDERS));
uris.add(i, null);
continue;
}

if (!headers[1]
&& !nextItem.isDirectory
&& !nextItem.title.equals(".")
&& !nextItem.title.equals("..")) {
headers[1] = true;
getItemsDigested().add(i, new ListItem(TYPE_HEADER_FILES));
uris.add(i, null);
continue; // leave this continue for symmetry
if (!headers[1]
&& !nextItem.isDirectory
&& !nextItem.title.equals(".")
&& !nextItem.title.equals("..")) {
headers[1] = true;
getItemsDigested().add(i, new ListItem(TYPE_HEADER_FILES));
uris.add(i, null);
continue; // leave this continue for symmetry
}
}
}
}
}

if (invalidate) {
notifyDataSetChanged();
if (invalidate) {
notifyDataSetChanged();
}
}
}

Expand Down Expand Up @@ -763,6 +792,7 @@ private void bindViewHolderList(@NonNull final ItemViewHolder holder, int positi

holder.baseItemView.setOnLongClickListener(
p1 -> {
if (hasPendingPasteOperation()) return false;
if (!isBackButton) {
if (dragAndDropPreference == PreferencesConstants.PREFERENCE_DRAG_DEFAULT
|| (dragAndDropPreference == PreferencesConstants.PREFERENCE_DRAG_TO_MOVE_COPY
Expand Down Expand Up @@ -976,6 +1006,7 @@ private void bindViewHolderGrid(@NonNull final ItemViewHolder holder, int positi

holder.baseItemView.setOnLongClickListener(
p1 -> {
if (hasPendingPasteOperation()) return false;
if (!isBackButton) {
if (dragAndDropPreference == PreferencesConstants.PREFERENCE_DRAG_DEFAULT
|| (dragAndDropPreference == PreferencesConstants.PREFERENCE_DRAG_TO_MOVE_COPY
Expand Down Expand Up @@ -1192,7 +1223,7 @@ private View getDragShadow(int selectionCount) {
.setVisibility(View.VISIBLE);
String rememberMovePreference =
sharedPrefs.getString(PreferencesConstants.PREFERENCE_DRAG_AND_DROP_REMEMBERED, "");
ImageView icon =
AppCompatImageView icon =
mainFragment
.getMainActivity()
.getTabFragment()
Expand All @@ -1204,7 +1235,7 @@ private View getDragShadow(int selectionCount) {
.getTabFragment()
.getDragPlaceholder()
.findViewById(R.id.files_count_parent);
TextView filesCount =
AppCompatTextView filesCount =
mainFragment
.getMainActivity()
.getTabFragment()
Expand Down Expand Up @@ -1238,7 +1269,7 @@ private int getDragIconReference(String rememberMovePreference) {
private void showThumbnailWithBackground(
ItemViewHolder viewHolder,
IconDataParcelable iconData,
ImageView view,
AppCompatImageView view,
OnImageProcessed errorListener) {
if (iconData.isImageBroken()) {
viewHolder.genericIcon.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -1301,7 +1332,7 @@ public boolean onResourceReady(
private void showRoundedThumbnail(
ItemViewHolder viewHolder,
IconDataParcelable iconData,
ImageView view,
AppCompatImageView view,
OnImageProcessed errorListener) {
if (iconData.isImageBroken()) {
View iconBackground =
Expand Down Expand Up @@ -1366,6 +1397,7 @@ public boolean onResourceReady(
}

private void showPopup(@NonNull View view, @NonNull final LayoutElementParcelable rowItem) {
if (hasPendingPasteOperation()) return;
Context currentContext = this.context;
if (mainFragment.getMainActivity().getAppTheme().getSimpleTheme(mainFragment.requireContext())
== AppTheme.BLACK) {
Expand Down Expand Up @@ -1428,6 +1460,31 @@ private void showPopup(@NonNull View view, @NonNull final LayoutElementParcelabl
popupMenu.show();
}

/**
* Helps in deciding whether to allow file modification or not, depending on the state of the
* copy/paste operation.
*
* @return true if there is an unfinished copy/paste operation, false otherwise.
*/
private boolean hasPendingPasteOperation() {
MainActivity mainActivity = mainFragment.getMainActivity();
if (mainActivity == null) return false;
MainActivityActionMode mainActivityActionMode = mainActivity.mainActivityActionMode;
PasteHelper pasteHelper = mainActivityActionMode.getPasteHelper();

if (pasteHelper != null
&& pasteHelper.getSnackbar() != null
&& pasteHelper.getSnackbar().isShown()) {
Toast.makeText(
mainFragment.requireContext(),
mainFragment.getString(R.string.complete_paste_warning),
Toast.LENGTH_LONG)
.show();
return true;
}
return false;
}

private boolean getBoolean(String key) {
return preferenceActivity.getBoolean(key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
Expand Down Expand Up @@ -81,8 +81,8 @@ class SearchRecyclerViewAdapter :

inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {

val fileNameTV: TextView
val filePathTV: TextView
val fileNameTV: AppCompatTextView
val filePathTV: AppCompatTextView
val colorView: View

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

Expand Down Expand Up @@ -85,7 +85,7 @@ public RequestBuilder getPreloadRequestBuilder(String item) {
}
}

public void loadApkImage(String item, ImageView v) {
public void loadApkImage(String item, AppCompatImageView v) {
if (isBottomSheet) {
request.load(getApplicationIconFromPackageName(item)).into(v);
} else {
Expand Down
Loading

0 comments on commit faf28bb

Please sign in to comment.