Skip to content
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
17 changes: 10 additions & 7 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 @@ -41,6 +41,7 @@ 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.android.gms:play-services-maps:18.0.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
13 changes: 7 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.harshad.projectclean">
package="com.harshad.projectclean" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<application
Expand All @@ -12,7 +13,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ProjectClean">
android:theme="@style/Theme.ProjectClean" >
<activity
android:name=".CreatePost"
android:exported="false" />
Expand All @@ -27,16 +28,16 @@
android:exported="false" />
<activity
android:name=".LoginActivity"
android:exported="true">
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=".MainActivity"
android:exported="false">
android:exported="false" >
</activity>
</application>

Expand Down
14 changes: 11 additions & 3 deletions app/src/main/java/com/harshad/projectclean/CreatePost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ class CreatePost : AppCompatActivity() {
binding = ActivityCreatePostBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)

ImagePicker.with(this).cameraOnly()
.compress(512)
.saveDir(getExternalFilesDir(Environment.DIRECTORY_PICTURES)!!).start()

binding.fabImg.setOnClickListener {
ImagePicker.with(this).cameraOnly()
.compress(512)
.saveDir(getExternalFilesDir(Environment.DIRECTORY_PICTURES)!!).start()
}
sharedPref = getSharedPreferences("SP", Context.MODE_PRIVATE)

actv = binding.dropMenu
Expand All @@ -51,9 +61,7 @@ class CreatePost : AppCompatActivity() {
Toast.makeText(applicationContext, "Item: $item", Toast.LENGTH_SHORT).show()
})

ImagePicker.with(this).cameraOnly()
.compress(512)
.saveDir(getExternalFilesDir(Environment.DIRECTORY_PICTURES)!!).start()


binding.btnSave.setOnClickListener {
val griTitle = binding.edDesc.text.trim().toString()
Expand Down
12 changes: 4 additions & 8 deletions app/src/main/java/com/harshad/projectclean/LoginActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.CheckBox
import android.widget.TextView
import android.widget.Toast
import com.harshad.projectclean.APIRequests.ApiClient
import com.harshad.projectclean.APIRequests.authentication_data_class.CurrentLoggedUserResponse
Expand All @@ -18,7 +15,6 @@ import com.harshad.projectclean.databinding.ActivityLoginBinding
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import kotlin.math.log

class LoginActivity : AppCompatActivity() {
lateinit var sharedPref: SharedPreferences
Expand Down Expand Up @@ -48,13 +44,13 @@ class LoginActivity : AppCompatActivity() {


binding.btnLogin.setOnClickListener {
if (binding.edUsername.text.trim().isNotEmpty() || binding.edPassword.text.trim()
if (binding.edEmail.text.trim().isNotEmpty() || binding.edPassword.text.trim()
.isNotEmpty()
) {
val username: String = binding.edUsername.text.trim().toString()
val email: String = binding.edEmail.text.trim().toString()
val password: String = binding.edPassword.text.trim().toString()
validate()
login(this, username, password)
login(this, email, password)
//Toast.makeText(this,"Remember",Toast.LENGTH_LONG).show()

} else {
Expand Down Expand Up @@ -127,7 +123,7 @@ class LoginActivity : AppCompatActivity() {
})
}
private fun validate(): Boolean {
if (binding.edUsername.text.trim().isNotEmpty() || binding.edPassword.text.trim()
if (binding.edEmail.text.trim().isNotEmpty() || binding.edPassword.text.trim()
.isNotEmpty()
) {
return true
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/com/harshad/projectclean/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import android.view.View
import com.harshad.projectclean.APIRequests.ApiClient
import com.harshad.projectclean.APIRequests.grievance_data_class.*
import com.harshad.projectclean.databinding.ActivityMainBinding
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody.Companion.asRequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.io.File
//import okhttp3.MediaType.Companion.toMediaType
//import okhttp3.MultipartBody
//import okhttp3.RequestBody.Companion.asRequestBody
//import okhttp3.RequestBody.Companion.toRequestBody
//import retrofit2.Call
//import retrofit2.Callback
//import retrofit2.Response
//import java.io.File


class MainActivity : AppCompatActivity() {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/harshad/projectclean/ProfileSetup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class ProfileSetup : AppCompatActivity() {
setContentView(view)
sharedPref = getSharedPreferences("SP", Context.MODE_PRIVATE)
binding.edUsername.setText(sharedPref.getString("username","none"))
binding.edPhoneno.setText(sharedPref.getString("phoneno","none"))
binding.edEmail.setText(sharedPref.getString("email","none"))
binding.edPassword.setText(sharedPref.getString("password","none"))
binding.edFirstname.requestFocus()
binding.btnSave.setOnClickListener {
val intent = Intent(this, DisplayGrievance::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ class RegisterActivity : AppCompatActivity() {

binding.btnSignup.setOnClickListener{
if(validate()){
//val phoneno:String = binding.edPhoneno.text.toString()
val email:String = binding.edEmail.text.toString()
val username:String = binding.edUsername.text.toString()
val password:String = binding.edPassword.text.toString()
val editor : SharedPreferences.Editor =sharedPref.edit()
editor.putString("username", username)
//editor.putString("phoneno", phoneno)
editor.putString("email", email)
editor.putString("password", password)

editor.apply()
Toast.makeText(this,"Profile", Toast.LENGTH_LONG).show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GrievanceRecycleViewAdapter(private val context: Context, private val grie
class GrievanceViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
var gri_title = itemView.findViewById<TextView>(R.id.tv_gri_title)
var gri_location = itemView.findViewById<TextView>(R.id.tv_gri_location)
var gri_desc = itemView.findViewById<TextView>(R.id.tv_gri_desc)
var gri_desc = itemView.findViewById<TextView>(R.id.tvDesc)
var gri_img = itemView.findViewById<ImageView>(R.id.iv_gri_img)
var gri_like_btn = itemView.findViewById<Button>(R.id.btn_griLike)
var gri_comment_btn = itemView.findViewById<Button>(R.id.btn_griComment)
Expand Down
173 changes: 113 additions & 60 deletions app/src/main/res/layout/activity_create_post.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,70 +21,123 @@
tools:srcCompat="@tools:sample/backgrounds/scenic"
android:contentDescription="@string/grievance_image" />

<TextView
android:id="@+id/tvLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="20dp"
android:text="19.71280, 71.89764"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@+id/tvDesc"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivGriImg"
app:layout_constraintVertical_bias="0.22000003" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabImg"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_marginEnd="32dp"
android:clickable="true"
android:contentDescription="FAB"
android:focusable="true"
android:foregroundGravity="center"
app:backgroundTint="#FFFFFFFF"
app:layout_constraintBottom_toBottomOf="@+id/ivGriImg"
app:layout_constraintEnd_toEndOf="@+id/ivGriImg"
app:srcCompat="@android:drawable/ic_menu_camera" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tvDesc"
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLocation">
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/ivGriImg"
android:fillViewport="true"
app:layout_constraintBottom_toBottomOf="parent">

<EditText
android:id="@+id/edDesc"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="phone"
android:hint="@string/describe"
android:inputType="textMultiLine"
android:lines="3"
android:textSize="18sp" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutDropdown"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:hint="@string/select"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDesc">
android:layout_height="0dp">

<AutoCompleteTextView
android:id="@+id/dropMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textDesc" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btnSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/teal_200"
android:layout_margin="30dp"
app:layout_constraintTop_toBottomOf="@+id/layoutDropdown"
android:text="@string/save"
android:textColor="@color/white" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_margin="30dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_height="wrap_content">

<EditText
android:id="@+id/edTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:hint="Title"
android:inputType="text"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>


<TextView
android:id="@+id/tvLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="19.71280, 71.89764"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
android:layout_margin="30dp"
app:layout_constraintTop_toBottomOf="@id/tvTitle"/>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:id="@+id/tvDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
app:layout_constraintTop_toBottomOf="@id/tvLocation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">

<EditText
android:id="@+id/edDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="phone"
android:hint="@string/describe"
android:inputType="textMultiLine"
android:lines="3"
android:textSize="18sp" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutDropdown"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:hint="@string/select"
app:layout_constraintTop_toBottomOf="@id/tvDesc"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">

<AutoCompleteTextView
android:id="@+id/dropMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textDesc" />
</com.google.android.material.textfield.TextInputLayout>




<Button
android:id="@+id/btnSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:layout_marginBottom="10dp"
android:background="@color/teal_200"
android:text="@string/save"
android:textColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/layoutDropdown"/>


</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
Loading