fix Intent filter issue on Android 6 (https://keepass2android.codeplex.com/workitem/518)
This commit is contained in:
		| @@ -1127,33 +1127,39 @@ namespace keepass2android | |||||||
| 			//started from "view" intent (e.g. from file browser) | 			//started from "view" intent (e.g. from file browser) | ||||||
| 			_ioConnection.Path = i.DataString; | 			_ioConnection.Path = i.DataString; | ||||||
|  |  | ||||||
| 			if (! _ioConnection.Path.Substring(0, 7).Equals("file://")) | 			if (_ioConnection.Path.StartsWith("file://")) | ||||||
| 			{ | 			{ | ||||||
| 				//TODO: this might no longer be required as we can handle http(s) and ftp as well (but we need server credentials therefore) | 				_ioConnection.Path = URLDecoder.Decode(_ioConnection.Path.Substring(7)); | ||||||
| 				Toast.MakeText(this, Resource.String.error_can_not_handle_uri, ToastLength.Long).Show(); |  | ||||||
| 				Finish(); | 				if (_ioConnection.Path.Length == 0) | ||||||
| 				return false; | 				{ | ||||||
| 			} | 					// No file name | ||||||
|  | 					Toast.MakeText(this, Resource.String.FileNotFound, ToastLength.Long).Show(); | ||||||
| 			_ioConnection.Path = URLDecoder.Decode(_ioConnection.Path.Substring(7)); | 					Finish(); | ||||||
|  | 					return false; | ||||||
| 			if (_ioConnection.Path.Length == 0) | 				} | ||||||
| 			{ |  | ||||||
| 				// No file name | 				File dbFile = new File(_ioConnection.Path); | ||||||
| 				Toast.MakeText(this, Resource.String.FileNotFound, ToastLength.Long).Show(); | 				if (!dbFile.Exists()) | ||||||
| 				Finish(); | 				{ | ||||||
| 				return false; | 					// File does not exist | ||||||
| 			} | 					Toast.MakeText(this, Resource.String.FileNotFound, ToastLength.Long).Show(); | ||||||
|  | 					Finish(); | ||||||
| 			File dbFile = new File(_ioConnection.Path); | 					return false; | ||||||
| 			if (! dbFile.Exists()) | 				} | ||||||
| 			{ | 			} | ||||||
| 				// File does not exist | 			else | ||||||
| 				Toast.MakeText(this, Resource.String.FileNotFound, ToastLength.Long).Show(); | 			{ | ||||||
| 				Finish(); | 				if (!_ioConnection.Path.StartsWith("content://")) | ||||||
| 				return false; | 				{ | ||||||
|  | 			 | ||||||
|  | 					Toast.MakeText(this, Resource.String.error_can_not_handle_uri, ToastLength.Long).Show(); | ||||||
|  | 					Finish(); | ||||||
|  | 					return false; | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | 			 | ||||||
| 			_keyFileOrProvider = GetKeyFile(_ioConnection.Path); | 			_keyFileOrProvider = GetKeyFile(_ioConnection.Path); | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -77,6 +77,15 @@ | |||||||
|     </service> |     </service> | ||||||
|   |   | ||||||
| 		<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity"  android:windowSoftInputMode="adjustResize"> | 		<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity"  android:windowSoftInputMode="adjustResize"> | ||||||
|  | 			<intent-filter android:label="@string/app_name"> | ||||||
|  | 				<action android:name="android.intent.action.VIEW" /> | ||||||
|  | 				<category android:name="android.intent.category.DEFAULT" /> | ||||||
|  | 				<category android:name="android.intent.category.BROWSABLE" /> | ||||||
|  | 				<data android:scheme="content" /> | ||||||
|  | 				<data android:mimeType="*/*" /> | ||||||
|  | 				<data android:host="*" /> | ||||||
|  | 			  </intent-filter> | ||||||
|  | 			   | ||||||
| 			<intent-filter android:label="@string/app_name"> | 			<intent-filter android:label="@string/app_name"> | ||||||
| 				<action android:name="android.intent.action.VIEW" /> | 				<action android:name="android.intent.action.VIEW" /> | ||||||
| 				<category android:name="android.intent.category.DEFAULT" /> | 				<category android:name="android.intent.category.DEFAULT" /> | ||||||
|   | |||||||
| @@ -69,7 +69,16 @@ | |||||||
|         </activity> |         </activity> | ||||||
|   |   | ||||||
| 		<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity"  android:windowSoftInputMode="adjustResize"> | 		<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity"  android:windowSoftInputMode="adjustResize"> | ||||||
| 			<intent-filter android:label="@string/app_name"> | 	   		  <intent-filter android:label="@string/app_name"> | ||||||
|  | 				<action android:name="android.intent.action.VIEW" /> | ||||||
|  | 				<category android:name="android.intent.category.DEFAULT" /> | ||||||
|  | 				<category android:name="android.intent.category.BROWSABLE" /> | ||||||
|  | 				<data android:scheme="content" /> | ||||||
|  | 				<data android:mimeType="*/*" /> | ||||||
|  | 				<data android:host="*" /> | ||||||
|  | 			  </intent-filter> | ||||||
|  |  | ||||||
|  | 			  <intent-filter android:label="@string/app_name"> | ||||||
| 				<action android:name="android.intent.action.VIEW" /> | 				<action android:name="android.intent.action.VIEW" /> | ||||||
| 				<category android:name="android.intent.category.DEFAULT" /> | 				<category android:name="android.intent.category.DEFAULT" /> | ||||||
| 				<category android:name="android.intent.category.BROWSABLE" /> | 				<category android:name="android.intent.category.BROWSABLE" /> | ||||||
|   | |||||||
| @@ -47,7 +47,16 @@ | |||||||
|         </activity> |         </activity> | ||||||
|   |   | ||||||
| 		<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity" android:windowSoftInputMode="adjustResize"> | 		<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity" android:windowSoftInputMode="adjustResize"> | ||||||
| 		  <intent-filter android:label="@string/app_name"> | 					<intent-filter android:label="@string/app_name"> | ||||||
|  | 				<action android:name="android.intent.action.VIEW" /> | ||||||
|  | 				<category android:name="android.intent.category.DEFAULT" /> | ||||||
|  | 				<category android:name="android.intent.category.BROWSABLE" /> | ||||||
|  | 				<data android:scheme="content" /> | ||||||
|  | 				<data android:mimeType="*/*" /> | ||||||
|  | 				<data android:host="*" /> | ||||||
|  | 			  </intent-filter> | ||||||
|  |  | ||||||
|  | 			  <intent-filter android:label="@string/app_name"> | ||||||
| 		  <action android:name="android.intent.action.VIEW" /> | 		  <action android:name="android.intent.action.VIEW" /> | ||||||
| 			    <category android:name="android.intent.category.DEFAULT" /> | 			    <category android:name="android.intent.category.DEFAULT" /> | ||||||
| 			    <category android:name="android.intent.category.BROWSABLE" /> | 			    <category android:name="android.intent.category.BROWSABLE" /> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll