forked from upstream-mirrors/OpenTracks
Have TrackListActivity extends AbstractMyTracksActivity.
This commit is contained in:
@@ -43,7 +43,9 @@ public abstract class AbstractMyTracksActivity extends FragmentActivity {
|
|||||||
setContentView(getLayoutResId());
|
setContentView(getLayoutResId());
|
||||||
|
|
||||||
// Configure action bar must be after setContentView
|
// 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;
|
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.
|
* Callback when the home menu item is selected.
|
||||||
*/
|
*/
|
||||||
@@ -67,10 +76,10 @@ public abstract class AbstractMyTracksActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() != android.R.id.home) {
|
if (item.getItemId() == android.R.id.home) {
|
||||||
return super.onOptionsItemSelected(item);
|
onHomeSelected();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
onHomeSelected();
|
return super.onOptionsItemSelected(item);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,7 @@ import android.location.Location;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.speech.tts.TextToSpeech;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
|
||||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.support.v4.content.CursorLoader;
|
import android.support.v4.content.CursorLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
@@ -93,7 +91,7 @@ import java.util.Locale;
|
|||||||
*
|
*
|
||||||
* @author Leif Hendrik Wilden
|
* @author Leif Hendrik Wilden
|
||||||
*/
|
*/
|
||||||
public class TrackListActivity extends FragmentActivity
|
public class TrackListActivity extends AbstractMyTracksActivity
|
||||||
implements ConfirmCaller, DeleteOneTrackCaller {
|
implements ConfirmCaller, DeleteOneTrackCaller {
|
||||||
|
|
||||||
private static final String TAG = TrackListActivity.class.getSimpleName();
|
private static final String TAG = TrackListActivity.class.getSimpleName();
|
||||||
@@ -357,9 +355,7 @@ public class TrackListActivity extends FragmentActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
|
|
||||||
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
||||||
setContentView(R.layout.track_list);
|
|
||||||
|
|
||||||
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
|
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
|
||||||
sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
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
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.track_list, menu);
|
getMenuInflater().inflate(R.menu.track_list, menu);
|
||||||
|
|||||||
Reference in New Issue
Block a user