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
/** | |
* 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
/** | |
* Created by Dinorah Tovar on 8/21/18 | |
* Base custom activity managing all the disposables | |
*/ | |
open class BaseActivity : AppCompatActivity() { | |
/** | |
* Keep reference of the active presenter. | |
*/ |
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
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 |
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 8/21/18 | |
* All fragments should extend from this fragment. | |
*/ | |
open class BaseFragment : Fragment() { | |
/** | |
* Keep reference of the active presenter | |
*/ |
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
@Entity(tableName = "Products", | |
foreignKeys = [ForeignKey(entity = ImagesEntity::class, | |
parentColumns = arrayOf("imageId"), childColumns = arrayOf("cityId")), | |
ForeignKey(entity = PricesEntity::class, | |
parentColumns = arrayOf("skuId"), childColumns = arrayOf("idProduct"))], | |
indices = [Index(value = ["idProduct", "skuId"])]) | |
data class ProductEntity ( | |
@PrimaryKey(autoGenerate = false) | |
@ColumnInfo(name = "idProduct") |
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
@Database(entities = [ProductEntity::class], version = SharedContentDataBase.VERSION) | |
abstract class SharedContentDataBase : RoomDatabase() { | |
companion object { | |
const val VERSION = 2 | |
val migrationRoom: Migration = object : Migration(1, 2) { | |
override fun migrate(database: SupportSQLiteDatabase) { | |
//This is where the magic happends |
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
database.execSQL("ALTER TABLE Product ADD COLUMN hasAddedToCart INT") |