diff options
Diffstat (limited to 'app/src/main/java/xyz/adjutor')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt | 31 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/MainActivity.kt | 40 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/News.kt | 5 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt | 31 |
4 files changed, 107 insertions, 0 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt b/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt new file mode 100644 index 0000000..05e5673 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/FirstFragment.kt @@ -0,0 +1,31 @@ +package xyz.adjutor.aniki + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.navigation.fragment.findNavController + +/** + * A simple [Fragment] subclass as the default destination in the navigation. + */ +class FirstFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_first, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById<Button>(R.id.button_first).setOnClickListener { + findNavController().navigate(R.id.action_FirstFragment_to_SecondFragment) + } + } +}
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt b/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt new file mode 100644 index 0000000..59f9a42 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/MainActivity.kt @@ -0,0 +1,40 @@ +package xyz.adjutor.aniki + +import android.os.Bundle +import com.google.android.material.floatingactionbutton.FloatingActionButton +import com.google.android.material.snackbar.Snackbar +import androidx.appcompat.app.AppCompatActivity +import android.view.Menu +import android.view.MenuItem + +class MainActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + setSupportActionBar(findViewById(R.id.toolbar)) + + findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { view -> + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show() + } + val industryNews = News("Horror Manga Ajin Ends Nine-Year Serialization") + + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + // Inflate the menu; this adds items to the action bar if it is present. + menuInflater.inflate(R.menu.menu_main, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + return when (item.itemId) { + R.id.action_settings -> true + else -> super.onOptionsItemSelected(item) + } + } +}
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/News.kt b/app/src/main/java/xyz/adjutor/aniki/News.kt new file mode 100644 index 0000000..c4e5759 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/News.kt @@ -0,0 +1,5 @@ +package xyz.adjutor.aniki + +data class News ( + val title: String +)
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt b/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt new file mode 100644 index 0000000..a994c61 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/SecondFragment.kt @@ -0,0 +1,31 @@ +package xyz.adjutor.aniki + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.navigation.fragment.findNavController + +/** + * A simple [Fragment] subclass as the second destination in the navigation. + */ +class SecondFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_second, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById<Button>(R.id.button_second).setOnClickListener { + findNavController().navigate(R.id.action_SecondFragment_to_FirstFragment) + } + } +}
\ No newline at end of file |