Skip to content

Instantly share code, notes, and snippets.

Marcel Holter anstaendig

Block or report user

Report or block anstaendig

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
View FactoryAndInjection.kt
@Module
object RemoteModule {
@Provides
@JvmStatic
fun provideService(): Service = ServiceFactory.getService(BuildConfig.DEBUG)
}
object ServiceFactory {
View gist:55636adaa23cbfcc14711afeeac4b390
// Ask for permission to read storage
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.READ_EXTERNAL_STORAGE)) {
// This will happen if the user previously denied the permission
requestPermissions()
} else {
// We need to check if it's the first time we ask because
// shouldShowRequestPermissionRationale returns false in that case.
View OutfitListFragment.java
/**
* This Fragment is used to show a list of outfits in a recyclerview. For the blogger app integration
* a type needs to be provided for the different outfit categories (ready for review, draft, live,
* on hold). This might be reused for any kind of OutfitList.
*/
public class OutfitListFragment extends Fragment {
// Constants
private static final String TAG = "OutfitListFragment";
private static final String TYPE = "type";
View BloggerAppFragment.java
public class BloggerAppFragment extends Fragment {
// Constants
private static final String TAG = "BloggerAppFragment";
private static final String ID = "id";
// Member variables
@InjectView(R.id.viewpager)
ViewPager mViewPager;
@InjectView(R.id.tab_layout)
TabLayout mTabLayout;
View request_example.js
//Load the request module
var request = require('request');
//Lets configure and request
request({
url: '', //URL to hit
method: 'POST'
}
}, function(err, response, body) {
if(!err && response.statusCode == 200) {
You can’t perform that action at this time.