Browse Source

Adding action bar to the preference activities.

material
Eric Kok 10 years ago
parent
commit
e710f18be2
  1. 2
      app/build.gradle
  2. 2
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  3. 4
      app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java
  4. 5
      app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java
  5. 77
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  6. 20
      app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java
  7. 121
      app/src/main/java/org/transdroid/core/gui/settings/OverflowPreference.java
  8. 65
      app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java
  9. 7
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
  10. 7
      app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java
  11. 4
      app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java
  12. 6
      app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java
  13. 7
      app/src/main/java/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java
  14. 2
      app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettingsActivity.java
  15. 2
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java
  16. 2
      app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java
  17. 2
      app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java
  18. 1
      app/src/main/res/values/strings.xml
  19. 2
      app/src/main/res/xml/pref_main.xml

2
app/build.gradle

@ -37,7 +37,7 @@ dependencies { @@ -37,7 +37,7 @@ dependencies {
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:support-annotations:20.0.0'
compile 'com.getbase:floatingactionbutton:1.8.0'
compile 'com.afollestad:material-dialogs:0.6.3.3'

2
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -472,6 +472,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE @@ -472,6 +472,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
}
// There is a connection (read: settings to some server known)
if (drawerToggle != null)
torrentsToolbar.setNavigationIcon(R.drawable.ic_action_drawer);
addmenuButton.setVisibility(View.VISIBLE);
actionsToolbar.setVisibility(View.VISIBLE);
@ -513,6 +514,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE @@ -513,6 +514,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
if (item instanceof SimpleListItem) {
filterSelected((SimpleListItem) item, false);
}
if (drawerLayout != null)
drawerLayout.closeDrawer(drawerContainer);
}
};

4
app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java

@ -37,7 +37,7 @@ import android.preference.Preference.OnPreferenceClickListener; @@ -37,7 +37,7 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
@EActivity
public class HelpSettingsActivity extends PreferenceActivity {
public class HelpSettingsActivity extends PreferenceCompatActivity {
protected static final int DIALOG_CHANGELOG = 0;
protected static final int DIALOG_ABOUT = 1;
@ -57,7 +57,7 @@ public class HelpSettingsActivity extends PreferenceActivity { @@ -57,7 +57,7 @@ public class HelpSettingsActivity extends PreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Just load the system-related preferences from XML
addPreferencesFromResource(R.xml.pref_help);

5
app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java

@ -28,7 +28,6 @@ import android.preference.CheckBoxPreference; @@ -28,7 +28,6 @@ import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.text.method.PasswordTransformationMethod;
@ -43,13 +42,13 @@ import android.text.method.PasswordTransformationMethod; @@ -43,13 +42,13 @@ import android.text.method.PasswordTransformationMethod;
* @author Eric Kok
*/
@EActivity
public abstract class KeyBoundPreferencesActivity extends PreferenceActivity {
public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivity {
@Extra
protected int key = -1;
private SharedPreferences sharedPrefs;
private Map<String, String> originalSummaries = new HashMap<String, String>();
private Map<String, String> originalSummaries = new HashMap<>();
/**
* Should be called during the activity {@link #onCreate(android.os.Bundle)} (but after super.onCreate(Bundle)) to

77
app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java

@ -28,8 +28,6 @@ import android.os.Bundle; @@ -28,8 +28,6 @@ import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.view.View;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
@ -41,9 +39,8 @@ import org.transdroid.core.app.settings.ApplicationSettings; @@ -41,9 +39,8 @@ import org.transdroid.core.app.settings.ApplicationSettings;
import org.transdroid.core.app.settings.RssfeedSetting;
import org.transdroid.core.app.settings.ServerSetting;
import org.transdroid.core.app.settings.WebsearchSetting;
import org.transdroid.core.gui.*;
import org.transdroid.core.gui.TorrentsActivity_;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.settings.OverflowPreference.OnOverflowClicked;
import org.transdroid.core.gui.settings.RssfeedPreference.OnRssfeedClickedListener;
import org.transdroid.core.gui.settings.ServerPreference.OnServerClickedListener;
import org.transdroid.core.gui.settings.WebsearchPreference.OnWebsearchClickedListener;
@ -55,21 +52,14 @@ import java.util.ArrayList; @@ -55,21 +52,14 @@ import java.util.ArrayList;
import java.util.List;
/**
* The main activity that provides access to all application settings. It shows the configured serves, web search sites
* and RSS feeds along with other general settings.
* The main activity that provides access to all application settings. It shows the configured serves, web search sites and RSS feeds along with other
* general settings.
* @author Eric Kok
*/
@EActivity
public class MainSettingsActivity extends PreferenceActivity {
public class MainSettingsActivity extends PreferenceCompatActivity {
protected static final int DIALOG_ADDSEEDBOX = 0;
private OnOverflowClicked onOverflowClicked = new OnOverflowClicked() {
@SuppressWarnings("deprecation")
@Override
public void onOverflowClicked(View overflowButton) {
showDialog(DIALOG_ADDSEEDBOX);
}
};
@Bean
protected NavigationHelper navigationHelper;
@Bean
@ -78,8 +68,12 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -78,8 +68,12 @@ public class MainSettingsActivity extends PreferenceActivity {
protected SearchHelper searchHelper;
protected SharedPreferences prefs;
private OnPreferenceClickListener onAddServer = new OnPreferenceClickListener() {
@SuppressWarnings("deprecation")
@Override
public boolean onPreferenceClick(Preference preference) {
if (navigationHelper.enableSeedboxes())
showDialog(DIALOG_ADDSEEDBOX);
else
ServerSettingsActivity_.intent(MainSettingsActivity.this).start();
return true;
}
@ -130,8 +124,7 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -130,8 +124,7 @@ public class MainSettingsActivity extends PreferenceActivity {
public void onSeedboxClicked(ServerSetting serverSetting, SeedboxProvider provider, int seedboxOffset) {
// NOTE: The seedboxOffset is the seedbox type-unique order that we need to supply uin the Extras bundle to
// edit this specific seedbox
startActivity(provider.getSettings().getSettingsActivityIntent(MainSettingsActivity.this)
.putExtra("key", seedboxOffset));
startActivity(provider.getSettings().getSettingsActivityIntent(MainSettingsActivity.this).putExtra("key", seedboxOffset));
}
};
private OnWebsearchClickedListener onWebsearchClicked = new OnWebsearchClickedListener() {
@ -150,8 +143,10 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -150,8 +143,10 @@ public class MainSettingsActivity extends PreferenceActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
// Start the configuration activity for this specific chosen seedbox
startActivity(
SeedboxProvider.values()[which].getSettings().getSettingsActivityIntent(MainSettingsActivity.this));
if (which == 0)
ServerSettingsActivity_.intent(MainSettingsActivity.this).start();
else
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this));
}
};
@ -166,7 +161,7 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -166,7 +161,7 @@ public class MainSettingsActivity extends PreferenceActivity {
protected void onResume() {
super.onResume();
//TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
prefs = getPreferenceManager().getSharedPreferences();
if (getPreferenceScreen() != null) {
@ -178,13 +173,7 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -178,13 +173,7 @@ public class MainSettingsActivity extends PreferenceActivity {
// Load the preference menu and attach actions
addPreferencesFromResource(R.xml.pref_main);
OverflowPreference addServerPrefernce = (OverflowPreference) findPreference("header_addserver");
addServerPrefernce.setOnPreferenceClickListener(onAddServer);
if (navigationHelper.enableSeedboxes()) {
addServerPrefernce.setOnOverflowClickedListener(onOverflowClicked);
} else {
addServerPrefernce.hideOverflowButton();
}
findPreference("header_addserver").setOnPreferenceClickListener(onAddServer);
if (enableSearchUi) {
findPreference("header_addwebsearch").setOnPreferenceClickListener(onAddWebsearch);
}
@ -196,8 +185,8 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -196,8 +185,8 @@ public class MainSettingsActivity extends PreferenceActivity {
findPreference("header_help").setOnPreferenceClickListener(onHelpSettings);
// Keep a list of the server codes and names (for default server selection)
List<String> serverCodes = new ArrayList<String>();
List<String> serverNames = new ArrayList<String>();
List<String> serverCodes = new ArrayList<>();
List<String> serverNames = new ArrayList<>();
serverCodes.add(Integer.toString(ApplicationSettings.DEFAULTSERVER_LASTUSED));
serverCodes.add(Integer.toString(ApplicationSettings.DEFAULTSERVER_ASKONADD));
serverNames.add(getString(R.string.pref_defaultserver_lastused));
@ -206,8 +195,8 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -206,8 +195,8 @@ public class MainSettingsActivity extends PreferenceActivity {
// Add existing servers
List<ServerSetting> servers = applicationSettings.getNormalServerSettings();
for (ServerSetting serverSetting : servers) {
getPreferenceScreen().addPreference(new ServerPreference(this).setServerSetting(serverSetting)
.setOnServerClickedListener(onServerClicked));
getPreferenceScreen()
.addPreference(new ServerPreference(this).setServerSetting(serverSetting).setOnServerClickedListener(onServerClicked));
if (serverSetting.getUniqueIdentifier() != null) {
serverCodes.add(Integer.toString(serverSetting.getOrder()));
serverNames.add(serverSetting.getName());
@ -219,8 +208,7 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -219,8 +208,7 @@ public class MainSettingsActivity extends PreferenceActivity {
for (SeedboxProvider provider : SeedboxProvider.values()) {
int seedboxOffset = 0;
for (ServerSetting seedbox : provider.getSettings().getAllServerSettings(prefs, orderOffset)) {
getPreferenceScreen().addPreference(
new SeedboxPreference(this).setProvider(provider).setServerSetting(seedbox)
getPreferenceScreen().addPreference(new SeedboxPreference(this).setProvider(provider).setServerSetting(seedbox)
.setOnSeedboxClickedListener(onSeedboxClicked, seedboxOffset));
orderOffset++;
seedboxOffset++;
@ -242,8 +230,8 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -242,8 +230,8 @@ public class MainSettingsActivity extends PreferenceActivity {
} else {
List<RssfeedSetting> rssfeeds = applicationSettings.getRssfeedSettings();
for (RssfeedSetting rssfeedSetting : rssfeeds) {
getPreferenceScreen().addPreference(new RssfeedPreference(this).setRssfeedSetting(rssfeedSetting)
.setOnRssfeedClickedListener(onRssfeedClicked));
getPreferenceScreen()
.addPreference(new RssfeedPreference(this).setRssfeedSetting(rssfeedSetting).setOnRssfeedClickedListener(onRssfeedClicked));
}
}
@ -256,8 +244,8 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -256,8 +244,8 @@ public class MainSettingsActivity extends PreferenceActivity {
// Add existing websearch sites
List<WebsearchSetting> websearches = applicationSettings.getWebsearchSettings();
for (WebsearchSetting websearchSetting : websearches) {
getPreferenceScreen().addPreference(new WebsearchPreference(this).setWebsearchSetting(websearchSetting)
.setOnWebsearchClickedListener(onWebsearchClicked));
getPreferenceScreen().addPreference(
new WebsearchPreference(this).setWebsearchSetting(websearchSetting).setOnWebsearchClickedListener(onWebsearchClicked));
}
// Construct list of all available search sites, in-app and web
@ -265,10 +253,10 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -265,10 +253,10 @@ public class MainSettingsActivity extends PreferenceActivity {
// Retrieve the available in-app search sites (using the Torrent Search package)
List<SearchSite> searchsites = searchHelper.getAvailableSites();
if (searchsites == null) {
searchsites = new ArrayList<SearchSite>();
searchsites = new ArrayList<>();
}
List<String> siteNames = new ArrayList<String>(websearches.size() + searchsites.size());
List<String> siteValues = new ArrayList<String>(websearches.size() + searchsites.size());
List<String> siteNames = new ArrayList<>(websearches.size() + searchsites.size());
List<String> siteValues = new ArrayList<>(websearches.size() + searchsites.size());
for (SearchSite searchSite : searchsites) {
siteNames.add(searchSite.getName());
siteValues.add(searchSite.getKey());
@ -295,14 +283,15 @@ public class MainSettingsActivity extends PreferenceActivity { @@ -295,14 +283,15 @@ public class MainSettingsActivity extends PreferenceActivity {
super.onBuildHeaders(target);
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_ADDSEEDBOX:
// Open dialog to pick one of the supported seedbox providers
String[] seedboxes = new String[SeedboxProvider.values().length];
for (int i = 0; i < seedboxes.length; i++) {
seedboxes[i] = getString(R.string.pref_seedbox_addseedbox,
SeedboxProvider.values()[i].getSettings().getName());
// Open dialog to pick one of the supported seedbox providers (or a normal server)
String[] seedboxes = new String[SeedboxProvider.values().length + 1];
seedboxes[0] = getString(R.string.pref_addserver_normal);
for (int i = 0; i < seedboxes.length - 1; i++) {
seedboxes[i + 1] = getString(R.string.pref_seedbox_addseedbox, SeedboxProvider.values()[i].getSettings().getName());
}
return new AlertDialog.Builder(this).setItems(seedboxes, onAddSeedbox).create();
}

20
app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java

@ -16,24 +16,22 @@ @@ -16,24 +16,22 @@
*/
package org.transdroid.core.gui.settings;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.transdroid.R;
import org.transdroid.core.app.settings.NotificationSettings;
import org.transdroid.core.service.BootReceiver;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.transdroid.R;
import org.transdroid.core.app.settings.NotificationSettings;
import org.transdroid.core.service.BootReceiver;
@EActivity
public class NotificationSettingsActivity extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
public class NotificationSettingsActivity extends PreferenceCompatActivity implements OnSharedPreferenceChangeListener {
@Bean
protected NotificationSettings notificationSettings;
@ -43,7 +41,7 @@ public class NotificationSettingsActivity extends PreferenceActivity implements @@ -43,7 +41,7 @@ public class NotificationSettingsActivity extends PreferenceActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the notification-related preferences from XML and update availability thereof
addPreferencesFromResource(R.xml.pref_notifications);

121
app/src/main/java/org/transdroid/core/gui/settings/OverflowPreference.java

@ -1,121 +0,0 @@ @@ -1,121 +0,0 @@
package org.transdroid.core.gui.settings;
import org.transdroid.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageButton;
/**
* A {@link Preference} item that shows an extra overflow button at the right side of the screen. The action attached to
* this button is set using {@link #setOnOverflowClickedListener(OnOverflowClicked)}. Normal clicks on this preference
* are handled in the standard way.
* @author Eric Kok
*/
public class OverflowPreference extends Preference {
private OnPreferenceClickListener onPreferenceClickListener = null;
private OnOverflowClicked onOverflowClickedListener = null;
private ImageButton overflowButton = null;
public OverflowPreference(Context context) {
super(context);
init();
}
public OverflowPreference(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public OverflowPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
@Override
protected View onCreateView(ViewGroup parent) {
View layout = super.onCreateView(parent);
// Since the Preference layout is now created, we can attach the proper click listeners
layout.setClickable(true);
layout.setFocusable(true);
// When setting the background drawable the padding on this Preference layout disappears, so add it again
int bottom = layout.getPaddingBottom();
int top = layout.getPaddingTop();
int right = layout.getPaddingRight();
int left = layout.getPaddingLeft();
TypedArray ta = getContext().obtainStyledAttributes(new int[] { android.R.attr.selectableItemBackground });
layout.setBackgroundDrawable(ta.getDrawable(0));
ta.recycle();
layout.setPadding(left, top, right, bottom);
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onPreferenceClickListener != null)
onPreferenceClickListener.onPreferenceClick(OverflowPreference.this);
}
});
overflowButton = (ImageButton) layout.findViewById(R.id.overflow_button);
overflowButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onOverflowClickedListener != null)
onOverflowClickedListener.onOverflowClicked(v);
}
});
return layout;
}
public void init() {
// Load an overflow-style image button as custom widget in the right of this Preference layout
setWidgetLayoutResource(R.layout.pref_withoverflow);
}
/**
* Hides the overflow button (on the right side of the Preference) from the UI.
*/
public void hideOverflowButton() {
if (overflowButton != null) {
overflowButton.setVisibility(View.GONE);
}
}
/**
* Shows (after hiding it) the overflow button (on the right side of the Preference) in the UI.
*/
public void showOverflowButton() {
if (overflowButton != null) {
overflowButton.setVisibility(View.VISIBLE);
}
}
@Override
public void setOnPreferenceClickListener(OnPreferenceClickListener onPreferenceClickListener) {
// Instead of the build-in list item click behaviour, we have to manually assign the click listener to this
// Preference item, as we stole the focus behaviour when we added a Button to the Preference layout
this.onPreferenceClickListener = onPreferenceClickListener;
}
/**
* Registers the listener for clicks on the overflow button contained in this preference.
* @param onOverflowClickedListener The overflow button click listener
*/
public void setOnOverflowClickedListener(OnOverflowClicked onOverflowClickedListener) {
this.onOverflowClickedListener = onOverflowClickedListener;
}
/**
* An interface to be implemented by any activity (or otherwise) that wants to handle events when the contained
* overflow button is clicked.
*/
public interface OnOverflowClicked {
public void onOverflowClicked(View overflowButton);
}
}

65
app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
package org.transdroid.core.gui.settings;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatCallback;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.view.ActionMode;
public class PreferenceCompatActivity extends PreferenceActivity implements AppCompatCallback {
private AppCompatDelegate acd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
acd = AppCompatDelegate.create(this, this);
acd.onCreate(savedInstanceState);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
acd.onPostCreate(savedInstanceState);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
acd.onConfigurationChanged(newConfig);
}
@Override
public void setTitle(CharSequence title) {
super.setTitle(title);
acd.setTitle(title);
}
@Override
protected void onStop() {
super.onStop();
acd.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
acd.onDestroy();
}
public ActionBar getSupportActionBar() {
return acd.getSupportActionBar();
}
@Override
public void onSupportActionModeStarted(ActionMode actionMode) {
}
@Override
public void onSupportActionModeFinished(ActionMode actionMode) {
}
}

7
app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java

@ -37,7 +37,7 @@ import android.os.Bundle; @@ -37,7 +37,7 @@ import android.os.Bundle;
* @author Eric Kok
*/
@EActivity
@OptionsMenu(resName = "activity_deleteableprefs")
@OptionsMenu(R.menu.activity_deleteableprefs)
public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity {
private static final int DIALOG_CONFIRMREMOVE = 0;
@ -46,7 +46,7 @@ public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity { @@ -46,7 +46,7 @@ public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_rssfeed, ApplicationSettings_.getInstance_(this).getMaxRssfeed());
@ -65,11 +65,12 @@ public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity { @@ -65,11 +65,12 @@ public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity {
}
@SuppressWarnings("deprecation")
@OptionsItem(resName = "action_removesettings")
@OptionsItem(R.id.action_removesettings)
protected void removeSettings() {
showDialog(DIALOG_CONFIRMREMOVE);
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_CONFIRMREMOVE:

7
app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java

@ -41,7 +41,7 @@ import android.preference.PreferenceManager; @@ -41,7 +41,7 @@ import android.preference.PreferenceManager;
* @author Eric Kok
*/
@EActivity
@OptionsMenu(resName = "activity_deleteableprefs")
@OptionsMenu(R.menu.activity_deleteableprefs)
public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
private static final int DIALOG_CONFIRMREMOVE = 0;
@ -52,7 +52,7 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity { @@ -52,7 +52,7 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_server, ApplicationSettings_.getInstance_(this).getMaxNormalServer());
@ -89,11 +89,12 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity { @@ -89,11 +89,12 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
}
@SuppressWarnings("deprecation")
@OptionsItem(resName = "action_removesettings")
@OptionsItem(R.id.action_removesettings)
protected void removeSettings() {
showDialog(DIALOG_CONFIRMREMOVE);
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_CONFIRMREMOVE:

4
app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java

@ -53,7 +53,7 @@ import java.io.FileNotFoundException; @@ -53,7 +53,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
@EActivity
public class SystemSettingsActivity extends PreferenceActivity {
public class SystemSettingsActivity extends PreferenceCompatActivity {
protected static final int DIALOG_IMPORTSETTINGS = 0;
private OnPreferenceClickListener onImportSettingsClick = new OnPreferenceClickListener() {
@ -154,7 +154,7 @@ public class SystemSettingsActivity extends PreferenceActivity { @@ -154,7 +154,7 @@ public class SystemSettingsActivity extends PreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Just load the system-related preferences from XML
addPreferencesFromResource(R.xml.pref_system);

6
app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java

@ -16,11 +16,11 @@ @@ -16,11 +16,11 @@
*/
package org.transdroid.core.gui.settings;
import org.transdroid.core.app.settings.WebsearchSetting;
import android.content.Context;
import android.preference.Preference;
import org.transdroid.core.app.settings.WebsearchSetting;
/**
* Represents a {@link WebsearchSetting} in a preferences screen.
* @author Eric Kok
@ -70,7 +70,7 @@ public class WebsearchPreference extends Preference { @@ -70,7 +70,7 @@ public class WebsearchPreference extends Preference {
};
public interface OnWebsearchClickedListener {
public void onWebsearchClicked(WebsearchSetting serverSetting);
void onWebsearchClicked(WebsearchSetting serverSetting);
}
}

7
app/src/main/java/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java

@ -37,7 +37,7 @@ import android.os.Bundle; @@ -37,7 +37,7 @@ import android.os.Bundle;
* @author Eric Kok
*/
@EActivity
@OptionsMenu(resName="activity_deleteableprefs")
@OptionsMenu(R.menu.activity_deleteableprefs)
public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity {
private static final int DIALOG_CONFIRMREMOVE = 0;
@ -46,7 +46,7 @@ public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity { @@ -46,7 +46,7 @@ public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_websearch, ApplicationSettings_.getInstance_(this).getMaxWebsearch());
@ -63,11 +63,12 @@ public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity { @@ -63,11 +63,12 @@ public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity {
}
@SuppressWarnings("deprecation")
@OptionsItem(resName = "action_removesettings")
@OptionsItem(R.id.action_removesettings)
protected void removeSettings() {
showDialog(DIALOG_CONFIRMREMOVE);
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_CONFIRMREMOVE:

2
app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettingsActivity.java

@ -42,7 +42,7 @@ public class SeedstuffSettingsActivity extends KeyBoundPreferencesActivity { @@ -42,7 +42,7 @@ public class SeedstuffSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_seedbox_seedstuff,

2
app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java

@ -42,7 +42,7 @@ public class XirvikDediSettingsActivity extends KeyBoundPreferencesActivity { @@ -42,7 +42,7 @@ public class XirvikDediSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_seedbox_xirvikdedi,

2
app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java

@ -42,7 +42,7 @@ public class XirvikSemiSettingsActivity extends KeyBoundPreferencesActivity { @@ -42,7 +42,7 @@ public class XirvikSemiSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_seedbox_xirviksemi,

2
app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java

@ -60,7 +60,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity { @@ -60,7 +60,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO getActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Load the raw preferences to show in this screen
init(R.xml.pref_seedbox_xirvikshared,

1
app/src/main/res/values/strings.xml

@ -222,6 +222,7 @@ @@ -222,6 +222,7 @@
<string name="pref_servers">Servers</string>
<string name="pref_addserver">Add new server</string>
<string name="pref_addserver_normal">Add normal, custom server</string>
<string name="pref_addseedbox">Add seedbox</string>
<string name="pref_defaultserver">Default server</string>
<string name="pref_defaultserver_lastused">Last used</string>

2
app/src/main/res/xml/pref_main.xml

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
android:key="header_servers"
android:title="@string/pref_servers"
android:order="0">
<org.transdroid.core.gui.settings.OverflowPreference
<Preference
android:key="header_addserver"
android:title="@string/pref_addserver"
android:order="98" />

Loading…
Cancel
Save