Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7436afa797 | ||
|
215b8cd2ca |
@ -6,7 +6,6 @@
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
|
@ -2,6 +2,9 @@ package com.example.diceroller;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
@ -13,7 +16,7 @@ import java.util.StringTokenizer;
|
||||
* Created by thibaud on 20/04/17.
|
||||
*/
|
||||
|
||||
public class DiceActivity extends Activity implements View.OnClickListener {
|
||||
public class DiceActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private TextView textResult;
|
||||
private int max;
|
||||
@ -41,4 +44,19 @@ public class DiceActivity extends Activity implements View.OnClickListener {
|
||||
int result = rand.nextInt(max) + 1;
|
||||
this.textResult.setText(String.valueOf(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu){
|
||||
getMenuInflater().inflate(R.menu.main_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item){
|
||||
switch (item.getItemId()){
|
||||
case R.id.action_back:
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.example.diceroller;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
@ -33,4 +34,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu){
|
||||
getMenuInflater().inflate(R.menu.main_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
31
app/src/main/res/menu/main_menu.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_back"
|
||||
android:icon="@android:drawable/ic_menu_revert"
|
||||
android:title="@string/back"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_edit"
|
||||
android:title="@string/edit"
|
||||
android:icon="@android:drawable/ic_menu_edit"
|
||||
app:showAsAction="ifRoom"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_add"
|
||||
android:title="@string/add"
|
||||
android:icon="@android:drawable/ic_menu_add"
|
||||
app:showAsAction="ifRoom"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:title="@string/delete"
|
||||
android:icon="@android:drawable/ic_menu_delete"
|
||||
app:showAsAction="never"
|
||||
/>
|
||||
</menu>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 9.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">DiceRoller</string>
|
||||
<string name="_6_sided_dice">Dé à 6 faces</string>
|
||||
<string name="_20_sided_dice">Dé à 20 faces</string>
|
||||
<string name="x_sided_dice">faces</string>
|
||||
<string name="x">X</string>
|
||||
<string name="roll_dice">Lancer le dé !</string>
|
||||
<string name="add">Ajouter</string>
|
||||
<string name="delete">Supprimer</string>
|
||||
<string name="edit">Éditer</string>
|
||||
<string name="back">Retour</string>
|
||||
</resources>
|
@ -1,8 +1,12 @@
|
||||
<resources>
|
||||
<string name="app_name">DiceRoller</string>
|
||||
<string name="app_name" translatable="false">DiceRoller</string>
|
||||
<string name="_6_sided_dice">6-sided dice</string>
|
||||
<string name="_20_sided_dice">20-sided dice</string>
|
||||
<string name="x_sided_dice">sided dice</string>
|
||||
<string name="x">X</string>
|
||||
<string name="roll_dice">Roll dice !</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="add">Add</string>
|
||||
<string name="delete">Delete</string>
|
||||
<string name="back">Back</string>
|
||||
</resources>
|
||||
|