Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HomeFragment extends Fragment {
- private HomeViewModel homeViewModel;
- JellyToggleButton jellyToggleButton;
- Toast lastToast;
- public View onCreateView(@NonNull LayoutInflater inflater,
- ViewGroup container, Bundle savedInstanceState) {
- homeViewModel =
- new ViewModelProvider(this).get(HomeViewModel.class);
- View root = inflater.inflate(R.layout.fragment_home, container, false);
- jellyToggleButton = (JellyToggleButton) getActivity().findViewById(R.id.relay);
- jellyToggleButton.setOnStateChangeListener(new JellyToggleButton.OnStateChangeListener() {
- @Override
- public void onStateChange(float process, State state, JellyToggleButton jtb) {
- if (state.equals(State.LEFT)) {
- Log.d(TAG, "onStateChange: Left");
- }
- if (state.equals(State.RIGHT)) {
- Log.d(TAG, "onStateChange: Right");
- }
- }
- });
- return root;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement