diff --git a/app/src/main/java/com/readrops/app/activities/MainActivity.java b/app/src/main/java/com/readrops/app/activities/MainActivity.java index 98f6eff1..ff023991 100644 --- a/app/src/main/java/com/readrops/app/activities/MainActivity.java +++ b/app/src/main/java/com/readrops/app/activities/MainActivity.java @@ -228,6 +228,12 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou case DrawerManager.ABOUT_ID: startActivity(new Intent(getApplication(), AboutActivity.class)); break; + case DrawerManager.SETTINGS_ID: + Intent intent = new Intent(getApplication(), SettingsActivity.class); + intent.putExtra(SettingsActivity.SETTINGS_KEY, + SettingsActivity.SettingsKey.SETTINGS.ordinal()); + startActivity(intent); + break; } } else if (drawerItem instanceof SecondaryDrawerItem) { drawer.closeDrawer(); diff --git a/app/src/main/java/com/readrops/app/activities/SettingsActivity.java b/app/src/main/java/com/readrops/app/activities/SettingsActivity.java index 006c1ea5..46e98147 100644 --- a/app/src/main/java/com/readrops/app/activities/SettingsActivity.java +++ b/app/src/main/java/com/readrops/app/activities/SettingsActivity.java @@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment; import com.readrops.app.R; import com.readrops.app.database.entities.account.Account; import com.readrops.app.fragments.settings.AccountSettingsFragment; +import com.readrops.app.fragments.settings.SettingsFragment; public class SettingsActivity extends AppCompatActivity { @@ -31,6 +32,10 @@ public class SettingsActivity extends AppCompatActivity { fragment = AccountSettingsFragment.newInstance(account); setTitle(account.getAccountName()); break; + case SETTINGS: + fragment = new SettingsFragment(); + setTitle(R.string.settings); + break; } getSupportFragmentManager() @@ -40,7 +45,8 @@ public class SettingsActivity extends AppCompatActivity { } public enum SettingsKey { - ACCOUNT_SETTINGS + ACCOUNT_SETTINGS, + SETTINGS } @Override diff --git a/app/src/main/java/com/readrops/app/fragments/settings/SettingsFragment.java b/app/src/main/java/com/readrops/app/fragments/settings/SettingsFragment.java new file mode 100644 index 00000000..b8b57383 --- /dev/null +++ b/app/src/main/java/com/readrops/app/fragments/settings/SettingsFragment.java @@ -0,0 +1,15 @@ +package com.readrops.app.fragments.settings; + +import android.os.Bundle; + +import androidx.preference.PreferenceFragmentCompat; + +import com.readrops.app.R; + +public class SettingsFragment extends PreferenceFragmentCompat { + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + addPreferencesFromResource(R.xml.preferences); + } +} diff --git a/app/src/main/java/com/readrops/app/utils/DrawerManager.java b/app/src/main/java/com/readrops/app/utils/DrawerManager.java index bb2ee31a..602aee31 100644 --- a/app/src/main/java/com/readrops/app/utils/DrawerManager.java +++ b/app/src/main/java/com/readrops/app/utils/DrawerManager.java @@ -41,6 +41,7 @@ public class DrawerManager { public static final int READ_LATER_ID = -6; public static final int ADD_ACCOUNT_ID = -4; public static final int ABOUT_ID = -7; + public static final int SETTINGS_ID = -8; private Activity activity; private Toolbar toolbar; @@ -212,6 +213,13 @@ public class DrawerManager { .withSelectable(false) .withIdentifier(ABOUT_ID); + PrimaryDrawerItem settingsItem = new PrimaryDrawerItem() + .withName(R.string.settings) + .withIcon(R.drawable.ic_settings) + .withSelectable(false) + .withIdentifier(SETTINGS_ID); + + drawer.addStickyFooterItem(settingsItem); drawer.addStickyFooterItem(aboutItem); drawer.addItem(articles); diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml index ace746c4..f7c249c4 100644 --- a/app/src/main/res/drawable/ic_settings.xml +++ b/app/src/main/res/drawable/ic_settings.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:fillColor="#727272" + android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z" /> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml new file mode 100644 index 00000000..624ed13a --- /dev/null +++ b/app/src/main/res/xml/preferences.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file