Skip to content

Commit

Permalink
Merge pull request #37 from timoetzold/main
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
timoetzold authored Sep 10, 2022
2 parents d90b463 + 716cc60 commit 4a2f9eb
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 26 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ android {
defaultConfig {
minSdkVersion 24 /*Dont change this unless you know why*/
targetSdkVersion 32 /*Dont change this unless you know why*/
versionCode 76
versionName "5.5.9-beta"
versionCode 77
versionName "5.5.9"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
}
Expand Down Expand Up @@ -175,7 +175,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.jakewharton.timber:timber:4.7.0'
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation 'com.rmtheis:tess-two:7.0.0'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'io.apptik.widget:multislider:1.2'
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@
</application>

<queries>
<!-- necessary for starting Pokemon GO -->
<package android:name="com.nianticlabs.pokemongo" />

<!-- necessary for opening a browser -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>

</manifest>
4 changes: 3 additions & 1 deletion app/src/main/java/com/kamron/pogoiv/ScreenGrabber.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kamron.pogoiv;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PixelFormat;
Expand Down Expand Up @@ -27,10 +28,11 @@ public class ScreenGrabber {

private static ScreenGrabber instance = null;
private ImageReader imageReader;
private MediaProjection projection = null;
private MediaProjection projection;
private DisplayMetrics rawDisplayMetrics;
private VirtualDisplay virtualDisplay;

@SuppressLint("WrongConstant")
private ScreenGrabber(MediaProjection mediaProjection, DisplayMetrics raw) {
rawDisplayMetrics = raw;
projection = mediaProjection;
Expand Down
22 changes: 12 additions & 10 deletions app/src/main/java/com/kamron/pogoiv/activities/MainFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,19 @@ public void onNothingSelected(AdapterView<?> parentView) {
* Initiates the links to reddit and github.
*/
private void initiateCommunityButtons() {
binding.redditButton.setOnClickListener(v -> {
Uri uriUrl = Uri.parse("https://www.reddit.com/r/GoIV/");
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(launchBrowser);
});
binding.redditButton.setOnClickListener(v -> openUrl("https://www.reddit.com/r/GoIV/"));
binding.githubButton.setOnClickListener(v -> openUrl("https://github.com/GoIV-Devs/GoIV"));
}

binding.githubButton.setOnClickListener(v -> {
Uri uriUrl = Uri.parse("https://github.com/GoIV-Devs/GoIV");
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(launchBrowser);
});
private void openUrl(String url) {
Activity activity = getActivity();
if (activity != null) {
Uri uriUrl = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
}
}
}

private void initiateHelpButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ public static boolean isGoIVBeingUpdated(@NonNull Context context) {
.setFilterByStatus(DownloadManager.STATUS_RUNNING);
Cursor c = downloadManager.query(q);
if (c.moveToFirst()) {
String fileName = c.getString(c.getColumnIndex(DownloadManager.COLUMN_TITLE));
return fileName.equals(DownloadUpdateService.DOWNLOAD_UPDATE_TITLE);
int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_TITLE);
if (columnIndex >= 0) {
String fileName = c.getString(columnIndex);
return fileName.equals(DownloadUpdateService.DOWNLOAD_UPDATE_TITLE);
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum Anchor {
TOP(Gravity.TOP),
BOTTOM(Gravity.BOTTOM);

private int gravity;
private final int gravity;

Anchor(int gravity) {
this.gravity = gravity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import androidx.annotation.StyleRes;

import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -48,7 +49,7 @@ public void show(Fraction fraction) {
fraction.onCreate(LayoutInflater.from(themedContext), containerView, true);
currentFraction = fraction;

layoutParams.gravity = currentFraction.getAnchor().getGravity();
layoutParams.gravity = currentFraction.getAnchor().getGravity() == Gravity.TOP ? Gravity.TOP : Gravity.BOTTOM;
int offset = currentFraction.getVerticalOffset(themedContext.getResources().getDisplayMetrics());
updateFloatingViewVerticalOffset(offset);
}
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/res/layout/activity_ocr_manual_calibration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,18 @@
android:id="@+id/dragUpDownArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="12dp">
android:paddingBottom="12dp"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/dragUpDownIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="@id/dragUpDownArea"
app:layout_constraintStart_toStartOf="@id/dragUpDownArea"
app:srcCompat="@drawable/ic_compare_arrows_white_24dp"/>
app:srcCompat="@drawable/ic_compare_arrows_white_24dp" />
</androidx.constraintlayout.widget.ConstraintLayout>


Expand Down Expand Up @@ -90,6 +92,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/manual_calibration_param1"
app:layout_constraintStart_toStartOf="@id/floatingEditFieldConstraint"
app:layout_constraintTop_toBottomOf="@id/fieldExplanation"/>

<SeekBar
Expand All @@ -107,6 +110,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/manual_calibration_param2"
app:layout_constraintStart_toStartOf="@id/floatingEditFieldConstraint"
app:layout_constraintTop_toBottomOf="@id/param1Seekbar"/>

<SeekBar
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/fraction_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-6dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:baselineAligned="true"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/fraction_iv_result.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
android:textAppearance="?android:attr/textAppearanceLarge"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="Pokename" />

<TextView
Expand All @@ -111,7 +112,8 @@
android:layout_height="48dp"
app:layout_constraintEnd_toEndOf="parent"
android:scaleType="center"
app:srcCompat="@drawable/ic_share_black" />
app:srcCompat="@drawable/ic_share_black"
tools:ignore="MissingConstraints" />

</androidx.constraintlayout.widget.ConstraintLayout>

Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/fraction_power_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@
android:layout_height="wrap_content"
android:text="@string/fraction_powerup_paragraph_predictedstats"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>

app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<TextView
android:id="@+id/exResultCP"
Expand Down Expand Up @@ -399,8 +399,8 @@
android:layout_marginTop="4dp"
android:layout_marginEnd="6dp"
android:src="@drawable/star"
android:tint="#6A6A6A"
tools:ignore="ContentDescription"/>
tools:ignore="ContentDescription"
app:tint="#6A6A6A" />

<TextView
android:id="@+id/exResStardust"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
<string name="token_msg_mixUnicode_msg1">Similar to UIV, UNICODE circular numbers are used to represent IV.</string>
<string name="token_msg_mixUnicode_msg2">" This token uses filled characters to represent single values and empty characters to represent the lowest of multiple values. For example, ⓭ in the attack position would mean that all Attack values are 13, while ① in the defense or HP means there are multiple values possible and that 1 is the lowest."</string>
<string name="token_msg_mixUnicode_msg3">" This token uses empty characters to represent single values and filled characters to represent the lowest of multiple values. For example, ⑪ in the attack position would mean that all Attack values are 11, while ❾ in the defense or HP means there are multiple values possible and that 9 is the lowest."</string>
<string name="token_msg_perfCP">This token calculates how close your monster is to its max potential, measured by CP. For example, if a monster with max IVs maxes out at 2000cp, but your specific monster maxes out at 1900, then your monster perfection is 95%, so this token returns 95.</string>
<string name="token_msg_perfCP" formatted="false">This token calculates how close your monster is to its max potential, measured by CP. For example, if a monster with max IVs maxes out at 2000cp, but your specific monster maxes out at 1900, then your monster perfection is 95%, so this token returns 95.</string>
<string name="token_msg_cp_percentage">This token calculates where your pokemon\'s L40 CP falls between 0% and 100% IV.</string>
<string name="token_msg_gender">"This token returns the gender of the monster: %1$s if male, %2$s if female, empty otherwise.</string>
<string name="token_msg_pkmName_msg1">"This token returns the name of the monster, for example if you scan a Dratini, it will return "</string>
Expand Down

0 comments on commit 4a2f9eb

Please sign in to comment.