-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split setting screen into options and advanced options issue #704 #714
Conversation
@@ -52,6 +52,11 @@ | |||
android:theme="@style/QuranToolBar" | |||
android:configChanges="keyboardHidden|orientation|screenSize"/> | |||
<activity | |||
android:name=".AdvancedQuranPreferenceActivity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, this should follow existing file naming convention. So, probably, should be named as QuranAdvancedPreferenceActivity
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
setContentView(R.layout.preferences); | ||
|
||
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
toolbar.setTitle(R.string.menu_settings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use "Advanced settings" title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thiught about using the exsting string as we will need a localization String for any new String will do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use R.string.prefs_category_advanced
for now
import rx.schedulers.Schedulers; | ||
import timber.log.Timber; | ||
|
||
public class QuranAdvancedSettingsFragment extends PreferenceFragment implements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are to use an additional fragment, is it possible to just have one original activity and let it utilize two fragments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep it as 2 and clean it up later since this is mostly a straight forward move of code - perhaps in another PR if it makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree for now, just to avoid more checks and conditions.
@@ -147,29 +147,16 @@ | |||
</PreferenceCategory> | |||
|
|||
<PreferenceCategory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to handle PreferenceCategory
clicks and launch advanced settings thereof, and get rid of additional Preference
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in an ideal world, the patch would have been as simple as Mohamed's original patch where he'd just add PreferenceScreen
around it - unfortunately though it doesn't work. maybe it would work with support-v7 fragments, but we can try that later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate more ? do we need to change something here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think @ozbek was saying, since PreferenceCategory extends Preference
, instead of having the PreferenceCategory
have a nested Preference
for advanced settings, can you just make PreferenceCategory
handle advanced settings without adding a child in xml?
i.e. instead of what you have now:
<PreferenceCategory android:key="">
<Preference android:key="">
<intent android:targetPackage="" />
</Preference>
</PreferenceCategory>
instead, would it work if you move everything on the Preference
up to the PreferenceCategory
instead and remove the preference? i.e.
<PreferenceCategory android:key="">
<intent android:targetPackage="" />
</PreferenceCategory>
update - after more thought, i don't think that this will work the way we want, because the PreferenceCategory
causes a group style ui to be drawn.
Also, while you are at it, please consider implementing all the changes mentioned in #704. |
} | ||
|
||
@Override | ||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
import timber.log.Timber; | ||
|
||
public class QuranAdvancedSettingsFragment extends PreferenceFragment implements | ||
SharedPreferences.OnSharedPreferenceChangeListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need the implements SharedPreferences.OnSharedPreferenceChangeListener
here.
import rx.schedulers.Schedulers; | ||
import timber.log.Timber; | ||
|
||
public class QuranAdvancedSettingsFragment extends PreferenceFragment implements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep it as 2 and clean it up later since this is mostly a straight forward move of code - perhaps in another PR if it makes sense?
@@ -147,29 +147,16 @@ | |||
</PreferenceCategory> | |||
|
|||
<PreferenceCategory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in an ideal world, the patch would have been as simple as Mohamed's original patch where he'd just add PreferenceScreen
around it - unfortunately though it doesn't work. maybe it would work with support-v7 fragments, but we can try that later?
@@ -52,6 +52,11 @@ | |||
android:theme="@style/QuranToolBar" | |||
android:configChanges="keyboardHidden|orientation|screenSize"/> | |||
<activity | |||
android:name=".AdvancedQuranPreferenceActivity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
re #704 agree, but split them into separate patches - let's get this one merged first and then if you're cool with continuing, would love more PRs about this insha'Allah? |
jazakAllah khairan - +1 from me, but will wait for @ozbek's +1 before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we can't have a single activity with two fragments?
</PreferenceCategory> | ||
</PreferenceScreen> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty line
<intent | ||
android:targetPackage="com.quran.labs.androidquran" | ||
android:targetClass="com.quran.labs.androidquran.QuranAdvancedPreferenceActivity" | ||
android:action="com.quran.labs.androidquran.PREFS_ONE" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right unneeded action will remove it. also about the one activity with two fragments won't it be a one level of navigation what do you think i prefer advanced options to be in a second level of navigation.
That's basically what I am asking about :) Is it possible to have your desired behaviour without adding |
Yes possible but not cleaner it will be with some hacks, like sending string value from setting fragment and restart setting activity with string value to replace setting fragment with advanced settings fragment ! , the current we have is more separated and better. |
OK, please cleanup the unused code. Thank you :) |
i'll go ahead and merge and then please send another PR removing whatever should be removed. jazakAllah khairan for doing this @mhussien86 ! |
Split setting screen into options and advanced options issue #704
This commit is solving the reorganizing of the setting screen into options and advanced options, change in the category name of Advanced settings maybe needed in the future.