Commit ee9f2345 authored by Adrien Oliva's avatar Adrien Oliva

feat(character) Prepare character switch activity

Create layout and activity for character switch and call it on right
action.

GTLAB #4Signed-off-by: Adrien Oliva's avatarAdrien Oliva <olivaa+gitlab@yapbreak.fr>
parent 1f5ee615
Pipeline #479 passed with stage
in 0 seconds
......@@ -31,6 +31,10 @@
<meta-data
android:name="com.google.android.actions"
android:resource="@xml/backup_rules" />
<activity android:name=".CharacterSwitch"
android:label="@string/title_activity_character_switch"
android:theme="@style/AppTheme.NoActionBar" />
</application>
</manifest>
\ No newline at end of file
package fr.yapbreak.skyrimquest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class CharacterSwitch extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_character_switch);
}
}
......@@ -40,7 +40,6 @@ public class QuestList extends AppCompatActivity
protected static Context context;
private DataHelper quest_data;
private Character activeCharacter;
private static final int EXTERNAL_CODE = 570;
......@@ -60,10 +59,10 @@ public class QuestList extends AppCompatActivity
private void updateCharacterInfo()
{
/*******************************************************************************************
/* *****************************************************************************************
Retrieve active character
******************************************************************************************/
activeCharacter = quest_data.getActiveCharacter();
Character activeCharacter = quest_data.getActiveCharacter();
if (activeCharacter != null) {
View header = navigationView.getHeaderView(0);
ImageView navigation_avatar = header.findViewById(R.id.navigation_avatar);
......@@ -116,13 +115,13 @@ public class QuestList extends AppCompatActivity
navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
/**
/*
* Set up navigation view
*/
mainListView = findViewById(R.id.quests_listview);
/*******************************************************************************************
/* *****************************************************************************************
Set up database
******************************************************************************************/
quest_data = new DataHelper(this);
......@@ -170,6 +169,9 @@ public class QuestList extends AppCompatActivity
//noinspection SimplifiableIfStatement
if (id == R.id.action_character_switch) {
Intent i = new Intent(this, CharacterSwitch.class);
startActivity(i);
updateCharacterInfo();
return true;
} else if (id == R.id.action_character_create) {
Intent i = new Intent(this, CharacterCreation.class);
......@@ -234,7 +236,7 @@ public class QuestList extends AppCompatActivity
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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=".CharacterSwitch">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/character_switch_listview"/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
......@@ -60,4 +60,5 @@
<string name="avatar_description">Avatar</string>
<string name="action_debug_grab_database">Copie base de données</string>
<string name="action_debug_grab_database_result">"Base de données disponnible sous "</string>
<string name="title_activity_character_switch">Changement de personnage</string>
</resources>
\ No newline at end of file
......@@ -4,6 +4,9 @@
<string name="navigation_drawer_close" translatable="false">Close navigation drawer</string>
<string name="nav_header_desc" translatable="false">Navigation header</string>
<string name="action_character_switch">Switch</string>
<string name="action_character_create">Create new…</string>
<string name="action_debug_grab_database">Copy database</string>
<string name="action_debug_grab_database_result">Database available at </string>
<!-- Strings from quest fragment -->
<string name="quest_img_alt">Image related to current quest</string>
......@@ -15,11 +18,11 @@
<string name="character_name_label">Name</string>
<string name="level_label">Level</string>
<string name="character_create">Create</string>
<string name="action_character_create">Create new…</string>
<string name="avatar_description">Avatar picture</string>
<string name="plus" translatable="false">+</string>
<string name="minus" translatable="false">-</string>
<string name="action_debug_grab_database">Copy database</string>
<string name="action_debug_grab_database_result">Database available at </string>
<!-- Strings from Character switch activity -->
<string name="title_activity_character_switch">Character Switch</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment