mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Adding refresh UI
This commit is contained in:
parent
cbbca8754c
commit
f2a3c5ff24
4 changed files with 40 additions and 2 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,33 @@ 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.finish();
|
||||||
|
startActivity(getIntent());
|
||||||
|
}
|
||||||
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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue