diff --git a/src/main/java/org/ligi/passandroid/ui/PassListActivity.java b/src/main/java/org/ligi/passandroid/ui/PassListActivity.java index 9dc2aa87..14b052c2 100644 --- a/src/main/java/org/ligi/passandroid/ui/PassListActivity.java +++ b/src/main/java/org/ligi/passandroid/ui/PassListActivity.java @@ -14,12 +14,17 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; - +import android.widget.TextView; +import butterknife.ButterKnife; +import butterknife.InjectView; +import butterknife.OnClick; import com.afollestad.materialdialogs.MaterialDialog; import com.androidquery.service.MarketService; import com.melnykov.fab.FloatingActionButton; import com.squareup.otto.Subscribe; - +import fr.nicolaspomepuy.discreetapprate.AppRate; +import fr.nicolaspomepuy.discreetapprate.RetryPolicy; +import org.ligi.axt.AXT; import org.ligi.passandroid.App; import org.ligi.passandroid.R; import org.ligi.passandroid.Tracker; @@ -30,12 +35,6 @@ import org.ligi.passandroid.model.PassStore; import org.ligi.tracedroid.TraceDroid; import org.ligi.tracedroid.sending.TraceDroidEmailSender; -import butterknife.ButterKnife; -import butterknife.InjectView; -import butterknife.OnClick; -import fr.nicolaspomepuy.discreetapprate.AppRate; -import fr.nicolaspomepuy.discreetapprate.RetryPolicy; - public class PassListActivity extends ActionBarActivity { private PassAdapter passAdapter; @@ -51,14 +50,16 @@ public class PassListActivity extends ActionBarActivity { @InjectView(R.id.fab) FloatingActionButton fab; + @InjectView(R.id.emptyView) + TextView emptyView; + @OnClick(R.id.fab) void onFABClick() { - new MaterialDialog.Builder(this) - .title(getString(R.string.fab_add_dialog_title)) - .items(R.array.items) - .itemsCallback( new FABCallback(this)) - .negativeText(android.R.string.cancel) - .show(); + new MaterialDialog.Builder(this).title(getString(R.string.fab_add_dialog_title)) + .items(R.array.items) + .itemsCallback(new FABCallback(this)) + .negativeText(android.R.string.cancel) + .show(); } private NavigationFragment navigationFragment; @@ -89,7 +90,10 @@ public class PassListActivity extends ActionBarActivity { passStore.refreshPassesList(); passStore.sort(App.getSettings().getSortOrder()); + AXT.at(emptyView).setVisibility(passStore.passCount() == 0); + passAdapter.notifyDataSetChanged(); + } }); @@ -116,10 +120,7 @@ public class PassListActivity extends ActionBarActivity { final MarketService ms = new MarketService(this); ms.level(MarketService.MINOR).checkVersion(); - AppRate.with(this) - .retryPolicy(RetryPolicy.EXPONENTIAL) - .initialLaunchCount(5) - .checkAndShow(); + AppRate.with(this).retryPolicy(RetryPolicy.EXPONENTIAL).initialLaunchCount(5).checkAndShow(); } drawerToggle = new ActionBarDrawerToggle(this, drawer, R.string.drawer_open, R.string.drawer_close) { diff --git a/src/main/res/layout/pass_list.xml b/src/main/res/layout/pass_list.xml index f5a65bfe..42702c84 100644 --- a/src/main/res/layout/pass_list.xml +++ b/src/main/res/layout/pass_list.xml @@ -1,41 +1,51 @@ + android:id="@+id/drawer_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + xmlns:fab="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:id="@+id/content_list" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:choiceMode="singleChoice" + android:divider="@null" + android:listSelector="@android:color/transparent"/> + + + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:layout_margin="16dp" + android:src="@drawable/ic_add_white_24dp" + fab:fab_colorNormal="@color/accent" + fab:fab_colorPressed="@color/icon_green" + fab:fab_colorRipple="@color/icon_green"/> + android:id="@+id/left_drawer" + android:layout_width="240dp" + android:layout_height="match_parent" + android:layout_gravity="start" + android:background="@android:color/white"/> \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 7ddd91e0..7536e35b 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -93,4 +93,10 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS Scan for pkpass files Add Demo-Pass Create Pass (experimental) + No pass yet + \n\n\n You can search your phone for passes + \n\n or create your own + \n\n or try a demo pass + \n\n just press + down below + \ No newline at end of file