Loading opentasks/build.gradle +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ dependencies { implementation 'io.reactivex.rxjava2:rxjava:2.2.21' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'androidx.preference:preference:1.1.1' } if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { Loading opentasks/src/main/java/org/dmfs/tasks/AppAppearanceSettingsFragment.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright 2017 dmfs GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.dmfs.tasks; import android.os.Bundle; import androidx.preference.PreferenceFragmentCompat; /** * Fragment for the app appearance settings. */ public final class AppAppearanceSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.appearance_preferences, rootKey); } } opentasks/src/main/java/org/dmfs/tasks/AppNotificationSettingsFragment.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright 2017 dmfs GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.dmfs.tasks; import android.os.Bundle; import androidx.preference.PreferenceFragmentCompat; /** * Fragment for the app notifications settings on Android <8. */ public final class AppNotificationSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.notification_preferences, rootKey); } } opentasks/src/main/java/org/dmfs/tasks/AppSettingsActivity.java +27 −2 Original line number Diff line number Diff line Loading @@ -16,18 +16,24 @@ package org.dmfs.tasks; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.view.MenuItem; import org.dmfs.tasks.utils.BaseActivity; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; /** * Activity for the general app settings screen. * * @author Gabor Keszthelyi */ public final class AppSettingsActivity extends BaseActivity public final class AppSettingsActivity extends BaseActivity implements PreferenceFragmentCompat.OnPreferenceStartFragmentCallback { @Override Loading @@ -35,7 +41,7 @@ public final class AppSettingsActivity extends BaseActivity { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction() .replace(android.R.id.content, new AppSettingsFragment()) .commit(); Loading @@ -54,4 +60,23 @@ public final class AppSettingsActivity extends BaseActivity return super.onOptionsItemSelected(item); } @Override public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) { if (Build.VERSION.SDK_INT >= 26 && "notifications".equalsIgnoreCase(pref.getKey())) { // open the system notification settings Intent intent = new Intent(); intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName()); startActivity(intent); return true; } getSupportFragmentManager().beginTransaction() .replace(android.R.id.content, getSupportFragmentManager().getFragmentFactory().instantiate(getClassLoader(), pref.getFragment())) .addToBackStack("") .commit(); return true; } } opentasks/src/main/java/org/dmfs/tasks/AppSettingsFragment.java +5 −10 Original line number Diff line number Diff line Loading @@ -17,23 +17,18 @@ package org.dmfs.tasks; import android.os.Bundle; import android.preference.PreferenceFragment; import androidx.annotation.Nullable; import androidx.preference.PreferenceFragmentCompat; /** * Fragment for the general app settings. * * @author Gabor Keszthelyi */ public final class AppSettingsFragment extends PreferenceFragment public final class AppSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreate(@Nullable Bundle savedInstanceState) public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.app_preferences); setPreferencesFromResource(R.xml.app_preferences, rootKey); } } Loading
opentasks/build.gradle +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ dependencies { implementation 'io.reactivex.rxjava2:rxjava:2.2.21' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'androidx.preference:preference:1.1.1' } if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { Loading
opentasks/src/main/java/org/dmfs/tasks/AppAppearanceSettingsFragment.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright 2017 dmfs GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.dmfs.tasks; import android.os.Bundle; import androidx.preference.PreferenceFragmentCompat; /** * Fragment for the app appearance settings. */ public final class AppAppearanceSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.appearance_preferences, rootKey); } }
opentasks/src/main/java/org/dmfs/tasks/AppNotificationSettingsFragment.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright 2017 dmfs GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.dmfs.tasks; import android.os.Bundle; import androidx.preference.PreferenceFragmentCompat; /** * Fragment for the app notifications settings on Android <8. */ public final class AppNotificationSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.notification_preferences, rootKey); } }
opentasks/src/main/java/org/dmfs/tasks/AppSettingsActivity.java +27 −2 Original line number Diff line number Diff line Loading @@ -16,18 +16,24 @@ package org.dmfs.tasks; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.view.MenuItem; import org.dmfs.tasks.utils.BaseActivity; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; /** * Activity for the general app settings screen. * * @author Gabor Keszthelyi */ public final class AppSettingsActivity extends BaseActivity public final class AppSettingsActivity extends BaseActivity implements PreferenceFragmentCompat.OnPreferenceStartFragmentCallback { @Override Loading @@ -35,7 +41,7 @@ public final class AppSettingsActivity extends BaseActivity { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction() .replace(android.R.id.content, new AppSettingsFragment()) .commit(); Loading @@ -54,4 +60,23 @@ public final class AppSettingsActivity extends BaseActivity return super.onOptionsItemSelected(item); } @Override public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) { if (Build.VERSION.SDK_INT >= 26 && "notifications".equalsIgnoreCase(pref.getKey())) { // open the system notification settings Intent intent = new Intent(); intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName()); startActivity(intent); return true; } getSupportFragmentManager().beginTransaction() .replace(android.R.id.content, getSupportFragmentManager().getFragmentFactory().instantiate(getClassLoader(), pref.getFragment())) .addToBackStack("") .commit(); return true; } }
opentasks/src/main/java/org/dmfs/tasks/AppSettingsFragment.java +5 −10 Original line number Diff line number Diff line Loading @@ -17,23 +17,18 @@ package org.dmfs.tasks; import android.os.Bundle; import android.preference.PreferenceFragment; import androidx.annotation.Nullable; import androidx.preference.PreferenceFragmentCompat; /** * Fragment for the general app settings. * * @author Gabor Keszthelyi */ public final class AppSettingsFragment extends PreferenceFragment public final class AppSettingsFragment extends PreferenceFragmentCompat { @Override public void onCreate(@Nullable Bundle savedInstanceState) public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.app_preferences); setPreferencesFromResource(R.xml.app_preferences, rootKey); } }