Skip to content

Instantly share code, notes, and snippets.

@daniellevass
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniellevass/5f65e884329d977d91c3 to your computer and use it in GitHub Desktop.
Save daniellevass/5f65e884329d977d91c3 to your computer and use it in GitHub Desktop.
BRLSI app

BRLSI Android App

So the Bath Royal Literary and Scientific Institution have three trials around Bath for this summer - they'd really like it turned into an app and the tourist center have said they'd already publicise about it 😄

The three trials are:

  1. Science Trial - https://www.dropbox.com/s/0m171oe51jb38f7/Science%20Trail%202.pdf?dl=0
  2. Tree Trial - https://www.dropbox.com/s/fjiroz7t2fyzijk/tree%20trail%20printer%203.pdf?dl=0
  3. Adelard Trial - https://www.dropbox.com/s/tj3egsjxcsg16sg/BRLSI%20TRAIL%20Adelard%204.pdf?dl=0

###1

Your first task is to pick between you guys whose going to do which trial - and make a seperate app for each - I'll help you turn it into one app at the end of the week.

###2

Create a spreadsheet (google sheets?) and have a row for the following:

  • number (e.g. 1, 2, 3,)
  • coordinates (lat/long - there are websites to help you work out coordinates you want)
  • title (maximum of like 50 characters)
  • description (the more information bit)

###3 GitHub Repo

Set up a GitHub Repo so you can all work together - make a different folder for each of your apps and remember to commit when you've made a thing work!

###4 Android Map App

Create an android app with a map - it's one of the things you can do when you create a new app. Part A is to zoom in on Bath to start. Part B is to create an array of your coordinates (from your spreadsheet) - and place them as markers on the map - you'll need to help each other out here. Part C is to customise each map pin to say the number it is - so they aren't all the same!

Help on Android maps - https://developers.google.com/maps/documentation/android/ help on customising android map pins - https://developers.google.com/maps/documentation/android/marker

#####Good Luck!

@manmadeharp
Copy link

scienceTrial.add(new MapInformationObject(1,"science", "Dr William Oliver", "name\n\ndate\n\nOliver became the leading physician in the city and a founder of the Mineral Water Hospital.\n " +
"His wrote a book on the water of Bath with an emphasis on drinking as well as bathing, and this helped increase the attract of the city to visitors.\n " +
"His interest in diet and health led to the invention of the famous Bath Oliver biscuit.\n", 0.0f, 0.0f));

@daniellevass
Copy link
Author

private Bitmap drawCircle(int number, String colour, boolean textBlack){

        Bitmap.Config conf = Bitmap.Config.ARGB_8888;
        Bitmap bmp = Bitmap.createBitmap(40, 40, conf);
        Canvas canvas = new Canvas(bmp);

        //draw a circle
        Paint color = new Paint();
        color.setColor(Color.parseColor(colour));
        canvas.drawCircle(20, 20, 20, color);

        //draw text
        if (textBlack){
            color.setColor(Color.BLACK);
        } else {
            color.setColor(Color.WHITE);
        }


        color.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));

        if (number < 10){
            color.setTextSize(25);
            canvas.drawText(Integer.toString(number), 15, 30, color);
        } else {
            color.setTextSize(18);
            canvas.drawText(Integer.toString(number), 10, 27, color);
        }

        return bmp;
    }
mMap.addMarker(new MarkerOptions().position(new LatLng(10.0f, 20.0f))
                        .icon(BitmapDescriptorFactory.fromBitmap(drawCircle(13, "#1976D2",false)))
                        .title("title")
        );

@daniellevass
Copy link
Author

//in oncreate
mMap.setOnInfoWindowClickListener(getInfoWindowClickListener());
//below oncreate
 public GoogleMap.OnInfoWindowClickListener getInfoWindowClickListener()
    {
        return new GoogleMap.OnInfoWindowClickListener()
        {
            @Override
            public void onInfoWindowClick(Marker marker)
            {
                Toast.makeText(getApplicationContext(), "Clicked a window with title..." + marker.getTitle(),
                        Toast.LENGTH_SHORT).show();
            }
        };
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment