migrate to swipeToRefreshLayout from support lib

This commit is contained in:
ligi 2014-03-29 03:55:59 +05:30
parent 076006d4e2
commit e6b0c76d28
4 changed files with 21 additions and 20 deletions

View file

@ -84,13 +84,13 @@ dependencies {
// The Apache Software License, Version 2.0
compile 'com.googlecode.android-query:android-query:0.25.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:support-v4:19.1'
compile 'com.android.support:support-v4:19.1.0'
compile 'net.lingala.zip4j:zip4j:1.2.9'
compile 'com.android.support:appcompat-v7:19.0.1'
compile 'com.jakewharton:butterknife:4.0.1'
compile 'joda-time:joda-time:2.3'
compile 'com.squareup:otto:1.3.4'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.3'
compile 'org.ligi:AXT:0.25'
compile 'org.ligi:tracedroid:1.1'
compile 'com.google.guava:guava:16.0.1'

View file

@ -9,6 +9,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.view.ActionMode;
import android.text.Html;
@ -45,9 +46,6 @@ import java.util.HashSet;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnItemClick;
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout;
import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh;
import uk.co.senab.actionbarpulltorefresh.library.listeners.OnRefreshListener;
import static org.ligi.passandroid.ui.UnzipPassController.SilentFail;
import static org.ligi.passandroid.ui.UnzipPassController.SilentWin;
@ -71,7 +69,7 @@ public class TicketListActivity extends ActionBarActivity {
TextView emptyView;
@InjectView(R.id.ptr_layout)
PullToRefreshLayout mPullToRefreshLayout;
SwipeRefreshLayout swipeRefreshLayout;
private ActionMode actionMode;
@ -181,17 +179,14 @@ public class TicketListActivity extends ActionBarActivity {
}
});
ActionBarPullToRefresh.from(this)
.allChildrenArePullable()
.listener(new OnRefreshListener() {
@Override
public void onRefreshStarted(View view) {
App.getPassStore().deleteCache();
new ScanForPassesTask().execute();
}
})
.setup(mPullToRefreshLayout);
swipeRefreshLayout.setColorScheme(R.color.icon_blue, R.color.icon_green, R.color.icon_lila, R.color.icon_orange);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
App.getPassStore().deleteCache();
new ScanForPassesTask().execute();
}
});
}
private void scrollToType(String type) {
@ -256,7 +251,7 @@ public class TicketListActivity extends ActionBarActivity {
public void updateUIToScanningState() {
mPullToRefreshLayout.setRefreshing(scanning);
swipeRefreshLayout.setRefreshing(scanning);
supportInvalidateOptionsMenu();
@ -370,6 +365,7 @@ public class TicketListActivity extends ActionBarActivity {
super.onPostExecute(aVoid);
scanning = false;
// TODO bring back Tracker.get().trackTiming("timing", System.currentTimeMillis() - start_time, "scan", "scan_time");
updateUIToScanningState();
}

View file

@ -10,7 +10,7 @@
android:layout_height="match_parent">
<uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/ptr_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -23,7 +23,7 @@
android:listSelector="@android:color/transparent"
android:divider="@null"></ListView>
</uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.PullToRefreshLayout>
</android.support.v4.widget.SwipeRefreshLayout>
<TextView
android:layout_width="wrap_content"

View file

@ -4,4 +4,9 @@
<color name="highlight_color">#FF4eacc6</color>
<color name="dividing_color">#ff0099cc</color>
<color name="icon_blue">#ff6ea0f2</color>
<color name="icon_green">#ffbfdf00</color>
<color name="icon_lila">#ffc46ee3</color>
<color name="icon_orange">#ffffb420</color>
</resources>