Skip to content

Commit

Permalink
Adding the entry page images and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
prajithkb committed Aug 21, 2013
1 parent ec8f2a3 commit 593d25a
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 97 deletions.
17 changes: 8 additions & 9 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >

<activity
android:name="com.trio.triotictactoe.activity.GameActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.trio.triotictactoe.activity.TakeNameActivity"
Expand All @@ -39,15 +35,18 @@
android:name="com.trio.triotictactoe.activity.HomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name="com.trio.triotictactoe.activity.FacebookTestActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>

<!-- Used by facebook -->
<activity android:name="com.facebook.LoginActivity" />

Expand All @@ -56,4 +55,4 @@
android:value="@string/app_id" />
</application>

</manifest>
</manifest>
Binary file modified res/drawable/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable/flike.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/drawable/game_background.jpg
Binary file not shown.
Binary file added res/drawable/game_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/playervscomputer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable/playervsplayer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable/scores.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 84 additions & 71 deletions res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,153 +2,166 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginTop="@dimen/game_general_padding"
android:background="@drawable/game_bg"
android:orientation="vertical"
android:weightSum="10"
android:background="@color/Green"
android:weightSum="10.0"
tools:context=".MainActivity" >

<RelativeLayout
android:layout_width="fill_parent"
<ImageView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="4"
android:focusable="false" >
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="2.0"
android:background="@drawable/app_logo"
android:contentDescription="@string/app_name" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:weightSum="5" >

<ImageView
android:id="@+id/logo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:adjustViewBounds="true"
android:src="@drawable/atrio" />

<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="4" />
</LinearLayout>
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1.5"
android:adjustViewBounds="true"
android:contentDescription="@string/app_name"
android:src="@drawable/game_title" />

<ImageView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|center_vertical"
android:background="@drawable/start_animation" />
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".5"
android:layout_weight="1.5"
android:visibility="invisible" />

<ImageView
android:id="@+id/playervsplayer"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1.5"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:onClick="playerVsPlayer"
android:padding="10dp"
android:src="@drawable/playervsplayer" />

<ImageView
android:id="@+id/playervscomputer"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1.5"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:onClick="playerVsComputer"
android:padding="10dp"
android:src="@drawable/playervsplayer" />

android:src="@drawable/playervscomputer" />

<View
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_weight="1.0"
android:visibility="invisible" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_weight="1.0"
android:orientation="horizontal"
android:weightSum="10" >
android:weightSum="11.5" >

<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:visibility="invisible" />

<ImageView
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:onClick="playerVsPlayer"
android:padding="2dp"
android:src="@drawable/scores" />

<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:visibility="invisible" />

<ImageView
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:onClick="playerVsPlayer"
android:padding="2dp"
android:src="@drawable/help" />
<com.trio.triotictactoe.views.SettingsButton

<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:visibility="invisible" />

<ImageView
android:id="@+id/settings"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:padding="2dp"
android:background="@drawable/settings"
/>
<ImageView
android:onClick="settingsActivity"
android:src="@drawable/settings" />

<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:visibility="invisible" />

<ImageView
android:id="@+id/finish"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:onClick="finish"
android:padding="2dp"
android:src="@drawable/exit"
/>
android:src="@drawable/exit" />

<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="5"
android:visibility="invisible" />

<ImageView
android:id="@+id/flike"
android:layout_width="0dp"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:visibility="invisible" />

<ImageView
android:id="@+id/flike"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:onClick="flike"
android:padding="2dp"
android:src="@drawable/flike"
/>
android:src="@drawable/flike" />
</LinearLayout>

<View
Expand Down
52 changes: 35 additions & 17 deletions src/com/trio/triotictactoe/activity/HomeActivity.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
package com.trio.triotictactoe.activity;

import com.trio.triotictactoe.R;
import com.trio.triotictactoe.utils.TTTConstants;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnPreparedListener;
import android.media.SoundPool;
import android.media.SoundPool.OnLoadCompleteListener;
import android.os.Bundle;
import android.view.View;

import com.trio.triotictactoe.R;
import com.trio.triotictactoe.utils.TTTConstants;

public class HomeActivity extends Activity {

//View playerVsPlayer, exit, settings,
Expand All @@ -24,8 +19,9 @@ public class HomeActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
player = MediaPlayer.create(this.getApplicationContext(), R.raw.home);

//player = MediaPlayer.create(this.getApplicationContext(), R.raw.home);
findViewById(R.id.playervscomputer).setOnClickListener(layoutClickListener);
findViewById(R.id.playervsplayer).setOnClickListener(layoutClickListener);
}

@Override
Expand All @@ -35,13 +31,13 @@ protected void onStart() {

@Override
public void onWindowFocusChanged(boolean hasFocus) {
if(hasFocus){
player.start();
((AnimationDrawable)findViewById(R.id.textview).getBackground()).start();
}else{
player.pause();
((AnimationDrawable)findViewById(R.id.textview).getBackground()).stop();
}
// if(hasFocus){
// player.start();
// ((AnimationDrawable)findViewById(R.id.textview).getBackground()).start();
// }else{
// player.pause();
// ((AnimationDrawable)findViewById(R.id.textview).getBackground()).stop();
// }
}

public void finish(View v){
Expand All @@ -59,5 +55,27 @@ public void playerVsComputer(View v){
nameAcivityIntent.putExtra(TTTConstants.GAME_MODE_KEY, TTTConstants.GAME_MODE_SINGLE_PLAYER);
startActivity(nameAcivityIntent);
}
public void settingsActivity(View v){
Intent settingsAcivityIntent = new Intent(this, SettingsActivity.class);
startActivity(settingsAcivityIntent);
}

/**
* Click listener for individual TTT (Linear Layout)
*/
private View.OnClickListener layoutClickListener = new View.OnClickListener() {
@Override
public void onClick(final View clickedLinearLayout) {
if(clickedLinearLayout.getId() == R.id.playervsplayer){
playerVsPlayer(clickedLinearLayout);
}else if (clickedLinearLayout.getId() == R.id.playervscomputer){
playerVsComputer(clickedLinearLayout);
}else if(clickedLinearLayout.getId() == R.id.settings){
settingsActivity(clickedLinearLayout);
}


}
};

}

0 comments on commit 593d25a

Please sign in to comment.