RatingCompat.java
5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
package android.support.v4.media;
import android.media.Rating;
import android.os.Build.VERSION;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.support.annotation.RestrictTo;
import android.util.Log;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public final class RatingCompat
implements Parcelable
{
public static final Parcelable.Creator<RatingCompat> CREATOR = new Parcelable.Creator() {};
public static final int RATING_3_STARS = 3;
public static final int RATING_4_STARS = 4;
public static final int RATING_5_STARS = 5;
public static final int RATING_HEART = 1;
public static final int RATING_NONE = 0;
public static final int RATING_PERCENTAGE = 6;
public static final int RATING_THUMB_UP_DOWN = 2;
private final int a;
private final float b;
private Object c;
RatingCompat(int paramInt, float paramFloat)
{
this.a = paramInt;
this.b = paramFloat;
}
public static RatingCompat fromRating(Object paramObject)
{
if ((paramObject == null) || (Build.VERSION.SDK_INT < 19)) {
return null;
}
int i = ((Rating)paramObject).getRatingStyle();
RatingCompat localRatingCompat;
if (((Rating)paramObject).isRated()) {
switch (i)
{
default:
return null;
case 1:
localRatingCompat = newHeartRating(((Rating)paramObject).hasHeart());
}
}
for (;;)
{
localRatingCompat.c = paramObject;
return localRatingCompat;
localRatingCompat = newThumbRating(((Rating)paramObject).isThumbUp());
continue;
localRatingCompat = newStarRating(i, ((Rating)paramObject).getStarRating());
continue;
localRatingCompat = newPercentageRating(((Rating)paramObject).getPercentRating());
continue;
localRatingCompat = newUnratedRating(i);
}
}
public static RatingCompat newHeartRating(boolean paramBoolean)
{
if (paramBoolean) {}
for (float f = 1.0F;; f = 0.0F) {
return new RatingCompat(1, f);
}
}
public static RatingCompat newPercentageRating(float paramFloat)
{
if ((paramFloat < 0.0F) || (paramFloat > 100.0F))
{
Log.e("Rating", "Invalid percentage-based rating value");
return null;
}
return new RatingCompat(6, paramFloat);
}
public static RatingCompat newStarRating(int paramInt, float paramFloat)
{
float f;
switch (paramInt)
{
default:
Log.e("Rating", "Invalid rating style (" + paramInt + ") for a star rating");
return null;
case 3:
f = 3.0F;
}
while ((paramFloat < 0.0F) || (paramFloat > f))
{
Log.e("Rating", "Trying to set out of range star-based rating");
return null;
f = 4.0F;
continue;
f = 5.0F;
}
return new RatingCompat(paramInt, paramFloat);
}
public static RatingCompat newThumbRating(boolean paramBoolean)
{
if (paramBoolean) {}
for (float f = 1.0F;; f = 0.0F) {
return new RatingCompat(2, f);
}
}
public static RatingCompat newUnratedRating(int paramInt)
{
switch (paramInt)
{
default:
return null;
}
return new RatingCompat(paramInt, -1.0F);
}
public final int describeContents()
{
return this.a;
}
public final float getPercentRating()
{
if ((this.a != 6) || (!isRated())) {
return -1.0F;
}
return this.b;
}
public final Object getRating()
{
if ((this.c != null) || (Build.VERSION.SDK_INT < 19)) {
return this.c;
}
if (isRated()) {
switch (this.a)
{
default:
return null;
case 1:
this.c = Rating.newHeartRating(hasHeart());
}
}
for (;;)
{
return this.c;
this.c = Rating.newThumbRating(isThumbUp());
continue;
this.c = Rating.newStarRating(this.a, getStarRating());
continue;
this.c = Rating.newPercentageRating(getPercentRating());
break;
this.c = Rating.newUnratedRating(this.a);
}
}
public final int getRatingStyle()
{
return this.a;
}
public final float getStarRating()
{
switch (this.a)
{
}
do
{
return -1.0F;
} while (!isRated());
return this.b;
}
public final boolean hasHeart()
{
if (this.a != 1) {}
while (this.b != 1.0F) {
return false;
}
return true;
}
public final boolean isRated()
{
return this.b >= 0.0F;
}
public final boolean isThumbUp()
{
if (this.a != 2) {}
while (this.b != 1.0F) {
return false;
}
return true;
}
public final String toString()
{
StringBuilder localStringBuilder = new StringBuilder("Rating:style=").append(this.a).append(" rating=");
if (this.b < 0.0F) {}
for (String str = "unrated";; str = String.valueOf(this.b)) {
return str;
}
}
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
paramParcel.writeInt(this.a);
paramParcel.writeFloat(this.b);
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface StarStyle {}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface Style {}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/media/RatingCompat.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/