mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(actions): remove 'File tree' action from editor activity
This commit is contained in:
@@ -1,59 +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.etc
|
||||
|
||||
import android.content.Context
|
||||
import android.view.MenuItem
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.GravityCompat
|
||||
import com.itsaky.androidide.resources.R
|
||||
import com.itsaky.androidide.actions.ActionData
|
||||
import com.itsaky.androidide.actions.EditorActivityAction
|
||||
import com.itsaky.androidide.preferences.internal.hideFileTreeButton
|
||||
|
||||
/** @author Akash Yadav */
|
||||
class FileTreeAction(context: Context, override val order: Int) : EditorActivityAction() {
|
||||
|
||||
override val id: String = "ide.editor.fileTree.open"
|
||||
|
||||
init {
|
||||
label = context.getString(R.string.msg_file_tree)
|
||||
icon = ContextCompat.getDrawable(context, R.drawable.ic_folder)
|
||||
}
|
||||
|
||||
override suspend fun execAction(data: ActionData): Boolean {
|
||||
val context = data.getActivity() ?: return false
|
||||
|
||||
context.binding.root.apply {
|
||||
if (!isDrawerOpen(GravityCompat.START)) {
|
||||
openDrawer(GravityCompat.START)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getShowAsActionFlags(data: ActionData): Int {
|
||||
return if (hideFileTreeButton) {
|
||||
MenuItem.SHOW_AS_ACTION_NEVER
|
||||
} else {
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import com.itsaky.androidide.actions.editor.LongSelectAction
|
||||
import com.itsaky.androidide.actions.editor.PasteAction
|
||||
import com.itsaky.androidide.actions.editor.SelectAllAction
|
||||
import com.itsaky.androidide.actions.etc.DisconnectLogSendersAction
|
||||
import com.itsaky.androidide.actions.etc.FileTreeAction
|
||||
import com.itsaky.androidide.actions.etc.FindActionMenu
|
||||
import com.itsaky.androidide.actions.etc.LaunchAppAction
|
||||
import com.itsaky.androidide.actions.etc.PreviewLayoutAction
|
||||
@@ -73,7 +72,6 @@ class EditorActivityActions {
|
||||
registry.registerAction(SaveFileAction(context, order++))
|
||||
registry.registerAction(PreviewLayoutAction(context, order++))
|
||||
registry.registerAction(FindActionMenu(context, order++))
|
||||
registry.registerAction(FileTreeAction(context, order++))
|
||||
registry.registerAction(ProjectSyncAction(context, order++))
|
||||
registry.registerAction(ReloadColorSchemesAction(context, order++))
|
||||
registry.registerAction(DisconnectLogSendersAction(context, order++))
|
||||
|
||||
Reference in New Issue
Block a user