mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Remove toggle view code
This commit is contained in:
parent
289a528cd3
commit
08cf0990ce
4 changed files with 3 additions and 44 deletions
|
|
@ -49,7 +49,6 @@ import timber.log.Timber;
|
||||||
public class NearbyActivity extends NavigationBaseActivity implements LocationUpdateListener {
|
public class NearbyActivity extends NavigationBaseActivity implements LocationUpdateListener {
|
||||||
|
|
||||||
private static final int LOCATION_REQUEST = 1;
|
private static final int LOCATION_REQUEST = 1;
|
||||||
private static final String MAP_LAST_USED_PREFERENCE = "mapLastUsed";
|
|
||||||
|
|
||||||
@BindView(R.id.progressBar)
|
@BindView(R.id.progressBar)
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
@ -70,7 +69,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
|
|
||||||
private LatLng curLatLang;
|
private LatLng curLatLang;
|
||||||
private Bundle bundle;
|
private Bundle bundle;
|
||||||
private SharedPreferences sharedPreferences;
|
|
||||||
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
|
||||||
|
|
@ -83,7 +81,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
||||||
setContentView(R.layout.activity_nearby);
|
setContentView(R.layout.activity_nearby);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
resumeFragment();
|
resumeFragment();
|
||||||
|
|
@ -93,7 +90,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
initFabList();
|
initFabList();
|
||||||
|
|
||||||
initDrawer();
|
initDrawer();
|
||||||
initViewState();
|
|
||||||
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
|
@ -118,14 +114,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViewState() {
|
|
||||||
if (sharedPreferences.getBoolean(MAP_LAST_USED_PREFERENCE, false)) {
|
|
||||||
viewMode = NearbyActivityMode.MAP;
|
|
||||||
} else {
|
|
||||||
viewMode = NearbyActivityMode.LIST;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initBottomSheetBehaviour() {
|
private void initBottomSheetBehaviour() {
|
||||||
transparentView.setAlpha(0);
|
transparentView.setAlpha(0);
|
||||||
|
|
||||||
|
|
@ -166,11 +154,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.menu_nearby, menu);
|
inflater.inflate(R.menu.menu_nearby, menu);
|
||||||
|
|
||||||
if (viewMode.isMap()) {
|
|
||||||
MenuItem item = menu.findItem(R.id.action_toggle_view);
|
|
||||||
item.setIcon(viewMode.getIcon());
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,11 +165,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
lockNearbyView(false);
|
lockNearbyView(false);
|
||||||
refreshView(true);
|
refreshView(true);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_toggle_view:
|
|
||||||
viewMode = viewMode.toggle();
|
|
||||||
item.setIcon(viewMode.getIcon());
|
|
||||||
toggleView();
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
@ -297,15 +275,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleView() {
|
|
||||||
if (viewMode.isMap()) {
|
|
||||||
setMapFragment();
|
|
||||||
} else {
|
|
||||||
setListFragment();
|
|
||||||
}
|
|
||||||
sharedPreferences.edit().putBoolean(MAP_LAST_USED_PREFERENCE, viewMode.isMap()).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
@ -468,7 +437,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
}
|
}
|
||||||
else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
|
else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
fabList.hide();
|
fabList.hide();
|
||||||
//NearbyActivity.bottomSheetStatus = BottomSheetStatus.DISPLAY_LIST_SHEET;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp">
|
||||||
android:src="@drawable/ic_launcher">
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
@ -72,7 +71,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
app:srcCompat="@drawable/ic_directions_black_48dp" />
|
app:srcCompat="@drawable/ic_directions_black_24dp" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
android:id="@+id/buttonLayout"
|
android:id="@+id/buttonLayout"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="visible"
|
android:visibility="gone"
|
||||||
android:layout_below="@+id/icon"
|
android:layout_below="@+id/icon"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,6 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_toggle_view"
|
|
||||||
android:title="@string/toggle_view_button"
|
|
||||||
android:icon="@drawable/ic_map_white_24dp"
|
|
||||||
android:orderInCategory="1"
|
|
||||||
app:showAsAction="ifRoom"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_refresh"
|
android:id="@+id/action_refresh"
|
||||||
android:title="@string/refresh_button"
|
android:title="@string/refresh_button"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue