Skip to content

Commit

Permalink
Added : A lot of things
Browse files Browse the repository at this point in the history
  • Loading branch information
shvmsaini committed Sep 22, 2021
1 parent 8abcb95 commit a764190
Show file tree
Hide file tree
Showing 23 changed files with 1,406 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetDropDown.xml

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

18 changes: 9 additions & 9 deletions .idea/misc.xml

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

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.firebaseui:firebase-ui-storage:7.2.0'

//other dependencies
implementation "androidx.cardview:cardview:1.0.0"
Expand Down
29 changes: 28 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.agrobuy.app">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.camera"
android:required="true" />

<application
android:allowBackup="true"
Expand All @@ -12,6 +15,18 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Agrobuy">

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths">
</meta-data>
</provider>

<activity
android:name=".MainActivity"
android:exported="true">
Expand Down Expand Up @@ -44,6 +59,18 @@
android:name=".UploadInvoiceActivity"
android:exported="true">
</activity>
<activity
android:name=".BuyerNetworkActivity"
android:exported="true">
</activity>
<activity
android:name=".DeliveryPartnersActivity"
android:exported="true">
</activity>
<activity
android:name=".ExportLogisticsActivity"
android:exported="true">
</activity>
</application>

</manifest>
29 changes: 29 additions & 0 deletions app/src/main/java/com/agrobuy/app/BuyerNetworkActivity.java
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 app/src/main/java/com/agrobuy/app/ContentDisplayAdapter.java
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);
}
});
}
}
}
53 changes: 53 additions & 0 deletions app/src/main/java/com/agrobuy/app/ContentObject.java
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;
}

}
Loading

0 comments on commit a764190

Please sign in to comment.