This file contains hidden or 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 BatteryActivity extends Activity { | |
| //UI Elements | |
| private TextView mTextViewLevel; | |
| private TextView mTextViewTemperature; | |
| private TextView mTextViewVoltage; | |
| private TextView mTextViewHealth; | |
| //Battery details | |
| private int level; |
This file contains hidden or 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"?> | |
| <fragment xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:id="@+id/map" | |
| android:name="com.google.android.gms.maps.SupportMapFragment" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" /> |
This file contains hidden or 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
| String java8 = getJavaVersion(8) | |
| String java7 = getJavaVersion(7) | |
| retrolambda { | |
| jdk java8 | |
| oldJdk java7 | |
| javaVersion JavaVersion.VERSION_1_7 | |
| // jvmArgs '-arg1', '-arg2' < if I don't comment this line gradle fails | |
| defaultMethods false | |
| incremental true |
This file contains hidden or 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or 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 Drawables { | |
| @NonNull | |
| public static Drawable getSelectableDrawableFor(int color) { | |
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { | |
| StateListDrawable stateListDrawable = new StateListDrawable(); | |
| stateListDrawable.addState( | |
| new int[]{android.R.attr.state_pressed}, | |
| new ColorDrawable(lightenOrDarken(color, 0.20D)) | |
| ); |
This file contains hidden or 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.text.TextUtils; | |
| import io.realm.Case; | |
| import io.realm.Realm; | |
| import io.realm.RealmObject; | |
| import io.realm.RealmResults; | |
| public class RealmFullTextSearch { | |
| public static <T extends RealmObject> RealmResults<T> search(Realm realm, Class<T> modelClass, String query, String fieldName, boolean partialSearch){ |
This file contains hidden or 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.Application; | |
| import android.content.Context; | |
| import android.location.Criteria; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; | |
| import android.os.Bundle; | |
| import android.os.Looper; | |
| import rx.Observable; |
This file contains hidden or 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
| //declaration of array | |
| var arr: number[]; | |
| //initilization of array | |
| arr = [1, 2, 3, 4, 5, 5, 6, 7, 8] | |
| //for loop |
This file contains hidden or 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
| //JSON is way of communication between client and server | |
| //custom type | |
| type Task={ | |
| id: number; | |
| title: string; | |
| detail: string; |