mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Have TrackListActivity extends AbstractMyTracksActivity.
This commit is contained in:
@@ -43,7 +43,9 @@ public abstract class AbstractMyTracksActivity extends FragmentActivity {
|
||||
setContentView(getLayoutResId());
|
||||
|
||||
// Configure action bar must be after setContentView
|
||||
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
|
||||
if (configureActionBarHomeAsUp()) {
|
||||
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,6 +60,13 @@ public abstract class AbstractMyTracksActivity extends FragmentActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true to configure the action bar home button as the up button.
|
||||
*/
|
||||
protected boolean configureActionBarHomeAsUp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback when the home menu item is selected.
|
||||
*/
|
||||
@@ -67,10 +76,10 @@ public abstract class AbstractMyTracksActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() != android.R.id.home) {
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onHomeSelected();
|
||||
return true;
|
||||
}
|
||||
onHomeSelected();
|
||||
return true;
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,7 @@ import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.provider.Settings;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
@@ -93,7 +91,7 @@ import java.util.Locale;
|
||||
*
|
||||
* @author Leif Hendrik Wilden
|
||||
*/
|
||||
public class TrackListActivity extends FragmentActivity
|
||||
public class TrackListActivity extends AbstractMyTracksActivity
|
||||
implements ConfirmCaller, DeleteOneTrackCaller {
|
||||
|
||||
private static final String TAG = TrackListActivity.class.getSimpleName();
|
||||
@@ -357,9 +355,7 @@ public class TrackListActivity extends FragmentActivity
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
|
||||
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
||||
setContentView(R.layout.track_list);
|
||||
|
||||
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
|
||||
sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||
@@ -511,6 +507,16 @@ public class TrackListActivity extends FragmentActivity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.track_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean configureActionBarHomeAsUp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.track_list, menu);
|
||||
|
||||
Reference in New Issue
Block a user