[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 all commits
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
14 changes: 8 additions & 6 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="libs/volley.jar"/>
<classpathentry exported="true" kind="lib" path="libs/gson-2.2.2.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/httpmime-4.1.2.jar"/>
<classpathentry kind="lib" path="libs/tagsoup-1.2.1.jar"/>
<classpathentry kind="lib" path="libs/gson-2.2.2.jar"/>
<classpathentry exported="true" kind="lib" path="libs/httpmime-4.1.2.jar"/>
<classpathentry exported="true" kind="lib" path="libs/tagsoup-1.2.1.jar"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="/ActionBarSherlock/libs/android-support-v4.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="lib" path="libs/volley.jar"/>
<classpathentry kind="lib" path="libs/gcm.jar"/>
<classpathentry exported="true" kind="lib" path="libs/gcm.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="lib" path="/home/star/adt-bundle-linux-x86_64/wordpress/libs/android-support-v4.jar"/>
<classpathentry exported="true" kind="lib" path="/home/star/adt-bundle-linux-x86_64/wordpress/libs/wordpresscom-android-rest-v0.0.3.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
5 changes: 3 additions & 2 deletions lint.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="DefaultLocale" severity="ignore" />
<issue id="MissingTranslation">
<ignore path="res\values\strings.xml" />
<ignore path="res/values/strings.xml" />
</issue>
</lint>
</lint>
5 changes: 3 additions & 2 deletions project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ split.density=false
target=android-17
apk-configurations=
android.library=false
android.library.reference.1=../ActionBarSherlock/library
android.library.reference.2=../../../Downloads/android-menudrawer-master/library
android.library.reference.1=../../JakeWharton-ActionBarSherlock-071a61c/actionbarsherlock
android.library.reference.2=../../new/android-menudrawer-master/library

android.library.reference.3=../ActionBar-PullToRefresh/library
5 changes: 0 additions & 5 deletions res/menu/basic_menu.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?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:title="@string/refresh"/>
<item
android:id="@+id/menu_settings"
android:icon="@android:drawable/ic_menu_preferences"
Expand Down
28 changes: 17 additions & 11 deletions res/menu/posts.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<?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:title="@string/refresh"/>


<item
android:id="@+id/menu_new_post"
android:icon="@drawable/ab_icon_new"
android:showAsAction="ifRoom"
android:showAsAction="always"
android:menuCategory="container"
android:orderInCategory="2"
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>
3 changes: 2 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
<string name="uploading">Uploading</string>
<string name="uploading_media_item">Uploading media item #</string>
<string name="gallery_error">Sorry, the media item could not be retrieved.</string>
<string name="refresh">Refresh</string>
<string name="home">Home</string>
<string name="more_tag">More</string>
<string name="blog_not_found">Sorry, an error occurred when attempting to access this blog.</string>
Expand Down Expand Up @@ -375,6 +374,8 @@
<!-- Menu Buttons -->
<string name="new_post">New Post</string>
<string name="new_page">New Page</string>
<string name="search_post">Search</string>
<string name="search_post_hint">Search Posts...</string>
<string name="quick_photo">Quick Photo</string>
<string name="quick_video">Quick Video</string>
<string name="wp_admin">Dashboard</string>
Expand Down
3 changes: 1 addition & 2 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<item name="android:panelBackground">@drawable/menu_hardkey_panel_wordpress</item>
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">@style/Theme.wordpress.widget</item>

<item name="menuDrawerStyle">@style/MenuDrawer</item>
</style>

Expand Down Expand Up @@ -77,7 +76,7 @@
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.wordpress.widget" parent="Theme.Sherlock">
<item name="popupMenuStyle">@style/wordpress_PopupMenu</item>

<item name="android:textColorHint">#CCCCCC</item>
<item name="android:dropDownListViewStyle">@style/wordpress_DropDownListView</item>
<item name="dropDownListViewStyle">@style/wordpress_DropDownListView</item>
</style>
Expand Down
33 changes: 19 additions & 14 deletions src/org/wordpress/android/ui/comments/CommentsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Toast;

import com.actionbarsherlock.app.ActionBar;
Expand All @@ -33,9 +34,11 @@
import org.wordpress.android.ui.comments.CommentsListFragment.OnCommentSelectedListener;
import org.wordpress.android.ui.comments.CommentsListFragment.OnContextCommentStatusChangeListener;

import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher;

public class CommentsActivity extends WPActionBarActivity implements
OnCommentSelectedListener, OnCommentStatusChangeListener,
OnAnimateRefreshButtonListener, OnContextCommentStatusChangeListener {
OnAnimateRefreshButtonListener, OnContextCommentStatusChangeListener, PullToRefreshAttacher.OnRefreshListener {

protected int id;
public int ID_DIALOG_MODERATING = 1;
Expand All @@ -45,7 +48,7 @@ public class CommentsActivity extends WPActionBarActivity implements
public ProgressDialog pd;
private CommentsListFragment commentList;
private boolean fromNotification = false;
private MenuItem refreshMenuItem;
private PullToRefreshAttacher pullToRefreshAttacher;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -55,7 +58,7 @@ public void onCreate(Bundle savedInstanceState) {
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
setTitle(getString(R.string.tab_comments));

Bundle extras = getIntent().getExtras();
if (extras != null) {
fromNotification = extras.getBoolean("fromNotification");
Expand All @@ -72,7 +75,8 @@ public void onCreate(Bundle savedInstanceState) {
FragmentManager fm = getSupportFragmentManager();
fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
commentList = (CommentsListFragment) fm.findFragmentById(R.id.commentList);

pullToRefreshAttacher = PullToRefreshAttacher.get(this);
pullToRefreshAttacher.addRefreshableView(commentList.getListView(), this);
WordPress.currentComment = null;

attemptToSelectComment();
Expand All @@ -94,23 +98,17 @@ public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.basic_menu, menu);
refreshMenuItem = menu.findItem(R.id.menu_refresh);
if (shouldAnimateRefreshButton) {
shouldAnimateRefreshButton = false;
startAnimatingRefreshButton(refreshMenuItem);
pullToRefreshAttacher.setRefreshing(true);
}
return true;
}

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.menu_refresh) {
popCommentDetail();
attemptToSelectComment();
commentList.refreshComments(false, false, false);
return true;
} else if (itemId == android.R.id.home) {
if (itemId == android.R.id.home) {
FragmentManager fm = getSupportFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
popCommentDetail();
Expand Down Expand Up @@ -569,9 +567,9 @@ public void onAnimateRefreshButton(boolean start) {

if (start) {
shouldAnimateRefreshButton = true;
this.startAnimatingRefreshButton(refreshMenuItem);
pullToRefreshAttacher.setRefreshing(true);
} else {
this.stopAnimatingRefreshButton(refreshMenuItem);
pullToRefreshAttacher.setRefreshing(false);
}

}
Expand All @@ -595,4 +593,11 @@ public void onSaveInstanceState(Bundle outState) {
}
super.onSaveInstanceState(outState);
}

@Override
public void onRefreshStarted(View view) {
popCommentDetail();
attemptToSelectComment();
commentList.refreshComments(false, false, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ public void refreshComments(final boolean more, final boolean refresh,

if (!loadMore && !doInBackground) {
onAnimateRefreshButton.onAnimateRefreshButton(true);

}
client = new XMLRPCClient(WordPress.currentBlog.getUrl(),
WordPress.currentBlog.getHttpuser(),
Expand Down
Loading