Skip to content

Commit 93be2cd

Browse files
Adding refresh option for Nearby
1 parent 99512da commit 93be2cd

File tree

6 files changed

+41
-4
lines changed

6 files changed

+41
-4
lines changed

app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java

+24-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import android.support.v4.app.FragmentTransaction;
1010
import android.support.v7.app.AppCompatActivity;
1111
import android.util.Log;
12+
import android.view.Menu;
13+
import android.view.MenuInflater;
14+
import android.view.MenuItem;
1215

1316
import fr.free.nrw.commons.R;
1417

@@ -40,12 +43,32 @@ protected void onCreate(Bundle savedInstanceState) {
4043
ft.add(R.id.container, fragment);
4144
ft.commit();
4245
}
43-
46+
@Override
47+
public boolean onCreateOptionsMenu (Menu menu) {
48+
MenuInflater inflater = getMenuInflater();
49+
inflater.inflate(R.menu.menu_nearby, menu);
50+
return super.onCreateOptionsMenu(menu);
51+
}
52+
@Override
53+
public boolean onOptionsItemSelected(MenuItem item) {
54+
// Handle item selection
55+
switch (item.getItemId()) {
56+
case R.id.action_refresh:
57+
refreshView();
58+
return true;
59+
default:
60+
return super.onOptionsItemSelected(item);
61+
}
62+
}
4463
@Override
4564
protected void onResume(){
4665
super.onResume();
4766
}
4867

68+
protected void refreshView()
69+
{
70+
this.recreate();
71+
}
4972
protected LatLng getmLatestLocation() {
5073
return mLatestLocation;
5174
}
Loading

app/src/main/res/menu/menu_nearby.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
4+
5+
<item
6+
android:id="@+id/action_refresh"
7+
android:title="@string/refresh_button"
8+
android:icon="@drawable/ic_action_refresh"
9+
android:orderInCategory="1"
10+
app:showAsAction="ifRoom"
11+
/>
12+
13+
</menu>

app/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<string name="menu_upload_single">Upload</string>
5050
<string name="categories_search_text_hint">Search categories</string>
5151
<string name="menu_save_categories">Save</string>
52+
<string name="refresh_button">Refresh</string>
5253
<plurals name="contributions_subtitle">
5354
<item quantity="zero">No uploads yet</item>
5455
<item quantity="one">1 upload</item>

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.3'
8+
classpath 'com.android.tools.build:gradle:2.3.0'
99
}
1010
}
1111

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Aug 17 16:02:52 NZST 2016
1+
#Fri Mar 03 19:41:57 IST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

0 commit comments

Comments
 (0)