Skip to content

Commit

Permalink
#317: add dialog to say app may not work every time the app opens
Browse files Browse the repository at this point in the history
  • Loading branch information
epicstar committed May 24, 2017
1 parent d90dc57 commit 69543ea
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "rectangledbmi.com.pittsburghrealtimetracker"
minSdkVersion 16
targetSdkVersion 23
versionCode 77
versionName "7.0.4"
versionCode 78
versionName "7.0.5"
}
lintOptions {
warning 'InvalidPackage'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package rectangledbmi.com.pittsburghrealtimetracker;

import android.Manifest;
import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -65,6 +66,7 @@
import rectangledbmi.com.pittsburghrealtimetracker.retrofit.patapi.containers.errors.ErrorMessage;
import rectangledbmi.com.pittsburghrealtimetracker.retrofit.patapi.containers.vehicles.VehicleBitmap;
import rectangledbmi.com.pittsburghrealtimetracker.selection.RouteSelection;
import rectangledbmi.com.pittsburghrealtimetracker.ui.serverdown.ServerDownDialogFragment;
import rectangledbmi.com.pittsburghrealtimetracker.world.Route;
import rectangledbmi.com.pittsburghrealtimetracker.world.TransitStopCollection;
import rectangledbmi.com.pittsburghrealtimetracker.world.jsonpojo.BustimeVehicleResponse;
Expand Down Expand Up @@ -221,6 +223,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onResume() {
super.onResume();
ServerDownDialogFragment.newInstance().show(getFragmentManager(), getString(R.string.servers_down_title));
Timber.d("resuming map fragment");
if (mapView != null) {
mapView.onResume();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package rectangledbmi.com.pittsburghrealtimetracker.ui.serverdown;

import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatDialogFragment;

import rectangledbmi.com.pittsburghrealtimetracker.R;

/**
* Dialog to tell users that the app is down.
* Created by epicstar on 5/23/17.
* @since 78
*/

public class ServerDownDialogFragment extends AppCompatDialogFragment {

public static ServerDownDialogFragment newInstance() {
return new ServerDownDialogFragment();
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstance) {
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext(), R.style.Theme_AppCompat_Dialog_Alert);
dialog.setTitle(R.string.servers_down_title);
dialog.setMessage(R.string.servers_down_description);
dialog.setNegativeButton(R.string.servers_down_dismiss, (dialog1, which) -> dismiss());
dialog.setPositiveButton(R.string.servers_down_tell_me_more_button, (dialog1, which) -> {
Uri url = Uri.parse("https://github.com/rectangle-dbmi/Realtime-Port-Authority/wiki/Port-Authority-Server-Downtimes");
Intent internetBrowser = new Intent(Intent.ACTION_VIEW, url);
startActivity(internetBrowser);
});
return dialog.create();
}

@Override
public void onPause() {
super.onPause();
dismiss();
}
}
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,8 @@
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="detour_info">Detour Information</string>
<string name="detour_url">http://www.portauthority.org/paac/SchedulesMaps/Detours.aspx</string>
<string name="servers_down_title">No buses?</string>
<string name="servers_down_description">Wondering why no buses have been on the map for the past 4 weeks?\n\nThis is because Port Authority\'s realtime data servers have been down.\n\nWhile this issue is out of our control, we\'ll give you an update ASAP.</string>
<string name="servers_down_tell_me_more_button">What? Tell me more!</string>
<string name="servers_down_dismiss">OK</string>
</resources>

0 comments on commit 69543ea

Please sign in to comment.