Skip to content

Instantly share code, notes, and snippets.

View DroidLove's full-sized avatar
🎯
Focusing

JItesh SUvarna DroidLove

🎯
Focusing
View GitHub Profile
GlobalScope.launch(Dispatchers.Main) {
val resultList = mappingResult(response?.employee)
pro_bar.visibility = View.GONE
activity?.let {
val adapter = ArrayAdapter<String>(it,
android.R.layout.simple_list_item_1, resultList)
list_api.adapter = adapter
}
}
GlobalScope.launch(Dispatchers.IO) {
try {
val request = retroApiInterface.getEmployeeListing()
val response = request.await().body()
handlingUI(response)
} catch (exception: Exception) {
Log.e("Retrofit Exception", exception.toString())
}
}
class APIService {
private lateinit var apiInterface: APIInterface
fun getClient(): APIInterface {
val gson = GsonBuilder().create()
val retrofit = Retrofit.Builder()
.baseUrl("https://limitless-lake-93364.herokuapp.com")
.client(provideOkHttpClient(provideLoggingInterceptor()))
.addConverterFactory(GsonConverterFactory.create(gson))
interface APIInterface {
@GET("/hello")
fun getEmployeeListing(): Deferred<Response<EmployeeListModel>>
}
@DroidLove
DroidLove / coroutinedepencies.gradle
Last active December 28, 2018 11:13
Dependencies for Coroutine and Retrofit 2
dependencies {
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
// OKHttp
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
1. Highlight a recommended option,

2. Allow users to switch currency (€/$/£)

3. Allow users to switch pricing monthly/yearly

4. Keep the entire pricing plan area clickable

5. Use slider to calculate how much a user would save

6. Provide free first month for good engagement

7. Prominently highlight testimonials prominently

8. Repeating call to action on top and bottom

9. Sell benefits instead of features

10. Indicate that users can cancel any time

@DroidLove
DroidLove / RecyclerView Template
Last active April 11, 2018 15:28
RecyclerView Template for AS
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import java.util.*
#parse("File Header.java")
class ${NAME} : RecyclerView.Adapter<${ViewHolder_Class}>() {
@DroidLove
DroidLove / index.js
Created April 9, 2018 07:43
Firebase cloud function accesing Database plus trigger Push notification
var functions = require('firebase-functions');
var admin = require('firebase-admin');
var serviceAccount = require("./serviceAccountKey.json");
// admin.initializeApp(functions.config().firebase);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://tutsalert.firebaseio.com"
});
exports.sendNotification = functions.database.ref('/articles/{articleId}')