Skip to content

Commit

Permalink
Merge branch 'feature/hide-qr' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
alopezh committed Jun 11, 2021
2 parents 45dd482 + 3410c2d commit 66422ef
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import es.gob.radarcovid.features.helpline.di.HelplineModule
import es.gob.radarcovid.features.helpline.view.HelplineFragment
import es.gob.radarcovid.features.home.di.HomeModule
import es.gob.radarcovid.features.home.view.HomeFragment
import es.gob.radarcovid.features.mydata.di.MyDataModule
import es.gob.radarcovid.features.mydata.view.MyDataFragment
import es.gob.radarcovid.features.settings.di.SettingsModule
import es.gob.radarcovid.features.settings.view.SettingsFragment
import es.gob.radarcovid.features.venue.di.VenueModule
Expand All @@ -29,6 +31,10 @@ abstract class MainFragmentsModule {
@ContributesAndroidInjector(modules = [HomeModule::class])
abstract fun bindsHomeFragment(): HomeFragment

@PerFragment
@ContributesAndroidInjector(modules = [MyDataModule::class])
abstract fun bindsMyDataFragment(): MyDataFragment

@PerFragment
@ContributesAndroidInjector(modules = [HelplineModule::class])
abstract fun bindsHelplineFragment(): HelplineFragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ class MainPresenterImpl @Inject constructor(
//Setup workers
view.cancelNotificationReminder()
view.startAnalyticsWorker(sendAnalyticsUseCase.getAnalyticsPeriod())

/*
if (exposureInfoUseCase.getExposureInfo().level != ExposureInfo.Level.INFECTED) {
//Start QR matcher worker only if no infected
view.startVenueMatcherWorker(preferencesRepository.getTroubledPlaceCheckTime())
} else {
view.cancelVenueMatcherWorker()
}
*/

//Redirection logic
if (getLocaleInfoUseCase.isLanguageChanged()) {
Expand Down Expand Up @@ -89,6 +92,10 @@ class MainPresenterImpl @Inject constructor(
router.navigateToHome(activateRadar = false, manualNavigation = true, backFromQr = false)
}

override fun onProfileButtonClick() {
router.navigateToProfile()
}

override fun onVenueButtonClick() {
router.navigateToVenueRecord(venueRecordUseCase.isCurrentVenue())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ interface MainPresenter {

fun onHomeButtonClick()

fun onProfileButtonClick()

fun onVenueButtonClick()

fun onHelplineButtonClick()
Expand All @@ -68,6 +70,8 @@ interface MainRouter {

fun navigateToHome(activateRadar: Boolean, manualNavigation: Boolean, backFromQr: Boolean)

fun navigateToProfile()

fun navigateToHelpline()

fun navigateToStats()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import es.gob.radarcovid.R
import es.gob.radarcovid.features.helpline.view.HelplineFragment
import es.gob.radarcovid.features.home.view.HomeFragment
import es.gob.radarcovid.features.main.protocols.MainRouter
import es.gob.radarcovid.features.mydata.view.MyDataFragment
import es.gob.radarcovid.features.settings.view.SettingsFragment
import es.gob.radarcovid.features.stats.view.StatsFragment
import es.gob.radarcovid.features.venue.view.VenueFragment
Expand All @@ -31,6 +32,14 @@ class MainRouterImpl @Inject constructor(private val activity: AppCompatActivity
.commit()
}

override fun navigateToProfile() {
activity
.supportFragmentManager
.beginTransaction()
.replace(R.id.wrapperContent, MyDataFragment.newInstance())
.commit()
}

override fun navigateToHelpline() {
activity
.supportFragmentManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ class MainActivity : BaseActivity(), MainView {
initViews()

presenter.onCreate(
intent.getBooleanExtra(EXTRA_ACTIVATE_RADAR, false),
intent.getStringExtra(EXTRA_CAPTURED_QR)
intent.getBooleanExtra(EXTRA_ACTIVATE_RADAR, false), null
)
}

override fun onResume() {
super.onResume()
presenter.onResume(
bottomNavigation.selectedItemId == R.id.menuItemVenue,
presenter.onResume(false,
bottomNavigation.selectedItemId == R.id.menuItemHome
)
}
Expand All @@ -93,8 +91,8 @@ class MainActivity : BaseActivity(), MainView {
when (it.itemId) {
R.id.menuItemHome -> it.title =
labelManager.getText("ACC_HOME_TITLE", R.string.title_home)
R.id.menuItemVenue -> it.title =
labelManager.getText("ACC_VENUE_TITLE", R.string.title_qr)
R.id.menuItemProfile -> it.title =
labelManager.getText("ACC_MYDATA_TITLE", R.string.title_mydata)
R.id.menuItemHelpline -> it.title =
labelManager.getText("ACC_HELPLINE_TITLE", R.string.title_helpline)
R.id.menuItemStats -> it.title =
Expand All @@ -106,7 +104,7 @@ class MainActivity : BaseActivity(), MainView {
bottomNavigation.setOnNavigationItemSelectedListener {
when (it.itemId) {
R.id.menuItemHome -> presenter.onHomeButtonClick()
R.id.menuItemVenue -> presenter.onVenueButtonClick()
R.id.menuItemProfile -> presenter.onProfileButtonClick()
R.id.menuItemHelpline -> presenter.onHelplineButtonClick()
R.id.menuItemStats -> presenter.onStatsButtonClick()
R.id.menuItemSettings -> presenter.onSettingsButtonClick()
Expand All @@ -125,7 +123,7 @@ class MainActivity : BaseActivity(), MainView {
}

override fun setVenueHomeSelected() {
bottomNavigation.selectedItemId = R.id.menuItemVenue

}

override fun onBackPressed() {
Expand All @@ -137,6 +135,7 @@ class MainActivity : BaseActivity(), MainView {

@SuppressLint("ResourceType")
override fun updateVenueIcon(isVenueRecordSelected: Boolean) {
/*
if (isVenueRecordSelected) {
bottomNavigation.getOrCreateBadge(R.id.menuItemVenue).apply {
backgroundColor = ContextCompat.getColor(applicationContext, R.color.red_2300)
Expand All @@ -147,6 +146,8 @@ class MainActivity : BaseActivity(), MainView {
} else {
bottomNavigation.removeBadge(R.id.menuItemVenue)
}
*/
}

override fun showExitConfirmationDialog() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2020 Gobierno de España
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/

package es.gob.radarcovid.features.mydata.di

import androidx.fragment.app.Fragment
import dagger.Module
import dagger.Provides
import es.gob.radarcovid.common.di.scope.PerFragment
import es.gob.radarcovid.features.mydata.presenter.MyDataPresenterImpl
import es.gob.radarcovid.features.mydata.protocols.MyDataPresenter
import es.gob.radarcovid.features.mydata.protocols.MyDataView
import es.gob.radarcovid.features.mydata.view.MyDataFragment

@Module
class MyDataModule {

@Provides
fun providesFragment(fragment: MyDataFragment): Fragment = fragment

@Provides
fun providesView(fragment: MyDataFragment): MyDataView = fragment

@Provides
@PerFragment
fun providesPresenter(presenter: MyDataPresenterImpl): MyDataPresenter = presenter

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2020 Gobierno de España
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/

package es.gob.radarcovid.features.mydata.presenter

import es.gob.radarcovid.features.mydata.protocols.MyDataPresenter
import javax.inject.Inject

class MyDataPresenterImpl @Inject constructor(
) : MyDataPresenter {

override fun viewReady() {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2020 Gobierno de España
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/

package es.gob.radarcovid.features.mydata.protocols

interface MyDataView

interface MyDataPresenter {

fun viewReady()

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2020 Gobierno de España
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/

package es.gob.radarcovid.features.mydata.view

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.accessibility.AccessibilityEvent
import es.gob.radarcovid.R
import es.gob.radarcovid.common.base.BaseFragment
import es.gob.radarcovid.features.mydata.protocols.MyDataPresenter
import es.gob.radarcovid.features.mydata.protocols.MyDataView
import kotlinx.android.synthetic.main.fragment_my_data.*
import javax.inject.Inject


class MyDataFragment : BaseFragment(), MyDataView {

companion object {
fun newInstance() = MyDataFragment()
}

@Inject
lateinit var presenter: MyDataPresenter

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_my_data, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
presenter.viewReady()
}

override fun onResume() {
super.onResume()
setAccessibilityFocus()
}

private fun setAccessibilityFocus() {
if (isAccessibilityEnabled())
textViewTitle.postDelayed({
if (textViewTitle != null) {
textViewTitle.isFocusable = true
textViewTitle.requestFocus()
textViewTitle.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED)
}
}, 3000)
}

}
70 changes: 1 addition & 69 deletions app/src/main/res/layout/fragment_helpline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
android:src="@drawable/img_background_helpline" />

<es.gob.radarcovid.common.view.LabelTextView
style="@style/TextNormal18"
style="@style/TextSmallBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
Expand Down Expand Up @@ -183,74 +183,6 @@

</LinearLayout>

<es.gob.radarcovid.common.view.LabelTextView
style="@style/Title22Black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="24dp"
android:text="@string/my_data_subtitle"
app:labelId="MY_DATA_TITLE" />

<es.gob.radarcovid.common.view.LabelDotTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/my_data_l1"
app:labelId="MY_DATA_BULLET_1" />

<es.gob.radarcovid.common.view.LabelDotTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/my_data_l2"
android:contentDescription="@string/my_data_l2_acc"
app:contentDescriptionLabelId="ACC_MY_DATA_BULLET_2"
app:labelId="MY_DATA_BULLET_2" />

<es.gob.radarcovid.common.view.LabelDotTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/my_data_l3"
app:dotVisibility="invisible"
app:labelId="MY_DATA_BULLET_3" />

<es.gob.radarcovid.common.view.LabelTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextNormal18"
android:layout_marginBottom="11dp"
android:text="@string/my_data_encription_info"
app:labelId="MY_DATA_PARAGRAPH_1" />

<es.gob.radarcovid.common.view.LabelTextView
android:id="@+id/textViewPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextNormal18"
android:paddingTop="13dp"
android:paddingBottom="13dp"
android:text="@string/my_data_privacy"
android:textColorLink="@color/purple_A7"
app:isLink="true"
app:removeUnderlineLink="true"
app:labelId="MY_DATA_PRIVACY" />

<es.gob.radarcovid.common.view.LabelTextView
android:id="@+id/textViewConditions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextNormal18"
android:layout_marginBottom="11dp"
android:paddingTop="13dp"
android:paddingBottom="13dp"
android:text="@string/my_data_conditions"
android:textColorLink="@color/purple_A7"
app:isLink="true"
app:removeUnderlineLink="true"
app:labelId="MY_DATA_TERMS" />

</LinearLayout>

</ScrollView>
Expand Down
Loading

0 comments on commit 66422ef

Please sign in to comment.