-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Regroup preferences #1635
Regroup preferences #1635
Conversation
Context context = ApplicationPreferencesActivity.this; | ||
|
||
SpannableString spanOn = new SpannableString(getString(R.string.ApplicationPreferencesActivity_on) + " "); | ||
SpannableString spanOff = new SpannableString(getString(R.string.ApplicationPreferencesActivity_off) + " "); |
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 had to put an extra space there, otherwise the last "f" from the Italic "Off" would have been cropped. Do you have a better solution?
@agrajaghh had a bit of work on this already, and continued a bit further. I added a workaround from SO for the home up navigation in a subscreen. Also to keep the discussion on how to regroup going, I did a bit more radical reorganization, let me know what you think about it. The summary generation code isn't in there, it's hardcoded in my branch so if you want to include it, that still needs to be done. |
In general, my opinion is that we should choose to either have PreferenceCategories (current) or PreferenceScreens (this) but not both, as it looks kind of strange hierarchically-speaking. As a mock, I also removed "automatic key exchange" as I think we can, at this point, just not have automated key exchange (or change the dialog for exchange to have "don't ask again"). We'll have to remove all the checks for that if people agree that's a fair thing to remove. |
Your regrouping looks good to me! But there is one issue with how I set the summary. The problem is that it's not refreshing immediately. You have to scroll away from the summary and scroll back in to display it. Which is not possible anymore in your branch for me, because there are not enough settings :) Regarding the key exchange: I think if we put a "don't ask again" checkbox in the dialog, we need an option in the preferences to ask again... |
I feel it's not a task that's repeated often enough to justify the need to have a preference automating it. Especially with data messages, it's no longer as common a task for secure messages. If we do want that preference to still exist, then yeah we might want an option that's a reset for "remember me" dialogs prompts. |
Will look into the summary refresh issues :) |
I would be fine with removing the key exchange option aswell, but perhaps we should start another issue for this discussion? |
Sounds fair to me 😄 Feel free to take whatever you want from my branch and integrate as you see fit |
Okay, I took the changes from your branch and put the key exchange option back. But I still didn't find a solution to the summary refresh problem :( You have an idea? |
The refresh problem is solved. I think I'm done. Any suggestions? |
return false; | ||
} | ||
|
||
/** Sets up the action bar for an {@link 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.
@mcginty: this is from http://stackoverflow.com/questions/16374820/action-bar-home-button-not-functional-with-nested-preferencescreen no?
Are we allowed to put it in here?
@agrajaghh SO is cc-by-sa - if I forgot to put a comment attribution in that draft branch, we should do that as a comment above the method but since we're open source it shouldn't be a problem to include it (but I'm not a lawyer), especially since this is a "snippet" or "quote" sized piece of code which'd qualify under fair use. |
I added a comment above the mothod, is it okay like that? edit: changed it, so it follows: http://blog.stackoverflow.com/2009/06/attribution-required/ |
That looks like fine attribution to me :). Will check out your change, thanks for taking this feature on! What an improvement it will be. |
Just threw it on a device and ran through it, a couple comments on the general preferences flow:
|
Also, in Access lock it might make more sense to have Disable passphrase actually turn into Enable passphrase, lest we have some weird inverted settings. |
I changed the "on" and "off" to lowercase for the SMS preference. Regarding the "Access lock", I 'm not sure whats best. Somebody else got an idea?
I think you are right, the inverted access lock setting doesn't really make sense. We should change that. But how do we migrate the old option? I think we have to change the settings key pref_disable_passphrase otherwise we don't know if we are reading the old or new value. But then we need to check for the old value everytime we check for the access lock. Should I put this check in TextSecurePreferences.isPasswordDisabled? |
I forgot the enter key preference: Should I leave it like it is, because you are changing the behaviour in #1656 anyway? |
Inverted the access lock preference now. But we still need the name... |
How about something like "offline encryption". If we are already butchering the technical terms, we can at least try to make it easily understandable. We could replace storage encryption with offline encryption and transport encryption with online encryption. |
What technical terms are being butchered? Nobody's arguing against using the word "encryption" for the passphrase, this is just a query as to what to call the general category of preferences that help secure your device as opposed to over-the-wire security. Screenshot security is also included in this category (although we can move it out if it turns it that doens't make as much sense). |
I was talking about my own suggestion, because it "dumbs down" the technical term ;-) If there are more non-encryption related subsettings (like the "screenshot blocker") I'd just call it offline security or device security. |
"Device security" sounds good to me! |
Yeah it's my new preference too. If we should ever feel the need to refer to the transport, we can use online or message security for that. |
Device security sounds like the best choice so far to me too |
Looks good to me! |
I just did a rebase. What do think @mcginty? |
Just a question: The "complete key exchange" option is only relevant in the SMS world, since there is no key exchange at all with the axolotl-over-data protocol, right? (Well, there is, but it's only Server-Client, not Client-Client). Shouldn't it go into the SMS submenu? |
|
||
public static CharSequence getSummary(Context context) { | ||
final int enabledResId = R.string.MmsPreferencesFragment__enabled; | ||
final int disabledResId = R.string.MmsPreferencesFragment__disabled; |
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.
nitpick, extra space before the =
super.onActivityResult(reqCode, resultCode, data); | ||
|
||
Log.w(TAG, "Got result: " + resultCode + " for req: " + reqCode); | ||
if (resultCode == Activity.RESULT_OK && reqCode == ApplicationPreferencesActivity.PICK_IDENTITY_CONTACT) { |
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.
ApplicationPreferencesActivity.PICK_IDENTITY_CONTACT
is now only used in PreferenceFragmentAdvanced
, so I think it makes more sense to move that here instead of make it public in a class that doesn't care about it.
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.
yep, you're totally right!
import org.thoughtcrime.securesms.contacts.ContactIdentityManager; | ||
import org.thoughtcrime.securesms.util.TextSecurePreferences; | ||
|
||
public class PreferenceFragmentAdvanced extends PreferenceFragment { |
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.
Would prefer AdvancedPreferenceFragment over PreferenceFragmentAdvanced, same for all the other subsections.
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.
done. Should I leave them in the preferences folder? Since they are not really a preference like PassphraseTimeoutPreference
or LedBlinkPatternListPreference
. But I guess it still makes sense..
if (value.equals(asList.getEntryValues()[index])) { | ||
break; | ||
} | ||
} |
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.
This is kind of gross. I'd either convert the findIndexOfValue
to a generic method in Util, or my personal leaning would be to just use Arrays.asList(Object[]) and then call indexOf
from that, since this isn't something that will be run constantly, so performance doesn't outweigh readability IMO.
Ha! I didn't notice you were updating the whole time I was giving comments. Incredible. |
Haha, yeah I just had time ;) |
private class DisablePushMessagesTask extends AsyncTask<Void, Void, Integer> { | ||
private ProgressDialog dialog; | ||
private final Preference preference; | ||
private class DisablePushMessagesTask extends AsyncTask<Void, Void, Integer> { |
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 can extend ProgressDialogAsyncTask
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.
done
I regrouped the preferences like discussed in the mailing list. I put notifications, old message deletion and passphrase into their own category pages. This is saving us ten items in the preference list. Its looking like this now:
But I dont know how to add the "back arrow" in the red square to the new PreferenceScreen's. Do you know how to put it there?
And I'm not sure about the new category for the PreferenceScreen's. I put them in "Miscellaneous" now, but perhaps you have a better idea?