Skip to content

Instantly share code, notes, and snippets.

View varundwarkani's full-sized avatar

Varun Dwarkani varundwarkani

View GitHub Profile
android:visibility="@{recordingState.center}"
layoutBinding.setRecordingState(simpleViewModel.recordingPositionUIState);
public class SimpleViewModel extends ViewModel {
public RecordingPositionUIState recordingPositionUIState = new RecordingPositionUIState();
}
<data>
<variable
name="recordingState"
type="com.trimble.ag.amaethon.runscreen.advanced.recording.model.RecordingPositionUIState" />
</data>
public class RecordingPositionUIState extends BaseObservable {
@Bindable
private Boolean left = false;
@Bindable
private Boolean center = false;
@Bindable
private Boolean right = false;
<fragment
android:id="@+id/callingFragment"
android:name="com.dwarsoft.criccrak.fragment.CallingFragment"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"
tools:layout="@layout/callingFragment">
<action
android:id="@+id/action_callingFragment_to_UPIDialogFragment"
public class CallingFragment extends Fragment {
private UPIViewModel upiViewModel;
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
upiViewModel = new ViewModelProvider(requireActivity()).get(UPIViewModel.class);
setObservers();
}
public class UPIViewModel extends ViewModel {
public MutableLiveData<String> upiID = new MutableLiveData<>("");
public SingleLiveEvent<Boolean> isSubmitAction = new SingleLiveEvent<>();
public SingleLiveEvent<Boolean> canSaveData = new SingleLiveEvent<>();
public void onSubmit() {
isSubmitAction.postValue(true);
}
public class UPIDialogFragment extends DialogFragment {
private DialogUpiBinding upiBinding;
private UPIViewModel upiViewModel;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
upiViewModel = new ViewModelProvider(requireActivity()).get(UPIViewModel.class);
}
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="com.dwarsoft.criccrak.appModules.wallet.viewModel.UPIViewModel" />
</data>