| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.service.quickaccesswallet; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.Parcelable; |
| 22 |
|
| 23 |
import java.util.ArrayList; |
| 24 |
import java.util.List; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public final class GetWalletCardsResponse implements Parcelable { |
| 31 |
|
| 32 |
private final List<WalletCard> mWalletCards; |
| 33 |
private final int mSelectedIndex; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public GetWalletCardsResponse(@NonNull List<WalletCard> walletCards, int selectedIndex) { |
| 47 |
this.mWalletCards = walletCards; |
| 48 |
this.mSelectedIndex = selectedIndex; |
| 49 |
} |
| 50 |
|
| 51 |
@Override |
| 52 |
public int describeContents() { |
| 53 |
return 0; |
| 54 |
} |
| 55 |
|
| 56 |
@Override |
| 57 |
public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 58 |
dest.writeInt(mWalletCards.size()); |
| 59 |
dest.writeParcelableList(mWalletCards, flags); |
| 60 |
dest.writeInt(mSelectedIndex); |
| 61 |
} |
| 62 |
|
| 63 |
private static GetWalletCardsResponse readFromParcel(Parcel source) { |
| 64 |
int size = source.readInt(); |
| 65 |
List<WalletCard> walletCards = |
| 66 |
source.readParcelableList(new ArrayList<>(size), WalletCard.class.getClassLoader(), android.service.quickaccesswallet.WalletCard.class); |
| 67 |
int selectedIndex = source.readInt(); |
| 68 |
return new GetWalletCardsResponse(walletCards, selectedIndex); |
| 69 |
} |
| 70 |
|
| 71 |
@NonNull |
| 72 |
public static final Creator<GetWalletCardsResponse> CREATOR = |
| 73 |
new Creator<GetWalletCardsResponse>() { |
| 74 |
@Override |
| 75 |
public GetWalletCardsResponse createFromParcel(Parcel source) { |
| 76 |
return readFromParcel(source); |
| 77 |
} |
| 78 |
|
| 79 |
@Override |
| 80 |
public GetWalletCardsResponse[] newArray(int size) { |
| 81 |
return new GetWalletCardsResponse[size]; |
| 82 |
} |
| 83 |
}; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
@NonNull |
| 90 |
public List<WalletCard> getWalletCards() { |
| 91 |
return mWalletCards; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
public int getSelectedIndex() { |
| 102 |
return mSelectedIndex; |
| 103 |
} |
| 104 |
} |