diff --git a/app/build.gradle b/app/build.gradle
index 3e23cd2..edf9d01 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,4 +1,19 @@
+buildscript {
+ repositories {
+ maven { url 'https://maven.fabric.io/public' }
+ }
+
+ dependencies {
+ classpath 'io.fabric.tools:gradle:1.+'
+ }
+}
apply plugin: 'com.android.application'
+apply plugin: 'io.fabric'
+
+repositories {
+ maven { url 'https://maven.fabric.io/public' }
+}
+
android {
compileSdkVersion 25
@@ -27,4 +42,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
testCompile 'junit:junit:4.12'
+ compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
+ transitive = true;
+ }
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ad5c6bf..2e18459 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,6 +15,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/wbrawner/numberguess/GameFragment.java b/app/src/main/java/com/wbrawner/numberguess/GameFragment.java
index 4c29ba4..f3ef24f 100644
--- a/app/src/main/java/com/wbrawner/numberguess/GameFragment.java
+++ b/app/src/main/java/com/wbrawner/numberguess/GameFragment.java
@@ -15,6 +15,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.TextView;
import android.widget.Toast;
import java.util.Map;
@@ -22,7 +23,7 @@ import java.util.Map;
public class GameFragment extends Fragment {
- private EditText guessInput;
+ private TextView guessInput;
private Button guessButton;
private Player user;
private NumberGuess ng;
@@ -50,7 +51,40 @@ public class GameFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_game, container, false);
- guessInput = (EditText) rootView.findViewById(R.id.guessInput);
+ guessInput = (TextView) rootView.findViewById(R.id.guessInput);
+ for (int i = 0; i <= 9; i++) {
+ int buttonId = getActivity().getResources().getIdentifier(
+ "button_" + i,
+ "id",
+ getActivity().getPackageName()
+ );
+ final Button inputBtn = (Button) rootView.findViewById(buttonId);
+ inputBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (guessInput.length() < 3)
+ guessInput.append(inputBtn.getText());
+ }
+ });
+ }
+ ((Button) rootView.findViewById(R.id.button_clear)).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ guessInput.setText("");
+ }
+ });
+ ((Button) rootView.findViewById(R.id.button_delete)).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (guessInput.getText().length() > 0)
+ guessInput.setText(
+ guessInput.getText().toString().substring(
+ 0,
+ guessInput.getText().length() - 1
+ )
+ );
+ }
+ });
guessButton = (Button) rootView.findViewById(R.id.guessButton);
guessButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -85,7 +119,6 @@ public class GameFragment extends Fragment {
public void resetGame() {
guessInput.setText("50");
- guessInput.setSelection(2);
user = null;
ng = null;
diff --git a/app/src/main/java/com/wbrawner/numberguess/MainActivity.java b/app/src/main/java/com/wbrawner/numberguess/MainActivity.java
index a937f3c..6e7c1ac 100644
--- a/app/src/main/java/com/wbrawner/numberguess/MainActivity.java
+++ b/app/src/main/java/com/wbrawner/numberguess/MainActivity.java
@@ -3,6 +3,8 @@ package com.wbrawner.numberguess;
import android.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import com.crashlytics.android.Crashlytics;
+import io.fabric.sdk.android.Fabric;
public class MainActivity extends AppCompatActivity
implements GameOverDialogFragment.GameOverListener {
@@ -12,6 +14,7 @@ public class MainActivity extends AppCompatActivity
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
diff --git a/app/src/main/res/layout-land/fragment_game.xml b/app/src/main/res/layout-land/fragment_game.xml
new file mode 100644
index 0000000..19a5ff3
--- /dev/null
+++ b/app/src/main/res/layout-land/fragment_game.xml
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_game.xml b/app/src/main/res/layout/fragment_game.xml
index dc0c99a..210241b 100644
--- a/app/src/main/res/layout/fragment_game.xml
+++ b/app/src/main/res/layout/fragment_game.xml
@@ -1,5 +1,6 @@
-
+ android:orientation="vertical">
-
+ android:imeOptions="flagNoExtractUi"
+ android:maxLength="3"
+ android:textSize="20sp"
+ android:text="50"
+ android:textAlignment="center" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5885930..23eba88 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -8,4 +8,14 @@
- @color/colorAccent
+
+
diff --git a/build.gradle b/build.gradle
index 74b2ab0..c2eea8e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.3'
+ classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 04e285f..4485571 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Dec 28 10:00:20 PST 2015
+#Fri Apr 28 15:04:17 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip