Skip to content

Commit

Permalink
Fixed console support
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-yun committed Oct 28, 2018
1 parent 49bbfbf commit 11ad7be
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.cogentworks.overwidget"
minSdkVersion 16
targetSdkVersion 27
versionCode 23
versionName "0.5.13"
versionCode 24
versionName "0.5.14"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void onClick(DialogInterface dialog, int which) {
comparator = new Comparator<Profile>() {
@Override
public int compare(Profile o1, Profile o2) {
return o1.BattleTag.compareTo(o2.BattleTag);
return o1.BattleTag.toLowerCase().compareTo(o2.BattleTag.toLowerCase());
}
};
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static Bitmap BuildLevelBmp(Profile profile, Context context) throws IOEx
canvas.drawBitmap(borderBmp, new Matrix(), null);
canvas.drawBitmap(levelBmp, 0, 90, null);

if (prestigeUrl != null) {
if (prestigeUrl != null && !prestigeUrl.equals(borderUrl)) {
InputStream rankInputStream = prestigeUrl.openConnection().getInputStream();
Bitmap rankBmp = BitmapFactory.decodeStream(rankInputStream);
canvas.drawBitmap(rankBmp, 0, bmOverlay.getHeight() - 128, null);
Expand Down
20 changes: 9 additions & 11 deletions app/src/main/java/com/cogentworks/overwidget/WidgetUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public static void setWidgetViews(Context context, Profile profile, int appWidge
// General views
views.setTextViewText(R.id.appwidget_battletag, profile.BattleTag);
// Comp Rank
views.setImageViewBitmap(R.id.appwidget_comprank, WidgetUtils.BuildTextBmp(profile.CompRank, profile.getTheme(), context));
if (Integer.parseInt(profile.CompRank) > 0)
views.setImageViewBitmap(R.id.appwidget_comprank, WidgetUtils.BuildTextBmp(profile.CompRank, profile.getTheme(), context));
if (!profile.RankImgURL.equals("")) {
SetCompBmp setCompBmp = new SetCompBmp(context, appWidgetManager, appWidgetId, views);
setCompBmp.execute(profile.RankImgURL);
Expand Down Expand Up @@ -186,8 +187,6 @@ public static Profile getProfile(Context context, int appWidgetId) throws IOExce
}

public static Profile getProfile(String battleTag, String platform, String region, String interval, String theme) throws IOException {
if (platform != null && !platform.equals("PC"))
region = "any"; // Set region to any on console

if (battleTag != null && platform != null && region != null) {
Profile result = new Profile(battleTag, platform, region);
Expand All @@ -197,7 +196,12 @@ public static Profile getProfile(String battleTag, String platform, String regio
result.setTheme(theme);
}

URL endpoint = new URL(server + "/v1/stats/" + platform.toLowerCase() + "/" + region.toLowerCase() + "/" + battleTag.replace('#', '-') + "/profile");
String url = server + "/v1/stats/" + platform.toLowerCase() + "/";
if (platform.equals("PC"))
url += region.toLowerCase() + "/";
url += battleTag.replace('#', '-') + "/profile";

URL endpoint = new URL(url);
//Log.d(TAG, endpoint.toString());
HttpsURLConnection urlConnection = (HttpsURLConnection) endpoint.openConnection();
//HttpURLConnection urlConnection = (HttpURLConnection) endpoint.openConnection();
Expand All @@ -224,13 +228,7 @@ public static Profile getProfile(String battleTag, String platform, String regio
result.PrestigeImgURL = stats.get("prestigeIcon").getAsString();
result.gamesWon = stats.get("gamesWon").getAsString();
result.RankImgURL = stats.get("ratingIcon").getAsString();
try {
result.setRank(stats.get("rating").getAsString(), stats.get("ratingName").getAsString().toLowerCase());
if (!result.Tier.equals(""))
result.Tier = "nullrank";
} catch (UnsupportedOperationException e) {
result.setRank("", "nullrank");
}
result.CompRank = stats.get("rating").getAsString();


responseBody.close();
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!--<item name="colorPrimary">@color/colorPrimary</item>-->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorEdgeEffect" tools:targetApi="21">@color/colorAccent</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
</style>

Expand All @@ -14,6 +15,7 @@
<!--<item name="colorPrimary">@color/colorPrimary</item>-->
<!--<item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
<item name="colorAccent">@color/colorAccentDark</item>
<item name="android:colorEdgeEffect" tools:targetApi="21">@color/colorAccentDark</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">false</item>
</style>

Expand Down

0 comments on commit 11ad7be

Please sign in to comment.