[go: nahoru, domu]

Skip to content
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

Added Pulltorefresh library #50

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
added search menu item...
  • Loading branch information
aagam-shah committed Aug 28, 2013
commit 79d67a735bc2ea5e122af8b77cb5179419c7a664
21 changes: 16 additions & 5 deletions res/menu/posts.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >



<item
android:id="@+id/menu_refresh"
android:icon="@drawable/ab_icon_refresh"
android:showAsAction="always"
android:menuCategory="container"
android:orderInCategory="2"
android:title="@string/refresh"/>
<item
android:id="@+id/menu_new_post"
android:icon="@drawable/ab_icon_new"
android:showAsAction="ifRoom"
android:title="@string/new_post"/>
<item
android:id="@+id/menu_post_search"
android:actionViewClass="com.actionbarsherlock.widget.SearchView"
android:menuCategory="container"
android:orderInCategory="1"
android:showAsAction="always"
android:title="@string/search_post"/>
<item
android:id="@+id/menu_settings"
android:icon="@android:drawable/ic_menu_preferences"
android:showAsAction="never"
android:title="@string/settings"/>
<item
android:id="@+id/menu_signout"
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:showAsAction="never"
android:title="@string/sign_out"/>
android:id="@+id/menu_signout"
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:showAsAction="never"
android:title="@string/sign_out"/>

</menu>
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
<!-- Menu Buttons -->
<string name="new_post">New Post</string>
<string name="new_page">New Page</string>
<string name="search_post">Search</string>
<string name="quick_photo">Quick Photo</string>
<string name="quick_video">Quick Video</string>
<string name="wp_admin">Dashboard</string>
Expand Down
35 changes: 34 additions & 1 deletion src/org/wordpress/android/ui/posts/PostsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
Expand All @@ -25,6 +28,7 @@
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.widget.SearchView;

import org.xmlrpc.android.ApiHelper;
import org.xmlrpc.android.XMLRPCClient;
Expand All @@ -41,16 +45,21 @@
import org.wordpress.android.ui.posts.PostsListFragment.OnPostActionListener;
import org.wordpress.android.ui.posts.PostsListFragment.OnPostSelectedListener;
import org.wordpress.android.ui.posts.PostsListFragment.OnRefreshListener;
import org.wordpress.android.ui.posts.PostsListFragment.OnSearchQueryListener;
import org.wordpress.android.util.WPAlertDialogFragment.OnDialogConfirmListener;
import org.wordpress.android.ui.notifications.NotificationsActivity;

public class PostsActivity extends WPActionBarActivity implements OnPostSelectedListener,
OnRefreshListener, OnPostActionListener, OnDetailPostActionListener, OnDialogConfirmListener {
OnRefreshListener, OnPostActionListener, OnDetailPostActionListener,
OnDialogConfirmListener, OnSearchQueryListener, SearchView.OnQueryTextListener {

private PostsListFragment postList;
private static final int ID_DIALOG_DELETING = 1, ID_DIALOG_SHARE = 2, ID_DIALOG_COMMENT = 3;
public static final int POST_DELETE = 0, POST_SHARE = 1, POST_EDIT = 2, POST_CLEAR = 3, POST_COMMENT = 4;
public ProgressDialog loadingDialog;
public SearchView searchView;
public SearchManager searchManager;
public SearchableInfo searchableInfo;
public boolean isPage = false;
public String errorMsg = "";
public boolean isRefreshing = false;
Expand Down Expand Up @@ -281,6 +290,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.posts, menu);
refreshMenuItem = menu.findItem(R.id.menu_refresh);

searchManager = (SearchManager)getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView)menu.findItem(R.id.menu_post_search).getActionView();
searchView.setIconifiedByDefault(true);

searchView.setQueryHint("Search Posts...");

if (isPage) {
menu.findItem(R.id.menu_new_post).setTitle(R.string.new_page);
Expand Down Expand Up @@ -860,4 +875,22 @@ public void onBlogChanged() {
postList.loadPosts(false);
new ApiHelper.RefreshBlogContentTask(this, WordPress.currentBlog).execute(false);
}

@Override
public boolean onQueryTextSubmit(String query) {
// TODO Auto-generated method stub
return false;
}

@Override
public boolean onQueryTextChange(String newText) {

return false;
}

@Override
public void updateList(String query) {
// TODO Auto-generated method stub

}
}
4 changes: 4 additions & 0 deletions src/org/wordpress/android/ui/posts/PostsListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ protected Boolean doInBackground(List<?>... args) {
public interface OnPostSelectedListener {
public void onPostSelected(Post post);
}

public interface OnSearchQueryListener{
public void updateList(String query);
}

public interface OnRefreshListener {
public void onRefresh(boolean start);
Expand Down