Search in sources :

Example 96 with IntentFilter

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;
}
Also used : IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) View(android.view.View) ListView(android.widget.ListView) Uri(android.net.Uri) OnClickListener(android.view.View.OnClickListener)

Example 97 with IntentFilter

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;
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter)

Example 98 with IntentFilter

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));
}
Also used : IntentFilter(android.content.IntentFilter)

Example 99 with IntentFilter

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);
}
Also used : IntentFilter(android.content.IntentFilter)

Example 100 with IntentFilter

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);
}
Also used : IntentFilter(android.content.IntentFilter)

Aggregations

IntentFilter (android.content.IntentFilter)1441 Intent (android.content.Intent)493 Context (android.content.Context)292 BroadcastReceiver (android.content.BroadcastReceiver)274 PendingIntent (android.app.PendingIntent)148 RemoteException (android.os.RemoteException)80 ComponentName (android.content.ComponentName)54 Handler (android.os.Handler)53 View (android.view.View)45 Test (org.junit.Test)41 Uri (android.net.Uri)40 PowerManager (android.os.PowerManager)38 ArrayList (java.util.ArrayList)37 TextView (android.widget.TextView)36 ResolveInfo (android.content.pm.ResolveInfo)30 File (java.io.File)29 Point (android.graphics.Point)28 PackageManager (android.content.pm.PackageManager)27 IOException (java.io.IOException)25 HandlerThread (android.os.HandlerThread)24