1
0
Fork 0

Fixed Snackbars and changed to Light

This commit is contained in:
Carlos Galindo 2015-03-25 14:02:03 +01:00
parent 624766ad33
commit 5cdb4b2932
3 changed files with 20 additions and 36 deletions

View file

@ -98,7 +98,7 @@ public class MainActivity extends ActionBarActivity{
if(player.getMaxPg() <= player.getPg()){ if(player.getMaxPg() <= player.getPg()){
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.maxed_curative) .text(R.string.maxed_curative)
); );
} else { } else {
@ -144,13 +144,7 @@ public class MainActivity extends ActionBarActivity{
// Player.LEVEL_PX[player.getLevel() - 1], // Player.LEVEL_PX[player.getLevel() - 1],
// true, player.getPx() - Player.LEVEL_PX[player.getLevel() - 1] // true, player.getPx() - Player.LEVEL_PX[player.getLevel() - 1]
// ); // );
} catch(Exception e) { } catch(Exception e) {}
SnackbarManager.show(
Snackbar
.with(getApplicationContext())
.text(R.string.message_no_px)
);
}
} }
}); });
alert.show(); alert.show();
@ -160,7 +154,7 @@ public class MainActivity extends ActionBarActivity{
player.rest(true); player.rest(true);
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.long_rest_done) .text(R.string.long_rest_done)
); );
p.edit() p.edit()
@ -173,7 +167,7 @@ public class MainActivity extends ActionBarActivity{
player.rest(false); player.rest(false);
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.rest_done) .text(R.string.rest_done)
); );
pgUpdate(); pgUpdate();
@ -197,14 +191,14 @@ public class MainActivity extends ActionBarActivity{
if (hasCured == Player.NOT_CURED) { if (hasCured == Player.NOT_CURED) {
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.no_curative_efforts_error) .text(R.string.no_curative_efforts_error)
); );
} else { } else {
if(hasCured == Player.MAXED){ if(hasCured == Player.MAXED){
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.maxed_curative) .text(R.string.maxed_curative)
); );
} }
@ -327,11 +321,12 @@ public class MainActivity extends ActionBarActivity{
alert.setNegativeButton(R.string.die, new DialogInterface.OnClickListener() { alert.setNegativeButton(R.string.die, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
SnackbarManager.show( //TODO: fix
Snackbar // SnackbarManager.show(
.with(getApplicationContext()) // Snackbar
.text(R.string.message_death) // .with(this)
); // .text(R.string.message_death)
// );
p.edit().clear().apply(); p.edit().clear().apply();
restoreData(); restoreData();
} }
@ -346,7 +341,7 @@ public class MainActivity extends ActionBarActivity{
if(lastState != Player.SAME) { if(lastState != Player.SAME) {
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.state_changed_debilitado) .text(R.string.state_changed_debilitado)
); );
} }
@ -358,7 +353,7 @@ public class MainActivity extends ActionBarActivity{
if(lastState != Player.SAME) { if(lastState != Player.SAME) {
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(R.string.state_changed_malherido) .text(R.string.state_changed_malherido)
); );
} }
@ -507,7 +502,7 @@ public class MainActivity extends ActionBarActivity{
if (!message.isEmpty()) { if (!message.isEmpty()) {
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
.with(getApplicationContext()) .with(this)
.text(message) .text(message)
); );
} }
@ -530,14 +525,7 @@ public class MainActivity extends ActionBarActivity{
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (input.getText().toString().isEmpty()) { if (!input.getText().toString().isEmpty()) {
SnackbarManager.show(
Snackbar
.with(getApplicationContext())
.text(R.string.empty_field)
);
pgDialog();
} else {
player.setMaxPg(Integer.parseInt(input.getText().toString())); player.setMaxPg(Integer.parseInt(input.getText().toString()));
} }
} }

View file

@ -8,14 +8,15 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
public class Welcome extends ActionBarActivity { public class Welcome extends ActionBarActivity {
private Button load; private Button load;
private SharedPreferences p; private SharedPreferences p;
private TextView newText;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -23,15 +24,12 @@ public class Welcome extends ActionBarActivity {
setContentView(R.layout.activity_welcome); setContentView(R.layout.activity_welcome);
p = getSharedPreferences("basics", MODE_PRIVATE); p = getSharedPreferences("basics", MODE_PRIVATE);
load = (Button) findViewById(R.id.loadCharacter); load = (Button) findViewById(R.id.loadCharacter);
newText = (TextView) findViewById(R.id.newText);
if (p.getBoolean("saved", false)) { if (p.getBoolean("saved", false)) {
load.setEnabled(true); load.setEnabled(true);
load.setText(String.format(getString(R.string.load_text), p.getString("playerName", ""))); load.setText(String.format(getString(R.string.load_text), p.getString("playerName", "")));
newText.setVisibility(View.VISIBLE);
} else { } else {
load.setEnabled(false); load.setEnabled(false);
load.setText(R.string.load_character); load.setText(R.string.load_character);
newText.setVisibility(View.GONE);
} }
} }
@ -71,11 +69,9 @@ public class Welcome extends ActionBarActivity {
if (p.getBoolean("saved", false)) { if (p.getBoolean("saved", false)) {
load.setEnabled(true); load.setEnabled(true);
load.setText(String.format(getString(R.string.load_text), p.getString("playerName", ""))); load.setText(String.format(getString(R.string.load_text), p.getString("playerName", "")));
newText.setVisibility(View.VISIBLE);
} else { } else {
load.setEnabled(false); load.setEnabled(false);
load.setText(R.string.load_character); load.setText(R.string.load_character);
newText.setVisibility(View.GONE);
} }
} }
} }

View file

@ -1,7 +1,7 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat"> <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorPrimary">@color/primary</item> <item name="colorPrimary">@color/primary</item>