List of usage examples for android.support.v4.app FragmentActivity getSupportLoaderManager
public LoaderManager getSupportLoaderManager()
From source file:io.valuesfeng.picker.control.AlbumCollection.java
public void onCreate(FragmentActivity activity, OnDirectorySelectListener directorySelectListener, SelectionSpec selectionSpec, ListView listView) { mContext = new WeakReference<Context>(activity); mLoaderManager = activity.getSupportLoaderManager(); this.directorySelectListener = directorySelectListener; this.selectionSpec = selectionSpec; albumAdapter = new AlbumAdapter(activity, null); listView.setAdapter(albumAdapter);/*from w ww . j a va2 s . c o m*/ listView.setOnItemClickListener(this); }
From source file:com.wit.android.support.database.LoadableAssistant.java
/** * Wrapped {@link android.support.v4.app.LoaderManager#getLoader(int)} called with the current * loader id.//from ww w . ja v a2 s .com */ @Nullable public Loader<Cursor> getLoader(@NonNull FragmentActivity activity) { final LoaderManager loaderManager = activity.getSupportLoaderManager(); return mLoaderId >= 0 && loaderManager != null ? loaderManager.<Cursor>getLoader(mLoaderId) : null; }
From source file:org.jboss.aerogear.android.authentication.impl.loader.support.SupportAuthenticationModuleAdapter.java
public SupportAuthenticationModuleAdapter(FragmentActivity activity, AuthenticationModule module, String name) { this.module = module; this.manager = activity.getSupportLoaderManager(); this.applicationContext = activity.getApplicationContext(); this.fragment = null; this.activity = activity; this.handler = new Handler(Looper.getMainLooper()); this.name = name; }
From source file:org.mozilla.gecko.FilePickerResultHandler.java
@Override public void onActivityResult(int resultCode, Intent intent) { if (resultCode != Activity.RESULT_OK) { sendResult(""); return;/* www . ja va 2 s. c o m*/ } // Camera results won't return an Intent. Use the file name we passed to the original intent. // In Android M, camera results return an empty Intent rather than null. if (intent == null || (intent.getAction() == null && intent.getData() == null)) { if (mImageName != null) { File file = new File(Environment.getExternalStorageDirectory(), mImageName); sendResult(file.getAbsolutePath()); } else { sendResult(""); } return; } Uri uri = intent.getData(); if (uri == null) { sendResult(""); return; } // Some file pickers may return a file uri if ("file".equals(uri.getScheme())) { String path = uri.getPath(); sendResult(path == null ? "" : path); return; } final FragmentActivity fa = (FragmentActivity) GeckoAppShell.getGeckoInterface().getActivity(); final LoaderManager lm = fa.getSupportLoaderManager(); // Finally, Video pickers and some file pickers may return a content provider. Cursor cursor = null; try { // Try a query to make sure the expected columns exist final ContentResolver cr = fa.getContentResolver(); cursor = cr.query(uri, new String[] { MediaStore.Video.Media.DATA }, null, null, null); int index = cursor.getColumnIndex(MediaStore.Video.Media.DATA); if (index >= 0) { lm.initLoader(intent.hashCode(), null, new VideoLoaderCallbacks(uri)); return; } } catch (Exception ex) { // We'll try a different loader below } finally { if (cursor != null) { cursor.close(); } } lm.initLoader(uri.hashCode(), null, new FileLoaderCallbacks(uri, cacheDir, tabId)); }
From source file:com.wit.android.support.database.LoadableAssistant.java
/** * Wrapped {@link android.support.v4.app.LoaderManager#destroyLoader(int)} called with the current * loader id./*w ww . ja v a 2 s . co m*/ */ public boolean destroyLoader(@NonNull FragmentActivity activity) { if (mLoaderId >= 0) { final LoaderManager loaderManager = activity.getSupportLoaderManager(); if (loaderManager != null) { loaderManager.destroyLoader(mLoaderId); } return true; } return false; }
From source file:org.jboss.aerogear.android.impl.pipeline.SupportLoaderAdapter.java
@Deprecated /**//www . ja va2 s . c om * This constructor is reprecated and will be replaced with * SupportLoaderAdapter(FragmentActivity activity, Pipe<T> pipe, String name) */ public SupportLoaderAdapter(FragmentActivity activity, Pipe<T> pipe, Gson gson, String name) { this.pipe = pipe; this.manager = activity.getSupportLoaderManager(); this.applicationContext = activity.getApplicationContext(); this.name = name; this.handler = new Handler(Looper.getMainLooper()); this.activity = activity; this.fragment = null; this.requestBuilder = new GsonRequestBuilder<T>(gson); this.responseParser = new GsonResponseParser<T>(gson); }
From source file:com.wit.android.support.database.LoadableAssistant.java
/** * Wrapped {@link android.support.v4.app.LoaderManager#initLoader(int, android.os.Bundle, android.support.v4.app.LoaderManager.LoaderCallbacks)} * called with the current loader id and this assistant as {@code LoaderManager.LoaderCallbacks}. *//*from w w w. ja v a 2 s . c o m*/ public boolean initLoader(@NonNull FragmentActivity activity, @Nullable Bundle params) { if (mLoaderId >= 0) { final LoaderManager loaderManager = activity.getSupportLoaderManager(); if (loaderManager != null) { loaderManager.initLoader(mLoaderId, params, this); return true; } } return false; }
From source file:com.wit.android.support.database.LoadableAssistant.java
/** * Wrapped {@link android.support.v4.app.LoaderManager#restartLoader(int, android.os.Bundle, android.support.v4.app.LoaderManager.LoaderCallbacks)} * called with the current loader id and this assistant as {@code LoaderManager.LoaderCallbacks}. *///from ww w .j av a2s . com public boolean restartLoader(@NonNull FragmentActivity activity, @Nullable Bundle params) { if (mLoaderId >= 0) { final LoaderManager loaderManager = activity.getSupportLoaderManager(); if (loaderManager != null) { loaderManager.restartLoader(mLoaderId, params, this); return true; } } return false; }
From source file:com.wit.android.support.database.LoadableAssistant.java
/** * Starts a loader using {@link LoaderManager} obtained from the given <var>activity</var> with * the current id and the specified parameters. * <p>//w w w . j a v a 2s .c o m * If the LoaderManager already has a Loader with the id of this assistant, such a loader will be * restarted by {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderManager.LoaderCallbacks)}, * otherwise will be initiated by {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderManager.LoaderCallbacks)}. * <p> * <b>Note</b>, that this assistant must have valid (none negative) loader id, otherwise the * requested loader can not be started. * * @param activity Activity used to access LoaderManager instance. * @param params The desired parameters for loader. * @return {@code True} if loader was successfully started (initiated/restarted), {@code false} * otherwise. */ public boolean startLoader(@NonNull FragmentActivity activity, @Nullable Bundle params) { if (mLoaderId >= 0) { final LoaderManager loaderManager = activity.getSupportLoaderManager(); if (loaderManager != null) { if (loaderManager.getLoader(mLoaderId) != null) { loaderManager.restartLoader(mLoaderId, params, this); } else { loaderManager.initLoader(mLoaderId, params, this); } return true; } } return false; }
From source file:org.jboss.aerogear.android.impl.pipeline.SupportLoaderAdapter.java
public SupportLoaderAdapter(FragmentActivity activity, Pipe<T> pipe, String name) { this.pipe = pipe; this.requestBuilder = pipe.getRequestBuilder(); this.manager = activity.getSupportLoaderManager(); this.applicationContext = activity.getApplicationContext(); this.name = name; this.handler = new Handler(Looper.getMainLooper()); this.activity = activity; this.fragment = null; this.responseParser = pipe.getResponseParser(); }