Add list item clicked and bottom sheet for list of nearby items is expanded

This commit is contained in:
neslihanturan 2019-06-13 23:00:05 +03:00
parent edfa39a2d3
commit 86679176d6

View file

@ -6,6 +6,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@ -114,12 +115,19 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
setRetainInstance(true); setRetainInstance(true);
} }
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Log.d("deneme3","oncongi changed fragmenr"+this);
}
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_nearby, container, false); View view = inflater.inflate(R.layout.fragment_nearby, container, false);
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
this.view = view; this.view = view;
initBottomSheetBehaviour();
Timber.d("onCreateView"); Timber.d("onCreateView");
return view; return view;
} }
@ -337,6 +345,36 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
getActivity().registerReceiver(broadcastReceiver, intentFilter); getActivity().registerReceiver(broadcastReceiver, intentFilter);
} }
/**
* Initialize bottom sheet behaviour (sheet for map list.) Set height 9/16 of all window.
* Add callback for bottom sheet changes, so that we can sync it with bottom sheet for details
* (sheet for nearby details)
*/
private void initBottomSheetBehaviour() {
transparentView.setAlpha(0);
bottomSheet.getLayoutParams().height = getActivity().getWindowManager()
.getDefaultDisplay().getHeight() / 16 * 9;
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(View bottomSheet, int unusedNewState) {
//prepareViewsForSheetPosition();
}
@Override
public void onSlide(View bottomSheet, float slideOffset) {
}
});
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
bottomSheetBehaviorForDetails = BottomSheetBehavior.from(bottomSheetDetails);
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
}
/** /**
* Hide or expand bottom sheet according to states of all sheets * Hide or expand bottom sheet according to states of all sheets
*/ */