|
|
@ -28,6 +28,8 @@ import org.floens.chan.ui.cell.PostCellInterface; |
|
|
|
import org.floens.chan.utils.AndroidUtils; |
|
|
|
import org.floens.chan.utils.AndroidUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.net.InetSocketAddress; |
|
|
|
|
|
|
|
import java.net.Proxy; |
|
|
|
|
|
|
|
|
|
|
|
public class ChanSettings { |
|
|
|
public class ChanSettings { |
|
|
|
public enum ImageAutoLoadMode { |
|
|
|
public enum ImageAutoLoadMode { |
|
|
@ -54,6 +56,8 @@ public class ChanSettings { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Proxy proxy; |
|
|
|
|
|
|
|
|
|
|
|
private static final StringSetting theme; |
|
|
|
private static final StringSetting theme; |
|
|
|
public static final StringSetting fontSize; |
|
|
|
public static final StringSetting fontSize; |
|
|
|
public static final BooleanSetting openLinkConfirmation; |
|
|
|
public static final BooleanSetting openLinkConfirmation; |
|
|
@ -165,9 +169,25 @@ public class ChanSettings { |
|
|
|
|
|
|
|
|
|
|
|
historyEnabled = new BooleanSetting(p, "preference_history_enabled", true); |
|
|
|
historyEnabled = new BooleanSetting(p, "preference_history_enabled", true); |
|
|
|
|
|
|
|
|
|
|
|
proxyEnabled = new BooleanSetting(p, "preference_proxy_enabled", false); |
|
|
|
proxyEnabled = new BooleanSetting(p, "preference_proxy_enabled", false, new Setting.SettingCallback<Boolean>() { |
|
|
|
proxyAddress = new StringSetting(p, "preference_proxy_address", ""); |
|
|
|
@Override |
|
|
|
proxyPort = new IntegerSetting(p, "preference_proxy_port", 80); |
|
|
|
public void onValueChange(Setting setting, Boolean value) { |
|
|
|
|
|
|
|
loadProxy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
proxyAddress = new StringSetting(p, "preference_proxy_address", "", new Setting.SettingCallback<String>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onValueChange(Setting setting, String value) { |
|
|
|
|
|
|
|
loadProxy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
proxyPort = new IntegerSetting(p, "preference_proxy_port", 80, new Setting.SettingCallback<Integer>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onValueChange(Setting setting, Integer value) { |
|
|
|
|
|
|
|
loadProxy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
loadProxy(); |
|
|
|
|
|
|
|
|
|
|
|
// Old (but possibly still in some users phone)
|
|
|
|
// Old (but possibly still in some users phone)
|
|
|
|
// preference_board_view_mode default "list"
|
|
|
|
// preference_board_view_mode default "list"
|
|
|
@ -202,6 +222,23 @@ public class ChanSettings { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns a {@link Proxy} if a proxy is enabled, <tt>null</tt> otherwise. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return a proxy or null |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static Proxy getProxy() { |
|
|
|
|
|
|
|
return proxy; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void loadProxy() { |
|
|
|
|
|
|
|
if (proxyEnabled.get()) { |
|
|
|
|
|
|
|
proxy = new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved(proxyAddress.get(), proxyPort.get())); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
proxy = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class ThemeColor { |
|
|
|
public static class ThemeColor { |
|
|
|
public String theme; |
|
|
|
public String theme; |
|
|
|
public String color; |
|
|
|
public String color; |
|
|
|