mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +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.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue