{"id":23870110,"url":"https://github.com/engineermichael/electrical-supplier-app-android-studios-","last_synced_at":"2025-06-20T14:36:41.766Z","repository":{"id":260214022,"uuid":"124948246","full_name":"EngineerMichael/Electrical-Supplier-App-Android-Studios-","owner":"EngineerMichael","description":"Electrical Supplier Management App, Supply Chain (Pending Revisions, NDA Final Version)","archived":false,"fork":false,"pushed_at":"2024-12-23T03:25:44.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T18:42:11.644Z","etag":null,"topics":["android-app","electrical","supply-chain-management"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngineerMichael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-12T20:35:45.000Z","updated_at":"2024-12-23T03:25:48.000Z","dependencies_parsed_at":"2025-01-03T23:15:18.708Z","dependency_job_id":null,"html_url":"https://github.com/EngineerMichael/Electrical-Supplier-App-Android-Studios-","commit_stats":null,"previous_names":["engineermichael/electrical-supplier-app-android-studios-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EngineerMichael/Electrical-Supplier-App-Android-Studios-","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2FElectrical-Supplier-App-Android-Studios-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2FElectrical-Supplier-App-Android-Studios-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2FElectrical-Supplier-App-Android-Studios-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2FElectrical-Supplier-App-Android-Studios-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineerMichael","download_url":"https://codeload.github.com/EngineerMichael/Electrical-Supplier-App-Android-Studios-/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2FElectrical-Supplier-App-Android-Studios-/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260962874,"owners_count":23089496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-app","electrical","supply-chain-management"],"created_at":"2025-01-03T13:52:18.353Z","updated_at":"2025-06-20T14:36:36.749Z","avatar_url":"https://github.com/EngineerMichael.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Electrical-Supplier-App-Android-Studios-\n\nCreating an Electrical Supplier App in Android Studio to manage supply and demand between vendors, contractors, and manufacturers involves designing an application with various user interfaces (UIs) and back-end logic to handle orders, inventory, communication, and more.\nWe’ll outline the core features and provide a basic structure for the application, which includes:\t\n•\tUser management (vendors, contractors, and manufacturers)\t•\tOrder management system for products\t\n•\tInventory management\t\n•\tCommunication between vendors, contractors, and manufacturers\t\n•\tBackend database (using Firebase or a local database like SQLite)\n\nKey Features for the App:\t\n1.\tUser Authentication:\n•\tDifferent roles (Vendors, Contractors, Manufacturers).\n•\tLogin \u0026 Registration for each role.\t\n3.\tInventory Management:\n•\tVendors can manage the inventory (products, prices, availability).\n3.\tOrder Management:\n•\tContractors can place orders from vendors.\n•\tVendors can manage incoming orders.\n•\tManufacturers can see the orders from vendors and update stock.\n4.\tNotifications:\n•\tNotifications for orders, product availability, etc.\n5.\tChat System:\n•\tCommunication between vendors, contractors, and manufacturers (optional).\n\nSteps to Create the App:\n1. Set up the Project:\n•\tOpen Android Studio and create a new project with an Empty Activity.\n•\tSelect Kotlin as the programming language.\n•\tSet up Firebase for user authentication and Firestore database, or SQLite for local storage.\n\n2. Dependencies:\nIn your build.gradle (Module: app) file, add the dependencies for Firebase, authentication, and Firestore.\ndependencies {\nimplementation \"com.google.firebase:firebase-auth:21.0.3\"\nimplementation \"com.google.firebase:firebase-firestore:24.3.0\"\nimplementation \"com.google.firebase:firebase-messaging:23.1.0\"\nimplementation \"androidx.recyclerview:recyclerview:1.2.1\"\nimplementation \"androidx.lifecycle:lifecycle-extensions:2.2.0\"\nimplementation 'com.google.android.material:material:1.6.1'}\n}\n\n\n\nDon’t forget to sync your project with Gradle after adding dependencies.\n\n\n\n3. Firebase Authentication (Login/Sign-Up)\nSet up Firebase Authentication to manage user roles (Vendors, Contractors, Manufacturers).\nFirebase Setup:\t•\tGo to Firebase Console -\u003e Add Firebase to your Android app.\t•\tEnable Email/Password authentication in Firebase Authentication.\nAuthentication Code:\nclass LoginActivity : AppCompatActivity() {\n   private lateinit var auth: FirebaseAuth\n   private lateinit var emailField: EditText\n   private lateinit var passwordField: EditText\n   private lateinit var loginButton: Button\n   private lateinit var registerButton: Button\n   \n    override fun onCreate(savedInstanceState: Bundle?) {        \n    super.onCreate(savedInstanceState)        \n    setContentView(R.layout.activity_login)\n     \n        auth = FirebaseAuth.getInstance()\n        \n        \n        emailField = findViewById(R.id.emailField)        \n        passwordField = findViewById(R.id.passwordField)        \n        loginButton = findViewById(R.id.loginButton)        \n        registerButton = findViewById(R.id.registerButton)\n        \n        loginButton.setOnClickListener {            \n        val email = emailField.text.toString()            \n        val password = passwordField.text.toString()\n            \n            auth.signInWithEmailAndPassword(email, password)                \n            .addOnCompleteListener(this) { task -\u003e                    \n            if (task.isSuccessful) {                        \n            // Redirect based on user role                        \n            val user = auth.currentUser                        \n            if (user != null) {                            \n            checkUserRole(user.uid)                        \n            }                    \n            }else {                        \n            Toast.makeText(baseContext, \"Authentication failed.\", \n            Toast.LENGTH_SHORT).show()                    \n            }                \n          }        \n        }\n        registerButton.setOnClickListener {            \n        // Navigate to RegisterActivity for new user registration        \n        }    \n      }\n    \n    private fun checkUserRole(userId: String) {        \n    val db = FirebaseFirestore.getInstance()        \n    val usersRef = db.collection(\"users\")        \n    usersRef.document(userId).get().addOnSuccessListener { document -\u003e            \n    if (document.exists()) {                \n       val role = document.getString(\"role\") // role can be \"vendor\", \"contractor\", or \"manufacturer\"                \n       if (role == \"vendor\") {                    \n          startActivity(Intent(this, VendorActivity::class.java))                \n          } else if (role == \"contractor\") {                    \n             startActivity(Intent(this, ContractorActivity::class.java))                \n             } else {                    \n             startActivity(Intent(this, ManufacturerActivity::class.java))                \n             }            \n          }        \n          \n        }    \n      }\n  }\n\n4. Role-Based Navigation:\nDepending on the user’s role, navigate them to different activities. For example:\n•\tVendors can see inventory and manage stock.\t•\tContractors can place orders.\t•\tManufacturers can manage orders and update product availability.\n\n\n5. Firestore Database for Inventory and Orders\n\n\n\nUse Firebase Firestore to store and manage inventory, orders, and user data.\nFirestore Structure:\n\n\n\nusers\n\n  |-- userId\n\n       |-- name: \"John Doe\"\n\n       |-- email: \"john@example.com\"\n\n       |-- role: \"vendor\"\n\n       |-- products (for vendors): \n\n           |-- productId\n\n               |-- name: \"Wire\"\n\n               |-- price: \"100\"\n\n               |-- quantity: \"500\"\n\norders\n\n  |-- orderId\n\n       |-- contractorId: \"contractorId\"\n\n       |-- vendorId: \"vendorId\"\n\n       |-- products: \n\n           |-- productId: \"productId\"\n\n           |-- quantity: 5\n\n           |-- price: 100\n\n\n\nAdding Product to Inventory:\n\n\n\nfun addProductToInventory(product: Product) {\n\n    val db = FirebaseFirestore.getInstance()\n\n    val productData = hashMapOf(\n\n        \"name\" to product.name,\n\n        \"price\" to product.price,\n\n        \"quantity\" to product.quantity\n\n    )\n\n    db.collection(\"users\").document(userId).collection(\"products\")\n\n        .add(productData)\n\n        .addOnSuccessListener {\n\n            Toast.makeText(this, \"Product added successfully\", Toast.LENGTH_SHORT).show()\n\n        }\n\n        .addOnFailureListener {\n\n            Toast.makeText(this, \"Error adding product\", Toast.LENGTH_SHORT).show()\n\n        }\n\n}\n\n6. Order Management System\n\n\n\nContractors place orders by selecting products from the vendor’s inventory. Vendors can view and manage these orders.\n\n\n\nPlacing an Order (Contractor Side):\n\n\n\nfun placeOrder(order: Order) {\n\n    val db = FirebaseFirestore.getInstance()\n\n    val orderData = hashMapOf(\n\n        \"contractorId\" to order.contractorId,\n\n        \"vendorId\" to order.vendorId,\n\n        \"products\" to order.products,\n\n        \"status\" to \"Pending\"\n\n    )\n\n    db.collection(\"orders\").add(orderData)\n\n        .addOnSuccessListener {\n\n            Toast.makeText(this, \"Order placed successfully\", Toast.LENGTH_SHORT).show()\n\n        }\n\n        .addOnFailureListener {\n\n            Toast.makeText(this, \"Error placing order\", Toast.LENGTH_SHORT).show()\n\n        }\n\n}\n\n\n\nViewing and Managing Orders (Vendor Side):\n\n\n\nfun getOrdersForVendor() {\n\n    val db = FirebaseFirestore.getInstance()\n\n    val ordersRef = db.collection(\"orders\").whereEqualTo(\"vendorId\", vendorId)\n\n\n\n    ordersRef.get().addOnSuccessListener { result -\u003e\n\n        for (document in result) {\n\n            val order = document.toObject(Order::class.java)\n\n            // Display order details\n\n        }\n\n    }\n\n}\n\n\n7. UI/UX Design:\n•\tUse RecyclerView to display lists of products, orders, etc.\n•\tCreate intuitive forms for order placing and inventory management.\n•\tUse CardView to display each product or order in a clean manner.\nExample layout for displaying products in activity_vendor.xml:\n\u003candroidx.recyclerview.widget.RecyclerView\nandroid:id=\"@+id/productRecyclerView\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"/\u003e\n\n9. Notifications (Optional):\nUse Firebase Cloud Messaging (FCM) to send notifications to vendors, contractors, and manufacturers about order status, stock updates, or new product availability.\n\n10. Test \u0026 Debug the App:\n\n• Test the app thoroughly with different users (vendor, contractor, manufacturer).\n\n• Debug any issues related to Firebase connectivity or data handling.\n\n\n\nConclusion:\n\n\n\nThis app structure provides the basic framework for a multi-role Electrical Supplier App that connects vendors, contractors, and manufacturers. The app allows vendors to manage their inventory, contractors to place orders, and manufacturers to handle production and order fulfillment. I can expand this basic structure with features like a chat system, order tracking, and real-time stock updates.\nGNU General Public License v3.0 \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineermichael%2Felectrical-supplier-app-android-studios-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineermichael%2Felectrical-supplier-app-android-studios-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineermichael%2Felectrical-supplier-app-android-studios-/lists"}