Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projects and leave #8

Merged
merged 11 commits into from
Apr 6, 2022
Merged
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
37 changes: 36 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,19 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.firebase:firebase-database:20.0.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-firestore:24.0.1'
implementation 'androidx.multidex:multidex:2.0.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.airbnb.android:lottie:4.2.2'
implementation 'com.faendir.rhino:rhino-android:1.6.0'
implementation 'com.scwang.wave:MultiWaveHeader:1.0.0-alpha-1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}
18 changes: 18 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WorkFlow">
<activity
android:name=".MyProjects"
android:exported="false" />
<activity
android:name=".ProjectActivity"
android:exported="false" />
<activity
android:name=".EmployeeList"
android:exported="false" />
<activity
android:name=".Splash"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MyNotices"
android:exported="false" />
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions app/src/main/java/com/example/workflow/AdapterEmployee.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.example.workflow;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

public class AdapterEmployee extends RecyclerView.Adapter<AdapterEmployee.MyViewHolder> {

ArrayList<EmployeeListModel> mList;
Context context;

public AdapterEmployee(Context context , ArrayList<EmployeeListModel> mList){

this.mList = mList;
this.context = context;
}

@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.employee_card , parent ,false);
return new MyViewHolder(v);
}

@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
EmployeeListModel model = mList.get(position);
holder.name.setText("Name: "+ model.getFirstName()+ " " + model.getLastName());
holder.position.setText("Position: "+model.getPosition());
holder.department.setText("Department: "+model.getDepartment());
holder.email.setText("Email: "+model.getEmail());
}

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

public static class MyViewHolder extends RecyclerView.ViewHolder{

TextView name , position,department, email;

public MyViewHolder(@NonNull View itemView) {
super(itemView);

name = itemView.findViewById(R.id.employeeName);
department = itemView.findViewById(R.id.employeeDepartment);
position = itemView.findViewById(R.id.employeePosition);
email = itemView.findViewById(R.id.employeeEmail);
}
}
}
4 changes: 3 additions & 1 deletion app/src/main/java/com/example/workflow/AdapterNotices.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
NoticeList noticeList = list.get(position);
holder.title.setText(noticeList.getTitle());
holder.description.setText(noticeList.getDescription());
holder.department.setText(noticeList.getDepartment());
}

@Override
Expand All @@ -48,11 +49,12 @@ public int getItemCount() {

public static class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

TextView description, title;
TextView description, title,department;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
title=itemView.findViewById(R.id.NoticeTitle);
description=itemView.findViewById(R.id.NoticeDesc);
department=itemView.findViewById(R.id.NoticeDepartment);
itemView.setOnClickListener(this);
}

Expand Down
70 changes: 70 additions & 0 deletions app/src/main/java/com/example/workflow/AdapterProjects.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.example.workflow;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

public class AdapterProjects extends RecyclerView.Adapter<AdapterProjects.MyViewHolder> {

Context context;
ArrayList<ProjectList> list;
private static RecyclerViewClickListener listener;

public AdapterProjects(Context context, ArrayList<ProjectList> list, RecyclerViewClickListener listener) {
this.context = context;
this.list = list;
AdapterProjects.listener =listener;
}
public AdapterProjects(Context context, ArrayList<ProjectList> list) {
this.context = context;
this.list = list;
}

@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.notices_card,parent,false);
return new MyViewHolder(v);
}

@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
ProjectList ProjectList = list.get(position);
holder.title.setText(ProjectList.getTitle());
holder.description.setText(ProjectList.getDescription());
holder.department.setText(ProjectList.getDepartment());
}

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

public static class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

TextView description, title,department;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
title=itemView.findViewById(R.id.NoticeTitle);
description=itemView.findViewById(R.id.NoticeDesc);
department=itemView.findViewById(R.id.NoticeDepartment);
itemView.setOnClickListener(this);
}

@Override
public void onClick(View v) {
listener.onClick(itemView, getAdapterPosition());
}
}

public interface RecyclerViewClickListener{
void onClick(View v, int position);
}
}
62 changes: 62 additions & 0 deletions app/src/main/java/com/example/workflow/EmployeeList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.example.workflow;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.ArrayList;

public class EmployeeList extends AppCompatActivity {

DatabaseReference root = FirebaseDatabase.getInstance().getReference().child("Users");
private AdapterEmployee adapter;
private ArrayList<EmployeeListModel> list;

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

RecyclerView recyclerView = findViewById(R.id.EmployeeRecyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

list = new ArrayList<>();
adapter = new AdapterEmployee(this ,list );

recyclerView.setAdapter(adapter);

root.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {

for (DataSnapshot dataSnapshot : snapshot.getChildren()){
EmployeeListModel model = dataSnapshot.getValue(EmployeeListModel.class);
list.add(model);
}
adapter.notifyDataSetChanged();
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});
}
@Override
public void onBackPressed() {
startActivity(new Intent(EmployeeList.this,HomeActivity.class));
finish();
}
}
25 changes: 25 additions & 0 deletions app/src/main/java/com/example/workflow/EmployeeListModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.example.workflow;

public class EmployeeListModel {

String firstName,lastName,email,position,department;

public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}

public String getEmail() {
return email;
}

public String getPosition() {
return position;
}

public String getDepartment() {
return department;
}
}
Loading