Skip to content

Commit

Permalink
added information fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitramkumar308 committed Apr 27, 2015
1 parent b4f6102 commit 88b75c4
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 35 deletions.
Binary file added app/app-release.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onCreate(Bundle savedInstanceState) {
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builderSingle = new AlertDialog.Builder(
getActivity());
builderSingle.setIcon(R.drawable.deck_icon);
builderSingle.setIcon(R.drawable.card_game);
builderSingle.setTitle("Customize Deck");
View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_list_fragment, null);
builderSingle.setView(rootView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ public class GameFragment extends Fragment {
public static boolean tableChanged = false;
public static ArrayList<Cards> tempHandCards = new ArrayList<Cards>();

public GameFragment(Game gameObject, Socket socket) {
this.gameObject = gameObject;
this.socket = socket;
public GameFragment() {

}

public GameFragment(Game gameObject) {
public void setParameters(Game gameObject, Socket socket) {
this.gameObject = gameObject;
this.socket = socket;
}


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package srk.syracuse.gameofcards.Fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import srk.syracuse.gameofcards.R;


public class InformationFragment extends Fragment {


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View rootView = getActivity().getLayoutInflater().inflate(R.layout.information_dialog, null);
return rootView;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onClick(View view) {
if (gameobject != null) {
GameFragment gameFragment = new GameFragment();
gameFragment.setParameters(gameobject, ClientConnectionThread.socket);
fragmentManager.beginTransaction()
.replace(R.id.container, new GameFragment(gameobject, ClientConnectionThread.socket)).addToBackStack(JoinGameFragment.class.getName())
.replace(R.id.container, gameFragment).addToBackStack(JoinGameFragment.class.getName())
.commit();
} else {
Toast.makeText(getActivity(), "Game setup not complete. Please try again", Toast.LENGTH_SHORT).show();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package srk.syracuse.gameofcards.Fragments;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
Expand Down Expand Up @@ -41,6 +43,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View rootView = inflater.inflate(R.layout.main_screen_layout, container, false);
Button hostGame = (Button) rootView.findViewById(R.id.hostGame);
Button joinGame = (Button) rootView.findViewById(R.id.joinGame);
Button infoButton = (Button) rootView.findViewById(R.id.infoButton);
infoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getActivity().getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new InformationFragment()).addToBackStack(InformationFragment.class.getName())
.commit();
}
});
WifiManager wifi = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
Method[] wmMethods = wifi.getClass().getDeclaredMethods();
userName = (MaterialEditText) rootView.findViewById(R.id.userName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ public void onClick(View view) {
if (ServerConnectionThread.allPlayersJoined) {
try {
initializeGame();
GameFragment gameFragment = new GameFragment();
gameFragment.setParameters(gameObject, null);
fragmentManager.beginTransaction()
.replace(R.id.container, new GameFragment(gameObject)).addToBackStack(GameFragment.class.getName())
.replace(R.id.container, gameFragment).addToBackStack(GameFragment.class.getName())
.commit();
} catch (IllegalArgumentException exception) {
Toast.makeText(getActivity(), exception.getMessage(), Toast.LENGTH_SHORT).show();
Expand Down
Binary file added app/src/main/res/drawable/info_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions app/src/main/res/layout-land/information_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/infoContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="@string/info_content" />


</LinearLayout>
65 changes: 37 additions & 28 deletions app/src/main/res/layout-land/main_screen_layout.xml
Original file line number Diff line number Diff line change
@@ -1,78 +1,87 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/tableBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
style="@style/tableBackground"
tools:context=".MainActivity$PlaceholderFragment">

<View

android:layout_width="320dp"
android:background="@color/inputText"
android:layout_height="470dp"
android:alpha="0.3"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
android:alpha="0.3"
android:background="@color/inputText" />

<TextView
android:id="@+id/menuText"
android:layout_width="280dp"
android:paddingTop="10dp"
android:layout_height="wrap_content"
android:text="MAIN MENU"
android:textColor="@color/headerText"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textStyle="bold"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:paddingTop="10dp"
android:text="MAIN MENU"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/headerText"
android:textStyle="bold" />

<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/userName"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/menuText"
android:layout_alignRight="@+id/menuText"
android:layout_centerVertical="true"
android:hint="username"
app:met_iconLeft="@drawable/user_icon"
android:inputType="text"
android:lines="1"
android:maxLength="30"
app:met_baseColor="#ffffff"
app:met_primaryColor="@color/editTextSelect"
app:met_iconLeft="@drawable/user_icon"
app:met_iconPadding="0dp"
android:maxLength="30"
android:lines="1"
android:layout_centerVertical="true"
android:layout_alignRight="@+id/menuText"
android:layout_alignEnd="@+id/menuText" />
app:met_primaryColor="@color/editTextSelect" />

<Button
android:id="@+id/hostGame"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Host Game"
android:textAllCaps="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp"
android:background="@drawable/button_drawable"
android:textColor="@color/headerText"
android:text="Host Game"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
android:textColor="@color/headerText" />


<Button
android:id="@+id/joinGame"
android:layout_width="200dp"
android:layout_marginBottom="40dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp"
android:background="@drawable/button_drawable"
android:text="Join Game"
android:textAllCaps="true"
android:background="@drawable/button_drawable"
android:textColor="@color/headerText"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
android:textColor="@color/headerText" />

<Button
android:id="@+id/infoButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/info_icon"
android:layout_alignBottom="@+id/menuText"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>

3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@
<item>king</item>
</string-array>

<string name="info_content">Thank you for downloading our Game of Cards app. We hope you are happy with your download. The app has been developed by Rohit Ramkumar (<a href="[email protected]">[email protected]</a>), Shivank Malik (<a href="[email protected]">[email protected]</a>) and Kunal Shrivastava (<a href="[email protected]">[email protected]</a>).\n\nThe way this app works has been described here. One of the player acts as host of the game and this player MUST have its hotspot on before the start of the app. The other players join to this hotspot before starting the game. The host player sees the "Host game" screen while the other players meet with the "Join game" screen. The host enters the number of players in order to host the game. This number is crucial to restrict the number of players in the game (maximum is 6). So, if the total number of players are 3 (including the host), then the host must enter 2 in the "Number of players" field.\n\nThe essence of the app is that there are no rules and the deck can be customized in more ways than one. Once the game begins after all the players and joined the game, the host gets the option to deal the cards from the deck during the game.\n\nWe do thoroughly test our apps, but it is impossible to test every phone/option combination. If you feel something is not working correctly with your app, please contact us directly at any of the aforementioned email address so that we can help you or fix a bug and get a new release out for all to benefit. And if you love our app, please post a review in the app store. Thank you!​</string>


<string name="title_activity_splash_screen">SplashScreenActivity</string>
</resources>

0 comments on commit 88b75c4

Please sign in to comment.