Skip to content

Instantly share code, notes, and snippets.

View ibrahimsn98's full-sized avatar
🐙

İbrahim Süren ibrahimsn98

🐙
View GitHub Profile
@ibrahimsn98
ibrahimsn98 / android-get-apps-adaptive-icons-circle
Created January 27, 2018 21:04
Android - Get aplication's adaptive icons in circle form
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
@ibrahimsn98
ibrahimsn98 / android-notification-listener-get-stacked-notification-text
Created February 15, 2018 17:01
Android notification listener get stacked notification text
String getNotificationText(Bundle extras) {
CharSequence[] lines = extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES);
if(lines != null && lines.length > 0) {
StringBuilder sb = new StringBuilder();
for (CharSequence msg : lines)
if (!TextUtils.isEmpty(msg)) {
sb.append(msg.toString());
sb.append('\n');
}
return sb.toString().trim();
@ibrahimsn98
ibrahimsn98 / gist:d9914c12b98446a25232aea23e4740f8
Created June 9, 2018 09:39
Android Bottom Navigation View Dimens
bottom_navigation_elevation
bottom_navigation_height
bottom_navigation_icon
bottom_navigation_margin_bottom
bottom_navigation_margin_top_active
bottom_navigation_margin_top_inactive
bottom_navigation_max_width
bottom_navigation_min_width
bottom_navigation_notification_elevation
bottom_navigation_notification_height
@ibrahimsn98
ibrahimsn98 / AdmobConsentSimple
Created June 18, 2018 16:12 — forked from ameerhamza6733/AdmobConsentSimple
Simple for Consent sdk android admob
/*https://www.youtube.com/watch?v=_JOapnq8hrs&t=852s
video tutorial for consent sdk android
*/
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
@ibrahimsn98
ibrahimsn98 / android-mvvm-with-dagger-2-build.gradle
Last active August 19, 2018 15:39
android-mvvm-with-dagger-2
def supportVersion = '27.1.1'
def retrofitVersion = '2.3.0'
def rxJavaVersion = '2.0.1'
def butterKnifeVersion = '8.8.1'
def daggerVersion = '2.13'
dependencies {
...
implementation "android.arch.lifecycle:extensions:1.1.1"
@ibrahimsn98
ibrahimsn98 / BaseApplication.java
Last active August 19, 2018 15:36
android-mvvm-with-dagger-2
public class BaseApplication extends DaggerApplication {
@Override
public void onCreate() {
super.onCreate();
}
@Override
protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
ApplicationComponent component = DaggerApplicationComponent.builder().application(this).build();
@ibrahimsn98
ibrahimsn98 / BaseActivity.java
Last active August 19, 2018 15:38
android-mvvm-with-dagger-2
public abstract class BaseActivity extends DaggerAppCompatActivity {
@LayoutRes
protected abstract int layoutRes();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(layoutRes());
ButterKnife.bind(this);
@ibrahimsn98
ibrahimsn98 / BaseFragment.java
Last active August 19, 2018 15:38
android-mvvm-with-dagger-2
public abstract class BaseFragment extends DaggerFragment {
private Unbinder unbinder;
private AppCompatActivity activity;
@LayoutRes
protected abstract int layoutRes();
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ibrahimsn98
ibrahimsn98 / ActivityBindingModule.java
Last active August 19, 2018 15:38
android-mvvm-with-dagger-2
@Module
public abstract class ActivityBindingModule {
@ContributesAndroidInjector(modules = {MainFragmentBindingModule.class})
abstract MainActivity bindMainActivity();
}
@ibrahimsn98
ibrahimsn98 / MainFragmentBindingModule.java
Last active August 19, 2018 15:37
android-mvvm-with-dagger-2
@Module
public abstract class MainFragmentBindingModule {
@ContributesAndroidInjector
abstract ListFragment provideListFragment();
@ContributesAndroidInjector
abstract DetailsFragment provideDetailsFragment();
}