Skip to content

Instantly share code, notes, and snippets.

View xsahil03x's full-sized avatar
🤹‍♂️
Working on something awesome

Sahil Kumar xsahil03x

🤹‍♂️
Working on something awesome
View GitHub Profile
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
@xsahil03x
xsahil03x / OnBoardingActivity.java
Created July 10, 2018 11:23
On Boarding Screen With Videos
package com.magarex.moviemania;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.view.View;
import android.widget.ImageButton;
@xsahil03x
xsahil03x / ReviewFragment.java
Created July 15, 2018 11:05
Review Recyclerview
public class ReviewFragment extends Fragment {
private ReviewAdapter mAdapter;
private static final String MOVIE_ID_KEY = "movie_id";
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
TabBottomSheetReviewBinding mBinding = DataBindingUtil.inflate(inflater, R.layout.tab_bottom_sheet_review, container, false);
mAdapter = new ReviewAdapter(getActivity());
@xsahil03x
xsahil03x / MainActivity.java
Last active July 26, 2018 13:41
Location Api Gist
package com.panchal.vivek.mapproject;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Geocoder;
import android.location.Location;
import android.os.Bundle;
import android.os.Handler;
public class RecipeIngredientWidget extends AppWidgetProvider {
@Inject
PreferenceRepository prefRepo;
public static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Recipe recipe) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.recipe_ingredient_widget);
// launch app when button is clicked
public class MyGamesAdapter extends RecyclerView.Adapter<MyGamesAdapter.MyGamesViewHolder> {
private static final int TYPE_FIRST_ITEM = 0;
private static final int TYPE_ITEM = 1;
private List<Game> gameList;
private Context context;
private MyGameItemClickListener itemClickListener;
public MyGamesAdapter(Context context, MyGameItemClickListener myGameItemClickListener) {
/*
* Copyright 2018 DevCompat
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@xsahil03x
xsahil03x / DummyApi.java
Created October 15, 2018 13:58
Retrofit Boilerplate
public interface DummyApi {
@GET("posts")
Call<DemoPost> fetchDummyPosts();
@GET("comments")
Call<DemoComment> fetchDummyComments();
}
[
{
"collectionImageURL": "https://s3.ap-south-1.amazonaws.com/jewelerykart/collections/501-DisplayImage.jpg",
"collectionDescription": "xyz",
"collectionId": 501,
"collectionName": "Ring"
},
{
"collectionImageURL": "https://i01.hsncdn.com/is/image/HomeShoppingNetwork/prodgrid230/ben-sherman-mens-stainless-steel-enamel-british-flag-pe-d-2018021410180695~602077.jpg",
"collectionDescription": "Neclace Collection",
Widget makeItemList(JweleryKartBloc bloc) => StreamBuilder(
stream: bloc.menOffers,
builder: (BuildContext context, AsyncSnapshot<List<OfferBrief>> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
return GridView.builder(
shrinkWrap: true,