Skip to content

Commit

Permalink
Fix missing class on run kotlin projects
Browse files Browse the repository at this point in the history
Signed-off-by: PranavPurwar <[email protected]>
  • Loading branch information
PranavPurwar committed Sep 8, 2023
1 parent 69086d4 commit ca78068
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
/.idea/sonarlint/
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.

This file was deleted.

Empty file.
Empty file.
Empty file.
13 changes: 0 additions & 13 deletions .idea/sonarlint/issuestore/index.pb

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
13 changes: 0 additions & 13 deletions .idea/sonarlint/securityhotspotstore/index.pb

This file was deleted.

30 changes: 30 additions & 0 deletions app/src/main/kotlin/org/cosmicide/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@
* You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see <https://www.gnu.org/licenses/>.
*/

/*
* This file is part of Cosmic IDE.
* Cosmic IDE is a 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.
* Cosmic IDE 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 Cosmic IDE. If not, see <https://www.gnu.org/licenses/>.
*/

package org.cosmicide

import android.app.Activity
import android.app.Application
import android.app.UiModeManager
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatDelegate
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -124,6 +135,25 @@ class App : Application() {
AppCompatDelegate.setDefaultNightMode(if (theme == UiModeManager.MODE_NIGHT_AUTO) AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM else theme)
}

// iterate through each activity and apply theme
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
override fun onActivityCreated(p0: Activity, p1: Bundle?) {
(p0 as? ComponentActivity)?.enableEdgeToEdge()
}

override fun onActivityStarted(p0: Activity) {}

override fun onActivityResumed(p0: Activity) {}

override fun onActivityPaused(p0: Activity) {}

override fun onActivityStopped(p0: Activity) {}

override fun onActivitySaveInstanceState(p0: Activity, p1: Bundle) {}

override fun onActivityDestroyed(p0: Activity) {}
})

Analytics.setAnalyticsCollectionEnabled(Prefs.analyticsEnabled)
}

Expand Down
9 changes: 7 additions & 2 deletions app/src/main/kotlin/org/cosmicide/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
* You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see <https://www.gnu.org/licenses/>.
*/

/*
* This file is part of Cosmic IDE.
* Cosmic IDE is a 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.
* Cosmic IDE 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 Cosmic IDE. If not, see <https://www.gnu.org/licenses/>.
*/

package org.cosmicide

import android.content.Context
Expand All @@ -27,7 +34,6 @@ import android.os.Bundle
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat
Expand Down Expand Up @@ -98,7 +104,6 @@ class MainActivity : AppCompatActivity() {
}

setContentView(binding.root)
enableEdgeToEdge()

if (ResourceUtil.missingResources().isNotEmpty()) {
supportFragmentManager.commit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
* You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see <https://www.gnu.org/licenses/>.
*/

/*
* This file is part of Cosmic IDE.
* Cosmic IDE is a 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.
* Cosmic IDE 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 Cosmic IDE. If not, see <https://www.gnu.org/licenses/>.
*/

package org.cosmicide.fragment

import android.os.Bundle
Expand Down Expand Up @@ -127,7 +134,7 @@ class ProjectOutputFragment : BaseBindingFragment<FragmentCompileInfoBinding>()
System.setErr(systemOut)
System.setIn(EditorInputStream(binding.infoEditor))

val loader = MultipleDexClassLoader()
val loader = MultipleDexClassLoader(classLoader = javaClass.classLoader)

loader.loadDex(project.binDir.resolve("classes.dex").apply { setReadOnly() })

Expand Down

0 comments on commit ca78068

Please sign in to comment.