Skip to content

Commit

Permalink
Added no entry Image to HomeActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
divya21raj committed Mar 26, 2018
1 parent 95bf51d commit ff5b338
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.RelativeLayout;

import garbagecollectors.com.unipool.R;
import garbagecollectors.com.unipool.adapters.HomeActivityTEA;
Expand All @@ -20,6 +22,8 @@ public class HomeActivity extends BaseActivity
RecyclerView recycle;
static HomeActivityTEA recyclerAdapter;

static public RelativeLayout noEntryRelativeLayout;

@Override
protected void onCreate(Bundle savedInstanceState)
{
Expand All @@ -37,6 +41,9 @@ protected void onCreate(Bundle savedInstanceState)

drawerLayout = findViewById(R.id.home_layout);

noEntryRelativeLayout = findViewById(R.id.no_entry_message);
noEntryRelativeLayout.setVisibility(View.INVISIBLE);

navDrawerStateListener();

navigationView = findViewById(R.id.nav_drawer);
Expand Down Expand Up @@ -129,6 +136,12 @@ protected int getContentViewId()

public static void updateRecycleAdapter()
{
recyclerAdapter.notifyDataSetChanged();
if(tripEntryList.isEmpty())
noEntryRelativeLayout.setVisibility(View.VISIBLE);

else
noEntryRelativeLayout.setVisibility(View.INVISIBLE);

recyclerAdapter.notifyDataSetChanged();
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_negative_smiley.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector android:height="24dp" android:viewportHeight="30.0"
android:viewportWidth="30.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="1" android:fillColor="#000000"
android:pathData="m11.09,10.511a2.989,2.826 90,1 1,-5.652 0A2.989,2.826 90,1 1,11.09 10.511Z" android:strokeColor="#00000000"/>
<path android:fillAlpha="1" android:fillColor="#000000"
android:pathData="m22.298,9.75a2.875,2.718 90,1 1,-5.436 0A2.875,2.718 90,1 1,22.298 9.75Z" android:strokeColor="#00000000"/>
<path android:fillAlpha="1" android:fillColor="#000000"
android:pathData="m4.655,27.498c1.291,-8.553 11.839,-13.071 20.912,-8.258C16.292,19.278 10.915,21.236 4.655,27.498Z" android:strokeColor="#00000000"/>
</vector>
38 changes: 38 additions & 0 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,44 @@

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

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:id="@+id/no_entry_message"
android:paddingTop="80dp">

<android.support.v7.widget.AppCompatImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/sad_smiley"
android:background="@drawable/ic_negative_smiley"
android:layout_centerHorizontal="true"
android:alpha="0.4"
android:backgroundTint="@color/colorPrimary"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/such_empty"
android:layout_below="@id/sad_smiley"
android:paddingTop="18dp"
android:layout_centerHorizontal="true"
android:text="Such empty..."
android:textAlignment="center"
android:textSize="24sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:textSize="14sp"
android:layout_centerHorizontal="true"
android:layout_below="@id/such_empty"
android:text="Maybe you can create a new entry?"/>

</RelativeLayout>

<include
android:id="@+id/bottom_navigation"
layout="@layout/element_bottom_navigation"
Expand Down

0 comments on commit ff5b338

Please sign in to comment.