-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
23 changed files
with
1,406 additions
and
189 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.
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/agrobuy/app/BuyerNetworkActivity.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.agrobuy.app; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
|
||
public class BuyerNetworkActivity extends Activity { | ||
private FirebaseAuth auth = FirebaseAuth.getInstance(); | ||
private FirebaseDatabase database = FirebaseDatabase.getInstance(); | ||
private DatabaseReference myRef = database.getReference(); | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.buyer_network); | ||
|
||
database.getReference("users" + "/" + auth.getCurrentUser().getUid() + "/" + "invoices").get() | ||
.addOnCompleteListener(task -> { | ||
|
||
}); | ||
|
||
} | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/agrobuy/app/ContentDisplayAdapter.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,72 @@ | ||
package com.agrobuy.app; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import com.bumptech.glide.Glide; | ||
|
||
import java.util.List; | ||
|
||
public class ContentDisplayAdapter extends RecyclerView.Adapter<ContentDisplayAdapter.ItemViewHolder>{ | ||
private final String LOG_TAG = getClass().toString(); | ||
private List<ContentObject> mContentObjectList; | ||
private Context mContext; | ||
private final OnItemClickListener listener; | ||
|
||
@Override | ||
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
LayoutInflater inflater = LayoutInflater.from(parent.getContext()); | ||
View view= inflater.inflate(R.layout.list_item,parent,false); | ||
ItemViewHolder viewHolder = new ItemViewHolder(view); | ||
return viewHolder; | ||
} | ||
|
||
public ContentDisplayAdapter(Context mContext, List<ContentObject> mContentObjectList,OnItemClickListener listener) { | ||
this.mContext=mContext; | ||
this.mContentObjectList = mContentObjectList; | ||
this.listener = listener; | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(ItemViewHolder holder, int position) { | ||
Log.d(LOG_TAG,"bindViewHolder"); | ||
ContentObject contentObject = mContentObjectList.get(position); | ||
Glide.with(mContext).load(contentObject.getProfilePicURL()).into(holder.pic); | ||
|
||
holder.bind(contentObject,listener); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return mContentObjectList.size(); | ||
} | ||
|
||
public static class ItemViewHolder extends RecyclerView.ViewHolder { | ||
TextView title,subTitle; | ||
ImageView pic; | ||
public ItemViewHolder(View itemView) { | ||
super(itemView); | ||
title = itemView.findViewById(R.id.title); | ||
subTitle = itemView.findViewById(R.id.sub_title); | ||
pic=itemView.findViewById(R.id.thumbnail); | ||
|
||
} | ||
public void bind(final ContentObject item, final OnItemClickListener listener) { | ||
title.setText(item.getName()); | ||
subTitle.setText(item.getSubLine()); | ||
// Glide.with(itemView.getContext()).load(item.profilePicURL).into(pic); | ||
itemView.setOnClickListener(new View.OnClickListener() { | ||
@Override public void onClick(View v) { | ||
listener.onItemClick(item); | ||
} | ||
}); | ||
} | ||
} | ||
} |
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,53 @@ | ||
package com.agrobuy.app; | ||
|
||
public class ContentObject { | ||
String name; | ||
String profilePicURL; | ||
String subLine; | ||
String ID; | ||
|
||
public ContentObject(String name, String profilePicURL, String subLine,String id) { | ||
this.name = name; | ||
this.profilePicURL = profilePicURL; | ||
this.subLine = subLine; | ||
} | ||
|
||
public ContentObject(String name, String profilePicURL,String id) { | ||
this.name = name; | ||
this.profilePicURL = profilePicURL; | ||
this.ID = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getSubLine() { | ||
return subLine; | ||
} | ||
|
||
public void setSubLine(String subLine) { | ||
this.subLine = subLine; | ||
} | ||
|
||
public String getProfilePicURL() { | ||
return profilePicURL; | ||
} | ||
|
||
public void setProfilePicURL(String profilePicURL) { | ||
this.profilePicURL = profilePicURL; | ||
} | ||
|
||
public String getID() { | ||
return ID; | ||
} | ||
|
||
public void setID(String ID) { | ||
this.ID = ID; | ||
} | ||
|
||
} |
Oops, something went wrong.