diff --git a/app/build.gradle b/app/build.gradle
index 0617e11c73..095a7d7e05 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
- versionCode 1197
- versionName "0.11.97"
+ versionCode 1198
+ versionName "0.11.98"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 08d97efe91..4cc8754640 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -30,7 +30,7 @@
-
+
openIntent(items, TextFileViewerActivity::class.java)
"md" -> openIntent(items, MarkdownViewerActivity::class.java)
"csv" -> openIntent(items, CSVViewerActivity::class.java)
- "apk" -> installApk(items)
+// "apk" -> installApk(items)
else -> Toast.makeText(
activity, getString(R.string.this_file_type_is_currently_unsupported), Toast.LENGTH_LONG
).show()
}
}
- @RequiresApi(Build.VERSION_CODES.O)
- private fun installApk(items: RealmMyLibrary) {
- currentLibrary = items
- val directory = File(MainApplication.context.getExternalFilesDir(null).toString() + "/ole" + "/" + items.id)
- if (!directory.exists()) {
- if (!directory.mkdirs()) {
- throw RuntimeException("Failed to create directory: " + directory.absolutePath)
- }
- }
-
- val apkFile = File(directory, items.resourceLocalAddress)
- if (!apkFile.exists()) {
- Utilities.toast(activity,"APK file not found")
- return
- }
-
- val uri = FileProvider.getUriForFile(
- MainApplication.context, "${MainApplication.context.packageName}.fileprovider",
- apkFile
- )
-
- val intent = Intent(Intent.ACTION_INSTALL_PACKAGE)
- intent.data = uri
- intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK
-
- if (intent.resolveActivity(requireActivity().packageManager) != null) {
- if (hasInstallPermission(MainApplication.context)) {
- startActivity(intent)
- } else {
- requestInstallPermission()
- }
- } else {
- Utilities.toast(activity,"No app to handle the installation")
- }
- }
+// @RequiresApi(Build.VERSION_CODES.O)
+// private fun installApk(items: RealmMyLibrary) {
+// currentLibrary = items
+// val directory = File(MainApplication.context.getExternalFilesDir(null).toString() + "/ole" + "/" + items.id)
+// if (!directory.exists()) {
+// if (!directory.mkdirs()) {
+// throw RuntimeException("Failed to create directory: " + directory.absolutePath)
+// }
+// }
+//
+// val apkFile = File(directory, items.resourceLocalAddress)
+// if (!apkFile.exists()) {
+// Utilities.toast(activity,"APK file not found")
+// return
+// }
+//
+// val uri = FileProvider.getUriForFile(
+// MainApplication.context, "${MainApplication.context.packageName}.fileprovider",
+// apkFile
+// )
+//
+// val intent = Intent(Intent.ACTION_INSTALL_PACKAGE)
+// intent.data = uri
+// intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK
+//
+// if (intent.resolveActivity(requireActivity().packageManager) != null) {
+// if (hasInstallPermission(MainApplication.context)) {
+// startActivity(intent)
+// } else {
+// requestInstallPermission()
+// }
+// } else {
+// Utilities.toast(activity,"No app to handle the installation")
+// }
+// }
- @RequiresApi(Build.VERSION_CODES.O)
- private fun requestInstallPermission() {
- val intent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES)
- intent.data = Uri.parse("package:" + MainApplication.context.packageName)
- startActivityForResult(intent, INSTALL_UNKNOWN_SOURCES_REQUEST_CODE)
- }
+// @RequiresApi(Build.VERSION_CODES.O)
+// private fun requestInstallPermission() {
+// val intent = Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES)
+// intent.data = Uri.parse("package:" + MainApplication.context.packageName)
+// startActivityForResult(intent, INSTALL_UNKNOWN_SOURCES_REQUEST_CODE)
+// }
fun openFileType(items: RealmMyLibrary, videotype: String) {
val mimetype = Utilities.getMimeType(items.resourceLocalAddress)
@@ -299,22 +296,22 @@ abstract class BaseContainerFragment : BaseResourceFragment() {
}
}
- @RequiresApi(Build.VERSION_CODES.O)
- override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
- super.onActivityResult(requestCode, resultCode, data)
- if (requestCode == INSTALL_UNKNOWN_SOURCES_REQUEST_CODE) {
- if (resultCode == Activity.RESULT_OK) {
- if (currentLibrary != null) {
- installApk(currentLibrary!!)
- currentLibrary = null
- }
- } else {
- Utilities.toast(requireActivity(), getString(R.string.permissions_denied))
- }
- }
- }
+// @RequiresApi(Build.VERSION_CODES.O)
+// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+// super.onActivityResult(requestCode, resultCode, data)
+// if (requestCode == INSTALL_UNKNOWN_SOURCES_REQUEST_CODE) {
+// if (resultCode == Activity.RESULT_OK) {
+// if (currentLibrary != null) {
+// installApk(currentLibrary!!)
+// currentLibrary = null
+// }
+// } else {
+// Utilities.toast(requireActivity(), getString(R.string.permissions_denied))
+// }
+// }
+// }
- open fun handleBackPressed() {
- requireActivity().onBackPressed()
- }
+// open fun handleBackPressed() {
+// requireActivity().onBackPressed()
+// }
}
diff --git a/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.java b/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.java
index 2d85f3fcfa..d66d72b49e 100644
--- a/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.java
+++ b/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.java
@@ -28,12 +28,12 @@ public boolean checkPermission(String strPermission) {
return result == PackageManager.PERMISSION_GRANTED;
}
- public static boolean hasInstallPermission(android.content.Context context) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- return context.getPackageManager().canRequestPackageInstalls();
- }
- return true;
- }
+// public static boolean hasInstallPermission(android.content.Context context) {
+// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+// return context.getPackageManager().canRequestPackageInstalls();
+// }
+// return true;
+// }
public void checkUsagesPermission() {
if (!getUsagesPermission(this)) {
diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.java b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.java
index 0007691189..6286b2dce1 100644
--- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.java
+++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.java
@@ -35,7 +35,6 @@
import com.mikepenz.materialdrawer.model.interfaces.Nameable;
import org.ole.planet.myplanet.R;
-import org.ole.planet.myplanet.base.BaseContainerFragment;
import org.ole.planet.myplanet.callback.OnHomeItemClickListener;
import org.ole.planet.myplanet.databinding.ActivityDashboardBinding;
import org.ole.planet.myplanet.databinding.CustomTabBinding;
@@ -429,12 +428,12 @@ public void onBackPressed() {
super.onBackPressed();
}
- Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
- if (fragment instanceof BaseContainerFragment) {
- ((BaseContainerFragment) fragment).handleBackPressed();
- } else {
- super.onBackPressed();
- }
+// Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
+// if (fragment instanceof BaseContainerFragment) {
+// ((BaseContainerFragment) fragment).handleBackPressed();
+// } else {
+// super.onBackPressed();
+// }
}
@Override