Skip to content
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 @@ -130,10 +130,11 @@ protected final AsyncTaskResult<Boolean> doInBackground(
@Override
public void onPostExecute(AsyncTaskResult<Boolean> result) {

Intent intent = new Intent(MainActivity.KEY_INTENT_LOAD_LIST);
if (files.size() > 0) {
String path = files.get(0).getParent(applicationContext);
Intent intent = new Intent(MainActivity.KEY_INTENT_LOAD_LIST);
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, path);
intent.setPackage(applicationContext.getPackageName());
applicationContext.sendBroadcast(intent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class MoveFilesTask(
// mainFrag.updateList();
val intent = Intent(MainActivity.KEY_INTENT_LOAD_LIST)
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, paths[0])
intent.setPackage(applicationContext.packageName)
applicationContext.sendBroadcast(intent)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public void onPostExecute(Void b) {

Intent intent = new Intent(MainActivity.KEY_INTENT_LOAD_LIST);
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, targetPath);
intent.setPackage(getPackageName());
sendBroadcast(intent);
stopSelf();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public void onFinish(Long value) {

Intent intent = new Intent(MainActivity.KEY_INTENT_LOAD_LIST);
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, "");
intent.setPackage(getPackageName());
sendBroadcast(intent);
stopSelf();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ public void onPostExecute(Boolean hasInvalidEntries) {
if (watcherUtil != null) watcherUtil.stopWatch();
Intent intent = new Intent(MainActivity.KEY_INTENT_LOAD_LIST);
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, extractionPath);
intent.setPackage(extractService.getPackageName());
extractService.sendBroadcast(intent);
extractService.stopSelf();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class ZipService : AbstractProgressiveService() {
val intent =
Intent(MainActivity.KEY_INTENT_LOAD_LIST)
.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, zipPath)
.setPackage(applicationContext.packageName)
zipService.sendBroadcast(intent)
zipService.stopSelf()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class MainActivityViewModel(val applicationContext: Application) :
val intent = Intent(MainActivity.KEY_INTENT_LOAD_LIST)
hybridFile.getParent(applicationContext)?.let {
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, it)
intent.setPackage(applicationContext.packageName)
applicationContext.sendBroadcast(intent)
}
return true
Expand Down Expand Up @@ -295,6 +296,7 @@ class MainActivityViewModel(val applicationContext: Application) :
val intent = Intent(MainActivity.KEY_INTENT_LOAD_LIST)
hybridFile.getParent(applicationContext)?.let {
intent.putExtra(MainActivity.KEY_INTENT_LOAD_LIST_FILE, it)
intent.setPackage(applicationContext.packageName)
applicationContext.sendBroadcast(intent)
}
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void loadViews() {
}
}

private BroadcastReceiver receiver2 =
private BroadcastReceiver intentLoadListReceiver =
new BroadcastReceiver() {

@Override
Expand Down Expand Up @@ -1246,22 +1246,25 @@ public void updateList(boolean forceReload) {
}

@Override
public void onResume() {
super.onResume();
public void onStart() {
super.onStart();
ContextCompatExtKt.registerReceiverCompat(
requireMainActivity(),
receiver2,
requireActivity().getApplicationContext(),
intentLoadListReceiver,
new IntentFilter(MainActivity.KEY_INTENT_LOAD_LIST),
ContextCompat.RECEIVER_NOT_EXPORTED);
}

@Override
public void onResume() {
super.onResume();
resumeDecryptOperations();
startFileObserver();
}

@Override
public void onPause() {
super.onPause();
(requireActivity()).unregisterReceiver(receiver2);
if (customFileObserver != null) {
customFileObserver.stopWatching();
}
Expand All @@ -1271,6 +1274,12 @@ public void onPause() {
}
}

@Override
public void onStop() {
super.onStop();
requireActivity().getApplicationContext().unregisterReceiver(intentLoadListReceiver);
}

public ArrayList<LayoutElementParcelable> addToSmb(
@NonNull SmbFile[] mFile, @NonNull String path, boolean showHiddenFiles) throws SmbException {
ArrayList<LayoutElementParcelable> smbFileList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Context
import android.content.IntentFilter
import android.os.Build
import android.os.Build.VERSION_CODES.O
import androidx.core.content.ContextCompat

/**
* Context.registerReceiver() for SDK compatibility.
Expand All @@ -17,7 +18,7 @@ import android.os.Build.VERSION_CODES.O
fun Context.registerReceiverCompat(
broadcastReceiver: BroadcastReceiver,
intentFilter: IntentFilter,
flag: Int = 0x4,
flag: Int = ContextCompat.RECEIVER_NOT_EXPORTED,
) {
if (Build.VERSION.SDK_INT >= O) {
this.registerReceiver(broadcastReceiver, intentFilter, flag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ public void done(final HybridFile hFile, final boolean b) {

intent.putExtra(
MainActivity.KEY_INTENT_LOAD_LIST_FILE, hFile.getParent(context));
intent.setPackage(mainActivity.getPackageName());
mainActivity.sendBroadcast(intent);

// update the database entry to reflect rename for encrypted file
Expand Down
Loading