Skip to content

Repository for Android course - Implementing Texas Holdem Poker application to play with friends online

License

Notifications You must be signed in to change notification settings

haimadrian/Android-TexasHoldemPokerOnline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Project

Repository to work on the final project in Android course, HIT, year C, 2nd semester

Video

Click on the image below in order to view it on YouTube
Android Final Project (Texas Holdem app)

Note

You'll need Gradle and Lombok in order to open, and successfully run, the projects below

Server

Source
Server is written in java, using Spring Boot.
REST API is wrritten in accordance to Spring MVC.
Controllers handle the requests, which go to Services, that use Repository.
User details, including profile image, are stored to My SQL (RDS) using Spring Data JPA.
Users are authorized using JWT that the server generates after a successful authentication.
Passwords are encrypted without being able to be decrypted. For security purposes.
The certificate of the server is a self signed one.
The server is built into Spring's bootJar, to make it easier to "install" it on a server.

Common

Source
Common project contains all of the classes that are shared to both server and client: the model classes (settings, chat, user, player, etc.), and GameEngine, so we will be able to support a server managed game, and a local game (AI - In a future version)
You may find important classes here, e.g.:

  • ThreadContextMap - used to keep requesting player identifier, to make sure we hide all player hands except the requesting player. Thus avoid of revealing other player hands (which might be exposed to an http client)
  • GameEngine - the main engine of a game
  • HandRankCalculator - a calculator to give a rank for player hands, based on hand and board (board is optional), which hekps us to find the winner or winners in case of a draw, and the selected cards so a client can highlight them.
  • Pot - this class is used to keep players bet on every round basis, which helps us in splitting to side pots (when a player is ALL-IN, and there are other players left to play)

Client

Source
Client is written in Java for Android. HTTPS requests are sent using Retrofit. (See TexasHoldemWebService that wraps our services) There are two major activities: Login and Main
Another activity is the ExitActivity which is used for an ordinary shutdown of the application.
And the SplashActivity, which is used when the app is launched, to display an animation and redirect to the LoginActivity.

The LoginActivity uses two fragments: SignInFragment and SignUpFragment. Those two fragments extend the AbstractSignInFragment, cause they both look the same, using two input fields, and a view model which is updated on every input change of the view. Thus following the MVVM pattern.
Note that the JWT token is stored to SharedPreferences, so in case user exits the application and then comes back in, user is automatically signed in without having to retype the password.

The MainActivity uses a NavigationView with a MobileNavigation that lists the items and their corresponding fragments in the navigation view. With that said, all navigations between fragments are performed using the navigation view, and not creating fragments manually.
Fragments related to the main activity are:

There is also a GameSoundService which we use to play sound effects in background. Thus letting a player to minimize the app, or switch to another app, and hear game steps (call/check/fold/timer) effects.

Basically the game is managed at the server side, and the client asks for updates every second, to demo a "realtime" game.

Screenshots

Sign In

Home

Home

Navigation View

Here the user can purchase chips (the + and cart button) and modify profile picture by clicking on it
NavigationView

Create Game

CreateGame

Seat Selection

The arrows are animated from top to bottom (bouncy) to make it clear that the user should pick up a seat
SeatSelection

Admin View

Here you see the start button, that only an admin (the one who created an online game) can see.
In addition, you can see the badge over the chat's button which tells how many new messages arrived.
AdminView

Game Start

You can see a circle progress bar around the current player, which counts the time for a turn before it runs out of time and fold automatically
StartAndTimer

Chat

Chat

Winner

Confetti animation that the winner sees. (And the winner only)
Winner

Game Log

GameLog

Releases

No releases published

Packages

No packages published

Languages