Skip to content

Commit

Permalink
Merge branch 'release/4.0' into update-contribution-guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal authored Aug 23, 2023
2 parents e093cb5 + 0b9601d commit 4b2e97f
Show file tree
Hide file tree
Showing 162 changed files with 3,974 additions and 1,647 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If we feel your PR is a significant help to us, we'll award you a bounty with an
## Points to note

- Please follow [Android/JAVA code style](https://source.android.com/docs/setup/contribute/code-style) for writing any code. Please see [this](https://github.com/TeamAmaze/AmazeFileManager/issues/986) issue too.
- Also, follow [Android Material Design guidelines](https://material.io/guidelines/material-design/introduction.html) in case you make changes to any UI element.
- Also, follow [Android Material Design guidelines](https://m3.material.io/get-started) in case you make changes to any UI element.

## PS: please make sure to

Expand All @@ -52,4 +52,4 @@ If we feel your PR is a significant help to us, we'll award you a bounty with an
- We have our day time work, so except security vulnerabilities, your submission may be left cold for a lil while before being picked up by us :)
- Please be patient with us while we review our code. Try to avoid favoritism, hate speech & adhere to our [code of conduct](https://github.com/TeamAmaze/AmazeFileManager/blob/release/4.0/CODE_OF_CONDUCT.md).

## Ready to roll? Start [forking](https://github.com/TeamAmaze/AmazeFileManager/fork)! ;)
## Ready to roll? Start [forking](https://github.com/TeamAmaze/AmazeFileManager/fork)! ;)
15 changes: 15 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Security Policy

## Supported Versions

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

Andorid devices that runs Android versions less that Android 4.4
(Android KitKat) would not recieve 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]`
11 changes: 6 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ dependencies {
implementation "androidx.room:room-rxjava2:$roomVersion"
kapt "androidx.annotation:annotation:$androidXAnnotationVersion"

implementation "androidx.preference:preference:$androidXPrefVersion"
implementation "androidx.preference:preference-ktx:$androidXPrefVersion"

//For tests
Expand Down Expand Up @@ -187,8 +186,6 @@ dependencies {

implementation 'org.greenrobot:eventbus:3.3.1'

implementation 'com.android.volley:volley:1.2.1'

implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:io:${libsuVersion}"

Expand All @@ -207,6 +204,9 @@ dependencies {
//FTP
implementation "commons-net:commons-net:$commonsNetVersion"

//OkHttp
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"

implementation "org.bouncycastle:bcpkix-jdk15on:$bouncyCastleVersion"
implementation "org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion"

Expand All @@ -233,14 +233,15 @@ dependencies {

implementation 'org.tukaani:xz:1.9'

implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.9'
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"

implementation project(':commons_compress_7z')
implementation project(':file_operations')
implementation project(':portscanner')
implementation "androidx.core:core-ktx:$androidXCoreVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "ch.acra:acra-core:5.7.0"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
tools:replace="android:label"
android:label="@string/appbar_name"
android:requestLegacyExternalStorage="true"
android:banner="@drawable/about_header">
android:banner="@drawable/about_header"
android:usesCleartextTraffic="true">

<activity
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import com.amaze.filemanager.utils.AnimUtils.marqueeAfterDelay
import com.amaze.filemanager.utils.Utils
import com.amaze.filemanager.utils.safeLet
import java.io.File
import kotlin.collections.ArrayList
import kotlin.math.roundToInt

class AppsRecyclerAdapter(
Expand Down Expand Up @@ -254,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
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@
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 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 +200,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 @@ -1192,7 +1192,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 +1204,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 +1238,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 +1301,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 @@ -1392,6 +1392,7 @@ private void showPopup(@NonNull View view, @NonNull final LayoutElementParcelabl
}
} else {
popupMenu.getMenu().findItem(R.id.book).setVisible(false);
popupMenu.getMenu().findItem(R.id.compress).setVisible(true);

if (description.endsWith(fileExtensionZip)
|| description.endsWith(fileExtensionJar)
Expand All @@ -1409,8 +1410,10 @@ private void showPopup(@NonNull View view, @NonNull final LayoutElementParcelabl
|| description.endsWith(fileExtensionGz)
|| description.endsWith(fileExtensionBzip2)
|| description.endsWith(fileExtensionLzma)
|| description.endsWith(fileExtensionXz))
|| description.endsWith(fileExtensionXz)) {
popupMenu.getMenu().findItem(R.id.ex).setVisible(true);
popupMenu.getMenu().findItem(R.id.compress).setVisible(false);
}
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
* Copyright (C) 2014-2023 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>,
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
*
* This file is part of Amaze File Manager.
*
* Amaze File Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.amaze.filemanager.adapters

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.amaze.filemanager.R
import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.filesystem.HybridFileParcelable
import com.amaze.filemanager.ui.activities.MainActivity
import com.amaze.filemanager.ui.colors.ColorPreference
import java.util.Random

class SearchRecyclerViewAdapter :
ListAdapter<HybridFileParcelable, SearchRecyclerViewAdapter.ViewHolder>(

object : DiffUtil.ItemCallback<HybridFileParcelable>() {
override fun areItemsTheSame(
oldItem: HybridFileParcelable,
newItem: HybridFileParcelable
): Boolean {
return oldItem.path == newItem.path && oldItem.name == newItem.name
}

override fun areContentsTheSame(
oldItem: HybridFileParcelable,
newItem: HybridFileParcelable
): Boolean {
return oldItem.path == newItem.path && oldItem.name == newItem.name
}
}
) {
override fun onCreateViewHolder(parent: ViewGroup, type: Int): ViewHolder {
val v: View = LayoutInflater.from(parent.context)
.inflate(R.layout.search_row_item, parent, false)
return ViewHolder(v)
}

override fun onBindViewHolder(holder: SearchRecyclerViewAdapter.ViewHolder, position: Int) {
val item = getItem(position)

holder.fileNameTV.text = item.name
holder.filePathTV.text = item.path.substring(0, item.path.lastIndexOf("/"))

holder.colorView.setBackgroundColor(getRandomColor(holder.colorView.context))

val colorPreference =
(AppConfig.getInstance().mainActivityContext as MainActivity).currentColorPreference

if (item.isDirectory) {
holder.colorView.setBackgroundColor(colorPreference.primaryFirstTab)
} else {
holder.colorView.setBackgroundColor(colorPreference.accent)
}
}

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

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

init {

fileNameTV = view.findViewById(R.id.searchItemFileNameTV)
filePathTV = view.findViewById(R.id.searchItemFilePathTV)
colorView = view.findViewById(R.id.searchItemSampleColorView)

view.setOnClickListener {

val item = getItem(adapterPosition)

if (!item.isDirectory) {
item.openFile(
AppConfig.getInstance().mainActivityContext as MainActivity?,
false
)
} else {
(AppConfig.getInstance().mainActivityContext as MainActivity?)
?.goToMain(item.path)
}

(AppConfig.getInstance().mainActivityContext as MainActivity?)
?.appbar?.searchView?.hideSearchView()
}
}
}

private fun getRandomColor(context: Context): Int {
return ContextCompat.getColor(
context,
ColorPreference.availableColors[
Random().nextInt(
ColorPreference.availableColors.size - 1
)
]
)
}
}
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 4b2e97f

Please sign in to comment.