Java Code Examples for android.net.Uri#getLastPathSegment()

The following examples show how to use android.net.Uri#getLastPathSegment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageUtils.java    From Tok-Android with GNU General Public License v3.0 6 votes vote down vote up
private static String getFilePathFromURI(Context context, Uri uri) {
    String data = null;

    if (uri.toString().contains(StorageUtil.ROOT_PROVIDER_NAME)) {
        //如果是自己目录下的,直接拼接路径
        return StorageUtil.getFilesFolder() + uri.getLastPathSegment();
    }
    //this is not useful when the uri is this app
    Cursor cursor = context.getContentResolver()
        .query(uri, new String[] { MediaStore.Images.ImageColumns.DATA }, null, null, null);
    if (null != cursor) {
        if (cursor.moveToFirst()) {
            int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
            if (index > -1) {
                data = cursor.getString(index);
            }
        }
        cursor.close();
    }
    LogUtil.i(TAG, "getFilePathFromURI:" + data);
    return data;
}
 
Example 2
Source File: BaseModelProvider.java    From hr with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
    int count = 0;
    setModel(uri);
    setMatcher(uri);
    int match = matcher.match(uri);
    switch (match) {
        case COLLECTION:
            SQLiteDatabase db = mModel.getWritableDatabase();
            count = db.delete(mModel.getTableName(), selection, selectionArgs);
            break;
        case SINGLE_ROW:
            db = mModel.getWritableDatabase();
            String row_id = uri.getLastPathSegment();
            count = db.delete(mModel.getTableName(), OColumn.ROW_ID + "  = ?", new String[]{row_id});
            break;
        case UriMatcher.NO_MATCH:
            break;
        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
    notifyDataChange(uri);
    return count;
}
 
Example 3
Source File: MainActivity.java    From Fergulator-Android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void loadRom(Uri uri) {
    Timber.d("Loading ROM: %s", uri);

    String name = uri.getLastPathSegment();

    if (name != null && name.endsWith(".zip")) {
        Timber.d("ZIP File: TODO");
    }

    InputStream is = null;
    try {
        is = getContentResolver().openInputStream(uri);
        mGameView.loadGame(is, name);
        toggleActionBar();
    } catch (IOException e) {
        Toast.makeText(this, "Invalid NES rom!", Toast.LENGTH_SHORT).show();
        Timber.w(e, "Invalid NES rom!");
        mRecentPrefs.edit().remove(name).apply();
        romAdapter.remove(name);
        getActionBar().setSelectedNavigationItem(0);
    } finally {
        closeSilently(is);
    }
}
 
Example 4
Source File: CatnutProvider.java    From catnut with MIT License 6 votes vote down vote up
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
	int count = 1; // 随便填的
	SQLiteDatabase db;
	switch (matcher.match(uri)) {
		case USERS:
		case STATUSES:
			db = mDb.getWritableDatabase();
			db.execSQL(selection);
			break;
		// plugins...starting
		case ZHIHU:
			selection = Zhihu.ANSWER_ID + "=" + uri.getLastPathSegment();
			count = mDb.getWritableDatabase().update(Zhihu.TABLE, values, selection, selectionArgs);
			break;
		// plugins...ending
		default:
			throw new UnsupportedOperationException("not supported for now!");
	}
	getContext().getContentResolver().notifyChange(uri, null, false);
	return count;
}
 
Example 5
Source File: CheckoutRequest.java    From braintree_android with MIT License 5 votes vote down vote up
@Override
public Result parseBrowserResponse(Uri uri) {
    String status = uri.getLastPathSegment();

    if (!Uri.parse(getSuccessUrl()).getLastPathSegment().equals(status)) {
        // return cancel result
        return new Result();
    }

    String requestXoToken = Uri.parse(mApprovalUrl).getQueryParameter(mTokenQueryParamKey);
    String responseXoToken = uri.getQueryParameter(mTokenQueryParamKey);
    if (responseXoToken != null && TextUtils.equals(requestXoToken, responseXoToken)) {
        try {
            JSONObject response = new JSONObject();
            response.put("webURL", uri.toString());
            return new Result(
                    null /*don't know the environment here*/,
                    ResponseType.web,
                    response,
                    null /* email not sent back in checkout requests since Hermes doesn't return that info*/);
        } catch (JSONException e) {
            return new Result(new ResponseParsingException(e));
        }
    } else {
        return new Result(
                new BrowserSwitchException("The response contained inconsistent data."));
    }
}
 
Example 6
Source File: RecipeContentProvider.java    From search-samples with Apache License 2.0 5 votes vote down vote up
public int updateNoteForRecipe(Uri uri, ContentValues values) {
    String sql = "UPDATE `" + RecipeNoteTable.TABLE + "` SET `" + RecipeNoteTable.TEXT_COLUMN
            + "` = '" + values.get(RecipeNoteTable.TEXT_COLUMN) + "' where `" +
            RecipeNoteTable.RECIPE_ID_COLUMN + "` = '" + uri.getLastPathSegment() + "'";
    database.getWritableDatabase().execSQL(sql);
    return 1;
}
 
Example 7
Source File: MainActivity.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public boolean isAdmin(Uri observer) {
    Log.i(TAG, "isAdmin() " + observer);
    if (Uris.isEmpty(observer))
        return false;
    String uuid = observer.getLastPathSegment();
    String[] admins = this.getResources().getStringArray(R.array.admins);
    boolean admin = false;
    for (String adminUuid : admins)
        if (uuid.compareTo(adminUuid) == 0) {
            admin = true;
            break;
        }
    Log.d(TAG, "...." + admin);
    return admin;
}
 
Example 8
Source File: ContactsServicePlugin.java    From flutter_contacts with MIT License 5 votes vote down vote up
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent intent) {
  if(requestCode == REQUEST_OPEN_EXISTING_CONTACT || requestCode == REQUEST_OPEN_CONTACT_FORM) {
    try {
      Uri ur = intent.getData();
      finishWithResult(getContactByIdentifier(ur.getLastPathSegment()));
    } catch (NullPointerException e) {
      finishWithResult(FORM_OPERATION_CANCELED);
    }
    return true;
  }

  if (requestCode == REQUEST_OPEN_CONTACT_PICKER) {
    if (resultCode == RESULT_CANCELED) {
      finishWithResult(FORM_OPERATION_CANCELED);
      return true;
    }
    Uri contactUri = intent.getData();
    Cursor cursor = contentResolver.query(contactUri, null, null, null, null);
    if (cursor.moveToFirst()) {
      String id = contactUri.getLastPathSegment();
      getContacts("openDeviceContactPicker", id, false, false, false, this.result);
    } else {
      Log.e(LOG_TAG, "onActivityResult - cursor.moveToFirst() returns false");
      finishWithResult(FORM_OPERATION_CANCELED);
    }
    cursor.close();
    return true;
  }

  finishWithResult(FORM_COULD_NOT_BE_OPEN);
  return false;
}
 
Example 9
Source File: CPOrmContentProvider.java    From CPOrm with MIT License 5 votes vote down vote up
@Override
public int update(@NonNull Uri uri, ContentValues contentValues, String where, String[] args) {

    TableDetails tableDetails = uriMatcherHelper.getTableDetails(uri);
    SQLiteDatabase db = database.getWritableDatabase();

    if (debugEnabled) {
        CPOrmLog.d("********* Update **********");
        CPOrmLog.d("Uri: " + uri);
        CPOrmLog.d("Content Values: " + contentValues);
        CPOrmLog.d("Where: " + where);
        CPOrmLog.d("Args: " + Arrays.toString(args));
    }

    int updateCount;

    if (uriMatcherHelper.isSingleItemRequested(uri)) {

        String itemId = uri.getLastPathSegment();
        TableDetails.ColumnDetails primaryKeyColumn = tableDetails.findPrimaryKeyColumn();
        updateCount = db.update(tableDetails.getTableName(), contentValues, primaryKeyColumn.getColumnName() + " = ?", new String[]{itemId});
    } else updateCount = db.update(tableDetails.getTableName(), contentValues, where, args);

    if (updateCount > 0 && shouldChangesBeNotified(tableDetails, contentValues)) {
        Uri updateUri = uri.buildUpon().appendQueryParameter(PARAMETER_CHANGE_TYPE, CPOrm.ChangeType.UPDATE.toString()).build();
        if(!isBatchOperation()) notifyChanges(updateUri, tableDetails);
        else changedUri.get().add(updateUri);
    }

    return updateCount;
}
 
Example 10
Source File: ApkCache.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get the full path for where an package URL will be downloaded into.
 */
public static SanitizedFile getApkDownloadPath(Context context, Uri uri) {
    File dir = new File(getApkCacheDir(context), uri.getHost() + "-" + uri.getPort());
    if (!dir.exists()) {
        dir.mkdirs();
    }
    return new SanitizedFile(dir, uri.getLastPathSegment());
}
 
Example 11
Source File: RecipeContentProvider.java    From app-indexing with Apache License 2.0 5 votes vote down vote up
public Uri insertNoteForRecipe(Uri uri, ContentValues values) {
    String sql = "INSERT INTO `" + RecipeNoteTable.TABLE + "` (`" + RecipeNoteTable
            .RECIPE_ID_COLUMN + "`, `" + RecipeNoteTable.TEXT_COLUMN + "`) VALUES ('" + uri
            .getLastPathSegment() + "', '" + values.get(RecipeNoteTable.TEXT_COLUMN) + "')";
    database.getWritableDatabase().execSQL(sql);
    return uri;
}
 
Example 12
Source File: DictionaryProvider.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
/**
 * Query the provider for dictionary files.
 *
 * This version dispatches the query according to the protocol version found in the
 * ?protocol= query parameter. If absent or not well-formed, it defaults to 1.
 * @see ContentProvider#query(Uri, String[], String, String[], String)
 *
 * @param uri a content uri (see sUriMatcherV{1,2} at the top of this file for format)
 * @param projection ignored. All columns are always returned.
 * @param selection ignored.
 * @param selectionArgs ignored.
 * @param sortOrder ignored. The results are always returned in no particular order.
 * @return a cursor matching the uri, or null if the URI was not recognized.
 */
@Override
public Cursor query(final Uri uri, final String[] projection, final String selection,
        final String[] selectionArgs, final String sortOrder) {
    DebugLogUtils.l("Uri =", uri);
    PrivateLog.log("Query : " + uri);
    final String clientId = getClientId(uri);
    final int match = matchUri(uri);
    switch (match) {
        case DICTIONARY_V1_WHOLE_LIST:
        case DICTIONARY_V2_WHOLE_LIST:
            final Cursor c = MetadataDbHelper.queryDictionaries(getContext(), clientId);
            DebugLogUtils.l("List of dictionaries with count", c.getCount());
            PrivateLog.log("Returned a list of " + c.getCount() + " items");
            return c;
        case DICTIONARY_V2_DICT_INFO:
            // In protocol version 2, we return null if the client is unknown. Otherwise
            // we behave exactly like for protocol 1.
            if (!MetadataDbHelper.isClientKnown(getContext(), clientId)) return null;
            // Fall through
        case DICTIONARY_V1_DICT_INFO:
            final String locale = uri.getLastPathSegment();
            final Collection<WordListInfo> dictFiles =
                    getDictionaryWordListsForLocale(clientId, locale);
            // TODO: pass clientId to the following function
            DictionaryService.updateNowIfNotUpdatedInAVeryLongTime(getContext());
            if (null != dictFiles && dictFiles.size() > 0) {
                PrivateLog.log("Returned " + dictFiles.size() + " files");
                return new ResourcePathCursor(dictFiles);
            }
            PrivateLog.log("No dictionary files for this URL");
            return new ResourcePathCursor(Collections.<WordListInfo>emptyList());
        // V2_METADATA and V2_DATAFILE are not supported for query()
        default:
            return null;
    }
}
 
Example 13
Source File: Uris.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Returns an int value describing the content and type represented by the
 * Uri
 *
 * @param uri The Uri to check.
 * @return a value greater than 0 if the Uri was recognized or the value of
 * 	{@link android.content.UriMatcher#NO_MATCH UriMatcher.NO_MATCH}.
 * @throws IllegalArgumentException if the descriptor can not be determined
 * 	or the UUID provided as a path segment is invalid.
 */
public static int getDescriptor(Uri uri) {
    int result = mMatcher.match((uri != null) ? uri : Uri.EMPTY);
    if (result > -1) {
        if (((result & TYPE_MASK) >> TYPE_SHIFT) == Uris.ITEM_UUID) {
            String uuid = uri.getLastPathSegment();
            if (!UUIDUtil.isValid(uuid))
                throw new IllegalArgumentException("Invalid uuid format");
        }
    }
    return result;
}
 
Example 14
Source File: ProfilePage.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
private void parseIntent() {
    final Intent intent = getIntent();
    final String action = intent.getAction();
    if (action == null) {
        this.userId = intent.getStringExtra(Constants.EXTRA_ID);
        this.user = (User) intent.getParcelableExtra(Constants.EXTRA_DATA);
        if (this.user != null) {
            this.userId = this.user.id;
        }
    } else if (action.equals(Intent.ACTION_VIEW)) {
        final Uri data = intent.getData();
        if (data != null) {
            this.userId = data.getLastPathSegment();
        }
    }
    if ((this.user == null) && (this.userId != null)) {
        this.user = CacheManager.getUser(this, this.userId);
    }

    if (this.user != null) {
        this.userId = this.user.id;
    }

    if (AppContext.getUserId().equals(this.userId)) {
        ActionManager.doMyProfile(this);
        finish();
    }

}
 
Example 15
Source File: ImageViewerActivity.java    From android-imageviewer with Apache License 2.0 4 votes vote down vote up
public void initData() {
        imageLoader = ImageLoader.getInstance();
        imageUrls = new ArrayList<String>();

        Intent intent = getIntent();
        if (intent != null) {
            Bundle bundle = intent.getExtras();
            if (bundle != null) {
                imageUrls = bundle.getStringArrayList(Extra.IMAGES);
                imagePosition = bundle.getInt(Extra.IMAGE_POSITION, 0);
                imageMode = bundle.getInt(Extra.IMAGE_MODE, 0);
                Log.i("The snowdream bundle path of the image is: " + imageUri);
            }

            Uri uri = (Uri) intent.getData();
            if (uri != null) {
                imageUri = uri.getPath();
                fileName = uri.getLastPathSegment();
                getSupportActionBar().setSubtitle(fileName);
                Log.i("The path of the image is: " + imageUri);

                File file = new File(imageUri);

                imageUri = "file://" + imageUri;
                File dir = file.getParentFile();
                if (dir != null) {
                    FileFilter fileFilter = new FileFilter() {
                        @Override
                        public boolean accept(File f) {
                            if (f != null) {
                                String extension = MimeTypeMap.getFileExtensionFromUrl(Uri.encode(f.getAbsolutePath()));
                                if (!TextUtils.isEmpty(extension)) {
                                    String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
                                    if (!TextUtils.isEmpty(mimeType) && mimeType.contains("image")) {
                                        return true;
                                    }
                                }
                            }
                        return false;
                    }
                } ;

                File[] files = dir.listFiles(fileFilter);

                if (files != null && files.length > 0) {
                    int size = files.length;

                    for (int i = 0; i < size; i++) {
                        imageUrls.add("file://" + files[i].getAbsolutePath());
                    }
                    imagePosition = imageUrls.indexOf(imageUri);
                    imageMode = 1;
                    Log.i("Image Position:" + imagePosition);
                }

            } else {
                imageUrls.add("file://" + imageUri);
                imagePosition = 0;
                imageMode = 0;
            }
        }
    }

    else

    {
        Log.w("The intent is null!");
    }

}
 
Example 16
Source File: VideoInfoParserManager.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void doParseVideoInfoTask(VideoCacheInfo info, IVideoInfoCallback callback, HashMap<String, String> headers) {
    try {
        if (info == null) {
            callback.onBaseVideoInfoFailed(new Throwable("Video info is null."));
            return;
        }
        if (!HttpUtils.matchHttpSchema(info.getUrl())) {
            callback.onBaseVideoInfoFailed(new Throwable("Can parse the request resource's schema."));
            return;
        }

        String finalUrl = info.getUrl();
        LogUtils.d("doParseVideoInfoTask finalUrl="+finalUrl);
        //Redirect is enabled, send redirect request to get final location.
        if (mConfig.isRedirect()) {
            finalUrl = HttpUtils.getFinalUrl(mConfig, info.getUrl(), headers);
            if (TextUtils.isEmpty(finalUrl)) {
                callback.onBaseVideoInfoFailed(new Throwable("FinalUrl is null."));
                return;
            }
            callback.onFinalUrl(finalUrl);
        }
        info.setFinalUrl(finalUrl);

        Uri uri = Uri.parse(finalUrl);
        String fileName = uri.getLastPathSegment();
        LogUtils.d("parseVideoInfo  fileName = " + fileName);
        //By suffix name.
        if (fileName != null) {
            fileName = fileName.toLowerCase();
            if (fileName.endsWith(".m3u8")) {
                parseM3U8Info(info, callback, headers);
                return;
            } else if (fileName.endsWith(".mp4")) {
                LogUtils.i("parseVideoInfo MP4_TYPE");
                info.setVideoType(Video.Type.MP4_TYPE);
                callback.onBaseVideoInfoSuccess(info);
                return;
            } else if (fileName.endsWith(".mov")) {
                LogUtils.i("parseVideoInfo QUICKTIME_TYPE");
                info.setVideoType(Video.Type.QUICKTIME_TYPE);
                callback.onBaseVideoInfoSuccess(info);
                return;
            } else if (fileName.endsWith(".webm")) {
                LogUtils.i("parseVideoInfo WEBM_TYPE");
                info.setVideoType(Video.Type.WEBM_TYPE);
                callback.onBaseVideoInfoSuccess(info);
                return;
            } else if (fileName.endsWith(".3gp")) {
                LogUtils.i("parseVideoInfo GP3_TYPE");
                info.setVideoType(Video.Type.GP3_TYPE);
                callback.onBaseVideoInfoSuccess(info);
                return;
            }
        }
        String mimeType = null;

        //Add more video mimeType.
        mimeType = HttpUtils.getMimeType(mConfig, finalUrl, headers);
        LogUtils.i("parseVideoInfo mimeType="+mimeType);
        if (mimeType != null) {
            mimeType = mimeType.toLowerCase();
            if (mimeType.contains(Video.Mime.MIME_TYPE_MP4)) {
                LogUtils.i("parseVideoInfo MP4_TYPE");
                info.setVideoType(Video.Type.MP4_TYPE);
                callback.onBaseVideoInfoSuccess(info);
            } else if (isM3U8Mimetype(mimeType)) {
                parseM3U8Info(info, callback, headers);
            } else if (mimeType.contains(Video.Mime.MIME_TYPE_WEBM)) {
                LogUtils.i("parseVideoInfo QUICKTIME_TYPE");
                info.setVideoType(Video.Type.WEBM_TYPE);
                callback.onBaseVideoInfoSuccess(info);
            } else if (mimeType.contains(Video.Mime.MIME_TYPE_QUICKTIME)) {
                LogUtils.i("parseVideoInfo WEBM_TYPE");
                info.setVideoType(Video.Type.QUICKTIME_TYPE);
                callback.onBaseVideoInfoSuccess(info);
            } else if (mimeType.contains(Video.Mime.MIME_TYPE_3GP)) {
                LogUtils.i("parseVideoInfo GP3_TYPE");
                info.setVideoType(Video.Type.GP3_TYPE);
                callback.onBaseVideoInfoSuccess(info);
            } else if (mimeType.contains(Video.Mime.MIME_TYPE_MP3)){
                info.setVideoType(Video.Type.MP3_TYPE);
                callback.onBaseVideoInfoSuccess(info);
            } else {
                callback.onBaseVideoInfoFailed(new VideoCacheException(DownloadExceptionUtils.MIMETYPE_NOT_FOUND_STRING));
            }
        } else {
            callback.onBaseVideoInfoFailed(new VideoCacheException(DownloadExceptionUtils.MIMETYPE_NULL_ERROR_STRING));
        }
    } catch (Exception e) {
        callback.onBaseVideoInfoFailed(e);
    }
}
 
Example 17
Source File: MDSInterface2.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static boolean getFile(Context context, Uri file) throws IOException {
    String path = "media/" + file.getLastPathSegment();
    return getFile(context, path, new File(file.getPath()));
}
 
Example 18
Source File: RecipeContentProvider.java    From search-samples with Apache License 2.0 4 votes vote down vote up
public int deleteNoteForRecipe(Uri uri) {
    String sql = "DELETE FROM `" + RecipeNoteTable.TABLE + "` WHERE `" + RecipeNoteTable
            .RECIPE_ID_COLUMN + "` = '" + uri.getLastPathSegment() + "'";
    database.getWritableDatabase().execSQL(sql);
    return 1;
}
 
Example 19
Source File: DownloadFileActivity.java    From imsdk-android with MIT License 4 votes vote down vote up
@Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.atom_ui_activity_download_file);
        bindViews();
        IMMessage message = (IMMessage) getIntent().getSerializableExtra("file_message");
        jsonObject = null;
        //加密消息 先解密
        if (message.getMsgType() == ProtoMessageOuterClass.MessageType.MessageTypeEncrypt_VALUE) {
            EncryptMsg encryptMsg = ChatTextHelper.getEncryptMessageBody(message);
            if (encryptMsg != null)
                jsonObject = JsonUtils.getGson().fromJson(encryptMsg.Content, TransitFileJSON.class);
        } else {
            jsonObject = JsonUtils.getGson().fromJson(message.getBody(), TransitFileJSON.class);
            if(jsonObject == null || TextUtils.isEmpty(jsonObject.HttpUrl)){
                jsonObject = JsonUtils.getGson().fromJson(message.getExt(), TransitFileJSON.class);
            }
        }
        url = QtalkStringUtils.addFilePathDomain(jsonObject.HttpUrl, true);
        StringBuilder urlbuilder = new StringBuilder(url);
        Protocol.addBasicParamsOnHead(urlbuilder);
        url = urlbuilder.toString();

        fileName = jsonObject.FileName;
        fileSize = jsonObject.FileSize;
        localFile = jsonObject.LocalFile;

        tvFileName.setText(getText(R.string.atom_ui_tip_filename) + ": " + fileName);

        Uri uri = Uri.parse(url);

        if (TextUtils.isEmpty(fileName)) {//json没有的filename从url里面获取
            String temp = uri.getQueryParameter("name");
            if (TextUtils.isEmpty(temp)) {//url 没有默认一个.temp后缀的文件
                fileName = System.currentTimeMillis() + ".temp";
            } else {
                fileName = temp;
            }
        }
//        fileMd5Path="";
        if (TextUtils.isEmpty(jsonObject.FILEMD5)) {
            if (!jsonObject.noMD5) {
                fileMd5Path = uri.getLastPathSegment();
                if (fileMd5Path != null && fileMd5Path.lastIndexOf(".") != -1) {//含后缀的md5需要截取
                    fileMd5Path = fileMd5Path.substring(0, fileMd5Path.lastIndexOf("."));
                }
            }

        } else {
            fileMd5Path = jsonObject.FILEMD5;
        }

         if (!TextUtils.isEmpty(fileMd5Path)) {
            fileName = fileMd5Path + File.separator + fileName;
        }
//        }

        mHandler = new FileDownloadHandler(new WeakReference<DownloadFileActivity>(this));
        initViews();
    }
 
Example 20
Source File: Storage.java    From OTTLivePlayer_vlc with MIT License 4 votes vote down vote up
public Storage(Uri uri){
    this.uri = uri;
    mTitle = uri.getLastPathSegment();
}