change naming
This commit is contained in:
parent
4289444a4c
commit
c6045de802
1 changed files with 13 additions and 13 deletions
|
@ -21,14 +21,14 @@ import org.ligi.passandroid.ui.views.CategoryIndicatorView;
|
||||||
import static butterknife.ButterKnife.findById;
|
import static butterknife.ButterKnife.findById;
|
||||||
|
|
||||||
public class PassVisualizer {
|
public class PassVisualizer {
|
||||||
public static void visualize(final Activity activity, final Pass pass, View res) {
|
public static void visualize(final Activity activity, final Pass pass, final View container) {
|
||||||
final TextView titleTextView = findById(res, R.id.title);
|
final TextView titleTextView = findById(container, R.id.title);
|
||||||
final TextView dateTextView = findById(res, R.id.date);
|
final TextView dateTextView = findById(container, R.id.date);
|
||||||
|
|
||||||
final CategoryIndicatorView categoryIndicator = findById(res, R.id.categoryView);
|
final CategoryIndicatorView categoryIndicator = findById(container, R.id.categoryView);
|
||||||
|
|
||||||
if (pass.getLocations().size() > 0) {
|
if (pass.getLocations().size() > 0) {
|
||||||
findById(res, R.id.navigateTo).setOnClickListener(new View.OnClickListener() {
|
findById(container, R.id.navigateTo).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final String lang = activity.getResources().getConfiguration().locale.getLanguage();
|
final String lang = activity.getResources().getConfiguration().locale.getLanguage();
|
||||||
|
@ -36,7 +36,7 @@ public class PassVisualizer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
findById(res, R.id.navigateTo).setVisibility(View.GONE);
|
findById(container, R.id.navigateTo).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
final DateTime dateForIntent;
|
final DateTime dateForIntent;
|
||||||
|
@ -51,7 +51,7 @@ public class PassVisualizer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dateForIntent != null) {
|
if (dateForIntent != null) {
|
||||||
findById(res, R.id.addCalendar).setOnClickListener(new View.OnClickListener() {
|
findById(container, R.id.addCalendar).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
Intent intent = new Intent(Intent.ACTION_EDIT);
|
||||||
|
@ -63,19 +63,19 @@ public class PassVisualizer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
findById(res, R.id.addCalendar).setVisibility(View.GONE);
|
findById(container, R.id.addCalendar).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dateForIntent == null && !(pass.getLocations().size() > 0)) {
|
if (dateForIntent == null && !(pass.getLocations().size() > 0)) {
|
||||||
findById(res, R.id.actionsContainer).setVisibility(View.GONE);
|
findById(container, R.id.actionsContainer).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ImageView icon_img = findById(res, R.id.icon);
|
final ImageView icon_img = findById(container, R.id.icon);
|
||||||
|
|
||||||
icon_img.setBackgroundColor(pass.getBackGroundColor());
|
icon_img.setBackgroundColor(pass.getBackGroundColor());
|
||||||
|
|
||||||
if (pass.getIconBitmap().isPresent()) {
|
if (pass.getIconBitmap().isPresent()) {
|
||||||
final int size = (int) res.getResources().getDimension(R.dimen.pass_icon_size);
|
final int size = (int) container.getResources().getDimension(R.dimen.pass_icon_size);
|
||||||
icon_img.setImageBitmap(Bitmap.createScaledBitmap(pass.getIconBitmap().get(), size, size, false));
|
icon_img.setImageBitmap(Bitmap.createScaledBitmap(pass.getIconBitmap().get(), size, size, false));
|
||||||
} else {
|
} else {
|
||||||
icon_img.setImageResource(R.drawable.ic_launcher);
|
icon_img.setImageResource(R.drawable.ic_launcher);
|
||||||
|
@ -93,10 +93,10 @@ public class PassVisualizer {
|
||||||
titleTextView.setText(pass.getDescription());
|
titleTextView.setText(pass.getDescription());
|
||||||
|
|
||||||
if (pass.getRelevantDate().isPresent()) {
|
if (pass.getRelevantDate().isPresent()) {
|
||||||
final CharSequence relativeDateTimeString = DateUtils.getRelativeDateTimeString(res.getContext(), pass.getRelevantDate().get().getMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
final CharSequence relativeDateTimeString = DateUtils.getRelativeDateTimeString(container.getContext(), pass.getRelevantDate().get().getMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
||||||
dateTextView.setText(relativeDateTimeString);
|
dateTextView.setText(relativeDateTimeString);
|
||||||
} else if (pass.getExpirationDate().isPresent()) {
|
} else if (pass.getExpirationDate().isPresent()) {
|
||||||
final CharSequence relativeDateTimeString = DateUtils.getRelativeDateTimeString(res.getContext(), pass.getExpirationDate().get().getMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
final CharSequence relativeDateTimeString = DateUtils.getRelativeDateTimeString(container.getContext(), pass.getExpirationDate().get().getMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
||||||
|
|
||||||
if (pass.getExpirationDate().get().isAfterNow()) {
|
if (pass.getExpirationDate().get().isAfterNow()) {
|
||||||
dateTextView.setText("expires " + relativeDateTimeString);
|
dateTextView.setText("expires " + relativeDateTimeString);
|
||||||
|
|
Loading…
Reference in a new issue