Skip to content

Commit

Permalink
work with motion for fab
Browse files Browse the repository at this point in the history
AJ-194
  • Loading branch information
Gromov Evgeny committed Jun 9, 2020
1 parent 8edf124 commit 18ae45a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.firebaseui:firebase-ui-auth:6.2.0'
Expand All @@ -113,7 +113,7 @@ dependencies {
implementation 'com.thefinestartist:finestwebview:1.2.7'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.2'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha03'
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import com.druger.aboutwork.model.Review
import com.druger.aboutwork.model.Vacancy
import com.druger.aboutwork.presenters.AddReviewPresenter
import com.druger.aboutwork.utils.Utils
import com.google.android.material.transition.MaterialArcMotion
import com.google.android.material.transition.MaterialContainerTransform
import kotlinx.android.synthetic.main.content_review.*
import kotlinx.android.synthetic.main.toolbar_review.*
import moxy.presenter.InjectPresenter
Expand Down Expand Up @@ -55,6 +57,13 @@ class AddReviewFragment : ReviewFragment(), AdapterView.OnItemSelectedListener,
private const val COMPANY_NAME = "companyName"
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sharedElementEnterTransition = MaterialContainerTransform().apply {
setPathMotion(MaterialArcMotion())
}
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
rootView = inflater.inflate(R.layout.fragment_review, container, false)
getData(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.druger.aboutwork.interfaces.OnItemClickListener
import com.druger.aboutwork.interfaces.view.CompaniesView
import com.druger.aboutwork.model.Review
import com.druger.aboutwork.presenters.CompaniesPresenter
import com.google.android.material.transition.Hold
import kotlinx.android.synthetic.main.fragment_companies.*
import kotlinx.android.synthetic.main.network_error.*
import kotlinx.android.synthetic.main.no_reviews.*
Expand All @@ -35,11 +34,6 @@ class CompaniesFragment : BaseSupportFragment(), CompaniesView {
@ProvidePresenter
internal fun provideCompaniesPresenter() = CompaniesPresenter()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
exitTransition = Hold()
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
rootView = inflater.inflate(R.layout.fragment_companies, container, false)
Expand Down Expand Up @@ -129,7 +123,7 @@ class CompaniesFragment : BaseSupportFragment(), CompaniesView {

private fun showSelectedReview(id: String) {
val fragment = SelectedReviewFragment.newInstance(id, false)
replaceFragment(fragment, R.id.main_container, true, rvLastReviews)
replaceFragment(fragment, R.id.main_container, true)
}

override fun showProgress(show: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.druger.aboutwork.interfaces.view.CompanyDetailView
import com.druger.aboutwork.model.CompanyDetail
import com.druger.aboutwork.model.Review
import com.druger.aboutwork.presenters.CompanyDetailPresenter
import com.google.android.material.transition.Hold
import com.thefinestartist.finestwebview.FinestWebView
import kotlinx.android.synthetic.main.content_company_detail.*
import kotlinx.android.synthetic.main.fragment_company_detail.*
Expand All @@ -44,6 +45,11 @@ class CompanyDetailFragment : BaseSupportFragment(), CompanyDetailView,
@ProvidePresenter
internal fun provideCompanyDetailPresenter() = CompanyDetailPresenter()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
exitTransition = Hold()
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
rootView = inflater.inflate(R.layout.fragment_company_detail, container, false)
Expand Down Expand Up @@ -135,7 +141,7 @@ class CompanyDetailFragment : BaseSupportFragment(), CompanyDetailView,
companyDetail?.id?.let { id ->
companyDetail?.name?.let { name ->
val review = AddReviewFragment.newInstance(id, name)
replaceFragment(review, R.id.main_container, true)
replaceFragment(review, R.id.main_container, true, fabAddReview)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.druger.aboutwork.model.Comment
import com.druger.aboutwork.model.Review
import com.druger.aboutwork.presenters.SelectedReviewPresenter
import com.druger.aboutwork.utils.Utils
import com.google.android.material.transition.MaterialContainerTransform
import com.google.firebase.auth.FirebaseUser
import com.google.firebase.storage.StorageReference
import kotlinx.android.synthetic.main.content_selected_review.*
Expand Down Expand Up @@ -61,9 +60,6 @@ class SelectedReviewFragment : BaseSupportFragment(), SelectedReview {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sharedElementEnterTransition = MaterialContainerTransform().apply {
duration = 450
}
photoAdapter = PhotoAdapter<StorageReference>(mutableListOf(),false)
}

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/fragment_companies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scrollbars="vertical"
android:transitionName="shared_element_container"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/fragment_company_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/ic_add"
app:tint="@null"
android:transitionName="shared_element_container"
app:backgroundTint="@color/colorAccent"
app:layout_behavior=".utils.recycler.ScrollAwareFABBehavior"/>
app:layout_behavior=".utils.recycler.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_add"
app:tint="@null" />

<include layout="@layout/content_company_detail" />

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_review.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:transitionName="shared_element_container">

<include layout="@layout/toolbar_review" />

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_selected_review.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionName="shared_element_container">
android:layout_height="match_parent">

<include layout="@layout/toolbar" />

Expand Down

0 comments on commit 18ae45a

Please sign in to comment.