|
|
@ -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 |
|
|
|
|
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
|
|
|
|
WebsearchSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
WebsearchSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onAddRssfeed = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onAddRssfeed = preference -> { |
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
|
|
|
|
RssfeedSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
RssfeedSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onBackgroundSettings = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onBackgroundSettings = preference -> { |
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
|
|
|
|
NotificationSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
NotificationSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onSystemSettings = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onSystemSettings = preference -> { |
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
|
|
|
|
SystemSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
SystemSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onHelpSettings = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onHelpSettings = preference -> { |
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
|
|
|
|
HelpSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
HelpSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
private OnPreferenceClickListener onDonate = new OnPreferenceClickListener() { |
|
|
|
private OnPreferenceClickListener onDonate = preference -> { |
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean onPreferenceClick(Preference preference) { |
|
|
|
|
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.donate_url)))); |
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.donate_url)))); |
|
|
|
return true; |
|
|
|
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(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
private OnRssfeedClickedListener onRssfeedClicked = new OnRssfeedClickedListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
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
|
|
|
|
// Start the configuration activity for this specific chosen seedbox
|
|
|
|
if (which == 0) |
|
|
|
if (which == 0) |
|
|
|
ServerSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
ServerSettingsActivity_.intent(MainSettingsActivity.this).start(); |
|
|
|
else |
|
|
|
else |
|
|
|
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this)); |
|
|
|
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this)); |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|