Skip to content

Commit

Permalink
Merge branch 'main' into site_survey_option
Browse files Browse the repository at this point in the history
  • Loading branch information
rksh authored Nov 6, 2024
2 parents b1ba14a + 18e3db6 commit 8978a62
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Update API KEY from Secrets
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.1.1'
}
}
plugins {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
4 changes: 3 additions & 1 deletion wiglewifiwardriving/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ android {
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildFeatures {
buildConfig = true
}

buildTypes {
release {
Expand All @@ -27,7 +30,6 @@ android {
excludes += ['META-INF/ASL2.0', 'META-INF/LICENSE', 'META-INF/NOTICE', 'META-INF/NOTICE.txt', 'META-INF/LICENSE.txt', 'META-INF/MANIFEST.MF']
}
}

}

configurations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public void run() {
@Override
public void onClick( final DialogInterface dialog, final int which ) {
try {
dialog.dismiss();
}
catch ( Exception ex ) {
if (null != dialog) {
dialog.dismiss();
}
} catch ( Exception ex ) {
// guess it wasn't there anyways
Logging.info( "exception dismissing alert dialog: " + ex );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,10 @@ public void checkStorage() {
iseDlgBuilder.setMessage(external?R.string.no_external_space_message:R.string.no_internal_space_message)
.setTitle(external?R.string.no_external_space_title:R.string.no_internal_space_title)
.setCancelable(true)
.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss());
.setPositiveButton(R.string.ok, (dialog, which) -> {
if (null != dialog) {
dialog.dismiss();
}});
final Dialog dialog = iseDlgBuilder.create();
if (!isFinishing()) {
dialog.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,27 @@ public static String getApiToken(SharedPreferences prefs) {
try {
final KeyStore keyStore = getKeyStore();

KeyStore.PrivateKeyEntry privateKeyEntry;

KeyStore.PrivateKeyEntry privateKeyEntry = null;
// prefer v2 key -> v1 key -> v0 key, nada as applicable
int versionThreshold = android.os.Build.VERSION_CODES.M;
if (keyStore.containsAlias(KEYSTORE_WIGLE_CREDS_KEY_V2)) {
//DEBUG: MainActivity.info("Using v2: " + KEYSTORE_WIGLE_CREDS_KEY_V2);
return getApiTokenVersion2(prefs);
} else if (keyStore.containsAlias(KEYSTORE_WIGLE_CREDS_KEY_V1)) {
privateKeyEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry(KEYSTORE_WIGLE_CREDS_KEY_V1, null);
} else if (keyStore.containsAlias(KEYSTORE_WIGLE_CREDS_KEY_V0)) {
privateKeyEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry(KEYSTORE_WIGLE_CREDS_KEY_V0, null);
versionThreshold = Build.VERSION_CODES.JELLY_BEAN_MR2;
} else {
Logging.warn("[TOKEN] Compatible build, but no key set: " +
android.os.Build.VERSION.SDK_INT + " - returning plaintext.");
return prefs.getString(PreferenceKeys.PREF_TOKEN, "");
if (null != keyStore) {
if (keyStore.containsAlias(KEYSTORE_WIGLE_CREDS_KEY_V2)) {
//DEBUG: MainActivity.info("Using v2: " + KEYSTORE_WIGLE_CREDS_KEY_V2);
return getApiTokenVersion2(prefs);
} else if (keyStore.containsAlias(KEYSTORE_WIGLE_CREDS_KEY_V1)) {
privateKeyEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry(KEYSTORE_WIGLE_CREDS_KEY_V1, null);
} else if (keyStore.containsAlias(KEYSTORE_WIGLE_CREDS_KEY_V0)) {
privateKeyEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry(KEYSTORE_WIGLE_CREDS_KEY_V0, null);
versionThreshold = Build.VERSION_CODES.JELLY_BEAN_MR2;
} else {
Logging.warn("[TOKEN] Compatible build, but no key set: " +
android.os.Build.VERSION.SDK_INT + " - returning plaintext.");
return prefs.getString(PreferenceKeys.PREF_TOKEN, "");
}
}


if (null != privateKeyEntry) {
String encodedCypherText = prefs.getString(PreferenceKeys.PREF_TOKEN, "");
if (!encodedCypherText.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ public void handleMessage( final Message msg ) {
if (dialog != null) {
try {
//DEBUG: Logging.info("fragment from dialog: " + dialog);
dialog.dismiss();
if (null != dialog && dialog.isVisible()) {
dialog.dismiss();
}
} catch ( Exception ex ) {
// you can't dismiss what isn't there
Logging.error( "exception dismissing fm dialog: " + ex );
Expand Down Expand Up @@ -326,7 +328,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog ad = builder.create();
ad.setButton( DialogInterface.BUTTON_POSITIVE, "OK", (dialog, which) -> {
try {
dialog.dismiss();
if (null != dialog) {
dialog.dismiss();
}
} catch ( Exception ex ) {
// guess it wasn't there anyways
Logging.info( "exception dismissing alert dialog: " + ex );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public void implantMxcDatabase(final Context context, final Boolean isFinishing)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (null != dialog) {
dialog.dismiss();
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class NetworkBubbleDrawable extends Drawable {

@SuppressLint("UseCompatLoadingForDrawables") //ALIBI: lifted from the original
public NetworkBubbleDrawable(Resources res) {
this.mMask = res.getDrawable(R.drawable.amu_bubble_mask);
this.mShadow = res.getDrawable(R.drawable.amu_bubble_shadow);
this.mMask = res.getDrawable(com.google.maps.android.R.drawable.amu_bubble_mask);
this.mShadow = res.getDrawable(com.google.maps.android.R.drawable.amu_bubble_shadow);
}
public void setColor(int color) {
this.mColor = color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public class NetworkIconGenerator {
public NetworkIconGenerator(Context context) {
mContext = context;
mBackground = new NetworkBubbleDrawable(this.mContext.getResources());
mContainer = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.amu_text_bubble, null);
mContainer = (ViewGroup) LayoutInflater.from(mContext).inflate(com.google.maps.android.R.layout.amu_text_bubble, null);
mRotationLayout = (RotationLayout) mContainer.getChildAt(0);
mContentView = mTextView = (TextView) mRotationLayout.findViewById(R.id.amu_text);
mContentView = mTextView = (TextView) mRotationLayout.findViewById(com.google.maps.android.R.id.amu_text);
setStyle(STYLE_DEFAULT);
}

Expand Down Expand Up @@ -123,7 +123,7 @@ public void setContentView(View contentView) {
mRotationLayout.removeAllViews();
mRotationLayout.addView(contentView);
mContentView = contentView;
final View view = mRotationLayout.findViewById(R.id.amu_text);
final View view = mRotationLayout.findViewById(com.google.maps.android.R.id.amu_text);
mTextView = view instanceof TextView ? (TextView) view : null;
}

Expand Down Expand Up @@ -210,14 +210,14 @@ private static int getTextStyle(int style) {
case 1:
case 2:
default:
return R.style.amu_Bubble_TextAppearance_Dark; //style.amu_Bubble_TextAppearance_Dark;
return com.google.maps.android.R.style.amu_Bubble_TextAppearance_Dark; //style.amu_Bubble_TextAppearance_Dark;
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
return R.style.amu_Bubble_TextAppearance_Light;//style.amu_Bubble_TextAppearance_Light;
return com.google.maps.android.R.style.amu_Bubble_TextAppearance_Light;//style.amu_Bubble_TextAppearance_Light;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity();
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setCancelable(true);
builder.setTitle("Confirmation"); //TODO: literal string
final String checkboxLabel = getArguments().getString("checkboxLabel");
if (null != checkboxLabel) {
View checkBoxView = View.inflate(activity, R.layout.checkbox, null);
CheckBox checkBox = checkBoxView.findViewById(R.id.checkbox);
checkBox.setText(checkboxLabel);
builder.setView(checkBoxView);
final String confirmString = getString(R.string.dialog_confirm);
builder.setTitle(confirmString);
Bundle arguments = getArguments();
if (null != arguments) {
final String checkboxLabel = arguments.getString("checkboxLabel");
if (null != checkboxLabel) {
View checkBoxView = View.inflate(activity, R.layout.checkbox, null);
CheckBox checkBox = checkBoxView.findViewById(R.id.checkbox);
checkBox.setText(checkboxLabel);
builder.setView(checkBoxView);
}
}
final String persistPrefKey = getArguments().getString("persistPref");
final String persistPrefAgreeValue = getArguments().getString("persistPrefAgreeValue");
Expand All @@ -90,17 +94,20 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

final AlertDialog ad = builder.create();
// ok
ad.setButton(DialogInterface.BUTTON_POSITIVE, activity.getString(R.string.ok), (dialog, which) -> {
final String okString = (null != activity) ? activity.getString(R.string.ok) : "OK";
ad.setButton(DialogInterface.BUTTON_POSITIVE, okString, (dialog, which) -> {
try {
if (null != persistPrefKey) {
CheckBox checkBox = ((AlertDialog) dialog).findViewById(R.id.checkbox);
if (checkBox.isChecked()) {
if (checkBox.isChecked() && prefs != null) {
final SharedPreferences.Editor editor = prefs.edit();
editor.putString(persistPrefKey, persistPrefAgreeValue);
editor.apply();
}
}
dialog.dismiss();
if (null != dialog) {
dialog.dismiss();
}
final Activity activity1 = getActivity();
if (activity1 == null) {
Logging.info("activity is null in dialog. tabPos: " + tabPos + " dialogId: " + dialogId);
Expand All @@ -113,7 +120,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
final Fragment fragment = fragmentManager.findFragmentByTag(MainActivity.FRAGMENT_TAG_PREFIX + tabPos);
if (fragment == null) {
Logging.error("null fragment for: " + String.format("0x%08X", tabPos) + " (" + maybeName + ")");
//TODO: might behoove us to show an error here
//ALIBI: how would we show an error here with a null fragment?
} else {
((DialogListener) fragment).handleDialog(dialogId);
}
Expand All @@ -128,7 +135,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
});

// cancel
ad.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getString(R.string.cancel), (dialog, which) -> {
final String cancelString = (null != activity) ? activity.getString(R.string.cancel) : "Cancel";
ad.setButton(DialogInterface.BUTTON_NEGATIVE, cancelString, (dialog, which) -> {
try {
if (null != persistPrefKey) {
CheckBox checkBox = ((AlertDialog) dialog).findViewById(R.id.checkbox);
Expand All @@ -138,14 +146,17 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
editor.apply();
}
}
dialog.dismiss();
if (null != dialog) {
dialog.dismiss();
}
} catch (Exception ex) {
// guess it wasn't there anyways
Logging.info("exception dismissing fragment alert dialog: ", ex);
}
});
return ad;
}

public static void createConfirmation(final FragmentActivity activity, final String message,
final int tabPos, final int dialogId) {
try {
Expand Down Expand Up @@ -181,6 +192,4 @@ public static void createCheckboxConfirmation(final FragmentActivity activity, f
Logging.error(errorMessage, ex);
}
}


}
2 changes: 1 addition & 1 deletion wiglewifiwardriving/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<string name="maxout_maxid_text">Sæt max kør til:</string>
<string name="csv_run_export_button">Start CSV Eksport</string>
<string name="csv_run_export_text">Eksport aktuelle forløb til CSV-fil</string>
<string name="csv_export_button">CSV Eksport til DB</string>
<string name="csv_export_button">CSV Eksport fra DB</string>
<string name="csv_export_text">Eksportere hele DB til CSV fil</string>
<string name="kml_run_export_button">Start KML Eksport</string>
<string name="kml_run_export_text">Eksport aktuelle forløb til KML-fil</string>
Expand Down
1 change: 1 addition & 0 deletions wiglewifiwardriving/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,5 @@
<string name="start_survey">Site Survey</string>
<string name="end_survey">End Survey</string>
<string name="confirm_survey">You MUST click \"%1$s\" to complete the survey and save your results before exiting the activity!\n\n We recommend setting \"%2$s\" scanning under settings for your travel speed for best results. (This WILL have battery consequences)</string>
<string name="dialog_confirm">Confirm</string>
</resources>

0 comments on commit 8978a62

Please sign in to comment.