From f422be36904bb7eb48d9d553233a96407deff0d1 Mon Sep 17 00:00:00 2001 From: Lorrany Date: Thu, 10 May 2018 17:18:41 -0300 Subject: [PATCH 01/11] FeedModel and SHowProfileModel tested --- .../nexte/nexte/FeedScene/FeedModelTest.kt | 32 ++++++++++++++++++- .../ShowProfileScene/ShowProfileModelTest.kt | 9 ++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/project/app/src/test/java/com/nexte/nexte/FeedScene/FeedModelTest.kt b/project/app/src/test/java/com/nexte/nexte/FeedScene/FeedModelTest.kt index 4eca2b98..cfb9c3f7 100644 --- a/project/app/src/test/java/com/nexte/nexte/FeedScene/FeedModelTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/FeedScene/FeedModelTest.kt @@ -84,6 +84,9 @@ class FeedModelTest { //call val feedPlayer = FeedModel.FeedPlayer(name = name, photo = photo, set = set) + feedPlayer.photo = photo + feedPlayer.set = set + feedPlayer.name = name //assert assertEquals(name, feedPlayer.name) @@ -100,6 +103,9 @@ class FeedModelTest { //call val feedChallenge = FeedModel.FeedChallenge(challenger = challenger, challenged = challenged, challengeDate = challengeDate) + feedChallenge.challenger = challenger + feedChallenge.challenged = challenged + feedChallenge.challengeDate = challengeDate //assert assertEquals(challenger, feedChallenge.challenger) @@ -120,6 +126,10 @@ class FeedModelTest { //call val feedActivity = FeedModel.FeedActivity(challenge = challenge, feedDate = feedDate, identifier = identifier, likes = likes) + feedActivity.likes = likes + feedActivity.identifier = identifier + feedActivity.feedDate = feedDate + feedActivity.challenge = challenge //assert assertEquals(challenge, feedActivity.challenge) @@ -143,6 +153,15 @@ class FeedModelTest { //call val feedActivityFormatted = FeedModel.FeedActivityFormatted(challengerName = challengerName, challengerPhoto = challengerPhoto, challengerSets = challengerSets, challengedName = challengedName, challengedPhoto = challengedPhoto, challengedSets = challengedSets, feedDate = feedDate, identifier = identifier, numberOfLikes = numberOfLikes) + feedActivityFormatted.numberOfLikes = numberOfLikes + feedActivityFormatted.identifier = identifier + feedActivityFormatted.feedDate = feedDate + feedActivityFormatted.challengerSets = challengerSets + feedActivityFormatted.challengerPhoto = challengerPhoto + feedActivityFormatted.challengerName = challengerName + feedActivityFormatted.challengedName = challengedName + feedActivityFormatted.challengedPhoto = challengedPhoto + feedActivityFormatted.challengedSets = challengedSets //assert assertEquals(challengerName, feedActivityFormatted.challengerName) @@ -163,7 +182,7 @@ class FeedModelTest { // call val request = FeedModel.LikeAndUnlike.Request(identifier = identifier) - + request.identifier = identifier //assert assertEquals(identifier, request.identifier) assertNotNull(request) @@ -192,6 +211,17 @@ class FeedModelTest { } + @Test + fun successFeedModel() { + //prepare + + //call + val model = FeedModel() + + //assert + assertNotNull(model) + } + @Test fun successCreateViewModelLikeAndUnlike(){ diff --git a/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt b/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt index 1d43f775..6000ea98 100644 --- a/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt @@ -22,7 +22,8 @@ class ShowProfileModelTest { //call val request = ShowProfileModel.Request(username = "luis-gustavo", tokenID = "akjbd2130as") - + request.username = userName + request.tokenID = tokenId //assert assertEquals(userName, request.username) assertEquals(tokenId, request.tokenID) @@ -76,7 +77,11 @@ class ShowProfileModelTest { //call val formattedPlayer = ShowProfileModel.FormattedPlayer(name = "Luis Gustavo", rank = "1", club = "AASCD", email = "luis@email.com", age = "21") - + formattedPlayer.age = age + formattedPlayer.club = club + formattedPlayer.email = email + formattedPlayer.name = name + formattedPlayer.rank = rank //assert assertEquals(name, formattedPlayer.name) assertEquals(rank, formattedPlayer.rank) From 400a740daed1eca4954d05664e9b999de242b7ef Mon Sep 17 00:00:00 2001 From: Lorrany Date: Thu, 10 May 2018 20:52:48 -0300 Subject: [PATCH 02/11] Modifications deleted --- .../nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt b/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt index 6000ea98..1d43f775 100644 --- a/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ShowProfileScene/ShowProfileModelTest.kt @@ -22,8 +22,7 @@ class ShowProfileModelTest { //call val request = ShowProfileModel.Request(username = "luis-gustavo", tokenID = "akjbd2130as") - request.username = userName - request.tokenID = tokenId + //assert assertEquals(userName, request.username) assertEquals(tokenId, request.tokenID) @@ -77,11 +76,7 @@ class ShowProfileModelTest { //call val formattedPlayer = ShowProfileModel.FormattedPlayer(name = "Luis Gustavo", rank = "1", club = "AASCD", email = "luis@email.com", age = "21") - formattedPlayer.age = age - formattedPlayer.club = club - formattedPlayer.email = email - formattedPlayer.name = name - formattedPlayer.rank = rank + //assert assertEquals(name, formattedPlayer.name) assertEquals(rank, formattedPlayer.rank) From dbcf6a9fadf89f577ebc1bfed54445b29f8b0229 Mon Sep 17 00:00:00 2001 From: Lorrany Date: Tue, 15 May 2018 23:23:59 -0300 Subject: [PATCH 03/11] Activity converted to fragment * MatchFragment adapted in MatchView Co-authored-by: Gabriel Albino --- project/app/src/main/AndroidManifest.xml | 2 +- .../nexte/ChallengeScene/ChallengeView.kt | 40 +++++++++--- .../main/java/com/nexte/nexte/MainActivity.kt | 4 +- .../{MatchView.kt => MatchFragment.kt} | 63 +++++++++---------- .../nexte/nexte/MatchScene/MatchPresenter.kt | 4 +- .../main/res/layout/activity_challenger.xml | 6 ++ .../src/main/res/layout/activity_match.xml | 2 +- project/app/src/main/res/values/strings.xml | 1 + .../EditProfileScene/EditProfileModelTest.kt | 25 ++++++++ 9 files changed, 96 insertions(+), 51 deletions(-) rename project/app/src/main/java/com/nexte/nexte/MatchScene/{MatchView.kt => MatchFragment.kt} (81%) diff --git a/project/app/src/main/AndroidManifest.xml b/project/app/src/main/AndroidManifest.xml index 307b1f4f..48b32fba 100644 --- a/project/app/src/main/AndroidManifest.xml +++ b/project/app/src/main/AndroidManifest.xml @@ -72,7 +72,7 @@ android:label="CommentsActivity" android:screenOrientation="portrait" /> diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt index dc02fd63..da5cf43b 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt @@ -14,10 +14,14 @@ import com.nexte.nexte.R import kotlinx.android.synthetic.main.activity_challenger_sent.* import kotlinx.android.synthetic.main.columns_challenged.view.* import android.app.AlertDialog +import android.support.v7.widget.LinearLayoutManager import android.widget.Button import android.widget.TextView +import com.nexte.nexte.MatchScene.MatchFragment +import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.UserSingleton import kotlinx.android.synthetic.main.activity_challenger.* +import kotlinx.android.synthetic.main.activity_match.* /** @@ -73,14 +77,6 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { var interactor: ChallengeBusinessLogic? = null private val context: Context? = null - /** - * This object is used for avoid magic numbers - */ - companion object { - - const val playerRanking = 8 //simulates the logged player ranking - } - /** * Method called whenever the view is created, responsible for create first * request and set listeners @@ -255,7 +251,31 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { viewContext.expandedRankingTextView = view?.findViewById(R.id.expandedRankingTextView) viewContext.expandedWins = view?.findViewById(R.id.expandedWins) viewContext.noPlayersText = view?.findViewById(R.id.noPlayersText) - } else { + } + else if(position == 1) { + val view = inflater?.inflate(R.layout.activity_match, container, false) + this.setUpMatchScene() + + val empty = MatchModel.FormattedMatchData("", 1, + "", 1) + + this.matchViewAdapter = MatchFragment.MatchDataAdapter(empty, this) + matchRecyclerView.adapter = this.matchViewAdapter + matchRecyclerView.layoutManager = LinearLayoutManager(activity) + + /** + * Passing string through intent, once the label of the string to be + * used in this scene is a string thrown by main activity + */ + val prevIntent = activity.intent.getStringExtra("identifier") + val request = MatchModel.InitScene.Request(prevIntent) + interactor?.getInfoMatches(request) + + sendButton.isEnabled = false + + return view!! + } + else { view = inflater?.inflate(R.layout.activity_challenger_received, container, false) } return view @@ -284,7 +304,7 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { */ class ViewPagerAdapter (fragmentManager: FragmentManager) : FragmentPagerAdapter(fragmentManager) { - private val pageTitles = listOf("Enviados", "Recebidos") + private val pageTitles = listOf("Tenistas", "Enviados", "Recebidos") override fun getCount(): Int { diff --git a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt index 40ef8660..b105bead 100644 --- a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt +++ b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt @@ -8,7 +8,7 @@ import com.nexte.nexte.LoginScene.* import com.nexte.nexte.RankingScene.RankingView import com.nexte.nexte.ShowProfileScene.ShowProfileView import com.nexte.nexte.ChallengeScene.ChallengeView -import com.nexte.nexte.MatchScene.MatchView +import com.nexte.nexte.MatchScene.MatchFragment import kotlinx.android.synthetic.main.activity_main.* import android.support.design.widget.BottomNavigationView @@ -43,7 +43,7 @@ class MainActivity : AppCompatActivity() { //Button to display Match scene matchButton.setOnClickListener { - val intent = Intent(this, MatchView::class.java) + val intent = Intent(this, MatchFragment::class.java) intent.putExtra("identifier", "matchName") startActivity(intent) } diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchView.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt similarity index 81% rename from project/app/src/main/java/com/nexte/nexte/MatchScene/MatchView.kt rename to project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index c23c91c9..29ac9058 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchView.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -1,9 +1,8 @@ package com.nexte.nexte.MatchScene import android.annotation.SuppressLint -import android.content.Context +import android.app.Fragment import android.os.Bundle -import android.support.v7.app.AppCompatActivity import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.RecyclerView import android.view.LayoutInflater @@ -17,7 +16,7 @@ import java.text.SimpleDateFormat import java.util.* /** - * Interface to define Display Logic to MatchView Class that will receive information + * Interface to define Display Logic to MatchFragment Class that will receive information * from Presenter */ interface MatchDisplayLogic { @@ -33,22 +32,15 @@ interface MatchDisplayLogic { * @property numberOfSets enum class to define the number of sets, which define the presentation * of recycler view */ -class MatchView : AppCompatActivity(), MatchDisplayLogic { +class MatchFragment : Fragment(), MatchDisplayLogic { var interactor: MatchInteractor? = null - var matchViewAdapter: MatchDataAdapter? = null + private var matchViewAdapter: MatchDataAdapter? = null var numberOfSets = MatchModel.SetsNumber.One - /** - * On Create is a method that will setup this scene and call first Request for Interactor - * - * @param savedInstanceState - */ - override fun onCreate(savedInstanceState: Bundle?) { - - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_match) + override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View { + val view = inflater?.inflate(R.layout.activity_match, container, false) this.setUpMatchScene() val empty = MatchModel.FormattedMatchData("", 1, @@ -56,18 +48,19 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { this.matchViewAdapter = MatchDataAdapter(empty,this) matchRecyclerView.adapter = this.matchViewAdapter - matchRecyclerView.layoutManager = LinearLayoutManager(this) + matchRecyclerView.layoutManager = LinearLayoutManager(activity) /** * Passing string through intent, once the label of the string to be * used in this scene is a string thrown by main activity */ - val prevIntent = intent.getStringExtra("identifier") + val prevIntent = activity.intent.getStringExtra("identifier") val request = MatchModel.InitScene.Request(prevIntent) interactor?.getInfoMatches(request) sendButton.isEnabled = false + return view!! } /** @@ -113,10 +106,10 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { * implemented, and do the management of the rows displays * * @param matchInfo information of Data obtained as formatted classes - * @param context activity to display defined elements + * @param fragment fragment to display defined elements */ class MatchDataAdapter (private var matchInfo: MatchModel.FormattedMatchData, - private val context: Context): RecyclerView.Adapter() { + private val fragment: Fragment): RecyclerView.Adapter() { /** * Function to get the type of the row to be displayed @@ -128,7 +121,7 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { val layoutMatch : Int - when((context as MatchView).numberOfSets.number){ + when((fragment as MatchFragment).numberOfSets.number){ firstPosition -> layoutMatch = when(position) { zeroPosition -> R.layout.row_match_info firstPosition -> R.layout.row_match_sets @@ -180,20 +173,20 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { when (viewType) { R.layout.row_match_info -> { - val view = LayoutInflater.from(context).inflate(R.layout.row_match_info, parent,false) - holder = MatchView.MatchDataAdapter.InfoViewHolder(view) + val view = LayoutInflater.from(fragment.activity).inflate(R.layout.row_match_info, parent,false) + holder = MatchFragment.MatchDataAdapter.InfoViewHolder(view) } R.layout.row_match_sets -> { - val view = LayoutInflater.from(context).inflate(R.layout.row_match_sets, parent,false) - holder = MatchView.MatchDataAdapter.SetsViewHolder(view) + val view = LayoutInflater.from(fragment.activity).inflate(R.layout.row_match_sets, parent,false) + holder = MatchFragment.MatchDataAdapter.SetsViewHolder(view) } R.layout.row_match_time -> { - val view = LayoutInflater.from(context).inflate(R.layout.row_match_time, parent,false) - holder = MatchView.MatchDataAdapter.TimeViewHolder(view) + val view = LayoutInflater.from(fragment.activity).inflate(R.layout.row_match_time, parent,false) + holder = MatchFragment.MatchDataAdapter.TimeViewHolder(view) } else -> { //viewType == R.layout.row_match_wo - val view = LayoutInflater.from(context).inflate(R.layout.row_match_wo, parent,false) - holder = MatchView.MatchDataAdapter.WOViewHolder(view) + val view = LayoutInflater.from(fragment.activity).inflate(R.layout.row_match_wo, parent,false) + holder = MatchFragment.MatchDataAdapter.WOViewHolder(view) } } @@ -202,11 +195,11 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { /** * Function that defines the size of the recycler view following the [numberOfSets] - * on [MatchView] + * on [MatchFragment] */ override fun getItemCount(): Int { - return when((context as MatchView).numberOfSets.number) { + return when((fragment as MatchFragment).numberOfSets.number) { firstPosition -> thirdPosition thirdPosition -> fifthPosition fifthPosition -> seventhPosition @@ -228,7 +221,7 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { if(holder is InfoViewHolder) { - holder.infoBindView(matchInfo, context) + holder.infoBindView(matchInfo,fragment) } if(holder is SetsViewHolder) { @@ -254,7 +247,7 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { */ class InfoViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - fun infoBindView(matchInfo: MatchModel.FormattedMatchData, context: Context) { + fun infoBindView(matchInfo: MatchModel.FormattedMatchData, fragment: Fragment) { itemView.challengedName.text = matchInfo.challengedName itemView.challengerName.text = matchInfo.challengerName @@ -262,18 +255,18 @@ class MatchView : AppCompatActivity(), MatchDisplayLogic { itemView.imageChallenger.setImageResource(matchInfo.challengerPhoto) itemView.buttonOne.setOnClickListener { - (context as MatchView).updateSetsNumber(MatchModel.SetsNumber.One) + (fragment as MatchFragment).updateSetsNumber(MatchModel.SetsNumber.One) } itemView.buttonThree.setOnClickListener { - (context as MatchView).updateSetsNumber(MatchModel.SetsNumber.Three) + (fragment as MatchFragment).updateSetsNumber(MatchModel.SetsNumber.Three) } itemView.buttonFive.setOnClickListener { - (context as MatchView).updateSetsNumber(MatchModel.SetsNumber.Five) + (fragment as MatchFragment).updateSetsNumber(MatchModel.SetsNumber.Five) } itemView.buttonWO.setOnClickListener { - (context as MatchView).updateSetsNumber(MatchModel.SetsNumber.WO) + (fragment as MatchFragment).updateSetsNumber(MatchModel.SetsNumber.WO) } } } diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchPresenter.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchPresenter.kt index 1905076c..e9ecc9ef 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchPresenter.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchPresenter.kt @@ -19,7 +19,7 @@ interface MatchPresentationLogic { } /** - * Class needed to format response so the data can be displayed on activity at [MatchView] + * Class needed to format response so the data can be displayed on activity at [MatchFragment] * * @property viewController Reference to the activity where data will be displayed on view */ @@ -33,7 +33,7 @@ class MatchPresenter(var viewController: MatchDisplayLogic? = null) : MatchPrese } /** - * Function that formats data of players to be displayed on [MatchView] + * Function that formats data of players to be displayed on [MatchFragment] * * @param toFormat Data at unformatted stage that needs to be formatted */ diff --git a/project/app/src/main/res/layout/activity_challenger.xml b/project/app/src/main/res/layout/activity_challenger.xml index 29d3c84a..e1cf2a70 100644 --- a/project/app/src/main/res/layout/activity_challenger.xml +++ b/project/app/src/main/res/layout/activity_challenger.xml @@ -18,6 +18,12 @@ app:tabMode="fixed" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + + + tools:context=".MatchScene.MatchFragment"> Hello blank fragment #N UserPicture + Tenistas diff --git a/project/app/src/test/java/com/nexte/nexte/EditProfileScene/EditProfileModelTest.kt b/project/app/src/test/java/com/nexte/nexte/EditProfileScene/EditProfileModelTest.kt index d9129538..e9467949 100644 --- a/project/app/src/test/java/com/nexte/nexte/EditProfileScene/EditProfileModelTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/EditProfileScene/EditProfileModelTest.kt @@ -48,6 +48,9 @@ class EditProfileModelTest { val firstRequest = EditProfileModel.RecoverUserRequest.Request(username, tokenID) val secondRequest = EditProfileModel.EditProfileRequest.Request(player) + firstRequest.tokenID = tokenID + firstRequest.username = username + secondRequest.user = player //assert assertEquals(username, firstRequest.username) assertEquals(tokenID, firstRequest.tokenID) @@ -99,6 +102,10 @@ class EditProfileModelTest { val firstResponse = EditProfileModel.EditProfileRequest.Response(errorID, newPlayer) val secondResponse = EditProfileModel.RecoverUserRequest.Response(newPlayer) + firstResponse.errorID = errorID + firstResponse.newUser = newPlayer + secondResponse.user = newPlayer + //assert assertEquals(firstResponse.errorID, errorID) assertEquals(firstResponse.newUser, newPlayer) @@ -148,6 +155,12 @@ class EditProfileModelTest { username, ranking, club, age, email ) + formattedPlayer.age = age + formattedPlayer.club = club + formattedPlayer.email = email + formattedPlayer.ranking = ranking + formattedPlayer.username = username + //assert assertEquals(formattedPlayer.age, age) assertEquals(formattedPlayer.club, club) @@ -199,6 +212,8 @@ class EditProfileModelTest { val firstViewModel = EditProfileModel.RecoverUserRequest.ViewModel(formattedPlayer) val secondViewModel = EditProfileModel.EditProfileRequest.ViewModel(message) + firstViewModel.playerToEdit = formattedPlayer + secondViewModel.errorMessage = message //assert assertEquals(firstViewModel.playerToEdit, formattedPlayer) assertEquals(secondViewModel.errorMessage, message) @@ -230,4 +245,14 @@ class EditProfileModelTest { assertEquals(firstViewModel.playerToEdit, formattedPlayer) assertEquals(secondViewModel.errorMessage, message) } + + @Test + fun successEditProfileModel(){ + //prepare + //call + val model = EditProfileModel() + + //assert + assertNotNull(model) + } } \ No newline at end of file From 8a66028ced3d8f5bb9e6479a9d096b03d3389ff1 Mon Sep 17 00:00:00 2001 From: Gabriel Albino Date: Wed, 16 May 2018 23:52:37 -0300 Subject: [PATCH 04/11] Converted matching activity to fragmented and added it to the tabs in challenge scene Co-authored-by: Lorrany Freire --- .../nexte/ChallengeScene/ChallengeView.kt | 35 +++---------------- .../main/java/com/nexte/nexte/MainActivity.kt | 9 ----- .../nexte/nexte/MatchScene/MatchFragment.kt | 8 ++++- 3 files changed, 12 insertions(+), 40 deletions(-) diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt index da5cf43b..f94434ab 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt @@ -14,14 +14,11 @@ import com.nexte.nexte.R import kotlinx.android.synthetic.main.activity_challenger_sent.* import kotlinx.android.synthetic.main.columns_challenged.view.* import android.app.AlertDialog -import android.support.v7.widget.LinearLayoutManager import android.widget.Button import android.widget.TextView import com.nexte.nexte.MatchScene.MatchFragment -import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.UserSingleton import kotlinx.android.synthetic.main.activity_challenger.* -import kotlinx.android.synthetic.main.activity_match.* /** @@ -252,29 +249,6 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { viewContext.expandedWins = view?.findViewById(R.id.expandedWins) viewContext.noPlayersText = view?.findViewById(R.id.noPlayersText) } - else if(position == 1) { - val view = inflater?.inflate(R.layout.activity_match, container, false) - this.setUpMatchScene() - - val empty = MatchModel.FormattedMatchData("", 1, - "", 1) - - this.matchViewAdapter = MatchFragment.MatchDataAdapter(empty, this) - matchRecyclerView.adapter = this.matchViewAdapter - matchRecyclerView.layoutManager = LinearLayoutManager(activity) - - /** - * Passing string through intent, once the label of the string to be - * used in this scene is a string thrown by main activity - */ - val prevIntent = activity.intent.getStringExtra("identifier") - val request = MatchModel.InitScene.Request(prevIntent) - interactor?.getInfoMatches(request) - - sendButton.isEnabled = false - - return view!! - } else { view = inflater?.inflate(R.layout.activity_challenger_received, container, false) } @@ -312,10 +286,11 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { } override fun getItem(position: Int): Fragment { - - val tabFragment = TabFragment() - - return tabFragment.getInstance(position) + return if(position == 1){ + MatchFragment().getInstance() + } else{ + TabFragment().getInstance(position) + } } override fun getPageTitle(position: Int): CharSequence { diff --git a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt index b105bead..f95ee277 100644 --- a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt +++ b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt @@ -20,7 +20,6 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) bottom_nav_view.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) - // Setting up feed button listener showProfileButton.setOnClickListener { @@ -39,14 +38,6 @@ class MainActivity : AppCompatActivity() { val intent = Intent(this, LoginView::class.java) startActivity(intent) } - - - //Button to display Match scene - matchButton.setOnClickListener { - val intent = Intent(this, MatchFragment::class.java) - intent.putExtra("identifier", "matchName") - startActivity(intent) - } } val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item -> diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index 29ac9058..ae3cb989 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -1,7 +1,7 @@ package com.nexte.nexte.MatchScene import android.annotation.SuppressLint -import android.app.Fragment +import android.support.v4.app.Fragment import android.os.Bundle import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.RecyclerView @@ -38,6 +38,12 @@ class MatchFragment : Fragment(), MatchDisplayLogic { private var matchViewAdapter: MatchDataAdapter? = null var numberOfSets = MatchModel.SetsNumber.One + //method created because in the future maybe this class will receive arguments. + fun getInstance(): MatchFragment { + val fragmentFirst = MatchFragment() + return fragmentFirst + } + override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View { val view = inflater?.inflate(R.layout.activity_match, container, false) From 32a462f4df691c773254be5b8f72de79b21ba2ee Mon Sep 17 00:00:00 2001 From: Lorrany Date: Thu, 17 May 2018 23:45:10 -0300 Subject: [PATCH 05/11] Created a variable recyclerView *Created a variable reciclerView in MatchScene to treat the exception Co-authored-by: Gabriel Albino --- .../main/java/com/nexte/nexte/MatchScene/MatchFragment.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index ae3cb989..22afd8e0 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -38,6 +38,8 @@ class MatchFragment : Fragment(), MatchDisplayLogic { private var matchViewAdapter: MatchDataAdapter? = null var numberOfSets = MatchModel.SetsNumber.One + var recyclerView: RecyclerView?= null + //method created because in the future maybe this class will receive arguments. fun getInstance(): MatchFragment { val fragmentFirst = MatchFragment() @@ -48,13 +50,14 @@ class MatchFragment : Fragment(), MatchDisplayLogic { val view = inflater?.inflate(R.layout.activity_match, container, false) this.setUpMatchScene() + this.recyclerView = view?.findViewById(R.id.matchRecyclerView) val empty = MatchModel.FormattedMatchData("", 1, "", 1) this.matchViewAdapter = MatchDataAdapter(empty,this) - matchRecyclerView.adapter = this.matchViewAdapter - matchRecyclerView.layoutManager = LinearLayoutManager(activity) + recyclerView?.adapter = this.matchViewAdapter + recyclerView?.layoutManager = LinearLayoutManager(activity) /** * Passing string through intent, once the label of the string to be From 440b0d4506e393af0ae6bb8bb82cfaee058686cc Mon Sep 17 00:00:00 2001 From: Gabriel Albino Date: Thu, 17 May 2018 23:56:05 -0300 Subject: [PATCH 06/11] Added instructions for recovering sendButton widget dinamically Co-authored-by: Alexandre Miguel --- .../main/java/com/nexte/nexte/MatchScene/MatchFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index 22afd8e0..a2bafd1b 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -8,6 +8,7 @@ import android.support.v7.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Button import com.nexte.nexte.R import kotlinx.android.synthetic.main.activity_match.* import kotlinx.android.synthetic.main.row_match_info.view.* @@ -38,6 +39,7 @@ class MatchFragment : Fragment(), MatchDisplayLogic { private var matchViewAdapter: MatchDataAdapter? = null var numberOfSets = MatchModel.SetsNumber.One + var sendButton: Button?= null var recyclerView: RecyclerView?= null //method created because in the future maybe this class will receive arguments. @@ -51,6 +53,7 @@ class MatchFragment : Fragment(), MatchDisplayLogic { val view = inflater?.inflate(R.layout.activity_match, container, false) this.setUpMatchScene() this.recyclerView = view?.findViewById(R.id.matchRecyclerView) + this.sendButton = view?.findViewById(R.id.sendButton) val empty = MatchModel.FormattedMatchData("", 1, "", 1) @@ -67,7 +70,7 @@ class MatchFragment : Fragment(), MatchDisplayLogic { val request = MatchModel.InitScene.Request(prevIntent) interactor?.getInfoMatches(request) - sendButton.isEnabled = false + sendButton?.isEnabled = false return view!! } From 3a4b5bd972ebd6cd18c24643017e828e1ba76163 Mon Sep 17 00:00:00 2001 From: Alexandre Miguel Date: Fri, 18 May 2018 00:31:10 -0300 Subject: [PATCH 07/11] Removed passing parameter as intent in MatchFragment Co-authored-by: Gabriel Albino --- .../main/java/com/nexte/nexte/MatchScene/MatchFragment.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index a2bafd1b..2aaa99a2 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -62,12 +62,7 @@ class MatchFragment : Fragment(), MatchDisplayLogic { recyclerView?.adapter = this.matchViewAdapter recyclerView?.layoutManager = LinearLayoutManager(activity) - /** - * Passing string through intent, once the label of the string to be - * used in this scene is a string thrown by main activity - */ - val prevIntent = activity.intent.getStringExtra("identifier") - val request = MatchModel.InitScene.Request(prevIntent) + val request = MatchModel.InitScene.Request("identifier") interactor?.getInfoMatches(request) sendButton?.isEnabled = false From 6f2880f337f09b6f425d288df68fd8e011c79c37 Mon Sep 17 00:00:00 2001 From: Gabriel Albino Date: Fri, 18 May 2018 22:29:25 -0300 Subject: [PATCH 08/11] Added new flow to challange scene * Now the send challenge button also generate an new match Co-authored-by: Lorrany Freire --- .../nexte/ChallengeScene/ChallengeInteractor.kt | 8 ++++---- .../nexte/nexte/ChallengeScene/ChallengeModel.kt | 10 ++++++++-- .../nexte/ChallengeScene/ChallengePresenter.kt | 15 ++++++++++----- .../nexte/nexte/ChallengeScene/ChallengeView.kt | 13 ++++++++++++- .../nexte/nexte/ChallengeScene/ChallengeWorker.kt | 13 ++++++++++--- .../com/nexte/nexte/MatchScene/MatchFragment.kt | 8 ++++++-- .../main/res/layout/activity_challenger_sent.xml | 14 ++++++++++++++ .../ChallengeScene/ChallengeInteractorTest.kt | 4 ++-- .../ChallengeScene/ChallengePresenterTest.kt | 2 +- .../nexte/ChallengeScene/ChallengeViewTest.kt | 2 +- 10 files changed, 68 insertions(+), 21 deletions(-) diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeInteractor.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeInteractor.kt index 5df68f1b..31eff58b 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeInteractor.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeInteractor.kt @@ -28,7 +28,7 @@ interface ChallengeBusinessLogic { * * @param request variable that gets the request from the 'send challenge' button */ - fun requestMessageForChallenger(request: ChallengeModel.ChallengeButtonRequest.Request) + fun requestChallenger(request: ChallengeModel.ChallengeButtonRequest.Request) } /** @@ -79,10 +79,10 @@ class ChallengeInteractor : ChallengeBusinessLogic { * * @param request */ - override fun requestMessageForChallenger(request: ChallengeModel.ChallengeButtonRequest.Request) { + override fun requestChallenger(request: ChallengeModel.ChallengeButtonRequest.Request) { - worker.fetchMessageForChallenge(request) { response -> - this.presenter?.formatMessage(response) + worker.generateChallenge(request) { response -> + this.presenter?.formatMatch(response) } } } \ No newline at end of file diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeModel.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeModel.kt index 4be36d3a..bc9294bf 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeModel.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeModel.kt @@ -1,4 +1,5 @@ package com.nexte.nexte.ChallengeScene +import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.Player /** @@ -79,16 +80,21 @@ class ChallengeModel { * Responsible for the user of the challenge * * @param username is the challenged user + * @param challenge is the challenge */ - class Response(var username: String) + class Response(var username: String, + var challenge: MatchModel.MatchData) /** * Class responsible to show a confirmation message informing that a challenged * has been sent * * @param messageForChallenger message with the confirmation of the challenge sent + * @param matchMessage indicate the response of the challenge */ - class ViewModel(var messageForChallenger: String) + class ViewModel(var messageForChallenger: String, + var matchMessage: String, + var matchData : MatchModel.MatchData?) } // ---------- Aux classes ---------- diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengePresenter.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengePresenter.kt index 19935018..f5411758 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengePresenter.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengePresenter.kt @@ -25,7 +25,7 @@ interface ChallengePresentationLogic { * * @param response contains unformatted data received from [ChallengeModel] */ - fun formatMessage(response : ChallengeModel.ChallengeButtonRequest.Response) + fun formatMatch(response : ChallengeModel.ChallengeButtonRequest.Response) /** * Method responsible to format the message tho inform that there are no @@ -95,12 +95,17 @@ class ChallengePresenter : ChallengePresentationLogic { * * @param response contains unformatted data received from [ChallengeWorker] */ - override fun formatMessage(response: ChallengeModel.ChallengeButtonRequest.Response) { - val message: String + override fun formatMatch(response: ChallengeModel.ChallengeButtonRequest.Response) { - message = String.format("Desafio enviado com sucesso para o jogador %s", response.username) + val message: String = String.format("Desafio enviado com sucesso para o jogador %s", response.username) - val viewModel = ChallengeModel.ChallengeButtonRequest.ViewModel(message) + val matchMessage: String = if(response.challenge.challenged.name != ""){ + "Você já enviou um desafio" + } else{ + "" + } + + val viewModel = ChallengeModel.ChallengeButtonRequest.ViewModel(message, matchMessage, response.challenge) viewChallenge?.displayMessage(viewModel) diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt index f94434ab..7f1ced65 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt @@ -17,6 +17,7 @@ import android.app.AlertDialog import android.widget.Button import android.widget.TextView import com.nexte.nexte.MatchScene.MatchFragment +import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.UserSingleton import kotlinx.android.synthetic.main.activity_challenger.* @@ -64,6 +65,7 @@ interface ChallengeDisplayLogic { */ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { + var match: MatchModel.MatchData?= null var recyclerView: RecyclerView?= null var sendChallengeButton: Button?= null var expandedLosses: TextView?= null @@ -71,6 +73,7 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { var expandedRankingTextView: TextView?= null var expandedName: TextView?= null var noPlayersText: TextView?= null + var message: TextView?= null var interactor: ChallengeBusinessLogic? = null private val context: Context? = null @@ -136,6 +139,13 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { */ override fun displayMessage(viewModel: ChallengeModel.ChallengeButtonRequest.ViewModel) { + if(viewModel.matchMessage != ""){ + this.match = viewModel.matchData + this.message?.text = viewModel.matchMessage + this.sendChallengeButton?.isEnabled = false + } + + val builder = AlertDialog.Builder(this) builder.setCancelable(true) @@ -248,6 +258,7 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { viewContext.expandedRankingTextView = view?.findViewById(R.id.expandedRankingTextView) viewContext.expandedWins = view?.findViewById(R.id.expandedWins) viewContext.noPlayersText = view?.findViewById(R.id.noPlayersText) + viewContext.message = view?.findViewById(R.id.message) } else { view = inflater?.inflate(R.layout.activity_challenger_received, container, false) @@ -263,7 +274,7 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { sendChallengeButton?.setOnClickListener { val request = ChallengeModel.ChallengeButtonRequest.Request(this.expandedName.text.toString()) - (context as ChallengeView).interactor?.requestMessageForChallenger(request) + (context as ChallengeView).interactor?.requestChallenger(request) } val request = ChallengeModel.ShowRankingPlayersRequest.Request(UserSingleton.getUserInformations().rankingPosition) diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeWorker.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeWorker.kt index 52efd20d..84513245 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeWorker.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeWorker.kt @@ -1,6 +1,9 @@ package com.nexte.nexte.ChallengeScene +import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.Player +import com.nexte.nexte.R +import com.nexte.nexte.UserSingleton /** * Class responsible to do request for anywhere, format Response and @@ -67,12 +70,16 @@ class ChallengeWorker { * @param request Challenge Model request that contains needed information to send to server * @param completion Method to call on parent class */ - fun fetchMessageForChallenge(request: ChallengeModel.ChallengeButtonRequest.Request, - completion: (ChallengeModel.ChallengeButtonRequest.Response) -> Unit) { + fun generateChallenge(request: ChallengeModel.ChallengeButtonRequest.Request, + completion: (ChallengeModel.ChallengeButtonRequest.Response) -> Unit) { val user = request.userChallenged - val response = ChallengeModel.ChallengeButtonRequest.Response(user) + val challenged = MatchModel.MatchPlayer(user, R.mipmap.ic_launcher_round) + val challenger = MatchModel.MatchPlayer(UserSingleton.getUserInformations().name, R.mipmap.ic_launcher_round) + val match = MatchModel.MatchData(challenged, challenger) + + val response = ChallengeModel.ChallengeButtonRequest.Response(user, match) completion(response) diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index a2bafd1b..c37050a8 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -9,8 +9,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button +import com.nexte.nexte.ChallengeScene.ChallengeModel import com.nexte.nexte.R -import kotlinx.android.synthetic.main.activity_match.* import kotlinx.android.synthetic.main.row_match_info.view.* import kotlinx.android.synthetic.main.row_match_time.view.* import java.text.SimpleDateFormat @@ -43,8 +43,12 @@ class MatchFragment : Fragment(), MatchDisplayLogic { var recyclerView: RecyclerView?= null //method created because in the future maybe this class will receive arguments. - fun getInstance(): MatchFragment { + fun getInstance(challenge: MatchModel.MatchData): MatchFragment { val fragmentFirst = MatchFragment() + val bundle = Bundle() + + fragmentFirst.arguments = bundle + return fragmentFirst } diff --git a/project/app/src/main/res/layout/activity_challenger_sent.xml b/project/app/src/main/res/layout/activity_challenger_sent.xml index 7b61a81d..1ec72a14 100644 --- a/project/app/src/main/res/layout/activity_challenger_sent.xml +++ b/project/app/src/main/res/layout/activity_challenger_sent.xml @@ -99,6 +99,20 @@ app:layout_constraintHorizontal_bias="0.497" app:layout_constraintStart_toStartOf="parent" /> + + \ No newline at end of file diff --git a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeInteractorTest.kt b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeInteractorTest.kt index dc5708ab..193fb65f 100644 --- a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeInteractorTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeInteractorTest.kt @@ -59,7 +59,7 @@ class ChallengeInteractorTest { val expectedResult = true //call - interactor?.requestMessageForChallenger(request) + interactor?.requestChallenger(request) //assert assertEquals(expectedResult, this.mock?.passedHere) @@ -107,7 +107,7 @@ private class MockChallengePresentationLogic: ChallengePresentationLogic{ passedHere = true } - override fun formatMessage(response: ChallengeModel.ChallengeButtonRequest.Response) { + override fun formatMatch(response: ChallengeModel.ChallengeButtonRequest.Response) { passedHere = true } diff --git a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt index b282eaed..f7b57f2b 100644 --- a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt @@ -73,7 +73,7 @@ class ChallengePresenterTest { val response = ChallengeModel.ChallengeButtonRequest.Response("larissa") //call - this.presenter?.formatMessage(response) + this.presenter?.formatMatch(response) //assert assertNotNull(this.mock?.formattedMessageToShow) diff --git a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeViewTest.kt b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeViewTest.kt index 55a6fd64..cef2592b 100644 --- a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeViewTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeViewTest.kt @@ -59,7 +59,7 @@ class ChallengeViewTest { hasBeenCalled = true } - override fun requestMessageForChallenger(request: ChallengeModel.ChallengeButtonRequest.Request) { + override fun requestChallenger(request: ChallengeModel.ChallengeButtonRequest.Request) { hasBeenCalled = true } From 083cb746f14fce9dedcf693bfae76ab2c2656450 Mon Sep 17 00:00:00 2001 From: Lorrany Date: Fri, 18 May 2018 23:33:35 -0300 Subject: [PATCH 09/11] Sent challenge displayed * None sent Challenge displayed * Show the tab about sent challenge Co-authored-by: Gabriel Albino --- .../nexte/ChallengeScene/ChallengeView.kt | 9 ++- .../nexte/nexte/MatchScene/MatchFragment.kt | 57 +++++++++++++------ .../main/res/layout/fragment_nochallenge.xml | 12 ++++ 3 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 project/app/src/main/res/layout/fragment_nochallenge.xml diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt index 7f1ced65..fa7deb21 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt @@ -86,7 +86,7 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { super.onCreate(savedInstanceState) this.setContentView(R.layout.activity_challenger) this.setupChallengeScene() - viewpager.adapter = ViewPagerAdapter(supportFragmentManager) + viewpager.adapter = ViewPagerAdapter(supportFragmentManager, this) tabs.setupWithViewPager(viewpager) } @@ -151,7 +151,9 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { builder.setCancelable(true) builder.setMessage(viewModel.messageForChallenger) builder.setPositiveButton("Ok", { dialogInterface, _ -> + this.tabs.getTabAt(1)?.select() dialogInterface.cancel() + }) val alert = builder.create() @@ -287,7 +289,8 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { /** * Adapter Class that populates the fragment */ - class ViewPagerAdapter (fragmentManager: FragmentManager) : FragmentPagerAdapter(fragmentManager) { + class ViewPagerAdapter (fragmentManager: FragmentManager, + var context: Context) : FragmentPagerAdapter(fragmentManager) { private val pageTitles = listOf("Tenistas", "Enviados", "Recebidos") @@ -298,7 +301,7 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { override fun getItem(position: Int): Fragment { return if(position == 1){ - MatchFragment().getInstance() + MatchFragment().getInstance((context as ChallengeView).match) } else{ TabFragment().getInstance(position) } diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index a14a6368..bf7eba69 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -9,7 +9,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button -import com.nexte.nexte.ChallengeScene.ChallengeModel import com.nexte.nexte.R import kotlinx.android.synthetic.main.row_match_info.view.* import kotlinx.android.synthetic.main.row_match_time.view.* @@ -39,37 +38,63 @@ class MatchFragment : Fragment(), MatchDisplayLogic { private var matchViewAdapter: MatchDataAdapter? = null var numberOfSets = MatchModel.SetsNumber.One - var sendButton: Button?= null - var recyclerView: RecyclerView?= null + private var sendButton: Button?= null + private var recyclerView: RecyclerView?= null + var challenged: String = "" + var challenger: String = "" + var hasChallenge: Int = 0 //method created because in the future maybe this class will receive arguments. - fun getInstance(challenge: MatchModel.MatchData): MatchFragment { + fun getInstance(challenge: MatchModel.MatchData?): MatchFragment { val fragmentFirst = MatchFragment() val bundle = Bundle() + bundle.putString("Challenger", challenge?.challenger?.name) + bundle.putString("Challenged", challenge?.challenged?.name) + if(challenge == null){ + bundle.putInt("HasChallenge", 0) + } + else { + bundle.putInt("HasChallenge", 1) + } + fragmentFirst.arguments = bundle return fragmentFirst } + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + this.challenged = arguments.getString("Challenged") + this.challenger = arguments.getString("Challenger") + this.hasChallenge = arguments.getInt("HasChallenge") + } + override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View { - val view = inflater?.inflate(R.layout.activity_match, container, false) - this.setUpMatchScene() - this.recyclerView = view?.findViewById(R.id.matchRecyclerView) - this.sendButton = view?.findViewById(R.id.sendButton) + val view: View? + if(hasChallenge == 1) { + view = inflater?.inflate(R.layout.activity_match, container, false) + this.setUpMatchScene() + this.recyclerView = view?.findViewById(R.id.matchRecyclerView) + this.sendButton = view?.findViewById(R.id.sendButton) - val empty = MatchModel.FormattedMatchData("", 1, - "", 1) + val match = MatchModel.FormattedMatchData(challenged, 1, + challenger, 1) - this.matchViewAdapter = MatchDataAdapter(empty,this) - recyclerView?.adapter = this.matchViewAdapter - recyclerView?.layoutManager = LinearLayoutManager(activity) + this.matchViewAdapter = MatchDataAdapter(match, this) + recyclerView?.adapter = this.matchViewAdapter + recyclerView?.layoutManager = LinearLayoutManager(activity) - val request = MatchModel.InitScene.Request("identifier") - interactor?.getInfoMatches(request) + val request = MatchModel.InitScene.Request("identifier") + interactor?.getInfoMatches(request) - sendButton?.isEnabled = false + sendButton?.isEnabled = false + } + else { + view = inflater?.inflate(R.layout.fragment_nochallenge, container, false) + } return view!! } diff --git a/project/app/src/main/res/layout/fragment_nochallenge.xml b/project/app/src/main/res/layout/fragment_nochallenge.xml new file mode 100644 index 00000000..cd6859d6 --- /dev/null +++ b/project/app/src/main/res/layout/fragment_nochallenge.xml @@ -0,0 +1,12 @@ + + + + + From bf884a8b3f78df161eaf76ff2619e5f412504200 Mon Sep 17 00:00:00 2001 From: Gabriel Albino Date: Sat, 19 May 2018 22:26:39 -0300 Subject: [PATCH 10/11] Finished flow to challenge new player * Now the sent challenge fragment changes according with the match setted in the view * Fixed weighted smells * Fixed unit tests Co-authored-by: Lorrany Freire --- .../nexte/ChallengeScene/ChallengeView.kt | 21 +++++++++++++++---- .../main/java/com/nexte/nexte/MainActivity.kt | 1 - .../nexte/nexte/MatchScene/MatchFragment.kt | 20 +++++++++++------- .../com/nexte/nexte/MatchScene/MatchModel.kt | 4 ++-- .../com/nexte/nexte/MatchScene/MatchWorker.kt | 11 +++++++--- .../res/layout/activity_challenger_sent.xml | 3 ++- .../ChallengeScene/ChallengeModelTest.kt | 20 +++++++++++++----- .../ChallengeScene/ChallengePresenterTest.kt | 6 +++++- .../nexte/MatchScene/MatchInteractorTest.kt | 5 ++++- .../nexte/nexte/MatchScene/MatchModelTest.kt | 13 ++++++------ .../nexte/nexte/MatchScene/MatchWorkerTest.kt | 10 +++++---- 11 files changed, 79 insertions(+), 35 deletions(-) diff --git a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt index fa7deb21..5f47a51d 100644 --- a/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt +++ b/project/app/src/main/java/com/nexte/nexte/ChallengeScene/ChallengeView.kt @@ -4,7 +4,6 @@ import android.content.Context import android.os.Bundle import android.support.v4.app.Fragment import android.support.v4.app.FragmentManager -import android.support.v4.app.FragmentPagerAdapter import android.support.v7.app.AppCompatActivity import android.support.v7.widget.RecyclerView import android.view.LayoutInflater @@ -14,6 +13,8 @@ import com.nexte.nexte.R import kotlinx.android.synthetic.main.activity_challenger_sent.* import kotlinx.android.synthetic.main.columns_challenged.view.* import android.app.AlertDialog +import android.support.v4.app.FragmentStatePagerAdapter +import android.support.v4.view.PagerAdapter import android.widget.Button import android.widget.TextView import com.nexte.nexte.MatchScene.MatchFragment @@ -142,7 +143,9 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { if(viewModel.matchMessage != ""){ this.match = viewModel.matchData this.message?.text = viewModel.matchMessage + this.message?.visibility = View.VISIBLE this.sendChallengeButton?.isEnabled = false + this.viewpager.adapter.notifyDataSetChanged() } @@ -153,7 +156,6 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { builder.setPositiveButton("Ok", { dialogInterface, _ -> this.tabs.getTabAt(1)?.select() dialogInterface.cancel() - }) val alert = builder.create() @@ -261,6 +263,9 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { viewContext.expandedWins = view?.findViewById(R.id.expandedWins) viewContext.noPlayersText = view?.findViewById(R.id.noPlayersText) viewContext.message = view?.findViewById(R.id.message) + if(viewContext.match != null){ + viewContext.message?.visibility = View.VISIBLE + } } else { view = inflater?.inflate(R.layout.activity_challenger_received, container, false) @@ -282,7 +287,6 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { val request = ChallengeModel.ShowRankingPlayersRequest.Request(UserSingleton.getUserInformations().rankingPosition) (context as ChallengeView).interactor?.requestPlayersToChallenge(request) } - } } @@ -290,10 +294,14 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { * Adapter Class that populates the fragment */ class ViewPagerAdapter (fragmentManager: FragmentManager, - var context: Context) : FragmentPagerAdapter(fragmentManager) { + var context: Context) : FragmentStatePagerAdapter(fragmentManager) { private val pageTitles = listOf("Tenistas", "Enviados", "Recebidos") + override fun getItemPosition(`object`: Any?): Int { + return PagerAdapter.POSITION_NONE + } + override fun getCount(): Int { return pageTitles.size @@ -371,6 +379,11 @@ class ChallengeView : AppCompatActivity(), ChallengeDisplayLogic { context.removePlayerDetailedInfo() context.sendChallengeButton?.isEnabled = false } + if(context.match != null){ + context.sendChallengeButton?.isEnabled = false + } + + } override fun getItemCount(): Int { diff --git a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt index f95ee277..37108b54 100644 --- a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt +++ b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt @@ -8,7 +8,6 @@ import com.nexte.nexte.LoginScene.* import com.nexte.nexte.RankingScene.RankingView import com.nexte.nexte.ShowProfileScene.ShowProfileView import com.nexte.nexte.ChallengeScene.ChallengeView -import com.nexte.nexte.MatchScene.MatchFragment import kotlinx.android.synthetic.main.activity_main.* import android.support.design.widget.BottomNavigationView diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt index bf7eba69..72ce4d93 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchFragment.kt @@ -42,20 +42,21 @@ class MatchFragment : Fragment(), MatchDisplayLogic { private var recyclerView: RecyclerView?= null var challenged: String = "" var challenger: String = "" - var hasChallenge: Int = 0 + private var hasChallenge: Int = 0 //method created because in the future maybe this class will receive arguments. fun getInstance(challenge: MatchModel.MatchData?): MatchFragment { val fragmentFirst = MatchFragment() val bundle = Bundle() - - bundle.putString("Challenger", challenge?.challenger?.name) - bundle.putString("Challenged", challenge?.challenged?.name) if(challenge == null){ bundle.putInt("HasChallenge", 0) + bundle.putString("Challenger", "") + bundle.putString("Challenged", "") } else { bundle.putInt("HasChallenge", 1) + bundle.putString("Challenger", challenge.challenger.name) + bundle.putString("Challenged", challenge.challenged.name) } fragmentFirst.arguments = bundle @@ -80,14 +81,19 @@ class MatchFragment : Fragment(), MatchDisplayLogic { this.recyclerView = view?.findViewById(R.id.matchRecyclerView) this.sendButton = view?.findViewById(R.id.sendButton) - val match = MatchModel.FormattedMatchData(challenged, 1, - challenger, 1) + val match = MatchModel.FormattedMatchData(challenged, + R.mipmap.ic_launcher_round, + challenger, + R.mipmap.ic_launcher_round) this.matchViewAdapter = MatchDataAdapter(match, this) recyclerView?.adapter = this.matchViewAdapter recyclerView?.layoutManager = LinearLayoutManager(activity) - val request = MatchModel.InitScene.Request("identifier") + val request = MatchModel.InitScene.Request(MatchModel.MatchData( + MatchModel.MatchPlayer(challenged, R.mipmap.ic_launcher_round), + MatchModel.MatchPlayer(challenger, R.mipmap.ic_launcher_round) + )) interactor?.getInfoMatches(request) sendButton?.isEnabled = false diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchModel.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchModel.kt index 4fbe8de8..821540dc 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchModel.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchModel.kt @@ -21,9 +21,9 @@ class MatchModel { * Class responsible to receive the ID of the challenge and passing it to * request other informations on worker * - * @param matchID identifier of the challenge that needs to be found + * @param match match that will be displayed */ - class Request(var matchID: String) + class Request(var match: MatchData?) /** * Class responsible to pass the unformmated elements from worker to presenter diff --git a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchWorker.kt b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchWorker.kt index b55c7a7a..9e652820 100644 --- a/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchWorker.kt +++ b/project/app/src/main/java/com/nexte/nexte/MatchScene/MatchWorker.kt @@ -20,7 +20,12 @@ class MatchWorker { */ fun fetchMatchData (request: MatchModel.InitScene.Request, completion: (MatchModel.InitScene.Response) -> Unit) { - val response = MatchModel.InitScene.Response (this.generateMatchData()) + val response = if(request.match == null) { + MatchModel.InitScene.Response (this.generateMatchData()) + } + else{ + MatchModel.InitScene.Response(request.match!!) + } completion(response) } @@ -30,9 +35,9 @@ class MatchWorker { */ fun generateMatchData() : MatchModel.MatchData{ - var challenger = MatchModel.MatchPlayer("Letícia", R.mipmap.ic_launcher ) + val challenger = MatchModel.MatchPlayer("Letícia", R.mipmap.ic_launcher ) - var challenged = MatchModel.MatchPlayer("Alexandre Miguel", R.mipmap.ic_launcher ) + val challenged = MatchModel.MatchPlayer("Alexandre Miguel", R.mipmap.ic_launcher ) val match = MatchModel.MatchData(challenger, challenged) diff --git a/project/app/src/main/res/layout/activity_challenger_sent.xml b/project/app/src/main/res/layout/activity_challenger_sent.xml index 1ec72a14..abeb8d36 100644 --- a/project/app/src/main/res/layout/activity_challenger_sent.xml +++ b/project/app/src/main/res/layout/activity_challenger_sent.xml @@ -106,9 +106,10 @@ android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" - android:text="" + android:text="Você já enviou um desafio" android:textAppearance="@style/TextAppearance.AppCompat.Button" android:textColor="@android:color/background_light" + android:visibility="invisible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/sendChallengeButton" /> diff --git a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeModelTest.kt b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeModelTest.kt index 4018b779..b58bd158 100644 --- a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeModelTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengeModelTest.kt @@ -1,5 +1,6 @@ package com.nexte.nexte.ChallengeScene +import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.Player import org.junit.After import org.junit.Assert.* @@ -155,13 +156,17 @@ class ChallengeModelTest{ fun successThirdResponse(){ //prepare val user = "larissa" + val match = MatchModel.MatchData( + MatchModel.MatchPlayer("larissa", 1), + MatchModel.MatchPlayer("larissa2", 1)) //call - val response = ChallengeModel.ChallengeButtonRequest.Response(user) + val response = ChallengeModel.ChallengeButtonRequest.Response(user, match) response.username = user - + response.challenge = match //assert assertEquals(response.username, user) + assertEquals(response.challenge, match) } @Test @@ -210,13 +215,18 @@ class ChallengeModelTest{ fun successThirdViewModel(){ //prepare val message = "Sucesso" - + val matchData = MatchModel.MatchData( + MatchModel.MatchPlayer("larissa", 1), + MatchModel.MatchPlayer("larissa2", 1)) //call - val viewModel = ChallengeModel.ChallengeButtonRequest.ViewModel(message) + val viewModel = ChallengeModel.ChallengeButtonRequest.ViewModel(message, message, matchData) + viewModel.messageForChallenger = message + viewModel.matchData = matchData viewModel.messageForChallenger = message - //assert assertEquals(viewModel.messageForChallenger, message) + assertEquals(viewModel.matchMessage, message) + assertEquals(viewModel.matchData, matchData) } @Test diff --git a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt index f7b57f2b..f9438c9b 100644 --- a/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/ChallengeScene/ChallengePresenterTest.kt @@ -1,5 +1,6 @@ package com.nexte.nexte.ChallengeScene +import com.nexte.nexte.MatchScene.MatchModel import com.nexte.nexte.Player import org.junit.After import org.junit.Test @@ -70,7 +71,10 @@ class ChallengePresenterTest { @Test fun successFormatMessage() { //prepare - val response = ChallengeModel.ChallengeButtonRequest.Response("larissa") + val match = MatchModel.MatchData( + MatchModel.MatchPlayer("larissa", 1), + MatchModel.MatchPlayer("larissa2", 1)) + val response = ChallengeModel.ChallengeButtonRequest.Response("larissa", match) //call this.presenter?.formatMatch(response) diff --git a/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchInteractorTest.kt b/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchInteractorTest.kt index 7ef91ff1..cad18e6d 100644 --- a/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchInteractorTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchInteractorTest.kt @@ -20,7 +20,10 @@ class MatchInteractorTest { @Test fun testGetInfoMatches() { //prepare - val request = MatchModel.InitScene.Request("abcd123") + val matchData = MatchModel.MatchData( + MatchModel.MatchPlayer("larissa", 1), + MatchModel.MatchPlayer("larissa2", 1)) + val request = MatchModel.InitScene.Request(matchData) //call this.interactor?.getInfoMatches(request) diff --git a/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchModelTest.kt b/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchModelTest.kt index 01e9b3c4..a333c967 100644 --- a/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchModelTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchModelTest.kt @@ -1,6 +1,5 @@ package com.nexte.nexte.MatchScene -import com.fasterxml.jackson.databind.deser.DataFormatReaders import com.nexte.nexte.R import org.junit.Assert.* import org.junit.Before @@ -16,7 +15,7 @@ class MatchModelTest { fun testMatchModel() { //prepare //call - var testClass = MatchModel() + val testClass = MatchModel() //assert assertNotNull(testClass) @@ -26,7 +25,7 @@ class MatchModelTest { fun testInitScene() { //prepare //call - var testInit = MatchModel.InitScene() + val testInit = MatchModel.InitScene() //assert assertNotNull(testInit) @@ -35,13 +34,15 @@ class MatchModelTest { @Test fun testRequest() { //prepare - val identifierMatch = "abcd1234" + val matchData = MatchModel.MatchData( + MatchModel.MatchPlayer("larissa", 1), + MatchModel.MatchPlayer("larissa2", 1)) //call - val request = MatchModel.InitScene.Request(identifierMatch) + val request = MatchModel.InitScene.Request(matchData) //assert - assertEquals(request.matchID, identifierMatch) + assertEquals(request.match, matchData) } @Test diff --git a/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchWorkerTest.kt b/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchWorkerTest.kt index a901647a..b449a465 100644 --- a/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchWorkerTest.kt +++ b/project/app/src/test/java/com/nexte/nexte/MatchScene/MatchWorkerTest.kt @@ -1,6 +1,5 @@ package com.nexte.nexte.MatchScene -import com.nexte.nexte.ChallengeScene.ChallengeWorker import org.junit.After import org.junit.Before import org.junit.Test @@ -18,13 +17,16 @@ class MatchWorkerTest { @Test fun testFetchMatchDatas() { //prepare - val request = MatchModel.InitScene.Request("1234abcd") + val match = MatchModel.MatchData( + MatchModel.MatchPlayer("larissa", 1), + MatchModel.MatchPlayer("larissa2", 1)) + val request = MatchModel.InitScene.Request(match) //calls worker?.fetchMatchData(request = request, completion = {response -> //asserts - assertEquals("Letícia", response.match.challenged.name) - assertEquals("Alexandre Miguel", response.match.challenger.name) + assertEquals("larissa", response.match.challenged.name) + assertEquals("larissa2", response.match.challenger.name) }) } From 2f7a816ac8c274667bd6bd77839bc03f5e675b4f Mon Sep 17 00:00:00 2001 From: Luis Gustavo Date: Mon, 21 May 2018 13:54:58 -0300 Subject: [PATCH 11/11] Fixed static analisys --- .../com/nexte/nexte/Entities/Story/StoryAdapterRealm.kt | 6 +++++- project/app/src/main/java/com/nexte/nexte/MainActivity.kt | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/project/app/src/main/java/com/nexte/nexte/Entities/Story/StoryAdapterRealm.kt b/project/app/src/main/java/com/nexte/nexte/Entities/Story/StoryAdapterRealm.kt index 243e8d56..a444a5b1 100644 --- a/project/app/src/main/java/com/nexte/nexte/Entities/Story/StoryAdapterRealm.kt +++ b/project/app/src/main/java/com/nexte/nexte/Entities/Story/StoryAdapterRealm.kt @@ -102,7 +102,11 @@ class StoryAdapterRealm: StoryAdapter{ likesIdRealmList.add(like) } - val storyRealm = StoryRealm(id = id, winnerId = winnerId, winnerSetResult = winnerSetResult, loserId = loserId, loserSetResult = loserSetResult, date = date, commentsId = commentsIdRealmList, likesId = likesIdRealmList) + val storyRealm = StoryRealm(id = id, winnerId = winnerId, + winnerSetResult = winnerSetResult, loserId = loserId, + loserSetResult = loserSetResult, date = date, + commentsId = commentsIdRealmList, + likesId = likesIdRealmList) return storyRealm } diff --git a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt index 9467575d..3cd43acf 100644 --- a/project/app/src/main/java/com/nexte/nexte/MainActivity.kt +++ b/project/app/src/main/java/com/nexte/nexte/MainActivity.kt @@ -6,7 +6,6 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import com.nexte.nexte.LoginScene.* import com.nexte.nexte.ShowProfileScene.ShowProfileView -import com.nexte.nexte.ChallengeScene.ChallengeView import kotlinx.android.synthetic.main.activity_main.* import android.support.design.widget.BottomNavigationView import android.support.v4.app.Fragment