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 androidx.fragment.app.FragmentManager | |
| import androidx.lifecycle.LiveData | |
| import androidx.lifecycle.MutableLiveData | |
| import androidx.navigation.NavController | |
| import androidx.navigation.fragment.NavHostFragment | |
| import com.google.android.material.bottomnavigation.BottomNavigationView | |
| import java.util.Stack | |
| import kotlin.collections.HashMap | |
| class BottomBackStackController { |
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 DataProvider { | |
| public static List<Person> getOldPersonList(){ | |
| List<Person> persons = new ArrayList<>(); | |
| persons.add(new Person(1, 20, "John")); | |
| persons.add(new Person(2, 12, "Jack")); | |
| persons.add(new Person(3, 8, "Michael")); | |
| persons.add(new Person(4, 19, "Rafael")); | |
| return persons; | |
| } |
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 final class RawCertificatePinner implements OkHttpCertificatePinner{ | |
| private static final String CERTIFICATE_TYPE = "BKS"; | |
| private static final String DEFAULT_TLS_VERSION = "TLSv1.2"; | |
| private final Context context; | |
| @RawRes | |
| private final int certificate; | |
| private final String certificatePassword; |
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 NewIntentProcessor extends AbstractProcessor { | |
| private static final String METHOD_PREFIX = "start"; | |
| private static final ClassName classIntent = ClassName.get("android.content", "Intent"); | |
| private static final ClassName classContext = ClassName.get("android.content", "Context"); | |
| private Filer filer; | |
| private Messager messager; | |
| private Elements elements; | |
| private Map<String, String> activitiesWithPackage; |
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
| api.fetchUser(object: Callback{ | |
| fun onResponse(userInfo: UserInfo){ | |
| userTextView.text = userInfo.name | |
| } | |
| }) |
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 FileUtil { | |
| public static File getPickedPictureFile(Context context, Uri selectedImage) { | |
| final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; | |
| // DocumentProvider | |
| if (isKitKat && DocumentsContract.isDocumentUri(context, selectedImage)) { | |
| // ExternalStorageProvider | |
| if (isExternalStorageDocument(selectedImage)) { |
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 void updateList(ArrayList<Person> newList) { | |
| DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new MyDiffCallback(this.persons, newList)); | |
| diffResult.dispatchUpdatesTo(this); | |
| } |
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 abstract class NetworkBoundSource<LocalType, RemoteType> { | |
| public NetworkBoundSource(FlowableEmitter<Resource<LocalType>> emitter) { | |
| Disposable firstDataDisposable = getLocal() | |
| .map(Resource::loading) | |
| .subscribe(emitter::onNext); | |
| getRemote().map(mapper()) | |
| .subscribeOn(Schedulers.newThread()) | |
| .observeOn(Schedulers.newThread()) |
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
| //Room | |
| archComponentVersion = "1.0.0-alpha3" | |
| archRoom = "android.arch.persistence.room:runtime:$archComponentVersion" | |
| archRoomCompiler = "android.arch.persistence.room:compiler:$archComponentVersion" | |
| archRoomRx = "android.arch.persistence.room:rxjava2:$archComponentVersion" | |
| archLifeCycleReactiveStreams = "android.arch.lifecycle:reactivestreams:$archComponentVersion" | |
| //RxJava & RxAndroid |
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 MyDiffCallback extends DiffUtil.Callback{ | |
| List<Person> oldPersons; | |
| List<Person> newPersons; | |
| public MyDiffCallback(List<Person> newPersons, List<Person> oldPersons) { | |
| this.newPersons = newPersons; | |
| this.oldPersons = oldPersons; | |
| } |
NewerOlder