mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-07 22:47:29 +00:00
Revert FileProvider to Keyman app
Starts to address #2039 Move FileProvider back to Keyman manifest and revert authority. Added Toast notification if 3rd party app doesn't define FileProvider. (info pages fail to properly load)
This commit is contained in:
parent
0e855dbfcf
commit
a36207ed79
6 changed files with 29 additions and 22 deletions
|
|
@ -192,6 +192,16 @@
|
|||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppTheme.Base" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -68,17 +68,6 @@
|
|||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.AppCompat.Light.Dialog" >
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.tavultesoft.kmea.fileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import android.widget.ListAdapter;
|
|||
import android.widget.ListView;
|
||||
import android.widget.SimpleAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tavultesoft.kmea.util.FileUtils;
|
||||
|
||||
|
|
@ -100,10 +101,12 @@ public final class KeyboardInfoActivity extends AppCompatActivity {
|
|||
// Starting with Android N, you can't pass file:// to intents, so we use FileProvider
|
||||
try {
|
||||
Uri contentUri = FileProvider.getUriForFile(
|
||||
context, "com.tavultesoft.kmea.fileProvider", customHelp);
|
||||
context, getApplication().getPackageName() + ".fileProvider", customHelp);
|
||||
i.setDataAndType(contentUri, "text/html");
|
||||
} catch (Exception e) {
|
||||
Log.e("KeyboardInfoActivity", "Failed to access " + customHelp.toString());
|
||||
} catch (NullPointerException e) {
|
||||
String message = "FileProvider undefined in app to load" + customHelp.toString();
|
||||
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
|
||||
Log.e("KeyboardInfoActivity", message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import android.widget.ListAdapter;
|
|||
import android.widget.ListView;
|
||||
import android.widget.SimpleAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tavultesoft.kmea.util.FileUtils;
|
||||
import com.tavultesoft.kmea.util.MapCompat;
|
||||
|
|
@ -143,10 +144,12 @@ public final class KeyboardSettingsActivity extends AppCompatActivity {
|
|||
// Starting with Android N, you can't pass file:// to intents, so we use FileProvider
|
||||
try {
|
||||
Uri contentUri = FileProvider.getUriForFile(
|
||||
context, "com.tavultesoft.kmea.fileProvider", customHelp);
|
||||
context, getApplication().getPackageName() + ".fileProvider", customHelp);
|
||||
i.setDataAndType(contentUri, "text/html");
|
||||
} catch (Exception e) {
|
||||
Log.e("KeyboardInfoActivity", "Failed to access " + customHelp.toString());
|
||||
} catch (NullPointerException e) {
|
||||
String message = "FileProvider undefined in app to load" + customHelp.toString();
|
||||
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
|
||||
Log.e("KeyboardInfoActivity", message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -143,10 +143,12 @@ public final class ModelInfoActivity extends AppCompatActivity {
|
|||
// Starting with Android N, you can't pass file:// to intents, so we use FileProvider
|
||||
try {
|
||||
Uri contentUri = FileProvider.getUriForFile(
|
||||
context, "com.tavultesoft.kmea.fileProvider", customHelp);
|
||||
context, getApplication().getPackageName() + ".fileProvider", customHelp);
|
||||
i.setDataAndType(contentUri, "text/html");
|
||||
} catch (Exception e) {
|
||||
Log.e("ModelInfoActivity", "Failed to access " + customHelp.toString());
|
||||
} catch (NullPointerException e) {
|
||||
String message = "FileProvider undefined in app to load" + customHelp.toString();
|
||||
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
|
||||
Log.e("ModelInfoActivity", message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue