mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Adding refresh option for Nearby
This commit is contained in:
parent
99512da7a6
commit
93be2cd33a
6 changed files with 41 additions and 4 deletions
|
|
@ -9,6 +9,9 @@ import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
|
@ -40,12 +43,32 @@ public class NearbyActivity extends AppCompatActivity {
|
||||||
ft.add(R.id.container, fragment);
|
ft.add(R.id.container, fragment);
|
||||||
ft.commit();
|
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
|
@Override
|
||||||
protected void onResume(){
|
protected void onResume(){
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void refreshView()
|
||||||
|
{
|
||||||
|
this.recreate();
|
||||||
|
}
|
||||||
protected LatLng getmLatestLocation() {
|
protected LatLng getmLatestLocation() {
|
||||||
return mLatestLocation;
|
return mLatestLocation;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
app/src/main/res/drawable-mdpi/ic_action_refresh.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_action_refresh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 856 B |
13
app/src/main/res/menu/menu_nearby.xml
Normal file
13
app/src/main/res/menu/menu_nearby.xml
Normal 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>
|
||||||
|
|
@ -49,6 +49,7 @@
|
||||||
<string name="menu_upload_single">Upload</string>
|
<string name="menu_upload_single">Upload</string>
|
||||||
<string name="categories_search_text_hint">Search categories</string>
|
<string name="categories_search_text_hint">Search categories</string>
|
||||||
<string name="menu_save_categories">Save</string>
|
<string name="menu_save_categories">Save</string>
|
||||||
|
<string name="refresh_button">Refresh</string>
|
||||||
<plurals name="contributions_subtitle">
|
<plurals name="contributions_subtitle">
|
||||||
<item quantity="zero">No uploads yet</item>
|
<item quantity="zero">No uploads yet</item>
|
||||||
<item quantity="one">1 upload</item>
|
<item quantity="one">1 upload</item>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
classpath 'com.android.tools.build:gradle:2.3.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
#Wed Aug 17 16:02:52 NZST 2016
|
#Fri Mar 03 19:41:57 IST 2017
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue