Adding refresh UI

This commit is contained in:
nextLane 2017-03-12 00:25:04 +05:30
parent cbbca8754c
commit f2a3c5ff24
4 changed files with 40 additions and 2 deletions

View file

@ -9,6 +9,9 @@ import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import fr.free.nrw.commons.R;
@ -40,12 +43,33 @@ public class NearbyActivity extends AppCompatActivity {
ft.add(R.id.container, fragment);
ft.commit();
}
@Override
public boolean onCreateOptionsMenu (Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_nearby, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.action_refresh:
refreshView();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onResume(){
super.onResume();
}
protected void refreshView()
{
this.finish();
startActivity(getIntent());
}
protected LatLng getmLatestLocation() {
return mLatestLocation;
}
@ -117,4 +141,4 @@ public class NearbyActivity extends AppCompatActivity {
unregisterLocationManager();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

View file

@ -0,0 +1,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item
android:id="@+id/action_refresh"
android:title="@string/refresh_button"
android:icon="@drawable/ic_action_refresh"
android:orderInCategory="1"
app:showAsAction="ifRoom"
/>
</menu>

View file

@ -49,6 +49,7 @@
<string name="menu_upload_single">Upload</string>
<string name="categories_search_text_hint">Search categories</string>
<string name="menu_save_categories">Save</string>
<string name="refresh_button">Refresh</string>
<plurals name="contributions_subtitle">
<item quantity="zero">No uploads yet</item>
<item quantity="one">1 upload</item>