Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0d894f8
Menu draft implemented.
ASGusev Nov 19, 2016
6b43203
first try
Aykeron Nov 23, 2016
5e1bc24
first try
Aykeron Nov 23, 2016
fc34dc0
add show sets card's and all cards
Aykeron Nov 25, 2016
8e0246e
Some cosmetic changes.
ASGusev Nov 26, 2016
eb63d26
add show sets card's and all cards
Aykeron Nov 26, 2016
2cfb959
Merge remote-tracking branch 'origin/imageDB' into imageDB
Aykeron Nov 26, 2016
ce04c9b
Gameplay in process.
ASGusev Nov 26, 2016
4691069
Merge branch 'imageDB' of https://github.com/MZuev/Resemblance into i…
ASGusev Nov 26, 2016
bff3773
add show sets card's and all cards
Aykeron Nov 26, 2016
42cd638
add show sets card's and all cards
Aykeron Nov 26, 2016
9348643
Merge branch 'imageDB' of https://github.com/MZuev/Resemblance into i…
ASGusev Nov 26, 2016
022b037
Game activities.
ASGusev Nov 26, 2016
9892f92
add show sets card's and all cards
Aykeron Nov 28, 2016
e86375f
Merge remote-tracking branch 'origin/imageDB' into imageDB
Aykeron Nov 28, 2016
a531637
add show sets card's and all cards
Aykeron Nov 28, 2016
edc93ae
Merge pull request #1 from MZuev/imageDB
ASGusev Nov 28, 2016
52fa00a
Class name corrected.
ASGusev Nov 28, 2016
ec8ea14
File name fixed.
ASGusev Nov 28, 2016
b9a30cc
add show sets card's and all cards
Aykeron Dec 2, 2016
4454b5a
Merge remote-tracking branch 'origin/imageDB' into imageDB
Aykeron Dec 2, 2016
1ab1519
Merge remote-tracking branch 'remotes/origin/imageDB'
Aykeron Dec 2, 2016
f527439
1
Aykeron Dec 3, 2016
ae4f3bd
MD5
ASGusev Dec 4, 2016
d39b94e
More logic implemented.
ASGusev Dec 4, 2016
f46cb00
Gameplay activities improved.
ASGusev Dec 4, 2016
f09f657
Communication and logic.
ASGusev Dec 4, 2016
ccd1bb2
Fixes.
ASGusev Dec 4, 2016
6f7979d
1
Aykeron Dec 5, 2016
eba9f69
Login and registration improved.
ASGusev Dec 6, 2016
e671ad8
Fixes
ASGusev Dec 12, 2016
a2be638
IP
ASGusev Dec 12, 2016
35a3655
Rounds and players in game activity.
ASGusev Dec 12, 2016
51e55f2
Shifted to new message processing mechanism. Rating is now shown, alt…
ASGusev Dec 17, 2016
681576a
Added processing of round end messages. Needs faster update, though.
ASGusev Dec 17, 2016
20d3772
Games with friends added.
ASGusev Dec 18, 2016
0545f26
Friend game players are shown to its creator.
ASGusev Dec 18, 2016
8251887
interface improvements
ASGusev Dec 23, 2016
09b65f9
Results are shown at the end of a game.
ASGusev Dec 24, 2016
51002bc
Friend game creator now can cancel the game or remove an unwanted pla…
ASGusev Dec 24, 2016
0f562de
Appearance improvements, possibility to leave a friend game.
ASGusev Dec 24, 2016
1190fd9
Icon set.
ASGusev Dec 24, 2016
859902a
Small interface improvements. Password change implemented.
ASGusev Dec 25, 2016
a8e0178
Time shown while waiting for card choice.
ASGusev Dec 25, 2016
5efb3db
Bigger pictures in grids
ASGusev Dec 25, 2016
75c40f9
1
Aykeron Dec 25, 2016
45d7c15
Merge remote-tracking branch 'origin/master'
Aykeron Dec 25, 2016
5a01b51
1
Aykeron Dec 25, 2016
354c362
Galleries improved
ASGusev Dec 26, 2016
ea92faa
fixes
ASGusev Dec 26, 2016
55ece0c
Changes made according to code review. No more BroadcastReceivers.
ASGusev Jan 4, 2017
dd9f0d9
Changes made according to code review. No more BroadcastReceivers.
ASGusev Jan 4, 2017
4dadc0d
Few more fixes
ASGusev Jan 5, 2017
d0ded0f
Gallery ram consumption reduced.
ASGusev Jan 5, 2017
ea8bd64
Gallery performance improved.
ASGusev Jan 5, 2017
6753419
Time of player choice expectation now can be changed.
ASGusev Jan 8, 2017
7e44297
Chat implemented.
ASGusev Jan 12, 2017
e31d440
Chat improved.
ASGusev Jan 12, 2017
32f998e
Sets list apppearance improved.
ASGusev Feb 7, 2017
079bc14
Settings activity updated.
ASGusev Feb 8, 2017
9ffb8c1
In-game card activities improved.
ASGusev Feb 8, 2017
968b0d2
Game appearance improved.
ASGusev Feb 11, 2017
5f84b0b
After game screen improved.
ASGusev Feb 12, 2017
2fdd667
Cards manipulation activity appearance improved.
ASGusev Feb 12, 2017
fbbb8ee
Card sets updated.
ASGusev Feb 13, 2017
ea6c0e8
Removed possibility to play with yourself.
ASGusev Feb 16, 2017
92cbe35
Cards grid activities merged. Timer is shown while leading.
ASGusev Feb 17, 2017
4f882e0
After game activity updated again.
ASGusev Feb 17, 2017
cc106ec
Fixes. Results header.
ASGusev Feb 17, 2017
d202ebe
Fixes.
ASGusev Feb 19, 2017
31d3a50
Added option to set server IP.
ASGusev Feb 23, 2017
4c6aa67
IP validation.
ASGusev Feb 25, 2017
4d752d6
Set reation implemented.
ASGusev Feb 25, 2017
36e7de3
Code tweaks
ASGusev Feb 26, 2017
32f1583
IP change from login screen.
ASGusev Feb 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .idea/gradle.xml

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

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.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

1 change: 0 additions & 1 deletion Resemblance
Submodule Resemblance deleted from 5e3ed0
10 changes: 8 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@ android {
defaultConfig {
applicationId "ru.spbau.resemblance"
minSdkVersion 16
targetSdkVersion 24
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:support-vector-drawable:24.2.1'
testCompile 'junit:junit:4.12'
}
68 changes: 67 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,85 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.spbau.resemblance">

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity
android:name=".MainActivity"
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=".CreateGameActivity"
android:screenOrientation="portrait" />
<activity
android:name=".JoinGameActivity"
android:screenOrientation="portrait" />
<activity
android:name=".LoginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".SettingsActivity"
android:label="@string/title_activity_settings"
android:screenOrientation="portrait" />
<activity
android:name=".RegistrationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".PasswordChangeActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CardSetsActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ListOfSetsActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GameIntermediateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".LeadingAssociationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CardPickerActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CardViewerActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GameExpectationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GamePreparationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GameFinishActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GalleryActivity"
android:screenOrientation="portrait" />
<activity
android:name=".GalleryCardViewerActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ChatActivity"
android:screenOrientation="portrait" />
<activity android:name=".CreateSetActivity"></activity>
</application>

</manifest>
144 changes: 144 additions & 0 deletions app/src/main/java/ru/spbau/resemblance/CardPickerActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
package ru.spbau.resemblance;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ListAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

public class CardPickerActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
public static final String PICTURE_PARAM = "picture_id";
public static final String OUR_CARDS_PARAM = "our_cards";
public static final String SUGGESTION_PARAM = "suggestion";
public static final String TITLE_PARAM = "title";
public static final String EXPECTATION_TIME_PARAM = "expectation_time";
public static final String LEADING_PARAM = "leading";
private final static int COLUMNS_NUMBER = 2;
private final static int CARD_REQUEST = 1;
private final static int LEADING_CARD_REQUEST = 2;
private final static long SECOND = 1000;

private TextView timeView;
private Timer timer;
private long deadline;
private boolean leading;

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

GridView grid = (GridView) findViewById(R.id.cardPickedGrid);
TextView suggestion = (TextView) findViewById(R.id.cardPickerText);
timeView = (TextView) findViewById(R.id.cardPickerTimeView);

Intent callingIntent = getIntent();

leading = callingIntent.getBooleanExtra(LEADING_PARAM, false);
suggestion.setText(callingIntent.getStringExtra(SUGGESTION_PARAM));
setTitle(callingIntent.getStringExtra(TITLE_PARAM));
long timeout = callingIntent.getLongExtra(EXPECTATION_TIME_PARAM, -1);

List <Long> cardIds = new ArrayList<>();
long[] cardsArr = callingIntent.getLongArrayExtra(OUR_CARDS_PARAM);
for(long card: cardsArr) {
cardIds.add(card);
}

ArrayList<ImageStorage.ImageWrapped> cardViews = new ArrayList<>();
for (int i = 0; i < cardIds.size(); i++) {
cardViews.add(ImageStorage.ImageWrapped.createById((int)(long)cardIds.get(i)));
}

ListAdapter cardsAdapter = new CardsAdapter(this, cardViews,
getResources().getDisplayMetrics().widthPixels / COLUMNS_NUMBER);
grid.setAdapter(cardsAdapter);
grid.setNumColumns(COLUMNS_NUMBER);

grid.setOnItemClickListener(this);

timer = new Timer();
deadline = System.currentTimeMillis() + timeout;
timer.scheduleAtFixedRate(new TimeUpdater(), 10, 200);
}

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (leading) {
Intent showPicture = new Intent(this, LeadingAssociationActivity.class);
showPicture.putExtra(LeadingAssociationActivity.IMAGE_PARAM, id);
startActivityForResult(showPicture, LEADING_CARD_REQUEST);
} else {
Intent showPicture = new Intent(this, CardViewerActivity.class);
showPicture.putExtra(LeadingAssociationActivity.IMAGE_PARAM, id);
startActivityForResult(showPicture, CARD_REQUEST);
}
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
long pictureId = data.getLongExtra(GameIntermediateActivity.PICTURE_PARAM, -1L);
if (pictureId >= 0) {
Intent ret = new Intent();
ret.putExtra(GameIntermediateActivity.PICTURE_PARAM, pictureId);
if (leading) {
ret.putExtra(GameIntermediateActivity.ASSOCIATION_PARAM,
data.getStringExtra(GameIntermediateActivity.ASSOCIATION_PARAM));
}
setResult(RESULT_OK, ret);
timer.cancel();
finish();
}
}

private class TimeUpdater extends TimerTask {
final int MINUTE = 60;

@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (System.currentTimeMillis() > deadline) {
Intent ret = new Intent();
ret.putExtra(GameIntermediateActivity.PICTURE_PARAM, -1L);
setResult(RESULT_OK, ret);
timer.cancel();
finish();
} else {
long rest = (deadline - System.currentTimeMillis()) / SECOND;
timeView.setText(String.format(getString(R.string.card_picker_time), rest / MINUTE + ":" + rest % MINUTE));
}
}
});
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.chat_menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent chatIntent = new Intent(this, ChatActivity.class);
startActivity(chatIntent);
return true;
}

@Override
public void onBackPressed() {
//Doing nothing. Player should submit an association.
}
}
75 changes: 75 additions & 0 deletions app/src/main/java/ru/spbau/resemblance/CardSetsActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package ru.spbau.resemblance;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;

import java.util.ArrayList;

//This is an activity for manipulations with cards and sets

public class CardSetsActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
final private static int GALLERY_REQUEST = 1;

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

ListView optionsList = (ListView)findViewById(R.id.cardSetsOptionsList);
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,
getResources().getStringArray(R.array.cards_control_options));

optionsList.setAdapter(adapter);
optionsList.setOnItemClickListener(this);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);

ImageView imageView = (ImageView) new ImageView(this);

switch (requestCode) {
case GALLERY_REQUEST:
if (resultCode == RESULT_OK) {
Uri selectedImage = imageReturnedIntent.getData();
imageView.setImageURI(selectedImage);
ImageStorage.addImageByUri(selectedImage.toString(), this);
}
}
}

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0: {
Intent listOfSets = new Intent(this, ListOfSetsActivity.class);
startActivity(listOfSets);
break;
}
case 1: {
Intent showCards = new Intent(this, GalleryActivity.class);
ArrayList<ImageStorage.ImageWrapped> cards = ImageStorage.getAllImages();
long[] cardIds = new long[cards.size()];
for (int i = 0; i < cardIds.length; i++) {
cardIds[i] = cards.get(i).getIdImage();
}
showCards.putExtra(GalleryActivity.CARDS_PARAM, cardIds);
startActivity(showCards);
break;
}
case 2: {
Intent createSet = new Intent(this, CreateSetActivity.class);
startActivity(createSet);
break;
}
}
}
}
Loading