This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example code to help with Stack Overflow post: | |
* http://stackoverflow.com/questions/35843374/android-pausing-service-thread-asynctask-using-a-handler-with-postdelayed-for | |
* | |
* THIS IS JUST SAMPLE CODE, HAS NOT BEEN BUILT OR TESTED. | |
*/ | |
public class MyService extends Service { | |
protected static final DEFAULT_TIMEOUT = 5000; | |
protected static final EXTENDED_TIMEOUT = 20000; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pickupTime.setContentText("10.00 AM"); | |
pickupDate.setContentText("02/02/2019"); | |
loadSize.setContentText("5 Tonne"); | |
loadMethod.setContentText("Scrappe"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderSummaryActivity extends AppCompatActivity { | |
private CustomView pickupTime; | |
private CustomView pickupDate; | |
private CustomView loadSize; | |
private CustomView loadMethod; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_order_summary); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginHorizontal="8dp" | |
android:orientation="vertical"> | |
<TextView | |
android:id="@+id/order_status_tv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomView extends FrameLayout { | |
private String labelText; | |
private String contentText; | |
private TextView labelTextView; | |
private TextView contentTextView; | |
public CustomView(Context context) { | |
super(context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<declare-styleable name="CustomView"> | |
<attr name="label_text" format="string"/> | |
<attr name="content_text" format="string"/> | |
</declare-styleable> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="#E0E0E0" | |
android:orientation="vertical" | |
android:padding="8dp"> | |
<TextView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun ifNullElse (string : String?){ | |
string?.let { | |
Log.d("Message","The string var is null") | |
} ?: kotlin.run { | |
Log.d("Message","The string var is not null") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onMapReady(GoogleMap googleMap) { | |
//Google map setup | |
mMap = googleMap; | |
mMap.getUiSettings().setZoomControlsEnabled(true); | |
mMap.setMyLocationEnabled(true); | |
mMap.getUiSettings().setMyLocationButtonEnabled(true); | |
// Show marker on the screen and adjust the zoom level | |
mMap.addMarker(new MarkerOptions().position(mOrigin).title("Origin")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Parse JSON Object from Google Direction API & display it on Map | |
public class TaskParseDirection extends AsyncTask<String, Void, List<List<HashMap<String, String>>>> { | |
@Override | |
protected List<List<HashMap<String, String>>> doInBackground(String... jsonString) { | |
List<List<HashMap<String, String>>> routes = null; | |
JSONObject jsonObject = null; | |
try { | |
jsonObject = new JSONObject(jsonString[0]); | |
DirectionParser parser = new DirectionParser(); |
NewerOlder