List of usage examples for android.net Uri decode
public static String decode(String s)
From source file:org.videolan.vlc.MediaDatabase.java
public synchronized ArrayList<MediaWrapper> getAllNetworkFav() { ArrayList<MediaWrapper> favs = new ArrayList<MediaWrapper>(); MediaWrapper mw;/*from ww w.j av a2 s. co m*/ Cursor cursor = mDb.query(NETWORK_FAV_TABLE_NAME, new String[] { NETWORK_FAV_URI, NETWORK_FAV_TITLE }, null, null, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { mw = new MediaWrapper(Uri.parse(cursor.getString(0))); mw.setTitle(Uri.decode(cursor.getString(1))); mw.setType(MediaWrapper.TYPE_DIR); favs.add(mw); } cursor.close(); } return favs; }
From source file:com.lgallardo.youtorrentcontroller.RefreshListener.java
private void addTorrentByIntent(Intent intent) { String urlTorrent = intent.getDataString(); if (urlTorrent != null && urlTorrent.length() != 0) { if (urlTorrent.substring(0, 7).equals("content")) { urlTorrent = "file://" + getFilePathFromUri(this, Uri.parse(urlTorrent)); }//w w w.ja v a 2 s. c o m if (urlTorrent.substring(0, 4).equals("file")) { // File addTorrentFile(Uri.parse(urlTorrent).getPath()); } else { try { addTorrent(Uri.decode(URLEncoder.encode(urlTorrent, "UTF-8"))); } catch (UnsupportedEncodingException e) { Log.e("Debug", "Check URL: " + e.toString()); } } } try { if (intent.getStringExtra("from").equals("NotifierService")) { // drawerList.setItemChecked(2, true); // setTitle(navigationDrawerItemTitles[2]); mRecyclerView.findViewHolderForAdapterPosition(3).itemView.performClick(); refresh("completed"); } } catch (NullPointerException npe) { } }
From source file:dk.nota.lyt.libvlc.PlaybackService.java
public synchronized void loadLastPlaylist(int type) { boolean audio = type == TYPE_AUDIO; String currentMedia = mSettings.getString(audio ? "current_song" : "current_media", ""); if (currentMedia.equals("")) return;// w w w .j a v a 2 s . c om String[] locations = mSettings.getString(audio ? "audio_list" : "media_list", "").split(" "); if (locations.length == 0) return; List<String> mediaPathList = new ArrayList<String>(locations.length); for (int i = 0; i < locations.length; ++i) mediaPathList.add(Uri.decode(locations[i])); mShuffling = mSettings.getBoolean(audio ? "audio_shuffling" : "media_shuffling", false); mRepeating = mSettings.getInt(audio ? "audio_repeating" : "media_repeating", REPEAT_NONE); int position = mSettings.getInt(audio ? "position_in_audio_list" : "position_in_media_list", Math.max(0, mediaPathList.indexOf(currentMedia))); long time = mSettings.getLong(audio ? "position_in_song" : "position_in_media", -1); mSavedTime = time; // load playlist loadLocations(mediaPathList); if (time > 0) setTime(time); SharedPreferences.Editor editor = mSettings.edit(); editor.putInt(audio ? "position_in_audio_list" : "position_in_media_list", 0); editor.putLong(audio ? "position_in_song" : "position_in_media", 0); editor.apply(); }
From source file:org.videolan.vlc.PlaybackService.java
private synchronized void loadLastPlaylist() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String currentMedia = prefs.getString("current_media", ""); if (currentMedia.equals("")) return;/*ww w . ja va 2 s . c om*/ String[] locations = prefs.getString("media_list", "").split(" "); List<String> mediaPathList = new ArrayList<String>(locations.length); for (int i = 0; i < locations.length; ++i) mediaPathList.add(Uri.decode(locations[i])); mShuffling = prefs.getBoolean("shuffling", false); mRepeating = RepeatType.values()[prefs.getInt("repeating", RepeatType.None.ordinal())]; int position = prefs.getInt("position_in_list", Math.max(0, mediaPathList.indexOf(currentMedia))); long time = prefs.getLong("position_in_song", -1); // load playlist try { mInterface.loadLocations(mediaPathList, position); if (time > 0) mInterface.setTime(time); } catch (RemoteException e) { e.printStackTrace(); } finally { SharedPreferences.Editor editor = prefs.edit(); editor.putInt("position_in_list", 0); editor.putLong("position_in_song", 0); Util.commitPreferences(editor); } }
From source file:io.github.mkjung.ivi.media.MediaDatabase.java
public synchronized ArrayList<MediaWrapper> getAllNetworkFav() { ArrayList<MediaWrapper> favs = new ArrayList<MediaWrapper>(); MediaWrapper mw;/*from www . j a v a 2s .co m*/ Cursor cursor = mDb.query(NETWORK_FAV_TABLE_NAME, new String[] { NETWORK_FAV_URI, NETWORK_FAV_TITLE, NETWORK_FAV_ICON_URL }, null, null, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { mw = new MediaWrapper(Uri.parse(cursor.getString(0))); mw.setDisplayTitle(Uri.decode(cursor.getString(1))); mw.setType(MediaWrapper.TYPE_DIR); String url = cursor.getString(2); if (!TextUtils.isEmpty(url)) mw.setArtworkURL(Uri.decode(url)); favs.add(mw); } cursor.close(); } return favs; }
From source file:io.github.mkjung.ivi.media.MediaDatabase.java
public synchronized ArrayList<String> getSubtitles(String mediaName) { if (TextUtils.isEmpty(mediaName)) return new ArrayList<>(); Cursor cursor = mDb.query(EXTERNAL_SUBTITLES_TABLE_NAME, new String[] { EXTERNAL_SUBTITLES_MEDIA_NAME, EXTERNAL_SUBTITLES_URI }, EXTERNAL_SUBTITLES_MEDIA_NAME + "=?", new String[] { mediaName }, null, null, null); ArrayList<String> list = new ArrayList<>(cursor.getCount()); if (cursor != null) { while (cursor.moveToNext()) { String url = cursor.getString(1); if (!TextUtils.isEmpty(url)) { String fileUrl = Uri.decode(url); if (new File(fileUrl).exists()) list.add(fileUrl);/*from ww w . j av a 2s. c o m*/ else deleteSubtitle(url); } } cursor.close(); } return list; }
From source file:io.github.mkjung.ivi.media.MediaDatabase.java
public synchronized ArrayList<Media.Slave> getSlaves(String mrl) { Cursor cursor = mDb.query(SLAVES_TABLE_NAME, new String[] { SLAVES_MEDIA_PATH, SLAVES_TYPE, SLAVES_PRIORITY, SLAVES_URI }, SLAVES_MEDIA_PATH + "=?", new String[] { mrl }, null, null, null); ArrayList<Media.Slave> list = new ArrayList<>(cursor.getCount()); if (cursor != null) { while (cursor.moveToNext()) { String uri = cursor.getString(3); if (!TextUtils.isEmpty(uri)) { uri = Uri.decode(uri); list.add(new Media.Slave(cursor.getInt(1), cursor.getInt(2), uri)); }/* w ww . j a v a 2s .c om*/ } cursor.close(); } return list; }
From source file:com.lgallardo.qbittorrentclient.RefreshListener.java
private void handleUrlTorrent() { // permission was granted, yay! Do the // contacts-related task you need to do. // if there is not a path to the file, open de file picker if (urlTorrent == null) { openFilePicker();//from w w w . j av a 2s . co m } else { try { if (urlTorrent.substring(0, 7).equals("content")) { urlTorrent = "file://" + getFilePathFromUri(this, Uri.parse(urlTorrent)); } if (urlTorrent.substring(0, 4).equals("file")) { // File addTorrentFile(Uri.parse(urlTorrent).getPath()); } else { urlTorrent = Uri.decode(URLEncoder.encode(urlTorrent, "UTF-8")); // If It is a valid torrent or magnet link if (urlTorrent.contains(".torrent") || urlTorrent.contains("magnet:")) { // Log.d("Debug", "URL: " + urlTorrent); addTorrent(urlTorrent); } else { // Open not valid torrent or magnet link in browser Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlTorrent)); startActivity(browserIntent); } } } catch (UnsupportedEncodingException e) { Log.e("Debug", "Check URL: " + e.toString()); } catch (NullPointerException e) { Log.e("Debug", "urlTorrent is null: " + e.toString()); } catch (IOException e) { e.printStackTrace(); } } }
From source file:com.owncloud.android.authentication.AuthenticatorActivity.java
private String getUserNameForSamlSso() { if (mAuthToken != null) { String[] cookies = mAuthToken.split(";"); for (int i = 0; i < cookies.length; i++) { if (cookies[i].startsWith(KEY_OC_USERNAME_EQUALS)) { String value = Uri.decode(cookies[i].substring(KEY_OC_USERNAME_EQUALS.length())); return value; }//from www.jav a2 s . co m } } return ""; }