Add basic fragment structure

Add the boilerplate fragment code.
This commit is contained in:
OxygenCobalt
2020-08-17 10:32:28 -06:00
parent 675f4af41b
commit 7c447e0296
9 changed files with 121 additions and 17 deletions
@@ -1,12 +1,15 @@
package org.oxycblt.auxio
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Log.d(this::class.simpleName, "Activity Created.")
}
}
}
@@ -0,0 +1,29 @@
package org.oxycblt.auxio.player
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.FragmentPlayerBinding
class PlayerFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val binding = DataBindingUtil.inflate<FragmentPlayerBinding>(
inflater, R.layout.fragment_player, container, false
)
Log.d(this::class.simpleName, "Fragment created.")
return binding.root
}
}
+18 -4
View File
@@ -1,10 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_main"
tools:ignore="FragmentTagUsage" />
</FrameLayout>
</layout>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_main"
app:startDestination="@id/playerFragment">
<fragment
android:id="@+id/playerFragment"
android:name="org.oxycblt.auxio.player.PlayerFragment"
android:label="PlayerFragment" />
</navigation>
+9 -8
View File
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primaryColor">#0d5af5</color>
<color name="primaryLightColor">#6b86ff</color>
<color name="primaryDarkColor">#0032c1</color>
<color name="secondaryColor">#212121</color>
<color name="secondaryLightColor">#484848</color>
<color name="secondaryDarkColor">#000000</color>
<color name="primaryTextColor">#ffffff</color>
<color name="secondaryTextColor">#ffffff</color>
<color name="primaryColor">#0d5af5</color>
<color name="primaryLightColor">#6b86ff</color>
<color name="primaryDarkColor">#0032c1</color>
<color name="secondaryColor">#212121</color>
<color name="secondaryLightColor">#484848</color>
<color name="secondaryDarkColor">#000000</color>
<color name="primaryTextColor">#ffffff</color>
<color name="secondaryTextColor">#ffffff</color>
</resources>
+1
View File
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Auxio</string>
</resources>
+1
View File
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">