import { PersonBaseViewModel } from "./../../view-models/person-base-model" ; let viewModel ; export function onPageNavigatingTo ( args ) { if ( ! viewModel ) { viewModel = new PersonBaseViewModel ( ) ; const page = args . object ; page . bindingContext = viewModel ; } } let buttonValue ; export function editorNeedsView ( args ) { const editorView = new android . widget . Button ( args . context ) ; editorView . setOnClickListener ( new android . view . View . OnClickListener ( { onClick ( view ) { handleTap ( view , args . object ) ; } } ) ) ; args . view = editorView ; } export function editorHasToApplyValue ( args ) { updateEditorValue ( args . view , args . value ) ; } export function editorNeedsValue ( args ) { args . value = buttonValue ; } export function updateEditorValue ( editorView , value ) { buttonValue = value ; editorView . setText ( buttonValue + " (tap to increase)" ) ; } export function handleTap ( editorView , editor ) { const newValue = buttonValue + 1 ; updateEditorValue ( editorView , newValue ) ; editor . notifyValueChanged ( ) ; }