Skip to content

Instantly share code, notes, and snippets.

public class LiteratureAdapter extends RecyclerView.Adapter {
private List<Literature> mLiteratureList;
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView;
switch (viewType) {
case Literature.TYPE_BOOK:
@ernestkamara
ernestkamara / AdbCommands
Created June 26, 2018 08:42 — forked from Pulimet/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
public class PaginationActivity extends AppCompatActivity {
// removed for brevity..
private PublishProcessor<Integer> paginator = PublishProcessor.create();
private ProgressBar progressBar;
private boolean loading = false;
private int pageNumber = 1;
private final int VISIBLE_THRESHOLD = 1;
private int lastVisibleItem, totalItemCount;
@EfeBudak
EfeBudak / BitmapUtils.java
Last active August 10, 2018 04:46
Vector drawable to bitmap
public static BitmapDescriptor generateBitmapDescriptorFromRes(
Context context, int resId) {
Drawable drawable = ContextCompat.getDrawable(context, resId);
drawable.setBounds(
0,
0,
drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
Bitmap bitmap = Bitmap.createBitmap(
drawable.getIntrinsicWidth(),
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@Pulimet
Pulimet / AdbCommands
Last active May 4, 2025 22:20
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
@AgiMaulana
AgiMaulana / Adding Badge to BottomNavigationView
Created August 16, 2017 18:00
Adding badge (such as notification count) in bottom nav menu item on android
navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(this);
navigation.setSelectedItemId(R.id.navigation_store);
BottomNavigationMenuView bottomNavigationMenuView =
(BottomNavigationMenuView) navigation.getChildAt(0);
View v = bottomNavigationMenuView.getChildAt(2); // number of menu from left
new QBadgeView(this).bindTarget(v).setBadgeNumber(5);
/**
* compile 'q.rorbin:badgeview:1.1.2'
* https://github.com/qstumn/BadgeView
@adavis
adavis / CommonExtensions.kt
Last active April 2, 2024 20:51
Common Android Extensions in Kotlin
fun View.visible() {
visibility = View.VISIBLE
}
fun View.invisible() {
visibility = View.INVISIBLE
}
fun View.gone() {
visibility = View.GONE
@jemshit
jemshit / proguard-rules.pro
Last active February 18, 2025 12:50
Proguard Rules for Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
@jaisonfdo
jaisonfdo / SocialConnection.java
Last active September 4, 2021 16:24
Connect social media account in a single line of code in Android.For more information, check out my detailed guide here : http://droidmentor.com/connect-social-media-account/
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.Toast;
/**