Connect with us

Android UI KIT

My Profile

Step 1: Open android studio. Go to File- new -Activity- Empty activity-Tasklongpress.
Step 2: Go to the res folder.
Step 3:Paste below code to MyProfile.xml.
Step 4:Add recyclerview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for recyclerview library-press ok.
Step 5:Add cardview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for cardview library-press ok.
Step 6:Add Circleimageview library in buil.gradle.
implementation ‘de.hdodenhof:circleimageview:3.0.0’

Paste below code to myprofile.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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:background="#f9f9f9"
    tools:context=".Myprofile">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <include layout="@layout/toolbar" />

            <android.support.v4.widget.NestedScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:overScrollMode="never"
                android:scrollbars="none">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="56.6dp"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="41.3dp"
                        android:orientation="horizontal">

                        <de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
                            android:id="@+id/profile_image"
                            android:layout_width="50.4dp"
                            android:layout_height="49.9dp"
                            android:src="@drawable/profile" />

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="19.2dp"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:fontFamily=""
                                android:text="Jihun Tae-Hee"
                                android:textColor="#4f4f6f"
                                android:textSize="21.1sp" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="6.5dp"
                                android:drawableLeft="@drawable/oval_green"
                                android:drawablePadding="4.2dp"
                                android:fontFamily="@font/helveticaneue"
                                android:text="Manager"
                                android:textColor="#88889c"
                                android:textSize="12sp" />

                        </LinearLayout>

                    </LinearLayout>

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:layout_marginTop="26.3dp"
                        android:background="#e3e3e3" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="23.2dp"
                        android:orientation="horizontal"
                        android:padding="10dp">

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:orientation="vertical">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Your sales"
                                android:textColor="#6a6a77"
                                android:textSize="15.4sp" />

                            <LinearLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:fontFamily="@font/helvetica_thin"
                                    android:text="€ "
                                    android:textColor="#c0c0cf"
                                    android:textSize="22.1sp" />

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="279 300"
                                    android:textColor="#4f4f6f"
                                    android:textSize="22.1sp" />


                            </LinearLayout>

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="17dp"
                                android:fontFamily="@font/helveticaneue"
                                android:text="Sales amount"
                                android:textColor="#c0c0cf"
                                android:textSize="10.6sp" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:orientation="vertical">

                            <Spinner
                                android:id="@+id/spinner"
                                android:layout_width="wrap_content"
                                android:layout_height="50dp"
                                android:background="@drawable/custom_spinner"
                                android:dropDownVerticalOffset="50dp"
                                android:paddingHorizontal="0dp" />

                            <ImageView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:src="@drawable/path_45"
                                android:tint="#4745fa" />

                        </LinearLayout>

                    </LinearLayout>

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/recycler_profile"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="33.8dp"/>

                </LinearLayout>

            </android.support.v4.widget.NestedScrollView>

        </LinearLayout>

    </ScrollView>


</RelativeLayout>

Create item_myprofile.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginRight="16.8dp"
    android:layout_marginBottom="16.8dp"
    android:layout_weight="1"
    app:cardElevation="0dp"
    android:elevation="0dp"
    app:cardCornerRadius="2.4dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingLeft="27dp"
        android:paddingTop="14.4dp"
        android:paddingRight="32dp"
        android:paddingBottom="12.1dp">

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/imgteammember"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:src="@drawable/team_members" />

            <ImageView
                android:id="@+id/one"
                android:visibility="gone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="top|end"
                android:src="@drawable/ic_number_one_inside_a_circle" />

        </FrameLayout>

        <TextView
            android:id="@+id/txtmember"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="44.4dp"
            android:fontFamily="@font/helveticaneue_medium"
            android:text="Team Members"
            android:textColor="#6a6a77"
            android:textSize="13sp"/>

        <TextView
            android:id="@+id/txtpeople"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4.8dp"
            android:fontFamily="@font/helveticaneue"
            android:text="19 People"
            android:textColor="#88889c"
            android:textSize="10.6sp" />

    </LinearLayout>

</android.support.v7.widget.CardView>

Create Model Class- MyProfile.java

Step 1: Create package ModelClass.
Step 2: Add Java class – MyProfileModel.
Step 3: Add id.
Step 4: Create Constructor. AND Create getter setter method.

package com.wolfsoft.avsc.model;

public class MyProfileModel {

    Integer imgteammember;

    String txtmember,txtpeople;

    public Integer getImgteammember() {
        return imgteammember;
    }

    public void setImgteammember(Integer imgteammember) {
        this.imgteammember = imgteammember;
    }

    public String getTxtmember() {
        return txtmember;
    }

    public void setTxtmember(String txtmember) {
        this.txtmember = txtmember;
    }

    public String getTxtpeople() {
        return txtpeople;
    }

    public void setTxtpeople(String txtpeople) {
        this.txtpeople = txtpeople;
    }

    public MyProfileModel(Integer imgteammember, String txtmember, String txtpeople) {
        this.imgteammember = imgteammember;
        this.txtmember = txtmember;
        this.txtpeople = txtpeople;
    }
}

Create Adapter -Myprofile.java

Step 1: Create package Adapter.
Step 2: Add Java class – MyProfileAdapter.
Step 3: Implement Methods.
Step 4:Paste Below Code to tTrafficAdapter.

package com.wolfsoft.avsc.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
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.wolfsoft.avsc.R;
import com.wolfsoft.avsc.model.MyProfileModel;

import java.util.ArrayList;


public class MyProfileAdapter extends RecyclerView.Adapter<MyProfileAdapter.ViewHolder> {

    Context context;
    private ArrayList<MyProfileModel> myProfileModelArrayList;


    public MyProfileAdapter(Context context, ArrayList<MyProfileModel> myProfileModelArrayList) {
        this.context = context;
        this.myProfileModelArrayList = myProfileModelArrayList;
    }

    @NonNull
    @Override
    public MyProfileAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_myprofile,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull MyProfileAdapter.ViewHolder holder, final int position) {

        holder.imgteammember.setImageResource(myProfileModelArrayList.get(position).getImgteammember());
        holder.txtmember.setText(myProfileModelArrayList.get(position).getTxtmember());
        holder.txtpeople.setText(myProfileModelArrayList.get(position).getTxtpeople());

        if(position==1){

            holder.one.setVisibility(View.VISIBLE);
        }

    }

    @Override
    public int getItemCount() {
        return myProfileModelArrayList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        ImageView imgteammember,one;

        TextView txtmember,txtpeople;

        public ViewHolder(View itemView) {

            super(itemView);

            imgteammember=itemView.findViewById(R.id.imgteammember);
            txtmember=itemView.findViewById(R.id.txtmember);
            txtpeople=itemView.findViewById(R.id.txtpeople);
            one=itemView.findViewById(R.id.one);

        }
    }
}

MyProfile.java

Step 1: Set Linearlayout Manager to GridLayout Manager. and give it Span count.

package com.wolfsoft.avsc;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import com.wolfsoft.avsc.adapter.MyProfileAdapter;
import com.wolfsoft.avsc.model.MyProfileModel;
import java.util.ArrayList;
import java.util.List;

public class Myprofile extends AppCompatActivity {

    ImageView profile_image;

    private Spinner spinner;

    private MyProfileAdapter myProfileAdapter;
    private ArrayList<MyProfileModel> myProfileModelArrayList;
    private RecyclerView recyclerView;


    Integer[] imgteammember = {R.drawable.team_members,R.drawable.points_of_sale
            ,R.drawable.my_contacts,R.drawable.notes};

    String[] txtmember = {"Team Members","Points of Sale","My Contacts", "Notes"};

    String[] txtpeople = {"19 People","12 Cities","10 New", "17 Open"};



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_myprofile);

        profile_image=findViewById(R.id.profile_image);
        profile_image.setImageResource(R.drawable.ic_settings);

        /*Spinner*/
        spinner = (Spinner) findViewById(R.id.spinner);
        List<String> list = new ArrayList<String>();
        list.add("Last Week");
        list.add("This Week");
        list.add("Last Week");
        list.add("This Week");
        list.add("Last Week");

        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(Myprofile.this, R.layout.item_country,
                R.id.textCountry, list);
        spinner.setAdapter(dataAdapter);


        recyclerView = findViewById(R.id.recycler_profile);
        RecyclerView.LayoutManager layoutManager = new GridLayoutManager(Myprofile.this,2);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());

        myProfileModelArrayList = new ArrayList<>();

        for (int i = 0; i < imgteammember.length; i++) {
            MyProfileModel view1 = new MyProfileModel(imgteammember[i],txtmember[i],txtpeople[i]);
            myProfileModelArrayList.add(view1);
        }

        myProfileAdapter = new MyProfileAdapter(Myprofile.this,myProfileModelArrayList);
        recyclerView.setAdapter(myProfileAdapter);

    }
}

Android UIUX Developer at WSDesign.

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Android UI KIT

Orders avsc

Step 1: Open android studio. Go to File- new -Activity- Empty activity-Orders.
Step 2: Go to the res folder.
Step 3:Paste below code to orders.xml.
Step 4:Add recyclerview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for recyclerview library-press ok.
Step 5:Add cardview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for cardview library-press ok.

orders.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
    android:orientation="vertical"
    tools:context=".Orders">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20.1dp"
                android:layout_marginTop="37.9dp"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/ic_left_arrow" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20.9dp"
                    android:fontFamily="@font/helveticaneue_light"
                    android:text="February"
                    android:textColor="#4d4c58"
                    android:textSize="22.1sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/helvetica_light"
                    android:text=" 2018"
                    android:textColor="#b1b1c0"
                    android:textSize="22.1sp" />

            </LinearLayout>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="57.6dp"
                android:layout_marginTop="5.3dp"
                android:text="Delivery availability"
                android:textColor="#9ea4af"
                android:textSize="11.5sp" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_weekdays"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="48.6dp"
                android:clipToPadding="false"
                android:paddingLeft="57.6dp" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="57.1dp"
                android:layout_marginTop="27.8dp"
                android:background="@drawable/rect_skyblue_bg"
                android:orientation="horizontal"
                android:paddingLeft="12dp"
                android:paddingTop="13.4dp"
                android:paddingBottom="13.5dp">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/information" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginLeft="9.6dp"
                    android:fontFamily="@font/helveticaneue_medium"
                    android:text="Be sure to stay and pick up the package"
                    android:textColor="#9999ae"
                    android:textSize="9.1sp" />


                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginLeft="55.4dp"
                    android:src="@drawable/ic_cross_2" />


            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="58.1dp"
                android:layout_marginTop="29.3dp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="27.8dp"
                    android:orientation="horizontal">

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/ic_circle_shape_outline"
                        android:tint="#e7e6ee" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:text="Morning"
                            android:textColor="#6a6a77"
                            android:textSize="12.5sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:layout_marginTop="6.6dp"
                            android:fontFamily="@font/helveticaneue"
                            android:text="Summer Collection Update"
                            android:textColor="#9ea4af"
                            android:textSize="10.6sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:layout_marginTop="6.6dp"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="08:00 - 12:00"
                            android:textColor="#9ea4af"
                            android:textSize="10.6sp" />

                    </LinearLayout>

                    <ImageView
                        android:id="@+id/toggle1"
                        android:layout_width="36.7dp"
                        android:layout_height="22.3dp"
                        android:layout_marginTop="19.6dp"
                        android:src="@drawable/ic_toggle_off"/>


                </LinearLayout>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginTop="18.7dp"
                    android:background="#e3e3e3" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="24dp"
                    android:layout_marginRight="27.8dp"
                    android:orientation="horizontal">

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/ic_circle_shape_outline"
                        android:tint="#ff7a10" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:text="Afternoon"
                            android:textColor="#6a6a77"
                            android:textSize="12.5sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:layout_marginTop="6.6dp"
                            android:fontFamily="@font/helveticaneue"
                            android:text="New accesories set"
                            android:textColor="#9ea4af"
                            android:textSize="10.6sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:layout_marginTop="6.6dp"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="12:00 - 16:00"
                            android:textColor="#9ea4af"
                            android:textSize="10.6sp" />

                    </LinearLayout>

                    <ImageView
                        android:id="@+id/toggle2"
                        android:layout_width="36.7dp"
                        android:layout_height="22.3dp"
                        android:layout_marginTop="19.6dp"
                        android:src="@drawable/ic_toggle_off"/>



                </LinearLayout>


                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginTop="18.7dp"
                    android:background="#e3e3e3" />


                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="24dp"
                    android:layout_marginRight="27.8dp"
                    android:orientation="horizontal">

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/ic_circle_shape_outline"
                        android:tint="#e7e6ee" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:text="Evening"
                            android:textColor="#6a6a77"
                            android:textSize="12.5sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:layout_marginTop="6.6dp"
                            android:fontFamily="@font/helveticaneue"
                            android:text="Online store orders"
                            android:textColor="#9ea4af"
                            android:textSize="10.6sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="20.6dp"
                            android:layout_marginTop="6.6dp"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="16:00 - 21:00"
                            android:textColor="#9ea4af"
                            android:textSize="10.6sp" />
                    </LinearLayout>

                    <ImageView
                        android:id="@+id/toggle3"
                        android:layout_width="36.7dp"
                        android:layout_height="22.3dp"
                        android:layout_marginTop="19.6dp"
                        android:src="@drawable/ic_toggle_off"/>

                </LinearLayout>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginTop="18.7dp"
                    android:background="#e3e3e3" />


            </LinearLayout>

        </LinearLayout>

    </ScrollView>


</LinearLayout>

create item_orders.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="87.4dp"
    android:layout_height="wrap_content"
    android:layout_marginRight="7.2dp"
    android:orientation="vertical"
    app:cardCornerRadius="4.8dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:id="@+id/txtday"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/rect_white"
            android:fontFamily="@font/helveticaneue_medium"
            android:paddingLeft="11dp"
            android:paddingTop="8.6dp"
            android:paddingBottom="8dp"
            android:text="Monday"
            android:textColor="#79859c"
            android:textSize="10.6sp" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#f1f1f1" />

        <LinearLayout
            android:id="@+id/linear_date"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/rect_skyblue_bg"
            android:orientation="vertical">

            <FrameLayout
                android:layout_marginTop="9.6dp"
                android:layout_marginRight="9.7dp"
                android:layout_gravity="right"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <ImageView
                    android:id="@+id/imgcircle"
                    android:layout_width="9.5dp"
                    android:layout_height="9.5dp"
                    android:layout_marginRight="2dp"
                    android:src="@drawable/ic_circle_shape_outline"
                    android:tint="#ff892b" />


                <ImageView
                    android:id="@+id/imgcircleblue"
                    android:visibility="gone"
                    android:layout_marginLeft="14dp"
                    android:layout_marginTop="1dp"
                    android:layout_width="7.6dp"
                    android:layout_height="7.6dp"
                    android:src="@drawable/ic_circle_blue_outline" />

            </FrameLayout>


            <TextView
                android:id="@+id/txtdate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="@font/helvetica"
                android:paddingLeft="10.6dp"
                android:text="5"
                android:textColor="#79859c"
                android:textSize="44.2sp" />

        </LinearLayout>

    </LinearLayout>

</android.support.v7.widget.CardView>

Create Model Class

Step 1: Create package ModelClass.
Step 2: Add Java class - OrderModel.
Step 3: Add textview id n imageview id.
Step 4: Create Constructor. AND Create getter setter method.
package com.wolfsoft.avsc.model;

public class OrderModel {


    Integer imgcircle;

    String txtday,txtdate;

    public Integer getImgcircle() {
        return imgcircle;
    }

    public void setImgcircle(Integer imgcircle) {
        this.imgcircle = imgcircle;
    }

    public String getTxtday() {
        return txtday;
    }

    public void setTxtday(String txtday) {
        this.txtday = txtday;
    }

    public String getTxtdate() {
        return txtdate;
    }

    public void setTxtdate(String txtdate) {
        this.txtdate = txtdate;
    }

    public OrderModel(Integer imgcircle, String txtday, String txtdate) {
        this.imgcircle = imgcircle;
        this.txtday = txtday;
        this.txtdate = txtdate;
    }
}

Create Adapter

Step 1: Create package Adapter.
Step 2: Add Java class – OrderAdapter.
Step 3: Implement Methods.
Step 4:Paste Below Code to OrderAdapter.

package com.wolfsoft.avsc.adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.annotation.NonNull;
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.LinearLayout;
import android.widget.TextView;
import com.wolfsoft.avsc.R;
import com.wolfsoft.avsc.model.OrderModel;

import java.util.ArrayList;

public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.ViewHolder> {
    int myPos=0;

    Context context;
    private ArrayList<OrderModel> orderModelArrayList;

    public OrderAdapter(Context context, ArrayList<OrderModel> orderModelArrayList) {
        this.context = context;
        this.orderModelArrayList = orderModelArrayList;
    }

    @NonNull
    @Override
    public OrderAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_orders,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull OrderAdapter.ViewHolder holder, final int position) {

        holder.imgcircle.setImageResource(orderModelArrayList.get(position).getImgcircle());
        holder.txtday.setText(orderModelArrayList.get(position).getTxtday());
        holder.txtdate.setText(orderModelArrayList.get(position).getTxtdate());

        if (position==myPos){
            holder.txtday.setTextColor(Color.parseColor("#ffffff"));
            holder.txtdate.setTextColor(Color.parseColor("#ffffff"));
            holder.txtday.setBackgroundResource(R.drawable.dark_gradient_gray);
            holder.linear_date.setBackgroundResource(R.drawable.dark_gradient_gray);
        }
        else{

            holder.txtday.setTextColor(Color.parseColor("#79859c"));
            holder.txtdate.setTextColor(Color.parseColor("#79859c"));
            holder.txtday.setBackgroundResource(R.drawable.rect_white);
            holder.linear_date.setBackgroundResource(R.drawable.rect_white);

        }

        if (position==1){
            holder.imgcircle.setImageResource(R.drawable.ic_circle_green_outline);
            holder.imgcircleblue.setVisibility(View.VISIBLE);
        }

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                myPos=position;
                notifyDataSetChanged();
            }
        });
    }

    @Override
    public int getItemCount() {
        return orderModelArrayList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        ImageView imgcircle,imgcircleblue;

        TextView txtday,txtdate;

        LinearLayout linear_date;


        public ViewHolder(View itemView) {

            super(itemView);

            imgcircle=itemView.findViewById(R.id.imgcircle);
            txtday=itemView.findViewById(R.id.txtday);
            txtdate=itemView.findViewById(R.id.txtdate);
            linear_date=itemView.findViewById(R.id.linear_date);
            imgcircleblue=itemView.findViewById(R.id.imgcircleblue);

        }
    }
}

Ordersavsc.java

package com.wolfsoft.avsc;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.wolfsoft.avsc.adapter.OrderAdapter;
import com.wolfsoft.avsc.model.OrderModel;
import java.util.ArrayList;

public class Orders extends AppCompatActivity implements View.OnClickListener {

    ImageView toggle1,toggle2,toggle3;

    private OrderAdapter orderAdapter;
    private ArrayList<OrderModel> orderModelArrayList;
    private RecyclerView recyclerView;


    Integer[] imgcircle = {R.drawable.ic_circle_shape_outline, R.drawable.ic_circle_shape_outline
            , R.drawable.ic_circle_shape_outline, R.drawable.ic_circle_shape_outline,
            R.drawable.ic_circle_shape_outline, R.drawable.ic_circle_shape_outline};

    String[] txtday = {"Monday", "Tuesday",
            "Wednesday", "Thursday",
            "Friday", "Saturday"};

    String[] txtdate = {"5", "6",
            "7", "8",
            "9", "10"};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_orders);

        toggle1=findViewById(R.id.toggle1);
        toggle2=findViewById(R.id.toggle2);
        toggle3=findViewById(R.id.toggle3);

        toggle1.setOnClickListener(this);
        toggle2.setOnClickListener(this);
        toggle3.setOnClickListener(this);



        recyclerView = findViewById(R.id.recycler_weekdays);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(Orders.this, LinearLayoutManager.HORIZONTAL, false);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());

        orderModelArrayList = new ArrayList<>();

        for (int i = 0; i < imgcircle.length; i++) {
            OrderModel view1 = new OrderModel(imgcircle[i], txtday[i], txtdate[i]);
            orderModelArrayList.add(view1);

        }
        orderAdapter = new OrderAdapter(Orders.this, orderModelArrayList);
        recyclerView.setAdapter(orderAdapter);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {

            case R.id.toggle1:

                toggle1.setImageResource(R.drawable.ic_toggle_on);
                toggle2.setImageResource(R.drawable.ic_toggle_off);
                toggle3.setImageResource(R.drawable.ic_toggle_off);

                break;



            case R.id.toggle2:

                toggle1.setImageResource(R.drawable.ic_toggle_off);
                toggle2.setImageResource(R.drawable.ic_toggle_on);
                toggle3.setImageResource(R.drawable.ic_toggle_off);

                break;



            case R.id.toggle3:

                toggle1.setImageResource(R.drawable.ic_toggle_off);
                toggle2.setImageResource(R.drawable.ic_toggle_off);
                toggle3.setImageResource(R.drawable.ic_toggle_on);

                break;
        }




    }
}

Continue Reading

Android UI KIT

Calender avsc

Step 1:Add recyclerview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for recyclerview library-press ok.

paste below code to calenderavsc.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="#ffffff"
    tools:context=".Calender">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        android:paddingBottom="50dp"
        android:clipToPadding="false">

          <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <include layout="@layout/toolbar"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="37dp"
                android:orientation="vertical"
                android:background="#ffffff">

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recycler_calender"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recycler_day"
                    android:paddingLeft="38.4dp"
                    android:clipToPadding="false"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

            </LinearLayout>

        </LinearLayout>

    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="right"
        android:orientation="vertical">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/plus_green" />

    </LinearLayout>

</RelativeLayout>

create item.xml

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_margin="12dp"
    android:background="@drawable/rect_white"
    app:cardCornerRadius="4.8dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="vertical"
        android:paddingTop="12.7dp"
        android:paddingBottom="12.5dp">

            <ImageView
                android:id="@+id/imgbag"
                android:layout_width="20.2dp"
                android:layout_height="20.2dp"
                android:layout_gravity="center"
                android:scaleType="centerCrop"
                android:src="@drawable/bag" />

            <TextView
                android:id="@+id/txtconversion"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="9.6dp"
                android:text="@string/conversion"
                android:textColor="#6a6a77"
                android:textSize="9.6sp"/>


    </LinearLayout>

</android.support.v7.widget.CardView>

Create Model class

Step 1: Create package ModelClass.
Step 2: Add Java class – TrafficModel.
Step 3: Add textview id n imageview id.
Step 4: Creat

package com.wolfsoft.avsc.model;


public class TrafficModel {

    Integer imgbag;

    String txtconversion;


    public Integer getImgbag() {
        return imgbag;
    }

    public void setImgbag(Integer imgbag) {
        this.imgbag = imgbag;
    }

    public String getTxtconversion() {
        return txtconversion;
    }

    public void setTxtconversion(String txtconversion) {
        this.txtconversion = txtconversion;
    }

    public TrafficModel(Integer imgbag, String txtconversion) {
        this.imgbag = imgbag;
        this.txtconversion = txtconversion;
    }
}

Create adapter

Step 1: Create package Adapter.
Step 2: Add Java class – TrafficAdapter.
Step 3: Implement Methods.
Step 4:Paste Below Code to tTrafficAdapter.

package com.wolfsoft.avsc.adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
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.wolfsoft.avsc.R;
import com.wolfsoft.avsc.model.TrafficModel;
import java.util.ArrayList;


public class TrafficAdapter extends RecyclerView.Adapter<TrafficAdapter.ViewHolder> {

    int myPos=0;

    Context context;
    private ArrayList<TrafficModel> trafficModelArrayList;

    public TrafficAdapter(Context context, ArrayList<TrafficModel> trafficModelArrayList) {
        this.context = context;
        this.trafficModelArrayList = trafficModelArrayList;
    }

    @NonNull
    @Override
    public TrafficAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_traffic,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull final TrafficAdapter.ViewHolder holder, final int position) {

        holder.imgbag.setImageResource(trafficModelArrayList.get(position).getImgbag());
        holder.txtconversion.setText(trafficModelArrayList.get(position).getTxtconversion());

        if (position==myPos){
            //  holder.card.setCardElevation(35);
         // holder.card.setOutlineSpotShadowColor(Color.parseColor("#000bff"));
            holder.imgbag.setColorFilter(Color.parseColor("#ffffff"));
            holder.txtconversion.setTextColor(Color.parseColor("#ffffff"));
            holder.card.setBackgroundResource(R.drawable.rect_blue); }

        else {

//            holder.card.setCardElevation(35);
//            holder.card.setOutlineSpotShadowColor(Color.parseColor("#808080"));
            holder.imgbag.setColorFilter(Color.parseColor("#bdc1c9"));
            holder.txtconversion.setTextColor(Color.parseColor("#6a6a77"));
            holder.card.setBackgroundResource(R.drawable.rect_white);
        }
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myPos = position;
                notifyDataSetChanged();
            }
        });
    }

    @Override
    public int getItemCount() {
        return trafficModelArrayList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {


        ImageView imgbag,one;

        TextView txtconversion;

         CardView card;

        public ViewHolder(View itemView) {

            super(itemView);


            imgbag=itemView.findViewById(R.id.imgbag);
            txtconversion=itemView.findViewById(R.id.txtconversion);
            card=itemView.findViewById(R.id.card);
            one=itemView.findViewById(R.id.one);




        }
    }
}

Calenderavsc.java

package com.wolfsoft.avsc;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import com.wolfsoft.avsc.adapter.InboxAdapter;
import com.wolfsoft.avsc.adapter.TrafficAdapter;
import com.wolfsoft.avsc.model.InboxModel;
import com.wolfsoft.avsc.model.TrafficModel;

import java.util.ArrayList;

public class Inbox extends AppCompatActivity {

    ImageView backarrow;

    private TrafficAdapter trafficAdapter;
    private ArrayList<TrafficModel> trafficModelArrayList;
    private RecyclerView recyclerView;

    Integer[] imgbag = {R.drawable.ic_done,R.drawable.ic_done
            ,R.drawable.ic_notification,R.drawable.ic_point_of_sale,
            R.drawable.ic_done,R.drawable.ic_clock};

    String[] txtconversion = {"Traffic","Conversion",
            "Alerts", "Points of Sale",
            "Tasks","Meetings"};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calender);

        backarrow=findViewById(R.id.backarrow);
        backarrow.setVisibility(View.GONE);

        recyclerView = findViewById(R.id.recycler_calender);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(Calender.this, LinearLayoutManager.HORIZONTAL, false);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());

        trafficModelArrayList = new ArrayList<>();

        for (int i = 0; i < imgbag.length; i++) {

            TrafficModel view1 = new TrafficModel(imgbag[i], txtconversion[i]);
            trafficModelArrayList.add(view1);
        }
        trafficAdapter = new TrafficAdapter(Calender.this, trafficModelArrayList);
        recyclerView.setAdapter(trafficAdapter);
}
}

Now Create second recyclerview.

Create item_calender.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginRight="10dp"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="21.6dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/txtday"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="44.3dp"
            android:fontFamily="@font/helveticaneue_light"
            android:text="@string/monday"
            android:textSize="22.1sp"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24.6dp"
            android:orientation="horizontal">

            <View
                android:layout_width="1.4dp"
                android:layout_height="86.9dp"
                android:background="#ffc47c" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="14.2dp"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/helveticaneue_medium"
                    android:text="Spring Targets"
                    android:textColor="#6a6a77"
                    android:textSize="12.5sp" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6.6dp"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:fontFamily="@font/helvetica"
                        android:text="Emilii Plater 11, Warsaw"
                        android:textColor="#6a6a77"
                        android:textSize="12.5sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helvetica"
                        android:text="15:30 - 17:00"
                        android:textColor="#6a6a77"
                        android:textSize="12.5sp" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="18.4dp"
                    android:orientation="horizontal">

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:src="@drawable/profile"
                        app:riv_corner_radius="4.8dp" />

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:layout_marginLeft="6.2dp"
                        android:src="@drawable/profile"
                        app:riv_corner_radius="4.8dp" />

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:layout_marginLeft="6.2dp"
                        android:src="@drawable/profile"
                        app:riv_corner_radius="4.8dp" />

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:layout_marginLeft="6.2dp"
                        android:src="@drawable/profile"
                        app:riv_corner_radius="4.8dp" />


                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="11.5dp"
                        android:fontFamily="@font/helveticaneue"
                        android:text="Avery, Teresa and Souhyun"
                        android:textColor="#9ea4af"
                        android:textSize="9.6sp" />


                </LinearLayout>

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24.6dp"
            android:orientation="horizontal">

            <View
                android:layout_width="1.4dp"
                android:layout_height="123.4dp"
                android:background="#76e7c6" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="14.2dp"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/helveticaneue_medium"
                    android:text="November Summary"
                    android:textColor="#6a6a77"
                    android:textSize="12.5sp" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6.6dp"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:fontFamily="@font/helvetica"
                        android:text="Kazimierza Wielkiego 3/12, Wroclaw"
                        android:textColor="#6a6a77"
                        android:textSize="12.5sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helvetica"
                        android:text="17:00 - 17:30"
                        android:textColor="#6a6a77"
                        android:textSize="12.5sp" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="18.4dp"
                    android:orientation="horizontal">

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:src="@drawable/profile1"
                        app:riv_corner_radius="4.8dp" />

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:layout_marginLeft="6.2dp"
                        android:src="@drawable/profile2"
                        app:riv_corner_radius="4.8dp" />


                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="11.5dp"
                        android:fontFamily="@font/helveticaneue"
                        android:text="Joanna and Kate"
                        android:textColor="#9ea4af"
                        android:textSize="9.6sp" />


                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16.8dp"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/txtaccept"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@drawable/rect_green"
                        android:text="Accept"
                        android:textColor="#ffffff"
                        android:textSize="11.5sp" />

                    <TextView
                        android:id="@+id/txtdecline"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="14.4dp"
                        android:text="Decline"
                        android:textColor="#656589"
                        android:textSize="11.5sp" />

                    <TextView
                        android:id="@+id/txtpostpone"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="14.4dp"
                        android:text="Postpone"
                        android:textColor="#656589"
                        android:textSize="11.5sp" />

                </LinearLayout>

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24.6dp"
            android:orientation="horizontal">

            <View
                android:layout_width="1.4dp"
                android:layout_height="86.9dp"
                android:background="#85e9cd" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="14.2dp"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/helveticaneue_medium"
                    android:text="New Collection"
                    android:textColor="#6a6a77"
                    android:textSize="12.5sp" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6.6dp"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:fontFamily="@font/helvetica"
                        android:text="Atherton St. 10B/2, Manchester"
                        android:textColor="#6a6a77"
                        android:textSize="12.5sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helvetica"
                        android:text="17:00 - 18:00"
                        android:textColor="#6a6a77"
                        android:textSize="12.5sp" />


                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="18.4dp"
                    android:orientation="horizontal">

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:src="@drawable/profile"
                        app:riv_corner_radius="4.8dp" />

                    <com.makeramen.roundedimageview.RoundedImageView
                        android:layout_width="28.8dp"
                        android:layout_height="27.8dp"
                        android:layout_marginLeft="6.2dp"
                        android:src="@drawable/profile"
                        app:riv_corner_radius="4.8dp" />


                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginLeft="11.5dp"
                        android:fontFamily="@font/helveticaneue"
                        android:text="Adrian and Elly"
                        android:textColor="#9ea4af"
                        android:textSize="9.6sp" />


                </LinearLayout>

            </LinearLayout>


        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:alpha="0.7"
        android:layout_width="25dp"
        android:layout_height="wrap_content">



    </LinearLayout>

</LinearLayout>

Create ModelClass

Step 1: Create package ModelClass.
Step 2: Add Java class – CalenderModel.
Step 3: Add textview id.
Step 4: Create Constructor. AND Create getter setter method.

package com.wolfsoft.avsc.model;

public class CalenderModel {

    String txtday;

    public String getTxtday() {
        return txtday;
    }

    public void setTxtday(String txtday) {
        this.txtday = txtday;
    }

    public CalenderModel(String txtday) {
        this.txtday = txtday;
    }
}

Create Adapter

Step 1: Create package Adapter.
Step 2: Add Java class – CalenderAdapter.
Step 3: Implement Methods.
Step 4:Paste Below Code to CalenderAdapter.

package com.wolfsoft.avsc.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.wolfsoft.avsc.R;
import com.wolfsoft.avsc.model.CalenderModel;

import java.util.ArrayList;


public class CalenderAdapter extends RecyclerView.Adapter<CalenderAdapter.ViewHolder> {

    Context context;
    private ArrayList<CalenderModel> calenderModelArrayList;

    public CalenderAdapter(Context context, ArrayList<CalenderModel> calenderModelArrayList) {
        this.context = context;
        this.calenderModelArrayList = calenderModelArrayList;

    }

    @NonNull
    @Override
    public CalenderAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_calender,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull CalenderAdapter.ViewHolder holder, final int position) {

        holder.txtday.setText(calenderModelArrayList.get(position).getTxtday());

    }

    @Override
    public int getItemCount() {

        return calenderModelArrayList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        TextView txtday;

        public ViewHolder(View itemView) {

            super(itemView);

            txtday=itemView.findViewById(R.id.txtday);


        }
    }
}

Paste below code to Calender.java

package com.wolfsoft.avsc;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.wolfsoft.avsc.adapter.CalenderAdapter;
import com.wolfsoft.avsc.adapter.TrafficAdapter;
import com.wolfsoft.avsc.model.CalenderModel;
import com.wolfsoft.avsc.model.TrafficModel;

import java.util.ArrayList;

public class Calender extends AppCompatActivity  {

    ImageView backarrow;

   
    private CalenderAdapter calenderAdapter;
    private ArrayList<CalenderModel> calenderModelArrayList;
    private RecyclerView recyclerView1;

    String[] txtday = {"Monday 27 Apr","Tuesday 28 Apr","Wednesday 29 Apr"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calender);

        backarrow=findViewById(R.id.backarrow);
        backarrow.setVisibility(View.GONE);

        

        recyclerView1 = findViewById(R.id.recycler_day);
        RecyclerView.LayoutManager layoutManager1 = new LinearLayoutManager(Calender.this, LinearLayoutManager.HORIZONTAL, false);
        recyclerView1.setLayoutManager(layoutManager1);
        recyclerView1.setItemAnimator(new DefaultItemAnimator());

        calenderModelArrayList = new ArrayList<>();

        for (int i = 0; i < txtday.length; i++) {

            CalenderModel view = new CalenderModel(txtday[i]);

            calenderModelArrayList.add(view);

        }
        calenderAdapter = new CalenderAdapter(Calender.this, calenderModelArrayList);
        recyclerView1.setAdapter(calenderAdapter);

    }
}

Continue Reading

Android UI KIT

Team avsc

Step 1: Open android studio. Go to File- new -Activity- Empty activity-Team avsc.
Step 2: Go to the res folder.
Step 3:Paste below code to teamavsc.xml.
Step 4:Create Background gradient drawable.
Step 5:Add cardview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for cardview library-press ok.
Step 6:Add recyclerview library to bulid.gradle. File-project structure-Dependencies-All dependencies- click on + and search for recyclerview library-press ok.
Step 7:Add makerman library to bulid.gradle.
implementation ‘com.makeramen:roundedimageview:2.3.0’

Paste Below Code to teamavsc.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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:background="#ffffff"
    android:overScrollMode="never"
    tools:context=".ViewPagerActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <include layout="@layout/toolbar" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycler_team"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="#eaeaea" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal">

                <Spinner
                    android:id="@+id/designteam"
                    android:layout_width="wrap_content"
                    android:layout_height="50dp"
                    android:layout_marginTop="12dp"
                    android:layout_marginBottom="12dp"
                    android:background="@drawable/custom_spinner"
                    android:dropDownVerticalOffset="50dp"
                    android:paddingHorizontal="0dp" />

                <View
                    android:layout_width="0.5dp"
                    android:layout_height="match_parent"
                    android:background="#e3e3e3" />

                <Spinner
                    android:id="@+id/project"
                    android:layout_width="wrap_content"
                    android:layout_height="50dp"
                    android:layout_marginTop="12dp"
                    android:layout_marginBottom="12dp"
                    android:background="@drawable/custom_spinner"
                    android:dropDownVerticalOffset="50dp"
                    android:paddingHorizontal="0dp" />

            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="#eaeaea" />

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rv_tasks_date"
                    android:gravity="center"
                    android:layout_marginTop="27.4dp"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:layout_height="106dp"/>



            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal">

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helveticaneue_medium"
                        android:text="35"
                        android:textColor="#6a6a77"
                        android:textSize="13.5sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helveticaneue_medium"
                        android:text="tasks"
                        android:textColor="#6a6a77"
                        android:textSize="10.6sp" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helveticaneue_medium"
                        android:text="Terrence Morin"
                        android:textColor="#6a6a77"
                        android:textSize="15.4sp" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:fontFamily="@font/helveticaneue_medium"
                        android:text="UX Designer"
                        android:textColor="#6a6a77"
                        android:textSize="10.6sp" />

                </LinearLayout>

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="13dp"
                    android:layout_weight="1"
                    android:src="@drawable/plus_green" />


            </LinearLayout>

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="39.8dp"
                android:layout_marginRight="38.9dp"
                android:layout_marginBottom="15dp"
                app:cardCornerRadius="4.8dp"
                app:cardElevation="0dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="18.2dp"
                    android:layout_marginTop="15.4dp"
                    android:layout_marginRight="17.7dp"
                    android:orientation="vertical"
                    android:paddingBottom="15dp">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="Product page UX research"
                            android:textColor="#6a6a77"
                            android:textSize="13.4sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="12.07.16"
                            android:textColor="#6a6a77"
                            android:textSize="8.6sp" />

                    </LinearLayout>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="11.4dp"
                        android:fontFamily="@font/helveticaneue"
                        android:lineSpacingExtra="5dp"
                        android:text="A good way to start the design of any page is to list its\nelements in order of importance. Ordering the page\nelements based on solid user research guarantees the\npage will not only..."
                        android:textColor="#9ea4af"
                        android:textSize="10.1sp" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="17.8dp"
                        android:orientation="horizontal">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:drawableLeft="@drawable/comment"
                            android:drawablePadding="6.7dp"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="2"
                            android:textColor="#88889c"
                            android:textSize="10.6sp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="16.1dp"
                            android:layout_weight="1"
                            android:drawableLeft="@drawable/list"
                            android:drawablePadding="6.7dp"
                            android:fontFamily="@font/helveticaneue_medium"
                            android:text="7/12"
                            android:textColor="#88889c"
                            android:textSize="10.6sp" />

                        <com.makeramen.roundedimageview.RoundedImageView
                            android:layout_width="24.3dp"
                            android:layout_height="24.5dp"
                            android:src="@drawable/profile"
                            app:riv_corner_radius="4.8dp" />

                        <com.makeramen.roundedimageview.RoundedImageView
                            android:layout_width="24.3dp"
                            android:layout_height="24.5dp"
                            android:layout_marginLeft="3.4dp"
                            android:src="@drawable/profile"
                            app:riv_corner_radius="4.8dp" />


                    </LinearLayout>

                </LinearLayout>

            </android.support.v7.widget.CardView>

        </LinearLayout>

    </ScrollView>

</RelativeLayout>

Create first horizontal recyclerview.

create item_inboxavsc.xml

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_margin="12dp"
    android:background="@drawable/rect_white"
    app:cardCornerRadius="4.8dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="vertical"
        android:paddingTop="12.7dp"
        android:paddingBottom="12.5dp">

            <ImageView
                android:id="@+id/imgbag"
                android:layout_width="20.2dp"
                android:layout_height="20.2dp"
                android:layout_gravity="center"
                android:scaleType="centerCrop"
                android:src="@drawable/bag" />

            <TextView
                android:id="@+id/txtconversion"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="9.6dp"
                android:text="@string/conversion"
                android:textColor="#6a6a77"
                android:textSize="9.6sp"/>


    </LinearLayout>

</android.support.v7.widget.CardView>

Create Model Class

Step 1: Create package ModelClass.
Step 2: Add Java class – TrafficModel.
Step 3: Add textview id n imageview id.
Step 4: Create Constructor. AND Create getter setter method.

package com.wolfsoft.avsc.model;


public class TrafficModel {

    Integer imgbag;

    String txtconversion;


    public Integer getImgbag() {
        return imgbag;
    }

    public void setImgbag(Integer imgbag) {
        this.imgbag = imgbag;
    }

    public String getTxtconversion() {
        return txtconversion;
    }

    public void setTxtconversion(String txtconversion) {
        this.txtconversion = txtconversion;
    }

    public TrafficModel(Integer imgbag, String txtconversion) {
        this.imgbag = imgbag;
        this.txtconversion = txtconversion;
    }
}

Create Adapter-TraffiCAdapter.java

Step 1: Create package Adapter.
Step 2: Add Java class – TrafficAdapter.
Step 3: Implement Methods.
Step 4:Paste Below Code to tTrafficAdapter.

package com.wolfsoft.avsc.adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
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.wolfsoft.avsc.R;
import com.wolfsoft.avsc.model.TrafficModel;
import java.util.ArrayList;


public class TrafficAdapter extends RecyclerView.Adapter<TrafficAdapter.ViewHolder> {

    int myPos=0;

    Context context;
    private ArrayList<TrafficModel> trafficModelArrayList;

    public TrafficAdapter(Context context, ArrayList<TrafficModel> trafficModelArrayList) {
        this.context = context;
        this.trafficModelArrayList = trafficModelArrayList;
    }

    @NonNull
    @Override
    public TrafficAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_traffic,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull final TrafficAdapter.ViewHolder holder, final int position) {

        holder.imgbag.setImageResource(trafficModelArrayList.get(position).getImgbag());
        holder.txtconversion.setText(trafficModelArrayList.get(position).getTxtconversion());

        if (position==myPos){
            //  holder.card.setCardElevation(35);
         // holder.card.setOutlineSpotShadowColor(Color.parseColor("#000bff"));
            holder.imgbag.setColorFilter(Color.parseColor("#ffffff"));
            holder.txtconversion.setTextColor(Color.parseColor("#ffffff"));
            holder.card.setBackgroundResource(R.drawable.rect_blue); }

        else {

//            holder.card.setCardElevation(35);
//            holder.card.setOutlineSpotShadowColor(Color.parseColor("#808080"));
            holder.imgbag.setColorFilter(Color.parseColor("#bdc1c9"));
            holder.txtconversion.setTextColor(Color.parseColor("#6a6a77"));
            holder.card.setBackgroundResource(R.drawable.rect_white);
        }
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myPos = position;
                notifyDataSetChanged();
            }
        });
    }

    @Override
    public int getItemCount() {
        return trafficModelArrayList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {


        ImageView imgbag,one;

        TextView txtconversion;

         CardView card;

        public ViewHolder(View itemView) {

            super(itemView);


            imgbag=itemView.findViewById(R.id.imgbag);
            txtconversion=itemView.findViewById(R.id.txtconversion);
            card=itemView.findViewById(R.id.card);
            one=itemView.findViewById(R.id.one);




        }
    }
}

Teamavsc.java

package com.wolfsoft.avsc;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import com.wolfsoft.avsc.adapter.InboxAdapter;
import com.wolfsoft.avsc.adapter.TrafficAdapter;
import com.wolfsoft.avsc.model.InboxModel;
import com.wolfsoft.avsc.model.TrafficModel;

import java.util.ArrayList;

public class Inbox extends AppCompatActivity {

    ImageView backarrow;

    private TrafficAdapter trafficAdapter;
    private ArrayList<TrafficModel> trafficModelArrayList;
    private RecyclerView recyclerView;

    Integer[] imgbag = {R.drawable.ic_done,R.drawable.ic_done
            ,R.drawable.ic_notification,R.drawable.ic_point_of_sale,
            R.drawable.ic_done,R.drawable.ic_clock};

    String[] txtconversion = {"Traffic","Conversion",
            "Alerts", "Points of Sale",
            "Tasks","Meetings"};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teamavsc);


 recyclerView = findViewById(R.id.recycler_inbox);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(Inbox.this,LinearLayoutManager.HORIZONTAL,false);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());

        trafficModelArrayList = new ArrayList<>();

        for (int i = 0; i < imgbag.length; i++) {
            TrafficModel view1 = new TrafficModel(imgbag[i],txtconversion[i]);
            trafficModelArrayList.add(view1);
        }

        trafficAdapter = new TrafficAdapter(Inbox.this,trafficModelArrayList);
        recyclerView.setAdapter(trafficAdapter);

}
}

Now Create second recyclerview on position selected recycler. Go to the main activity and paste below second recyclerview code. and spinner code.

Create item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_marginRight="7.7dp">


    <com.makeramen.roundedimageview.RoundedImageView
        android:id="@+id/imgprofile"
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:adjustViewBounds="true"
        app:riv_corner_radius="4.8dp"/>


</LinearLayout>

Now Paste the below code to mainactivity teamavsc.java

 private View view;

    private static final String TAG = ViewPagerActivity.class.getSimpleName();

    public float firstItemWidthDate;
    public float paddingDate;
    public float itemWidthDate;
    public int allPixelsDate;
    public int finalWidthDate;

    private DateAdapter dateAdapter;
    private ArrayList<LabelerDate> labelerDates = new ArrayList<>();

   int image[]={R.drawable.profile1,R.drawable.profile2,R.drawable.profile1,
           R.drawable.profile1,R.drawable.profile2,R.drawable.profile1,
           R.drawable.profile1,R.drawable.profile2};


    private Spinner spinner;


 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_viewpageractivity);


        getRecyclerviewDate();

 /*Spinner- DESIGN TEAM*/
        spinner = (Spinner) findViewById(R.id.designteam);
        List<String> list = new ArrayList<String>();
        list.add("Design Team");
        list.add("Design Team");
        list.add("Design Team");
        list.add("Design Team");
        list.add("Design Team");

        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(ViewPagerActivity.this, R.layout.item_country,
                R.id.textCountry, list);
        spinner.setAdapter(dataAdapter);


        /*SPINNER-projecty*/
        spinner = (Spinner) findViewById(R.id.project);
        List<String> list1 = new ArrayList<String>();
        list1.add("Project Y");
        list1.add("Project X");
        list1.add("Project Y");
        list1.add("Project X");
        list1.add("Project Y");

        ArrayAdapter<String> dataAdapter1 = new ArrayAdapter<String>(ViewPagerActivity.this, R.layout.item_country,
                R.id.textCountry, list1);
        spinner.setAdapter(dataAdapter1);
    }



    public void getRecyclerviewDate() {
        final RecyclerView recyclerViewDate = (RecyclerView) findViewById(R.id.rv_tasks_date);
        if (recyclerViewDate != null) {
            recyclerViewDate.postDelayed(new Runnable() {
                @Override
                public void run() {
                    setDateValue();
                }
            }, 000);
            recyclerViewDate.postDelayed(new Runnable() {
                @Override
                public void run() {
//                    recyclerViewDate.smoothScrollToPosition(102);
                    setDateValue();
                }
            }, 0000);
        }
        ViewTreeObserver vtoDate = recyclerViewDate.getViewTreeObserver();
        vtoDate.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {


            @Override
            public boolean onPreDraw() {
                recyclerViewDate.getViewTreeObserver().removeOnPreDrawListener(this);
                finalWidthDate = recyclerViewDate.getMeasuredWidth();
                itemWidthDate = getResources().getDimension(R.dimen.item_dob_width);
                paddingDate = (finalWidthDate - itemWidthDate) / 2;
                firstItemWidthDate = paddingDate;
                allPixelsDate = 0;

                final LinearLayoutManager dateLayoutManager = new LinearLayoutManager(ViewPagerActivity.this.getApplicationContext());
                dateLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
                recyclerViewDate.setLayoutManager(dateLayoutManager);
                recyclerViewDate.addOnScrollListener(new RecyclerView.OnScrollListener() {
                    @Override
                    public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                        super.onScrollStateChanged(recyclerView, newState);
                        synchronized (this) {
                            if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                                calculatePositionAndScrollDate(recyclerView);
                            }
                        }

                    }

                    @Override
                    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                        super.onScrolled(recyclerView, dx, dy);
                        allPixelsDate += dx;
                    }
                });
                if (labelerDates == null) {
                    labelerDates = new ArrayList<>();
                }
                genLabelerDate();
                dateAdapter = new DateAdapter(labelerDates, (int) firstItemWidthDate);
                recyclerViewDate.setAdapter(dateAdapter);
                dateAdapter.setSelecteditem(dateAdapter.getItemCount() - 1);
                return true;
            }
        });
    }

    private void genLabelerDate() {
        for (int i = 0; i < image.length; i++) {
            LabelerDate labelerDate = new LabelerDate();
            labelerDate.setImgprofile(image[i]);
            labelerDates.add(labelerDate);

            if (i == 0|| i == image.length-1) {
                labelerDate.setType(DateAdapter.VIEW_TYPE_PADDING);
            } else {
                labelerDate.setType(DateAdapter.VIEW_TYPE_ITEM);
            }
        }
    }


    /* this if most important, if expectedPositionDate < 0 recyclerView will return to nearest item*/
    private void calculatePositionAndScrollDate(RecyclerView recyclerView) {
        int expectedPositionDate = Math.round((allPixelsDate + paddingDate - firstItemWidthDate) / itemWidthDate);

        if (expectedPositionDate == -1) {
            expectedPositionDate = 0;
        } else if (expectedPositionDate >= recyclerView.getAdapter().getItemCount() - 2) {
            expectedPositionDate--;
        }
        scrollListToPositionDate(recyclerView, expectedPositionDate);

    }

    /* this if most important, if expectedPositionDate < 0 recyclerView will return to nearest item*/
    private void scrollListToPositionDate(RecyclerView recyclerView, int expectedPositionDate) {
        float targetScrollPosDate = expectedPositionDate * itemWidthDate + firstItemWidthDate - paddingDate;
        float missingPxDate = targetScrollPosDate - allPixelsDate;
        if (missingPxDate != 0) {
            recyclerView.smoothScrollBy((int) missingPxDate, 0);
        }
        setDateValue();
    }


    private void setDateValue() {
        int expectedPositionDateColor = Math.round((allPixelsDate + paddingDate - firstItemWidthDate) / itemWidthDate);
        int setColorDate = expectedPositionDateColor + 1;
//        set color here
        dateAdapter.setSelecteditem(setColorDate);
    }


    public class DateAdapter extends RecyclerView.Adapter<DateAdapter.DateViewHolder> {
        private ArrayList<LabelerDate> dateDataList;


        private static final int VIEW_TYPE_PADDING = 1;
        private static final int VIEW_TYPE_ITEM =  2;
        private int paddingWidthDate = 0;

        private int selectedItem = -1;

        public DateAdapter(ArrayList<LabelerDate> dateData, int paddingWidthDate) {

            this.dateDataList = dateData;
            this.paddingWidthDate = paddingWidthDate;

        }

        @Override
        public DateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

            if (viewType == VIEW_TYPE_ITEM) {
                final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item,
                        parent, false);
                return new DateViewHolder(view);
            } else {
                View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item,
                        parent, false);

                RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
                layoutParams.width = paddingWidthDate;
                view.setLayoutParams(layoutParams);
                return new DateViewHolder(view);

            }
        }

        @Override
        public void onBindViewHolder(DateViewHolder holder, int position) {
            LabelerDate labelerDate = dateDataList.get(position);

            if (getItemViewType(position) == VIEW_TYPE_ITEM) {

                holder.imgprofile.setImageResource(labelerDate.getImgprofile());

                holder.imgprofile.setVisibility(View.VISIBLE);

                Log.d(TAG, "default " + position + ", selected " + selectedItem);
                if (position == selectedItem) {

                    Log.d(TAG, "center" + position);

                    holder.imgprofile.getLayoutParams().height = 275;
                    holder.imgprofile.getLayoutParams().width = 275;
                    holder.imgprofile.setAdjustViewBounds(true);
                    holder.imgprofile.setImageResource(labelerDate.getImgprofile());

                } else {
                    holder.imgprofile.getLayoutParams().height = 250;
                    holder.imgprofile.getLayoutParams().width = 250;
                    holder.imgprofile.setAdjustViewBounds(true);
                    holder.imgprofile.setImageResource(labelerDate.getImgprofile());
                }
            } else {
                holder.imgprofile.setAdjustViewBounds(true);
                holder.imgprofile.setVisibility(View.INVISIBLE);
            }
        }

        public void setSelecteditem(int selecteditem) {
            this.selectedItem = selecteditem;
            notifyDataSetChanged();
        }

        @Override
        public int getItemCount() {

            return dateDataList.size();
        }

        @Override
        public int getItemViewType(int position) {
            LabelerDate labelerDate = dateDataList.get(position);

            if (labelerDate.getType() == VIEW_TYPE_PADDING) {
                return VIEW_TYPE_PADDING;
            }
            else {

                return VIEW_TYPE_ITEM;
            }
        }

        public class DateViewHolder extends RecyclerView.ViewHolder {

            public ImageView imgprofile;

            public DateViewHolder(View itemView) {
                super(itemView);

                imgprofile = (ImageView) itemView.findViewById(R.id.imgprofile);
            }
        }
    }

    private class LabelerDate {

        private int type;

        private Integer imgprofile;

        public Integer getImgprofile() {
            return imgprofile;
        }

        public void setImgprofile(Integer imgprofile) {
            this.imgprofile = imgprofile;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }
    }

}

Create Spinner item_country file in layout folder.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_vertical">

    <TextView
        android:id="@+id/textCountry"
        android:fontFamily="@font/helveticaneue"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="10dp"
        android:letterSpacing="0.043"
        android:textColor="#6a6a77"
        android:textSize="11.5sp"
        android:text="Last week"/>

</LinearLayout>

Also add custom_spinner file in drawable folder. and add only PNG down arrow in custom_spinner folder.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape>
            <solid android:color="@android:color/transparent" />
            <!--<padding
                android:bottom="10dp"
                android:left="2dp"
                android:right="10dp"
                android:top="10dp" />-->
            <padding android:left="10dp"
                android:right="10dp"/>

        </shape>
    </item>
    <item>
        <bitmap
            android:gravity="right"
            android:src="@drawable/ic_down_arrow" />
    </item>

</layer-list>

Continue Reading

Trending

Copyright © 2019 UIUXLAB.in