| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.service.games; |
| 18 |
|
| 19 |
import android.annotation.IntDef; |
| 20 |
import android.annotation.NonNull; |
| 21 |
import android.os.Parcel; |
| 22 |
import android.os.Parcelable; |
| 23 |
|
| 24 |
import java.lang.annotation.Retention; |
| 25 |
import java.lang.annotation.RetentionPolicy; |
| 26 |
import java.util.Objects; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public final class GameScreenshotResult implements Parcelable { |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
@IntDef(flag = false, prefix = {"GAME_SCREENSHOT_"}, value = { |
| 44 |
GAME_SCREENSHOT_SUCCESS, |
| 45 |
GAME_SCREENSHOT_ERROR_INTERNAL_ERROR, |
| 46 |
}) |
| 47 |
@Retention(RetentionPolicy.SOURCE) |
| 48 |
public @interface GameScreenshotStatus { |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public static final int GAME_SCREENSHOT_SUCCESS = 0; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
public static final int GAME_SCREENSHOT_ERROR_INTERNAL_ERROR = 1; |
| 73 |
|
| 74 |
@NonNull |
| 75 |
public static final Parcelable.Creator<GameScreenshotResult> CREATOR = |
| 76 |
new Parcelable.Creator<GameScreenshotResult>() { |
| 77 |
@Override |
| 78 |
public GameScreenshotResult createFromParcel(Parcel source) { |
| 79 |
return new GameScreenshotResult(source.readInt()); |
| 80 |
} |
| 81 |
|
| 82 |
@Override |
| 83 |
public GameScreenshotResult[] newArray(int size) { |
| 84 |
return new GameScreenshotResult[0]; |
| 85 |
} |
| 86 |
}; |
| 87 |
|
| 88 |
@GameScreenshotStatus |
| 89 |
private final int mStatus; |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
public static GameScreenshotResult createSuccessResult() { |
| 95 |
return new GameScreenshotResult(GAME_SCREENSHOT_SUCCESS); |
| 96 |
} |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
public static GameScreenshotResult createInternalErrorResult() { |
| 103 |
return new GameScreenshotResult(GAME_SCREENSHOT_ERROR_INTERNAL_ERROR); |
| 104 |
} |
| 105 |
|
| 106 |
private GameScreenshotResult(@GameScreenshotStatus int status) { |
| 107 |
this.mStatus = status; |
| 108 |
} |
| 109 |
|
| 110 |
@Override |
| 111 |
public int describeContents() { |
| 112 |
return 0; |
| 113 |
} |
| 114 |
|
| 115 |
@Override |
| 116 |
public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 117 |
dest.writeInt(mStatus); |
| 118 |
} |
| 119 |
|
| 120 |
@GameScreenshotStatus |
| 121 |
public int getStatus() { |
| 122 |
return mStatus; |
| 123 |
} |
| 124 |
|
| 125 |
@Override |
| 126 |
public String toString() { |
| 127 |
return "GameScreenshotResult{" |
| 128 |
+ "mStatus=" |
| 129 |
+ mStatus |
| 130 |
+ "}"; |
| 131 |
} |
| 132 |
|
| 133 |
@Override |
| 134 |
public boolean equals(Object o) { |
| 135 |
if (this == o) { |
| 136 |
return true; |
| 137 |
} |
| 138 |
|
| 139 |
if (!(o instanceof GameScreenshotResult)) { |
| 140 |
return false; |
| 141 |
} |
| 142 |
|
| 143 |
GameScreenshotResult that = (GameScreenshotResult) o; |
| 144 |
return mStatus == that.mStatus; |
| 145 |
} |
| 146 |
|
| 147 |
@Override |
| 148 |
public int hashCode() { |
| 149 |
return Objects.hash(mStatus); |
| 150 |
} |
| 151 |
} |