mirror of
https://github.com/Aviortheking/Hangman.git
synced 2024-12-19 18:20:54 +00:00
Update time !
This commit is contained in:
parent
743b69261d
commit
a018ad56ee
15
.idea/misc.xml
generated
15
.idea/misc.xml
generated
@ -1,8 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
@ -27,17 +24,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -4,7 +4,7 @@ android {
|
||||
buildToolsVersion "26.0.1"
|
||||
defaultConfig {
|
||||
applicationId "net.DeltaWings.Android.Hangman"
|
||||
minSdkVersion 15
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
@ -6,19 +6,26 @@ import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
import android.widget.TextView;
|
||||
|
||||
import static net.DeltaWings.Android.Hangman.MainActivity.instance;
|
||||
import net.DeltaWings.Android.Hangman.Util.ConnectionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GameActivity extends AppCompatActivity {
|
||||
|
||||
ProgressBar progressBar;
|
||||
AlertDialog.Builder builder;
|
||||
private AlertDialog.Builder builder;
|
||||
private ConnectionUtil co;
|
||||
private List<String> letters = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,47 +36,105 @@ public class GameActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.game_activity);
|
||||
|
||||
ProgressBar progressBar = findViewById(R.id.progressBar);
|
||||
EditText input = findViewById(R.id.input);
|
||||
|
||||
log("Logs");
|
||||
log("Connecting...");
|
||||
co = new ConnectionUtil();
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
} else {
|
||||
Toast.makeText(instance, " There is a problem here let's see what it is", Toast.LENGTH_LONG).show();
|
||||
log("A problem occurred Please restart the application");
|
||||
}
|
||||
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
|
||||
|
||||
|
||||
|
||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which){
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
Toast.makeText(instance, "Selected Yes", Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
//Close Connection
|
||||
log("Closing connection");
|
||||
co.closeConnection();
|
||||
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
Toast.makeText(instance, "Selected No", Toast.LENGTH_LONG).show();
|
||||
//send to main menu
|
||||
finish();
|
||||
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Input Management
|
||||
input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
String text = ((EditText) v).getText().toString();
|
||||
if(text.length() == 1) {
|
||||
log("Letter : " + text);
|
||||
if(letters.contains(text)) {
|
||||
log("Letter : " + text + "Already in");
|
||||
} else {
|
||||
log("Sending letter " + text);
|
||||
//Send Letter
|
||||
}
|
||||
} else if(text.length() > 1) {
|
||||
log("Word : " + text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//Input Management
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Return Builder
|
||||
builder = new AlertDialog.Builder(this);
|
||||
|
||||
builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
|
||||
builder.setMessage("Do you really want to quit your game ?")
|
||||
.setPositiveButton("Yes", dialogClickListener)
|
||||
.setNegativeButton("No", dialogClickListener);
|
||||
//Return Builder
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
log("Connected !");
|
||||
setProgressAnimate(progressBar, 100);
|
||||
}
|
||||
|
||||
private void setProgressAnimate(ProgressBar pb, int progressTo)
|
||||
{
|
||||
|
||||
private void setProgressAnimate(ProgressBar pb, int progressTo) {
|
||||
ObjectAnimator animation = ObjectAnimator.ofInt(pb, "progress", pb.getProgress(), progressTo);
|
||||
animation.setDuration(250);
|
||||
animation.setInterpolator(new DecelerateInterpolator());
|
||||
animation.start();
|
||||
}
|
||||
|
||||
private void log(String message) {
|
||||
TextView logs = findViewById(R.id.logs);
|
||||
logs.setText(logs.getText().toString() + "\n" + message);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package net.DeltaWings.Android.Hangman.Util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ConnectionUtil {
|
||||
|
||||
static public ConnectionUtil connection;
|
||||
|
||||
private String ip = null;
|
||||
private String userID = null;
|
||||
private String jsp = "jsp";
|
||||
public int percent = 0;
|
||||
|
||||
public ConnectionUtil ConnectionUtil() {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void closeConnection() {
|
||||
|
||||
}
|
||||
|
||||
public boolean sendData(List<Object> query) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:paddingTop="-4dp"
|
||||
android:progress="50"
|
||||
@ -27,14 +28,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_begin="4dp"
|
||||
app:layout_constraintGuide_begin="3dp"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="4dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -76,7 +76,7 @@
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:id="@+id/input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="0dp"
|
||||
@ -93,11 +93,17 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Logs"/>
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Mon Sep 18 17:41:18 CEST 2017
|
||||
#Mon Jan 22 23:59:18 CET 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
|
Loading…
x
Reference in New Issue
Block a user