fix typo Pas Pass - bugfix optional pass being absent - cleanup

This commit is contained in:
ligi 2014-07-18 17:20:58 +02:00
parent 22f596ffcc
commit 62818d3fcf
6 changed files with 9 additions and 26 deletions

View file

@ -9,7 +9,7 @@ import org.joda.time.DateTime;
import org.ligi.passandroid.injections.FixedPassListPassStore;
import org.ligi.passandroid.model.Pass;
import org.ligi.passandroid.model.PassImpl;
import org.ligi.passandroid.ui.PasViewActivity;
import org.ligi.passandroid.ui.PassViewActivity;
import java.util.ArrayList;
@ -17,17 +17,16 @@ import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.click;
import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isDisplayed;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.not;
@TargetApi(14)
public class ThePassViewActivity extends BaseIntegration<PasViewActivity> {
public class ThePassViewActivity extends BaseIntegration<PassViewActivity> {
private PassImpl act_pass;
public ThePassViewActivity() {
super(PasViewActivity.class);
super(PassViewActivity.class);
}
@Override

View file

@ -142,7 +142,7 @@
</intent-filter>
</activity>
<activity
android:name=".ui.PasViewActivity"
android:name=".ui.PassViewActivity"
android:label="@string/app_name"
android:parentActivityName=".ui.PassListActivity">
<meta-data

View file

@ -55,7 +55,7 @@ public class PassImportActivity extends ActionBarActivity {
final PassStore store = App.getPassStore();
store.setCurrentPass(store.getPassbookForId(id));
AXT.at(PassImportActivity.this).startCommonIntent().activityFromClass(PasViewActivity.class);
AXT.at(PassImportActivity.this).startCommonIntent().activityFromClass(PassViewActivity.class);
return null;
}

View file

@ -94,7 +94,7 @@ public class PassListActivity extends ActionBarActivity {
void listItemClick(int position) {
final Pass newSelectedPass = App.getPassStore().getPassbookAt(position);
App.getPassStore().setCurrentPass(Optional.of(newSelectedPass));
AXT.at(this).startCommonIntent().activityFromClass(PasViewActivity.class);
AXT.at(this).startCommonIntent().activityFromClass(PassViewActivity.class);
}
public void refreshPasses() {

View file

@ -28,7 +28,7 @@ import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
public class PasViewActivity extends PassViewActivityBase {
public class PassViewActivity extends PassViewActivityBase {
@OnClick(R.id.barcode_img)
@ -73,7 +73,7 @@ public class PasViewActivity extends PassViewActivityBase {
.setNeutralButton(getString(R.string.send), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new ExportProblemPassToLigiAndFinishTask(PasViewActivity.this, pass.getId(), App.getShareDir(), "share.pkpass").execute();
new ExportProblemPassToLigiAndFinishTask(PassViewActivity.this, pass.getId(), App.getShareDir(), "share.pkpass").execute();
}
})
.show();
@ -134,7 +134,7 @@ public class PasViewActivity extends PassViewActivityBase {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
boolean res = super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.menu_map).setVisible((optionalPass.get().isValid() && optionalPass.get().getLocations().size() > 0));
menu.findItem(R.id.menu_map).setVisible((optionalPass.isPresent() && optionalPass.get().isValid() && optionalPass.get().getLocations().size() > 0));
return res;
}

View file

@ -1,9 +1,7 @@
package org.ligi.passandroid.ui;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
@ -16,7 +14,6 @@ import org.ligi.passandroid.model.Pass;
public class PassViewActivityBase extends ActionBarActivity {
protected Bitmap icon_bitmap;
public Optional<Pass> optionalPass;
@Override
@ -33,19 +30,6 @@ public class PassViewActivityBase extends ActionBarActivity {
finish();
return;
}
loadIcon();
}
private void loadIcon() {
Display display = getWindowManager().getDefaultDisplay();
int smallestSide = Math.min(display.getHeight(), display.getWidth());
int size = (int) (2.0f * smallestSide / 3.0f);
icon_bitmap = optionalPass.get().getIconBitmap();
if (icon_bitmap != null) {
icon_bitmap = Bitmap.createScaledBitmap(icon_bitmap, size, size, true);
}
}
@Override