This file contains hidden or 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
if (throwable instanceof HttpException) { | |
Response response = ((HttpException) throwable).response(); | |
RetrofitError commonResponse = null; | |
if (response != null) { | |
Gson gson = new Gson(); | |
try { | |
commonResponse = gson.fromJson(response.errorBody().string(), RetrofitError.class); | |
CommonUtilities.showAlertDialog(context, commonResponse.getMessage()); | |
} catch (IOException e) { | |
e.printStackTrace(); |
This file contains hidden or 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 DateDeserializer implements JsonDeserializer<MyDate> { | |
//if not epoch time from server response | |
public static SimpleDateFormat serverFormatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSS'Z'"); | |
public static SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); | |
@Override | |
public MyDate deserialize(JsonElement element, Type arg1, JsonDeserializationContext arg2) throws JsonParseException { | |
String date = element.getAsString(); | |
//if epoch sent then create date object directly new Date(time*1000) | |
formatter.setTimeZone(TimeZone.getTimeZone("UTC"));//the timezones you want |
This file contains hidden or 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
@BindingAdapter(value = {"bind:textContentClickable", "bind:textContentClick"}, requireAll = true) | |
public static void onContentClick(TextView textView, String[] content, final View.OnClickListener clickListener) { | |
String originalText = textView.getText().toString(); | |
SpannableString ss = new SpannableString(originalText); | |
for (int index = 0; index < content.length; index++) { | |
int indexStarting = originalText.indexOf(content[index]); | |
int lastIndex = indexStarting + content[index].length(); | |
ss = applyClickToTextContent(ss, content[index], indexStarting, lastIndex, clickListener); | |
} | |
textView.setText(ss); |
This file contains hidden or 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
@BindingAdapter(value = {"bind:datePick", "bind:maxDate", "bind:minDate"}, requireAll = false) | |
public static void bindTextViewDateClicks(final TextView textView, final ObservableField<Date> date, final ObservableField<Date> maxDate, final ObservableField<Date> minDate) { | |
textView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
selectDate(textView.getContext(), date, maxDate, minDate); | |
} | |
}); | |
} | |
This file contains hidden or 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
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
var arrayList = ArrayList<ItemModel>() | |
for (index in 0 .. 50){ | |
arrayList.add(ItemModel("test $index",false)) | |
} |
This file contains hidden or 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 CircularLayoutManager extends LinearLayoutManager { | |
private static final int CIRCLE = 0; | |
private static final int ELLIPSE = 1; | |
private static final int MILLISECONDS_PER_INCH = 30; | |
private RecyclerView recyclerView; | |
private Rect recyclerBounds; | |
private int topOfFirstChild; |
This file contains hidden or 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
{ | |
"info": { | |
"name": "firebase", | |
"_postman_id": "e80f736a-f80e-8d91-436d-c633be4e23b2", | |
"description": "", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "https://fcm.googleapis.com/fcm/send", |
This file contains hidden or 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
import com.com.parthdave93.mock.Foo | |
import com.com.parthdave93.mock.FooInterface | |
import com.com.parthdave93.ownmockingmodule.MockDave | |
import org.mockito.Mockito | |
object CustomMockitoTestSuit { | |
@JvmStatic | |
fun main(args: Array<String>) { |
This file contains hidden or 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
import 'package:flutter/material.dart'; | |
import 'package:flutter_performance_check/utils.dart'; | |
class PerformanceChartUI extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return _PerformanceChartUIState(); | |
} | |
} |
This file contains hidden or 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
import 'javascript_util.dart'; | |
void callJavascriptFunction(){ | |
//callJavascriptFunctions("javascriptMethodName", ["arguments"]); example | |
callJavascriptFunctions("functionName", ["argument1","argument2","argument3"]); | |
} | |
void callJavascriptFunctionAndFetchData(){ | |
//fetchJavaScriptData("javascriptMethodName", callbackFunction(){},["arguments"]); example | |
fetchJavaScriptData("functionName", (resultFromJavascript){ |
OlderNewer