Commit ebdd7654 authored by Matyáš Latner's avatar Matyáš Latner

Initial commit

Návrh první obrazovky pro výběr uživatele. Použití GridView zatím jen se
statickou množinou uživatelů.
parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Tablexia</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.nic.tablexia"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.NoActionBar">
<activity
android:label="@string/app_name"
android:name="cz.nic.tablexia.UserSelectorActivity"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cz.nic.tablexia"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.NoActionBar">
<activity
android:label="@string/app_name"
android:name="cz.nic.tablexia.UserSelectorActivity"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
int dimen activity_horizontal_margin 0x7f040002
int dimen user_selector_item_height 0x7f040000
int dimen user_selector_item_width 0x7f040001
int drawable add_user 0x7f020000
int drawable default_user 0x7f020001
int drawable ic_launcher 0x7f020002
int id action_settings 0x7f080003
int id userSelectorGridView 0x7f080000
int id userSelectorItemImage 0x7f080001
int id userSelectorItemText 0x7f080002
int layout user_selector 0x7f030000
int layout user_selector_item 0x7f030001
int menu main 0x7f070000
int string action_settings 0x7f050001
int string app_name 0x7f050000
int string user_image 0x7f050002
int string user_selector_title 0x7f050003
int style AppBaseTheme 0x7f060000
int style AppTheme 0x7f060001
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
/** Automatically generated file. DO NOT MODIFY */
package cz.nic.tablexia;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
\ No newline at end of file
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package cz.nic.tablexia;
public final class R {
public static final class attr {
}
public static final class dimen {
/**
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040002;
public static final int user_selector_item_height=0x7f040000;
public static final int user_selector_item_width=0x7f040001;
}
public static final class drawable {
public static final int add_user=0x7f020000;
public static final int default_user=0x7f020001;
public static final int ic_launcher=0x7f020002;
}
public static final class id {
public static final int action_settings=0x7f080003;
public static final int userSelectorGridView=0x7f080000;
public static final int userSelectorItemImage=0x7f080001;
public static final int userSelectorItemText=0x7f080002;
}
public static final class layout {
public static final int user_selector=0x7f030000;
public static final int user_selector_item=0x7f030001;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int user_image=0x7f050002;
public static final int user_selector_title=0x7f050003;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.nic</groupId>
<artifactId>tablexia</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>Tablexia</name>
<!--////////////////////////////// PROPERTIES ///////////////////////////-->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Plugins -->
<android-maven-plugin.version>3.6.0</android-maven-plugin.version>
<api.platform>14</api.platform>
<!-- Dependencies -->
<android.version>4.1.1.4</android.version>
<andengine.version>1.0.0-SNAPSHOT</andengine.version>
</properties>
<!--////////////////////////////// DEPENDENCIES ///////////////////////////-->
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.andengine</groupId>
<artifactId>andengine</artifactId>
<version>${andengine.version}</version>
<type>apklib</type>
<scope>system</scope>
<systemPath>${basedir}/libs/andengine-${andengine.version}.apklib</systemPath>
</dependency>
</dependencies>
<!--////////////////////////////// BUILD ///////////////////////////-->
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven-plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<zipalign>
<skip>false</skip>
<verbose>true</verbose>
</zipalign>
<sdk>
<platform>${api.platform}</platform>
</sdk>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>install</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-14
android.library.reference.1=../../../Workspace/AndEngine
<LinearLayout 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:background="@android:color/white"
android:orientation="vertical"
android:padding="30dp"
tools:context=".UserSelectorActivity" >
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="@android:color/black"
android:textSize="20sp"
android:layout_marginBottom="20dp"
android:text="@string/user_selector_title"/>
<GridView
android:id="@+id/userSelectorGridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="@dimen/user_selector_item_width"
android:gravity="center"
android:numColumns="5"
android:stretchMode="spacingWidth">
</GridView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/user_selector_item_width"
android:layout_height="@dimen/user_selector_item_height"
android:paddingBottom="20dp"
android:orientation="vertical" >
<ImageView
android:id="@+id/userSelectorItemImage"
android:scaleType="fitXY"
android:contentDescription="@string/user_image"
android:layout_width="match_parent"
android:layout_height="@dimen/user_selector_item_height"/>
<TextView
android:id="@+id/userSelectorItemText"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textColor="@android:color/black"
android:layout_marginTop="5dp"
android:textSize="16sp"/>
</LinearLayout>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->
</resources>
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>
</resources>
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
<resources>
<dimen name="user_selector_item_height">150dp</dimen>
<dimen name="user_selector_item_width">150dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Tablexia</string>
<string name="action_settings">Settings</string>
<string name="user_image">Fotka uživatele</string>
<string name="user_selector_title">Vyber svůj profil a dej se do toho!</string>
</resources>
<resources>
<!--
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">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
package cz.nic.tablexia;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import cz.nic.tablexia.user.User;
/**
* Activity for selecting game user.
* @author Matyáš Latner
*
*/
public class UserSelectorActivity extends Activity {
private static final int USER_SELECTOR_GRID_ID = R.id.userSelectorGridView;
private static final int USER_SELECTOR_ITEM_ID = R.layout.user_selector_item;
private User[] users = new User[]{new User("Nový hráč", R.drawable.add_user),
new User("User2", R.drawable.default_user),
new User("User3", R.drawable.default_user),
new User("User4", R.drawable.default_user),
new User("User5", R.drawable.default_user),
new User("User6", R.drawable.default_user),
new User("User7", R.drawable.default_user)};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_selector);
GridView userSelectorGridView;
userSelectorGridView = (GridView) findViewById(USER_SELECTOR_GRID_ID);
userSelectorGridView.setAdapter(new UserAdapter());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private class UserAdapter extends BaseAdapter {
public int getCount() {
return users.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
/**
* Loads content for each user item view.
*/
public View getView(int position, View convertView, ViewGroup parent) {
convertView = prepareItemView(convertView);
ImageView imageView = (ImageView) convertView.findViewById(R.id.userSelectorItemImage);
imageView.setImageResource(users[position].getImagePath());
TextView textView = (TextView) convertView.findViewById(R.id.userSelectorItemText);
textView.setText(users[position].getUserName());
return convertView;
}
/**
* Creates a new view for user item if its needed.
* @param itemView
* @return recycled or new user item view
*/
private View prepareItemView(View itemView) {
if (itemView == null) {
LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
itemView = inflater.inflate(USER_SELECTOR_ITEM_ID, null);
}
return itemView;
}
}
}
package cz.nic.tablexia.user;
public class User {
private String userName;
private int imagePath;
public User(String userName, int imagePath) {
this.userName = userName;
this.imagePath = imagePath;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getImagePath() {
return imagePath;
}
public void setImagePath(int imagePath) {
this.imagePath = imagePath;
}
}
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