Skip to content

Commit

Permalink
Implement gps data sending. Comment out @drawable/progress for now (u…
Browse files Browse the repository at this point in the history
…ncommited file)
  • Loading branch information
Kanac committed Apr 5, 2017
1 parent f2ebb53 commit 8248ecb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
3 changes: 3 additions & 0 deletions HikingPal/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class MainActivity extends AppCompatActivity
private StringBuilder mBluetoothData = new StringBuilder();
public static final char BLUETOOTH_RATE = 'P';
public static final char BLUETOOTH_WEATHER = 'Z';
public static final char BLUETOOTH_GPS = 'Y';

private enum State{
None,
Expand Down Expand Up @@ -214,7 +215,6 @@ public void onDrawerOpened(View drawerView) {
waiting_view = findViewById(R.id.container_waiting);
waitIcon = (ProgressBar)findViewById(R.id.loading_spinner);
//waitIcon.getIndeterminateDrawable().setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY);

}


Expand Down Expand Up @@ -378,8 +378,6 @@ protected void onPostExecute(Weather weather) {
textView.setText(mWeatherText);
return;
}

MainActivity.this.sendMessageSlow(BLUETOOTH_WEATHER + mWeatherIcon + mWeatherText + BLUETOOTH_WEATHER );
}
}

Expand Down Expand Up @@ -736,6 +734,24 @@ private void setStatus(CharSequence subTitle) {
actionBar.setSubtitle(subTitle);
}

private String GetGpsString(){
String lat = String.format("%.3f", Math.abs(MapViewFragment.latlng.latitude));
String lon = String.format("%.3f", Math.abs(MapViewFragment.latlng.longitude));
if(MapViewFragment.latlng.latitude < 0){
lat += "S";
}
else{
lat += "N";
}
if(MapViewFragment.latlng.longitude < 0){
lon += "W";
}
else{
lon += "E";
}
return lat + " " + lon;
}

/**
* The Handler that gets information back from the BluetoothChatService
*/
Expand All @@ -752,6 +768,7 @@ public void handleMessage(Message msg) {
} catch (InterruptedException e) {
e.printStackTrace();
}
MainActivity.this.sendMessageSlow(BLUETOOTH_GPS + GetGpsString() + BLUETOOTH_GPS);
MainActivity.this.sendMessageSlow(BLUETOOTH_WEATHER + mWeatherIcon + mWeatherText + BLUETOOTH_WEATHER);
break;
case BluetoothChatService.STATE_CONNECTING:
Expand Down
3 changes: 1 addition & 2 deletions HikingPal/app/src/main/res/layout/app_bar_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/progress" />
android:indeterminate="true" />
</FrameLayout>

</android.support.design.widget.CoordinatorLayout>

0 comments on commit 8248ecb

Please sign in to comment.