mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix: remove HomeSidebarFragment
This commit is contained in:
@@ -45,10 +45,10 @@ class FileTreeAction(context: Context) : EditorActivityAction() {
|
||||
val context = data.getActivity() ?: return false
|
||||
|
||||
context.binding.root.apply {
|
||||
// if (!isDrawerOpen(GravityCompat.END)) {
|
||||
// openDrawer(GravityCompat.END)
|
||||
// return true
|
||||
// }
|
||||
if (!isDrawerOpen(GravityCompat.START)) {
|
||||
openDrawer(GravityCompat.START)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
@@ -31,7 +31,11 @@ import kotlin.reflect.KClass
|
||||
*/
|
||||
class FileTreeSidebarAction(context: Context) : AbstractSidebarAction() {
|
||||
|
||||
override val id: String = "ide.editor.sidebar.projectFiles"
|
||||
companion object {
|
||||
const val ID ="ide.editor.sidebar.projectFiles"
|
||||
}
|
||||
|
||||
override val id: String = ID
|
||||
override val fragmentClass: KClass<out Fragment> = FileTreeFragment::class
|
||||
override val order: Int = 1
|
||||
|
||||
|
||||
@@ -1,47 +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.actions.sidebar
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.itsaky.androidide.R
|
||||
import com.itsaky.androidide.fragments.sidebar.HomeSidebarFragment
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Miscellaneous items shown in the sidebar.
|
||||
*
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
class HomeSidebarAction(context: Context) : AbstractSidebarAction() {
|
||||
|
||||
companion object {
|
||||
|
||||
const val ID = "ide.editor.sidebar.home"
|
||||
}
|
||||
|
||||
override val fragmentClass: KClass<out Fragment> = HomeSidebarFragment::class
|
||||
override val id: String = ID
|
||||
override val order: Int = 0
|
||||
|
||||
init {
|
||||
label = context.getString(R.string.title_home)
|
||||
icon = ContextCompat.getDrawable(context, R.drawable.ic_home)
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,10 @@ import com.itsaky.androidide.viewmodel.EmptyStateFragmentViewModel
|
||||
*
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
abstract class EmptyStateFragment<T : ViewBinding>(layout: Int,
|
||||
bind: (View) -> T) : FragmentWithBinding<T>(layout, bind) {
|
||||
abstract class EmptyStateFragment<T : ViewBinding> : FragmentWithBinding<T> {
|
||||
|
||||
constructor(layout: Int, bind: (View) -> T) : super(layout, bind)
|
||||
constructor(inflate: (LayoutInflater, ViewGroup?, Boolean) -> T) : super(inflate)
|
||||
|
||||
protected var emptyStateBinding: FragmentEmptyStateBinding? = null
|
||||
private set
|
||||
|
||||
@@ -31,8 +31,7 @@ import com.itsaky.androidide.databinding.FragmentRecyclerviewBinding
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
abstract class RecyclerViewFragment<A : RecyclerView.Adapter<*>> :
|
||||
EmptyStateFragment<FragmentRecyclerviewBinding>(R.layout.fragment_recyclerview,
|
||||
FragmentRecyclerviewBinding::bind) {
|
||||
EmptyStateFragment<FragmentRecyclerviewBinding>(FragmentRecyclerviewBinding::inflate) {
|
||||
|
||||
private var unsavedAdapter: A? = null
|
||||
|
||||
|
||||
@@ -1,31 +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.fragments.sidebar
|
||||
|
||||
import com.itsaky.androidide.databinding.FragmentEditorSidebarHomeBinding
|
||||
import com.itsaky.androidide.fragments.FragmentWithBinding
|
||||
|
||||
/**
|
||||
* Container which shows other fragments in the editor activity's sidebar.
|
||||
*
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
class HomeSidebarFragment :
|
||||
FragmentWithBinding<FragmentEditorSidebarHomeBinding>(
|
||||
FragmentEditorSidebarHomeBinding::inflate) {
|
||||
}
|
||||
@@ -39,7 +39,6 @@ import com.itsaky.androidide.actions.SidebarActionItem
|
||||
import com.itsaky.androidide.actions.internal.DefaultActionsRegistry
|
||||
import com.itsaky.androidide.actions.sidebar.CloseProjectSidebarAction
|
||||
import com.itsaky.androidide.actions.sidebar.FileTreeSidebarAction
|
||||
import com.itsaky.androidide.actions.sidebar.HomeSidebarAction
|
||||
import com.itsaky.androidide.actions.sidebar.TerminalSidebarAction
|
||||
import com.itsaky.androidide.fragments.sidebar.EditorSidebarFragment
|
||||
|
||||
@@ -55,7 +54,6 @@ internal object EditorSidebarActions {
|
||||
@JvmStatic
|
||||
fun registerActions(context: Context) {
|
||||
val registry = ActionsRegistry.getInstance()
|
||||
registry.registerAction(HomeSidebarAction(context))
|
||||
registry.registerAction(FileTreeSidebarAction(context))
|
||||
registry.registerAction(TerminalSidebarAction(context))
|
||||
registry.registerAction(CloseProjectSidebarAction(context))
|
||||
@@ -119,7 +117,7 @@ internal object EditorSidebarActions {
|
||||
|
||||
registry.fillMenu(params)
|
||||
|
||||
controller.graph = controller.createGraph(startDestination = HomeSidebarAction.ID) {
|
||||
controller.graph = controller.createGraph(startDestination = FileTreeSidebarAction.ID) {
|
||||
actions.forEach { (actionId, action) ->
|
||||
if (action !is SidebarActionItem) {
|
||||
throw IllegalStateException(
|
||||
@@ -146,7 +144,7 @@ internal object EditorSidebarActions {
|
||||
rail.setupWithNavController(controller)
|
||||
|
||||
// make sure the 'Home' item is checked by default
|
||||
rail.menu.findItem(HomeSidebarAction.ID.hashCode())?.isChecked = true
|
||||
rail.menu.findItem(FileTreeSidebarAction.ID.hashCode())?.isChecked = true
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||
</vector>
|
||||
@@ -594,5 +594,4 @@
|
||||
<string name="msg_codeaction_failed">Failed to perform code action</string>
|
||||
<string name="idepref_devOptions_enableLogsender_title">Enable LogSender</string>
|
||||
<string name="idepref_devOptions_enableLogsender_summary">When disabled, logs from applications won\'t be shown in AndroidIDE</string>
|
||||
<string name="title_home">Home</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user