mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Remove toggle view code
This commit is contained in:
parent
56cdf56430
commit
dc294b8b97
4 changed files with 3 additions and 44 deletions
|
|
@ -48,7 +48,6 @@ import timber.log.Timber;
|
|||
public class NearbyActivity extends NavigationBaseActivity implements LocationUpdateListener {
|
||||
|
||||
private static final int LOCATION_REQUEST = 1;
|
||||
private static final String MAP_LAST_USED_PREFERENCE = "mapLastUsed";
|
||||
|
||||
@BindView(R.id.progressBar)
|
||||
ProgressBar progressBar;
|
||||
|
|
@ -69,7 +68,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
|
||||
private LatLng curLatLang;
|
||||
private Bundle bundle;
|
||||
private SharedPreferences sharedPreferences;
|
||||
private NearbyActivityMode viewMode;
|
||||
private Disposable placesDisposable;
|
||||
private boolean lockNearbyView; //Determines if the nearby places needs to be refreshed
|
||||
|
|
@ -81,7 +79,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
setContentView(R.layout.activity_nearby);
|
||||
ButterKnife.bind(this);
|
||||
resumeFragment();
|
||||
|
|
@ -91,7 +88,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
initFabList();
|
||||
|
||||
initDrawer();
|
||||
initViewState();
|
||||
}
|
||||
|
||||
private void resumeFragment() {
|
||||
|
|
@ -109,14 +105,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() {
|
||||
transparentView.setAlpha(0);
|
||||
|
||||
|
|
@ -157,11 +145,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
MenuInflater inflater = getMenuInflater();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -173,11 +156,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
lockNearbyView(false);
|
||||
refreshView(true);
|
||||
return true;
|
||||
case R.id.action_toggle_view:
|
||||
viewMode = viewMode.toggle();
|
||||
item.setIcon(viewMode.getIcon());
|
||||
toggleView();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
@ -288,15 +266,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
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
|
@ -456,7 +425,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
}
|
||||
else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
fabList.hide();
|
||||
//NearbyActivity.bottomSheetStatus = BottomSheetStatus.DISPLAY_LIST_SHEET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@
|
|||
android:id="@+id/icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_launcher">
|
||||
android:layout_marginLeft="16dp">
|
||||
</ImageView>
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -72,7 +71,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:srcCompat="@drawable/ic_directions_black_48dp" />
|
||||
app:srcCompat="@drawable/ic_directions_black_24dp" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
android:id="@+id/buttonLayout"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:layout_below="@+id/icon"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -2,14 +2,6 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_toggle_view"
|
||||
android:title="@string/refresh_button"
|
||||
android:icon="@drawable/ic_map_white_24dp"
|
||||
android:orderInCategory="1"
|
||||
app:showAsAction="ifRoom"
|
||||
/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_refresh"
|
||||
android:title="@string/refresh_button"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue