Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
class EmployeeListAdapter extends RecyclerView.Adapter{

private List<EmployeeDescription> mData = Arrays.asList(
new EmployeeDescription("Ashique", R.drawable.ashique)
new EmployeeDescription("Ashique", R.drawable.ashique),
new EmployeeDescription("Cat", R.drawable.catwong2)

);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import nyc.c4q.grocerystore.R;
import nyc.c4q.grocerystore.employeeHandbook.employees.Ashique;
import nyc.c4q.grocerystore.employeeHandbook.employees.Cat;

public class EmployeeView extends AppCompatActivity {
public static final String EMPLOYEE_NAME = "extra.employee.name";
Expand All @@ -17,8 +18,17 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.employee_view);
String employee = getIntent().getStringExtra(EMPLOYEE_NAME);
if(employee != null){
// call a function
if (employee != null) {
switch (employee) {
case "Ashique":
showAshique();
break;
case "Cat":
showCat();
break;
default:
break;
}
}
}

Expand All @@ -28,4 +38,11 @@ private void showAshique(){
fragmentTransaction.add(R.id.employee_profile,new Ashique());
fragmentTransaction.commit();
}

private void showCat(){
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.employee_profile,new Cat());
fragmentTransaction.commit();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package nyc.c4q.grocerystore.employeeHandbook.employees;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import nyc.c4q.grocerystore.R;

/**
* Created by catwong on 10/24/16.
*/

public class Cat extends Fragment {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.cat_wong,container,false);
}

}
3 changes: 1 addition & 2 deletions app/src/main/res/layout/cat_wong.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:background="@drawable/cat_background"
android:orientation="vertical"
android:baselineAligned="false">

Expand Down Expand Up @@ -69,7 +69,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background1"
android:orientation="horizontal">

<ImageView
Expand Down