.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package com.ssb.simplitend.caregiverdashboard;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.caregiverdashboard.mvvm.CaregiverMainViewModel;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardBinding;
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNav;
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNavBuilder;
|
||||
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
|
||||
import com.yarolegovich.slidingrootnav.util.DrawerListenerAdapter;
|
||||
|
||||
public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
DragStateListener{
|
||||
|
||||
// view binding
|
||||
protected CaregiverDashboardBinding binding;
|
||||
|
||||
protected CaregiverMainViewModel viewModel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = CaregiverDashboardBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
binding.btn.setOnClickListener(view -> {
|
||||
ObjectAnimator objAnim = ObjectAnimator.ofFloat(view, "translationX", -100f);
|
||||
objAnim.setDuration(100);
|
||||
objAnim.start();
|
||||
});
|
||||
|
||||
initViews();
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
// viewmodel
|
||||
viewModel = new ViewModelProvider(this).get(CaregiverMainViewModel.class);
|
||||
|
||||
|
||||
// sliding navigation bar
|
||||
viewModel.slidingRootNav = null;
|
||||
viewModel.slidingRootNav = new SlidingRootNavBuilder(this)
|
||||
.withMenuLayout(R.layout.caregiver_dashboard_menu)
|
||||
.addDragStateListener(this)
|
||||
.withToolbarMenuToggle(binding.toolbar)
|
||||
.inject();
|
||||
|
||||
}
|
||||
// slide bar drag callbacks
|
||||
@Override
|
||||
public void onDragStart() {
|
||||
binding.getRoot().setRadius(30);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragEnd(boolean isMenuOpened) {
|
||||
if (isMenuOpened){
|
||||
binding.getRoot().setRadius(30);
|
||||
}else{
|
||||
binding.getRoot().setRadius(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ssb.simplitend.caregiverdashboard.mvvm;
|
||||
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNav;
|
||||
|
||||
public class CaregiverMainViewModel extends ViewModel {
|
||||
|
||||
public SlidingRootNav slidingRootNav;
|
||||
|
||||
public CaregiverMainViewModel(){}
|
||||
|
||||
}
|
||||
@@ -11,21 +11,21 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardFragmentBinding;
|
||||
import com.ssb.simplitend.databinding.PatientDashboardFragmentBinding;
|
||||
|
||||
public class CPDashboardFragment extends Fragment {
|
||||
public class PatientDashboardFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected CaregiverDashboardFragmentBinding binding;
|
||||
protected PatientDashboardFragmentBinding binding;
|
||||
|
||||
public CPDashboardFragment() {
|
||||
public PatientDashboardFragment() {
|
||||
// required
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = CaregiverDashboardFragmentBinding.inflate(inflater, container, false);
|
||||
binding = PatientDashboardFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ssb.simplitend.customsviews;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
|
||||
public class HomeBottomNav extends FrameLayout {
|
||||
|
||||
|
||||
// constructors
|
||||
public HomeBottomNav(@NonNull Context context) {
|
||||
super(context);
|
||||
initViews();
|
||||
}
|
||||
|
||||
public HomeBottomNav(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initViews();
|
||||
}
|
||||
|
||||
public HomeBottomNav(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initViews();
|
||||
}
|
||||
|
||||
private void initViews(){
|
||||
View view = inflate(getContext(), R.layout.home_bottom_nav, this);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user