Fix conflicts

This commit is contained in:
neslihanturan 2017-12-13 16:59:09 +03:00 committed by maskara
parent 88cf1bdcd7
commit e15daa15e1
5 changed files with 50 additions and 36 deletions

View file

@ -14,6 +14,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -55,6 +56,8 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
@BindView(R.id.bottom_sheet) @BindView(R.id.bottom_sheet)
LinearLayout bottomSheet; LinearLayout bottomSheet;
@BindView(R.id.bottom_sheet_details)
LinearLayout bottomSheetDetails;
@BindView(R.id.fab_list) @BindView(R.id.fab_list)
FloatingActionButton fabList; FloatingActionButton fabList;
@BindView(R.id.transparentView) @BindView(R.id.transparentView)
@ -71,7 +74,8 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
private NearbyActivityMode viewMode; private NearbyActivityMode viewMode;
private Disposable placesDisposable; private Disposable placesDisposable;
private boolean lockNearbyView; //Determines if the nearby places needs to be refreshed private boolean lockNearbyView; //Determines if the nearby places needs to be refreshed
private BottomSheetBehavior bottomSheetBehavior; private BottomSheetBehavior bottomSheetBehavior; // Behavior for list bottom sheet
private BottomSheetBehavior bottomSheetBehaviorForDetails; // Behavior for details bottom sheet
@BindView(R.id.swipe_container) SwipeRefreshLayout swipeLayout; @BindView(R.id.swipe_container) SwipeRefreshLayout swipeLayout;
@Override @Override
@ -115,6 +119,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
@Override @Override
public void onStateChanged(View bottomSheet, int newState) { public void onStateChanged(View bottomSheet, int newState) {
Log.d("Deneme","deneme"+newState);
prepareViewsForSheetPosition(newState); prepareViewsForSheetPosition(newState);
} }
@ -123,13 +128,16 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
} }
}); });
bottomSheetBehaviorForDetails = BottomSheetBehavior.from(bottomSheetDetails);
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
} }
private void initFabList() { private void initFabList() {
fabList.setOnClickListener(new View.OnClickListener() { fabList.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
//nearbyMapFragment.bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} }
}); });

View file

@ -9,6 +9,8 @@ import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.GravityCompat;
import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -278,36 +280,44 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
} }
public void prepareViewsForSheetPosition(int bottomSheetState) { public void prepareViewsForSheetPosition(int bottomSheetState) {
if(bottomSheetState==BottomSheetBehavior.STATE_COLLAPSED){ if (bottomSheetState == BottomSheetBehavior.STATE_COLLAPSED) {
if(!fabList.isShown()) fabList.show(); if (!fabList.isShown()) fabList.show();
closeFabs(isFabOpen); closeFabs(isFabOpen);
if(!fabPlus.isShown()){ if (!fabPlus.isShown()) showFAB();
CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fabPlus.getLayoutParams();
p.setAnchorId(getActivity().findViewById(R.id.bottom_sheet_details).getId());
fabPlus.setLayoutParams(p);
fabPlus.show();
}
this.getView().requestFocus(); this.getView().requestFocus();
moreInfo.setVisibility(View.VISIBLE); moreInfo.setVisibility(View.VISIBLE);
//NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_COLLAPSED; //NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_COLLAPSED;
} }
else if(bottomSheetState==BottomSheetBehavior.STATE_EXPANDED){ else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
if(fabList.isShown()) fabList.hide(); if (fabList.isShown()) fabList.hide();
this.getView().requestFocus(); this.getView().requestFocus();
moreInfo.setVisibility(View.GONE); moreInfo.setVisibility(View.VISIBLE);
//NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_EXPANDED; //NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_EXPANDED;
} }
else if(bottomSheetState==BottomSheetBehavior.STATE_HIDDEN){ else if (bottomSheetState == BottomSheetBehavior.STATE_HIDDEN) {
closeFabs(isFabOpen); closeFabs(isFabOpen);
hideFAB();
moreInfo.setVisibility(View.GONE);
this.getView().clearFocus();
}
//currBottomSheetState = bottomSheetState;
}
private void hideFAB() {
//get rid of anchors //get rid of anchors
//Somehow this was the only way https://stackoverflow.com/questions/32732932/floatingactionbutton-visible-for-sometime-even-if-visibility-is-set-to-gone //Somehow this was the only way https://stackoverflow.com/questions/32732932/floatingactionbutton-visible-for-sometime-even-if-visibility-is-set-to-gone
CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fabPlus.getLayoutParams(); CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fabPlus
.getLayoutParams();
p.setAnchorId(View.NO_ID); p.setAnchorId(View.NO_ID);
fabPlus.setLayoutParams(p); fabPlus.setLayoutParams(p);
fabPlus.hide(); fabPlus.hide();
moreInfo.setVisibility(View.GONE);
} }
//currBottomSheetState = bottomSheetState;
private void showFAB() {
CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fabPlus.getLayoutParams();
p.setAnchorId(getActivity().findViewById(R.id.bottom_sheet_details).getId());
fabPlus.setLayoutParams(p);
fabPlus.show();
} }
private void passInfoToSheet(Place place) { private void passInfoToSheet(Place place) {

View file

@ -90,7 +90,7 @@ class PlaceRenderer extends Renderer<Place> {
private void closeLayout(LinearLayout buttonLayout){ private void closeLayout(LinearLayout buttonLayout){
//openedItems.remove(buttonLayout); //openedItems.remove(buttonLayout);
buttonLayout.startAnimation(animationUp); /*buttonLayout.startAnimation(animationUp);
CountDownTimer countDownTimerStatic = new CountDownTimer(COUNTDOWN_RUNNING_TIME, 16) { CountDownTimer countDownTimerStatic = new CountDownTimer(COUNTDOWN_RUNNING_TIME, 16) {
@Override @Override
public void onTick(long millisUntilFinished) { public void onTick(long millisUntilFinished) {
@ -102,14 +102,16 @@ class PlaceRenderer extends Renderer<Place> {
//buttonLayout.setVisibility(View.GONE); //buttonLayout.setVisibility(View.GONE);
} }
}; };
countDownTimerStatic.start(); countDownTimerStatic.start();*/
buttonLayout.setVisibility(View.GONE);
} }
private void openLayout(LinearLayout buttonLayout){ private void openLayout(LinearLayout buttonLayout){
buttonLayout.setVisibility(View.VISIBLE); /*buttonLayout.setVisibility(View.VISIBLE);
ViewCompat.setElevation( view, 10); ViewCompat.setElevation( view, 10);
buttonLayout.startAnimation(animationDown); buttonLayout.startAnimation(animationDown);
//openedItems.add(buttonLayout); //openedItems.add(buttonLayout);*/
buttonLayout.setVisibility(View.VISIBLE);
} }
@Override @Override

View file

@ -2,17 +2,10 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:id="@+id/more_info_bar" android:id="@+id/more_info_button"
android:visibility="gone" android:visibility="gone"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@color/default_circle_indicator_stroke_color" android:background="@color/default_circle_indicator_stroke_color"
> >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/more_info_button"
android:text="More Info"
android:layout_marginLeft="16dp"
android:background="@color/default_circle_indicator_stroke_color"
/>
</LinearLayout> </LinearLayout>

View file

@ -148,9 +148,10 @@ Description Description Description
Description Description Description Description Description Description
" /> " />
<FrameLayout <View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container_sheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"></FrameLayout> android:layout_height="48dp"
>
</View>
</LinearLayout> </LinearLayout>