Update time !

This commit is contained in:
Florian Bouillon 2017-11-26 15:29:53 +01:00
parent 61aa8417f3
commit 743b69261d
10 changed files with 204 additions and 62 deletions

View File

@ -3,7 +3,7 @@ android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "net.DeltaWings.Android.Pendu"
applicationId "net.DeltaWings.Android.Hangman"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
@ -27,7 +27,6 @@ dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.google.android.gms:play-services-ads:11.0.4'
testCompile 'junit:junit:4.12'
}

View File

@ -21,6 +21,6 @@ public class ExampleInstrumentedTest {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("net.DeltaWings.Android.Pendu", appContext.getPackageName());
assertEquals("net.DeltaWings.Android.Hangman", appContext.getPackageName());
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.DeltaWings.Android.Hangman">
package="net.DeltaWings.Android.Hangman">
<application
android:allowBackup="true"
@ -8,17 +8,22 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:fullBackupContent="@xml/backup_descriptor">
<activity
android:name="net.DeltaWings.Android.Hangman.MainActivity"
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".GameActivity"
android:windowSoftInputMode="stateHidden|adjustResize">
</activity>
</application>
</manifest>

View File

@ -0,0 +1,75 @@
package net.DeltaWings.Android.Hangman;
import android.animation.ObjectAnimator;
import android.content.DialogInterface;
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.animation.DecelerateInterpolator;
import android.widget.ProgressBar;
import android.widget.Toast;
import static net.DeltaWings.Android.Hangman.MainActivity.instance;
public class GameActivity extends AppCompatActivity {
ProgressBar progressBar;
AlertDialog.Builder builder;
@Override
public void onBackPressed() {
}
@Override
public boolean onSupportNavigateUp(){
builder.show();
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.game_activity);
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();
}
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;
case DialogInterface.BUTTON_NEGATIVE:
Toast.makeText(instance, "Selected No", Toast.LENGTH_LONG).show();
break;
}
}
};
builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
.setNegativeButton("No", dialogClickListener);
}
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();
}
}

View File

@ -1,7 +1,6 @@
package net.DeltaWings.Android.Hangman;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
@ -11,59 +10,29 @@ import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
public static MainActivity instance;
public static Boolean test = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
instance = this;
test = true;
final ProgressDialog progressDialog = new ProgressDialog(instance);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//Multiplayer button
findViewById(R.id.multiplayerButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//setContentView(R.layout.activity_multiplayer);
progressDialog.setMessage("Connecting...");
//progressDialog.setCancelable(false);
progressDialog.setOnShowListener(new ProgressDialog.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Toast.makeText(instance, "test", Toast.LENGTH_LONG).show();
}
});
progressDialog.setOnCancelListener(new ProgressDialog.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
progressDialog.setMessage("Cancelling...");
progressDialog.setCancelable(false);
//wait for canceletion.
}
});
progressDialog.show();
//Make Connection
//
startActivity(new Intent(instance, GameActivity.class));
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
findViewById(R.id.singleplayerButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
findViewById(R.id.progressBar).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(instance, test + "", Toast.LENGTH_LONG).show();
Toast.makeText(instance, "WIP", Toast.LENGTH_LONG).show();
}
});
}

View File

@ -11,6 +11,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:expanded="false"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="-1dp">
@ -20,10 +21,10 @@
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/relativeLayout"
android:layout_toRightOf="@+id/relativeLayout"
android:layout_weight="1"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_toRightOf="@+id/relativeLayout"/>
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
@ -36,15 +37,6 @@
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
<Button
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/multiplayerButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="92dp"
android:text="Button" />
<Button
android:id="@+id/multiplayerButton"
android:layout_width="wrap_content"

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="net.DeltaWings.Android.Hangman.GameActivity"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="81dp">
<ProgressBar
android:id="@+id/progressBar"
style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:max="100"
android:paddingTop="-4dp"
android:progress="50"
app:layout_constraintBottom_toTopOf="@+id/guideline"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="4dp"
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:orientation="vertical"
android:weightSum="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressBar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/lettersTextView"
android:layout_width="0dp"
android:layout_height="172dp"
android:layout_weight=".50"
android:textAlignment="center"
android:textAllCaps="true"
android:textSize="36sp"
android:textStyle="bold"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.50"
app:srcCompat="@mipmap/ic_launcher_round"/>
</LinearLayout>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:text="________________"
android:textAlignment="center"
android:textSize="36sp"
android:textStyle="bold"/>
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:ems="10"
android:inputType="textPersonName"
android:maxLength="16"
android:maxLines="1"
android:selectAllOnFocus="false"
android:text="Name"
android:textAlignment="center"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Logs"/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">Pendu</string>
<string name="app_name">Hangman</string>
<string name="action_settings">Settings</string>
<string name="multiplayer">Multiplayer</string>
<string name="singleplayer">Singleplayer</string>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<!-- Exclude specific shared preferences that contain GCM registration Id -->
</full-backup-content>