-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from kirikirisu/add-gettingStartScreenTemplate
簡単入門画面の作成
- Loading branch information
Showing
18 changed files
with
402 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
app/src/main/java/com/example/kanazawaapp_2019/GettingStartMainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
startActivity(finalyIntent) | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/example/kanazawaapp_2019/HowToAddFoodActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/example/kanazawaapp_2019/HowToLookFirstScreenActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/example/kanazawaapp_2019/HowToLookListActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/example/kanazawaapp_2019/HowToLookShelterActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/example/kanazawaapp_2019/HowToNotificationSettingsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
24
app/src/main/res/layout/activity_how_to_look_first_screen.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.