-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'issue/10519-edit-ad-ui' into issue/10519-edit-ad-image-…
…selection
- Loading branch information
Showing
13 changed files
with
199 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/ExperimentTracker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/FirebaseTracker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...in/kotlin/com/woocommerce/android/ui/blaze/creation/budget/BlazeCampaignBudgetFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.woocommerce.android.ui.blaze.creation.budget | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.viewModels | ||
import androidx.navigation.fragment.findNavController | ||
import com.woocommerce.android.ui.base.BaseFragment | ||
import com.woocommerce.android.ui.compose.composeView | ||
import com.woocommerce.android.ui.main.AppBarStatus | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class BlazeCampaignBudgetFragment : BaseFragment() { | ||
override val activityAppBarStatus: AppBarStatus | ||
get() = AppBarStatus.Hidden | ||
|
||
val viewModel: BlazeCampaignBudgetViewModel by viewModels() | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
return composeView { | ||
CampaignBudgetScreen(viewModel) | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
setupObservers() | ||
} | ||
|
||
private fun setupObservers() { | ||
viewModel.event.observe(viewLifecycleOwner) { event -> | ||
when (event) { | ||
is MultiLiveEvent.Event.Exit -> findNavController().popBackStack() | ||
} | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
...main/kotlin/com/woocommerce/android/ui/blaze/creation/budget/BlazeCampaignBudgetScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.woocommerce.android.ui.blaze.creation.budget | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material.ExperimentalMaterialApi | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.ModalBottomSheetValue | ||
import androidx.compose.material.Scaffold | ||
import androidx.compose.material.Text | ||
import androidx.compose.material.icons.Icons.Filled | ||
import androidx.compose.material.icons.filled.ArrowBack | ||
import androidx.compose.material.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.dimensionResource | ||
import androidx.compose.ui.res.stringResource | ||
import com.woocommerce.android.R.dimen | ||
import com.woocommerce.android.R.string | ||
import com.woocommerce.android.ui.compose.component.Toolbar | ||
import com.woocommerce.android.ui.compose.component.WCColoredButton | ||
import com.woocommerce.android.ui.compose.component.WCModalBottomSheetLayout | ||
import kotlinx.coroutines.launch | ||
|
||
@Composable | ||
fun CampaignBudgetScreen(viewModel: BlazeCampaignBudgetViewModel) { | ||
CampaignBudgetScreen( | ||
onBackPressed = viewModel::onBackPressed | ||
) | ||
} | ||
|
||
@OptIn(ExperimentalMaterialApi::class) | ||
@Composable | ||
private fun CampaignBudgetScreen( | ||
onBackPressed: () -> Unit | ||
) { | ||
val coroutineScope = rememberCoroutineScope() | ||
val modalSheetState = rememberModalBottomSheetState( | ||
initialValue = ModalBottomSheetValue.Hidden, | ||
confirmValueChange = { it != ModalBottomSheetValue.HalfExpanded } | ||
) | ||
Scaffold( | ||
topBar = { | ||
Toolbar( | ||
title = stringResource(id = string.blaze_campaign_budget_title), | ||
onNavigationButtonClick = onBackPressed, | ||
navigationIcon = Filled.ArrowBack | ||
) | ||
}, | ||
modifier = Modifier.background(MaterialTheme.colors.surface) | ||
) { paddingValues -> | ||
WCModalBottomSheetLayout( | ||
sheetState = modalSheetState, | ||
sheetContent = { | ||
DurationSheetContent( | ||
durationInDays = 0, | ||
onApplyTapped = { | ||
coroutineScope.launch { modalSheetState.hide() } | ||
} | ||
) | ||
} | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.padding(paddingValues) | ||
.background(MaterialTheme.colors.surface) | ||
.padding(dimensionResource(id = dimen.major_100)) | ||
) { | ||
// Budget content | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun DurationSheetContent( | ||
durationInDays: Int, | ||
onApplyTapped: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
Column( | ||
modifier = modifier.verticalScroll(rememberScrollState()) | ||
) { | ||
Text(text = "Current duration: $durationInDays") | ||
WCColoredButton(onClick = onApplyTapped, text = "Apply") | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...n/kotlin/com/woocommerce/android/ui/blaze/creation/budget/BlazeCampaignBudgetViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.woocommerce.android.ui.blaze.creation.budget | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.Exit | ||
import com.woocommerce.android.viewmodel.ScopedViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class BlazeCampaignBudgetViewModel @Inject constructor( | ||
savedStateHandle: SavedStateHandle, | ||
) : ScopedViewModel(savedStateHandle) { | ||
|
||
fun onBackPressed() { | ||
triggerEvent(Exit) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.