Skip to content

Commit

Permalink
Merge pull request #1 from rzhao271/rzhao271/fix-warnings
Browse files Browse the repository at this point in the history
Upgrade to SDK version 33
  • Loading branch information
rzhao271 authored Dec 3, 2022
2 parents d6709d1 + 0d71546 commit 3c22fca
Show file tree
Hide file tree
Showing 29 changed files with 259 additions and 247 deletions.
136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Created by https://www.toptal.com/developers/gitignore/api/androidstudio
# Edit at https://www.toptal.com/developers/gitignore?templates=androidstudio

### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.

# Built application files
*.apk
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle
.gradle/
build/

# Signing files
.signing/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
captures/
.navigation/
*.ipr
*~
*.swp

# Keystore files
*.jks
*.keystore

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Android Patch
gen-external-apklibs

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# NDK
obj/

# IntelliJ IDEA
*.iml
*.iws
/out/

# User-specific configurations
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/assetWizardSettings.xml
.idea/gradle.xml
.idea/jarRepositories.xml
.idea/navEditor.xml

# Legacy Eclipse project files
.classpath
.project
.cproject
.settings/

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.ear

# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
hs_err_pid*

## Plugin-specific files:

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Mongo Explorer plugin
.idea/mongoSettings.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### AndroidStudio Patch ###

!/gradle/wrapper/gradle-wrapper.jar

# End of https://www.toptal.com/developers/gitignore/api/androidstudio
84 changes: 0 additions & 84 deletions AndroidUtils/AndroidUtils.iml

This file was deleted.

10 changes: 5 additions & 5 deletions AndroidUtils/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 8
buildToolsVersion "19.1.0"

namespace 'com.superliminal.util.android'
compileSdk 33
buildToolsVersion '33.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
minSdk 33
targetSdk 33
}

buildTypes {
Expand Down
4 changes: 0 additions & 4 deletions AndroidUtils/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.superliminal.util.android"
android:versionCode="2"
android:versionName="1.1">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ public void setColorComponents(float[] rgb) {
}

public static Color decode(String str) {
System.out.println("Color.decode() not yet implemented.");
if (str.startsWith("#")) {
// parse hex
int r = Integer.parseInt(str.substring(1, 3), 16);
int g = Integer.parseInt(str.substring(3, 5), 16);
int b = Integer.parseInt(str.substring(5, 7), 16);
return new Color(r / 255.0f, g / 255.0f, b / 255.0f);
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,18 @@ public static Color[] generateVisuallyDistinctColors(int ncolors, float minCompo

// HACK!
if(ncolors == 8) {
// Use HSC colours
// Cell order: I D F L R B U O
return new Color[] {
Color.blue, Color.cyan, new Color(.5f,.4f,.2f), Color.red,
Color.yellow, new Color(.5f, 0, 1), Color.rose, Color.brown};
Color.decode("#8822CC"), // purple
Color.decode("#88EE66"), // light green
Color.decode("#FFFFFF"), // white
Color.decode("#FF9922"), // orange
Color.decode("#CC3333"), // red
Color.decode("#FFFF00"), // yellow
Color.decode("#33AAFF"), // light blue
Color.decode("#FF66FF") // pink
};
}

float[][] yuv = new float[ncolors][3];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.superliminal.util.android;

import static android.text.Html.FROM_HTML_MODE_LEGACY;

import android.app.AlertDialog;
import android.content.Context;
import android.text.Html;
Expand All @@ -13,8 +15,8 @@ public class DialogUtils {
// From workaround at http://stackoverflow.com/questions/1997328/android-clickable-hyperlinks-in-alertdialog
public static void showHTMLDialog(Context context, String html) {
// Linkify the message
final SpannableString s = new SpannableString(Html.fromHtml(html));
Linkify.addLinks(s, Linkify.ALL);
final SpannableString s = new SpannableString(Html.fromHtml(html, FROM_HTML_MODE_LEGACY));
Linkify.addLinks(s, Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
final AlertDialog d = new AlertDialog.Builder(context)
.setPositiveButton(android.R.string.ok, null)
//.setIcon(R.drawable.icon)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,4 @@ public static Cursor buildFilteredStringListCursor(String[] strings, String filt
cursor.addRow(new Object[]{"" + row++, string});
return cursor;
}

/**
* Base implementation of contacts search.
*
* @return A managed cursor of contacts for the given activity and optional String prefix.
*/
public static Cursor buildFilteredCursor(Activity activity, String prefix, String dataKind, Uri uri) {
String my_sort_order = null;
String my_selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'";
if(prefix != null)
my_selection += " AND " + ContactsContract.Contacts.DISPLAY_NAME + " LIKE '" + prefix + "%'";
String[] eproj = new String[]{
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
dataKind};
return activity.managedQuery(uri, eproj, my_selection, null, my_sort_order);
}

public static Cursor buildFilteredEmailCursor(Activity activity, String prefix) {
Uri email_uri = android.provider.ContactsContract.CommonDataKinds.Email.CONTENT_URI;
String email_kind = ContactsContract.CommonDataKinds.Email.DATA;
return buildFilteredCursor(activity, prefix, email_kind, email_uri);
}

public static Cursor buildFilteredPhoneCursor(Activity activity, String prefix) {
Uri phone_uri = android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
String phone_kind = ContactsContract.CommonDataKinds.Phone.DATA;
return buildFilteredCursor(activity, prefix, phone_kind, phone_uri);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.superliminal.util.android;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.ProgressBar;
Expand Down Expand Up @@ -99,7 +100,11 @@ private void postException(GUITask task, Throwable t) {
postMessage(HANDLE_EXCEPTION, new GUITaskWithSomething<Throwable>(task, t));
}

private class MyHandler extends Handler {
private static class MyHandler extends Handler {
MyHandler() {
super(Looper.getMainLooper());
}

@Override
public void handleMessage(Message msg) {
switch (msg.what) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public void onMeasure(int wSpec, int hSpec) {
{
addView(child,
new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT));
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT));
addView(new Button(context) {
@Override
protected void onDraw(Canvas canvas) {
Expand Down
Loading

0 comments on commit 3c22fca

Please sign in to comment.