Skip to content

Commit

Permalink
Bustime V3 Hardcoded (#340)
Browse files Browse the repository at this point in the history
* bustimeV3: fix javax.annotation import, switch to V3 and hard code rtpidatafeed=Port%20Authority%20Bus into the api calls

* bustimeV3: targetSdk to 30

* bustimeV3: just add https to a url

* bustimeV3: update kotlin, jcenter to mavenCentral

* bustimeV3: update versions, move to androidx

* bustimeV3: update more versions

* bustimeV3: remove jcenter...

* bustimeV3: add gradle.properties

* bustimeV3: update timber

* bustimeV3: update okHttp to 3.14.9

* update to 9.0.0

* downgrade to retrofit 2.7.2

* update to jdk 11 in github action

* update to mockito 3.12.4

Co-authored-by: Michael Antonacci <[email protected]>
  • Loading branch information
epicstar and mikeantonacci authored Oct 30, 2021
1 parent ecc7644 commit 9715c93
Show file tree
Hide file tree
Showing 34 changed files with 123 additions and 95 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
- name: set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Build with Gradle
env:
PAT_BASE_URL: ${{ secrets.PAT_BASE_URL }}
Expand Down
2 changes: 1 addition & 1 deletion Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ This data changes every 10 seconds!
- `sudo apt-get install android-studio`
4. Install the update that pops up (would be 1.0.2)
5. Install the SDK Manager and install
- API 28 to the most recent (29 atm)
- API 21 to the most recent (30 atm)
- Google Play Services
- Google Repositories
- ... pretty much everything kinda a little
Expand Down
31 changes: 19 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId "rectangledbmi.com.pittsburghrealtimetracker"
minSdkVersion versions.android.minSdk
targetSdkVersion versions.android.targetSdk
versionCode 160080002
versionName "8.0.2-beta"
versionCode 160090000
versionName "9.0.0-alpha"
}
lintOptions {
warning 'InvalidPackage'
Expand All @@ -43,7 +43,10 @@ android {
sourceSets {
main.java.srcDirs += "src/main/kotlin"
}
buildToolsVersion '29.0.3'
buildToolsVersion '30.0.2'
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
Expand All @@ -60,14 +63,16 @@ dependencies {
implementation "com.google.android.gms:play-services-maps:${versions.google.play}"
//google play services location and places
implementation "com.google.android.gms:play-services-location:${versions.google.play}"
implementation "com.google.android.gms:play-services-places:${versions.google.play}"
implementation "com.google.android.gms:play-services-places:${versions.google.places}"

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'

implementation "com.android.support:support-v4:${versions.android.support}"
implementation "com.android.support:design:${versions.android.support}"
implementation "com.android.support:appcompat-v7:${versions.android.support}"
implementation "com.android.support:recyclerview-v7:${versions.android.support}"
implementation 'androidx.mediarouter:mediarouter:1.2.5'

implementation "com.android.support:mediarouter-v7:${versions.android.support}"
implementation "androidx.fragment:fragment-ktx:1.3.6"

//3rd party android libraries
implementation "com.github.pwittchen:reactivenetwork-rx2:${versions.rx.network}"
Expand All @@ -79,12 +84,14 @@ dependencies {
implementation "io.reactivex.rxjava2:rxjava:${versions.rx.java2}"

debugImplementation "com.squareup.leakcanary:leakcanary-android:${versions.square.leakCanary}"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${versions.square.leakCanary}"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${versions.square.leakCanary}"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${versions.square.leakCanary_no_op}"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${versions.square.leakCanary_no_op}"

testImplementation "junit:junit:${versions.test.junit}"
testImplementation "org.mockito:mockito-core:${versions.test.mockito}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.glassfish:javax.annotation:10.0-b28'

}

buildscript {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
android:installLocation="auto"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />

<activity
android:name=".ui.MainActivity"
android:label="@string/app_name" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PATTrackApplication : Application() {

private class CrashTree : Timber.Tree() {

override fun log(priority: Int, tag: String?, message: String?, t: Throwable?) {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (tag == null || message == null) return

when (priority) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package rectangledbmi.com.pittsburghrealtimetracker.ui

import android.app.AlertDialog
import androidx.appcompat.app.AlertDialog
import android.content.DialogInterface
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.preference.PreferenceManager
import android.provider.Settings
import android.support.design.widget.Snackbar
import android.support.v4.widget.DrawerLayout
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import com.google.android.material.snackbar.Snackbar
import androidx.drawerlayout.widget.DrawerLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import android.view.Menu
import android.view.MenuItem
import android.view.View
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package rectangledbmi.com.pittsburghrealtimetracker.ui.about

import android.app.Fragment
import androidx.fragment.app.Fragment
import android.content.pm.PackageManager
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import android.view.Menu
Expand All @@ -15,14 +15,13 @@ import android.widget.TextView
import rectangledbmi.com.pittsburghrealtimetracker.R


@Suppress("RedundantOverride")
class AboutActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_about)
if (savedInstanceState == null) {
fragmentManager.beginTransaction()
supportFragmentManager.beginTransaction()
.add(R.id.container, PlaceholderFragment())
.commit()
}
Expand Down Expand Up @@ -62,7 +61,7 @@ class AboutActivity : AppCompatActivity() {
fbLink.movementMethod = LinkMovementMethod.getInstance()
gitLink.movementMethod = LinkMovementMethod.getInstance()
emailLink.movementMethod = LinkMovementMethod.getInstance()
val versionText = getString(R.string.version_prefix) + " " + activity.packageManager.getPackageInfo(activity.packageName, 0).versionName
val versionText = getString(R.string.version_prefix) + " " + requireActivity().packageManager.getPackageInfo(requireActivity().packageName, 0)?.versionName
version.text = versionText
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import android.graphics.*
import android.location.Location
import android.os.Build
import android.os.Bundle
import android.support.annotation.RequiresApi
import android.support.design.widget.Snackbar
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
import androidx.annotation.RequiresApi
import com.google.android.material.snackbar.Snackbar
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
Expand Down Expand Up @@ -406,16 +406,20 @@ class BusMapFragment : SelectionFragment(), ConnectionCallbacks, OnConnectionFai
patApiService = busListInteraction?.patApiService
Timber.d("PAT API client set")
// center the map
if (cameraPosition != null) {
Timber.d("map was instantiated from a recreation (orientation change, etc.)")
mMap?.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
zoomSubject?.onNext(cameraPosition?.zoom ?: defaultZoom)
enableGoogleMapLocation()
} else {
Timber.d("Map was instantiated from a clean state. Centering the map on Pittsburgh and possibly on you")
mMap?.moveCamera(CameraUpdateFactory.newLatLngZoom(PITTSBURGH, defaultZoom))
centerMapWithPermissions()
when(val it = cameraPosition){
null -> {
Timber.d("Map was instantiated from a clean state. Centering the map on Pittsburgh and possibly on you")
mMap?.moveCamera(CameraUpdateFactory.newLatLngZoom(PITTSBURGH, defaultZoom))
centerMapWithPermissions()
}
else -> {
Timber.d("map was instantiated from a recreation (orientation change, etc.)")
mMap?.moveCamera(CameraUpdateFactory.newCameraPosition(it))
zoomSubject?.onNext(cameraPosition?.zoom ?: defaultZoom)
enableGoogleMapLocation()
}
}

activity?.let { mMap?.setInfoWindowAdapter(ETAWindowAdapter(it.layoutInflater)) }
mMap?.setOnCameraIdleListener {
cameraPosition = mMap?.cameraPosition
Expand Down Expand Up @@ -542,7 +546,7 @@ class BusMapFragment : SelectionFragment(), ConnectionCallbacks, OnConnectionFai
return@flatMap route.route?.let { rt ->
Timber.d("removing all %s's", rt)
Flowable.fromIterable<Map.Entry<Int, Marker>>(busMarkers?.entries)
.filter { busMarker: Map.Entry<Int, Marker> -> busMarker.value.title.contains(rt) }
.filter { busMarker: Map.Entry<Int, Marker> -> busMarker.value.title?.contains(rt) ?: false }
}
}
?.subscribeWith(object : DisposableSubscriber<Map.Entry<Int?, Marker?>?>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import android.content.res.Configuration
import android.graphics.Color
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.app.Fragment
import android.support.v4.view.GravityCompat
import android.support.v4.widget.DrawerLayout
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import androidx.fragment.app.Fragment
import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package rectangledbmi.com.pittsburghrealtimetracker.ui.selection
*/

import android.content.DialogInterface
import android.support.v4.app.Fragment
import androidx.fragment.app.Fragment
import android.view.View

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.app.Dialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatDialogFragment
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment

import rectangledbmi.com.pittsburghrealtimetracker.R

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AndroidWifiChecker constructor(context: Context): WifiChecker {

override fun isWifiOn(): Boolean {
val networkInfo = connectivityManager.activeNetworkInfo
return networkInfo.type == ConnectivityManager.TYPE_WIFI
return networkInfo?.type == ConnectivityManager.TYPE_WIFI
}

}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_select_transit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
Expand Down Expand Up @@ -44,4 +44,4 @@
android:name="rectangledbmi.com.pittsburghrealtimetracker.ui.selection.NavigationDrawerFragment"
tools:layout="@layout/navigation_drawer_layout" />

</android.support.v4.widget.DrawerLayout>
</androidx.drawerlayout.widget.DrawerLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/bus_route_recycler_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme"
android:background="?android:selectableItemBackground"
android:background="?attr/selectableItemBackground"
android:padding="8dp"

>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
Expand All @@ -15,7 +16,7 @@
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
app:srcCompat="@drawable/ic_launcher"
android:contentDescription="Logo"
android:paddingRight="10dp"/>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/navigation_drawer_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:id="@+id/new_navigation_drawer"
>

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/bus_list_recyclerview"
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 @@ -366,7 +366,7 @@
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="detour_info">Detour Information</string>
<string name="clear_cache">Clear Route Cache</string>
<string name="detour_url">http://www.portauthority.org/Detours/</string>
<string name="detour_url">https://www.portauthority.org/Detours/</string>
<string name="servers_down_title">No buses?</string>
<string name="servers_down_description">Wondering why there may be no buses on the map right now?\n\nThat is because Port Authority\'s servers may be down.\n\nWhile this issue is out of our control, we\'ll give you a status update ASAP.</string>
<string name="servers_down_tell_me_more_button">What? Tell me more!</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">@color/grey_400</item>
<item name="background">@color/grey_400</item>
</style>
<style name="AboutHeader">
<item name="android:textSize">16sp</item>
Expand Down
Loading

0 comments on commit 9715c93

Please sign in to comment.