Skip to content

Instantly share code, notes, and snippets.

İbrahim Süren ibrahimsn98

Block or report user

Report or block ibrahimsn98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ibrahimsn98
ibrahimsn98 / MainActivity.kt
Created Dec 31, 2018
Android-Live-Shared-Preferences-Git1
View MainActivity.kt
class MainActivity : AppCompatActivity() {
private val preferences = PreferenceManager.getDefaultSharedPreferences(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
var listener: SharedPreferences.OnSharedPreferenceChangeListener =
@ibrahimsn98
ibrahimsn98 / sudoku.c
Created Dec 8, 2018
C Sudoku Solver Backtracing
View sudoku.c
#include <stdio.h>
int sudo[9][9];
int isExistsInRow(int row, int s) {
int i;
for(i=0; i<9; i++)
if(sudo[row][i] == s)
return 1;
@ibrahimsn98
ibrahimsn98 / SeekBarPreference.kt
Created Oct 27, 2018
Android Custom SeekBar Preference
View SeekBarPreference.kt
class SeekBarPreference(context: Context, attrs: AttributeSet) :
Preference(context, attrs, 0) {
private var max = 0
private var current = 0
init {
widgetLayoutResource = R.layout.preference_seekbar
layoutResource = R.layout.preference_seekbar
@ibrahimsn98
ibrahimsn98 / gist:e5b2261aa53964183c561437c02f8740
Last active Aug 24, 2018
Extract all zip files to the same folder
View gist:e5b2261aa53964183c561437c02f8740
find . -name "*.zip" -exec unzip {} \;
View FixAppBarLayoutBehavior.java
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ibrahimsn98
ibrahimsn98 / ApplicationModule.java
Created Aug 19, 2018
android-mvvm-with-dagger-2
View ApplicationModule.java
@Singleton
@Module(includes = ViewModelModule.class)
public class ApplicationModule {
private static final String BASE_URL = "https://api.github.com/";
@Singleton
@Provides
static Retrofit provideRetrofit() {
return new Retrofit.Builder().baseUrl(BASE_URL)
@ibrahimsn98
ibrahimsn98 / ContextModule.java
Created Aug 19, 2018
android-mvvm-with-dagger-2
View ContextModule.java
@Module
public abstract class ContextModule {
@Binds
abstract Context provideContext(Application application);
}
@ibrahimsn98
ibrahimsn98 / ApplicationComponent.java
Last active Aug 19, 2018
android-mvvm-with-dagger-2
View ApplicationComponent.java
@Singleton
@Component(modules = {ContextModule.class, ApplicationModule.class, AndroidSupportInjectionModule.class, ActivityBindingModule.class})
public interface ApplicationComponent extends AndroidInjector<DaggerApplication> {
void inject(BaseApplication application);
@Component.Builder
interface Builder {
@BindsInstance
Builder application(Application application);
@ibrahimsn98
ibrahimsn98 / RepoService.java
Last active Aug 19, 2018
android-mvvm-with-dagger-2
View RepoService.java
public interface RepoService {
@GET("orgs/Google/repos")
Single<List<Repo>> getRepositories();
@GET("repos/{owner}/{name}")
Single<Repo> getRepo(@Path("owner") String owner, @Path("name") String name);
}
@ibrahimsn98
ibrahimsn98 / ListViewModel.java
Last active Aug 19, 2018
android-mvvm-with-dagger-2
View ListViewModel.java
public class ListViewModel extends ViewModel {
private final RepoRepository repoRepository;
private CompositeDisposable disposable;
private final MutableLiveData<List<Repo>> repos = new MutableLiveData<>();
private final MutableLiveData<Boolean> repoLoadError = new MutableLiveData<>();
private final MutableLiveData<Boolean> loading = new MutableLiveData<>();
@Inject
You can’t perform that action at this time.