diff --git a/dependencies.gradle b/dependencies.gradle
index a3a8d0514..f8d8e4243 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -46,6 +46,7 @@ ext {
animated_vectors : 'androidx.vectordrawable:vectordrawable-animated:1.1.0',
multidex : 'androidx.multidex:multidex:2.0.1',
ktx : 'androidx.core:core-ktx:1.9.0',
+ fragment_ktx : 'androidx.fragment:fragment-ktx:1.5.4',
lib_desugaring : 'com.android.tools:desugar_jdk_libs:1.1.6',
splashscreen : 'androidx.core:core-splashscreen:1.0.0'
]
diff --git a/resources/src/main/res/values/strings.xml b/resources/src/main/res/values/strings.xml
index 9cb80a81e..bd868025b 100644
--- a/resources/src/main/res/values/strings.xml
+++ b/resources/src/main/res/values/strings.xml
@@ -487,9 +487,10 @@
Switch
TextureView
ToggleButton
+ WebView
FrameLayout
GridLayout
LinearLayout (H)
- RelativeLayout
LinearLayout (V)
+ RelativeLayout
\ No newline at end of file
diff --git a/uidesigner/build.gradle b/uidesigner/build.gradle
index 95b55a10c..6aa267a71 100644
--- a/uidesigner/build.gradle
+++ b/uidesigner/build.gradle
@@ -38,6 +38,8 @@ android {
dependencies {
implementation androidx.appcompat
+ implementation androidx.ktx
+ implementation androidx.fragment_ktx
implementation google.material
implementation project(path: ':common')
diff --git a/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt
new file mode 100644
index 000000000..4868e48c5
--- /dev/null
+++ b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/fragments/DesignerWorkspaceFragment.kt
@@ -0,0 +1,55 @@
+/*
+ * 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 .
+ */
+
+package com.itsaky.androidide.uidesigner.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.viewModels
+import com.itsaky.androidide.fragments.BaseFragment
+import com.itsaky.androidide.uidesigner.databinding.FragmentDesignerWorkspaceBinding
+import com.itsaky.androidide.uidesigner.viewmodel.WorkspaceViewModel
+
+/**
+ * The fragement that previews the inflated layout.
+ *
+ * @author Akash Yadav
+ */
+class DesignerWorkspaceFragment : BaseFragment() {
+ private var binding: FragmentDesignerWorkspaceBinding? = null
+ private val viewModel by viewModels()
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ this.binding = FragmentDesignerWorkspaceBinding.inflate(inflater, container, false)
+ return this.binding!!.root
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ viewModel.observeCurrentView(viewLifecycleOwner) {
+
+ }
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ this.binding = null
+ }
+}
\ No newline at end of file
diff --git a/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/viewmodel/WorkspaceViewModel.kt b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/viewmodel/WorkspaceViewModel.kt
new file mode 100644
index 000000000..cb02fbadc
--- /dev/null
+++ b/uidesigner/src/main/java/com/itsaky/androidide/uidesigner/viewmodel/WorkspaceViewModel.kt
@@ -0,0 +1,37 @@
+/*
+ * 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 .
+ */
+
+package com.itsaky.androidide.uidesigner.viewmodel
+
+import androidx.lifecycle.LifecycleOwner
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModel
+
+class WorkspaceViewModel : ViewModel() {
+ private val _currentView = MutableLiveData(0)
+
+ var currentView: Int
+ get() = _currentView.value!!
+ set(value) {
+ _currentView.value = value
+ }
+
+ fun observeCurrentView(owner: LifecycleOwner, observer: Observer) {
+ _currentView.observe(owner, observer)
+ }
+}
diff --git a/uidesigner/src/main/res/layout/activity_ui_designer.xml b/uidesigner/src/main/res/layout/activity_ui_designer.xml
index bbf74a049..239e35bbb 100644
--- a/uidesigner/src/main/res/layout/activity_ui_designer.xml
+++ b/uidesigner/src/main/res/layout/activity_ui_designer.xml
@@ -1,5 +1,4 @@
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uidesigner/src/main/res/values/strings.xml b/uidesigner/src/main/res/layout/layout_designer_error.xml
similarity index 66%
rename from uidesigner/src/main/res/values/strings.xml
rename to uidesigner/src/main/res/layout/layout_designer_error.xml
index 68dfa61cd..afbb3ea34 100644
--- a/uidesigner/src/main/res/values/strings.xml
+++ b/uidesigner/src/main/res/layout/layout_designer_error.xml
@@ -15,6 +15,10 @@
~ along with AndroidIDE. If not, see .
-->
-
- WebView
-
\ No newline at end of file
+
\ No newline at end of file