diff --git a/android/src/main/java/org/ligi/passandroid/events/NavigationOpenedEvent.java b/android/src/main/java/org/ligi/passandroid/events/NavigationOpenedEvent.java deleted file mode 100644 index d0463462..00000000 --- a/android/src/main/java/org/ligi/passandroid/events/NavigationOpenedEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.ligi.passandroid.events; - -public class NavigationOpenedEvent { -} diff --git a/android/src/main/java/org/ligi/passandroid/events/SortOrderChangeEvent.java b/android/src/main/java/org/ligi/passandroid/events/SortOrderChangeEvent.java deleted file mode 100644 index f7050523..00000000 --- a/android/src/main/java/org/ligi/passandroid/events/SortOrderChangeEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.ligi.passandroid.events; - -public class SortOrderChangeEvent { -} diff --git a/android/src/main/java/org/ligi/passandroid/events/TypeFocusEvent.java b/android/src/main/java/org/ligi/passandroid/events/TypeFocusEvent.java deleted file mode 100644 index a1786db7..00000000 --- a/android/src/main/java/org/ligi/passandroid/events/TypeFocusEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.ligi.passandroid.events; - -public class TypeFocusEvent { - public final String type; - - public TypeFocusEvent(String type) { - this.type = type; - } -} diff --git a/android/src/main/java/org/ligi/passandroid/model/AndroidSettings.java b/android/src/main/java/org/ligi/passandroid/model/AndroidSettings.java index c5a18b4f..1442f549 100644 --- a/android/src/main/java/org/ligi/passandroid/model/AndroidSettings.java +++ b/android/src/main/java/org/ligi/passandroid/model/AndroidSettings.java @@ -5,12 +5,15 @@ import android.content.SharedPreferences; import android.os.Environment; import android.preference.PreferenceManager; +import org.ligi.passandroid.R; import org.ligi.passandroid.model.comparator.PassSortOrder; import java.io.File; +import static org.ligi.passandroid.R.string.preference_key_autolight; +import static org.ligi.passandroid.R.string.preference_key_condensed; + public class AndroidSettings implements Settings { - public static final String ORDER_KEY = "order"; public final Context context; final SharedPreferences sharedPreferences; @@ -20,14 +23,11 @@ public class AndroidSettings implements Settings { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); } - @Override - public void setSortOrder(PassSortOrder order) { - sharedPreferences.edit().putInt(ORDER_KEY, order.getInt()).apply(); - } - @Override public PassSortOrder getSortOrder() { - int id = sharedPreferences.getInt(ORDER_KEY, 0); + final String key = context.getString(R.string.preference_key_sort); + final String stringValue = sharedPreferences.getString(key, "0"); + final int id = Integer.valueOf(stringValue); for (PassSortOrder order : PassSortOrder.values()) { if (order.getInt() == id) { return order; @@ -60,12 +60,12 @@ public class AndroidSettings implements Settings { @Override public boolean isCondensedModeEnabled() { - return sharedPreferences.getBoolean("CONDENSED", false); + return sharedPreferences.getBoolean(context.getString(preference_key_condensed), false); } @Override public boolean isAutomaticLightEnabled() { - return sharedPreferences.getBoolean("AUTOLIGHT", true); + return sharedPreferences.getBoolean(context.getString(preference_key_autolight), true); } } diff --git a/android/src/main/java/org/ligi/passandroid/model/Settings.java b/android/src/main/java/org/ligi/passandroid/model/Settings.java index 24b7cf1e..ee55d021 100644 --- a/android/src/main/java/org/ligi/passandroid/model/Settings.java +++ b/android/src/main/java/org/ligi/passandroid/model/Settings.java @@ -6,8 +6,6 @@ import java.io.File; public interface Settings { - void setSortOrder(PassSortOrder order); - PassSortOrder getSortOrder(); boolean doTraceDroidEmailSend(); diff --git a/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java b/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java index 6d4f1fca..3e1c941e 100644 --- a/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java +++ b/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.java @@ -19,21 +19,15 @@ import android.support.v7.app.AppCompatDelegate; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; -import android.view.View; import android.view.Window; import android.widget.TextView; -import com.squareup.otto.Subscribe; - import net.i2p.android.ext.floatingactionbutton.FloatingActionButton; import net.i2p.android.ext.floatingactionbutton.FloatingActionsMenu; import org.ligi.axt.AXT; import org.ligi.passandroid.App; import org.ligi.passandroid.R; -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.PassClassifier; @@ -130,16 +124,6 @@ public class PassListActivity extends PassAndroidActivity implements PassClassif } } - @Subscribe - public void sortOrderChange(SortOrderChangeEvent orderChangeEvent) { - refreshPasses(); - } - - @Subscribe - public void typeFocus(TypeFocusEvent typeFocusEvent) { - drawer.closeDrawers(); - } - public void refreshPasses() { passStore.preCachePassesList(); runOnUiThread(new Runnable() { @@ -183,12 +167,7 @@ public class PassListActivity extends PassAndroidActivity implements PassClassif SnackEngage.from(floatingActionsMenu).withSnack(new DefaultRateSnack()).build().engageWhenAppropriate(); } - drawerToggle = new ActionBarDrawerToggle(this, drawer, R.string.drawer_open, R.string.drawer_close) { - @Override - public void onDrawerOpened(View drawerView) { - bus.post(new NavigationOpenedEvent()); - } - }; + drawerToggle = new ActionBarDrawerToggle(this, drawer, R.string.drawer_open, R.string.drawer_close); drawer.addDrawerListener(drawerToggle); diff --git a/android/src/main/java/org/ligi/passandroid/ui/PassListFragment.java b/android/src/main/java/org/ligi/passandroid/ui/PassListFragment.java index 0134153e..8bf23075 100644 --- a/android/src/main/java/org/ligi/passandroid/ui/PassListFragment.java +++ b/android/src/main/java/org/ligi/passandroid/ui/PassListFragment.java @@ -12,11 +12,9 @@ import android.view.View; import android.view.ViewGroup; import com.squareup.otto.Bus; -import com.squareup.otto.Subscribe; import org.ligi.passandroid.App; import org.ligi.passandroid.R; -import org.ligi.passandroid.events.TypeFocusEvent; import org.ligi.passandroid.helper.MoveHelper; import org.ligi.passandroid.model.FiledPass; import org.ligi.passandroid.model.PassStore; @@ -165,19 +163,4 @@ public class PassListFragment extends Fragment implements OnClassificationChange adapter.notifyDataSetChanged(); } - @Subscribe - public void typeFocus(TypeFocusEvent typeFocusEvent) { - scrollToType(typeFocusEvent.type); - } - - - private void scrollToType(String type) { - - for (int i = 0; i < adapter.getItemCount(); i++) { - if (passStoreProjection.getPassList().get(i).getTypeNotNull().equals(type)) { - recyclerView.scrollToPosition(i); - return; // we are done - } - } - } } diff --git a/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.java b/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.java index 2a3bac58..ae2ebeec 100644 --- a/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.java +++ b/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.java @@ -17,7 +17,6 @@ import com.squareup.otto.Bus; import org.ligi.passandroid.App; import org.ligi.passandroid.R; import org.ligi.passandroid.Tracker; -import org.ligi.passandroid.events.SortOrderChangeEvent; import org.ligi.passandroid.model.FiledPass; import org.ligi.passandroid.model.InputStreamWithSource; import org.ligi.passandroid.model.Pass; @@ -158,7 +157,6 @@ public class SearchPassesIntentService extends IntentService { foundList.add(uuid); final String language = getBaseContext().getResources().getConfiguration().locale.getLanguage(); final FiledPass pass = AppleStylePassReader.read(passStore.getPathForID(uuid), language); - bus.post(new SortOrderChangeEvent()); final Bitmap iconBitmap = pass.getBitmap(Pass.BITMAP_ICON); if (iconBitmap != null) { final Bitmap bitmap = scale2maxSize(iconBitmap, getResources().getDimensionPixelSize(R.dimen.finger)); diff --git a/android/src/main/res/values/arrays.xml b/android/src/main/res/values/arrays.xml new file mode 100644 index 00000000..db5da5dc --- /dev/null +++ b/android/src/main/res/values/arrays.xml @@ -0,0 +1,7 @@ + + + + 0 + 1 + + \ No newline at end of file diff --git a/android/src/main/res/values/stings-notranslate.xml b/android/src/main/res/values/stings-notranslate.xml new file mode 100644 index 00000000..869023d0 --- /dev/null +++ b/android/src/main/res/values/stings-notranslate.xml @@ -0,0 +1,6 @@ + + + SORT + AUTOLIGHT + CONDENSED + \ No newline at end of file diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml index d3bda092..56cb4b91 100644 --- a/android/src/main/res/values/strings.xml +++ b/android/src/main/res/values/strings.xml @@ -92,7 +92,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS also delete source? MORE LESS - Scanning for Passes + Scanning for Passes Scan for pkpass files Add Demo-Pass Create Pass (experimental) @@ -115,4 +115,8 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS Move to new Topic %d Categories %d Passes + + Date + Type + \ No newline at end of file diff --git a/android/src/main/res/xml/preferences.xml b/android/src/main/res/xml/preferences.xml index 42acc898..0ade3005 100644 --- a/android/src/main/res/xml/preferences.xml +++ b/android/src/main/res/xml/preferences.xml @@ -1,12 +1,20 @@ + + \ No newline at end of file