use new tooling and get rid of swiperefresh workaround closes #9

This commit is contained in:
ligi 2014-10-18 13:24:40 +02:00
parent 2e3e9dc5d7
commit 8c0dd9b707
3 changed files with 28 additions and 50 deletions

View file

@ -82,7 +82,7 @@ dependencies {
// The Apache Software License, Version 2.0
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:support-v4:21.0.0'
compile 'net.lingala.zip4j:zip4j:1.3.2'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.jakewharton:butterknife:5.1.2'
@ -109,8 +109,8 @@ dependencies {
android {
compileSdkVersion 20
buildToolsVersion "20"
compileSdkVersion 21
buildToolsVersion "21"
defaultConfig {
versionCode 241

View file

@ -68,14 +68,11 @@ public class PassListActivity extends ActionBarActivity {
@InjectView(R.id.drawer_layout)
DrawerLayout drawer;
@InjectView(R.id.emptyView)
@InjectView(android.R.id.empty)
TextView emptyView;
@InjectView(R.id.list_swiperefresh_layout)
SwipeRefreshLayout listSwipeRefreshLayout;
@InjectView(R.id.empty_swiperefresh_layout)
SwipeRefreshLayout emptySwipeRefreshLayout;
@InjectView(R.id.swiperefresh_layout)
SwipeRefreshLayout swipeRefreshLayout;
private ActionMode actionMode;
private NavigationFragment navigationFragment;
@ -136,7 +133,7 @@ public class PassListActivity extends ActionBarActivity {
ButterKnife.inject(this);
listView.setEmptyView(emptySwipeRefreshLayout);
listView.setEmptyView(emptyView);
// don't want too many windows in worst case - so check for errors first
if (TraceDroid.getStackTraceFiles().length > 0) {
@ -212,9 +209,7 @@ public class PassListActivity extends ActionBarActivity {
}
});
prepareRefreshLayout(listSwipeRefreshLayout);
prepareRefreshLayout(emptySwipeRefreshLayout);
prepareRefreshLayout(swipeRefreshLayout);
}
private void prepareRefreshLayout(SwipeRefreshLayout swipeRefreshLayout) {
@ -314,7 +309,7 @@ public class PassListActivity extends ActionBarActivity {
if (navigationFragment == null) {
navigationFragment = new NavigationFragment();
getSupportFragmentManager().beginTransaction().add(R.id.left_drawer, navigationFragment).commit();
getSupportFragmentManager().beginTransaction().add(R.id.left_drawer, navigationFragment).commitAllowingStateLoss();
}
}
}
@ -331,8 +326,7 @@ public class PassListActivity extends ActionBarActivity {
public void updateUIRegardingToUIState() {
Log.i("", "changeuistate" + uiState);
listSwipeRefreshLayout.setRefreshing(uiState.get() != PassListUIState.UISTATE_LIST);
emptySwipeRefreshLayout.setRefreshing(uiState.get() != PassListUIState.UISTATE_LIST);
swipeRefreshLayout.setRefreshing(uiState.get() != PassListUIState.UISTATE_LIST);
supportInvalidateOptionsMenu();

View file

@ -5,16 +5,28 @@
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/list_swiperefresh_layout"
android:id="@+id/swiperefresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:padding="7dp"
android:text="test"
android:textAppearance="?android:textAppearanceLarge" />
<ListView
android:id="@+id/content_list"
android:layout_width="match_parent"
@ -23,27 +35,9 @@
android:divider="@null"
android:listSelector="@android:color/transparent"/>
</FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/empty_swiperefresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:padding="7dp"
android:text="test"
android:textAppearance="?android:textAppearanceLarge" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
<FrameLayout
@ -52,15 +46,5 @@
android:layout_width="240dp"
android:layout_height="match_parent"
android:background="@android:color/white"/>
<!--
<fragment
android:name="org.ligi.passandroid.ui.NavigationFragment"
android:layout_width="240dp"
android:layout_height="match_parent"
android:orientation="vertical" />
-->
</android.support.v4.widget.DrawerLayout>