Skip to content

Instantly share code, notes, and snippets.

View Nyame123's full-sized avatar

Nyame Bismark Nyame123

View GitHub Profile
@Nyame123
Nyame123 / test.java
Created November 1, 2020 10:46
test
package com.bisapp.threadingexamples.loaders;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@Nyame123
Nyame123 / createObservablesAndSubscribing.java
Last active November 1, 2020 13:40
Using create method to create Observables and subscribe
private void createObservablesAndSubscribing() {
Observable observable = Observable.create(new ObservableOnSubscribe() {
@Override
public void subscribe(@NonNull ObservableEmitter emitter) {
emitter.onNext("Emitting new Stuff !!");
emitter.onComplete();
}
});
@Nyame123
Nyame123 / deferJustUsage.java
Created November 5, 2020 22:49
comparing defer with just usage
package com.bisapp.rxjavaexamples;
import java.util.concurrent.Callable;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
public class Book {
String page = "First page";
@Nyame123
Nyame123 / animatorsetFromXml.xml
Created November 13, 2020 21:49
Creating animator set from xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator android:propertyName="x"
android:valueTo="50"
android:duration="2000"
android:interpolator="@android:interpolator/accelerate_decelerate"/>
<objectAnimator
android:duration="2000"
@Nyame123
Nyame123 / scale_animate.xml
Created November 14, 2020 00:08
Creating a state list animator
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<set >
<objectAnimator android:propertyName="scaleX"
android:duration="@android:integer/config_shortAnimTime"
android:valueTo="1.2"
android:valueType="floatType"/>
<objectAnimator android:propertyName="scaleY"
@Nyame123
Nyame123 / view_state_animator
Created November 14, 2020 00:12
setting the state animator to the view
<Button
android:id="@+id/scaleBtn"
android:layout_width="0dp"
android:stateListAnimator="@animator/animate_scale"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="0.4"
android:text="Scale" />
@Nyame123
Nyame123 / animation_list_ex.xml
Created November 15, 2020 12:16
Creating animation list xml sample
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item
android:drawable="@drawable/baseline_star_border_black_18dp"
android:duration="200" />
<item
android:drawable="@drawable/baseline_star_half_black_18dp"
android:duration="200" />
<item
@Nyame123
Nyame123 / animation_list_java.java
Created November 15, 2020 12:17
Calling the animation list in java
package com.bisapp.android_animations;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
@Nyame123
Nyame123 / animated_vector_drawable.xml
Last active November 15, 2020 18:00
creating animated vector drawable
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="84dp"
android:height="84dp"
android:viewportWidth="24"
android:viewportHeight="24">
@Nyame123
Nyame123 / main_layout.xml
Created November 17, 2020 10:52
Main Layout containing the scene
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/master_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/goBtn"
android:layout_width="wrap_content"