Skip to content
Open
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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ dependencies {
implementation 'com.google.firebase:firebase-auth:22.0.0'
implementation 'com.google.firebase:firebase-perf:20.3.3'

implementation 'com.devlomi.record-view:record-view:2.0.1'
implementation 'com.github.JagarYousef:ChatVoicePlayer:1.0.7'
//implementation 'com.devlomi.record-view:record-view:2.0.1'
//implementation 'com.github.JagarYousef:ChatVoicePlayer:1.0.7'
implementation 'com.github.bumptech.glide:glide:4.15.1'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Comment on lines 9 to 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove duplicate permission declarations.

The INTERNET and ACCESS_NETWORK_STATE permissions are declared twice (lines 9-10 and 19-20). Remove the duplicate declarations to clean up the manifest.

-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
-    <uses-permission
-        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
-        tools:ignore="ScopedStorage" />
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
-        android:maxSdkVersion="32" />
-
-    <!-- Internet and media permissions -->
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
+    <uses-permission
+        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
+        tools:ignore="ScopedStorage" />

Also applies to: 19-20

🤖 Prompt for AI Agents
In app/src/main/AndroidManifest.xml at lines 9-10 and 19-20, the permissions
INTERNET and ACCESS_NETWORK_STATE are declared twice. Remove the duplicate
declarations at lines 19-20 to keep only one instance of each permission and
clean up the manifest file.

<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
Expand All @@ -11,6 +15,21 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
Comment on lines 15 to 16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove duplicate READ_EXTERNAL_STORAGE permission.

The READ_EXTERNAL_STORAGE permission is declared twice with the same maxSdkVersion="32". Keep only one declaration.

-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
-        android:maxSdkVersion="32" />

Also applies to: 27-28

🤖 Prompt for AI Agents
In app/src/main/AndroidManifest.xml around lines 15 to 16 and also lines 27 to
28, the READ_EXTERNAL_STORAGE permission is declared twice with the same
maxSdkVersion="32". Remove the duplicate declarations so that the permission is
only declared once to avoid redundancy.


<!-- Internet and media permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- For Android 13+ (API 33+) -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"
tools:ignore="SelectedPhotoAccess" />

<!-- For Android 12 and below -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<!-- Camera or audio permissions (if used in calls) -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:name=".OfflineCapabilities"
android:allowBackup="true"
Expand Down
549 changes: 166 additions & 383 deletions app/src/main/java/com/Strong/ConnectX/Activity/mainChatActivity.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import android.view.View;
import android.widget.Toast;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

Expand All @@ -29,31 +31,47 @@
public class uploadProfileActivity extends AppCompatActivity {

ActivityProfileBinding BindProfile;
//Uri Indicates where the image wil be picked from!
private Uri filePath;

//Request Code
private final int PICK_IMAGE_REQUEST = 22;
//Firebase Instance
StorageReference storageReference;
private FirebaseAuth mAuth;
String username, email, pass, id;

private ActivityResultLauncher<Intent> imagePickerLauncher;

@Override
protected void onCreate(Bundle savedInstanceState) {
mAuth = FirebaseAuth.getInstance();
super.onCreate(savedInstanceState);
BindProfile = ActivityProfileBinding.inflate(getLayoutInflater());
setContentView(BindProfile.getRoot());

// Retrieve data from intent
username = getIntent().getStringExtra(Constants.KEY_USERNAME);
email = getIntent().getStringExtra(Constants.KEY_EMAIL);
pass = getIntent().getStringExtra(Constants.KEY_PASSWORD);
id = getIntent().getStringExtra(Constants.KEY_ID);

BindProfile.newProfileImage.setOnClickListener(view -> SelectImage());
// Initialize ActivityResultLauncher
imagePickerLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == RESULT_OK && result.getData() != null) {
filePath = result.getData().getData();
try {
BindProfile.pickImage.setVisibility(View.INVISIBLE);
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
BindProfile.newProfileImage.setImageBitmap(bitmap);
} catch (IOException e) {
e.printStackTrace();
}
}
}
);

// Image selection
BindProfile.newProfileImage.setOnClickListener(view -> SelectImage());

// Upload button
BindProfile.uploadProfile.setOnClickListener(view -> {
try {
uploadImage();
Expand All @@ -67,32 +85,14 @@ private void SelectImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(ACTION_GET_CONTENT);
startActivityForResult(createChooser(intent, "Select Image From Here"), PICK_IMAGE_REQUEST);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
//get The Uri of Data
filePath = data.getData();
//Setting image on imageview using bitmap
try {
BindProfile.pickImage.setVisibility(View.INVISIBLE);
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
BindProfile.newProfileImage.setImageBitmap(bitmap);
} catch (IOException e) {
e.printStackTrace();
}
}
imagePickerLauncher.launch(createChooser(intent, "Select Image From Here"));
}

private void uploadImage() throws IOException {
if (filePath != null) {
showToast("Uploading Profile Pic");
visibility(true);

//Storing Image String to The Database
FirebaseDatabase database = FirebaseDatabase.getInstance();
storageReference = FirebaseStorage.getInstance().getReference();

Expand All @@ -103,7 +103,6 @@ private void uploadImage() throws IOException {

mAuth.createUserWithEmailAndPassword(email, pass).addOnCompleteListener(task -> {
if (task.isSuccessful()) {

String id = Objects.requireNonNull(mAuth.getCurrentUser()).getUid();
storageReference = storageReference.child("ProfileImages/" + id);

Expand All @@ -118,26 +117,23 @@ private void uploadImage() throws IOException {
database.getReference().child("Users").child(id).setValue(hashMap);
showToast("Image Uploaded!");
});

showToast("Welcome " + username + " PersonalChat.");
Intent intent = new Intent(uploadProfileActivity.this, recentActivity.class);
startActivity(intent);
}).addOnFailureListener(e -> {
visibility(false);
showToast("Failed" + e.getMessage());
showToast("Failed: " + e.getMessage());
});
} else {
// Registration failed
showToast(Objects.requireNonNull(task.getException()).getMessage());
}
});
} else {
showToast("Please select an image first.");
}
}

@Override
public void onBackPressed() {
super.onBackPressed();
}

private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
Expand All @@ -151,4 +147,9 @@ private void visibility(boolean key) {
BindProfile.uploadProfile.setVisibility(View.VISIBLE);
}
}
}

@Override
public void onBackPressed() {
super.onBackPressed();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.Strong.personalchat.Utilities;
package com.Strong.ConnectX.Utilities;

import com.Strong.ConnectX.Utilities.MyResponse;
import com.Strong.ConnectX.Utilities.NotificationSender;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;

public interface APIService {
@Headers({"Content-Type:application/json", "YOUR_FCM_KEY"})
@Headers({"Content-Type:application/json", "FCM_KEY"})

@POST("fcm/send")
Call<MyResponse> sendNotification(@Body NotificationSender body);
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/recv_ic_delete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#3C4FF8" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>

</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/round_corner.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<stroke android:color="@color/white" android:width="2dp"/>
<stroke android:color="@color/White" android:width="2dp"/>
</shape>
42 changes: 21 additions & 21 deletions app/src/main/res/layout/sample_audiorecieve.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints">

<me.jagar.chatvoiceplayerlibrary.VoicePlayerView
android:id="@+id/RecVoicePlayerView"
android:layout_width="260dp"
android:layout_height="wrap_content"
app:enableVisualizer="true"
app:playPauseBackgroundColor="#0F8BED"
app:playPauseCornerRadius="100"
app:playProgressbarColor="#0F8BED"
app:progressTimeColor="#000"
app:seekBarProgressColor="#000"
app:seekBarThumbColor="#11A4DD"
app:shareBackgroundColor="#0F8BED"
app:shareCornerRadius="100"
app:shareText="SHARE ME"
app:showShareButton="false"
app:showTiming="true"
app:timingBackgroundColor="#8611A4DD"
app:viewBackground="#C6C4CF"
app:viewCornerRadius="100"
app:visualizationNotPlayedColor="#727171"
app:visualizationPlayedColor="#ff7700" />
<!-- <me.jagar.chatvoiceplayerlibrary.VoicePlayerView-->
<!-- android:id="@+id/RecVoicePlayerView"-->
<!-- android:layout_width="260dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:enableVisualizer="true"-->
<!-- app:playPauseBackgroundColor="#0F8BED"-->
<!-- app:playPauseCornerRadius="100"-->
<!-- app:playProgressbarColor="#0F8BED"-->
<!-- app:progressTimeColor="#000"-->
<!-- app:seekBarProgressColor="#000"-->
<!-- app:seekBarThumbColor="#11A4DD"-->
<!-- app:shareBackgroundColor="#0F8BED"-->
<!-- app:shareCornerRadius="100"-->
<!-- app:shareText="SHARE ME"-->
<!-- app:showShareButton="false"-->
<!-- app:showTiming="true"-->
<!-- app:timingBackgroundColor="#8611A4DD"-->
<!-- app:viewBackground="#C6C4CF"-->
<!-- app:viewCornerRadius="100"-->
<!-- app:visualizationNotPlayedColor="#727171"-->
<!-- app:visualizationPlayedColor="#ff7700" />-->

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
42 changes: 21 additions & 21 deletions app/src/main/res/layout/sample_audiosend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@
app:layout_constraintTop_toTopOf="parent">


<me.jagar.chatvoiceplayerlibrary.VoicePlayerView
android:id="@+id/SendVoicePlayerView"
android:layout_width="260dp"
android:layout_height="wrap_content"
app:enableVisualizer="true"
app:playPauseBackgroundColor="#0F8BED"
app:playPauseCornerRadius="100"
app:playProgressbarColor="#0F8BED"
app:progressTimeColor="#000"
app:seekBarProgressColor="#000"
app:seekBarThumbColor="#FFC107"
app:shareBackgroundColor="#0F8BED"
app:shareCornerRadius="100"
app:shareText="SHARE ME"
app:showShareButton="false"
app:showTiming="true"
app:timingBackgroundColor="#8611A4DD"
app:viewBackground="#C6C4CF"
app:viewCornerRadius="100"
app:visualizationNotPlayedColor="#727171"
app:visualizationPlayedColor="#ff7700" />
<!-- <me.jagar.chatvoiceplayerlibrary.VoicePlayerView-->
<!-- android:id="@+id/SendVoicePlayerView"-->
<!-- android:layout_width="260dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:enableVisualizer="true"-->
<!-- app:playPauseBackgroundColor="#0F8BED"-->
<!-- app:playPauseCornerRadius="100"-->
<!-- app:playProgressbarColor="#0F8BED"-->
<!-- app:progressTimeColor="#000"-->
<!-- app:seekBarProgressColor="#000"-->
<!-- app:seekBarThumbColor="#FFC107"-->
<!-- app:shareBackgroundColor="#0F8BED"-->
<!-- app:shareCornerRadius="100"-->
<!-- app:shareText="SHARE ME"-->
<!-- app:showShareButton="false"-->
<!-- app:showTiming="true"-->
<!-- app:timingBackgroundColor="#8611A4DD"-->
<!-- app:viewBackground="#C6C4CF"-->
<!-- app:viewCornerRadius="100"-->
<!-- app:visualizationNotPlayedColor="#727171"-->
<!-- app:visualizationPlayedColor="#ff7700" />-->
</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="White">#FFFFFF</color>
<color name="white">#FFFFFF</color>
Comment on lines 11 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Duplicate & improperly-named color creates build-time failure risk

White already violates Android’s naming rule (lower-case, digits, underscores only). Adding a second entry white duplicates the value and doubles the confusion. Choose one, keep it lowercase and migrate all references to it.

-    <color name="White">#FFFFFF</color>
-    <color name="white">#FFFFFF</color>
+    <color name="white">#FFFFFF</color>

Afterwards replace every @color/White with @color/white across the project.

🤖 Prompt for AI Agents
In app/src/main/res/values/colors.xml at lines 11-12, there are two color
entries named "White" and "white" which duplicates the same color and violates
Android's naming conventions requiring lowercase letters only. Remove the
"White" entry, keep the "white" entry, and update all references in the project
from "@color/White" to "@color/white" to ensure consistency and prevent build
errors.

<color name="Ivory">#FFFFF0</color>
<color name="LightYellow">#FFFFE0</color>
<color name="Yellow">#FFFF00</color>
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jan 11 05:35:23 IST 2022
#Wed Jun 25 07:29:44 IST 2025
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME