Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="com.termux.permission.RUN_COMMAND" />
<uses-permission android:name="com.termoneplus.permission.RUN_SCRIPT" />
<uses-permission android:name="jackpal.androidterm.permission.RUN_SCRIPT" />

<uses-feature
android:name="android.hardware.touchscreen"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ import com.amaze.filemanager.utils.safeLet
import java.io.File
import kotlin.math.roundToInt

/**
* [RecyclerView.Adapter] implementation for apps lists.
*/
class AppsRecyclerAdapter(
private val fragment: Fragment,
private val modelProvider: AppsAdapterPreloadModel,
private val isBottomSheet: Boolean,
private val adjustListViewCallback: AdjustListViewForTv<AppHolder>,
private val appDataParcelableList: MutableList<AppDataParcelable>,
// Optional, for specifying customized action on row click
private val onClickRowAction: ((AppDataParcelable) -> Unit)? = null,
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val myChecked = SparseBooleanArray()
private var appDataListItem: MutableList<ListItem> = mutableListOf()
Expand Down Expand Up @@ -209,7 +214,11 @@ class AppsRecyclerAdapter(
holder.rl.isClickable = true
holder.rl.nextFocusRightId = holder.about.id
holder.rl.setOnClickListener {
startActivityForRowItem(rowItem)
if (onClickRowAction != null) {
onClickRowAction.invoke(rowItem)
} else {
startActivityForRowItem(rowItem)
}
}
}
if (myChecked[position]) {
Expand Down Expand Up @@ -508,7 +517,7 @@ class AppsRecyclerAdapter(
MaterialDialog.Builder(fragment.requireContext())
builder1
.theme(
themedActivity.appTheme.getMaterialDialogTheme(),
themedActivity.appTheme.materialDialogTheme,
)
.content(fragment.getString(R.string.unin_system_apk))
.title(fragment.getString(R.string.warning))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,13 +1435,15 @@ private void showPopup(@NonNull View view, @NonNull final LayoutElementParcelabl
if (rowItem.isDirectory) {
popupMenu.getMenu().findItem(R.id.open_with).setVisible(false);
popupMenu.getMenu().findItem(R.id.share).setVisible(false);
popupMenu.getMenu().findItem(R.id.open_in_terminal).setVisible(true);

if (mainFragment.getMainActivity().mReturnIntent) {
popupMenu.getMenu().findItem(R.id.return_select).setVisible(true);
}
} else {
popupMenu.getMenu().findItem(R.id.book).setVisible(false);
popupMenu.getMenu().findItem(R.id.compress).setVisible(true);
popupMenu.getMenu().findItem(R.id.open_in_terminal).setVisible(false);

if (description.endsWith(fileExtensionZip)
|| description.endsWith(fileExtensionJar)
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@
import io.reactivex.schedulers.Schedulers;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import kotlin.Deprecated;
import kotlin.ReplaceWith;
import kotlin.collections.ArraysKt;
import kotlin.io.ByteStreamsKt;
import kotlin.text.Charsets;
Expand Down Expand Up @@ -609,6 +611,9 @@ public String getParent(Context context) {
*
* @deprecated use {@link #isDirectory(Context)} to handle content resolvers
*/
@Deprecated(
replaceWith = @ReplaceWith(expression = "isDirectory(Context)", imports = ""),
message = "")
public boolean isDirectory() {
boolean isDirectory;
switch (mode) {
Expand Down Expand Up @@ -703,6 +708,9 @@ public Boolean execute(@NonNull SFTPClient client) {
/**
* @deprecated use {@link #folderSize(Context)}
*/
@Deprecated(
replaceWith = @ReplaceWith(expression = "folderSize(Context)", imports = ""),
message = "")
public long folderSize() {
long size = 0L;

Expand Down Expand Up @@ -1062,6 +1070,9 @@ public FTPFile[] executeWithFtpClient(@NonNull FTPClient ftpClient)
*
* @deprecated use forEachChildrenFile()
*/
@Deprecated(
replaceWith = @ReplaceWith(expression = "forEachChildrenFile", imports = ""),
message = "")
public ArrayList<HybridFileParcelable> listFiles(Context context, boolean isRoot) {
ArrayList<HybridFileParcelable> arrayList = new ArrayList<>();
forEachChildrenFile(context, isRoot, arrayList::add);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
import androidx.annotation.Nullable;
import androidx.documentfile.provider.DocumentFile;

import kotlin.Deprecated;
import kotlin.ReplaceWith;

/**
* Created by vishal on 19/4/17.
*
Expand All @@ -73,6 +76,7 @@ public class CloudUtil {
/**
* @deprecated use getCloudFiles()
*/
@Deprecated(replaceWith = @ReplaceWith(expression = "getCloudFiles", imports = ""), message = "")
public static ArrayList<HybridFileParcelable> listFiles(
String path, CloudStorage cloudStorage, OpenMode openMode) throws CloudPluginException {
final ArrayList<HybridFileParcelable> baseFiles = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,11 @@ public static void installApk(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !permissionsActivity.getPackageManager().canRequestPackageInstalls()) {
permissionsActivity.requestInstallApkPermission(
() -> installApk(f, permissionsActivity), true);
() -> {
installApk(f, permissionsActivity);
return null;
},
true);
}

Intent intent = new Intent(Intent.ACTION_VIEW);
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/amaze/filemanager/ui/ItemPopupMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.amaze.filemanager.ui.dialogs.EncryptAuthenticateDialog;
import com.amaze.filemanager.ui.dialogs.EncryptWithPresetPasswordSaveAsDialog;
import com.amaze.filemanager.ui.dialogs.GeneralDialogCreation;
import com.amaze.filemanager.ui.dialogs.OpenFolderInTerminalFragment;
import com.amaze.filemanager.ui.fragments.MainFragment;
import com.amaze.filemanager.ui.fragments.preferencefragments.PreferencesConstants;
import com.amaze.filemanager.ui.provider.UtilitiesProvider;
Expand Down Expand Up @@ -251,6 +252,9 @@ public void onButtonPressed(Intent intent, String password)
} else if (item.getItemId() == R.id.return_select) {
mainFragment.returnIntentResults(new HybridFileParcelable[] {rowItem.generateBaseFile()});
return true;
} else if (item.getItemId() == R.id.open_in_terminal) {
OpenFolderInTerminalFragment.Companion.openTerminalOrShow(rowItem.desc, mainActivity);
return true;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import kotlin.Unit;
import kotlin.collections.ArraysKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.text.Charsets;

Expand All @@ -222,7 +224,7 @@ public class MainActivity extends PermissionsActivity
CloudConnectionCallbacks,
LoaderManager.LoaderCallbacks<Cursor>,
FolderChooserDialog.FolderCallback,
PermissionsActivity.OnPermissionGranted {
Function0<Unit> {

private static final Logger LOG = LoggerFactory.getLogger(MainActivity.class);

Expand Down Expand Up @@ -532,9 +534,8 @@ public void invalidateFragmentAndBundle(Bundle savedInstanceState, boolean isClo
}
}

@Override
@SuppressLint("CheckResult")
public void onPermissionGranted() {
public Unit invoke() {
drawer.refreshDrawer();
TabFragment tabFragment = getTabFragment();
boolean b = getBoolean(PREFERENCE_NEED_TO_SET_HOME);
Expand Down Expand Up @@ -563,6 +564,7 @@ public void onPermissionGranted() {
if (main1 != null) ((MainFragment) main1).updateList(false);
}
}
return null;
}

private void checkForExternalPermission() {
Expand Down Expand Up @@ -1120,6 +1122,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.hiddenitems).setVisible(true);
menu.findItem(R.id.view).setVisible(true);
menu.findItem(R.id.extract).setVisible(false);
menu.findItem(R.id.open_in_terminal).setVisible(true);
invalidatePasteSnackbar(true);
findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE);
} else if (fragment instanceof AppsListFragment
Expand All @@ -1133,6 +1136,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.home).setVisible(false);
menu.findItem(R.id.history).setVisible(false);
menu.findItem(R.id.extract).setVisible(false);
menu.findItem(R.id.open_in_terminal).setVisible(false);
if (fragment instanceof ProcessViewerFragment) {
menu.findItem(R.id.sort).setVisible(false);
} else if (fragment instanceof FtpServerFragment) {
Expand All @@ -1156,6 +1160,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.hiddenitems).setVisible(false);
menu.findItem(R.id.view).setVisible(false);
menu.findItem(R.id.extract).setVisible(true);
menu.findItem(R.id.open_in_terminal).setVisible(false);
invalidatePasteSnackbar(false);
}
return super.onPrepareOptionsMenu(menu);
Expand Down Expand Up @@ -1279,6 +1284,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
} else if (item.getItemId() == R.id.search) {
getAppbar().getSearchView().revealSearchView();
} else if (item.getItemId() == R.id.open_in_terminal) {
// do nothing
}
return null;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,25 @@
* 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.ui.activities.superclasses

package com.amaze.filemanager.ui.activities.superclasses;
import androidx.appcompat.app.AppCompatActivity
import com.amaze.filemanager.application.AppConfig
import com.amaze.filemanager.ui.colors.ColorPreferenceHelper
import com.amaze.filemanager.ui.provider.UtilitiesProvider
import com.amaze.filemanager.ui.theme.AppTheme

import com.amaze.filemanager.application.AppConfig;
import com.amaze.filemanager.ui.colors.ColorPreferenceHelper;
import com.amaze.filemanager.ui.provider.UtilitiesProvider;
import com.amaze.filemanager.ui.theme.AppTheme;
/** Created by rpiotaix on 17/10/16. */
open class BasicActivity : AppCompatActivity() {
private val appConfig: AppConfig
get() = application as AppConfig

import androidx.appcompat.app.AppCompatActivity;
val colorPreference: ColorPreferenceHelper
get() = appConfig.utilsProvider.colorPreference

/** Created by rpiotaix on 17/10/16. */
public class BasicActivity extends AppCompatActivity {
val appTheme: AppTheme
get() = appConfig.utilsProvider.appTheme

protected AppConfig getAppConfig() {
return (AppConfig) getApplication();
}

public ColorPreferenceHelper getColorPreference() {
return getAppConfig().getUtilsProvider().getColorPreference();
}

public AppTheme getAppTheme() {
return getAppConfig().getUtilsProvider().getAppTheme();
}

public UtilitiesProvider getUtilsProvider() {
return getAppConfig().getUtilsProvider();
}
val utilsProvider: UtilitiesProvider
get() = appConfig.utilsProvider
}
Loading