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
import android.app.Activity; | |
import android.content.Context; | |
import android.graphics.Rect; | |
import android.util.AttributeSet; | |
import android.widget.LinearLayout; | |
/** | |
* Created by suraj on 15/6/2016. | |
* | |
* This linear layout is used to listen to visibility of the soft keyboard. |
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 android:layout_height="match_parent" | |
android:layout_width="match_parent" | |
android:id="@+id/rootView" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:orientation="vertical" | |
xmlns:android="http://schemas.android.com/apk/res/android"> | |
<android.support.v7.widget.Toolbar | |
android:id="@+id/toolbar" |
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
@SuppressLint("NewApi") | |
private static String getRealPathFromUri(boolean isKitKat, final Context context, final Uri uri) { | |
// DocumentProvider | |
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { | |
// ExternalStorageProvider | |
if (isExternalStorageDocument(uri)) { | |
final String docId = DocumentsContract.getDocumentId(uri); | |
final String[] split = docId.split(":"); | |
final String type = split[0]; |
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
import java.io.IOException; | |
import in.surajsau.popularmovies.IConstants; | |
import okhttp3.HttpUrl; | |
import okhttp3.Interceptor; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
import okhttp3.logging.HttpLoggingInterceptor; | |
import retrofit2.Retrofit; |
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 SamplePreference { | |
private static SharedPreferences sharedpreferences; | |
public static SharedPreferences init(Context appCtx, String file) { | |
sharedpreferences = appCtx.getSharedPreferences(file, | |
Context.MODE_PRIVATE); | |
return sharedpreferences; |
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
#!/bin/bash | |
i=0 | |
limit=<MAX_LIMIT> | |
while [ $i -lt $limit ] | |
do | |
if [ $i -lt 10 ] | |
then |
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
/** | |
* This handles 'Latest 10 cases in Radiology' from the user. It receives | |
* $rounds_pref (from rounds_preference entity) as in which speciality is being asked for, | |
* $cases tells total number of cases asked for | |
* $is_best_cases tells whether the user wants 'Top' or 'Best' cases | |
*/ | |
app.intent('cases', (conv, {rounds_pref, cases, is_best_cases}) => { | |
//default 5 cases | |
if(!cases) | |
cases = 5; |
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
const casesRequest = (rounds, skipCount, conv) => { | |
const timestamp = new Date().getTime(); | |
const options = { | |
method: 'GET', | |
url: `http://keanuisimmortal.com/v1/talk?topics=${rounds.id}&limit=${skipCount}`, | |
headers: { | |
'Content-Type': 'application/json', | |
... | |
} | |
}; |
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
/** | |
* This handles the situation when agrees to save his/her speciality | |
* preference or wants to change his/her speciality preference. | |
*/ | |
app.intent(['rounds_preference_yes', 'rounds_preference_change', 'cases_speciality_ask_yes'], (conv) => { | |
conv.ask('Sure, so which speciality would you prefer to see?'); | |
conv.ask(new Suggestions('DailyRounds', 'Radiology Rounds', 'Cardiology Rounds')); | |
}); |
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
/** | |
* This handles the situation when user refuses to save his/her | |
* speciality preference. In this case, we use the fallback 'primary'. | |
* 'cases-followup' context has exhausted 1 lifespan. Since, it has a | |
* total of 2, we are safe to proceed with using it's parameters | |
* without first checking for availability of context. | |
*/ | |
app.intent('cases_speciality_ask_no', (conv) => { | |
conv.ask('Not an issue, you can always save your preference later.'); |
OlderNewer