Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

簡単入門画面の作成 #40

Merged
merged 11 commits into from
Jan 14, 2020
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@
android:label="@string/appName"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".HowToLookShelterActivity"></activity>
<activity android:name=".HowToNotificationSettingsActivity" />
<activity android:name=".HowToLookFirstScreenActivity" />
<activity android:name=".HowToLookListActivity" />
<activity android:name=".HowToAddFoodActivity" />
<activity
android:name=".SecondDescriptionActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"></activity>
<activity
android:name=".FirstDescriptionActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".GettingStartMainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.example.kanazawaapp_2019

import android.content.Intent
import android.location.LocationManager
import android.os.Bundle
import android.util.Log
import android.widget.ArrayAdapter
import android.widget.ListView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat

class GettingStartMainActivity: AppCompatActivity() {

lateinit var finalyIntent: Intent

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_getting_start_main)

setUpToolbar()

renderList()
}

fun setUpToolbar() {
setSupportActionBar(findViewById(R.id.toolbar))
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
supportActionBar?.let {
it.setDisplayHomeAsUpEnabled(true)
it.setHomeButtonEnabled(true)
} ?: IllegalAccessError("toolbar cannot be null")
}

fun renderList() {
val listView = findViewById(R.id.listView) as ListView
val dataArray = arrayOf("保存食追加の仕方", "リストの見方", "一覧の見方", "通知設定の仕方", "避難所の見方")
val adapter = ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dataArray)
listView.adapter = adapter
listView.setOnItemClickListener { parent, view, position, id ->
// Log.i("debug", position.toString())
when (position) {
0 -> {
Log.i("debug", "保存食追加の仕方")
finalyIntent = Intent(this, HowToAddFoodActivity::class.java)
}
1 -> {
Log.i("debug", "リストの見方")
finalyIntent = Intent(this, HowToLookListActivity::class.java)
}
2 -> {
Log.i("debug", "一覧の見方")
finalyIntent = Intent(this, HowToLookFirstScreenActivity::class.java)
}
3 -> {
finalyIntent = Intent(this, HowToNotificationSettingsActivity::class.java)
}
4 -> {
finalyIntent = Intent(this, HowToLookShelterActivity::class.java)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良さげ

}
startActivity(finalyIntent)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.kanazawaapp_2019

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.core.content.ContextCompat

class HowToAddFoodActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_how_to_add_food)

setUpToolbar()
}

fun setUpToolbar() {
setSupportActionBar(findViewById(R.id.toolbar))
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
supportActionBar?.let {
it.setDisplayHomeAsUpEnabled(true)
it.setHomeButtonEnabled(true)
} ?: IllegalAccessError("toolbar cannot be null")
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when(item!!.itemId) {
android.R.id.home -> {
finish()
}
}

return super.onOptionsItemSelected(item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.kanazawaapp_2019

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.core.content.ContextCompat

class HowToLookFirstScreenActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_how_to_look_first_screen)

setUpToolbar()
}

fun setUpToolbar() {
setSupportActionBar(findViewById(R.id.toolbar))
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
supportActionBar?.let {
it.setDisplayHomeAsUpEnabled(true)
it.setHomeButtonEnabled(true)
} ?: IllegalAccessError("toolbar cannot be null")
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when(item!!.itemId) {
android.R.id.home -> {
finish()
}
}

return super.onOptionsItemSelected(item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.kanazawaapp_2019

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.core.content.ContextCompat

class HowToLookListActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_how_to_look_list)

setUpToolbar()
}

fun setUpToolbar() {
setSupportActionBar(findViewById(R.id.toolbar))
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
supportActionBar?.let {
it.setDisplayHomeAsUpEnabled(true)
it.setHomeButtonEnabled(true)
} ?: IllegalAccessError("toolbar cannot be null")
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when(item!!.itemId) {
android.R.id.home -> {
finish()
}
}

return super.onOptionsItemSelected(item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.kanazawaapp_2019

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.core.content.ContextCompat

class HowToLookShelterActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_how_to_look_shelter)

setUpToolbar()
}

fun setUpToolbar() {
setSupportActionBar(findViewById(R.id.toolbar))
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
supportActionBar?.let {
it.setDisplayHomeAsUpEnabled(true)
it.setHomeButtonEnabled(true)
} ?: IllegalAccessError("toolbar cannot be null")
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when(item!!.itemId) {
android.R.id.home -> {
finish()
}
}

return super.onOptionsItemSelected(item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.example.kanazawaapp_2019

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import androidx.core.content.ContextCompat

class HowToNotificationSettingsActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_how_to_notification_settings)

setUpToolbar()
}

fun setUpToolbar() {
setSupportActionBar(findViewById(R.id.toolbar))
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
supportActionBar?.let {
it.setDisplayHomeAsUpEnabled(true)
it.setHomeButtonEnabled(true)
} ?: IllegalAccessError("toolbar cannot be null")
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when(item!!.itemId) {
android.R.id.home -> {
finish()
}
}

return super.onOptionsItemSelected(item)
}
}
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_getting_start_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fitsSystemWindows="true">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:titleTextColor="@color/colorWhite"
app:title="@string/gettingStartMainHeader"/>

<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>


</LinearLayout>
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_how_to_add_food.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fitsSystemWindows="true">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:titleTextColor="@color/colorWhite"
app:title="@string/howToAddFoodHeader"/>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="保存食追加画面"/>

</LinearLayout>
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_how_to_look_first_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fitsSystemWindows="true">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:titleTextColor="@color/colorWhite"
app:title="@string/howToLookFirstScreenHeader"/>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="一覧の見方画面"/>

</LinearLayout>
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_how_to_look_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fitsSystemWindows="true">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:titleTextColor="@color/colorWhite"
app:title="@string/howToLookListHeader"/>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="リストの見方画面"/>

</LinearLayout>
Loading