├── app ├── .gitignore ├── src │ ├── main │ │ ├── assets │ │ │ ├── 2_french_ligue_1.png │ │ │ ├── 4_italian_serie_a.png │ │ │ ├── 5_spanish_la_liga.png │ │ │ ├── 10_english_league_1.png │ │ │ ├── 3_german_bundesliga.png │ │ │ ├── 8_australian_a_league.png │ │ │ ├── 1_english_premier_league.png │ │ │ ├── 6_american_mayor_league.png │ │ │ ├── 9_scotish_premier_league.png │ │ │ ├── 7_portugeuese_premiera_liga.png │ │ │ ├── TODO.txt │ │ │ └── league.json │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── ids.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── menu │ │ │ │ ├── detail_match_menu.xml │ │ │ │ ├── action_menu.xml │ │ │ │ └── main_activity_menu.xml │ │ │ ├── drawable │ │ │ │ ├── ic_favorite_black_24dp.xml │ │ │ │ ├── ic_star_border_black_24dp.xml │ │ │ │ ├── ic_search_black_24dp.xml │ │ │ │ ├── ic_favorite_border_black_24dp.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ │ ├── main_activity.xml │ │ │ │ ├── liga_item.xml │ │ │ │ ├── activity_pencarian.xml │ │ │ │ ├── activity_favorit.xml │ │ │ │ └── detail_match_activity.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── dizcoding │ │ │ │ └── kadesubmission2 │ │ │ │ ├── model │ │ │ │ ├── Flist.kt │ │ │ │ ├── Leagues.kt │ │ │ │ ├── AllTeamResponse.kt │ │ │ │ ├── MatchResponse.kt │ │ │ │ ├── SearchResponse.kt │ │ │ │ ├── DetailLigaResponse.kt │ │ │ │ ├── DetailPertandinganResponse.kt │ │ │ │ ├── League.kt │ │ │ │ ├── Team.kt │ │ │ │ └── Event.kt │ │ │ │ ├── tools │ │ │ │ └── Utils.kt │ │ │ │ ├── interfaceclass │ │ │ │ └── FragmentNavigationListener.kt │ │ │ │ ├── adapter │ │ │ │ ├── ViewPagerNextPrevAdapter.kt │ │ │ │ ├── ViewPagerLigaAdapter.kt │ │ │ │ └── MatchAdapter.kt │ │ │ │ ├── api │ │ │ │ ├── local │ │ │ │ │ └── DataLeague.kt │ │ │ │ ├── apiservice │ │ │ │ │ └── TheSportDbService.kt │ │ │ │ └── TheSportDbApi.kt │ │ │ │ ├── layout │ │ │ │ ├── fragment │ │ │ │ │ ├── NextMatchFragmentLayout.kt │ │ │ │ │ ├── PrefMatchFragmentLayout.kt │ │ │ │ │ └── BaseFragmentLayout.kt │ │ │ │ ├── activity │ │ │ │ │ └── LigaDetailLayout.kt │ │ │ │ └── adapter │ │ │ │ │ └── MatchItemLayout.kt │ │ │ │ ├── activity │ │ │ │ ├── DetailLigaActivity.kt │ │ │ │ ├── Pencarian.kt │ │ │ │ ├── Favorit.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ └── DetailMatchActivity.kt │ │ │ │ ├── fragment │ │ │ │ ├── NextMatchFragment.kt │ │ │ │ ├── PrevMatchFragment.kt │ │ │ │ └── BaseFragment.kt │ │ │ │ └── db │ │ │ │ ├── DbFavoriteMatch.kt │ │ │ │ └── table │ │ │ │ └── FavoriteMatch.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── dizcoding │ │ │ └── kadesubmission2 │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── dizcoding │ │ └── kadesubmission2 │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml └── runConfigurations.xml ├── gradle.properties ├── gradlew.bat ├── .gitignore └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='KadeSubmission2' 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/assets/2_french_ligue_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/2_french_ligue_1.png -------------------------------------------------------------------------------- /app/src/main/assets/4_italian_serie_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/4_italian_serie_a.png -------------------------------------------------------------------------------- /app/src/main/assets/5_spanish_la_liga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/5_spanish_la_liga.png -------------------------------------------------------------------------------- /app/src/main/assets/10_english_league_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/10_english_league_1.png -------------------------------------------------------------------------------- /app/src/main/assets/3_german_bundesliga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/3_german_bundesliga.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/assets/8_australian_a_league.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/8_australian_a_league.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/assets/1_english_premier_league.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/1_english_premier_league.png -------------------------------------------------------------------------------- /app/src/main/assets/6_american_mayor_league.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/6_american_mayor_league.png -------------------------------------------------------------------------------- /app/src/main/assets/9_scotish_premier_league.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/9_scotish_premier_league.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/assets/7_portugeuese_premiera_liga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/assets/7_portugeuese_premiera_liga.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gandhi-wibowo/kadesub2/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | KadeSubmission2 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/Flist.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import androidx.fragment.app.Fragment 4 | 5 | data class Flist(val title: String, val fragment: Fragment) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Nov 16 18:26:33 WIB 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/Leagues.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import kotlinx.android.parcel.Parcelize 5 | 6 | @Parcelize 7 | data class Leagues( 8 | val description: String, 9 | val id: String, 10 | val logo: String, 11 | val name: String 12 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | #1F262D 8 | #FFFFFF 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/AllTeamResponse.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class AllTeamResponse( 9 | @SerializedName("teams") 10 | val teams: List 11 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/MatchResponse.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class MatchResponse( 9 | @SerializedName("events") 10 | val events: List 11 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/SearchResponse.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class SearchResponse( 9 | @SerializedName("event") 10 | val event: List 11 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/tools/Utils.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.tools 2 | 3 | import android.widget.ImageView 4 | import com.squareup.picasso.Picasso 5 | 6 | class Utils { 7 | 8 | fun picShow(img: String, imgView: ImageView) { 9 | Picasso 10 | .get() 11 | .load(img) 12 | .into(imgView) 13 | } 14 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/DetailLigaResponse.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class DetailLigaResponse( 9 | @SerializedName("leagues") 10 | val leagues: List 11 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/DetailPertandinganResponse.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class DetailPertandinganResponse( 9 | @SerializedName("events") 10 | val events: List 11 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/res/menu/detail_match_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/action_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /app/src/test/java/com/dizcoding/kadesubmission2/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star_border_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/interfaceclass/FragmentNavigationListener.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.interfaceclass 2 | 3 | 4 | import android.view.View 5 | import com.dizcoding.kadesubmission2.model.Event 6 | import com.dizcoding.kadesubmission2.model.Leagues 7 | 8 | interface FragmentNavigationListener { 9 | 10 | fun onMatchItemSelected(data: Event) 11 | 12 | fun openFragment() 13 | fun loadData(v: View) 14 | 15 | fun refreshNextMatch(v: View) 16 | fun refreshPrevMatch(v: View) 17 | 18 | fun pagerAdapterDetails(data: Leagues) 19 | fun pagerAdapterSelected(data: Leagues) 20 | 21 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/main_activity_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite_border_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/adapter/ViewPagerNextPrevAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.adapter 2 | 3 | import androidx.fragment.app.Fragment 4 | import androidx.fragment.app.FragmentManager 5 | import androidx.fragment.app.FragmentPagerAdapter 6 | import com.dizcoding.kadesubmission2.model.Flist 7 | 8 | class ViewPagerNextPrevAdapter(fm: FragmentManager, val flist: List = listOf()) : 9 | FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { 10 | 11 | override fun getItem(position: Int): Fragment = flist[position].fragment 12 | 13 | override fun getCount(): Int = flist.size 14 | 15 | override fun getPageTitle(position: Int): CharSequence? = flist[position].title 16 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/api/local/DataLeague.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.api.local 2 | 3 | import android.content.Context 4 | import com.dizcoding.kadesubmission2.model.Leagues 5 | import com.github.salomonbrys.kotson.fromJson 6 | import com.google.gson.Gson 7 | import java.io.InputStream 8 | 9 | class DataLeague(private val context: Context) { 10 | 11 | private val gson: Gson = Gson() 12 | 13 | private fun data() : String{ 14 | return try { 15 | val inputStream : InputStream = context.assets.open("league.json") 16 | val inputString = inputStream.bufferedReader().use{it.readText()} 17 | inputString 18 | } catch (e:Exception){ 19 | e.toString() 20 | } 21 | } 22 | 23 | fun get() : ArrayList = gson.fromJson(data()) 24 | 25 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/dizcoding/kadesubmission2/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.dizcoding.kadesubmission2", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/layout/fragment/NextMatchFragmentLayout.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.layout.fragment 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.dizcoding.kadesubmission2.R 8 | import org.jetbrains.anko.AnkoComponent 9 | import org.jetbrains.anko.AnkoContext 10 | import org.jetbrains.anko.matchParent 11 | import org.jetbrains.anko.recyclerview.v7.recyclerView 12 | 13 | class NextMatchFragmentLayout : AnkoComponent { 14 | 15 | override fun createView(ui: AnkoContext): View = with(ui) { 16 | recyclerView { 17 | id = R.id.nmFrv 18 | lparams(matchParent, matchParent) 19 | layoutManager = LinearLayoutManager(ctx, RecyclerView.VERTICAL, false) 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/layout/fragment/PrefMatchFragmentLayout.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.layout.fragment 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.dizcoding.kadesubmission2.R 8 | import org.jetbrains.anko.AnkoComponent 9 | import org.jetbrains.anko.AnkoContext 10 | import org.jetbrains.anko.matchParent 11 | import org.jetbrains.anko.recyclerview.v7.recyclerView 12 | 13 | class PrefMatchFragmentLayout : AnkoComponent { 14 | 15 | override fun createView(ui: AnkoContext): View = with(ui) { 16 | recyclerView { 17 | id = R.id.pmFrv 18 | lparams(matchParent, matchParent) 19 | layoutManager = LinearLayoutManager(ctx, RecyclerView.VERTICAL, false) 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/activity/DetailLigaActivity.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.activity 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import com.dizcoding.kadesubmission2.layout.activity.LigaDetailLayout 6 | import com.dizcoding.kadesubmission2.model.Leagues 7 | import org.jetbrains.anko.setContentView 8 | 9 | class DetailLigaActivity : AppCompatActivity() { 10 | 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | val bundle: Bundle = intent.getBundleExtra("Bundle") 14 | val leagues: Leagues? = bundle.getParcelable("league") 15 | if (leagues != null) { 16 | LigaDetailLayout(leagues).setContentView(this) 17 | } 18 | } 19 | 20 | override fun onBackPressed() { 21 | super.onBackPressed() 22 | finish() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/api/apiservice/TheSportDbService.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.api.apiservice 2 | 3 | import com.dizcoding.kadesubmission2.BuildConfig.* 4 | import com.dizcoding.kadesubmission2.model.* 5 | import retrofit2.Call 6 | import retrofit2.http.GET 7 | import retrofit2.http.Query 8 | 9 | interface TheSportDbService { 10 | 11 | @GET(DETAIL_LIGA) 12 | fun detailLiga(@Query("id") id_liga: String): Call 13 | 14 | @GET(NEXT_MATCH) 15 | fun nextMatch(@Query("id") id_liga: String): Call 16 | 17 | @GET(PREV_MATCH) 18 | fun prevMatch(@Query("id") id_liga: String): Call 19 | 20 | @GET(DETAIL_PERTANDINGAN) 21 | fun detailPertandingan(@Query("id") id_event: String): Call 22 | 23 | @GET(CARI_PERTANDINGAN) 24 | fun cariPertandingan(@Query("e") query: String): Call 25 | 26 | @GET(ALL_TEAM_BY_IDLIGA) 27 | fun allTeams(@Query("id") id_liga: String): Call 28 | 29 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/assets/TODO.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO : 3 | * Menampilkan informasi yang lengkap pada halaman detail liga. 4 | * Menggunakan Fragment untuk menampung halaman Next Match dan Previous Match. 5 | * Menampilkan informasi yang lengkap pada halaman detail pertandingan. 6 | * Menampilkan indikator loading ketika aplikasi sedang memuat data. 7 | * Menggunakan pattern seperti MVP, MVVM, Architecture Component atau yang lainnya. 8 | * Menampilkan waktu pertandingan dalam format GMT +7. 9 | * Menggunakan SearchView pada penerapan fitur pencarian. 10 | * Menampilkan informasi ke pengguna ketika hasil pencarian tidak ditemukan. 11 | * Menuliskan kode dengan bersih. 12 | * : Itu rolenya 13 | * Lalu bagaiamana penyelesaiannya ? 14 | * 1. ayo bkin layoutnya dlu 15 | * : ada 4 layout 16 | * : kita hanya butuh 1 activity 17 | * : banyak fragment 18 | * : 1. fragment yang menampung (pertandingan terakhir, pertandingan mendatang) 19 | * : 2. fragment pertandingan terakhir 20 | * : 3. fragment pertandingan mendatang 21 | * : 4. framgnet detail pertandingan 22 | * : 5. frament pencarian pertandingan 23 | * 24 | * Yeay, anggap aja semua datanya udah di dapat. 25 | * tinggal di tampilin aja.nexmatch ke nextmact 26 | * prev match, ke prev 27 | * */ -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/api/TheSportDbApi.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.api 2 | 3 | import android.app.Application 4 | import com.dizcoding.kadesubmission2.BuildConfig 5 | import com.dizcoding.kadesubmission2.BuildConfig.BASE_URL 6 | import com.dizcoding.kadesubmission2.api.apiservice.TheSportDbService 7 | import okhttp3.OkHttpClient 8 | import okhttp3.logging.HttpLoggingInterceptor 9 | import retrofit2.Retrofit 10 | import retrofit2.converter.gson.GsonConverterFactory 11 | import java.util.concurrent.TimeUnit 12 | 13 | class TheSportDbApi : Application() { 14 | private val client = OkHttpClient().newBuilder() 15 | .addInterceptor(HttpLoggingInterceptor().apply { 16 | level = 17 | if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE 18 | }) 19 | .readTimeout(30, TimeUnit.SECONDS) 20 | .writeTimeout(30, TimeUnit.SECONDS) 21 | .build() 22 | 23 | private val retrofit = Retrofit.Builder() 24 | .baseUrl(BASE_URL) 25 | .client(client) 26 | .addConverterFactory(GsonConverterFactory.create()) 27 | .build() 28 | 29 | val services: TheSportDbService = retrofit.create(TheSportDbService::class.java) 30 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/main_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/layout/fragment/BaseFragmentLayout.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.layout.fragment 2 | 3 | import android.content.Context 4 | import android.graphics.Color 5 | import android.view.View 6 | import android.widget.LinearLayout 7 | import com.dizcoding.kadesubmission2.R 8 | import org.jetbrains.anko.* 9 | import org.jetbrains.anko.design.tabLayout 10 | import org.jetbrains.anko.support.v4.viewPager 11 | 12 | class BaseFragmentLayout : AnkoComponent { 13 | override fun createView(ui: AnkoContext): View = with(ui) { 14 | linearLayout { 15 | lparams(width = matchParent, height = matchParent) { 16 | orientation = LinearLayout.VERTICAL 17 | } 18 | 19 | linearLayout { 20 | lparams(width = matchParent, height = dip(200)) { 21 | } 22 | viewPager { 23 | id = R.id.lgVp 24 | }.lparams(matchParent, matchParent) 25 | 26 | } 27 | linearLayout { 28 | lparams(width = matchParent, height = dip(45)) 29 | tabLayout { 30 | id = R.id.bfIdtbl 31 | lparams(width = matchParent, height = matchParent) 32 | } 33 | } 34 | linearLayout { 35 | lparams(width = matchParent, height = matchParent) { 36 | } 37 | viewPager { 38 | id = R.id.bfVp 39 | }.lparams(matchParent, matchParent) 40 | 41 | } 42 | 43 | } 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/fragment/NextMatchFragment.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.fragment 2 | 3 | 4 | import android.os.Bundle 5 | import androidx.fragment.app.Fragment 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import androidx.recyclerview.widget.RecyclerView 10 | import com.dizcoding.kadesubmission2.R 11 | import com.dizcoding.kadesubmission2.adapter.MatchAdapter 12 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 13 | import com.dizcoding.kadesubmission2.layout.fragment.NextMatchFragmentLayout 14 | import com.dizcoding.kadesubmission2.model.AllTeamResponse 15 | import com.dizcoding.kadesubmission2.model.MatchResponse 16 | import org.jetbrains.anko.AnkoContext 17 | import org.jetbrains.anko.support.v4.ctx 18 | 19 | class NextMatchFragment(private val listener: FragmentNavigationListener) : Fragment() { 20 | 21 | private lateinit var adapter: MatchAdapter 22 | private lateinit var v: View 23 | 24 | override fun onCreateView( 25 | inflater: LayoutInflater, 26 | container: ViewGroup?, 27 | savedInstanceState: Bundle? 28 | ): View? = NextMatchFragmentLayout().createView(AnkoContext.create(ctx)) 29 | 30 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 31 | super.onViewCreated(view, savedInstanceState) 32 | v = view 33 | listener.refreshNextMatch(view) 34 | } 35 | 36 | fun refreshData(dataTeams: AllTeamResponse, data: MatchResponse, view: View) { 37 | val nextMatchRecyclerView = view.findViewById(R.id.nmFrv) 38 | adapter = MatchAdapter(dataTeams, data, listener) 39 | nextMatchRecyclerView.adapter = adapter 40 | adapter.notifyDataSetChanged() 41 | } 42 | 43 | override fun onResume() { 44 | super.onResume() 45 | listener.refreshNextMatch(v) 46 | } 47 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/liga_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 15 | 16 | 28 | 29 | 38 | 39 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/fragment/PrevMatchFragment.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.fragment 2 | 3 | 4 | import android.content.Context 5 | import android.os.Bundle 6 | import android.util.Log 7 | import androidx.fragment.app.Fragment 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.ViewGroup 11 | import com.dizcoding.kadesubmission2.R 12 | import com.dizcoding.kadesubmission2.model.MatchResponse 13 | import androidx.recyclerview.widget.RecyclerView 14 | import com.dizcoding.kadesubmission2.adapter.MatchAdapter 15 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 16 | import com.dizcoding.kadesubmission2.layout.fragment.PrefMatchFragmentLayout 17 | import com.dizcoding.kadesubmission2.model.AllTeamResponse 18 | import org.jetbrains.anko.AnkoContext 19 | import org.jetbrains.anko.support.v4.ctx 20 | 21 | class PrevMatchFragment(private val listener: FragmentNavigationListener) : Fragment() { 22 | 23 | private lateinit var adapter: MatchAdapter 24 | private lateinit var v: View 25 | 26 | override fun onCreateView( 27 | inflater: LayoutInflater, 28 | container: ViewGroup?, 29 | savedInstanceState: Bundle? 30 | ): View? = PrefMatchFragmentLayout().createView(AnkoContext.create(ctx)) 31 | 32 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 33 | super.onViewCreated(view, savedInstanceState) 34 | listener.refreshPrevMatch(view) 35 | v = view 36 | } 37 | 38 | fun refreshData(dataTeams: AllTeamResponse, data: MatchResponse, view: View) { 39 | val prefMatchRecyclerView = view.findViewById(R.id.pmFrv) 40 | adapter = MatchAdapter(dataTeams, data, listener) 41 | prefMatchRecyclerView.adapter = adapter 42 | adapter.notifyDataSetChanged() 43 | } 44 | 45 | override fun onResume() { 46 | super.onResume() 47 | listener.refreshPrevMatch(v) 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/adapter/ViewPagerLigaAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.adapter 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.ImageView 8 | import android.widget.TextView 9 | import androidx.viewpager.widget.PagerAdapter 10 | import com.dizcoding.kadesubmission2.R 11 | import com.dizcoding.kadesubmission2.model.Leagues 12 | import androidx.viewpager.widget.ViewPager 13 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 14 | import com.dizcoding.kadesubmission2.tools.Utils 15 | 16 | 17 | class ViewPagerLigaAdapter( 18 | val ctx: Context, 19 | val data: ArrayList = arrayListOf(), 20 | var listener: FragmentNavigationListener 21 | ) : PagerAdapter() { 22 | 23 | override fun isViewFromObject(view: View, obj: Any): Boolean { 24 | return view == obj 25 | } 26 | 27 | override fun getCount(): Int = data.size 28 | 29 | override fun instantiateItem(container: ViewGroup, position: Int): Any { 30 | val view: View = LayoutInflater.from(ctx).inflate(R.layout.liga_item, null) 31 | 32 | // inisialisasi 33 | 34 | val imView = view.findViewById(R.id.ivPagerAdapter) 35 | val tvLigaName = view.findViewById(R.id.tvLigaName) 36 | val tvDetailLiga = view.findViewById(R.id.tvDetailLiga) 37 | 38 | // listener 39 | tvDetailLiga.setOnClickListener { listener.pagerAdapterDetails(data[position]) } // open detail 40 | view.setOnClickListener { listener.pagerAdapterSelected(data[position]) } // refresh liga 41 | 42 | // setdata 43 | Utils().picShow("file:///android_asset/" + data[position].logo, imView) 44 | tvLigaName.text = data[position].name 45 | 46 | container.addView(view) 47 | return view 48 | } 49 | 50 | override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { 51 | (container as ViewPager).removeView(`object` as View) 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/layout/activity/LigaDetailLayout.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.layout.activity 2 | 3 | import android.content.Context 4 | import android.graphics.Color 5 | import android.view.Gravity 6 | import android.view.View 7 | import android.widget.ImageView 8 | import android.widget.LinearLayout 9 | import android.widget.TextView 10 | import com.dizcoding.kadesubmission2.model.Leagues 11 | import com.dizcoding.kadesubmission2.tools.Utils 12 | import org.jetbrains.anko.* 13 | import org.jetbrains.anko.cardview.v7.cardView 14 | 15 | class LigaDetailLayout(val leagues: Leagues) : AnkoComponent { 16 | override fun createView(ui: AnkoContext): View = with(ui) { 17 | 18 | scrollView { 19 | lparams(matchParent, matchParent) 20 | 21 | cardView { 22 | lparams(width = matchParent, height = wrapContent) { 23 | margin = dip(5) 24 | } 25 | radius = dip(5).toFloat() 26 | 27 | linearLayout { 28 | orientation = LinearLayout.VERTICAL 29 | lparams(width = matchParent, height = matchParent) 30 | 31 | val logo: ImageView = imageView { 32 | scaleType = ImageView.ScaleType.FIT_CENTER 33 | }.lparams(width = matchParent, height = wrapContent) 34 | 35 | val judul: TextView = textView { 36 | gravity = Gravity.CENTER_HORIZONTAL 37 | textColor = Color.BLACK 38 | textSize = dip(12).toFloat() 39 | }.lparams(width = matchParent, height = matchParent) 40 | val desc: TextView = textView { 41 | textColor = Color.BLACK 42 | padding = dip(5) 43 | }.lparams(width = matchParent, height = matchParent) 44 | 45 | Utils().picShow("file:///android_asset/" + leagues.logo, logo) 46 | judul.text = leagues.name 47 | desc.text = leagues.description 48 | } 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/fragment/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.fragment 2 | 3 | 4 | import android.os.Bundle 5 | import androidx.fragment.app.Fragment 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import androidx.fragment.app.FragmentManager 10 | import androidx.viewpager.widget.ViewPager 11 | import com.dizcoding.kadesubmission2.R 12 | import com.dizcoding.kadesubmission2.adapter.ViewPagerLigaAdapter 13 | import com.dizcoding.kadesubmission2.adapter.ViewPagerNextPrevAdapter 14 | import com.dizcoding.kadesubmission2.api.local.DataLeague 15 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 16 | import com.dizcoding.kadesubmission2.layout.fragment.BaseFragmentLayout 17 | import com.dizcoding.kadesubmission2.model.AllTeamResponse 18 | import com.dizcoding.kadesubmission2.model.Flist 19 | import com.dizcoding.kadesubmission2.model.MatchResponse 20 | import com.google.android.material.tabs.TabLayout 21 | import org.jetbrains.anko.AnkoContext 22 | import org.jetbrains.anko.support.v4.ctx 23 | 24 | class BaseFragment( 25 | var fm: FragmentManager, 26 | var listener: FragmentNavigationListener 27 | ) : Fragment() { 28 | 29 | private lateinit var tabLayout: TabLayout 30 | private lateinit var viewPager: ViewPager 31 | private lateinit var ligaViewPager: ViewPager 32 | 33 | override fun onCreateView( 34 | inflater: LayoutInflater, 35 | container: ViewGroup?, 36 | savedInstanceState: Bundle? 37 | ): View? = BaseFragmentLayout().createView(AnkoContext.create(ctx)) 38 | 39 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 40 | super.onViewCreated(view, savedInstanceState) 41 | 42 | tabLayout = view.findViewById(R.id.bfIdtbl) 43 | viewPager = view.findViewById(R.id.bfVp) 44 | ligaViewPager = view.findViewById(R.id.lgVp) 45 | 46 | val flist: List = listOf( 47 | Flist("Prev Match", PrevMatchFragment(listener)), 48 | Flist("Next Match", NextMatchFragment(listener)) 49 | ) 50 | viewPager.adapter = ViewPagerNextPrevAdapter(fm, flist) 51 | tabLayout.setupWithViewPager(viewPager) 52 | ligaViewPager.adapter = ViewPagerLigaAdapter(ctx, DataLeague(ctx).get(), listener) 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 29 9 | buildToolsVersion "29.0.2" 10 | defaultConfig { 11 | applicationId "com.dizcoding.kadesubmission2" 12 | minSdkVersion 15 13 | targetSdkVersion 29 14 | versionCode 1 15 | versionName "1.0" 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | 18 | 19 | buildConfigField "String", "BASE_URL", '"https://www.thesportsdb.com/api/v1/json/1/"' 20 | buildConfigField "String", "DETAIL_LIGA", '"lookupleague.php?"' 21 | buildConfigField "String", "NEXT_MATCH", '"eventsnextleague.php?"' 22 | buildConfigField "String", "PREV_MATCH", '"eventspastleague.php?"' 23 | buildConfigField "String", "DETAIL_PERTANDINGAN", '"lookupevent.php?"' 24 | buildConfigField "String", "CARI_PERTANDINGAN", '"searchevents.php?"' 25 | buildConfigField "String", "ALL_TEAM_BY_IDLIGA", '"lookup_all_teams.php?"' 26 | 27 | } 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | androidExtensions { 35 | experimental = true 36 | } 37 | } 38 | 39 | dependencies { 40 | implementation fileTree(dir: 'libs', include: ['*.jar']) 41 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 42 | implementation 'androidx.appcompat:appcompat:1.1.0' 43 | implementation 'androidx.core:core-ktx:1.1.0' 44 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 45 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 46 | testImplementation 'junit:junit:4.12' 47 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 48 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 49 | 50 | 51 | implementation "com.squareup.picasso:picasso:$picasso_version" 52 | // implementation "com.google.code.gson:gson:$gson_version" 53 | 54 | 55 | //anko 56 | implementation "org.jetbrains.anko:anko:$anko_version" 57 | implementation "org.jetbrains.anko:anko-design:$anko_version" 58 | implementation "org.jetbrains.anko:anko-cardview-v7:$anko_version" 59 | 60 | 61 | // RecyclerView-v7 62 | implementation "org.jetbrains.anko:anko-recyclerview-v7:$anko_version" 63 | implementation "org.jetbrains.anko:anko-recyclerview-v7-coroutines:$anko_version" 64 | 65 | // Retrofit 66 | implementation "com.squareup.retrofit2:retrofit:$retro_version" 67 | implementation "com.squareup.retrofit2:converter-gson:$gson_converter_version" 68 | implementation "com.squareup.okhttp3:okhttp:$ok_http_version" 69 | implementation "com.squareup.okhttp3:logging-interceptor:$logging_interceptor_version" 70 | 71 | implementation 'com.github.salomonbrys.kotson:kotson:2.5.0' 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_pencarian.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 29 | 30 | 36 | 42 | 43 | 55 | 56 | 57 | 58 | 59 | 60 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_favorit.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 30 | 31 | 37 | 43 | 44 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/League.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class League( 9 | @SerializedName("dateFirstEvent") val dateFirstEvent: String, 10 | @SerializedName("idCup") val idCup: String, 11 | @SerializedName("idLeague") val idLeague: String, 12 | @SerializedName("idSoccerXML") val idSoccerXML: String, 13 | @SerializedName("intFormedYear") val intFormedYear: String, 14 | @SerializedName("strBadge") val strBadge: String, 15 | @SerializedName("strBanner") val strBanner: String, 16 | @SerializedName("strComplete") val strComplete: String, 17 | @SerializedName("strCountry") val strCountry: String, 18 | @SerializedName("strDescriptionCN") val strDescriptionCN: String, 19 | @SerializedName("strDescriptionDE") val strDescriptionDE: String, 20 | @SerializedName("strDescriptionEN") val strDescriptionEN: String, 21 | @SerializedName("strDescriptionES") val strDescriptionES: String, 22 | @SerializedName("strDescriptionFR") val strDescriptionFR: String, 23 | @SerializedName("strDescriptionHU") val strDescriptionHU: String, 24 | @SerializedName("strDescriptionIL") val strDescriptionIL: String, 25 | @SerializedName("strDescriptionIT") val strDescriptionIT: String, 26 | @SerializedName("strDescriptionJP") val strDescriptionJP: String, 27 | @SerializedName("strDescriptionNL") val strDescriptionNL: String, 28 | @SerializedName("strDescriptionNO") val strDescriptionNO: String, 29 | @SerializedName("strDescriptionPL") val strDescriptionPL: String, 30 | @SerializedName("strDescriptionPT") val strDescriptionPT: String, 31 | @SerializedName("strDescriptionRU") val strDescriptionRU: String, 32 | @SerializedName("strDescriptionSE") val strDescriptionSE: String, 33 | @SerializedName("strDivision") val strDivision: String, 34 | @SerializedName("strFacebook") val strFacebook: String, 35 | @SerializedName("strFanart1") val strFanart1: String, 36 | @SerializedName("strFanart2") val strFanart2: String, 37 | @SerializedName("strFanart3") val strFanart3: String, 38 | @SerializedName("strFanart4") val strFanart4: String, 39 | @SerializedName("strGender") val strGender: String, 40 | @SerializedName("strLeague") val strLeague: String, 41 | @SerializedName("strLeagueAlternate") val strLeagueAlternate: String, 42 | @SerializedName("strLocked") val strLocked: String, 43 | @SerializedName("strLogo") val strLogo: String, 44 | @SerializedName("strNaming") val strNaming: String, 45 | @SerializedName("strPoster") val strPoster: String, 46 | @SerializedName("strRSS") val strRSS: String, 47 | @SerializedName("strSport") val strSport: String, 48 | @SerializedName("strTrophy") val strTrophy: String, 49 | @SerializedName("strTwitter") val strTwitter: String, 50 | @SerializedName("strWebsite") val strWebsite: String, 51 | @SerializedName("strYoutube") val strYoutube: String 52 | ) : Parcelable -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | 16 | *.iml 17 | .gradle 18 | /local.properties 19 | /.idea/caches 20 | /.idea/libraries 21 | /.idea/modules.xml 22 | /.idea/workspace.xml 23 | /.idea/navEditor.xml 24 | /.idea/assetWizardSettings.xml 25 | .DS_Store 26 | /build 27 | /captures 28 | .externalNativeBuild 29 | .cxx 30 | 31 | # Built application files 32 | /*/build/ 33 | /**/build/ 34 | 35 | # Crashlytics configuations 36 | com_crashlytics_export_strings.xml 37 | 38 | # Local configuration file (sdk path, etc) 39 | local.properties 40 | 41 | # Gradle generated files 42 | .gradle/ 43 | 44 | # Signing files 45 | .signing/ 46 | 47 | # User-specific configurations 48 | .idea/libraries/ 49 | .idea/workspace.xml 50 | .idea/tasks.xml 51 | .idea/.name 52 | .idea/compiler.xml 53 | .idea/copyright/profiles_settings.xml 54 | .idea/encodings.xml 55 | .idea/misc.xml 56 | .idea/modules.xml 57 | .idea/scopes/scope_settings.xml 58 | .idea/vcs.xml 59 | *.iml 60 | 61 | # OS-specific files 62 | .DS_Store 63 | .DS_Store? 64 | ._* 65 | .Spotlight-V100 66 | .Trashes 67 | ehthumbs.db 68 | Thumbs.db 69 | 70 | # Built application files 71 | *.apk 72 | *.ap_ 73 | *.aab 74 | 75 | # Files for the ART/Dalvik VM 76 | *.dex 77 | 78 | # Java class files 79 | *.class 80 | 81 | # Generated files 82 | bin/ 83 | gen/ 84 | out/ 85 | # Uncomment the following line in case you need and you don't have the release build type files in your app 86 | # release/ 87 | 88 | # Gradle files 89 | .gradle/ 90 | build/ 91 | 92 | # Local configuration file (sdk path, etc) 93 | local.properties 94 | 95 | # Proguard folder generated by Eclipse 96 | proguard/ 97 | 98 | # Log Files 99 | *.log 100 | 101 | # Android Studio Navigation editor temp files 102 | .navigation/ 103 | 104 | # Android Studio captures folder 105 | captures/ 106 | 107 | # IntelliJ 108 | *.iml 109 | .idea/workspace.xml 110 | .idea/tasks.xml 111 | .idea/gradle.xml 112 | .idea/assetWizardSettings.xml 113 | .idea/dictionaries 114 | .idea/libraries 115 | # Android Studio 3 in .gitignore file. 116 | .idea/caches 117 | .idea/modules.xml 118 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 119 | .idea/navEditor.xml 120 | 121 | # Keystore files 122 | # Uncomment the following lines if you do not want to check your keystore files in. 123 | #*.jks 124 | #*.keystore 125 | 126 | # External native build folder generated in Android Studio 2.2 and later 127 | .externalNativeBuild 128 | .cxx/ 129 | 130 | # Google Services (e.g. APIs or Firebase) 131 | # google-services.json 132 | 133 | # Freeline 134 | freeline.py 135 | freeline/ 136 | freeline_project_description.json 137 | 138 | # fastlane 139 | fastlane/report.xml 140 | fastlane/Preview.html 141 | fastlane/screenshots 142 | fastlane/test_output 143 | fastlane/readme.md 144 | 145 | # Version control 146 | vcs.xml 147 | 148 | # lint 149 | lint/intermediates/ 150 | lint/generated/ 151 | lint/outputs/ 152 | lint/tmp/ 153 | # lint/reports/ 154 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/Team.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class Team( 9 | @SerializedName("idLeague") val idLeague: String, 10 | @SerializedName("idSoccerXML") val idSoccerXML: String, 11 | @SerializedName("idTeam") val idTeam: String, 12 | @SerializedName("intFormedYear") val intFormedYear: String, 13 | @SerializedName("intLoved") val intLoved: String, 14 | @SerializedName("intStadiumCapacity") val intStadiumCapacity: String, 15 | @SerializedName("strAlternate") val strAlternate: String, 16 | @SerializedName("strCountry") val strCountry: String, 17 | @SerializedName("strDescriptionCN") val strDescriptionCN: String, 18 | @SerializedName("strDescriptionDE") val strDescriptionDE: String, 19 | @SerializedName("strDescriptionEN") val strDescriptionEN: String, 20 | @SerializedName("strDescriptionES") val strDescriptionES: String, 21 | @SerializedName("strDescriptionFR") val strDescriptionFR: String, 22 | @SerializedName("strDescriptionHU") val strDescriptionHU: String, 23 | @SerializedName("strDescriptionIL") val strDescriptionIL: String, 24 | @SerializedName("strDescriptionIT") val strDescriptionIT: String, 25 | @SerializedName("strDescriptionJP") val strDescriptionJP: String, 26 | @SerializedName("strDescriptionNL") val strDescriptionNL: String, 27 | @SerializedName("strDescriptionNO") val strDescriptionNO: String, 28 | @SerializedName("strDescriptionPL") val strDescriptionPL: String, 29 | @SerializedName("strDescriptionPT") val strDescriptionPT: String, 30 | @SerializedName("strDescriptionRU") val strDescriptionRU: String, 31 | @SerializedName("strDescriptionSE") val strDescriptionSE: String, 32 | @SerializedName("strDivision") val strDivision: String, 33 | @SerializedName("strFacebook") val strFacebook: String, 34 | @SerializedName("strGender") val strGender: String, 35 | @SerializedName("strInstagram") val strInstagram: String, 36 | @SerializedName("strKeywords") val strKeywords: String, 37 | @SerializedName("strLeague") val strLeague: String, 38 | @SerializedName("strLocked") val strLocked: String, 39 | @SerializedName("strManager") val strManager: String, 40 | @SerializedName("strRSS") val strRSS: String, 41 | @SerializedName("strSport") val strSport: String, 42 | @SerializedName("strStadium") val strStadium: String, 43 | @SerializedName("strStadiumDescription") val strStadiumDescription: String, 44 | @SerializedName("strStadiumLocation") val strStadiumLocation: String, 45 | @SerializedName("strStadiumThumb") val strStadiumThumb: String, 46 | @SerializedName("strTeam") val strTeam: String, 47 | @SerializedName("strTeamBadge") val strTeamBadge: String, 48 | @SerializedName("strTeamBanner") val strTeamBanner: String, 49 | @SerializedName("strTeamFanart1") val strTeamFanart1: String, 50 | @SerializedName("strTeamFanart2") val strTeamFanart2: String, 51 | @SerializedName("strTeamFanart3") val strTeamFanart3: String, 52 | @SerializedName("strTeamFanart4") val strTeamFanart4: String, 53 | @SerializedName("strTeamJersey") val strTeamJersey: String, 54 | @SerializedName("strTeamLogo") val strTeamLogo: String, 55 | @SerializedName("strTeamShort") val strTeamShort: String, 56 | @SerializedName("strTwitter") val strTwitter: String, 57 | @SerializedName("strWebsite") val strWebsite: String, 58 | @SerializedName("strYoutube") val strYoutube: String 59 | ) : Parcelable -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/adapter/MatchAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.adapter 2 | 3 | import android.content.Intent 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import android.widget.ImageView 7 | import android.widget.TextView 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.dizcoding.kadesubmission2.R 10 | import com.dizcoding.kadesubmission2.activity.DetailMatchActivity 11 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 12 | import com.dizcoding.kadesubmission2.layout.adapter.MatchItemLayout 13 | import com.dizcoding.kadesubmission2.model.AllTeamResponse 14 | import com.dizcoding.kadesubmission2.model.Event 15 | import com.dizcoding.kadesubmission2.model.MatchResponse 16 | import com.dizcoding.kadesubmission2.tools.Utils 17 | import org.jetbrains.anko.AnkoContext 18 | 19 | class MatchAdapter( 20 | var dataTeams: AllTeamResponse = AllTeamResponse( 21 | listOf() 22 | ), 23 | var data: MatchResponse = MatchResponse( 24 | listOf() 25 | ), 26 | val listener: FragmentNavigationListener 27 | ) : RecyclerView.Adapter() { 28 | 29 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder = 30 | Holder(MatchItemLayout().createView(AnkoContext.Companion.create(parent.context))) 31 | 32 | override fun getItemCount(): Int = data.events.size 33 | override fun onBindViewHolder(holder: Holder, position: Int) = 34 | holder.bind(data.events[position]) 35 | 36 | inner class Holder(itemview: View) : RecyclerView.ViewHolder(itemview) { 37 | 38 | val ivHome = itemview.findViewById(R.id.ivHome) 39 | val ivAway = itemview.findViewById(R.id.ivAway) 40 | val tvHomeScore = itemview.findViewById(R.id.tvHomeScore) 41 | val tvAwayScore = itemview.findViewById(R.id.tvAwayScore) 42 | val tvHomeTeamName = itemview.findViewById(R.id.tvHomeTeamName) 43 | val tvAwayTeamName = itemview.findViewById(R.id.tvAwayTeamName) 44 | 45 | val tvLigaName = itemview.findViewById(R.id.tvLigaName) 46 | val tvEventName = itemview.findViewById(R.id.tvEventName) 47 | 48 | fun bind(event: Event) { 49 | val listTeams = dataTeams.teams 50 | val homeTeam = listTeams.filter { it.idTeam == event.idHomeTeam } 51 | val awayTeam = listTeams.filter { it.idTeam == event.idAwayTeam } 52 | 53 | if (listTeams.isNotEmpty()) { 54 | if (awayTeam.isNotEmpty()) { 55 | Utils().picShow(awayTeam[0].strTeamBadge, ivAway) 56 | } 57 | if (homeTeam.isNotEmpty()) { 58 | Utils().picShow(homeTeam[0].strTeamBadge, ivHome) 59 | } 60 | } 61 | if (event.intHomeScore.isNullOrEmpty() || event.intHomeScore == "null") { 62 | tvHomeScore.text = "-" 63 | } else { 64 | tvHomeScore.text = event.intHomeScore 65 | } 66 | if (event.intAwayScore.isNullOrEmpty() || event.intAwayScore == "null") { 67 | tvAwayScore.text = "-" 68 | } else { 69 | tvAwayScore.text = event.intAwayScore 70 | } 71 | 72 | tvHomeTeamName.text = event.strHomeTeam 73 | tvAwayTeamName.text = event.strAwayTeam 74 | tvLigaName.text = event.strLeague 75 | tvEventName.text = event.strEvent 76 | 77 | itemView.setOnClickListener { listener.onMatchItemSelected(event) } 78 | } 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/model/Event.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.model 2 | 3 | import android.os.Parcelable 4 | import com.google.gson.annotations.SerializedName 5 | import kotlinx.android.parcel.Parcelize 6 | 7 | @Parcelize 8 | data class Event( 9 | @SerializedName("dateEvent") val dateEvent: String, 10 | @SerializedName("dateEventLocal") val dateEventLocal: String, 11 | @SerializedName("idAwayTeam") val idAwayTeam: String, 12 | @SerializedName("idEvent") val idEvent: String, 13 | @SerializedName("idHomeTeam") val idHomeTeam: String, 14 | @SerializedName("idLeague") val idLeague: String, 15 | @SerializedName("idSoccerXML") val idSoccerXML: String, 16 | @SerializedName("intAwayScore") val intAwayScore: String, 17 | @SerializedName("intAwayShots") val intAwayShots: String, 18 | @SerializedName("intHomeScore") val intHomeScore: String, 19 | @SerializedName("intHomeShots") val intHomeShots: String, 20 | @SerializedName("intRound") val intRound: String, 21 | @SerializedName("intSpectators") val intSpectators: String, 22 | @SerializedName("strAwayFormation") val strAwayFormation: String, 23 | @SerializedName("strAwayGoalDetails") val strAwayGoalDetails: String, 24 | @SerializedName("strAwayLineupDefense") val strAwayLineupDefense: String, 25 | @SerializedName("strAwayLineupForward") val strAwayLineupForward: String, 26 | @SerializedName("strAwayLineupGoalkeeper") val strAwayLineupGoalkeeper: String, 27 | @SerializedName("strAwayLineupMidfield") val strAwayLineupMidfield: String, 28 | @SerializedName("strAwayLineupSubstitutes") val strAwayLineupSubstitutes: String, 29 | @SerializedName("strAwayRedCards") val strAwayRedCards: String, 30 | @SerializedName("strAwayTeam") val strAwayTeam: String, 31 | @SerializedName("strAwayYellowCards") val strAwayYellowCards: String, 32 | @SerializedName("strBanner") val strBanner: String, 33 | @SerializedName("strCircuit") val strCircuit: String, 34 | @SerializedName("strCity") val strCity: String, 35 | @SerializedName("strCountry") val strCountry: String, 36 | @SerializedName("strDate") val strDate: String, 37 | @SerializedName("strDescriptionEN") val strDescriptionEN: String, 38 | @SerializedName("strEvent") val strEvent: String, 39 | @SerializedName("strEventAlternate") val strEventAlternate: String, 40 | @SerializedName("strFanart") val strFanart: String, 41 | @SerializedName("strFilename") val strFilename: String, 42 | @SerializedName("strHomeFormation") val strHomeFormation: String, 43 | @SerializedName("strHomeGoalDetails") val strHomeGoalDetails: String, 44 | @SerializedName("strHomeLineupDefense") val strHomeLineupDefense: String, 45 | @SerializedName("strHomeLineupForward") val strHomeLineupForward: String, 46 | @SerializedName("strHomeLineupGoalkeeper") val strHomeLineupGoalkeeper: String, 47 | @SerializedName("strHomeLineupMidfield") val strHomeLineupMidfield: String, 48 | @SerializedName("strHomeLineupSubstitutes") val strHomeLineupSubstitutes: String, 49 | @SerializedName("strHomeRedCards") val strHomeRedCards: String, 50 | @SerializedName("strHomeTeam") val strHomeTeam: String, 51 | @SerializedName("strHomeYellowCards") val strHomeYellowCards: String, 52 | @SerializedName("strLeague") val strLeague: String, 53 | @SerializedName("strLocked") val strLocked: String, 54 | @SerializedName("strMap") val strMap: String, 55 | @SerializedName("strPoster") val strPoster: String, 56 | @SerializedName("strResult") val strResult: String, 57 | @SerializedName("strSeason") val strSeason: String, 58 | @SerializedName("strSport") val strSport: String, 59 | @SerializedName("strTVStation") val strTVStation: String, 60 | @SerializedName("strThumb") val strThumb: String, 61 | @SerializedName("strTime") val strTime: String, 62 | @SerializedName("strTimeLocal") val strTimeLocal: String, 63 | @SerializedName("strTweet1") val strTweet1: String, 64 | @SerializedName("strTweet2") val strTweet2: String, 65 | @SerializedName("strTweet3") val strTweet3: String, 66 | @SerializedName("strVideo") val strVideo: String 67 | ) : Parcelable -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | xmlns:android 20 | 21 | ^$ 22 | 23 | 24 | 25 |
26 |
27 | 28 | 29 | 30 | xmlns:.* 31 | 32 | ^$ 33 | 34 | 35 | BY_NAME 36 | 37 |
38 |
39 | 40 | 41 | 42 | .*:id 43 | 44 | http://schemas.android.com/apk/res/android 45 | 46 | 47 | 48 |
49 |
50 | 51 | 52 | 53 | .*:name 54 | 55 | http://schemas.android.com/apk/res/android 56 | 57 | 58 | 59 |
60 |
61 | 62 | 63 | 64 | name 65 | 66 | ^$ 67 | 68 | 69 | 70 |
71 |
72 | 73 | 74 | 75 | style 76 | 77 | ^$ 78 | 79 | 80 | 81 |
82 |
83 | 84 | 85 | 86 | .* 87 | 88 | ^$ 89 | 90 | 91 | BY_NAME 92 | 93 |
94 |
95 | 96 | 97 | 98 | .* 99 | 100 | http://schemas.android.com/apk/res/android 101 | 102 | 103 | ANDROID_ATTRIBUTE_ORDER 104 | 105 |
106 |
107 | 108 | 109 | 110 | .* 111 | 112 | .* 113 | 114 | 115 | BY_NAME 116 | 117 |
118 |
119 |
120 |
121 | 122 | 124 |
125 |
-------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/db/DbFavoriteMatch.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.db 2 | 3 | import android.content.Context 4 | import android.database.sqlite.SQLiteDatabase 5 | import com.dizcoding.kadesubmission2.db.table.FavoriteMatch 6 | import org.jetbrains.anko.db.* 7 | 8 | class DbFavoriteMatch(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "FavoriteMatch.db", null, 1) { 9 | companion object { 10 | private var instance: DbFavoriteMatch? = null 11 | 12 | @Synchronized 13 | fun getInstance(ctx: Context): DbFavoriteMatch { 14 | if (instance == null) { 15 | instance = DbFavoriteMatch(ctx.applicationContext) 16 | } 17 | return instance as DbFavoriteMatch 18 | } 19 | } 20 | 21 | override fun onCreate(db: SQLiteDatabase) { 22 | // Ok, lets try make a database 23 | db.createTable( 24 | FavoriteMatch.TABLE_NAME, true, 25 | FavoriteMatch.ID to INTEGER + PRIMARY_KEY + AUTOINCREMENT, 26 | FavoriteMatch.dateEvent to TEXT, 27 | FavoriteMatch.dateEventLocal to TEXT, 28 | FavoriteMatch.idAwayTeam to TEXT, 29 | FavoriteMatch.idEvent to TEXT + UNIQUE, 30 | FavoriteMatch.idHomeTeam to TEXT, 31 | FavoriteMatch.idLeague to TEXT, 32 | FavoriteMatch.idSoccerXML to TEXT, 33 | FavoriteMatch.intAwayScore to TEXT, 34 | FavoriteMatch.intAwayShots to TEXT, 35 | FavoriteMatch.intHomeScore to TEXT, 36 | FavoriteMatch.intHomeShots to TEXT, 37 | FavoriteMatch.intRound to TEXT, 38 | FavoriteMatch.intSpectators to TEXT, 39 | FavoriteMatch.strAwayFormation to TEXT, 40 | FavoriteMatch.strAwayGoalDetails to TEXT, 41 | FavoriteMatch.strAwayLineupDefense to TEXT, 42 | FavoriteMatch.strAwayLineupForward to TEXT, 43 | FavoriteMatch.strAwayLineupGoalkeeper to TEXT, 44 | FavoriteMatch.strAwayLineupMidfield to TEXT, 45 | FavoriteMatch.strAwayLineupSubstitutes to TEXT, 46 | FavoriteMatch.strAwayRedCards to TEXT, 47 | FavoriteMatch.strAwayTeam to TEXT, 48 | FavoriteMatch.strAwayYellowCards to TEXT, 49 | FavoriteMatch.strBanner to TEXT, 50 | FavoriteMatch.strCircuit to TEXT, 51 | FavoriteMatch.strCity to TEXT, 52 | FavoriteMatch.strCountry to TEXT, 53 | FavoriteMatch.strDate to TEXT, 54 | FavoriteMatch.strDescriptionEN to TEXT, 55 | FavoriteMatch.strEvent to TEXT, 56 | FavoriteMatch.strEventAlternate to TEXT, 57 | FavoriteMatch.strFanart to TEXT, 58 | FavoriteMatch.strFilename to TEXT, 59 | FavoriteMatch.strHomeFormation to TEXT, 60 | FavoriteMatch.strHomeGoalDetails to TEXT, 61 | FavoriteMatch.strHomeLineupDefense to TEXT, 62 | FavoriteMatch.strHomeLineupForward to TEXT, 63 | FavoriteMatch.strHomeLineupGoalkeeper to TEXT, 64 | FavoriteMatch.strHomeLineupMidfield to TEXT, 65 | FavoriteMatch.strHomeLineupSubstitutes to TEXT, 66 | FavoriteMatch.strHomeRedCards to TEXT, 67 | FavoriteMatch.strHomeTeam to TEXT, 68 | FavoriteMatch.strHomeYellowCards to TEXT, 69 | FavoriteMatch.strLeague to TEXT, 70 | FavoriteMatch.strLocked to TEXT, 71 | FavoriteMatch.strMap to TEXT, 72 | FavoriteMatch.strPoster to TEXT, 73 | FavoriteMatch.strResult to TEXT, 74 | FavoriteMatch.strSeason to TEXT, 75 | FavoriteMatch.strSport to TEXT, 76 | FavoriteMatch.strTVStation to TEXT, 77 | FavoriteMatch.strThumb to TEXT, 78 | FavoriteMatch.strTime to TEXT, 79 | FavoriteMatch.strTimeLocal to TEXT, 80 | FavoriteMatch.strTweet1 to TEXT, 81 | FavoriteMatch.strTweet2 to TEXT, 82 | FavoriteMatch.strTweet3 to TEXT, 83 | FavoriteMatch.strVideo to TEXT 84 | ) 85 | } 86 | 87 | override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) { 88 | db.dropTable(FavoriteMatch.TABLE_NAME, true) 89 | } 90 | } 91 | 92 | val Context.dbFavoriteMatch: DbFavoriteMatch get() = DbFavoriteMatch.getInstance(applicationContext) -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/db/table/FavoriteMatch.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.db.table 2 | 3 | data class FavoriteMatch( 4 | val ID : Long?, 5 | val dateEvent : String?, 6 | val dateEventLocal : String?, 7 | val idAwayTeam : String?, 8 | val idEvent : String?, 9 | val idHomeTeam : String?, 10 | val idLeague : String?, 11 | val idSoccerXML : String?, 12 | val intAwayScore : String?, 13 | val intAwayShots : String?, 14 | val intHomeScore : String?, 15 | val intHomeShots : String?, 16 | val intRound : String?, 17 | val intSpectators : String?, 18 | val strAwayFormation : String?, 19 | val strAwayGoalDetails : String?, 20 | val strAwayLineupDefense : String?, 21 | val strAwayLineupForward : String?, 22 | val strAwayLineupGoalkeeper : String?, 23 | val strAwayLineupMidfield : String?, 24 | val strAwayLineupSubstitutes : String?, 25 | val strAwayRedCards : String?, 26 | val strAwayTeam : String?, 27 | val strAwayYellowCards : String?, 28 | val strBanner : String?, 29 | val strCircuit : String?, 30 | val strCity : String?, 31 | val strCountry : String?, 32 | val strDate : String?, 33 | val strDescriptionEN : String?, 34 | val strEvent : String?, 35 | val strEventAlternate : String?, 36 | val strFanart : String?, 37 | val strFilename : String?, 38 | val strHomeFormation : String?, 39 | val strHomeGoalDetails : String?, 40 | val strHomeLineupDefense : String?, 41 | val strHomeLineupForward : String?, 42 | val strHomeLineupGoalkeeper : String?, 43 | val strHomeLineupMidfield : String?, 44 | val strHomeLineupSubstitutes : String?, 45 | val strHomeRedCards : String?, 46 | val strHomeTeam : String?, 47 | val strHomeYellowCards : String?, 48 | val strLeague : String?, 49 | val strLocked : String?, 50 | val strMap : String?, 51 | val strPoster : String?, 52 | val strResult : String?, 53 | val strSeason : String?, 54 | val strSport : String?, 55 | val strTVStation : String?, 56 | val strThumb : String?, 57 | val strTime : String?, 58 | val strTimeLocal : String?, 59 | val strTweet1 : String?, 60 | val strTweet2 : String?, 61 | val strTweet3 : String?, 62 | val strVideo : String? 63 | ){ 64 | companion object{ 65 | const val TABLE_NAME: String = "favorite_match" 66 | const val ID: String = "ID_" 67 | const val dateEvent: String = "dateEvent" 68 | const val dateEventLocal: String = "dateEventLocal" 69 | const val idAwayTeam: String = "idAwayTeam" 70 | const val idEvent: String ="idEvent" 71 | const val idHomeTeam: String = "idHomeTeam" 72 | const val idLeague: String ="idLeague" 73 | const val idSoccerXML: String ="idSoccerXML" 74 | const val intAwayScore: String ="intAwayScore" 75 | const val intAwayShots: String ="intAwayShots" 76 | const val intHomeScore: String ="intHomeScore" 77 | const val intHomeShots: String ="intHomeShots" 78 | const val intRound: String ="intRound" 79 | const val intSpectators: String ="intSpectators" 80 | const val strAwayFormation: String ="strAwayFormation" 81 | const val strAwayGoalDetails: String = "strAwayGoalDetails" 82 | const val strAwayLineupDefense: String ="strAwayLineupDefense" 83 | const val strAwayLineupForward: String ="strAwayLineupForward" 84 | const val strAwayLineupGoalkeeper: String ="strAwayLineupGoalkeeper" 85 | const val strAwayLineupMidfield: String ="strAwayLineupMidfield" 86 | const val strAwayLineupSubstitutes: String ="strAwayLineupSubstitutes" 87 | const val strAwayRedCards: String ="strAwayRedCards" 88 | const val strAwayTeam: String ="strAwayTeam" 89 | const val strAwayYellowCards: String = "strAwayYellowCards" 90 | const val strBanner: String ="strBanner" 91 | const val strCircuit: String = "strCircuit" 92 | const val strCity: String ="strCity" 93 | const val strCountry: String = "strCountry" 94 | const val strDate: String ="strDate" 95 | const val strDescriptionEN: String ="strDescriptionEN" 96 | const val strEvent: String ="strEvent" 97 | const val strEventAlternate: String ="strEventAlternate" 98 | const val strFanart: String ="strFanart" 99 | const val strFilename: String ="strFilename" 100 | const val strHomeFormation: String ="strHomeFormation" 101 | const val strHomeGoalDetails: String = "strHomeGoalDetails" 102 | const val strHomeLineupDefense: String ="strHomeLineupDefense" 103 | const val strHomeLineupForward: String ="strHomeLineupForward" 104 | const val strHomeLineupGoalkeeper: String ="strHomeLineupGoalkeeper" 105 | const val strHomeLineupMidfield: String ="strHomeLineupMidfield" 106 | const val strHomeLineupSubstitutes: String ="strHomeLineupSubstitutes" 107 | const val strHomeRedCards: String ="strHomeRedCards" 108 | const val strHomeTeam: String ="strHomeTeam" 109 | const val strHomeYellowCards: String = "strHomeYellowCards" 110 | const val strLeague: String ="strLeague" 111 | const val strLocked: String ="strLocked" 112 | const val strMap: String = "strMap" 113 | const val strPoster: String ="strPoster" 114 | const val strResult: String ="strResult" 115 | const val strSeason: String ="strSeason" 116 | const val strSport: String ="strSport" 117 | const val strTVStation: String ="strTVStation" 118 | const val strThumb: String ="strThumb" 119 | const val strTime: String ="strTime" 120 | const val strTimeLocal: String ="strTimeLocal" 121 | const val strTweet1: String ="strTweet1" 122 | const val strTweet2: String ="strTweet2" 123 | const val strTweet3: String ="strTweet3" 124 | const val strVideo: String ="strVideo" 125 | } 126 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/activity/Pencarian.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.activity 2 | 3 | import android.content.Intent 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.view.Menu 7 | import android.view.MenuItem 8 | import android.view.View 9 | import android.widget.Toast 10 | import androidx.appcompat.widget.SearchView 11 | import androidx.recyclerview.widget.LinearLayoutManager 12 | import androidx.recyclerview.widget.RecyclerView 13 | import com.dizcoding.kadesubmission2.R 14 | import com.dizcoding.kadesubmission2.adapter.MatchAdapter 15 | import com.dizcoding.kadesubmission2.api.TheSportDbApi 16 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 17 | import com.dizcoding.kadesubmission2.model.* 18 | import kotlinx.android.synthetic.main.activity_pencarian.* 19 | import kotlinx.android.synthetic.main.main_activity.* 20 | import kotlinx.android.synthetic.main.main_activity.toolbar 21 | import org.jetbrains.anko.intentFor 22 | import org.jetbrains.anko.toast 23 | import retrofit2.Call 24 | import retrofit2.Callback 25 | import retrofit2.Response 26 | 27 | class Pencarian : AppCompatActivity(), SearchView.OnQueryTextListener, FragmentNavigationListener { 28 | 29 | private var dataTeams: AllTeamResponse = AllTeamResponse(listOf()) 30 | private var dataPencarian = MatchResponse(listOf()) 31 | private var listIdLiga = mutableListOf() 32 | private lateinit var adapter: MatchAdapter 33 | 34 | override fun onCreate(savedInstanceState: Bundle?) { 35 | super.onCreate(savedInstanceState) 36 | setContentView(R.layout.activity_pencarian) 37 | setSupportActionBar(toolbar) 38 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 39 | } 40 | 41 | override fun onSupportNavigateUp(): Boolean { 42 | finish() 43 | return super.onSupportNavigateUp() 44 | } 45 | 46 | private fun refreshData(dataTeams: AllTeamResponse, data: MatchResponse) { 47 | adapter = MatchAdapter(dataTeams, data, this) 48 | rvMatchSearch.adapter = adapter 49 | rvMatchSearch.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false) 50 | adapter.notifyDataSetChanged() 51 | } 52 | 53 | override fun onCreateOptionsMenu(menu: Menu?): Boolean { 54 | menuInflater.inflate(R.menu.action_menu, menu) 55 | val searchItem: MenuItem = menu!!.findItem(R.id.searchMenu) 56 | val searchView: SearchView = searchItem.actionView as SearchView 57 | searchView.setOnQueryTextListener(this) 58 | return super.onCreateOptionsMenu(menu) 59 | } 60 | 61 | override fun onQueryTextSubmit(query: String?): Boolean { 62 | query?.let { toast("Mencari " + it) } 63 | query?.let { cariPertandingan(it) } 64 | return false 65 | } 66 | 67 | override fun onQueryTextChange(newText: String?): Boolean { 68 | return false 69 | } 70 | 71 | private fun cariPertandingan(query: String) { 72 | TheSportDbApi().services.cariPertandingan(query).enqueue(object : Callback { 73 | override fun onFailure(call: Call, t: Throwable) { 74 | toast("Failure get cari pertandingan : " + t.message) 75 | } 76 | 77 | override fun onResponse( 78 | call: Call, 79 | response: Response 80 | ) { 81 | var listEvent = response.body()!!.event 82 | listEvent = if (listEvent.isNullOrEmpty()) { 83 | listOf() 84 | } else { 85 | listEvent.filter { it.strSport == "Soccer" } 86 | } 87 | dataPencarian = MatchResponse(listEvent) 88 | addLigaList(dataPencarian.events) 89 | } 90 | }) 91 | 92 | } 93 | 94 | private fun addLigaList(events: List) { 95 | if (!events.isNullOrEmpty()) { 96 | events.forEach { 97 | if (cekLigaList(it.idLeague)) { 98 | listIdLiga.add(it.idLeague) 99 | } 100 | } 101 | } 102 | if (!listIdLiga.isNullOrEmpty()) { 103 | listIdLiga.forEach { 104 | getAllTeams(it) 105 | } 106 | } 107 | } 108 | 109 | private fun getAllTeams(id_liga: String) { 110 | TheSportDbApi().services.allTeams(id_liga).enqueue(object : Callback { 111 | override fun onFailure(call: Call, t: Throwable) { 112 | toast("Failure get All Teams : " + t.message) 113 | } 114 | 115 | override fun onResponse( 116 | call: Call, 117 | response: Response 118 | ) { 119 | dataTeams = response.body()!! 120 | if (!dataTeams.teams.isNullOrEmpty()) { 121 | if (!dataPencarian.events.isNullOrEmpty()) { 122 | noData.visibility = View.GONE 123 | refreshData(AllTeamResponse(dataTeams.teams), dataPencarian) 124 | } 125 | } 126 | 127 | } 128 | }) 129 | 130 | } 131 | 132 | private fun cekLigaList(idLiga: String): Boolean { 133 | val listliga = listIdLiga.filter { it == idLiga } 134 | return listliga.isEmpty() 135 | } 136 | 137 | override fun onMatchItemSelected(data: Event) { 138 | val intent = Intent(applicationContext, DetailMatchActivity::class.java) 139 | intent.putExtra("id", data.idEvent) 140 | startActivity(intent) 141 | } 142 | 143 | override fun openFragment() {} 144 | override fun loadData(v: View) {} 145 | override fun refreshNextMatch(v: View) {} 146 | override fun refreshPrevMatch(v: View) {} 147 | override fun pagerAdapterDetails(data: Leagues) {} 148 | override fun pagerAdapterSelected(data: Leagues) {} 149 | 150 | 151 | } 152 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/activity/Favorit.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.activity 2 | 3 | import android.content.Intent 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.view.View 7 | import androidx.recyclerview.widget.LinearLayoutManager 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.dizcoding.kadesubmission2.R 10 | import com.dizcoding.kadesubmission2.adapter.MatchAdapter 11 | import com.dizcoding.kadesubmission2.api.TheSportDbApi 12 | import com.dizcoding.kadesubmission2.db.dbFavoriteMatch 13 | import com.dizcoding.kadesubmission2.db.table.FavoriteMatch 14 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 15 | import com.dizcoding.kadesubmission2.model.* 16 | import kotlinx.android.synthetic.main.activity_favorit.* 17 | import org.jetbrains.anko.db.classParser 18 | import org.jetbrains.anko.db.select 19 | import org.jetbrains.anko.toast 20 | import retrofit2.Call 21 | import retrofit2.Callback 22 | import retrofit2.Response 23 | 24 | class Favorit : AppCompatActivity(), FragmentNavigationListener { 25 | 26 | 27 | private var dataTeams: AllTeamResponse = AllTeamResponse(listOf()) 28 | private var dataPertandingan = MatchResponse(listOf()) 29 | private var listIdLiga = mutableListOf() 30 | private lateinit var adapter: MatchAdapter 31 | 32 | 33 | override fun onCreate(savedInstanceState: Bundle?) { 34 | super.onCreate(savedInstanceState) 35 | setContentView(R.layout.activity_favorit) 36 | setSupportActionBar(toolbar) 37 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 38 | loadData() 39 | } 40 | 41 | private fun loadData() { 42 | dbFavoriteMatch.use { 43 | val result = select(FavoriteMatch.TABLE_NAME) 44 | val favorite = result.parseList(classParser()) 45 | dataPertandingan = MatchResponse(convertToTeam(favorite)) 46 | addLigaList(dataPertandingan.events) 47 | } 48 | 49 | } 50 | 51 | private fun convertToTeam(favorite: List): List { 52 | var eventList: MutableList = mutableListOf() 53 | 54 | favorite.forEach { 55 | eventList.add( 56 | Event( 57 | it.dateEvent.toString(), 58 | it.dateEventLocal.toString(), 59 | it.idAwayTeam.toString(), 60 | it.idEvent.toString(), 61 | it.idHomeTeam.toString(), 62 | it.idLeague.toString(), 63 | it.idSoccerXML.toString(), 64 | it.intAwayScore.toString(), 65 | it.intAwayShots.toString(), 66 | it.intHomeScore.toString(), 67 | it.intHomeShots.toString(), 68 | it.intRound.toString(), 69 | it.intSpectators.toString(), 70 | it.strAwayFormation.toString(), 71 | it.strAwayGoalDetails.toString(), 72 | it.strAwayLineupDefense.toString(), 73 | it.strAwayLineupForward.toString(), 74 | it.strAwayLineupGoalkeeper.toString(), 75 | it.strAwayLineupMidfield.toString(), 76 | it.strAwayLineupSubstitutes.toString(), 77 | it.strAwayRedCards.toString(), 78 | it.strAwayTeam.toString(), 79 | it.strAwayYellowCards.toString(), 80 | it.strBanner.toString(), 81 | it.strCircuit.toString(), 82 | it.strCity.toString(), 83 | it.strCountry.toString(), 84 | it.strDate.toString(), 85 | it.strDescriptionEN.toString(), 86 | it.strEvent.toString(), 87 | it.strEventAlternate.toString(), 88 | it.strFanart.toString(), 89 | it.strFilename.toString(), 90 | it.strHomeFormation.toString(), 91 | it.strHomeGoalDetails.toString(), 92 | it.strHomeLineupDefense.toString(), 93 | it.strHomeLineupForward.toString(), 94 | it.strHomeLineupGoalkeeper.toString(), 95 | it.strHomeLineupMidfield.toString(), 96 | it.strHomeLineupSubstitutes.toString(), 97 | it.strHomeRedCards.toString(), 98 | it.strHomeTeam.toString(), 99 | it.strHomeYellowCards.toString(), 100 | it.strLeague.toString(), 101 | it.strLocked.toString(), 102 | it.strMap.toString(), 103 | it.strPoster.toString(), 104 | it.strResult.toString(), 105 | it.strSeason.toString(), 106 | it.strSport.toString(), 107 | it.strTVStation.toString(), 108 | it.strThumb.toString(), 109 | it.strTime.toString(), 110 | it.strTimeLocal.toString(), 111 | it.strTweet1.toString(), 112 | it.strTweet2.toString(), 113 | it.strTweet3.toString(), 114 | it.strVideo.toString() 115 | ) 116 | ) 117 | } 118 | 119 | 120 | return eventList 121 | } 122 | 123 | private fun addLigaList(events: List) { 124 | if (!events.isNullOrEmpty()) { 125 | events.forEach { 126 | if (cekLigaList(it.idLeague)) { 127 | listIdLiga.add(it.idLeague) 128 | } 129 | } 130 | } 131 | if (!listIdLiga.isNullOrEmpty()) { 132 | listIdLiga.forEach { 133 | getAllTeams(it) 134 | } 135 | } 136 | } 137 | 138 | private fun getAllTeams(id_liga: String) { 139 | TheSportDbApi().services.allTeams(id_liga).enqueue(object : Callback { 140 | override fun onFailure(call: Call, t: Throwable) { 141 | toast("Failure get All Teams : " + t.message) 142 | } 143 | 144 | override fun onResponse( 145 | call: Call, 146 | response: Response 147 | ) { 148 | response.body().let { 149 | if (it != null) { 150 | dataTeams = it 151 | refreshData(dataTeams, dataPertandingan) 152 | } 153 | } 154 | } 155 | }) 156 | 157 | } 158 | 159 | 160 | override fun onResume() { 161 | loadData() 162 | // refreshData(dataTeams,dataPertandingan) 163 | super.onResume() 164 | } 165 | 166 | 167 | private fun cekLigaList(idLiga: String): Boolean { 168 | val listliga = listIdLiga.filter { it == idLiga } 169 | return listliga.isEmpty() 170 | } 171 | 172 | private fun refreshData(dataTeams: AllTeamResponse, data: MatchResponse) { 173 | adapter = MatchAdapter(dataTeams, data, this) 174 | rvMatchFavorite.adapter = adapter 175 | rvMatchFavorite.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false) 176 | adapter.notifyDataSetChanged() 177 | noData.visibility = View.GONE 178 | 179 | } 180 | 181 | override fun onMatchItemSelected(data: Event) { 182 | val intent = Intent(applicationContext, DetailMatchActivity::class.java) 183 | intent.putExtra("id", data.idEvent) 184 | startActivity(intent) 185 | } 186 | 187 | override fun openFragment() {} 188 | override fun loadData(v: View) {} 189 | override fun refreshNextMatch(v: View) {} 190 | override fun refreshPrevMatch(v: View) {} 191 | override fun pagerAdapterDetails(data: Leagues) {} 192 | override fun pagerAdapterSelected(data: Leagues) {} 193 | 194 | override fun onSupportNavigateUp(): Boolean { 195 | finish() 196 | return super.onSupportNavigateUp() 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/layout/adapter/MatchItemLayout.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.layout.adapter 2 | 3 | import android.content.Context 4 | import android.graphics.Color 5 | import android.graphics.Typeface 6 | import android.view.Gravity 7 | import android.view.View 8 | import android.widget.ImageView 9 | import android.widget.LinearLayout 10 | import com.dizcoding.kadesubmission2.R 11 | import org.jetbrains.anko.* 12 | import org.jetbrains.anko.cardview.v7.cardView 13 | 14 | class MatchItemLayout : AnkoComponent { 15 | override fun createView(ui: AnkoContext): View = with(ui) { 16 | cardView { 17 | lparams(matchParent, dip(150)) { 18 | margin = dip(5) 19 | radius = dip(5).toFloat() 20 | 21 | } 22 | linearLayout { 23 | lparams(matchParent, matchParent) { 24 | orientation = LinearLayout.VERTICAL 25 | } 26 | 27 | /*Header / Title*/ 28 | linearLayout { 29 | lparams(matchParent, matchParent) { 30 | orientation = LinearLayout.VERTICAL 31 | weight = .3.toFloat() 32 | backgroundColor = Color.YELLOW 33 | } 34 | linearLayout { 35 | lparams(matchParent, matchParent) { 36 | weight = .1.toFloat() 37 | } 38 | 39 | textView { 40 | id = R.id.tvEventName 41 | gravity = Gravity.CENTER 42 | textColor = Color.BLACK 43 | typeface = Typeface.DEFAULT_BOLD 44 | textSize = dip(6).toFloat() 45 | }.lparams(matchParent, matchParent) 46 | } 47 | linearLayout { 48 | lparams(matchParent, matchParent) { 49 | weight = .1.toFloat() 50 | } 51 | 52 | textView { 53 | id = R.id.tvLigaName 54 | gravity = Gravity.CENTER 55 | textColor = Color.BLACK 56 | typeface = Typeface.DEFAULT_BOLD 57 | textSize = dip(5).toFloat() 58 | }.lparams(matchParent, matchParent) 59 | } 60 | } 61 | /*Body*/ 62 | linearLayout { 63 | lparams(matchParent, matchParent) { 64 | orientation = LinearLayout.HORIZONTAL 65 | weight = .1.toFloat() 66 | padding = dip(5) 67 | } 68 | 69 | /*Home*/ 70 | linearLayout { 71 | lparams(matchParent, matchParent) { 72 | orientation = LinearLayout.HORIZONTAL 73 | weight = .1.toFloat() 74 | } 75 | /*Home Image*/ 76 | linearLayout { 77 | lparams(matchParent, matchParent) { 78 | weight = .1.toFloat() 79 | orientation = LinearLayout.VERTICAL 80 | } 81 | linearLayout { 82 | lparams(matchParent, matchParent) { 83 | weight = .1.toFloat() 84 | } 85 | imageView { 86 | id = R.id.ivHome 87 | scaleType = ImageView.ScaleType.FIT_CENTER 88 | }.lparams(matchParent, matchParent) 89 | } 90 | linearLayout { 91 | lparams(matchParent, wrapContent) 92 | textView { 93 | id = R.id.tvHomeTeamName 94 | gravity = Gravity.CENTER 95 | textColor = Color.BLACK 96 | typeface = Typeface.DEFAULT_BOLD 97 | textSize = dip(5).toFloat() 98 | }.lparams(matchParent, matchParent) 99 | } 100 | 101 | } 102 | /*Home Score*/ 103 | linearLayout { 104 | lparams(matchParent, matchParent) { 105 | weight = .4.toFloat() 106 | orientation = LinearLayout.VERTICAL 107 | } 108 | textView { 109 | id = R.id.tvHomeScore 110 | 111 | gravity = Gravity.CENTER 112 | textColor = Color.BLACK 113 | typeface = Typeface.DEFAULT_BOLD 114 | textSize = dip(8).toFloat() 115 | 116 | }.lparams(matchParent, matchParent) 117 | } 118 | 119 | } 120 | /*Pemisah*/ 121 | linearLayout { 122 | lparams(dip(20), matchParent) { 123 | orientation = LinearLayout.VERTICAL 124 | } 125 | textView(":") { 126 | gravity = Gravity.CENTER 127 | textColor = Color.BLACK 128 | typeface = Typeface.DEFAULT_BOLD 129 | textSize = dip(8).toFloat() 130 | 131 | }.lparams(matchParent, matchParent) 132 | } 133 | 134 | /*Away*/ 135 | linearLayout { 136 | lparams(matchParent, matchParent) { 137 | orientation = LinearLayout.HORIZONTAL 138 | weight = .1.toFloat() 139 | } 140 | /*Away Score*/ 141 | linearLayout { 142 | lparams(matchParent, matchParent) { 143 | weight = .4.toFloat() 144 | orientation = LinearLayout.VERTICAL 145 | } 146 | textView { 147 | id = R.id.tvAwayScore 148 | gravity = Gravity.CENTER 149 | textColor = Color.BLACK 150 | typeface = Typeface.DEFAULT_BOLD 151 | textSize = dip(8).toFloat() 152 | 153 | }.lparams(matchParent, matchParent) 154 | } 155 | /*Away Image*/ 156 | linearLayout { 157 | lparams(matchParent, matchParent) { 158 | weight = .1.toFloat() 159 | orientation = LinearLayout.VERTICAL 160 | } 161 | 162 | linearLayout { 163 | lparams(matchParent, matchParent) { 164 | weight = .1.toFloat() 165 | } 166 | imageView { 167 | id = R.id.ivAway 168 | scaleType = ImageView.ScaleType.FIT_CENTER 169 | }.lparams(matchParent, matchParent) 170 | } 171 | linearLayout { 172 | lparams(matchParent, wrapContent) 173 | textView { 174 | id = R.id.tvAwayTeamName 175 | gravity = Gravity.CENTER 176 | textColor = Color.BLACK 177 | typeface = Typeface.DEFAULT_BOLD 178 | textSize = dip(5).toFloat() 179 | }.lparams(matchParent, matchParent) 180 | } 181 | } 182 | 183 | } 184 | } 185 | 186 | 187 | } 188 | } 189 | 190 | 191 | } 192 | } -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/activity/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.activity 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import androidx.appcompat.app.AppCompatActivity 6 | import android.os.Bundle 7 | import android.view.Menu 8 | import android.view.MenuItem 9 | import android.view.View 10 | import androidx.fragment.app.Fragment 11 | 12 | import com.dizcoding.kadesubmission2.R 13 | import com.dizcoding.kadesubmission2.api.TheSportDbApi 14 | import com.dizcoding.kadesubmission2.fragment.BaseFragment 15 | import com.dizcoding.kadesubmission2.fragment.NextMatchFragment 16 | import com.dizcoding.kadesubmission2.fragment.PrevMatchFragment 17 | import com.dizcoding.kadesubmission2.interfaceclass.FragmentNavigationListener 18 | import com.dizcoding.kadesubmission2.model.* 19 | import kotlinx.android.synthetic.main.main_activity.* 20 | import org.jetbrains.anko.intentFor 21 | import org.jetbrains.anko.toast 22 | import retrofit2.Call 23 | import retrofit2.Callback 24 | import retrofit2.Response 25 | 26 | 27 | class MainActivity : AppCompatActivity(), FragmentNavigationListener { 28 | 29 | private var dataDetailPertandingan: DetailPertandinganResponse = 30 | DetailPertandinganResponse(listOf()) 31 | private var dataDetailLiga: DetailLigaResponse = DetailLigaResponse(listOf()) 32 | private var dataNextMatch: MatchResponse = MatchResponse(listOf()) 33 | private var dataPrevMatch: MatchResponse = MatchResponse(listOf()) 34 | private var dataTeams: AllTeamResponse = AllTeamResponse(listOf()) 35 | 36 | private lateinit var nextMatchFragment: NextMatchFragment 37 | private lateinit var prefMatchFragment: PrevMatchFragment 38 | 39 | 40 | private var idLiga: String = "4328" 41 | private var idEvent: String = "602262" 42 | 43 | private lateinit var prefMatcView: View 44 | private lateinit var nextMatcView: View 45 | private lateinit var conntext: Context 46 | 47 | 48 | override fun onCreate(savedInstanceState: Bundle?) { 49 | super.onCreate(savedInstanceState) 50 | setContentView(R.layout.main_activity) 51 | setSupportActionBar(toolbar) 52 | conntext = this 53 | nextMatchFragment = NextMatchFragment(this) 54 | prefMatchFragment = PrevMatchFragment(this) 55 | dorApi() 56 | openBaseFragment() 57 | } 58 | 59 | override fun onCreateOptionsMenu(menu: Menu?): Boolean { 60 | menuInflater.inflate(R.menu.main_activity_menu, menu) 61 | return super.onCreateOptionsMenu(menu) 62 | } 63 | 64 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 65 | when (item.itemId) { 66 | R.id.searchMenu -> startActivity(intentFor()) 67 | R.id.favorit -> startActivity(intentFor()) 68 | } 69 | return super.onOptionsItemSelected(item) 70 | } 71 | 72 | 73 | private fun commitFragment(fragment: Fragment) { 74 | val fragmentManager = supportFragmentManager 75 | val fragmentTransaction = fragmentManager.beginTransaction() 76 | fragmentTransaction.replace(R.id.container, fragment) 77 | fragmentTransaction.addToBackStack(null) 78 | fragmentTransaction.commit() 79 | } 80 | 81 | private fun openBaseFragment() { 82 | commitFragment(BaseFragment(supportFragmentManager, this)) 83 | } 84 | 85 | override fun openFragment() { 86 | 87 | } 88 | 89 | override fun pagerAdapterDetails(data: Leagues) { 90 | val bundle = Bundle() 91 | bundle.putParcelable("league", data) 92 | startActivity(intentFor("Bundle" to bundle)) 93 | } 94 | 95 | override fun pagerAdapterSelected(data: Leagues) { 96 | idLiga = data.id 97 | getAllTeams(idLiga) 98 | nextMatch(idLiga) 99 | prevMatch(idLiga) 100 | } 101 | 102 | override fun refreshNextMatch(v: View) { 103 | nextMatcView = v 104 | nextMatch(idLiga) 105 | } 106 | 107 | override fun refreshPrevMatch(v: View) { 108 | prefMatcView = v 109 | prevMatch(idLiga) 110 | } 111 | 112 | override fun loadData(v: View) { 113 | 114 | } 115 | 116 | override fun onMatchItemSelected(data: Event) { 117 | val intent = Intent(applicationContext, DetailMatchActivity::class.java) 118 | intent.putExtra("id", data.idEvent) 119 | startActivity(intent) 120 | } 121 | 122 | // Dor API 123 | private fun dorApi() { 124 | getAllTeams(idLiga) 125 | detailLiga(idLiga) 126 | detailPertandingan(idEvent) 127 | } 128 | 129 | private fun detailLiga(id_liga: String) { 130 | TheSportDbApi().services.detailLiga(id_liga).enqueue(object : Callback { 131 | override fun onFailure(call: Call, t: Throwable) { 132 | toast("Failure get Detail Liga : " + t.message) 133 | } 134 | 135 | override fun onResponse( 136 | call: Call, 137 | response: Response 138 | ) { 139 | response.body().let { 140 | if (it != null) { 141 | dataDetailLiga = it 142 | } 143 | } 144 | } 145 | }) 146 | 147 | } 148 | 149 | private fun nextMatch(id_liga: String) { 150 | TheSportDbApi().services.nextMatch(id_liga).enqueue(object : Callback { 151 | override fun onFailure(call: Call, t: Throwable) { 152 | toast("Failure get Next Match : " + t.message) 153 | } 154 | 155 | override fun onResponse( 156 | call: Call, 157 | response: Response 158 | ) { 159 | response.body().let { 160 | if (it != null) { 161 | dataNextMatch = it 162 | nextMatchFragment.refreshData(dataTeams, dataNextMatch, nextMatcView) 163 | } 164 | } 165 | } 166 | }) 167 | 168 | } 169 | 170 | private fun prevMatch(id_liga: String) { 171 | TheSportDbApi().services.prevMatch(id_liga).enqueue(object : Callback { 172 | override fun onFailure(call: Call, t: Throwable) { 173 | toast("Failure get Prev Match : " + t.message) 174 | } 175 | 176 | override fun onResponse( 177 | call: Call, 178 | response: Response 179 | ) { 180 | response.body().let { 181 | if (it != null) { 182 | dataPrevMatch = it 183 | prefMatchFragment.refreshData(dataTeams, dataPrevMatch, prefMatcView) 184 | } 185 | } 186 | } 187 | }) 188 | 189 | } 190 | 191 | private fun detailPertandingan(id_event: String) { 192 | TheSportDbApi().services.detailPertandingan(id_event) 193 | .enqueue(object : Callback { 194 | override fun onFailure(call: Call, t: Throwable) { 195 | toast("Failure get detail pertandingan : " + t.message) 196 | } 197 | 198 | override fun onResponse( 199 | call: Call, 200 | response: Response 201 | ) { 202 | response.body().let { 203 | if (it != null) { 204 | dataDetailPertandingan = it 205 | } 206 | } 207 | } 208 | }) 209 | 210 | } 211 | 212 | private fun getAllTeams(id_liga: String) { 213 | TheSportDbApi().services.allTeams(id_liga).enqueue(object : Callback { 214 | override fun onFailure(call: Call, t: Throwable) { 215 | toast("Failure get All Teams : " + t.message) 216 | } 217 | 218 | override fun onResponse( 219 | call: Call, 220 | response: Response 221 | ) { 222 | dataTeams = AllTeamResponse(listOf()) 223 | response.body().let { 224 | if (it != null) { 225 | dataTeams = it 226 | prefMatchFragment.refreshData(dataTeams, dataPrevMatch, prefMatcView) 227 | nextMatchFragment.refreshData(dataTeams, dataNextMatch, nextMatcView) 228 | } 229 | } 230 | 231 | } 232 | }) 233 | 234 | } 235 | 236 | } 237 | -------------------------------------------------------------------------------- /app/src/main/java/com/dizcoding/kadesubmission2/activity/DetailMatchActivity.kt: -------------------------------------------------------------------------------- 1 | package com.dizcoding.kadesubmission2.activity 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import android.view.Menu 6 | import android.view.MenuItem 7 | import androidx.core.content.ContextCompat 8 | import com.dizcoding.kadesubmission2.R 9 | import com.dizcoding.kadesubmission2.api.TheSportDbApi 10 | import com.dizcoding.kadesubmission2.db.dbFavoriteMatch 11 | import com.dizcoding.kadesubmission2.db.table.FavoriteMatch 12 | import com.dizcoding.kadesubmission2.model.AllTeamResponse 13 | import com.dizcoding.kadesubmission2.model.DetailPertandinganResponse 14 | import com.dizcoding.kadesubmission2.model.Event 15 | import com.dizcoding.kadesubmission2.model.Team 16 | import com.dizcoding.kadesubmission2.tools.Utils 17 | import kotlinx.android.synthetic.main.detail_match_activity.* 18 | import org.jetbrains.anko.db.classParser 19 | import org.jetbrains.anko.db.insert 20 | import org.jetbrains.anko.db.select 21 | import org.jetbrains.anko.db.delete 22 | import org.jetbrains.anko.toast 23 | import retrofit2.Call 24 | import retrofit2.Callback 25 | import retrofit2.Response 26 | 27 | class DetailMatchActivity : AppCompatActivity() { 28 | private var dataDetailPertandingan: DetailPertandinganResponse = 29 | DetailPertandinganResponse(listOf()) 30 | private var event: Event? = null 31 | private var home: Team? = null 32 | private var away: Team? = null 33 | private var menuItem: Menu? = null 34 | 35 | private var favorit: Boolean = false 36 | private var isMenuReady: Boolean = false 37 | 38 | private lateinit var idEvent: String 39 | private lateinit var dataMatch: FavoriteMatch 40 | 41 | override fun onCreate(savedInstanceState: Bundle?) { 42 | super.onCreate(savedInstanceState) 43 | setContentView(R.layout.detail_match_activity) 44 | setSupportActionBar(toolbar) 45 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 46 | idEvent = intent.getStringExtra("id") 47 | isFavorit() 48 | detailPertandingan(idEvent) 49 | 50 | } 51 | 52 | override fun onSupportNavigateUp(): Boolean { 53 | finish() 54 | return super.onSupportNavigateUp() 55 | } 56 | 57 | override fun onCreateOptionsMenu(menu: Menu?): Boolean { 58 | menuInflater.inflate(R.menu.detail_match_menu, menu) 59 | menuItem = menu 60 | setIcon() 61 | return super.onCreateOptionsMenu(menu) 62 | } 63 | 64 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 65 | when (item.itemId) { 66 | R.id.favorit -> { 67 | if (isMenuReady) { 68 | if (favorit) hapus() else simpan() 69 | favorit = !favorit 70 | setIcon() 71 | } 72 | } 73 | } 74 | return super.onOptionsItemSelected(item) 75 | } 76 | 77 | private fun setDataMatch(event: Event) { 78 | dataMatch = FavoriteMatch( 79 | 0, event.dateEvent 80 | , event.dateEventLocal 81 | , event.idAwayTeam 82 | , event.idEvent 83 | , event.idHomeTeam 84 | , event.idLeague 85 | , event.idSoccerXML 86 | , event.intAwayScore 87 | , event.intAwayShots 88 | , event.intHomeScore 89 | , event.intHomeShots 90 | , event.intRound 91 | , event.intSpectators 92 | , event.strAwayFormation 93 | , event.strAwayGoalDetails 94 | , event.strAwayLineupDefense 95 | , event.strAwayLineupForward 96 | , event.strAwayLineupGoalkeeper 97 | , event.strAwayLineupMidfield 98 | , event.strAwayLineupSubstitutes 99 | , event.strAwayRedCards 100 | , event.strAwayTeam 101 | , event.strAwayYellowCards 102 | , event.strBanner 103 | , event.strCircuit 104 | , event.strCity 105 | , event.strCountry 106 | , event.strDate 107 | , event.strDescriptionEN 108 | , event.strEvent 109 | , event.strEventAlternate 110 | , event.strFanart 111 | , event.strFilename 112 | , event.strHomeFormation 113 | , event.strHomeGoalDetails 114 | , event.strHomeLineupDefense 115 | , event.strHomeLineupForward 116 | , event.strHomeLineupGoalkeeper 117 | , event.strHomeLineupMidfield 118 | , event.strHomeLineupSubstitutes 119 | , event.strHomeRedCards 120 | , event.strHomeTeam 121 | , event.strHomeYellowCards 122 | , event.strLeague 123 | , event.strLocked 124 | , event.strMap 125 | , event.strPoster 126 | , event.strResult 127 | , event.strSeason 128 | , event.strSport 129 | , event.strTVStation 130 | , event.strThumb 131 | , event.strTime 132 | , event.strTimeLocal 133 | , event.strTweet1 134 | , event.strTweet2 135 | , event.strTweet3 136 | , event.strVideo 137 | ) 138 | } 139 | 140 | private fun simpan() { 141 | dbFavoriteMatch.use { 142 | insert( 143 | FavoriteMatch.TABLE_NAME, 144 | FavoriteMatch.dateEvent to dataMatch.dateEvent, 145 | FavoriteMatch.dateEventLocal to dataMatch.dateEventLocal, 146 | FavoriteMatch.idAwayTeam to dataMatch.idAwayTeam, 147 | FavoriteMatch.idEvent to dataMatch.idEvent, 148 | FavoriteMatch.idHomeTeam to dataMatch.idHomeTeam, 149 | FavoriteMatch.idLeague to dataMatch.idLeague, 150 | FavoriteMatch.idSoccerXML to dataMatch.idSoccerXML, 151 | FavoriteMatch.intAwayScore to dataMatch.intAwayScore, 152 | FavoriteMatch.intAwayShots to dataMatch.intAwayShots, 153 | FavoriteMatch.intHomeScore to dataMatch.intHomeScore, 154 | FavoriteMatch.intHomeShots to dataMatch.intHomeShots, 155 | FavoriteMatch.intRound to dataMatch.intRound, 156 | FavoriteMatch.intSpectators to dataMatch.intSpectators, 157 | FavoriteMatch.strAwayFormation to dataMatch.strAwayFormation, 158 | FavoriteMatch.strAwayGoalDetails to dataMatch.strAwayGoalDetails, 159 | FavoriteMatch.strAwayLineupDefense to dataMatch.strAwayLineupDefense, 160 | FavoriteMatch.strAwayLineupForward to dataMatch.strAwayLineupForward, 161 | FavoriteMatch.strAwayLineupGoalkeeper to dataMatch.strAwayLineupGoalkeeper, 162 | FavoriteMatch.strAwayLineupMidfield to dataMatch.strAwayLineupMidfield, 163 | FavoriteMatch.strAwayLineupSubstitutes to dataMatch.strAwayLineupSubstitutes, 164 | FavoriteMatch.strAwayRedCards to dataMatch.strAwayRedCards, 165 | FavoriteMatch.strAwayTeam to dataMatch.strAwayTeam, 166 | FavoriteMatch.strAwayYellowCards to dataMatch.strAwayYellowCards, 167 | FavoriteMatch.strBanner to dataMatch.strBanner, 168 | FavoriteMatch.strCircuit to dataMatch.strCircuit, 169 | FavoriteMatch.strCity to dataMatch.strCity, 170 | FavoriteMatch.strCountry to dataMatch.strCountry, 171 | FavoriteMatch.strDate to dataMatch.strDate, 172 | FavoriteMatch.strDescriptionEN to dataMatch.strDescriptionEN, 173 | FavoriteMatch.strEvent to dataMatch.strEvent, 174 | FavoriteMatch.strEventAlternate to dataMatch.strEventAlternate, 175 | FavoriteMatch.strFanart to dataMatch.strFanart, 176 | FavoriteMatch.strFilename to dataMatch.strFilename, 177 | FavoriteMatch.strHomeFormation to dataMatch.strHomeFormation, 178 | FavoriteMatch.strHomeGoalDetails to dataMatch.strHomeGoalDetails, 179 | FavoriteMatch.strHomeLineupDefense to dataMatch.strHomeLineupDefense, 180 | FavoriteMatch.strHomeLineupForward to dataMatch.strHomeLineupForward, 181 | FavoriteMatch.strHomeLineupGoalkeeper to dataMatch.strHomeLineupGoalkeeper, 182 | FavoriteMatch.strHomeLineupMidfield to dataMatch.strHomeLineupMidfield, 183 | FavoriteMatch.strHomeLineupSubstitutes to dataMatch.strHomeLineupSubstitutes, 184 | FavoriteMatch.strHomeRedCards to dataMatch.strHomeRedCards, 185 | FavoriteMatch.strHomeTeam to dataMatch.strHomeTeam, 186 | FavoriteMatch.strHomeYellowCards to dataMatch.strHomeYellowCards, 187 | FavoriteMatch.strLeague to dataMatch.strLeague, 188 | FavoriteMatch.strLocked to dataMatch.strLocked, 189 | FavoriteMatch.strMap to dataMatch.strMap, 190 | FavoriteMatch.strPoster to dataMatch.strPoster, 191 | FavoriteMatch.strResult to dataMatch.strResult, 192 | FavoriteMatch.strSeason to dataMatch.strSeason, 193 | FavoriteMatch.strSport to dataMatch.strSport, 194 | FavoriteMatch.strTVStation to dataMatch.strTVStation, 195 | FavoriteMatch.strThumb to dataMatch.strThumb, 196 | FavoriteMatch.strTime to dataMatch.strTime, 197 | FavoriteMatch.strTimeLocal to dataMatch.strTimeLocal, 198 | FavoriteMatch.strTweet1 to dataMatch.strTweet1, 199 | FavoriteMatch.strTweet2 to dataMatch.strTweet2, 200 | FavoriteMatch.strTweet3 to dataMatch.strTweet3, 201 | FavoriteMatch.strVideo to dataMatch.strVideo 202 | ) 203 | } 204 | } 205 | 206 | private fun hapus() { 207 | dbFavoriteMatch.use { 208 | delete( 209 | FavoriteMatch.TABLE_NAME, 210 | "(idEvent = {id})", 211 | "id" to idEvent 212 | ) 213 | } 214 | } 215 | 216 | private fun isFavorit() { 217 | dbFavoriteMatch.use { 218 | val result = 219 | select(FavoriteMatch.TABLE_NAME).whereArgs("idEvent ={id}", "id" to idEvent) 220 | val favorite = result.parseList(classParser()) 221 | if (favorite.isNotEmpty()) favorit = true 222 | } 223 | } 224 | 225 | private fun setIcon() { 226 | if (favorit) 227 | menuItem?.getItem(0)?.icon = 228 | ContextCompat.getDrawable(this, R.drawable.ic_favorite_border_black_24dp) 229 | else 230 | menuItem?.getItem(0)?.icon = 231 | ContextCompat.getDrawable(this, R.drawable.ic_favorite_black_24dp) 232 | } 233 | 234 | private fun loadContent() { 235 | home?.strTeamBadge?.let { Utils().picShow(it, ivHomeBadge) } 236 | tvHomeScore.text = event?.intHomeScore ?: "-" 237 | tvHomeName.text = event?.strHomeTeam ?: "-" 238 | 239 | away?.strTeamBadge?.let { Utils().picShow(it, ivAwayBadge) } 240 | tvAwayScore.text = event?.intAwayScore ?: "-" 241 | tvAwayName.text = event?.strAwayTeam ?: "-" 242 | 243 | // body header 244 | strEvent.text = event?.strEvent ?: "-" 245 | strLeague.text = event?.strLeague ?: "-" 246 | 247 | // home content 248 | home?.strTeamLogo?.let { Utils().picShow(it, ivHomeLogo) } 249 | tvHomeTeamName.text = event?.strHomeTeam ?: "-" 250 | tvHomeFormation.text = event?.strHomeFormation ?: "-" 251 | tvHomeShots.text = event?.intHomeShots ?: "-" 252 | tvHomeScoreDetail.text = event?.intHomeScore ?: "-" 253 | 254 | // away content 255 | away?.strTeamLogo?.let { Utils().picShow(it, ivAwayLogo) } 256 | tvAwayTeamName.text = event?.strAwayTeam ?: "-" 257 | tvAwayFormation.text = event?.strAwayFormation ?: "-" 258 | tvAwayShots.text = event?.intAwayShots ?: "-" 259 | tvAwayScoreDetail.text = event?.intAwayScore ?: "-" 260 | } 261 | 262 | private fun detailPertandingan(id_event: String) { 263 | TheSportDbApi().services.detailPertandingan(id_event).enqueue(object : 264 | Callback { 265 | override fun onFailure(call: Call, t: Throwable) { 266 | toast("Failure get detail pertandingan : " + t.message) 267 | } 268 | 269 | override fun onResponse( 270 | call: Call, 271 | response: Response 272 | ) { 273 | response.body().let { 274 | if (it != null) { 275 | dataDetailPertandingan = it 276 | event = dataDetailPertandingan.events[0] 277 | getAllTeams(dataDetailPertandingan.events[0].idLeague) 278 | } 279 | } 280 | 281 | } 282 | }) 283 | 284 | } 285 | 286 | private fun getAllTeams(id_liga: String) { 287 | TheSportDbApi().services.allTeams(id_liga).enqueue(object : Callback { 288 | override fun onFailure(call: Call, t: Throwable) { 289 | toast("Failure get cari pertandingan : " + t.message) 290 | } 291 | 292 | override fun onResponse( 293 | call: Call, 294 | response: Response 295 | ) { 296 | val datas = response.body() 297 | val event = dataDetailPertandingan.events 298 | val hme = datas?.teams?.filter { it.idTeam == event[0].idHomeTeam } 299 | val awy = datas?.teams?.filter { it.idTeam == event[0].idAwayTeam } 300 | home = hme?.get(0) 301 | away = awy?.get(0) 302 | setDataMatch(event[0]) 303 | loadContent() 304 | isMenuReady = true 305 | setIcon() 306 | // kalau sudah sampai sini, baru icon di tampilkan. 307 | } 308 | }) 309 | 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /app/src/main/assets/league.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"English Premier League", 4 | "id":"4328", 5 | "logo": "1_english_premier_league.png", 6 | "description" :"The Premier League (often referred to as the English Premier League (EPL) outside England), is the top level of the English football league system. Contested by 20 clubs, it operates on a system of promotion and relegation with the English Football League (EFL).\nThe Premier League is a corporation in which the member clubs act as shareholders. Seasons run from August to May with each team playing 38 matches (playing each other home and away). Most games are played on Saturday and Sunday afternoons. The Premier League has featured 47 English and two Welsh clubs since its inception, making it a cross-border league.\n The competition was formed as the FA Premier League on 20 February 1992 following the decision of clubs in the Football League First Division to break away from the Football League, founded in 1888, and take advantage of a lucrative television rights deal. The deal was worth £1 billion a year domestically as of 2013–14, with BSkyB and BT Group securing the domestic rights to broadcast 116 and 38 games respectively. The league generates €2.2 billion per year in domestic and international television rights. In 2014–15, teams were apportioned revenues of £1.6 billion, rising sharply to £2.4 billion in 2016–17.\n The Premier League is the most-watched sports league in the world, broadcast in 212 territories to 643 million homes and a potential TV audience of 4.7 billion people. In the 2014–15 season, the average Premier League match attendance exceeded 36,000, second highest of any professional football league behind the Bundesliga's 43,500. Most stadium occupancies are near capacity. The Premier League ranks second in the UEFA coefficients of leagues based on performances in European competitions over the past five seasons, as of 2018.\n Forty-nine clubs have competed since the inception of the Premier League in 1992. Six of them have won the title: Manchester United (13), Chelsea (5), Arsenal (3), Manchester City (3), Blackburn Rovers (1), and Leicester City (1). Following the 2003–04 season, Arsenal acquired the nickname \"The Invincibles\" as they became, and still remain, the only club to complete a Premier League campaign without losing a single game. The record of most points in a season is 100 by Manchester City in 2017–18." 7 | }, 8 | { 9 | "name":"French Ligue 1", 10 | "id":"4334", 11 | "logo": "2_french_ligue_1.png", 12 | "description" :"Ligue 1 (French pronunciation: ; League 1, formerly known as Division 1), is the French professional league for association football clubs. It is the country's primary football competition and serves as the top division of the French football league system. Ligue 1 is one of two divisions making up the Ligue de Football Professionnel, the other being Ligue 2. Contested by 20 clubs, it operates on a system of promotion and relegation with Ligue 2. Seasons run from August to May, with teams playing 38 games each totaling 380 games in the season. Most games are played on Saturdays and Sundays, with a few games played during weekday evenings. Play is regularly suspended the last weekend before Christmas for two weeks before returning in the second week of January. Ligue 1 is one of the top national leagues, currently ranked sixth in Europe behind the Spanish La Liga, English Premier League, the German Bundesliga, the Portuguese Primeira Liga and the Italian Serie A.\n Ligue 1 was inaugurated on 11 September 1932 under the name National before switching to Division 1 after a year of existence. The name lasted until 2002 before switching to its current name. The current champions are Paris Saint-Germain, who won the 4th title of their history in the 2013–14 season.\n Ligue 1 is generally regarded as competently run, with good planning of fixtures, complete and consistently enforced rules, timely resolution of issues, and adequate escalation procedures of judicial disputes to national or international institutions. The league has faced three significant corruption scandals in its history (Antibes in 1933, Red Star in the 1950s, and Marseille in 1993) and has preserved its reputation every time through swift and appropriately severe punishment of the guilty parties." 13 | }, 14 | { 15 | "name":"German Bundesliga", 16 | "id":"4331", 17 | "logo": "3_german_bundesliga.png", 18 | "description" :"The Fußball-Bundesliga (English: Football Federal League), commonly known as the Bundesliga, is a professional association football league in Germany and the football league with the highest average stadium attendance worldwide. At the top of the German football league system, the Bundesliga is Germany's primary football competition. The Bundesliga is contested by 18 teams and operates on a system of promotion and relegation with the 2. Bundesliga. Seasons run from August to May. Most games are played on Saturdays and Sundays, with a few games played during weekdays. All of the Bundesliga clubs qualify for the DFB-Pokal. The winner of the Bundesliga qualifies for the DFL-Supercup.\n A total of 53 clubs have competed in the Bundesliga since its founding. FC Bayern Munich has won the Bundesliga the most, winning the title 23 times. However, the Bundesliga has seen other champions with Borussia Dortmund, Hamburger SV, Werder Bremen, Borussia Mönchengladbach and VfB Stuttgart most prominent among them. The Bundesliga is one of the top national leagues, currently ranked 3rd in Europe according to UEFA's league coefficient ranking, based on recent European performances. The Bundesliga is the number one football league in the world in terms of average attendance; out of all sports, its average of 45,134 fans per game during the 2011–12 season was the second highest of any sports league in the world. The Bundesliga is broadcast on television in over 200 countries.\n The Bundesliga was founded in 1962 in Dortmund and the first season started in 1963. The structure and organisation of the Bundesliga along with Germany's other football leagues have undergone frequent changes right up to the present day. The Bundesliga was originally founded by the Deutscher Fußball-Bund (English: German Football Association), but is now operated by the Deutsche Fußball Liga (English: German Football League)." 19 | }, 20 | { 21 | "name":"Italian Serie A", 22 | "id":"4332", 23 | "logo": "4_italian_serie_a.png", 24 | "description" :"Serie A, also called Serie A TIM due to sponsorship by Telecom Italia, is a professional league competition for football clubs located at the top of the Italian football league system and has been operating for over eighty years since the 1929–30 season. It had been organized by Lega Calcio until 2010, but a new league, the Lega Serie A, was created for the 2010–11 season. Serie A is regarded as one of the best football leagues in the world. Serie A was considered the best league in the world in the '90s, and has produced the highest number of European Cup finalists: Italian clubs have reached the final of the competition on a record twenty-six different occasions, winning the title twelve times. Serie A is ranked 4th among European leagues according to UEFA's league coefficient behind the Spanish La Liga, English Premier League and German Bundesliga, which is based on the performance of Italian clubs in the Champions League and the Europa League. It also ranked 5th in world according to the first trends of the 2011 IFFHS rating.\n In its current format, the Italian Football Championship was revised from having regional and interregional rounds, to a single-tier league from the 1929–30 season onwards. The championship titles won prior to 1929 are officially recognised by FIGC with the same weighting as titles that were subsequently awarded. However, the 1945–46 season, when the league was played over two geographical groups due to the ravages of WWII, is not statistically considered, even if its title is fully official.\n The league hosts three of the world's most famous clubs as Juventus, Milan and Internazionale, all founding members of the G-14, a group which represented the largest and most prestigious European football clubs; Serie A was the only league to produce three founding members. More players have won the coveted Ballon d'Or award while playing at a Serie A club than any other league in the world. Ahead of Spain's La Liga. Although the actual number of Ballon d'Or won by players in these two leagues is equal at 18 each. Including the FIFA Ballon d'Or. Milan is the second club with the most official international titles in the world (18). Juventus, Italy's most successful club of the 20th century and the most successful Italian team, is tied for fourth in Europe and eighth in the world in the same ranking. The club is the only one in the world to have won all possible official continental competitions and the world title. Internazionale, following their achievements in the 2009–10 season, became the first Italian team to have achieved The Treble." 25 | }, 26 | { 27 | "name":"Spanish La Liga", 28 | "id":"4335", 29 | "logo": "5_spanish_la_liga.png", 30 | "description" :"The Primera División, commonly known as La Liga and as La Liga Santander for sponsorship reasons, is the top professional association football division of the Spanish football league system. Administrated by the Liga de Fútbol Profesional (LFP), La Liga is contested by 20 teams, with the three lowest-placed teams relegated to the Segunda División and replaced by the top two teams in that division plus the winner of a play-off.\n A total of 60 teams have competed in La Liga since its inception. Nine teams have been crowned champions, with Real Madrid winning the title a record 32 times and Barcelona 24 times. Real Madrid dominated the championship from the 1950s through the 1980s. From the 1990s onwards, Barcelona (14 titles) and Real Madrid (7 titles) both dominated, though La Liga also saw other champions, including Atlético Madrid, Valencia, and Deportivo de La Coruña. In more recent years, Atlético Madrid has joined a coalition of now three teams dominating La Liga alongside Real Madrid and Barcelona.\n According to UEFA's league coefficient, La Liga has been the top league in Europe over the last five years, and has produced the continent's top-rated club more times (18) than any other league, double that of second-placed Serie A. Its clubs have won the most UEFA Champions League (16), UEFA Europa League (10), UEFA Super Cup (13), and FIFA Club World Cup (5) titles, and its players have accumulated the highest number of (FIFA) Ballon d'Or awards (19).\n La Liga is one of the most popular professional sports leagues in the world, with an average attendance of 26,741 for league matches in the 2014–15 season. This is the sixth-highest of any domestic professional sports league in the world and the fourth-highest of any professional association football league in the world, behind the Bundesliga, the Premier League, and the Indian Super League." 31 | }, 32 | { 33 | "name":"American Mayor League", 34 | "id":"4346", 35 | "logo": "6_american_mayor_league.png", 36 | "description" :"Major League Soccer (MLS) is a professional soccer league representing the sport's highest level in both the United States and Canada. MLS constitutes one of the major professional sports leagues of the United States and Canada. The league is composed of 20 teams—17 in the U.S. and 3 in Canada. The MLS regular season runs from March to October, with each team playing 34 games; the team with the best record is awarded the Supporters' Shield. The post season includes twelve teams competing in the MLS Cup Playoffs through November and December, culminating in the championship game, the MLS Cup. MLS teams also play in other competitions against teams from other divisions and countries, such as the U.S. Open Cup, the Canadian Championship, and the CONCACAF Champions League. MLS is sanctioned by the United States Soccer Federation (U.S. Soccer).\n Major League Soccer was founded in 1993 as part of the United States' successful bid to host the 1994 FIFA World Cup. The first season took place in 1996 with ten teams. MLS experienced financial and operational struggles in its first few years: The league lost millions of dollars, teams played in mostly empty American football stadiums, and two teams folded in 2002. Since then, MLS has expanded to 20 teams, owners built soccer-specific stadiums, average attendance at MLS matches exceeds that of the National Basketball Association (NBA) and the National Hockey League (NHL), MLS secured national TV contracts, and the league is now profitable.\n Instead of operating as an association of independently owned teams, MLS is a single entity in which each team is owned and controlled by the league's investors. The investor-operators control their teams as owners control teams in other leagues, and are commonly (but inaccurately) referred to as the team's owners. The league's closed membership makes it one of the world's few soccer leagues that does not use promotion and relegation, which is uncommon in North America. MLS headquarters are in New York City." 37 | }, 38 | { 39 | "name":"Protugeuese Premiera Liga", 40 | "id":"4344", 41 | "logo": "7_portugeuese_premiera_liga.png", 42 | "description" :"The Primeira Liga (First League; Portuguese pronunciation: ), formerly called Primeira Divisão), is the top professional association football division of the Portuguese football league system.\n The Primeira Liga is contested by 18 clubs, but only five of them have won the title. Founded in 1934, the league is in its 81st edition (counting four experimental leagues in the 1930s). It has been dominated by the \"Big Three\": Benfica, Porto and Sporting CP. These three clubs have won a total of 78 titles, with Belenenses and Boavista winning the other two." 43 | }, 44 | { 45 | "name":"Australian A League", 46 | "id":"4356", 47 | "logo": "8_australian_a_league.png", 48 | "description" :"The A-League is a professional men's soccer league, run by Football Federation Australia (FFA). At the top of the Australian league system, it is the country's primary competition for the sport. The A-League was established in 2004 as a successor to the National Soccer League (NSL) and competition commenced in August 2005. The league is currently contested by ten teams; nine based in Australia and one based in New Zealand. It is known as the Hyundai A-League (HAL) through a sponsorship arrangement with the Hyundai Motor Company.\n Seasons run from October to May and include a 27-round regular season and an end-of-season finals series playoff tournament involving the highest-placed teams, culminating in a grand final match. The winner of the regular season tournament is dubbed 'premier' and the winner of the grand final is 'champion'. This differs from the other major football codes in Australia, where 'premier' refers to the winner of the grand final and the winner of the regular season is the 'minor premier'. The A-League's non-standard terminology is reflective of the increased prestige associated with winning the regular season in association football compared to other football codes in Australia. Successful A-League clubs gain qualification into the continental competition, the Asian Football Confederation Champions League (ACL).\n Since the league's inaugural season, a total of six clubs have been crowned A-League Premiers and five clubs have been crowned A-League Champions. The current premiers and champions are Brisbane Roar, who won both titles in 2013–14." 49 | }, 50 | { 51 | "name":"Scotish Premier League", 52 | "id":"4330", 53 | "logo": "9_scotish_premier_league.png", 54 | "description" :"The Scottish Premiership is the top division of the Scottish Professional Football League, the league competition for professional football clubs in Scotland. The Scottish Premiership was established in July 2013, after the Scottish Professional Football League was formed by a merger of the Scottish Premier League and Scottish Football League. Teams receive three points for a win and one point for a draw. No points are awarded for a loss. Teams are ranked by total points, then goal difference, and then goals scored. At the end of each season, the club with the most points is crowned league champion. If points are equal, the goal difference and then goals scored determine the winner." 55 | }, 56 | { 57 | "name":"English League 1", 58 | "id":"4396", 59 | "logo": "10_english_league_1.png", 60 | "description" :"Football League One (often referred to as League One for short or Sky Bet League 1) is the second-highest division of the Football League and the third tier in the English football league system\n Football League One was introduced for the 2004–05 season. It was previously known as the Football League Second Division and prior to the advent of the Premier League, the Football League Third Division.\n At present (2014–15 season), Oldham Athletic hold the longest tenure in League One, last being out of the division in the 1996–97 season when they were relegated from the Championship. There are currently six former Premier League clubs competing in the League One, namely Barnsley, Bradford City, Coventry City, Oldham Athletic, Sheffield United and Swindon Town.\n There are 24 clubs in Football League One. Each club plays every other club twice (once at home and once away). Three points are awarded for a win, one for a draw and zero for a loss. At the end of the season a table of the final League standings is determined, based on the following criteria in this order: points obtained, goal difference, goals scored, an aggregate of the results between two or more clubs (ranked using the previous three criteria) and, finally, a series of one or more play-off matches.\n At the end of each season the top two clubs, together with the winner of the play-offs between the clubs which finished in 3rd–6th position, are promoted to Football League Championship and are replaced by the three clubs that finished at the bottom of that division.\n Similarly, the four clubs that finished at the bottom of Football League One are relegated to Football League Two and are replaced by the top three clubs and the club that won the 4th–7th place play-offs in that division.\n Sky Sports currently show live League One matches with highlights shown on BBC One on their programme called The Football League Show, which also broadcasts highlights of Football League Championship and Football League Two matches. The show is available on the red button the following Sunday until midday and is available on iPlayer all the following week. Highlights of all games in the Football League are also available to view separately on the Sky Sports website. In Sweden, TV4 Sport has the rights of broadcasting from the league. A couple of league matches during the season of 09/10 including play-off matches and the play-off final to the Championship were shown. In Australia, Setanta Sports Australia broadcasts live Championship matches. In the USA and surrounding countries including Cuba, some Football League Championship, Football League One and Football League Two games are shown on beIN Sport." 61 | } 62 | ] -------------------------------------------------------------------------------- /app/src/main/res/layout/detail_match_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 34 | 40 | 46 | 52 | 53 | 59 | 64 | 69 | 70 | 75 | 80 | 85 | 86 | 87 | 88 | 98 | 99 | 102 | 103 | 104 | 110 | 115 | 121 | 122 | 123 | 129 | 135 | 141 | 147 | 148 | 149 | 158 | 171 | 184 | 185 | 194 | 207 | 220 | 221 | 233 | 234 | 235 | 236 | 237 | 238 | 248 | 249 | 252 | 253 | 258 | 264 | 270 | 275 | 276 | 282 | 288 | 294 | 300 | 305 | 310 | 315 | 321 | 327 | 333 | 339 | 345 | 351 | 356 | 361 | 366 | 371 | 376 | 381 | 382 | 383 | 384 | 394 | 395 | 407 | 419 | 431 | 443 | 444 | 456 | 468 | 479 | 490 | 501 | 512 | 513 | 514 | 524 | 525 | 537 | 549 | 561 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | --------------------------------------------------------------------------------