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 ThreadingService { | |
private final Threader networkService; | |
private final Threader serialQueue; | |
private final Threader hsuiThreader; | |
private final Object syncLock = new Object(); | |
public ThreadingService(Threader networkThreader, Threader serialQueue, Threader uiThreader) { | |
this.networkService = networkThreader; | |
this.serialQueue = serialQueue; | |
this.hsuiThreader = uiThreader; |
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 HSDownloaderResponse downloadResource(String url, Map<String, String> headers, | |
File saveToFile) { | |
boolean isSuccess = false; | |
int status = 404; | |
String mimetype = ""; | |
String encoding = "utf-8"; | |
String etag = ""; | |
JSONObject responseHeadersJSON = new JSONObject(); | |
FileOutputStream fos = null; | |
try { |
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 HSResponse makeRequest(HSRequest request) { | |
HttpsURLConnection connection = null; | |
OutputStream outputStream = null; | |
InputStream errorStream = null; | |
InputStream inputStream = null; | |
try { | |
connection = (HttpsURLConnection) new URL(request.getUrl()).openConnection(); | |
connection.setRequestMethod(request.getMethod().name()); | |
connection.setConnectTimeout(request.getTimeout()); | |
for (Map.Entry<String, String> header : request.getHeaders().entrySet()) { |
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 WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { | |
// Only cache GET calls | |
if (!"GET".equalsIgnoreCase(request.getMethod())) { | |
return super.shouldInterceptRequest(view, request); | |
} | |
// Init the cache config, fetch from network if not done already | |
List<String> urls = initCacheConfig(); |
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
{ | |
ttl: 1234567890 | |
urls: [ | |
{ | |
path:"/abc/content/abc.js" | |
ttl:1234567890 | |
}, | |
{ | |
path:"/abc/content/efg.css" | |
ttl:1234567890 |
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 void inflate(Context context, | |
double maxAvailableWidthScaleFactor, | |
LinearLayout containerView, | |
int selectOptionInflaterLayout, | |
int optionTextViewId, | |
List<String> pillTitles, | |
View.OnClickListener optionSelectionListener) { | |
List<LinearLayout> layouts = new ArrayList<>(); | |
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:paddingTop="8dp"> | |
<com.helpshift.views.HSTextView | |
android:id="@+id/selectable_option_text" | |
android:layout_width="wrap_content" |