Added advanced settings

captchafix
Florens Douwes 11 years ago
parent 7464687bec
commit d6111578f9
  1. 8
      Clover/app/src/main/AndroidManifest.xml
  2. 51
      Clover/app/src/main/java/org/floens/chan/ui/activity/AdvancedSettingsActivity.java
  3. 20
      Clover/app/src/main/java/org/floens/chan/ui/activity/SettingsActivity.java
  4. 25
      Clover/app/src/main/res/menu/settings.xml
  5. 3
      Clover/app/src/main/res/values/strings.xml
  6. 5
      Clover/app/src/main/res/xml/preference.xml
  7. 25
      Clover/app/src/main/res/xml/preference_advanced.xml

@ -134,6 +134,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</activity> </activity>
<activity android:name="org.floens.chan.ui.activity.DeveloperActivity"> <activity android:name="org.floens.chan.ui.activity.DeveloperActivity">
</activity> </activity>
<activity
android:name="org.floens.chan.ui.activity.AdvancedSettingsActivity"
android:label="@string/settings_advanced_label"
android:parentActivityName="org.floens.chan.ui.activity.BoardActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.floens.chan.ui.activity.BoardActivity"/>
</activity>
<service <service
android:name=".ui.service.WatchNotifier" android:name=".ui.service.WatchNotifier"

@ -0,0 +1,51 @@
/*
* Clover - 4chan browser https://github.com/Floens/Clover/
* Copyright (C) 2014 Floens
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.floens.chan.ui.activity;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import org.floens.chan.R;
public class AdvancedSettingsActivity extends PreferenceActivity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content, new AdvancedSettingsFragment()).commit();
}
public static class AdvancedSettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preference_advanced);
findPreference("preference_force_phone_layout").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
BaseActivity.doRestartOnResume = true;
return true;
}
});
}
}
}

@ -20,7 +20,10 @@ package org.floens.chan.ui.activity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import org.floens.chan.R;
import org.floens.chan.ui.fragment.SettingsFragment; import org.floens.chan.ui.fragment.SettingsFragment;
import org.floens.chan.utils.ThemeHelper; import org.floens.chan.utils.ThemeHelper;
@ -61,4 +64,21 @@ public class SettingsActivity extends Activity {
BaseActivity.doRestartOnResume = true; BaseActivity.doRestartOnResume = true;
} }
} }
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.settings, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
if (item.getItemId() == R.id.action_settings_advanced) {
startActivity(new Intent(this, AdvancedSettingsActivity.class));
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
} }

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_settings_advanced"
android:orderInCategory="1"
android:showAsAction="never"
android:title="@string/action_settings_advanced"/>
</menu>

@ -40,6 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="action_board_view_mode">View mode</string> <string name="action_board_view_mode">View mode</string>
<string name="action_board_view_mode_list">List</string> <string name="action_board_view_mode_list">List</string>
<string name="action_board_view_mode_grid">Grid</string> <string name="action_board_view_mode_grid">Grid</string>
<string name="action_settings_advanced">Advanced</string>
<string name="open_unknown_title">Unsupported link</string> <string name="open_unknown_title">Unsupported link</string>
<string name="open_unknown">Clover can\'t open this link. Opening it in your browser instead.</string> <string name="open_unknown">Clover can\'t open this link. Opening it in your browser instead.</string>
@ -201,6 +202,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="download_confirm">COUNT images will be downloaded to FOLDER</string> <string name="download_confirm">COUNT images will be downloaded to FOLDER</string>
<string name="board_select_add">Add more&#8230;</string> <string name="board_select_add">Add more&#8230;</string>
<string name="settings_advanced_label">Advanced settings</string>
</resources> </resources>

@ -72,11 +72,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:key="preference_autoplay" android:key="preference_autoplay"
android:dependency="preference_image_auto_load" android:dependency="preference_image_auto_load"
android:title="@string/preference_autoplay"/> android:title="@string/preference_autoplay"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="preference_force_phone_layout"
android:title="@string/preference_force_phone_layout"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/preference_posting"> <PreferenceCategory android:title="@string/preference_posting">

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Clover - 4chan browser https://github.com/Floens/Clover/
Copyright (C) 2014 Floens
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:defaultValue="false"
android:key="preference_force_phone_layout"
android:title="@string/preference_force_phone_layout"/>
</PreferenceScreen>
Loading…
Cancel
Save