Skip to content

Commit

Permalink
Añadidas las preferencias y tambien los creditos.
Browse files Browse the repository at this point in the history
  • Loading branch information
marsavela committed Oct 10, 2013
1 parent 2c09b29 commit b1df6fe
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions WWTBAM/WWTBAM.iml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,37 @@
<output url="file://$MODULE_DIR$/build/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/apk" />
<excludeFolder url="file://$MODULE_DIR$/build/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/bundles" />
Expand Down
16 changes: 15 additions & 1 deletion WWTBAM/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,27 @@
android:theme="@style/AppTheme" >
<activity
android:name="es.serpat.wwtbam.MainActivity"
android:label="@string/app_name" >
android:label="@string/main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--<activity
android:name=".Game"
android:label="@string/play"
android:screenOrientation="landscape"/>-->
<activity
android:name=".SetPreferences"
android:label="@string/settings"/>
<!--<activity
android:name=".Scores"
android:label="@string/scores"/>-->
<activity
android:name=".Credits"
android:label="@string/about"
android:theme="@android:style/Theme.Holo.Dialog"/>
</application>

</manifest>
15 changes: 15 additions & 0 deletions WWTBAM/src/main/java/es/serpat/wwtbam/Credits.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package es.serpat.wwtbam;

import android.app.Activity;
import android.os.Bundle;

/**
* Created by SergiuDaniel on 10/10/13.
*/
public class Credits extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.credits);
}
}
58 changes: 51 additions & 7 deletions WWTBAM/src/main/java/es/serpat/wwtbam/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,67 @@
package es.serpat.wwtbam;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button bPlay = (Button) findViewById(R.id.butPlay);
bPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchGame(null);
}
});
Button bPreferences = (Button) findViewById(R.id.butSettings);
bPreferences.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchPreferences(null);
}
});
Button bScores = (Button) findViewById(R.id.butScores);
bScores.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
launchScores(null);
}
});
Button bAbout = (Button) findViewById(R.id.butAbout);
bAbout.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View view) {
launchAbout(null);
}
});
}

private void launchScores(View view) {
//Intent i = new Intent(this, Scores.class);
//startActivity(i);
}

private void launchGame(View view) {
//Intent i = new Intent(this, Game.class);
//startActivity(i);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
private void launchPreferences(View view) {
Intent i = new Intent(this, SetPreferences.class);
startActivity(i);
}

public void launchAbout(View view) {
Intent i = new Intent(this, Credits.class);
startActivity(i);
}

}
16 changes: 16 additions & 0 deletions WWTBAM/src/main/java/es/serpat/wwtbam/Preferences.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package es.serpat.wwtbam;

import android.os.Bundle;
import android.preference.PreferenceFragment;

/**
* Created by SergiuDaniel on 10/10/13.
*/
public class Preferences extends PreferenceFragment {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
19 changes: 19 additions & 0 deletions WWTBAM/src/main/java/es/serpat/wwtbam/SetPreferences.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package es.serpat.wwtbam;

import android.app.Activity;
import android.os.Bundle;

/**
* Created by SergiuDaniel on 2/07/13.
*/
public class SetPreferences extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

getFragmentManager().beginTransaction().replace(android.R.id.content,
new Preferences()).commit();
}
}
44 changes: 31 additions & 13 deletions WWTBAM/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="30dp"
android:gravity="center">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
android:text="@string/app_name"
android:id="@+id/titleWWTBAM"
style="@style/textWWTBAM"/>

</RelativeLayout>
<Button
android:text="@string/play"
android:id="@+id/butPlay"
style="@style/button"/>

<Button
android:text="@string/settings"
android:id="@+id/butSettings"
style="@style/button"/>

<Button
android:text="@string/scores"
android:id="@+id/butScores"
style="@style/button"/>

<Button
android:text="@string/about"
android:id="@+id/butAbout"
style="@style/button"/>

</LinearLayout>
14 changes: 14 additions & 0 deletions WWTBAM/src/main/res/layout/credits.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_text"
android:textSize="18sp"
android:layout_margin="30dp"/>
</LinearLayout>
15 changes: 15 additions & 0 deletions WWTBAM/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="numHelps">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="numHelpsValues">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources>
13 changes: 12 additions & 1 deletion WWTBAM/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@

<string name="app_name">WWTBAM</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="play">Play</string>
<string name="settings">Settings</string>
<string name="scores">Scores</string>
<string name="about">Credits</string>
<string name="main">MAIN</string>
<string name="about_text">This app was made for ADM. Sergiu Daniel Marsavela and Patrick Mondria Simoes.</string>
<string name="pref_title_help">Number of helps</string>
<string name="pref_help_summary">Select how many times you can ask for help.</string>
<string name="pref_name_summary">Introduce your name.</string>
<string name="pref_name_title">Name</string>
<string name="pref_addFriend_title">Add friend</string>
<string name="pref_addFriend_summary">Add friends to compare scores.</string>

</resources>
17 changes: 16 additions & 1 deletion WWTBAM/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<style name="AppBaseTheme" parent="android:Theme">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
Expand All @@ -17,4 +17,19 @@
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

<style name="textWWTBAM">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">40sp</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_marginBottom">25dp</item>
<item name="android:gravity">center</item>
</style>

<style name="button">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">center</item>
</style>

</resources>
19 changes: 19 additions & 0 deletions WWTBAM/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference
android:key="fragments"
android:title="@string/pref_name_title"
android:summary="@string/pref_name_summary"/>
<ListPreference
android:key="graphics"
android:title="@string/pref_title_help"
android:summary="@string/pref_help_summary"
android:entries="@array/numHelps"
android:entryValues="@array/numHelpsValues"
android:defaultValue="3"/>
<EditTextPreference
android:key="fragments"
android:title="@string/pref_addFriend_title"
android:summary="@string/pref_addFriend_summary"/>
</PreferenceScreen>

0 comments on commit b1df6fe

Please sign in to comment.