Skip to content

Commit

Permalink
Third step: refractored switch, added new extension function
Browse files Browse the repository at this point in the history
  • Loading branch information
MadRatSRP committed Apr 22, 2019
1 parent d80901e commit b266860
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 32 deletions.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import com.madrat.abiturhelper.R
import com.madrat.abiturhelper.adapter.SpecialtiesAdapter
import com.madrat.abiturhelper.interfaces.fragments.ShowSpecialtiesMVP
import com.madrat.abiturhelper.model.Specialty
import com.madrat.abiturhelper.model.Student
import com.madrat.abiturhelper.util.MyApplication
import com.madrat.abiturhelper.util.linearManager
import com.madrat.abiturhelper.util.showLog
import com.madrat.abiturhelper.util.stringAndSerializable
import kotlinx.android.synthetic.main.fragment_specialties.*
import kotlinx.android.synthetic.main.fragment_specialties.view.*

Expand Down Expand Up @@ -59,15 +61,29 @@ class ShowSpecialtiesView
val bundle = Bundle()
val unti = myApplication.returnUnti()

fun moveToSpecialty(list: ArrayList<Student>) {
bundle.stringAndSerializable(specialty, list)
toSpecialty(bundle)
}

unti?.let {
when (position) {
0 -> {
//moveToSpecialty(it.specialtiesATP.zaochnBudg)
bundle.putString("title", specialty.shortName)
bundle.putSerializable("array", it.specialtiesATP.zaochnBudg)
toSpecialty(bundle)
}


}
}



/*unti?.let {
}*/
}

override fun toSpecialty(bundle: Bundle) {
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/com/madrat/abiturhelper/util/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.madrat.abiturhelper.BuildConfig
import com.madrat.abiturhelper.model.Specialty
import com.madrat.abiturhelper.model.Student
import com.madrat.abiturhelper.model.faculties.Unti

fun Fragment.setFragment(fragment: Fragment, fragmentManager: FragmentManager, id: Int) {
fragmentManager.beginTransaction()
Expand Down Expand Up @@ -39,4 +42,9 @@ fun ViewGroup.inflate(layoutRes: Int): View {
}
fun RecyclerView.linearManager() {
this.layoutManager = LinearLayoutManager(context)
}

fun Bundle.stringAndSerializable(specialty: Specialty, list: ArrayList<Student>) {
this.putString("title", specialty.shortName)
this.putSerializable("array", list)
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
//Navigation Architecture Component Wiki
ext.nav_version = "2.0.0-rc02"

ext.gradle_version = '3.3.2'
ext.gradle_version = '3.4.0'
ext.kotlin_version = '1.3.30'

repositories {
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 14 23:59:55 MSK 2019
#Mon Apr 22 10:48:28 MSK 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0 comments on commit b266860

Please sign in to comment.