|
1 | 1 | package com.simplemobiletools.keyboard.activities |
2 | 2 |
|
3 | 3 | import android.app.Activity |
| 4 | +import android.content.ActivityNotFoundException |
4 | 5 | import android.content.Intent |
5 | 6 | import android.os.Bundle |
6 | 7 | import android.view.Menu |
7 | 8 | import android.view.MenuItem |
| 9 | +import android.widget.Toast |
8 | 10 | import com.google.gson.Gson |
9 | 11 | import com.google.gson.reflect.TypeToken |
10 | 12 | import com.simplemobiletools.commons.dialogs.FilePickerDialog |
@@ -109,7 +111,14 @@ class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListen |
109 | 111 | type = "text/plain" |
110 | 112 | putExtra(Intent.EXTRA_TITLE, filename) |
111 | 113 | addCategory(Intent.CATEGORY_OPENABLE) |
112 | | - startActivityForResult(this, PICK_EXPORT_CLIPS_INTENT) |
| 114 | + |
| 115 | + try { |
| 116 | + startActivityForResult(this, PICK_EXPORT_CLIPS_INTENT) |
| 117 | + } catch (e: ActivityNotFoundException) { |
| 118 | + toast(R.string.system_service_disabled, Toast.LENGTH_LONG) |
| 119 | + } catch (e: Exception) { |
| 120 | + showErrorToast(e) |
| 121 | + } |
113 | 122 | } |
114 | 123 | } |
115 | 124 | } else { |
@@ -154,7 +163,14 @@ class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListen |
154 | 163 | Intent(Intent.ACTION_GET_CONTENT).apply { |
155 | 164 | addCategory(Intent.CATEGORY_OPENABLE) |
156 | 165 | type = "text/plain" |
157 | | - startActivityForResult(this, PICK_IMPORT_CLIPS_SOURCE_INTENT) |
| 166 | + |
| 167 | + try { |
| 168 | + startActivityForResult(this, PICK_IMPORT_CLIPS_SOURCE_INTENT) |
| 169 | + } catch (e: ActivityNotFoundException) { |
| 170 | + toast(R.string.system_service_disabled, Toast.LENGTH_LONG) |
| 171 | + } catch (e: Exception) { |
| 172 | + showErrorToast(e) |
| 173 | + } |
158 | 174 | } |
159 | 175 | } else { |
160 | 176 | handlePermission(PERMISSION_READ_STORAGE) { |
|
0 commit comments