diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7ac24c7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..12e26b5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..2ce18e2 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,39 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 25 + buildToolsVersion "25.0.2" + defaultConfig { + applicationId "com.jintu.pickd" + minSdkVersion 17 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.3.1' + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:25.3.1' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + compile 'com.nineoldandroids:library:2.4.0' + compile 'com.daimajia.slider:library:1.1.5@aar' + compile 'com.android.support:design:25.3.1' + compile 'com.android.support:recyclerview-v7:25.3.1' + compile 'com.android.support:cardview-v7:25.3.1' + compile 'com.github.bumptech.glide:glide:3.7.0' + compile 'com.squareup.picasso:picasso:2.5.2' + testCompile 'junit:junit:4.12' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..661f72a --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Lenovo\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/jintu/pickd/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/jintu/pickd/ExampleInstrumentedTest.java new file mode 100644 index 0000000..0f99cc4 --- /dev/null +++ b/app/src/androidTest/java/com/jintu/pickd/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.jintu.pickd; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.jintu.pickd", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..162c0bc --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/jintu/pickd/Activities/ElectronicsActivity.java b/app/src/main/java/com/jintu/pickd/Activities/ElectronicsActivity.java new file mode 100644 index 0000000..9a2da8e --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Activities/ElectronicsActivity.java @@ -0,0 +1,15 @@ +package com.jintu.pickd.Activities; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +import com.jintu.pickd.R; + +public class ElectronicsActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_electronics); + } +} diff --git a/app/src/main/java/com/jintu/pickd/Activities/MainActivity.java b/app/src/main/java/com/jintu/pickd/Activities/MainActivity.java new file mode 100644 index 0000000..f217266 --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Activities/MainActivity.java @@ -0,0 +1,278 @@ +package com.jintu.pickd.Activities; + +import android.content.Intent; +import android.content.res.Resources; +import android.graphics.Rect; +import android.os.Bundle; +import android.support.design.widget.AppBarLayout; +import android.support.design.widget.CollapsingToolbarLayout; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.DefaultItemAnimator; +import android.support.v7.widget.GridLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; +import android.util.TypedValue; +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.View; + +import com.daimajia.slider.library.Animations.DescriptionAnimation; +import com.daimajia.slider.library.SliderLayout; +import com.daimajia.slider.library.SliderTypes.BaseSliderView; +import com.daimajia.slider.library.SliderTypes.TextSliderView; +import com.daimajia.slider.library.Tricks.ViewPagerEx; +import com.jintu.pickd.Adapter.CategoryAdapter; +import com.jintu.pickd.Model.Category; +import com.jintu.pickd.R; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class MainActivity extends AppCompatActivity implements BaseSliderView.OnSliderClickListener, ViewPagerEx.OnPageChangeListener{ + + private SliderLayout mSlider; + private RecyclerView recyclerView; + private CategoryAdapter adapter; + private List CategoryList; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + mSlider = (SliderLayout)findViewById(R.id.slider); + + //Hiding the status bar + View decorView = getWindow().getDecorView(); + int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; + decorView.setSystemUiVisibility(uiOptions); + + //Category view + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + initCollapsingToolbar(); + + recyclerView = (RecyclerView) findViewById(R.id.recycler_view); + + CategoryList = new ArrayList<>(); + adapter = new CategoryAdapter(this, CategoryList); + + RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2); + recyclerView.setLayoutManager(mLayoutManager); + recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, dpToPx(10), true)); + recyclerView.setItemAnimator(new DefaultItemAnimator()); + recyclerView.setAdapter(adapter); + final GestureDetector mGestureDetector = new GestureDetector(MainActivity.this, new GestureDetector.SimpleOnGestureListener() { + + @Override + public boolean onSingleTapUp(MotionEvent e) { + return true; + } + + }); + + recyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { + @Override + public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { + View child = recyclerView.findChildViewUnder(motionEvent.getX(), motionEvent.getY()); + + + if (child != null && mGestureDetector.onTouchEvent(motionEvent)) { + + int a=recyclerView.getChildPosition(child); + if(a == 0){ + startActivity(new Intent(MainActivity.this,ManActivity.class)); + } + return true; + + } + + return false; + } + + @Override + public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { + + } + + @Override + public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { + + } + }); + + prepareCategorys(); + + //Adding images + HashMap file_maps = new HashMap(); + file_maps.put("Adidas",R.drawable.adidas); + file_maps.put("Puma",R.drawable.puma); + file_maps.put("Marks & Spencer",R.drawable.mands); + file_maps.put("Allen Solly", R.drawable.allensolly); + + for(String name : file_maps.keySet()){ + TextSliderView textSliderView = new TextSliderView(this); + // initialize a SliderLayout + textSliderView + .description(name) + .image(file_maps.get(name)) + .setScaleType(BaseSliderView.ScaleType.Fit) + .setOnSliderClickListener(this); + + //add extra information + textSliderView.bundle(new Bundle()); + textSliderView.getBundle() + .putString("extra",name); + + mSlider.addSlider(textSliderView); + } + + mSlider.setPresetTransformer(SliderLayout.Transformer.Accordion); + mSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom); + mSlider.setCustomAnimation(new DescriptionAnimation()); + mSlider.setDuration(4000); + mSlider.addOnPageChangeListener(this); + + } + + @Override + public void onSliderClick(BaseSliderView slider) { + + } + + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + + } + + @Override + public void onPageSelected(int position) { + + } + + @Override + public void onPageScrollStateChanged(int state) { + + } + + private void initCollapsingToolbar() { + final CollapsingToolbarLayout collapsingToolbar = + (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); + collapsingToolbar.setTitle(" "); + AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appbar); + appBarLayout.setExpanded(true); + + // hiding & showing the title when toolbar expanded & collapsed + appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { + boolean isShow = false; + int scrollRange = -1; + + @Override + public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { + if (scrollRange == -1) { + scrollRange = appBarLayout.getTotalScrollRange(); + } + if (scrollRange + verticalOffset == 0) { + collapsingToolbar.setTitle(getString(R.string.app_name)); + isShow = true; + } else if (isShow) { + collapsingToolbar.setTitle(" "); + isShow = false; + } + } + }); + } + + /** + * Adding few Categorys for testing + */ + private void prepareCategorys() { + int[] covers = new int[]{ + R.drawable.c1, + R.drawable.c2, + R.drawable.c3, + R.drawable.baby, + R.drawable.c5, + R.drawable.book, + R.drawable.c7, + R.drawable.c8, + R.drawable.c9}; + + Category a = new Category("MEN", 13, covers[0]); + CategoryList.add(a); + + a = new Category("WOMEN", 8, covers[1]); + CategoryList.add(a); + + a = new Category("ELECTRONICS", 11, covers[2]); + CategoryList.add(a); + + a = new Category("BABY & KIDS", 12, covers[3]); + CategoryList.add(a); + + a = new Category("HOME & FURNITURE", 14, covers[4]); + CategoryList.add(a); + + a = new Category("BOOKS", 1, covers[5]); + CategoryList.add(a); + + a = new Category("FOOD & DRINKS", 11, covers[6]); + CategoryList.add(a); + + a = new Category("MOVIES", 14, covers[7]); + CategoryList.add(a); + + a = new Category("RESTAURANTS", 11, covers[8]); + CategoryList.add(a); + + adapter.notifyDataSetChanged(); + } + + /** + * RecyclerView item decoration - give equal margin around grid item + */ + public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration { + + private int spanCount; + private int spacing; + private boolean includeEdge; + + public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) { + this.spanCount = spanCount; + this.spacing = spacing; + this.includeEdge = includeEdge; + } + + @Override + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { + int position = parent.getChildAdapterPosition(view); // item position + int column = position % spanCount; // item column + + if (includeEdge) { + outRect.left = spacing - column * spacing / spanCount; // spacing - column * ((1f / spanCount) * spacing) + outRect.right = (column + 1) * spacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing) + + if (position < spanCount) { // top edge + outRect.top = spacing; + } + outRect.bottom = spacing; // item bottom + } else { + outRect.left = column * spacing / spanCount; // column * ((1f / spanCount) * spacing) + outRect.right = spacing - (column + 1) * spacing / spanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing) + if (position >= spanCount) { + outRect.top = spacing; // item top + } + } + } + } + + /** + * Converting dp to pixel + */ + private int dpToPx(int dp) { + Resources r = getResources(); + return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics())); + } + +} diff --git a/app/src/main/java/com/jintu/pickd/Activities/ManActivity.java b/app/src/main/java/com/jintu/pickd/Activities/ManActivity.java new file mode 100644 index 0000000..3aa1359 --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Activities/ManActivity.java @@ -0,0 +1,60 @@ +package com.jintu.pickd.Activities; + +import android.app.Activity; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.ListView; + +import com.jintu.pickd.R; + +import java.util.ArrayList; + +public class ManActivity extends Activity { + + Adapter adapter ; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_man); + + final ListView listview = (ListView) findViewById(R.id.mList); + final ArrayList list = new ArrayList<>(); + + list.add(getResources().getDrawable(R.drawable.m1)); + list.add(getResources().getDrawable(R.drawable.m2)); + list.add(getResources().getDrawable(R.drawable.m3)); + list.add(getResources().getDrawable(R.drawable.m4)); + list.add(getResources().getDrawable(R.drawable.m5)); + list.add(getResources().getDrawable(R.drawable.m6)); + list.add(getResources().getDrawable(R.drawable.m7)); + adapter = new Adapter(this,0,list); + listview.setAdapter(adapter); + } +} +class Adapter extends ArrayAdapter{ + ArrayList items ; + ImageView image ; + + public Adapter(Context c, int resources, ArrayListlist){ + super(c,resources,list); + this.items = list ; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + if (convertView == null) { + convertView = LayoutInflater.from(getContext()).inflate(R.layout.men_items, parent, false); + } + image= (ImageView) convertView.findViewById(R.id.mImg); + image.setBackground(items.get(position)); + return convertView; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/jintu/pickd/Activities/WelcomeActivity.java b/app/src/main/java/com/jintu/pickd/Activities/WelcomeActivity.java new file mode 100644 index 0000000..bdceb66 --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Activities/WelcomeActivity.java @@ -0,0 +1,205 @@ +package com.jintu.pickd.Activities; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; +import com.jintu.pickd.Manager.PrefManager; +import com.jintu.pickd.R; + +public class WelcomeActivity extends AppCompatActivity { + + private ViewPager viewPager; + private MyViewPagerAdapter myViewPagerAdapter; + private LinearLayout dotsLayout; + private TextView[] dots; + private int[] layouts; + private Button btnSkip, btnNext; + private PrefManager prefManager; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Checking for first time launch - before calling setContentView() + prefManager = new PrefManager(this); + if (!prefManager.isFirstTimeLaunch()) { + launchHomeScreen(); + finish(); + } + + // Making notification bar transparent + if (Build.VERSION.SDK_INT >= 21) { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); + } + + setContentView(R.layout.activity_welcome); + + viewPager = (ViewPager) findViewById(R.id.view_pager); + dotsLayout = (LinearLayout) findViewById(R.id.layoutDots); + btnSkip = (Button) findViewById(R.id.btn_skip); + btnNext = (Button) findViewById(R.id.btn_next); + + + // layouts of all welcome sliders + // add few more layouts if you want + layouts = new int[]{ + R.layout.welcome_slide_1, + R.layout.welcome_slide_2, + R.layout.welcome_slide_3, + R.layout.welcome_slide_4}; + + // adding bottom dots + addBottomDots(0); + + // making notification bar transparent + changeStatusBarColor(); + + myViewPagerAdapter = new MyViewPagerAdapter(); + viewPager.setAdapter(myViewPagerAdapter); + viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + + btnSkip.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + launchHomeScreen(); + } + }); + + btnNext.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // checking for last page + // if last page home screen will be launched + int current = getItem(+1); + if (current < layouts.length) { + // move to next screen + viewPager.setCurrentItem(current); + } else { + launchHomeScreen(); + } + } + }); + } + + + private void addBottomDots(int currentPage) { + dots = new TextView[layouts.length]; + + int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); + int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + + dotsLayout.removeAllViews(); + for (int i = 0; i < dots.length; i++) { + dots[i] = new TextView(this); + dots[i].setText(Html.fromHtml("•")); + dots[i].setTextSize(35); + dots[i].setTextColor(colorsInactive[currentPage]); + dotsLayout.addView(dots[i]); + } + + if (dots.length > 0) + dots[currentPage].setTextColor(colorsActive[currentPage]); + } + + private int getItem(int i) { + return viewPager.getCurrentItem() + i; + } + + private void launchHomeScreen() { + prefManager.setFirstTimeLaunch(false); + startActivity(new Intent(WelcomeActivity.this, MainActivity.class)); + finish(); + } + + // viewpager change listener + ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() { + + @Override + public void onPageSelected(int position) { + addBottomDots(position); + + // changing the next button text 'NEXT' / 'GOT IT' + if (position == layouts.length - 1) { + // last page. make button text to GOT IT + btnNext.setText(getString(R.string.start)); + btnSkip.setVisibility(View.GONE); + } else { + // still pages are left + btnNext.setText(getString(R.string.next)); + btnSkip.setVisibility(View.VISIBLE); + } + } + + @Override + public void onPageScrolled(int arg0, float arg1, int arg2) { + + } + + @Override + public void onPageScrollStateChanged(int arg0) { + + } + }; + + /** + * Making notification bar transparent + */ + private void changeStatusBarColor() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(Color.TRANSPARENT); + } + } + + /** + * View pager adapter + */ + public class MyViewPagerAdapter extends PagerAdapter { + private LayoutInflater layoutInflater; + + public MyViewPagerAdapter() { + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + View view = layoutInflater.inflate(layouts[position], container, false); + container.addView(view); + + return view; + } + + @Override + public int getCount() { + return layouts.length; + } + + @Override + public boolean isViewFromObject(View view, Object obj) { + return view == obj; + } + + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + View view = (View) object; + container.removeView(view); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/jintu/pickd/Activities/WomanActivity.java b/app/src/main/java/com/jintu/pickd/Activities/WomanActivity.java new file mode 100644 index 0000000..e0a6ab3 --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Activities/WomanActivity.java @@ -0,0 +1,15 @@ +package com.jintu.pickd.Activities; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +import com.jintu.pickd.R; + +public class WomanActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_woman); + } +} diff --git a/app/src/main/java/com/jintu/pickd/Adapter/CategoryAdapter.java b/app/src/main/java/com/jintu/pickd/Adapter/CategoryAdapter.java new file mode 100644 index 0000000..94b77f7 --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Adapter/CategoryAdapter.java @@ -0,0 +1,71 @@ +package com.jintu.pickd.Adapter; + +import android.content.Context; +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.jintu.pickd.Model.Category; +import com.jintu.pickd.R; + +import java.util.List; + +/** + * Created by Jack on 4/1/2017. + */ + +public class CategoryAdapter extends RecyclerView.Adapter { + + private Context mContext; + private List CategoryList; + + public class MyViewHolder extends RecyclerView.ViewHolder { + public TextView title, count; + public ImageView thumbnail; + + public MyViewHolder(View view) { + super(view); + title = (TextView) view.findViewById(R.id.title); + // count = (TextView) view.findViewById(R.id.count); + thumbnail = (ImageView) view.findViewById(R.id.thumbnail); + } + } + + + public CategoryAdapter(Context mContext, List CategoryList) { + this.mContext = mContext; + this.CategoryList = CategoryList; + } + + @Override + public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View itemView = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.album_card, parent, false); + + return new MyViewHolder(itemView); + } + + @Override + public void onBindViewHolder(final MyViewHolder holder, int position) { + Category Category = CategoryList.get(position); + holder.title.setText(Category.getName()); + // holder.count.setText(Category.getNumOfSongs() + " songs"); + + // loading Category cover using Glide library + Glide + .with(mContext) + .load(Category.getThumbnail()) + .into(holder.thumbnail); + } + + + + @Override + public int getItemCount() { + return CategoryList.size(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/jintu/pickd/Manager/PrefManager.java b/app/src/main/java/com/jintu/pickd/Manager/PrefManager.java new file mode 100644 index 0000000..46bd82e --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Manager/PrefManager.java @@ -0,0 +1,38 @@ +package com.jintu.pickd.Manager; + +import android.content.Context; +import android.content.SharedPreferences; + +/** + * Created by Jack on 3/31/2017. + */ + +public class PrefManager { + SharedPreferences pref; + SharedPreferences.Editor editor; + Context _context; + + // shared pref mode + int PRIVATE_MODE = 0; + + // Shared preferences file name + private static final String PREF_NAME = "PickD-welcome"; + + private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; + + public PrefManager(Context context) { + this._context = context; + pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); + editor = pref.edit(); + } + + public void setFirstTimeLaunch(boolean isFirstTime) { + editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); + editor.commit(); + } + + public boolean isFirstTimeLaunch() { + return pref.getBoolean(IS_FIRST_TIME_LAUNCH, true); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/jintu/pickd/Model/Category.java b/app/src/main/java/com/jintu/pickd/Model/Category.java new file mode 100644 index 0000000..4533e7f --- /dev/null +++ b/app/src/main/java/com/jintu/pickd/Model/Category.java @@ -0,0 +1,44 @@ +package com.jintu.pickd.Model; + +/** + * Created by Jack on 4/1/2017. + */ + +public class Category { + private String name; + private int numOfSongs; + private int thumbnail; + + public Category() { + } + + public Category(String name, int numOfSongs, int thumbnail) { + this.name = name; + this.numOfSongs = numOfSongs; + this.thumbnail = thumbnail; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getNumOfSongs() { + return numOfSongs; + } + + public void setNumOfSongs(int numOfSongs) { + this.numOfSongs = numOfSongs; + } + + public int getThumbnail() { + return thumbnail; + } + + public void setThumbnail(int thumbnail) { + this.thumbnail = thumbnail; + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_discount.png b/app/src/main/res/drawable-hdpi/ic_discount.png new file mode 100644 index 0000000..debc27b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_discount.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_food.png b/app/src/main/res/drawable-hdpi/ic_food.png new file mode 100644 index 0000000..3618ae5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_food.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_movie.png b/app/src/main/res/drawable-hdpi/ic_movie.png new file mode 100644 index 0000000..0d96620 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_movie.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_travel.png b/app/src/main/res/drawable-hdpi/ic_travel.png new file mode 100644 index 0000000..d94496a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_travel.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_discount.png b/app/src/main/res/drawable-mdpi/ic_discount.png new file mode 100644 index 0000000..a51125c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_discount.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_food.png b/app/src/main/res/drawable-mdpi/ic_food.png new file mode 100644 index 0000000..5e764e0 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_food.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_movie.png b/app/src/main/res/drawable-mdpi/ic_movie.png new file mode 100644 index 0000000..c5a9546 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_movie.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_travel.png b/app/src/main/res/drawable-mdpi/ic_travel.png new file mode 100644 index 0000000..920c404 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_travel.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_discount.png b/app/src/main/res/drawable-xhdpi/ic_discount.png new file mode 100644 index 0000000..254c078 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_discount.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_food.png b/app/src/main/res/drawable-xhdpi/ic_food.png new file mode 100644 index 0000000..7af31ae Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_food.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_movie.png b/app/src/main/res/drawable-xhdpi/ic_movie.png new file mode 100644 index 0000000..cc2ebf6 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_movie.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_travel.png b/app/src/main/res/drawable-xhdpi/ic_travel.png new file mode 100644 index 0000000..9236d04 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_travel.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_discount.png b/app/src/main/res/drawable-xxhdpi/ic_discount.png new file mode 100644 index 0000000..f038d73 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_discount.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_food.png b/app/src/main/res/drawable-xxhdpi/ic_food.png new file mode 100644 index 0000000..bb3bc0e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_food.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_movie.png b/app/src/main/res/drawable-xxhdpi/ic_movie.png new file mode 100644 index 0000000..73e528d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_movie.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_travel.png b/app/src/main/res/drawable-xxhdpi/ic_travel.png new file mode 100644 index 0000000..1fbbd97 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_travel.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_discount.png b/app/src/main/res/drawable-xxxhdpi/ic_discount.png new file mode 100644 index 0000000..ee9a3a5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_discount.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_food.png b/app/src/main/res/drawable-xxxhdpi/ic_food.png new file mode 100644 index 0000000..2ac75ad Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_food.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_movie.png b/app/src/main/res/drawable-xxxhdpi/ic_movie.png new file mode 100644 index 0000000..83436bf Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_movie.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_travel.png b/app/src/main/res/drawable-xxxhdpi/ic_travel.png new file mode 100644 index 0000000..ad12cd3 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_travel.png differ diff --git a/app/src/main/res/drawable/adidas.png b/app/src/main/res/drawable/adidas.png new file mode 100644 index 0000000..bff4214 Binary files /dev/null and b/app/src/main/res/drawable/adidas.png differ diff --git a/app/src/main/res/drawable/allensolly.png b/app/src/main/res/drawable/allensolly.png new file mode 100644 index 0000000..96d1057 Binary files /dev/null and b/app/src/main/res/drawable/allensolly.png differ diff --git a/app/src/main/res/drawable/baby.jpg b/app/src/main/res/drawable/baby.jpg new file mode 100644 index 0000000..31d5e51 Binary files /dev/null and b/app/src/main/res/drawable/baby.jpg differ diff --git a/app/src/main/res/drawable/book.jpg b/app/src/main/res/drawable/book.jpg new file mode 100644 index 0000000..768723e Binary files /dev/null and b/app/src/main/res/drawable/book.jpg differ diff --git a/app/src/main/res/drawable/c1.jpg b/app/src/main/res/drawable/c1.jpg new file mode 100644 index 0000000..5c60b45 Binary files /dev/null and b/app/src/main/res/drawable/c1.jpg differ diff --git a/app/src/main/res/drawable/c2.jpg b/app/src/main/res/drawable/c2.jpg new file mode 100644 index 0000000..0d07908 Binary files /dev/null and b/app/src/main/res/drawable/c2.jpg differ diff --git a/app/src/main/res/drawable/c3.jpg b/app/src/main/res/drawable/c3.jpg new file mode 100644 index 0000000..80a500d Binary files /dev/null and b/app/src/main/res/drawable/c3.jpg differ diff --git a/app/src/main/res/drawable/c5.jpg b/app/src/main/res/drawable/c5.jpg new file mode 100644 index 0000000..5806d2c Binary files /dev/null and b/app/src/main/res/drawable/c5.jpg differ diff --git a/app/src/main/res/drawable/c7.jpg b/app/src/main/res/drawable/c7.jpg new file mode 100644 index 0000000..e74881d Binary files /dev/null and b/app/src/main/res/drawable/c7.jpg differ diff --git a/app/src/main/res/drawable/c8.jpg b/app/src/main/res/drawable/c8.jpg new file mode 100644 index 0000000..0675908 Binary files /dev/null and b/app/src/main/res/drawable/c8.jpg differ diff --git a/app/src/main/res/drawable/c9.jpg b/app/src/main/res/drawable/c9.jpg new file mode 100644 index 0000000..2ed406d Binary files /dev/null and b/app/src/main/res/drawable/c9.jpg differ diff --git a/app/src/main/res/drawable/cover.jpg b/app/src/main/res/drawable/cover.jpg new file mode 100644 index 0000000..41b5c07 Binary files /dev/null and b/app/src/main/res/drawable/cover.jpg differ diff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.png new file mode 100644 index 0000000..df24d29 Binary files /dev/null and b/app/src/main/res/drawable/logo.png differ diff --git a/app/src/main/res/drawable/m1.png b/app/src/main/res/drawable/m1.png new file mode 100644 index 0000000..3c150b4 Binary files /dev/null and b/app/src/main/res/drawable/m1.png differ diff --git a/app/src/main/res/drawable/m2.png b/app/src/main/res/drawable/m2.png new file mode 100644 index 0000000..a2a46c9 Binary files /dev/null and b/app/src/main/res/drawable/m2.png differ diff --git a/app/src/main/res/drawable/m3.png b/app/src/main/res/drawable/m3.png new file mode 100644 index 0000000..0eab41e Binary files /dev/null and b/app/src/main/res/drawable/m3.png differ diff --git a/app/src/main/res/drawable/m4.png b/app/src/main/res/drawable/m4.png new file mode 100644 index 0000000..49a721d Binary files /dev/null and b/app/src/main/res/drawable/m4.png differ diff --git a/app/src/main/res/drawable/m5.png b/app/src/main/res/drawable/m5.png new file mode 100644 index 0000000..c3d8c1e Binary files /dev/null and b/app/src/main/res/drawable/m5.png differ diff --git a/app/src/main/res/drawable/m6.png b/app/src/main/res/drawable/m6.png new file mode 100644 index 0000000..df254dc Binary files /dev/null and b/app/src/main/res/drawable/m6.png differ diff --git a/app/src/main/res/drawable/m7.png b/app/src/main/res/drawable/m7.png new file mode 100644 index 0000000..b3e07fd Binary files /dev/null and b/app/src/main/res/drawable/m7.png differ diff --git a/app/src/main/res/drawable/mall.png b/app/src/main/res/drawable/mall.png new file mode 100644 index 0000000..c530b04 Binary files /dev/null and b/app/src/main/res/drawable/mall.png differ diff --git a/app/src/main/res/drawable/mands.png b/app/src/main/res/drawable/mands.png new file mode 100644 index 0000000..1335411 Binary files /dev/null and b/app/src/main/res/drawable/mands.png differ diff --git a/app/src/main/res/drawable/puma.png b/app/src/main/res/drawable/puma.png new file mode 100644 index 0000000..f5aec6b Binary files /dev/null and b/app/src/main/res/drawable/puma.png differ diff --git a/app/src/main/res/layout/activity_electronics.xml b/app/src/main/res/layout/activity_electronics.xml new file mode 100644 index 0000000..f77138a --- /dev/null +++ b/app/src/main/res/layout/activity_electronics.xml @@ -0,0 +1,9 @@ + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..ca5a983 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_man.xml b/app/src/main/res/layout/activity_man.xml new file mode 100644 index 0000000..0d65c70 --- /dev/null +++ b/app/src/main/res/layout/activity_man.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_welcome.xml b/app/src/main/res/layout/activity_welcome.xml new file mode 100644 index 0000000..fae0a80 --- /dev/null +++ b/app/src/main/res/layout/activity_welcome.xml @@ -0,0 +1,51 @@ + + + + + + + + + + +