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
/** | |
* Created by Dinorah Tovar on 12/20/17. | |
* RecyclerView Implementation inside Activity/Fragment | |
*/ | |
//... | |
RecyclerViewAdapter adapter = new RecyclerViewAdapter(); | |
final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); | |
layoutManager.setOrientation(LinearLayoutManager.VERTICAL); | |
recyclerView.setLayoutManager(layoutManager); |
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
/** | |
* Created by Dinorah Tovar on 12/20/17. | |
* ViewPager | |
*/ | |
public class CustomViewPager extends ViewPager { | |
public CustomViewPager(Context context) { | |
super(context); | |
setMyScroller(); |
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
@Headers("Content-Type:application/json; charset=UTF-8") | |
@GET("yourwebsite/{someParam}/login") | |
fun logout(@Header(UUID.randomUUID().toString()) authToken: String?, @Path("someParam") someParam: String?): Observable<LoginResponseViewModel> |
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
@Provides | |
@Singleton | |
fun getUnsafeOkHttpClient(): OkHttpClient { | |
val interceptor = HttpLoggingInterceptor() | |
interceptor.level = HttpLoggingInterceptor.Level.BODY | |
val builder = OkHttpClient.Builder() | |
builder.addInterceptor(interceptor) | |
.connectTimeout(30, TimeUnit.SECONDS) | |
.readTimeout(30, TimeUnit.SECONDS) | |
.followRedirects(true) |
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
/** | |
* Created by Dinorah Tovar on 04/04/18. | |
* Secondary helper interceptor to skip interceptor headers over Data Module | |
*/ | |
class SupportInterceptor: Interceptor { | |
/** | |
* Interceptor class for setting of the headers for every request |
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
/** | |
* Created by Dinorah Tovar on 04/04/18. | |
* Secondary helper interceptor to skip interceptor headers over Data Module | |
*/ | |
class SupportInterceptor: Interceptor, Authenticator { | |
/** | |
* Interceptor class for setting of the headers for every request | |
*/ |
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
/** | |
* OkHttpClient | |
*/ | |
@Provides | |
@Singleton | |
fun getUnsafeOkHttpClient(): OkHttpClient { | |
val interceptor = HttpLoggingInterceptor() | |
interceptor.level = HttpLoggingInterceptor.Level.HEADERS | |
interceptor.level = HttpLoggingInterceptor.Level.BODY | |
val builder = OkHttpClient.Builder() |
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
@Headers("Content-Type:application/json; charset=UTF-8") | |
@GET("yourwebsite/{someParam}/login") | |
fun logout(@Path("someParam") someParam: String?): Observable<LoginResponseViewModel> |
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
/** | |
* Returns an observable from a function that decrypts stored user data | |
*/ | |
fun currentUserObservable(): Observable<UserViewModel> { | |
return Observable.create(ObservableOnSubscribe<UserViewModel> { subscriber -> | |
val user = currentUser() | |
if (user != null) | |
subscriber.onNext(user) | |
else | |
subscriber.onError(Throwable("User is 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
import android.content.Context | |
import android.graphics.Rect | |
import android.support.design.widget.TextInputLayout | |
import android.util.AttributeSet | |
import java.lang.reflect.InvocationTargetException | |
import java.lang.reflect.Method | |
/** | |
* Created by Dinorah Tovar on 6/19/18 | |
* Password with |
OlderNewer