Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bac33e
commit b96c397
Showing
11 changed files
with
187 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/macbitsgoa/prdrive/ResidentModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.macbitsgoa.prdrive; | ||
|
||
public class ResidentModel { | ||
|
||
String name; | ||
String roomNo; | ||
|
||
public ResidentModel(String name, String roomNo) | ||
{ | ||
this.name= name; | ||
this.roomNo=roomNo; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getRoomNo() { | ||
return roomNo; | ||
} | ||
|
||
public void setRoomNo(String roomNo) { | ||
this.roomNo = roomNo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/macbitsgoa/prdrive/activities/ResidentActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.macbitsgoa.prdrive.activities; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import com.macbitsgoa.prdrive.R; | ||
import com.macbitsgoa.prdrive.adapters.ResidentAdapter; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
|
||
public class ResidentActivity extends Activity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_resident); | ||
|
||
RecyclerView rv; | ||
|
||
rv = findViewById(R.id.list_rv); | ||
rv.setLayoutManager(new LinearLayoutManager(ResidentActivity.this)); | ||
rv.setHasFixedSize(false); | ||
ResidentAdapter residentAdapter = new ResidentAdapter(ResidentActivity.this); | ||
rv.setAdapter(residentAdapter); | ||
|
||
|
||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/macbitsgoa/prdrive/adapters/ResidentAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.macbitsgoa.prdrive.adapters; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.macbitsgoa.prdrive.R; | ||
import com.macbitsgoa.prdrive.viewholders.ResidentViewHolder; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import static com.macbitsgoa.prdrive.StaticHelperClass.merchModelList; | ||
|
||
public class ResidentAdapter extends RecyclerView.Adapter<ResidentViewHolder> { | ||
Context context; | ||
|
||
public ResidentAdapter(Context ctx) { | ||
this.context = ctx; | ||
} | ||
|
||
@Override | ||
public ResidentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
return new ResidentViewHolder(View.inflate(parent.getContext(), R.layout.item_format_resident, null) , | ||
parent.getContext()); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull ResidentViewHolder holder, int position) { | ||
|
||
|
||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return merchModelList.size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/macbitsgoa/prdrive/viewholders/ResidentViewHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.macbitsgoa.prdrive.viewholders; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
import com.macbitsgoa.prdrive.R; | ||
import com.macbitsgoa.prdrive.activities.MerchActivity; | ||
import androidx.annotation.NonNull; | ||
import androidx.cardview.widget.CardView; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
|
||
public class ResidentViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { | ||
|
||
private Context ctx; | ||
public TextView name; | ||
public TextView roomNo; | ||
|
||
|
||
public ResidentViewHolder(@NonNull View itemView , Context ctx) { | ||
super(itemView); | ||
|
||
CardView cardView; | ||
this.ctx = ctx; | ||
name =itemView.findViewById(R.id.name); | ||
roomNo = itemView.findViewById(R.id.roomNo); | ||
cardView = itemView.findViewById(R.id.cv); | ||
cardView.setOnClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View view) { | ||
|
||
Intent i = new Intent(ctx,MerchActivity.class); | ||
ctx.startActivity(i); | ||
//take the activity to merchActivity | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:id="@+id/list_rv" | ||
android:padding="5dp"> | ||
|
||
</androidx.recyclerview.widget.RecyclerView> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.cardview.widget.CardView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="50dp" | ||
android:id="@+id/cv" | ||
android:clickable="true"> | ||
|
||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="horizontal" | ||
android:weightSum="100"> | ||
|
||
<TextView | ||
android:id="@+id/name" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="70" /> | ||
|
||
<TextView | ||
android:id="@+id/roomNo" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="30" /> | ||
</LinearLayout> | ||
</androidx.cardview.widget.CardView> |