Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2341d26
Use our logger in IabHelper
daniloercoli Apr 10, 2016
9cda45d
Start integrating the store calls
daniloercoli Apr 10, 2016
db846cf
Re-synch purchases with wpcom server on startup and periodically. (Th…
daniloercoli Apr 11, 2016
eecf66f
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli Apr 11, 2016
443d963
Remove unused imports.
daniloercoli Apr 11, 2016
8f553c9
Remove custom hardcoded SKUs since REST Endpoint has been updated.
daniloercoli Apr 12, 2016
2b9d5a6
Fix log message
daniloercoli Apr 12, 2016
63ef93b
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli Apr 12, 2016
6be91fa
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli Apr 14, 2016
3835ec3
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli Apr 28, 2016
691e6a8
Use the new endpoint name, and remove unused parameters.
daniloercoli Apr 29, 2016
d18fb25
add a "wp." prefix to crashlytics.apikey so that value will be tested…
maxme May 2, 2016
c5253ca
update release check sha1sum with optimizely and crashlytics keys
maxme May 2, 2016
cc3c871
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli May 2, 2016
569e2b0
Change the label to "upgrade" when the selected blog already has a pl…
daniloercoli May 3, 2016
9cfa151
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli May 3, 2016
20c7335
Remove links to unused subprojects used during development
daniloercoli May 3, 2016
27765fb
Revert unwanted commits
daniloercoli May 3, 2016
ef9b80d
Fix merge conflicts
daniloercoli May 3, 2016
97baa8c
Fix merge conflicts - tentative #2
daniloercoli May 3, 2016
7c28243
New plans strings
daniloercoli May 3, 2016
90e71a4
Do not show the Upgrade|Purchase button when the blog already has a p…
daniloercoli May 4, 2016
2c25280
First pass at adding toolbar above reader post list
nbradbury May 5, 2016
56f0bee
Replaced filtered recycler's ability to add components with a simpler…
nbradbury May 5, 2016
f9e5ca3
Check isAdded() in toolbar listener
nbradbury May 5, 2016
0a015bc
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
nbradbury May 5, 2016
518db33
First pass at adding SearchView
nbradbury May 5, 2016
ca0890d
Fixed centering of menu items in toolbar
nbradbury May 6, 2016
5666942
Toggle settings icon with search
nbradbury May 6, 2016
b295c04
Removed toolbar listener from addToolbarMenu
nbradbury May 6, 2016
f340723
Simplified search view config
nbradbury May 6, 2016
e6ce503
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli May 6, 2016
ec694f2
Added bare-bones SearchViewStyle
nbradbury May 6, 2016
5b1463e
Implemented shell for search results, including empty message
nbradbury May 6, 2016
d1594ca
Clear the post list when search is expanded, reload the list when sea…
nbradbury May 6, 2016
5bdb33d
Renamed FilteredRecyclerViewFilterContainer style to FilteredRecycler…
nbradbury May 6, 2016
17ee94e
Added tbl_search_history
nbradbury May 6, 2016
67b9a4d
Added suggestion adapter
nbradbury May 6, 2016
95cc569
Moved suggestion adapter to it's own class file
nbradbury May 6, 2016
9fc30b7
Added suggestion filtering
nbradbury May 6, 2016
63097ce
Collapse search input upon submit
nbradbury May 6, 2016
877b460
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
daniloercoli May 9, 2016
bdba660
Make sure `mIabHelper` has finished its setup before doing any calls …
daniloercoli May 9, 2016
948c6be
Use constants defined in PlanConstants.java when checking for `planID`
daniloercoli May 9, 2016
795c213
Remove unused constants.
daniloercoli May 9, 2016
4e92211
Improved error message displayed when failing to load visual editor HTML
aforcier May 10, 2016
129aebf
Updated README with build instructions for Windows, for setting up th…
aforcier May 10, 2016
51fbe2b
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
nbradbury May 10, 2016
c7fc937
First pass at empty view for search
nbradbury May 10, 2016
891a029
Move empty search title to resources
nbradbury May 10, 2016
f48f9f7
Synch IAPs with the backend when there is a pending request only. Do …
daniloercoli May 11, 2016
dac1bab
Merge pull request #4083 from wordpress-mobile/issue/4081-visual-edit…
kwonye May 11, 2016
f5a59fd
Merge pull request #4045 from wordpress-mobile/issue/4044-release-che…
kwonye May 11, 2016
62317a9
Don't show updated posts during search
nbradbury May 12, 2016
858cfa8
Change the visibilty of `mContext` to private in UpdateIAPTask
daniloercoli May 12, 2016
d0d361e
Drop unused variable
daniloercoli May 12, 2016
09fbec3
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
nbradbury May 12, 2016
70d4012
Added a comment that describe how the sync with wpcom works
daniloercoli May 12, 2016
84932ae
Revert changes made to IabHelper
daniloercoli May 12, 2016
6279f18
Tapping back button when search is expanded now closes it
nbradbury May 12, 2016
d5b0364
Don't show empty message for search when in landscape
nbradbury May 12, 2016
1284722
Use a separate view for the search explainer
nbradbury May 12, 2016
e3e95df
Recycler is now hidden rather than cleared when searching
nbradbury May 12, 2016
f963389
Merge pull request #4078 from wordpress-mobile/feature/plans-integrat…
nbradbury May 12, 2016
8b96bec
Merge branch 'develop' of https://github.com/wordpress-mobile/WordPre…
nbradbury May 12, 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
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ test the project:

You can use [Android Studio][3] by importing the project as a Gradle project.

### Additional Build Instructions for Windows ###

The [visual editor][10] uses a linux-style symlink for its [assets folder][11],
which has to be converted to a Windows symlink.

From git bash, inside the project root:

$ rm libs/editor/WordPressEditor/src/main/assets
$ git ls-files --deleted -z | git update-index --assume-unchanged -z --stdin

Then, from a Windows command prompt:

mklink /D [PROJECT_ROOT]\libs\editor\WordPressEditor\src\main\assets %PROJECT_ROOT%\libs\editor\libs\editor-common\assets

Finally, update `[PROJECT_ROOT]\.git\info\exclude` to ignore the symlink locally:

# editor assets symlink
libs/editor/WordPressEditor/src/main/assets

## Directory structure ##

|-- libs # dependencies used to build debug variants
Expand Down Expand Up @@ -122,3 +141,5 @@ be covered by a different license compatible with the GPLv2.
[7]: https://developer.wordpress.com/docs/api/
[8]: https://facebook.github.io/buck
[9]: https://facebook.github.io/watchman/docs/install.html
[10]: https://github.com/wordpress-mobile/WordPress-Editor-Android
[11]: https://github.com/wordpress-mobile/WordPress-Android/blob/develop/libs/editor/WordPressEditor/src/main/assets
2 changes: 1 addition & 1 deletion WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ task generateCrashlyticsConfig(group: "generate", description: "Generate Crashly
inputFile.withInputStream { stream ->
properties.load(stream)
}
def crashlyticsApiKey = properties.getProperty('crashlytics.apikey', '0')
def crashlyticsApiKey = properties.getProperty('wp.crashlytics.apikey', '0')
def writer = new FileWriter(outputFile)
writer.write("""// auto-generated file from ${rootDir}/gradle.properties do not modify
apiKey=${crashlyticsApiKey}""")
Expand Down
3 changes: 2 additions & 1 deletion WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@
<activity
android:name=".ui.reader.ReaderPostListActivity"
android:label="@string/reader"
android:theme="@style/Calypso.NoActionBar" />
android:theme="@style/Calypso.NoActionBar">
</activity>
<activity
android:name=".ui.reader.ReaderPostPagerActivity"
android:label="@string/reader_title_post_detail"
Expand Down
2 changes: 2 additions & 0 deletions WordPress/src/main/java/org/wordpress/android/WordPress.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.wordpress.android.ui.accounts.helpers.UpdateBlogListTask.GenericUpdateBlogListTask;
import org.wordpress.android.ui.notifications.utils.NotificationsUtils;
import org.wordpress.android.ui.notifications.utils.SimperiumUtils;
import org.wordpress.android.ui.plans.PlansUtils;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.stats.StatsWidgetProvider;
import org.wordpress.android.ui.stats.datasets.StatsDatabaseHelper;
Expand Down Expand Up @@ -822,6 +823,7 @@ public void onAppComesFromBackground() {
sUpdateCurrentBlogOption.runIfNotLimited();
}
sDeleteExpiredStats.runIfNotLimited();
PlansUtils.synchIAPsWordPressCom();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
public class ReaderDatabase extends SQLiteOpenHelper {
protected static final String DB_NAME = "wpreader.db";
private static final int DB_VERSION = 114;
private static final int DB_VERSION = 115;

/*
* version history
Expand Down Expand Up @@ -66,6 +66,7 @@ public class ReaderDatabase extends SQLiteOpenHelper {
* 112 - no structural change, just reset db
* 113 - added tag_title to tag tables
* 114 - renamed tag_name to tag_slug in tag tables
* 115 - added ReaderSearchTable
*/

/*
Expand Down Expand Up @@ -141,6 +142,7 @@ private void createAllTables(SQLiteDatabase db) {
ReaderUserTable.createTables(db);
ReaderThumbnailTable.createTables(db);
ReaderBlogTable.createTables(db);
ReaderSearchTable.createTables(db);
}

private void dropAllTables(SQLiteDatabase db) {
Expand All @@ -151,6 +153,7 @@ private void dropAllTables(SQLiteDatabase db) {
ReaderUserTable.dropTables(db);
ReaderThumbnailTable.dropTables(db);
ReaderBlogTable.dropTables(db);
ReaderSearchTable.dropTables(db);
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package org.wordpress.android.datasets;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.support.annotation.NonNull;
import android.text.TextUtils;

import org.wordpress.android.util.DateTimeUtils;
import org.wordpress.android.util.SqlUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
* user's reader search history
*/
public class ReaderSearchTable {

protected static void createTables(SQLiteDatabase db) {
db.execSQL("CREATE TABLE tbl_search_history ("
+ " query_string TEXT NOT NULL COLLATE NOCASE PRIMARY KEY,"
+ " date_used TEXT,"
+ " counter INTEGER DEFAULT 1)");
}

protected static void dropTables(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS tbl_search_history");
}

/*
* adds the passed query string, updating the usage counter and date
*/
public static void addOrUpdateQueryString(@NonNull String query) {
String date = DateTimeUtils.javaDateToIso8601(new Date());
int counter = getCounterForQueryString(query) + 1;

SQLiteStatement stmt = ReaderDatabase.getWritableDb().compileStatement(
"INSERT OR REPLACE INTO tbl_search_history (query_string, date_used, counter) VALUES (?1,?2,?3)");
try {
stmt.bindString(1, query);
stmt.bindString(2, date);
stmt.bindLong (3, counter);
stmt.execute();
} finally {
SqlUtils.closeStatement(stmt);
}
}

private static int getCounterForQueryString(@NonNull String query) {
String[] args = {query};
return SqlUtils.intForQuery(ReaderDatabase.getReadableDb(),
"SELECT counter FROM tbl_search_history WHERE query_string=?", args);
}

public static List<String> getQueryStrings() {
return getQueryStrings(null);
}
public static List<String> getQueryStrings(String filter) {
List<String> queries = new ArrayList<>();
Cursor cursor;
if (TextUtils.isEmpty(filter)) {
cursor = ReaderDatabase.getReadableDb().rawQuery(
"SELECT query_string FROM tbl_search_history ORDER BY date_used DESC", null);
} else {
String likeFilter = filter + "%";
cursor = ReaderDatabase.getReadableDb().rawQuery(
"SELECT query_string FROM tbl_search_history WHERE query_string LIKE ? ORDER BY date_used DESC", new String[]{likeFilter});
}

try {
while (cursor.moveToNext()) {
queries.add(cursor.getString(0));
}
return queries;
} finally {
SqlUtils.closeCursor(cursor);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected static void createTables(SQLiteDatabase db) {
+ " tag_title TEXT COLLATE NOCASE,"
+ " tag_type INTEGER DEFAULT 0,"
+ " endpoint TEXT,"
+ " date_updated TEXT,"
+ " date_updated TEXT,"
+ " PRIMARY KEY (tag_slug, tag_type)"
+ ")");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package org.wordpress.android.ui;

import android.content.Context;
import android.support.annotation.MenuRes;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Spinner;
Expand Down Expand Up @@ -41,7 +42,6 @@ public class FilteredRecyclerView extends RelativeLayout {
private RecyclerView mRecyclerView;
private TextView mEmptyView;
private View mCustomEmptyView;
private LinearLayout mCustomComponentsContainer;
private Toolbar mToolbar;
private AppBarLayout mAppBarLayout;

Expand Down Expand Up @@ -124,7 +124,6 @@ private void init() {
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mRecyclerView.addItemDecoration(new RecyclerItemDecoration(spacingHorizontal, spacingVertical));

mCustomComponentsContainer = (LinearLayout) findViewById(R.id.custom_components_toolbar_container);
mToolbar = (Toolbar) findViewById(R.id.toolbar_with_spinner);
mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout);

Expand Down Expand Up @@ -278,15 +277,12 @@ public void hideLoadingProgress() {
}

/*
* use this to add custom control/component views to your toolbar. Components are added on the right side of the
* toolbar */
public void addToolbarCustomControl(View v, OnClickListener clickListener){
if (v != null){
mCustomComponentsContainer.addView(v);
if (clickListener != null){
v.setOnClickListener(clickListener);
}
}
* add a menu to the right side of the toolbar, returns the toolbar menu so the caller
* can act upon it
*/
public Menu addToolbarMenu(@MenuRes int menuResId) {
mToolbar.inflateMenu(menuResId);
return mToolbar.getMenu();
}

public void setToolbarBackgroundColor(int color){
Expand Down Expand Up @@ -362,6 +358,10 @@ public void removeOnScrollListener(RecyclerView.OnScrollListener listener) {
}
}

public RecyclerView getInternalRecyclerView() {
return mRecyclerView;
}

public void hideToolbar(){
mAppBarLayout.setExpanded(false, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public interface OnScrollToTopListener {
void onScrollToTop();
}

/*
* tab fragments implement this and return true if the fragment handles the back button
* and doesn't want the activity to handle it as well
*/
public interface OnActivityBackPressedListener {
boolean onActivityBackPressed();
}

@Override
public void onCreate(Bundle savedInstanceState) {
ProfilingUtils.split("WPMainActivity.onCreate");
Expand Down Expand Up @@ -314,6 +322,23 @@ protected void onResume() {
ProfilingUtils.stop();
}

@Override
public void onBackPressed() {
// let the fragment handle the back button if it implements our OnParentBackPressedListener
Fragment fragment = getActiveFragment();
if (fragment instanceof OnActivityBackPressedListener) {
boolean handled = ((OnActivityBackPressedListener) fragment).onActivityBackPressed();
if (handled) {
return;
}
}
super.onBackPressed();
}

private Fragment getActiveFragment() {
return mTabAdapter.getFragment(mViewPager.getCurrentItem());
}

private void checkMagicLinkSignIn() {
if (getIntent() != null) {
if (getIntent().getBooleanExtra(MagicLinkSignInActivity.MAGIC_LOGIN, false)) {
Expand Down
Loading