use of android.content.IntentFilter in project FileExplorer by MiCode.
the class FileViewActivity method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mActivity = getActivity();
// getWindow().setFormat(android.graphics.PixelFormat.RGBA_8888);
mRootView = inflater.inflate(R.layout.file_explorer_list, container, false);
ActivitiesManager.getInstance().registerActivity(ActivitiesManager.ACTIVITY_FILE_VIEW, mActivity);
mFileCagetoryHelper = new FileCategoryHelper(mActivity);
mFileViewInteractionHub = new FileViewInteractionHub(this);
Intent intent = mActivity.getIntent();
String action = intent.getAction();
if (!TextUtils.isEmpty(action) && (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT))) {
mFileViewInteractionHub.setMode(Mode.Pick);
boolean pickFolder = intent.getBooleanExtra(PICK_FOLDER, false);
if (!pickFolder) {
String[] exts = intent.getStringArrayExtra(EXT_FILTER_KEY);
if (exts != null) {
mFileCagetoryHelper.setCustomCategory(exts);
}
} else {
mFileCagetoryHelper.setCustomCategory(new String[] {});
mRootView.findViewById(R.id.pick_operation_bar).setVisibility(View.VISIBLE);
mRootView.findViewById(R.id.button_pick_confirm).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try {
Intent intent = Intent.parseUri(mFileViewInteractionHub.getCurrentPath(), 0);
mActivity.setResult(Activity.RESULT_OK, intent);
mActivity.finish();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
});
mRootView.findViewById(R.id.button_pick_cancel).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mActivity.finish();
}
});
}
} else {
mFileViewInteractionHub.setMode(Mode.View);
}
mFileListView = (ListView) mRootView.findViewById(R.id.file_path_list);
mFileIconHelper = new FileIconHelper(mActivity);
mAdapter = new FileListAdapter(mActivity, R.layout.file_browser_item, mFileNameList, mFileViewInteractionHub, mFileIconHelper);
boolean baseSd = intent.getBooleanExtra(GlobalConsts.KEY_BASE_SD, !FileExplorerPreferenceActivity.isReadRoot(mActivity));
Log.i(LOG_TAG, "baseSd = " + baseSd);
String rootDir = intent.getStringExtra(ROOT_DIRECTORY);
if (!TextUtils.isEmpty(rootDir)) {
if (baseSd && this.sdDir.startsWith(rootDir)) {
rootDir = this.sdDir;
}
} else {
rootDir = baseSd ? this.sdDir : GlobalConsts.ROOT_PATH;
}
mFileViewInteractionHub.setRootPath(rootDir);
String currentDir = FileExplorerPreferenceActivity.getPrimaryFolder(mActivity);
Uri uri = intent.getData();
if (uri != null) {
if (baseSd && this.sdDir.startsWith(uri.getPath())) {
currentDir = this.sdDir;
} else {
currentDir = uri.getPath();
}
}
mFileViewInteractionHub.setCurrentPath(currentDir);
Log.i(LOG_TAG, "CurrentDir = " + currentDir);
mBackspaceExit = (uri != null) && (TextUtils.isEmpty(action) || (!action.equals(Intent.ACTION_PICK) && !action.equals(Intent.ACTION_GET_CONTENT)));
mFileListView.setAdapter(mAdapter);
mFileViewInteractionHub.refreshFileList();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
intentFilter.addDataScheme("file");
mActivity.registerReceiver(mReceiver, intentFilter);
updateUI();
setHasOptionsMenu(true);
return mRootView;
}
use of android.content.IntentFilter in project FileExplorer by MiCode.
the class FTPServerService method onCreate.
public void onCreate() {
myLog.l(Log.DEBUG, "SwiFTP server created");
// Set the application-wide context global, if not already set
Context myContext = Globals.getContext();
if (myContext == null) {
myContext = getApplicationContext();
if (myContext != null) {
Globals.setContext(myContext);
}
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
intentFilter.addDataScheme("file");
registerReceiver(mReceiver, intentFilter);
return;
}
use of android.content.IntentFilter in project Xposed-Tinted-Status-Bar by MohammadAG.
the class PluginDownloaderActivity method onResume.
@Override
protected void onResume() {
super.onResume();
registerReceiver(mDownlaodReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
use of android.content.IntentFilter in project openkit-android by OpenKit.
the class UiLifecycleHelper method onResume.
/**
* To be called from an Activity or Fragment's onResume method.
*/
public void onResume() {
Session session = Session.getActiveSession();
if (session != null) {
if (callback != null) {
session.addCallback(callback);
}
if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) {
session.openForRead(null);
}
}
// add the broadcast receiver
IntentFilter filter = new IntentFilter();
filter.addAction(Session.ACTION_ACTIVE_SESSION_SET);
filter.addAction(Session.ACTION_ACTIVE_SESSION_UNSET);
// Add a broadcast receiver to listen to when the active Session
// is set or unset, and add/remove our callback as appropriate
broadcastManager.registerReceiver(receiver, filter);
}
use of android.content.IntentFilter in project openkit-android by OpenKit.
the class SessionTracker method addBroadcastReceiver.
private void addBroadcastReceiver() {
IntentFilter filter = new IntentFilter();
filter.addAction(Session.ACTION_ACTIVE_SESSION_SET);
filter.addAction(Session.ACTION_ACTIVE_SESSION_UNSET);
// Add a broadcast receiver to listen to when the active Session
// is set or unset, and add/remove our callback as appropriate
broadcastManager.registerReceiver(receiver, filter);
}
Aggregations