Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
305 commits
Select commit Hold shift + click to select a range
fff72f6
More design improvements. Dividers as expected in the preference list.
tonyr59h Aug 18, 2015
3b18601
Using correct font for preference category headers.
tonyr59h Aug 18, 2015
ec2490f
Using custom Action Bar layout to use OpenSans
tonyr59h Aug 18, 2015
f48b6f8
Fixing size
tonyr59h Aug 18, 2015
879ca78
Finishing touches on styling.
tonyr59h Aug 18, 2015
053e659
Adding Writing and Account preferences to UI.
tonyr59h Aug 19, 2015
6ad00d6
Adjusting fonts
tonyr59h Aug 21, 2015
fe9346e
Fixing list preference cancel bug.
tonyr59h Aug 22, 2015
47c9bf0
Disabling Settings editing when connection is lost.
tonyr59h Aug 24, 2015
5a72a63
Updating MySiteFragment view when blog name is changed.
tonyr59h Aug 24, 2015
4dd5f54
Replacing HTML entities and updating blog with self-hosted title changes
tonyr59h Aug 24, 2015
cf8b955
Keyboard hidden when dialog dismissed, cursor placed at end of text.
tonyr59h Aug 24, 2015
9a27aec
Merge branch 'feature/site-settings-review' into feature/2886-general…
tonyr59h Aug 24, 2015
bfeb69a
Fixing incorrect dialog text and some HTML entity issues
tonyr59h Aug 25, 2015
24d9181
Fixing self-hosted title change bug and handling empty title change.
tonyr59h Aug 25, 2015
f0fee90
Merge pull request #2979 from wordpress-mobile/feature/2886-general-s…
nbradbury Aug 26, 2015
c36df63
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Aug 26, 2015
5658eaa
Handling account settings changes on self-hosted sites.
tonyr59h Aug 27, 2015
90aeab6
Using location preference to toggle post location capabilities.
tonyr59h Aug 27, 2015
4887bd1
Setting up category and format preferences with entries.
tonyr59h Aug 28, 2015
946188b
Adding settings table to database for caching. De-coupling some logic.
tonyr59h Aug 28, 2015
b28cb25
Janitorial work on SiteSettingsFragment.
tonyr59h Aug 29, 2015
41616b7
Fixing SQL syntax.
tonyr59h Aug 31, 2015
1252e4a
Storing settings locally and fixing up some save/load logic.
tonyr59h Sep 1, 2015
1bdac04
Merge branch 'develop' into feature/site-settings-review
tonyr59h Sep 3, 2015
74ebca0
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Sep 3, 2015
acac0f6
Removing non-existant resource usage.
tonyr59h Sep 3, 2015
3b8b8cf
Using WPSwitchFragment to set custom font on title text for Location
tonyr59h Sep 3, 2015
b03fa5c
Creating table for categories in the site settings database.
tonyr59h Sep 4, 2015
90dbfe4
Getting supported post formats.
tonyr59h Sep 10, 2015
e66cba0
Updating preference view with supported post formats.
tonyr59h Sep 10, 2015
b411b81
Merge branch 'develop' into feature/site-settings-review
tonyr59h Sep 10, 2015
a1f9337
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Sep 10, 2015
3976830
Adding hints to writing preferences.
tonyr59h Sep 15, 2015
e65a7a2
Setting summary for category and format preferences.
tonyr59h Sep 15, 2015
aa17c43
Fixing formatting on preference dialog when there is no detail text.
tonyr59h Sep 15, 2015
4c5ed73
Moving inline strings to resources.
tonyr59h Sep 15, 2015
cc8fde7
SiteSettings implementation now separates self-hosted from .com logic.
tonyr59h Sep 15, 2015
7e60784
Reworking CategoryModel object responsibilities.
tonyr59h Sep 15, 2015
cb7f0d6
Populating post formats and categories preferences, setting initial v…
tonyr59h Sep 16, 2015
a1c85a1
Merge branch 'develop' into feature/site-settings-review
tonyr59h Sep 16, 2015
0332b06
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Sep 16, 2015
da18345
Removing legacy SiteSettings class. Caching post formats. Fixing some…
tonyr59h Sep 18, 2015
c16f4a8
Merge branch 'develop' into feature/site-settings-review
tonyr59h Sep 22, 2015
14266d4
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Sep 22, 2015
ccfda9e
Using unique XMLRPCClientInterface objects for queries.
tonyr59h Sep 22, 2015
b528c05
Moving network related work out of the Site Settings data model.
tonyr59h Sep 22, 2015
12d8fe9
Removing SiteSettingsTable dependency from SiteSettingsModel.
tonyr59h Sep 22, 2015
43423d4
Fixing local-only storage of location preference.
tonyr59h Sep 22, 2015
d2e9aa1
Disabling Related Posts, implementing in another PR.
tonyr59h Sep 22, 2015
67cad18
Fixing category caching and format/category selection.
tonyr59h Sep 22, 2015
e92c8b4
Introducing local preferences for default post category and format
tonyr59h Sep 23, 2015
fd9999e
Storing default category and format locally due to self-hosted limita…
tonyr59h Sep 25, 2015
bcb3417
Using preferences to set default category and format when creating po…
tonyr59h Sep 25, 2015
ae09d92
Tracking whether or not credentials are valid.
tonyr59h Sep 28, 2015
a0aea04
Fixing order of strings. Should automate this.
tonyr59h Sep 29, 2015
a6fa0cb
Adding username/password parameters to validate credentials.
tonyr59h Sep 29, 2015
a0fa67f
Cached settings no longer loaded from background thread + refactoring.
tonyr59h Sep 29, 2015
ddd959a
Changing formatting for language display to include country name.
tonyr59h Sep 29, 2015
a1dbde9
Adding Related Posts dialog
tonyr59h Sep 30, 2015
107ffc2
Merge branch 'develop' into feature/site-settings-review
tonyr59h Sep 30, 2015
b3bd683
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Sep 30, 2015
d39fefb
Updating SiteSettingsModel to include related posts data
tonyr59h Sep 30, 2015
83ffc00
Using string resources
tonyr59h Sep 30, 2015
ac847f9
Updating layout to match spec
tonyr59h Oct 1, 2015
ab3aaea
Styling the related posts dialog
tonyr59h Oct 6, 2015
843bf6b
Merge branch 'develop' into feature/site-settings-review
tonyr59h Oct 6, 2015
b8e612e
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Oct 6, 2015
5749a4b
Adding data models and tables for site settings and categories.
tonyr59h Oct 6, 2015
4f3da15
Merge pull request #3307 from wordpress-mobile/feature/2887-data-models
kwonye Oct 6, 2015
bc147ab
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Oct 6, 2015
1319912
Encapsulating self-hosted and WP.com logic in their own classes.
tonyr59h Oct 6, 2015
d012b04
Using new settings interfaces, removing logic from settings fragment.
tonyr59h Oct 6, 2015
d5f8aa0
Creating Settings table in database.
tonyr59h Oct 7, 2015
a68e160
Updating local state on preference change
tonyr59h Oct 7, 2015
9edeab1
Merge pull request #3309 from wordpress-mobile/feature/2887-dotcom-se…
kwonye Oct 7, 2015
a2768a4
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Oct 7, 2015
b0cc18d
Refactoring to remove duplicated work.
tonyr59h Oct 7, 2015
86d6d34
Toggling Related Posts enables/disables appropriate views.
tonyr59h Oct 8, 2015
233df2a
Moving hint interface into it's own file to limit dependencies.
tonyr59h Oct 8, 2015
be621f1
Fixing divider background and adding WPPreference to style view
tonyr59h Oct 8, 2015
cadd605
Merge branch 'develop' into feature/site-settings-review
tonyr59h Oct 8, 2015
c699465
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Oct 8, 2015
fb1f762
Merge branch 'release/4.7' into feature/site-settings-review
tonyr59h Oct 23, 2015
f714c44
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Oct 23, 2015
5d84498
Related posts settings synced remotely
tonyr59h Oct 25, 2015
9697245
Related posts preview list shown/updated based on settings
tonyr59h Oct 25, 2015
42f7c81
Fixing related post preview scrolling behavior to match design
tonyr59h Oct 25, 2015
b4e8416
Spacing preview items, resourcifying, disabled state, category bug fix
tonyr59h Oct 26, 2015
5fdcc8b
Disabling Username/Password fields until changes are handled
tonyr59h Oct 26, 2015
0a6a257
Setting initial language for self hosted settings. Storing pref locally.
tonyr59h Oct 26, 2015
49994b9
Replacing magic numbers with descriptive constants.
tonyr59h Oct 26, 2015
cb05dae
Removing commented out code.
tonyr59h Oct 26, 2015
a41af2d
Auto-select the first item in if none selected
tonyr59h Oct 26, 2015
5a556b8
Adding buttons to dialog, styling, implementing cancel functionality.
tonyr59h Oct 27, 2015
302e1b0
Committing changes to work on different machine
tonyr59h Oct 28, 2015
c3f4ce0
Setting default post format to standard
tonyr59h Oct 30, 2015
e9df77e
Merge branch 'develop' into feature/site-settings-review
tonyr59h Oct 30, 2015
67c3b59
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Oct 30, 2015
10a11bd
Merge branch 'develop' into feature/site-settings-review
tonyr59h Nov 2, 2015
ca441ee
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Nov 2, 2015
25b9eae
Removing unusable settings from self-hosted.
tonyr59h Nov 2, 2015
be96667
Fixing new post geotagging and default format value.
tonyr59h Nov 2, 2015
f90d105
Merge branch 'develop' into feature/site-settings-review
tonyr59h Nov 2, 2015
53bed7d
Merge branch 'feature/site-settings-review' into feature/2887-writing…
tonyr59h Nov 2, 2015
f02ff4a
Fixing cached settings for self-hosted sites
tonyr59h Nov 3, 2015
caa1214
Related posts not updated when user cancels
tonyr59h Nov 3, 2015
ce1767d
Verifying state of fragment before modifying views
tonyr59h Nov 3, 2015
ca7ecf5
Defer location permission check until after view references are set
tonyr59h Nov 3, 2015
364ecfd
Merge pull request #3243 from wordpress-mobile/feature/2887-writing-s…
kwonye Nov 3, 2015
45840e4
Merge branch 'feature/site-settings-review' into feature/2888-discuss…
tonyr59h Nov 5, 2015
40ac404
Hooking up manual approval preference
tonyr59h Nov 5, 2015
14fcf36
Hooking the remaining switch preferences
tonyr59h Nov 5, 2015
09212a3
Replacing inline strings with resources
tonyr59h Nov 5, 2015
698c00f
Adding hints
tonyr59h Nov 5, 2015
36eff27
Setting entries + values for discussion preferences
tonyr59h Nov 5, 2015
52c9d22
Adding placeholder Learn More preference
tonyr59h Nov 5, 2015
b2001a4
Adding toolbar with enter/exit animations to nested preference screens
tonyr59h Nov 6, 2015
9a15a4f
Updating discussion preferences to new design
tonyr59h Nov 6, 2015
6592039
Fixing strings
tonyr59h Nov 6, 2015
560e1c1
Filling out summary for settings that use DetailListPreference
tonyr59h Nov 6, 2015
cebe2fd
Saving DetailListPreference settings remotely if changed
tonyr59h Nov 6, 2015
f545313
Learn More button now opens support document in a dialog
tonyr59h Nov 7, 2015
21a9023
Toggling dangerous preference visibility based on .com flag
tonyr59h Nov 7, 2015
dfb0aa7
Adding loading indicator for Learn More button
tonyr59h Nov 7, 2015
7368332
Showing some discussion settings, adding More button for the rest
tonyr59h Nov 9, 2015
810ac2f
Updating preferences shared between both preference screens
tonyr59h Nov 9, 2015
a29c0fc
Setting preference default values and cleaning up summaries
tonyr59h Nov 10, 2015
10d4234
Saving moderation and blacklist key changes remotely
tonyr59h Nov 10, 2015
7743211
Shortening variable names for preferences
tonyr59h Nov 10, 2015
b09e329
Fixing summary string issue
tonyr59h Nov 10, 2015
a49d7e4
Adding picker dialog to edit max links allowed in comments
tonyr59h Nov 10, 2015
8803f6d
Merge branch 'develop' into feature/site-settings-review
tonyr59h Nov 10, 2015
03ebaa8
Merge branch 'feature/site-settings-review' into feature/2888-discuss…
tonyr59h Nov 10, 2015
70b4522
Fixing auto-approval settings
tonyr59h Nov 11, 2015
f448f99
Fixing title and hints for discussion preference screen
tonyr59h Nov 11, 2015
6acbe7a
Updating font style on WPPreference summary text
tonyr59h Nov 11, 2015
744b85b
Formatting text in list editor dialog
tonyr59h Nov 11, 2015
ce1e746
Adding padding to list editor entry dialog
tonyr59h Nov 11, 2015
1a65ffe
Not adding empty string to moderation and blacklist keys
tonyr59h Nov 11, 2015
9f6e557
Adding empty view for list editor screen
tonyr59h Nov 11, 2015
219d67d
Setting initial summary for multiple links preference
tonyr59h Nov 11, 2015
7b47db4
Deserializing .org settings response using patched endpoint.
tonyr59h Nov 12, 2015
726293f
Adding editable preferences back to self-hosted sites
tonyr59h Nov 12, 2015
1c4ea65
Saving changed settings on self-hosted sites remotely
tonyr59h Nov 12, 2015
c83844c
Fixing lint errors
tonyr59h Nov 12, 2015
8ebfb26
Formatting number picker dialog
tonyr59h Nov 12, 2015
ee12982
Fixing (de)serialization of self-hosted options
tonyr59h Nov 13, 2015
2f1c85a
Implementing delete site button
tonyr59h Nov 13, 2015
38b91d9
Removing Start Over and Remove Site options
tonyr59h Nov 13, 2015
d0022d6
Adding Action Mode to list editor dialog for removing items
tonyr59h Nov 14, 2015
408404e
Selecting originally long pressed item when entering Action Mode
tonyr59h Nov 14, 2015
ba7dc60
Adjusting Learn More spacing, fixing warnings, array index checking
tonyr59h Nov 16, 2015
6327159
Handling cases where selected value is not in the value set
tonyr59h Nov 17, 2015
ed99b4e
Initializing language value. Moving to selected value in number picker
tonyr59h Nov 17, 2015
a59cde7
Removing redundant method in favor of existing utility method
tonyr59h Nov 17, 2015
937582e
Encapsulating multi-select functionality
tonyr59h Nov 17, 2015
581bdbd
Using MultiSelectListView in list editor layout
tonyr59h Nov 17, 2015
5f4978a
Ending Action Mode if the last item is deselected
tonyr59h Nov 17, 2015
870df76
Styling list editor action mode
tonyr59h Nov 17, 2015
fa27144
Merge branch 'develop' into feature/site-settings-review
tonyr59h Nov 20, 2015
ec77ac9
Merge branch 'feature/site-settings-review' into feature/2888-discuss…
tonyr59h Nov 20, 2015
a65770f
Verifying fragment activity is running before getting summary resources
tonyr59h Nov 20, 2015
0ecbed7
Only fetching remote settings on first load
tonyr59h Nov 20, 2015
44e827f
Returning true when handling remove blog button
tonyr59h Nov 20, 2015
e92f491
Avoid potential NullPointerException when saving Site Settings
tonyr59h Nov 20, 2015
bae5cb6
Fixing self-hosted send pingbacks setting (de)serialization
tonyr59h Nov 20, 2015
1055583
Not saving if there is no network.
tonyr59h Nov 24, 2015
91e3352
Merge pull request #3387 from wordpress-mobile/feature/2888-discussio…
kwonye Nov 24, 2015
5728644
Styling More preference
tonyr59h Nov 24, 2015
fa05c8d
Removing divider between list and buttons in DetailListPreference dialog
tonyr59h Nov 25, 2015
6b4bc30
Fixing lint error
tonyr59h Nov 25, 2015
faa074d
Fixing edit text preference styling
tonyr59h Nov 30, 2015
eb06bc6
Removing dividers in number picker
tonyr59h Nov 30, 2015
5a54497
Adjusting fonts on Related Posts dialog
tonyr59h Dec 1, 2015
a9b9df7
Adding dividers to related posts dialog
tonyr59h Dec 1, 2015
64c4b32
Padding empty view
tonyr59h Dec 1, 2015
912d836
Creating utility class to handle common functions
tonyr59h Dec 1, 2015
ce97891
Adjusting layout of related posts dialog to match design
tonyr59h Dec 2, 2015
30a58e1
Matching design with list editor input dialog
tonyr59h Dec 2, 2015
92f38bb
Toggling background color for checked items in action mode
tonyr59h Dec 3, 2015
2cb682e
Paging and close after settings no longer show pre-defined values
tonyr59h Dec 4, 2015
8c5e13b
Using reflection to style number picker view
tonyr59h Dec 5, 2015
171c55a
Improving number alignment for center number
tonyr59h Dec 5, 2015
bfc16e2
Drawing 5 items in the number picker scroller, no fading edges
tonyr59h Dec 7, 2015
713ae1f
Changing to number pickers for close after and paging settings
tonyr59h Dec 7, 2015
3e66383
Merge branch 'develop' into feature/site-settings-review
tonyr59h Dec 7, 2015
708f463
Merge branch 'feature/site-settings-review' into feature/3441-site-se…
tonyr59h Dec 7, 2015
bcac6d8
Adding dividers and fixing wrapped number picker element values
tonyr59h Dec 7, 2015
0cb0b19
Design cleanup, mostly ActionMode changes, some font tweaks, shadowing
tonyr59h Dec 8, 2015
54830dd
Adding analytics
tonyr59h Dec 8, 2015
367389f
Showing keyboard on input dialogs, fixing delete bug, editing design
tonyr59h Dec 9, 2015
93b7e77
Fixing subscreen header fonts
tonyr59h Dec 9, 2015
9383f4f
Updating analytics based on feedback from PR
tonyr59h Dec 9, 2015
857d8ee
Cleaning up the code, re-using dialog creation work
tonyr59h Dec 9, 2015
9d3c246
Changing number picker dialog font colors when toggling switch
tonyr59h Dec 10, 2015
3544f15
Formatting number picker display strings
tonyr59h Dec 10, 2015
bcee50e
Version checking self-hosted responses to determine if settings are s…
tonyr59h Dec 10, 2015
4b9a7e0
Fixing crash from 0 length substring
tonyr59h Dec 10, 2015
678ce08
Verifying fragment is active before updating views
tonyr59h Dec 10, 2015
86518ab
Adding values of updated settings to analytics
tonyr59h Dec 10, 2015
1fe87b5
Fixing crash when deleting multiple items from list editor
tonyr59h Dec 10, 2015
c25ac5d
Showing keyboard for input in list editor when FAB is clicked
tonyr59h Dec 11, 2015
8a73b8e
Adding more levels to Threading picker, fixing fonts and a crash
tonyr59h Dec 11, 2015
f9ff589
Adjusting font for Discussion toolbar
tonyr59h Dec 11, 2015
84b9e5f
Checking for valid length string before serializing
tonyr59h Dec 11, 2015
a5e369f
Savings settings as soon as they change per discussion with Matt
tonyr59h Dec 11, 2015
b6cf058
Lots of code cleanup
tonyr59h Dec 12, 2015
d3682b4
Creating constants/resources for strings
tonyr59h Dec 14, 2015
ecaf8f9
Fixing switch implementation for paging and close after settings
tonyr59h Dec 14, 2015
b0f563d
Merge branch 'develop' into feature/site-settings-review
tonyr59h Dec 14, 2015
319437a
Merge branch 'feature/site-settings-review' into feature/3441-site-se…
tonyr59h Dec 14, 2015
334f335
Renaming language selection stat
tonyr59h Dec 14, 2015
f9a0eec
Saving related post changes remotely
tonyr59h Dec 14, 2015
8de264e
Hiding Settings option if user does not have permission to edit them
tonyr59h Dec 14, 2015
475a5d5
Fixing self-hosted settings deserialization and password display
tonyr59h Dec 15, 2015
6641545
Fixing issues with saving close after and paging settings
tonyr59h Dec 15, 2015
866afb5
Saving Blacklist and Hold for Moderation lists when dismissing dialog
tonyr59h Dec 15, 2015
91ff1dd
Fixing some broken discussion settings serialization
tonyr59h Dec 15, 2015
0b5b59a
Ensuring non-null formats list when calling getFormats()
tonyr59h Dec 16, 2015
6b25f98
Strings cleanup
tonyr59h Dec 16, 2015
9e8496b
Using correct key when serializing hold for moderation list changes
tonyr59h Dec 16, 2015
9eef65d
Saving hold for moderation and blacklist changes immediately
tonyr59h Dec 16, 2015
96df18b
Setting list divider programmatically
tonyr59h Dec 16, 2015
5592667
Removing preferences when user does not have admin privileges
tonyr59h Dec 16, 2015
29f2a1d
Delaying fetching settings to allow new screen to load immediately
tonyr59h Dec 17, 2015
46eb536
Not showing DetailListPreferences if there is no list
tonyr59h Dec 17, 2015
1ba9a8b
Fixing fetching boolean logic
tonyr59h Dec 17, 2015
2d792a2
Including certain preference toggle values in the database + code clean
tonyr59h Jan 5, 2016
49661eb
Capitalizing first letter of language summary string
tonyr59h Jan 5, 2016
e43b88c
Default Format value set to standard if value is not in format map
tonyr59h Jan 5, 2016
fbc4165
Moving Uncategorized to the beginning of the category list
tonyr59h Jan 5, 2016
c01ba16
Fixing implementation of Threading, Paging, and Close after preferences
tonyr59h Jan 5, 2016
d398c6e
Fixing wrapped number picker values
tonyr59h Jan 5, 2016
9e462ec
Self-hosted sites will use the old settings for now
tonyr59h Jan 5, 2016
7fbe1dd
Adjusting positions of number picker elements
tonyr59h Jan 6, 2016
44293ae
Merge pull request #3562 from wordpress-mobile/feature/3441-only-dotcom
kwonye Jan 6, 2016
866fe32
Merge pull request #3473 from wordpress-mobile/feature/3441-site-sett…
kwonye Jan 6, 2016
f7062f3
Merge develop into site-settings-review
tonyr59h Jan 6, 2016
fd632d2
Adding back image width setting under new This Device category
tonyr59h Jan 6, 2016
1b8478d
Adding upload and link preference to This Device settings
tonyr59h Jan 6, 2016
6dd8552
Correcting title string
tonyr59h Jan 6, 2016
fe8bdb2
Order matters when setting up dividers, setting height after drawable
tonyr59h Jan 7, 2016
166b0a3
Merge branch 'develop' into feature/site-settings-review
tonyr59h Jan 7, 2016
703c9cc
Merge branch 'feature/site-settings-review' into issue/2977-add-media…
tonyr59h Jan 7, 2016
0cdd4ef
Using WPCheckBox in related post dialog
tonyr59h Jan 7, 2016
dc5caf8
Removing unnecessary enabled state toggling
tonyr59h Jan 7, 2016
4670e2e
Using existing string and updating some CheckBox views
tonyr59h Jan 7, 2016
3aefb83
Fixing mis-translated boolean logic
tonyr59h Jan 7, 2016
3e33a48
Merge pull request #3566 from wordpress-mobile/issue/2977-add-media-s…
kwonye Jan 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
<activity
android:name=".ui.prefs.BlogPreferencesActivity"
android:theme="@style/CalypsoTheme"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateHidden"/>
<activity
android:name=".ui.prefs.LicensesActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.json.JSONArray;
import org.wordpress.android.datasets.AccountTable;
import org.wordpress.android.datasets.CommentTable;
import org.wordpress.android.datasets.SiteSettingsTable;
import org.wordpress.android.datasets.SuggestionTable;
import org.wordpress.android.models.Account;
import org.wordpress.android.models.Blog;
Expand Down Expand Up @@ -238,6 +239,7 @@ public WordPressDB(Context ctx) {
db.execSQL(CREATE_TABLE_QUICKPRESS_SHORTCUTS);
db.execSQL(CREATE_TABLE_MEDIA);
db.execSQL(CREATE_TABLE_THEMES);
SiteSettingsTable.createTable(db);
CommentTable.createTables(db);
SuggestionTable.createTables(db);

Expand Down Expand Up @@ -1294,7 +1296,7 @@ public boolean insertCategory(int id, int wp_id, int parent_id, String category_

public List<String> loadCategories(int id) {
Cursor c = db.query(CATEGORIES_TABLE, new String[] { "id", "wp_id",
"category_name" }, "blog_id=" + id, null, null, null, null);
"category_name" }, "blog_id=" + Integer.toString(id), null, null, null, null);
int numRows = c.getCount();
c.moveToFirst();
List<String> returnVector = new Vector<String>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package org.wordpress.android.datasets;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import org.wordpress.android.WordPress;
import org.wordpress.android.models.CategoryModel;
import org.wordpress.android.models.SiteSettingsModel;

import java.util.HashMap;
import java.util.Map;

public final class SiteSettingsTable {
public static final String CATEGORIES_TABLE_NAME = "site_categories";

private static final String CREATE_CATEGORIES_TABLE_SQL =
"CREATE TABLE IF NOT EXISTS " +
CATEGORIES_TABLE_NAME +
" (" +
CategoryModel.ID_COLUMN_NAME + " INTEGER PRIMARY KEY, " +
CategoryModel.NAME_COLUMN_NAME + " TEXT, " +
CategoryModel.SLUG_COLUMN_NAME + " TEXT, " +
CategoryModel.DESC_COLUMN_NAME + " TEXT, " +
CategoryModel.PARENT_ID_COLUMN_NAME + " INTEGER, " +
CategoryModel.POST_COUNT_COLUMN_NAME + " INTEGER" +
");";

public static void createTable(SQLiteDatabase db) {
if (db != null) {
db.execSQL(SiteSettingsModel.CREATE_SETTINGS_TABLE_SQL);
db.execSQL(CREATE_CATEGORIES_TABLE_SQL);
}
}

public static Map<Integer, CategoryModel> getAllCategories() {
String sqlCommand = sqlSelectAllCategories() + ";";
Cursor cursor = WordPress.wpDB.getDatabase().rawQuery(sqlCommand, null);

if (cursor == null || !cursor.moveToFirst() || cursor.getCount() == 0) return null;

Map<Integer, CategoryModel> models = new HashMap<>();
for (int i = 0; i < cursor.getCount(); ++i) {
CategoryModel model = new CategoryModel();
model.deserializeFromDatabase(cursor);
models.put(model.id, model);
cursor.moveToNext();
}

return models;
}

public static Cursor getCategory(long id) {
if (id < 0) return null;

String sqlCommand = sqlSelectAllCategories() + sqlWhere(CategoryModel.ID_COLUMN_NAME, Long.toString(id)) + ";";
return WordPress.wpDB.getDatabase().rawQuery(sqlCommand, null);
}

public static Cursor getSettings(long id) {
if (id < 0) return null;

String sqlCommand = sqlSelectAllSettings() + sqlWhere(SiteSettingsModel.ID_COLUMN_NAME, Long.toString(id)) + ";";
return WordPress.wpDB.getDatabase().rawQuery(sqlCommand, null);
}

public static void saveCategory(CategoryModel category) {
if (category == null) return;

ContentValues values = category.serializeToDatabase();
category.isInLocalTable = WordPress.wpDB.getDatabase().insertWithOnConflict(
CATEGORIES_TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE) != -1;
}

public static void saveCategories(CategoryModel[] categories) {
if (categories == null) return;

for (CategoryModel category : categories) {
saveCategory(category);
}
}

public static void saveSettings(SiteSettingsModel settings) {
if (settings == null) return;

ContentValues values = settings.serializeToDatabase();
settings.isInLocalTable = WordPress.wpDB.getDatabase().insertWithOnConflict(
SiteSettingsModel.SETTINGS_TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE) != -1;

saveCategories(settings.categories);
}

private static String sqlSelectAllCategories() {
return "SELECT * FROM " + CATEGORIES_TABLE_NAME + " ";
}

private static String sqlSelectAllSettings() {
return "SELECT * FROM " + SiteSettingsModel.SETTINGS_TABLE_NAME + " ";
}

private static String sqlWhere(String variable, String value) {
return "WHERE " + variable + "=\"" + value + "\" ";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package org.wordpress.android.models;

import android.content.ContentValues;
import android.database.Cursor;

/**
* Represents WordPress post Category data and handles local database (de)serialization.
*/
public class CategoryModel {
// Categories table column names
public static final String ID_COLUMN_NAME = "ID";
public static final String NAME_COLUMN_NAME = "name";
public static final String SLUG_COLUMN_NAME = "slug";
public static final String DESC_COLUMN_NAME = "description";
public static final String PARENT_ID_COLUMN_NAME = "parent";
public static final String POST_COUNT_COLUMN_NAME = "post_count";

public int id;
public String name;
public String slug;
public String description;
public int parentId;
public int postCount;
public boolean isInLocalTable;

public CategoryModel() {
id = -1;
name = "";
slug = "";
description = "";
parentId = -1;
postCount = 0;
isInLocalTable = false;
}

/**
* Sets data from a local database {@link Cursor}.
*/
public void deserializeFromDatabase(Cursor cursor) {
if (cursor == null) return;

id = cursor.getInt(cursor.getColumnIndex(ID_COLUMN_NAME));
name = cursor.getString(cursor.getColumnIndex(NAME_COLUMN_NAME));
slug = cursor.getString(cursor.getColumnIndex(SLUG_COLUMN_NAME));
description = cursor.getString(cursor.getColumnIndex(DESC_COLUMN_NAME));
parentId = cursor.getInt(cursor.getColumnIndex(PARENT_ID_COLUMN_NAME));
postCount = cursor.getInt(cursor.getColumnIndex(POST_COUNT_COLUMN_NAME));
isInLocalTable = true;
}

/**
* Creates the {@link ContentValues} object to store this category data in a local database.
*/
public ContentValues serializeToDatabase() {
ContentValues values = new ContentValues();
values.put(ID_COLUMN_NAME, id);
values.put(NAME_COLUMN_NAME, name);
values.put(SLUG_COLUMN_NAME, slug);
values.put(DESC_COLUMN_NAME, description);
values.put(PARENT_ID_COLUMN_NAME, parentId);
values.put(POST_COUNT_COLUMN_NAME, postCount);

return values;
}
}
Loading