mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	show file name at ReadTextActivity if available
This commit is contained in:
		| @@ -54,13 +54,32 @@ class ReadTextActivity : SimpleActivity() { | ||||
|         searchPrevBtn = findViewById(R.id.search_previous) | ||||
|         searchNextBtn = findViewById(R.id.search_next) | ||||
|         searchClearBtn = findViewById(R.id.search_clear) | ||||
|         read_text_view.setTextColor(config.textColor) | ||||
|  | ||||
|         if (checkAppSideloading()) { | ||||
|             return | ||||
|         } | ||||
|  | ||||
|         val uri = if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { | ||||
|             Uri.fromFile(File(intent.extras?.get(REAL_FILE_PATH).toString())) | ||||
|         } else { | ||||
|             intent.data | ||||
|         } | ||||
|  | ||||
|         if (uri == null) { | ||||
|             finish() | ||||
|             return | ||||
|         } | ||||
|  | ||||
|         val filename = getFilenameFromUri(uri) | ||||
|         if (filename.isNotEmpty()) { | ||||
|             title = filename | ||||
|         } | ||||
|  | ||||
|         read_text_view.onGlobalLayout { | ||||
|             checkIntent() | ||||
|             ensureBackgroundThread { | ||||
|                 checkIntent(uri) | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         setupSearchButtons() | ||||
| @@ -213,20 +232,7 @@ class ReadTextActivity : SimpleActivity() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun checkIntent() { | ||||
|         read_text_view.setTextColor(config.textColor) | ||||
|         val uri = if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { | ||||
|             Uri.fromFile(File(intent.extras?.get(REAL_FILE_PATH).toString())) | ||||
|         } else { | ||||
|             intent.data | ||||
|         } | ||||
|  | ||||
|         if (uri == null) { | ||||
|             finish() | ||||
|             return | ||||
|         } | ||||
|  | ||||
|         ensureBackgroundThread { | ||||
|     private fun checkIntent(uri: Uri) { | ||||
|         originalText = if (uri.scheme == "file") { | ||||
|             filePath = uri.path!! | ||||
|             val file = File(filePath) | ||||
| @@ -246,11 +252,11 @@ class ReadTextActivity : SimpleActivity() { | ||||
|                 contentResolver.openInputStream(uri)!!.bufferedReader().use { it.readText() } | ||||
|             } catch (e: OutOfMemoryError) { | ||||
|                 showErrorToast(e.toString()) | ||||
|                     return@ensureBackgroundThread | ||||
|                 return | ||||
|             } catch (e: Exception) { | ||||
|                 showErrorToast(e) | ||||
|                 finish() | ||||
|                     return@ensureBackgroundThread | ||||
|                 return | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -263,7 +269,6 @@ class ReadTextActivity : SimpleActivity() { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     } | ||||
|  | ||||
|     private fun setupSearchButtons() { | ||||
|         searchQueryET.onTextChangeListener { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user