From 9c576de8f38e3af9d20af55e03b1392d8f124485 Mon Sep 17 00:00:00 2001 From: jdagnogo Date: Fri, 27 Oct 2017 14:16:19 +0200 Subject: [PATCH] zoomView added --- app/build.gradle | 4 +- build.gradle | 3 + mytournament/build.gradle | 9 +- .../jdagnogo/mytournament/TournamentView.java | 21 +- .../mytournament/model/MatchResult.java | 2 + .../src/main/res/layout/main_layout.xml | 676 +++++++++--------- 6 files changed, 371 insertions(+), 344 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8ee56e9..568028f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 - buildToolsVersion "26.0.0" + buildToolsVersion "26.0.2" defaultConfig { applicationId "com.example.jdagnogo.tournament" minSdkVersion 21 @@ -24,7 +24,7 @@ dependencies { 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:26.+' + compile 'com.android.support:appcompat-v7:26.0.2' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' compile project(':mytournament') diff --git a/build.gradle b/build.gradle index c2eea8e..428e343 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,9 @@ buildscript { allprojects { repositories { jcenter() + maven { + url "https://maven.google.com" + } } } diff --git a/mytournament/build.gradle b/mytournament/build.gradle index 5b4a6fa..7d323dc 100644 --- a/mytournament/build.gradle +++ b/mytournament/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 26 - buildToolsVersion "26.0.0" + buildToolsVersion "26.0.2" defaultConfig { minSdkVersion 21 @@ -22,11 +22,12 @@ android { } 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:26.+' - compile 'com.android.support:cardview-v7:26.+' + compile 'com.android.support:appcompat-v7:26.0.2' + compile 'com.android.support:cardview-v7:26.0.2' + compile 'com.otaliastudios:zoomlayout:1.1.0' testCompile 'junit:junit:4.12' } diff --git a/mytournament/src/main/java/com/example/jdagnogo/mytournament/TournamentView.java b/mytournament/src/main/java/com/example/jdagnogo/mytournament/TournamentView.java index c145125..bc290a2 100644 --- a/mytournament/src/main/java/com/example/jdagnogo/mytournament/TournamentView.java +++ b/mytournament/src/main/java/com/example/jdagnogo/mytournament/TournamentView.java @@ -57,7 +57,6 @@ public TournamentView(Context context, @Nullable AttributeSet attrs) { setupLayout(context); initViews(); updateElementsAccordingToAttributs(context, attrs); - } private void initViews() { @@ -169,18 +168,18 @@ private Team updateScoreandGetWinner(BinderTeamTextView semi1, BinderTeamTextVie .scoreA(Integer.valueOf(semi1.getTextViewScore().getText().toString())) .scoreB(Integer.valueOf(semi2.getTextViewScore().getText().toString())) .build(); - if (matchResult.getWinner().equals(semi1.getTeam())) { - setColorsBgForLoserAndWinner(semi1, semi2); - } else { - setColorsBgForLoserAndWinner(semi2, semi1); + Team winner = matchResult.getWinner(); + if (null!= winner){ + if (winner.equals(semi1.getTeam())) { + setColorsBgForLoserAndWinner(semi1, semi2); + } else { + setColorsBgForLoserAndWinner(semi2, semi1); + } + return winner; } - - return matchResult.getWinner(); - - - } else return null; + } } - else return null; + return null; } private TextWatcher watcherSemi1 = new TextWatcher() { diff --git a/mytournament/src/main/java/com/example/jdagnogo/mytournament/model/MatchResult.java b/mytournament/src/main/java/com/example/jdagnogo/mytournament/model/MatchResult.java index f1fdc55..2232caf 100644 --- a/mytournament/src/main/java/com/example/jdagnogo/mytournament/model/MatchResult.java +++ b/mytournament/src/main/java/com/example/jdagnogo/mytournament/model/MatchResult.java @@ -21,6 +21,8 @@ public Team getWinner(){ if (scoreA>scoreB){ teamB.setHasBeenEliminated(true); return teamA; + }else if (scoreA == scoreB) { + return null; }else { return teamB; } diff --git a/mytournament/src/main/res/layout/main_layout.xml b/mytournament/src/main/res/layout/main_layout.xml index 4fa2da5..268569c 100644 --- a/mytournament/src/main/res/layout/main_layout.xml +++ b/mytournament/src/main/res/layout/main_layout.xml @@ -1,338 +1,360 @@ - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/default_space" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + - - - - - - - + android:layout_height="match_parent" + android:layout_marginRight="@dimen/default_space" + android:orientation="vertical"> + + + + + + + + + - - \ No newline at end of file + + \ No newline at end of file