|
|
@ -1,6 +1,6 @@
|
|
|
|
package org.tasks.billing;
|
|
|
|
package org.tasks.billing;
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
@ -9,17 +9,20 @@ import androidx.recyclerview.widget.ListAdapter;
|
|
|
|
import org.tasks.Callback;
|
|
|
|
import org.tasks.Callback;
|
|
|
|
import org.tasks.R;
|
|
|
|
import org.tasks.R;
|
|
|
|
import org.tasks.locale.Locale;
|
|
|
|
import org.tasks.locale.Locale;
|
|
|
|
|
|
|
|
import org.tasks.themes.Theme;
|
|
|
|
|
|
|
|
|
|
|
|
public class PurchaseAdapter extends ListAdapter<Integer, PurchaseHolder> {
|
|
|
|
public class PurchaseAdapter extends ListAdapter<Integer, PurchaseHolder> {
|
|
|
|
|
|
|
|
|
|
|
|
private final Activity activity;
|
|
|
|
private final Context context;
|
|
|
|
|
|
|
|
private final Theme theme;
|
|
|
|
private final Locale locale;
|
|
|
|
private final Locale locale;
|
|
|
|
private final Callback<Integer> onPriceChanged;
|
|
|
|
private final Callback<Integer> onPriceChanged;
|
|
|
|
private int selected;
|
|
|
|
private int selected;
|
|
|
|
|
|
|
|
|
|
|
|
PurchaseAdapter(Activity activity, Locale locale, Callback<Integer> onPriceChanged) {
|
|
|
|
PurchaseAdapter(Context context, Theme theme, Locale locale, Callback<Integer> onPriceChanged) {
|
|
|
|
super(new DiffCallback());
|
|
|
|
super(new DiffCallback());
|
|
|
|
this.activity = activity;
|
|
|
|
this.context = context;
|
|
|
|
|
|
|
|
this.theme = theme;
|
|
|
|
this.locale = locale;
|
|
|
|
this.locale = locale;
|
|
|
|
this.onPriceChanged = onPriceChanged;
|
|
|
|
this.onPriceChanged = onPriceChanged;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -38,7 +41,7 @@ public class PurchaseAdapter extends ListAdapter<Integer, PurchaseHolder> {
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PurchaseHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
|
|
public PurchaseHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
|
|
View view = activity.getLayoutInflater().inflate(R.layout.dialog_purchase_cell, parent, false);
|
|
|
|
View view = theme.getLayoutInflater(context).inflate(R.layout.dialog_purchase_cell, parent, false);
|
|
|
|
return new PurchaseHolder(view, onPriceChanged, locale);
|
|
|
|
return new PurchaseHolder(view, onPriceChanged, locale);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|