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
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val values = ArrayList<PieEntry>() | |
var colorList = listOf(Color.RED, Color.GREEN, Color.YELLOW); | |
// 1. Create an array list of pie chart values. |
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
<android.support.v7.widget.RecyclerView | |
android:id="@+id/rv_users" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_margin="8dp"/> |
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
Observable.just(1,2,3).subscribe(Subscriber<Integer>() { | |
@Override | |
public void onCompleted() { | |
Log.d("","all done. oncompleted called"); | |
} | |
@Override | |
public void onError(Throwable e) { | |
} |
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
implementation "io.reactivex.rxjava2:rxjava:2.2.9" //RxJava | |
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' //RxAndroid | |
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0' //kotlin coroutines | |
//Retrofit | |
implementation 'com.squareup.retrofit2:retrofit:2.5.0' //retrofit | |
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion" //retrofit gson converter. | |
implementation 'com.google.code.gson:gson:2.8.5' //gson | |
implementation 'joda-time:joda-time:2.10.2' //joda-time |
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
implementation 'androidx.appcompat:appcompat:1.0.2' | |
implementation 'androidx.core:core-ktx:1.0.2' | |
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | |
implementation "com.google.android.material:material:1.1.0-alpha10" | |
implementation "io.reactivex.rxjava2:rxjava:2.2.9" //RxJava | |
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' //RxAndroid | |
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0' //kotlin coroutines | |
//Retrofit | |
implementation 'com.squareup.retrofit2:retrofit:2.5.0' //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
class HexColor extends Color { | |
static int _getColorFromHex(String hexColor) { | |
hexColor = hexColor.toUpperCase().replaceAll("#", ""); | |
if (hexColor.length == 6) { | |
hexColor = "FF" + hexColor; | |
} | |
return int.parse(hexColor, radix: 16); | |
} | |
HexColor(final String hexColor) : super(_getColorFromHex(hexColor)); |
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
//UI Unit conversion. | |
fun Context.pxToDp(dimension: Int) = dimension / this.resources.displayMetrics.density | |
fun Context.pxToSp(dimension: Int) = dimension / this.resources.displayMetrics.scaledDensity | |
fun Context.dpToPx(dimension: Int) = dimension * this.resources.displayMetrics.density | |
fun Context.spToPx(dimension: Int) = dimension * this.resources.displayMetrics.scaledDensity |
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
<style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> | |
<item name="bottomSheetStyle">@style/CustomBottomSheetStyle</item> | |
</style> | |
<style name="CustomBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal"> | |
<item name="android:background">@android:color/transparent</item> | |
</style> |
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
class DeleteScreenConfirmationBottomSheet : BottomSheetDialogFragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setStyle(STYLE_NORMAL, R.style.BottomSheetDialog) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, |