Example usage for android.content Intent getDataString

List of usage examples for android.content Intent getDataString

Introduction

In this page you can find the example usage for android.content Intent getDataString.

Prototype

public @Nullable String getDataString() 

Source Link

Document

The same as #getData() , but returns the URI as an encoded String.

Usage

From source file:com.amytech.android.library.views.imagechooser.api.MediaChooserManager.java

@SuppressLint("NewApi")
private void processImageFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);/*from w w w  .j av a2  s.  com*/
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            MediaProcessorThread thread = null;

            if (!wasVideoSelected(data)) {
                thread = new ImageProcessorThread(path, foldername, shouldCreateThumbnails);
                ((ImageProcessorThread) thread).setListener(this);
            } else {
                thread = new VideoProcessorThread(path, foldername, shouldCreateThumbnails);
                ((VideoProcessorThread) thread).setListener(this);
            }
            thread.setContext(getContext());
            thread.start();
        }
    } else {
        onError("Image Uri was null!");
    }
}

From source file:com.kbeanie.imagechooser.api.MediaChooserManager.java

@SuppressLint("NewApi")
private void processImageFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);/*from   w w w.j  ava  2s  . c o m*/
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            MediaProcessorThread thread;

            if (!wasVideoSelected(data)) {
                thread = new ImageProcessorThread(path, foldername, shouldCreateThumbnails);
                ((ImageProcessorThread) thread).setListener(this);
            } else {
                thread = new VideoProcessorThread(path, foldername, shouldCreateThumbnails);
                ((VideoProcessorThread) thread).setListener(this);
            }
            thread.setContext(getContext());
            thread.start();
        }
    } else {
        onError("Image Uri was null!");
    }
}

From source file:com.amytech.android.library.views.imagechooser.api.VideoChooserManager.java

@SuppressLint("NewApi")
private void processVideoFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);/* w ww  . jav a  2  s.  co  m*/
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            VideoProcessorThread thread = new VideoProcessorThread(path, foldername, shouldCreateThumbnails);
            thread.setListener(this);
            thread.setContext(getContext());
            thread.start();
        }
    }
}

From source file:com.cars.manager.utils.imageChooser.api.VideoChooserManager.java

@SuppressLint("NewApi")
private void processVideoFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);/*w  w w  .j ava2 s. c  om*/
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (Config.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            VideoProcessorThread thread = new VideoProcessorThread(path, foldername, shouldCreateThumbnails);
            thread.setListener(this);
            if (activity != null) {
                thread.setContext(activity.getApplicationContext());
            } else if (fragment != null) {
                thread.setContext(fragment.getActivity().getApplicationContext());
            } else if (appFragment != null) {
                thread.setContext(appFragment.getActivity().getApplicationContext());
            }
            thread.start();
        }
    }
}

From source file:com.snail.imagechooser.api.MediaChooserManager.java

@SuppressLint("NewApi")
private void processImageFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);//from  w  w w.  j  a  v  a  2  s  .  c om
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (Config.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            MediaProcessorThread thread = null;

            if (!wasVideoSelected(data)) {
                thread = new ImageProcessorThread(path, foldername, shouldCreateThumbnails);
                ((ImageProcessorThread) thread).setListener(this);
            } else {
                thread = new VideoProcessorThread(path, foldername, shouldCreateThumbnails);
                ((VideoProcessorThread) thread).setListener(this);
            }

            if (activity != null) {
                thread.setContext(activity.getApplicationContext());
            } else if (fragment != null) {
                thread.setContext(fragment.getActivity().getApplicationContext());
            } else if (appFragment != null) {
                thread.setContext(appFragment.getActivity().getApplicationContext());
            }
            thread.start();
        }
    } else {
        onError("Image Uri was null!");
    }
}

From source file:com.cars.manager.utils.imageChooser.api.ImageChooserManager.java

@SuppressLint("NewApi")
private void processImageFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);/*from  w  w w  .  ja v a2 s.c o m*/
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (Config.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            ImageProcessorThread thread = new ImageProcessorThread(path, foldername, shouldCreateThumbnails);
            thread.setListener(this);
            if (activity != null) {
                thread.setContext(activity.getApplicationContext());
            } else if (fragment != null) {
                thread.setContext(fragment.getActivity().getApplicationContext());
            } else if (appFragment != null) {
                thread.setContext(appFragment.getActivity().getApplicationContext());
            }
            thread.start();
        }
    } else {
        onError("Image Uri was null!");
    }

}

From source file:io.ionic.links.IonicDeeplink.java

public void handleIntent(Intent intent) {
    final String intentString = intent.getDataString();

    // read intent
    String action = intent.getAction();
    Uri url = intent.getData();//  w w  w  .ja v a 2s .  c  om
    JSONObject bundleData = this._bundleToJson(intent.getExtras());
    Log.d(TAG, "Got a new intent: " + intentString + " " + intent.getScheme() + " " + action + " " + url);

    // if app was not launched by the url - ignore
    if (!Intent.ACTION_VIEW.equals(action) || url == null) {
        return;
    }

    // store message and try to consume it
    try {
        lastEvent = new JSONObject();
        lastEvent.put("url", url.toString());
        lastEvent.put("path", url.getPath());
        lastEvent.put("queryString", url.getQuery());
        lastEvent.put("scheme", url.getScheme());
        lastEvent.put("host", url.getHost());
        lastEvent.put("fragment", url.getFragment());
        lastEvent.put("extra", bundleData);
        consumeEvents();
    } catch (JSONException ex) {
        Log.e(TAG, "Unable to process URL scheme deeplink", ex);
    }
}

From source file:io.hypertrack.sendeta.view.SplashScreen.java

private void prepareAppDeepLink() {
    appDeepLink = new AppDeepLink(DeepLinkUtil.DEFAULT);

    Intent intent = getIntent();
    // if started through deep link
    if (intent != null && !TextUtils.isEmpty(intent.getDataString())) {
        Log.d(TAG, "deeplink " + intent.getDataString());
        appDeepLink = DeepLinkUtil.prepareAppDeepLink(SplashScreen.this, intent.getData());
    }//from  ww w .  j  ava2 s.  c  o  m
}

From source file:com.wots.lutmaar.CustomView.imagechooser.api.ImageChooserManager.java

@SuppressLint("NewApi")
private void processImageFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);//w w  w  .  j a va2 s .c  o m
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            ImageProcessorThread thread = new ImageProcessorThread(path, foldername, false);
            thread.setListener(this);
            thread.setContext(getContext());
            thread.start();
        }
    } else {
        onError("Image Uri was null!");
    }
}

From source file:com.amytech.android.library.views.imagechooser.api.ImageChooserManager.java

@SuppressLint("NewApi")
private void processImageFromGallery(Intent data) {
    if (data != null && data.getDataString() != null) {
        String uri = data.getData().toString();
        sanitizeURI(uri);//w ww .j a  v a 2  s. com
        if (filePathOriginal == null || TextUtils.isEmpty(filePathOriginal)) {
            onError("File path was null");
        } else {
            if (BuildConfig.DEBUG) {
                Log.i(TAG, "File: " + filePathOriginal);
            }
            String path = filePathOriginal;
            ImageProcessorThread thread = new ImageProcessorThread(path, foldername, shouldCreateThumbnails);
            thread.setListener(this);
            thread.setContext(getContext());
            thread.start();
        }
    } else {
        onError("Image Uri was null!");
    }
}