|
|
@ -19,7 +19,6 @@ package org.transdroid.core.gui.settings; |
|
|
|
import android.annotation.TargetApi; |
|
|
|
import android.annotation.TargetApi; |
|
|
|
import android.app.AlertDialog; |
|
|
|
import android.app.AlertDialog; |
|
|
|
import android.app.Dialog; |
|
|
|
import android.app.Dialog; |
|
|
|
import android.content.DialogInterface; |
|
|
|
|
|
|
|
import android.content.DialogInterface.OnClickListener; |
|
|
|
import android.content.DialogInterface.OnClickListener; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.SharedPreferences; |
|
|
|
import android.content.SharedPreferences; |
|
|
@ -80,83 +79,44 @@ public class MainSettingsActivity extends PreferenceCompatActivity { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onAddWebsearch = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onAddWebsearch = preference -> { |
|
|
|
@Override |
|
|
|
WebsearchSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
return true; |
|
|
|
WebsearchSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onAddRssfeed = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onAddRssfeed = preference -> { |
|
|
|
@Override |
|
|
|
RssfeedSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
return true; |
|
|
|
RssfeedSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onBackgroundSettings = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onBackgroundSettings = preference -> { |
|
|
|
@Override |
|
|
|
NotificationSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
return true; |
|
|
|
NotificationSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onSystemSettings = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onSystemSettings = preference -> { |
|
|
|
@Override |
|
|
|
SystemSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
return true; |
|
|
|
SystemSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onHelpSettings = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onHelpSettings = preference -> { |
|
|
|
@Override |
|
|
|
HelpSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
return true; |
|
|
|
HelpSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onDonate = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onDonate = preference -> { |
|
|
|
@Override |
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.donate_url)))); |
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
return true; |
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.donate_url)))); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
private OnServerClickedListener onServerClicked = new OnServerClickedListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onServerClicked(ServerSetting serverSetting) { |
|
|
|
|
|
|
|
ServerSettingsActivity_.intent(MainSettingsActivity.this).key(serverSetting.getOrder()).start(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnSeedboxClickedListener onSeedboxClicked = new OnSeedboxClickedListener() { |
|
|
|
private OnServerClickedListener onServerClicked = serverSetting -> ServerSettingsActivity_.intent(MainSettingsActivity.this).key(serverSetting.getOrder()).start(); |
|
|
|
@Override |
|
|
|
private OnSeedboxClickedListener onSeedboxClicked = (serverSetting, provider, seedboxOffset) -> { |
|
|
|
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
|
|
|
|
// NOTE: The seedboxOffset is the seedbox type-unique order that we need to supply uin the Extras bundle to
|
|
|
|
// edit this specific seedbox
|
|
|
|
// 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() { |
|
|
|
private OnWebsearchClickedListener onWebsearchClicked = websearchSetting -> WebsearchSettingsActivity_.intent(MainSettingsActivity.this).key(websearchSetting.getOrder()).start(); |
|
|
|
@Override |
|
|
|
private OnRssfeedClickedListener onRssfeedClicked = rssfeedSetting -> RssfeedSettingsActivity_.intent(MainSettingsActivity.this).key(rssfeedSetting.getOrder()).start(); |
|
|
|
public void onWebsearchClicked(WebsearchSetting websearchSetting) { |
|
|
|
private OnClickListener onAddSeedbox = (dialog, which) -> { |
|
|
|
WebsearchSettingsActivity_.intent(MainSettingsActivity.this).key(websearchSetting.getOrder()).start(); |
|
|
|
// Start the configuration activity for this specific chosen seedbox
|
|
|
|
} |
|
|
|
if (which == 0) |
|
|
|
}; |
|
|
|
ServerSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
private OnRssfeedClickedListener onRssfeedClicked = new OnRssfeedClickedListener() { |
|
|
|
else |
|
|
|
@Override |
|
|
|
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this)); |
|
|
|
public void onRssfeedClicked(RssfeedSetting rssfeedSetting) { |
|
|
|
|
|
|
|
RssfeedSettingsActivity_.intent(MainSettingsActivity.this).key(rssfeedSetting.getOrder()).start(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
private OnClickListener onAddSeedbox = new OnClickListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
|
|
|
// Start the configuration activity for this specific chosen seedbox
|
|
|
|
|
|
|
|
if (which == 0) |
|
|
|
|
|
|
|
ServerSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|