Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
intern-amin-qms
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amin
intern-amin-qms
Commits
91042840
Commit
91042840
authored
Oct 23, 2025
by
Amin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix and add in history
parent
b4ee0f71
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
245 additions
and
2 deletions
+245
-2
AddInfo.java
app/src/main/java/com/example/qms/AddInfo.java
+79
-2
History.java
app/src/main/java/com/example/qms/History.java
+6
-0
camera_add.png
app/src/main/res/drawable/camera_add.png
+0
-0
upload_border.xml
app/src/main/res/drawable/upload_border.xml
+13
-0
activity_add_info.xml
app/src/main/res/layout/activity_add_info.xml
+147
-0
activity_history.xml
app/src/main/res/layout/activity_history.xml
+0
-0
activity_issue_details.xml
app/src/main/res/layout/activity_issue_details.xml
+0
-0
No files found.
app/src/main/java/com/example/qms/AddInfo.java
View file @
91042840
package
com
.
example
.
qms
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.ImageButton
;
import
androidx.activity.EdgeToEdge
;
import
androidx.activity.result.ActivityResultLauncher
;
import
androidx.activity.result.contract.ActivityResultContracts
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.graphics.Insets
;
import
androidx.core.view.ViewCompat
;
...
...
@@ -10,15 +19,84 @@ import androidx.core.view.WindowInsetsCompat;
public
class
AddInfo
extends
AppCompatActivity
{
private
LinearLayout
uploadLayout
;
private
ImageView
cameraIcon
;
private
TextView
uploadText
;
// Launcher for picking image
private
final
ActivityResultLauncher
<
Intent
>
pickImageLauncher
=
registerForActivityResult
(
new
ActivityResultContracts
.
StartActivityForResult
(),
result
->
{
if
(
result
.
getResultCode
()
==
Activity
.
RESULT_OK
&&
result
.
getData
()
!=
null
)
{
Uri
imageUri
=
result
.
getData
().
getData
();
if
(
imageUri
!=
null
)
{
getContentResolver
().
takePersistableUriPermission
(
imageUri
,
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
// Set the background of the layout to the chosen image
uploadLayout
.
setBackground
(
null
);
// remove the border first
uploadLayout
.
setBackgroundResource
(
R
.
drawable
.
upload_border
);
// keep border look
uploadLayout
.
setClipToOutline
(
true
);
// follow rounded shape if any
uploadLayout
.
setBackground
(
null
);
uploadLayout
.
setBackgroundResource
(
0
);
uploadLayout
.
setBackgroundResource
(
R
.
drawable
.
upload_border
);
uploadLayout
.
setClipToOutline
(
true
);
// Create an ImageView to preview inside the layout
ImageView
preview
=
new
ImageView
(
this
);
preview
.
setLayoutParams
(
new
LinearLayout
.
LayoutParams
(
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
LinearLayout
.
LayoutParams
.
MATCH_PARENT
));
preview
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
preview
.
setImageURI
(
imageUri
);
// Clear previous views (icon + text)
uploadLayout
.
removeAllViews
();
uploadLayout
.
addView
(
preview
);
}
}
});
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
EdgeToEdge
.
enable
(
this
);
setContentView
(
R
.
layout
.
activity_add_info
);
ViewCompat
.
setOnApplyWindowInsetsListener
(
findViewById
(
R
.
id
.
main
),
(
v
,
insets
)
->
{
Insets
systemBars
=
insets
.
getInsets
(
WindowInsetsCompat
.
Type
.
systemBars
());
v
.
setPadding
(
systemBars
.
left
,
systemBars
.
top
,
systemBars
.
right
,
systemBars
.
bottom
);
return
insets
;
});
uploadLayout
=
findViewById
(
R
.
id
.
comment_section
).
findViewById
(
R
.
id
.
uploadLayout
);
// If uploadLayout doesn’t have id, just find it directly:
uploadLayout
=
findViewById
(
R
.
id
.
comment_section
).
findViewById
(
R
.
id
.
comment_section
);
// Or simply:
uploadLayout
=
findViewById
(
R
.
id
.
comment_section
).
findViewById
(
R
.
id
.
comment_section
);
// If your inner layout has no id, give it one in XML:
// android:id="@+id/uploadLayout"
uploadLayout
=
findViewById
(
R
.
id
.
uploadLayout
);
// Reference icon and text
cameraIcon
=
uploadLayout
.
findViewById
(
R
.
id
.
camera_icon
);
uploadText
=
uploadLayout
.
findViewById
(
R
.
id
.
upload_text
);
uploadLayout
.
setOnClickListener
(
v
->
openGallery
());
ImageButton
backButton
=
findViewById
(
R
.
id
.
back_button
);
if
(
backButton
!=
null
)
backButton
.
setOnClickListener
(
v
->
onBackPressed
());
}
private
void
openGallery
()
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_OPEN_DOCUMENT
);
intent
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
);
intent
.
setType
(
"image/*"
);
pickImageLauncher
.
launch
(
intent
);
}
}
\ No newline at end of file
}
app/src/main/java/com/example/qms/History.java
View file @
91042840
...
...
@@ -24,6 +24,12 @@ public class History extends AppCompatActivity {
});
ImageButton
addInfo
=
findViewById
(
R
.
id
.
add_info_icon
);
ImageButton
backButton
=
findViewById
(
R
.
id
.
backButton
);
backButton
.
setOnClickListener
(
v
->
{
onBackPressed
();
});
addInfo
.
setOnClickListener
(
v
->
{
Intent
intent
=
new
Intent
(
History
.
this
,
AddInfo
.
class
);
...
...
app/src/main/res/drawable/camera_add.png
0 → 100644
View file @
91042840
2.01 KB
app/src/main/res/drawable/upload_border.xml
0 → 100644
View file @
91042840
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@android:color/transparent"
/>
<stroke
android:width=
"1dp"
android:color=
"@color/card_border"
android:dashGap=
"4dp"
android:dashWidth=
"4dp"
/>
<corners
android:radius=
"21dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_add_info.xml
View file @
91042840
...
...
@@ -7,4 +7,150 @@
android:layout_height=
"match_parent"
tools:context=
".AddInfo"
>
<LinearLayout
android:id=
"@+id/top_nav"
android:layout_width=
"match_parent"
android:layout_height=
"117dp"
android:background=
"@color/primary"
android:orientation=
"vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<View
android:layout_width=
"match_parent"
android:layout_height=
"59dp"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"59dp"
>
<ImageButton
android:id=
"@+id/back_button"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_marginStart=
"16dp"
android:background=
"@null"
android:src=
"@drawable/arrow_left"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/titleText"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Add Info"
android:textColor=
"@color/white"
android:textSize=
"20sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<TextView
android:id=
"@+id/issue_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:paddingHorizontal=
"21dp"
android:text=
"ASH1-L011-N826"
android:textSize=
"24sp"
android:textStyle=
"bold"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/top_nav"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:paddingHorizontal=
"21dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/issue_name"
>
<LinearLayout
android:id=
"@+id/remarks_section"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/issue_name"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"* Comment"
android:textSize=
"19sp"
android:textStyle=
"bold"
/>
<EditText
android:id=
"@+id/remarks_input"
android:layout_width=
"match_parent"
android:layout_height=
"115dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/background_border"
android:gravity=
"top|start"
android:hint=
"Enter remarks here..."
android:inputType=
"textMultiLine"
android:padding=
"15dp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/comment_section"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"15dp"
android:orientation=
"vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/issue_name"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Image Upload"
android:textSize=
"19sp"
android:textStyle=
"bold"
android:layout_marginBottom=
"10dp"
/>
<LinearLayout
android:id=
"@+id/uploadLayout"
android:layout_width=
"match_parent"
android:layout_height=
"150dp"
android:background=
"@drawable/upload_border"
android:gravity=
"center"
android:orientation=
"vertical"
android:clipToOutline=
"true"
>
<ImageView
android:id=
"@+id/camera_icon"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:src=
"@drawable/camera_add"
/>
<TextView
android:id=
"@+id/upload_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:text=
"Upload Image"
android:textColor=
"@color/primary"
android:textSize=
"17dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_history.xml
View file @
91042840
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/activity_issue_details.xml
View file @
91042840
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment