mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 15:56:48 +08:00
Removed SplashActivity
This commit is contained in:
@@ -38,19 +38,14 @@ import androidx.annotation.NonNull;
|
||||
import androidx.core.splashscreen.SplashScreen;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.android.aaptcompiler.BlameLogger;
|
||||
import com.android.aaptcompiler.ResourceCompiler;
|
||||
import com.android.aaptcompiler.ResourceCompilerOptions;
|
||||
import com.android.utils.StdLogger;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.itsaky.androidide.app.IDEActivity;
|
||||
import com.itsaky.androidide.app.IDEApplication;
|
||||
import com.itsaky.androidide.databinding.ActivityMainBinding;
|
||||
import com.itsaky.androidide.fragments.MainFragment;
|
||||
import com.itsaky.androidide.projects.ProjectManager;
|
||||
import com.itsaky.androidide.tasks.TaskExecutor;
|
||||
import com.itsaky.androidide.utils.DialogUtils;
|
||||
import com.itsaky.androidide.utils.Environment;
|
||||
import com.itsaky.androidide.utils.StopWatch;
|
||||
import com.itsaky.toaster.Toaster;
|
||||
import com.itsaky.toaster.ToasterKt;
|
||||
|
||||
@@ -62,6 +57,17 @@ public class MainActivity extends IDEActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!IDEApplication.isAbiSupported()) {
|
||||
final MaterialAlertDialogBuilder builder = DialogUtils.newMaterialDialogBuilder(this);
|
||||
builder.setTitle(R.string.title_device_not_supported);
|
||||
builder.setMessage(R.string.msg_device_not_supported);
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(android.R.string.ok, (p1, p2) -> finishAffinity());
|
||||
builder.create().show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!checkToolsIsInstalled()) {
|
||||
showDialogInstallJdkSdk();
|
||||
} else {
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/************************************************************************************
|
||||
* This file is part of AndroidIDE.
|
||||
*
|
||||
*
|
||||
*
|
||||
* AndroidIDE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* AndroidIDE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
package com.itsaky.androidide;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.itsaky.androidide.app.IDEActivity;
|
||||
import com.itsaky.androidide.app.IDEApplication;
|
||||
import com.itsaky.androidide.databinding.ActivitySplashBinding;
|
||||
import com.itsaky.androidide.models.Constants;
|
||||
import com.itsaky.androidide.utils.DialogUtils;
|
||||
|
||||
public class SplashActivity extends IDEActivity {
|
||||
private static final Handler mHandler = new Handler();
|
||||
private final Runnable mRunnable =
|
||||
() -> {
|
||||
Constants.SPLASH_TO_MAIN = true;
|
||||
startActivity(new Intent(SplashActivity.this, MainActivity.class));
|
||||
finish();
|
||||
};
|
||||
private ActivitySplashBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding.splashText.setText(getString(R.string.msg_checking_storage_permissions));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStorageGranted() {
|
||||
super.onStorageGranted();
|
||||
proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStorageAlreadyGranted() {
|
||||
super.onStorageAlreadyGranted();
|
||||
proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View bindLayout() {
|
||||
binding = ActivitySplashBinding.inflate(getLayoutInflater());
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void proceed() {
|
||||
if (!IDEApplication.isAbiSupported()) {
|
||||
final MaterialAlertDialogBuilder builder = DialogUtils.newMaterialDialogBuilder(this);
|
||||
builder.setTitle(R.string.title_device_not_supported);
|
||||
builder.setMessage(R.string.msg_device_not_supported);
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(android.R.string.ok, (p1, p2) -> finishAffinity());
|
||||
builder.create().show();
|
||||
} else {
|
||||
binding.splashText.setText(getString(R.string.msg_storage_granted));
|
||||
mHandler.removeCallbacks(mRunnable);
|
||||
mHandler.postDelayed(mRunnable, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activitysplashImageView1"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:contentDescription="@string/label_splash_image"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/secondaryTextColor" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/splash_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -46,5 +46,4 @@ public class Constants {
|
||||
+ "\n \"PGDN\""
|
||||
+ "\n ]"
|
||||
+ "\n]";
|
||||
public static boolean SPLASH_TO_MAIN = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user