Skip to content

Commit

Permalink
Merge pull request #235 from rectangle-dbmi/default
Browse files Browse the repository at this point in the history
Merge default with beta release
  • Loading branch information
epicstar committed Nov 9, 2015
2 parents 56fe3cb + 44324a9 commit d28f4ab
Show file tree
Hide file tree
Showing 16 changed files with 829 additions and 334 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ apks/
/app/apks
/app/src/debug/res/values/google_maps_api.xml
/app/src/release/res/values/google_maps_api.xml
/app/src/main/java/rectangledbmi/com/pittsburghrealtimetracker/hidden/
/app/build/
/build/
/local.properties
2 changes: 1 addition & 1 deletion Realtime-Port-Authority.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
Expand Down
45 changes: 26 additions & 19 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/retrolambda/debug" />
<output-test url="file://$MODULE_DIR$/build/retrolambda/debugAndroidTest" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
Expand Down Expand Up @@ -71,13 +71,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.8.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/7.8.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/7.8.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.squareup.leakcanary/leakcanary-android/1.3.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.reactivex/rxandroid/1.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
Expand All @@ -93,26 +96,30 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/retrolambda" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="haha-1.3" level="project" />
<orderEntry type="library" exported="" name="play-services-location-8.3.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="palette-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-8.3.0" level="project" />
<orderEntry type="library" exported="" name="rxandroid-1.0.1" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="design-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-location-7.8.0" level="project" />
<orderEntry type="library" exported="" name="design-23.1.0" level="project" />
<orderEntry type="library" exported="" name="leakcanary-android-1.3.1" level="project" />
<orderEntry type="library" exported="" name="leakcanary-watcher-1.3.1" level="project" />
<orderEntry type="library" exported="" name="javax.annotation-10.0-b28" level="project" />
<orderEntry type="library" exported="" name="mediarouter-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.0.15" level="project" />
<orderEntry type="library" exported="" name="play-services-maps-8.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-8.3.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="mediarouter-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="leakcanary-analyzer-1.3.1" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.0.14" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-maps-7.8.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-7.8.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
</component>
</module>
54 changes: 42 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.application'


//must define PAT_API_KEY in gradle.properties by adding pat_api=<KEY> on the last line non-commented
def PAT_API_KEY = '"' + pat_api + '"' ?: '"Define Port Authority TrueTime API Key in gradle.properties"';

Expand All @@ -10,13 +11,13 @@ android.buildTypes.each { type ->
android {

compileSdkVersion 23
buildToolsVersion '23.0.1'
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "rectangledbmi.com.pittsburghrealtimetracker"
minSdkVersion 16
targetSdkVersion 23
versionCode 54
versionName "4.8"
versionCode 55
versionName "5.0"
}
buildTypes {

Expand All @@ -25,33 +26,62 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

}

repositories {
mavenCentral()
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
repositories {
mavenCentral()
}

//google play services maps
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
//google play services location and places
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.google.android.gms:play-services-location:8.3.0'

compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:design:23.0.1';
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0';
compile 'com.android.support:appcompat-v7:23.1.0'

compile 'com.android.support:mediarouter-v7:23.0.1'
compile 'com.android.support:mediarouter-v7:23.1.0'

//3rd party android libraries
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxjava:1.0.15'

compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'org.glassfish:javax.annotation:10.0-b28'


debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}

buildscript {
repositories {
mavenCentral()
jcenter()
}

dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.3' // use some java 8 syntax in the project
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3' // check for updates of 3rd party libs
}
}

// Required because retrolambda is on maven central
repositories {
jcenter()
mavenCentral()
}

apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.github.ben-manes.versions'
184 changes: 184 additions & 0 deletions app/src/main/java/io/paour/github/natorder/NaturalOrderComparator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
package io.paour.github.natorder; // epicstar - changed to bring natural order comparator to app...

/*
NaturalOrderComparator.java -- Perform 'natural order' comparisons of strings in Java.
Copyright (C) 2003 by Pierre-Luc Paour <[email protected]>
Based on the C version by Martin Pool, of which this is more or less a straight conversion.
Copyright (C) 2000 by Martin Pool <[email protected]>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

import java.util.*;

public class NaturalOrderComparator<T> implements Comparator<T> // epicstar: change to abide by Generic Rules
{
int compareRight(String a, String b)
{
int bias = 0;
int ia = 0;
int ib = 0;

// The longest run of digits wins. That aside, the greatest
// value wins, but we can't know that it will until we've scanned
// both numbers to know that they have the same magnitude, so we
// remember it in BIAS.
for (;; ia++, ib++)
{
char ca = charAt(a, ia);
char cb = charAt(b, ib);

if (!Character.isDigit(ca) && !Character.isDigit(cb))
{
return bias;
}
else if (!Character.isDigit(ca))
{
return -1;
}
else if (!Character.isDigit(cb))
{
return +1;
}
else if (ca < cb)
{
if (bias == 0)
{
bias = -1;
}
}
else if (ca > cb)
{
if (bias == 0)
bias = +1;
}
else if (ca == 0 && cb == 0)
{
return bias;
}
}
}

public int compare(T o1, T o2)
{
String a = o1.toString();
String b = o2.toString();

int ia = 0, ib = 0;
int nza = 0, nzb = 0;
char ca, cb;
int result;

while (true)
{
// only count the number of zeroes leading the last number compared
nza = nzb = 0;

ca = charAt(a, ia);
cb = charAt(b, ib);

// skip over leading spaces or zeros
while (Character.isSpaceChar(ca) || ca == '0')
{
if (ca == '0')
{
nza++;
}
else
{
// only count consecutive zeroes
nza = 0;
}

ca = charAt(a, ++ia);
}

while (Character.isSpaceChar(cb) || cb == '0')
{
if (cb == '0')
{
nzb++;
}
else
{
// only count consecutive zeroes
nzb = 0;
}

cb = charAt(b, ++ib);
}

// process run of digits
if (Character.isDigit(ca) && Character.isDigit(cb))
{
if ((result = compareRight(a.substring(ia), b.substring(ib))) != 0)
{
return result;
}
}

if (ca == 0 && cb == 0)
{
// The strings compare the same. Perhaps the caller
// will want to call strcmp to break the tie.
return nza - nzb;
}

if (ca < cb)
{
return -1;
}
else if (ca > cb)
{
return +1;
}

++ia;
++ib;
}
}

static char charAt(String s, int i)
{
if (i >= s.length())
{
return 0;
}
else
{
return s.charAt(i);
}
}

public static void main(String[] args)
{
String[] strings = new String[] { "1-2", "1-02", "1-20", "10-20", "fred", "jane", "pic01",
"pic2", "pic02", "pic02a", "pic3", "pic4", "pic 4 else", "pic 5", "pic05", "pic 5",
"pic 5 something", "pic 6", "pic 7", "pic100", "pic100a", "pic120", "pic121",
"pic02000", "tom", "x2-g8", "x2-y7", "x2-y08", "x8-y8" };

List orig = Arrays.asList(strings);

System.out.println("Original: " + orig);

List scrambled = Arrays.asList(strings);
Collections.shuffle(scrambled);

System.out.println("Scrambled: " + scrambled);

Collections.sort(scrambled, new NaturalOrderComparator());

System.out.println("Sorted: " + scrambled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
Button negBut = (Button) view.findViewById(R.id.info_dismiss);
negBut.setBackgroundColor(getResources().getColor(R.color.blue_500_trans));
negBut.setTextColor(Color.WHITE);
negBut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
negBut.setOnClickListener(v -> dismiss());

//Set title
builder.setTitle(title);
Expand Down
Loading

0 comments on commit d28f4ab

Please sign in to comment.