Compare commits
1 commit
master
...
ligi/featu
Author | SHA1 | Date | |
---|---|---|---|
|
86c71cf349 |
12 changed files with 113 additions and 71 deletions
|
@ -107,6 +107,9 @@ dependencies {
|
|||
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||
compile 'com.android.support:cardview-v7:21.0.0'
|
||||
|
||||
compile 'com.melnykov:floatingactionbutton:1.1.0'
|
||||
compile 'com.afollestad:material-dialogs:0.6.2.3'
|
||||
|
||||
compile 'org.ligi:AXT:0.31'
|
||||
compile 'org.ligi:tracedroid:1.4'
|
||||
compile 'com.google.guava:guava:18.0'
|
||||
|
|
|
@ -21,9 +21,6 @@ import org.ligi.passandroid.events.NavigationOpenedEvent;
|
|||
import org.ligi.passandroid.events.SortOrderChangeEvent;
|
||||
import org.ligi.passandroid.events.TypeFocusEvent;
|
||||
import org.ligi.passandroid.helper.CategoryHelper;
|
||||
import org.ligi.passandroid.helper.PassUtil;
|
||||
import org.ligi.passandroid.model.FiledPass;
|
||||
import org.ligi.passandroid.model.Pass;
|
||||
import org.ligi.passandroid.model.PassStore;
|
||||
import org.ligi.passandroid.ui.views.CategoryIndicatorView;
|
||||
import org.ligi.tracedroid.logging.Log;
|
||||
|
@ -34,6 +31,9 @@ import butterknife.ButterKnife;
|
|||
import butterknife.InjectView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
public class NavigationFragment extends Fragment {
|
||||
|
||||
@OnClick(R.id.community)
|
||||
|
@ -41,14 +41,6 @@ public class NavigationFragment extends Fragment {
|
|||
AXT.at(getActivity()).startCommonIntent().openUrl("https://plus.google.com/communities/116353894782342292067");
|
||||
}
|
||||
|
||||
@OnClick(R.id.add)
|
||||
void add() {
|
||||
final FiledPass pass = PassUtil.createEmptyPass();
|
||||
App.getPassStore().setCurrentPass(pass);
|
||||
pass.save(App.getPassStore());
|
||||
AXT.at(getActivity()).startCommonIntent().activityFromClass(PassEditActivity.class);
|
||||
}
|
||||
|
||||
@OnClick(R.id.share)
|
||||
void share() {
|
||||
AXT.at(getActivity()).startCommonIntent().shareUrl(getMarketUrl());
|
||||
|
@ -128,24 +120,16 @@ public class NavigationFragment extends Fragment {
|
|||
createCategoryJumpMarks(LayoutInflater.from(getActivity()));
|
||||
}
|
||||
|
||||
private boolean shouldDisplaCategoryNav() {
|
||||
if (App.getPassStore().getCountedTypes().size() < 2) { // navigation only makes sense with >=2 Elements
|
||||
return false;
|
||||
}
|
||||
|
||||
if (App.getSettings().getSortOrder() != PassStore.SortOrder.TYPE) { // nav only makes sense if we order by category
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // we are good to give this user this feature
|
||||
private boolean shouldDisplayCategoryNav() {
|
||||
return shouldDisplaySort() && App.getSettings().getSortOrder() == PassStore.SortOrder.TYPE;
|
||||
}
|
||||
|
||||
private boolean shouldDisplaySort() {
|
||||
return App.getPassStore().getCountedTypes().size() >= 2;
|
||||
}
|
||||
private void setCategoryNavVisibilityByCurrentConditions() {
|
||||
if (shouldDisplaCategoryNav()) {
|
||||
categoriesContainerOuter.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
categoriesContainerOuter.setVisibility(View.GONE);
|
||||
}
|
||||
categoriesContainerOuter.setVisibility(shouldDisplayCategoryNav()? VISIBLE: GONE);
|
||||
radioGroup.setVisibility(shouldDisplaySort()? VISIBLE: GONE);
|
||||
}
|
||||
|
||||
private void createCategoryJumpMarks(LayoutInflater inflater) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.ligi.passandroid.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
|
@ -23,10 +24,15 @@ import android.view.Window;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.GravityEnum;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.androidquery.service.MarketService;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import com.melnykov.fab.FloatingActionButton;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.ligi.axt.AXT;
|
||||
import org.ligi.passandroid.App;
|
||||
import org.ligi.passandroid.R;
|
||||
import org.ligi.passandroid.Tracker;
|
||||
|
@ -34,6 +40,8 @@ import org.ligi.passandroid.TrackerInterface;
|
|||
import org.ligi.passandroid.events.NavigationOpenedEvent;
|
||||
import org.ligi.passandroid.events.SortOrderChangeEvent;
|
||||
import org.ligi.passandroid.events.TypeFocusEvent;
|
||||
import org.ligi.passandroid.helper.PassUtil;
|
||||
import org.ligi.passandroid.model.FiledPass;
|
||||
import org.ligi.passandroid.model.InputStreamWithSource;
|
||||
import org.ligi.passandroid.model.PassStore;
|
||||
import org.ligi.passandroid.model.PastLocationsStore;
|
||||
|
@ -45,6 +53,7 @@ import java.io.File;
|
|||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.InjectView;
|
||||
import butterknife.OnClick;
|
||||
import fr.nicolaspomepuy.discreetapprate.AppRate;
|
||||
import fr.nicolaspomepuy.discreetapprate.RetryPolicy;
|
||||
|
||||
|
@ -68,6 +77,38 @@ public class PassListActivity extends ActionBarActivity {
|
|||
@InjectView(R.id.list_swiperefresh_layout)
|
||||
SwipeRefreshLayout listSwipeRefreshLayout;
|
||||
|
||||
@InjectView(R.id.fab)
|
||||
FloatingActionButton fab;
|
||||
|
||||
@OnClick(R.id.fab)
|
||||
void foo(){
|
||||
new MaterialDialog.Builder(this)
|
||||
.title("Pass Source")
|
||||
.items(R.array.items)
|
||||
.itemsCallback(new MaterialDialog.ListCallback() {
|
||||
@Override
|
||||
public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence charSequence) {
|
||||
switch (i) {
|
||||
case 0: // scan
|
||||
break;
|
||||
|
||||
case 1: // demo-pass
|
||||
AXT.at(PassListActivity.this).startCommonIntent().openUrl("http://ligi.de/passandroid_samples/index.html");
|
||||
break;
|
||||
|
||||
case 2: // add
|
||||
final FiledPass pass = PassUtil.createEmptyPass();
|
||||
App.getPassStore().setCurrentPass(pass);
|
||||
pass.save(App.getPassStore());
|
||||
AXT.at(PassListActivity.this).startCommonIntent().activityFromClass(PassEditActivity.class);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
.negativeText(android.R.string.cancel)
|
||||
.show();
|
||||
}
|
||||
private NavigationFragment navigationFragment;
|
||||
|
||||
@Subscribe
|
||||
|
@ -215,6 +256,7 @@ public class PassListActivity extends ActionBarActivity {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
//listView.setOnTouchListener(new ShowHideOnScroll(fab));
|
||||
new InitAsyncTask().execute();
|
||||
|
||||
App.getBus().register(this);
|
||||
|
|
BIN
src/main/res/drawable-hdpi/ic_add_white_36dp.png
Normal file
BIN
src/main/res/drawable-hdpi/ic_add_white_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 B |
BIN
src/main/res/drawable-mdpi/ic_add_white_36dp.png
Normal file
BIN
src/main/res/drawable-mdpi/ic_add_white_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 223 B |
BIN
src/main/res/drawable-xhdpi/ic_add_white_36dp.png
Normal file
BIN
src/main/res/drawable-xhdpi/ic_add_white_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 222 B |
BIN
src/main/res/drawable-xxhdpi/ic_add_white_36dp.png
Normal file
BIN
src/main/res/drawable-xxhdpi/ic_add_white_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 314 B |
BIN
src/main/res/drawable-xxxhdpi/ic_add_white_36dp.png
Normal file
BIN
src/main/res/drawable-xxxhdpi/ic_add_white_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 B |
|
@ -7,25 +7,25 @@
|
|||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:orientation="vertical"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<TextView
|
||||
style="@style/nav_topic"
|
||||
android:text="@string/nav_sort" />
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/radioGroup">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/nav_topic"
|
||||
android:text="@string/nav_sort" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/categoryRadioButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/nav_sort_category"
|
||||
android:checked="true" />
|
||||
android:checked="true"
|
||||
android:text="@string/nav_sort_category" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/dateRadioButton"
|
||||
|
@ -35,66 +35,52 @@
|
|||
</RadioGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/navCategoriesOuter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/navCategoriesOuter">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:text="@string/nav_categories"
|
||||
style="@style/nav_topic" />
|
||||
style="@style/nav_topic"
|
||||
android:text="@string/nav_categories" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/navCategoriesInner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/navCategoriesInner"
|
||||
android:orientation="vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:text="@string/nav_more"
|
||||
style="@style/nav_topic" />
|
||||
style="@style/nav_topic"
|
||||
android:text="@string/nav_more" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
style="@style/nav_btn"
|
||||
android:id="@+id/community"
|
||||
|
||||
android:id="@+id/add">
|
||||
|
||||
<ImageView
|
||||
style="@style/nav_icon"
|
||||
android:src="@android:drawable/ic_menu_add" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/nav_add"
|
||||
style="@style/nav_text" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/nav_btn"
|
||||
|
||||
android:id="@+id/community">
|
||||
style="@style/nav_btn">
|
||||
|
||||
<ImageView
|
||||
style="@style/nav_icon"
|
||||
android:src="@drawable/community_icon" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/nav_comunity"
|
||||
style="@style/nav_text" />
|
||||
style="@style/nav_text"
|
||||
android:text="@string/nav_comunity" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/nav_btn"
|
||||
|
||||
android:id="@+id/share">
|
||||
android:id="@+id/share"
|
||||
style="@style/nav_btn">
|
||||
|
||||
<ImageView
|
||||
style="@style/nav_icon"
|
||||
android:src="@android:drawable/ic_menu_share" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/nav_share"
|
||||
style="@style/nav_text" />
|
||||
style="@style/nav_text"
|
||||
android:text="@string/nav_share" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/list_swiperefresh_layout"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/list_swiperefresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/content_list"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -19,7 +23,22 @@
|
|||
android:divider="@null"
|
||||
android:listSelector="@android:color/transparent" />
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
|
||||
<com.melnykov.fab.FloatingActionButton
|
||||
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_36dp"
|
||||
fab:fab_colorNormal="@color/primary"
|
||||
fab:fab_colorPressed="@color/secondary"
|
||||
fab:fab_colorRipple="@color/secondary" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/left_drawer"
|
||||
|
|
8
src/main/res/values/arrays.xml
Normal file
8
src/main/res/values/arrays.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="items" >
|
||||
<item>Scan for pkpass files</item>
|
||||
<item>Add Demo-Pass</item>
|
||||
<item>Create Pass (experimental)</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -3,7 +3,7 @@
|
|||
<item name="android:windowBackground">@color/window_bg</item>
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorPrimaryDark">@color/secondary</item>
|
||||
<item name="colorAccent">@color/icon_green_dark</item>
|
||||
<item name="colorAccent">@color/secondary</item>
|
||||
<item name="color">@color/secondary</item>
|
||||
<item name="actionModeBackground">@color/secondary</item>
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue