Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
My notepad
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
9731301
My notepad
Commits
1e1d10e3
Commit
1e1d10e3
authored
Nov 08, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GalleryAdaptor
parent
c8a3009f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
187 additions
and
34 deletions
+187
-34
build.gradle
app/build.gradle
+0
-1
NoteFragment.java
...le/mynotepad/MenuFeatures/AllNotes/Note/NoteFragment.java
+17
-0
GalleryAdaptor.java
...e/mynotepad/MenuFeatures/Pics/Gallery/GalleryAdaptor.java
+56
-0
MyGalleryPic.java
...ple/mynotepad/MenuFeatures/Pics/Gallery/MyGalleryPic.java
+27
-0
NotedPicsListFragment.java
...epad/MenuFeatures/Pics/Gallery/NotedPicsListFragment.java
+2
-1
bg_border.xml
app/src/main/res/drawable/bg_border.xml
+9
-0
custom_gallery_item.xml
app/src/main/res/layout/custom_gallery_item.xml
+19
-0
fragment_note.xml
app/src/main/res/layout/fragment_note.xml
+48
-28
fragment_noted_pics.xml
app/src/main/res/layout/fragment_noted_pics.xml
+8
-3
bottom_nav_pic.xml
app/src/main/res/navigation/bottom_nav_pic.xml
+1
-1
No files found.
app/build.gradle
View file @
1e1d10e3
...
...
@@ -46,5 +46,4 @@ dependencies {
implementation
'com.google.android.material:material:1.3.0-alpha03'
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/AllNotes/Note/NoteFragment.java
View file @
1e1d10e3
...
...
@@ -6,6 +6,7 @@ import android.os.Bundle;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.fragment.app.Fragment
;
import
android.view.LayoutInflater
;
...
...
@@ -21,6 +22,7 @@ import com.example.mynotepad.MenuFeatures.AllNotes.AllNotesListFragment;
import
com.example.mynotepad.MenuFeatures.AllNotes.DataBase.DateEntity
;
import
com.example.mynotepad.MenuFeatures.AllNotes.DataBase.Note
;
import
com.example.mynotepad.MenuFeatures.Calender.CalenderNotesListFragment
;
import
com.example.mynotepad.MenuFeatures.Utils
;
import
com.example.mynotepad.R
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
...
...
@@ -37,6 +39,7 @@ public class NoteFragment extends Fragment {
private
FloatingActionButton
back
;
private
boolean
isAnewNote
;
private
String
type
,
noteDateType
;
private
ConstraintLayout
noteLayout
;
public
NoteFragment
()
{
}
...
...
@@ -47,6 +50,7 @@ public class NoteFragment extends Fragment {
// Inflate the layout for this fragment
final
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_note
,
container
,
false
);
init
(
v
);
setBg
(
Utils
.
sTheme
);
isAnewNote
=
true
;
return
v
;
}
...
...
@@ -57,15 +61,28 @@ public class NoteFragment extends Fragment {
setTitleAndBodyTxt
();
}
private
void
setBg
(
String
sTheme
)
{
switch
(
sTheme
)
{
case
"dark"
:
noteLayout
.
setBackgroundResource
(
R
.
drawable
.
main_bg_dark
);
break
;
case
"bright"
:
noteLayout
.
setBackgroundResource
(
R
.
drawable
.
main_bg_bright
);
break
;
}
}
private
void
init
(
View
view
)
{
back
=
view
.
findViewById
(
R
.
id
.
backBtn
);
titleTxt
=
view
.
findViewById
(
R
.
id
.
myTitle
);
bodyTxt
=
view
.
findViewById
(
R
.
id
.
textBody
);
noteLayout
=
view
.
findViewById
(
R
.
id
.
noteLayout
);
back
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
titleTxt
.
getText
().
length
()
!=
0
&&
bodyTxt
.
getText
().
length
()
!=
0
)
showAlert
();
else
getActivity
().
onBackPressed
();
}
});
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/Pics/Gallery/GalleryAdaptor.java
0 → 100644
View file @
1e1d10e3
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Pics
.
Gallery
;
import
android.content.Context
;
import
android.graphics.BitmapFactory
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.example.mynotepad.R
;
import
java.util.ArrayList
;
public
class
GalleryAdaptor
extends
RecyclerView
.
Adapter
<
GalleryAdaptor
.
GalleryViewHolder
>
{
private
ArrayList
<
MyGalleryPic
>
picsUrlAndTxt
;
private
Context
context
;
public
GalleryAdaptor
(
ArrayList
<
MyGalleryPic
>
picsUrlAndTxt
,
Context
context
)
{
this
.
picsUrlAndTxt
=
picsUrlAndTxt
;
this
.
context
=
context
;
}
@NonNull
@Override
public
GalleryViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
custom_gallery_item
,
parent
,
false
);
return
new
GalleryViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
GalleryViewHolder
holder
,
int
position
)
{
holder
.
textView
.
setText
(
picsUrlAndTxt
.
get
(
position
).
getText
());
System
.
out
.
println
(
picsUrlAndTxt
.
get
(
position
).
getUrl
()
+
" !!!!!"
);
holder
.
imageView
.
setImageBitmap
(
BitmapFactory
.
decodeFile
(
picsUrlAndTxt
.
get
(
position
).
getUrl
()));
}
@Override
public
int
getItemCount
()
{
return
picsUrlAndTxt
.
size
();
}
public
class
GalleryViewHolder
extends
RecyclerView
.
ViewHolder
{
TextView
textView
;
ImageView
imageView
;
public
GalleryViewHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
textView
=
itemView
.
findViewById
(
R
.
id
.
tv_gallery
);
imageView
=
itemView
.
findViewById
(
R
.
id
.
img_gallery
);
}
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Pics/Gallery/MyGalleryPic.java
0 → 100644
View file @
1e1d10e3
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Pics
.
Gallery
;
public
class
MyGalleryPic
{
private
String
url
;
private
String
text
;
public
MyGalleryPic
(
String
url
,
String
text
)
{
this
.
url
=
url
;
this
.
text
=
text
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/Pics/NotedPicsListFragment.java
→
app/src/main/java/com/example/mynotepad/MenuFeatures/Pics/
Gallery/
NotedPicsListFragment.java
View file @
1e1d10e3
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Pics
;
package
com
.
example
.
mynotepad
.
MenuFeatures
.
Pics
.
Gallery
;
import
android.os.Bundle
;
...
...
@@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.example.mynotepad.MenuFeatures.Pics.PicsActivity
;
import
com.example.mynotepad.R
;
public
class
NotedPicsListFragment
extends
Fragment
{
...
...
app/src/main/res/drawable/bg_border.xml
0 → 100644
View file @
1e1d10e3
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"?colorButtonNormal"
/>
<stroke
android:color=
"?colorPrimary"
android:width=
"10dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/custom_gallery_item.xml
0 → 100644
View file @
1e1d10e3
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:background=
"@color/colorPrimaryDark"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/img_gallery"
android:adjustViewBounds=
"true"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/tv_gallery"
android:layout_gravity=
"center"
android:textColor=
"#FFFFFF"
android:textStyle=
"bold"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_note.xml
View file @
1e1d10e3
...
...
@@ -3,42 +3,62 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/noteLayout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/
notes_bg
"
android:background=
"@drawable/
main_bg_bright
"
android:orientation=
"vertical"
android:visibility=
"visible"
>
<EditText
android:id=
"@+id/myTitle"
android:layout_width=
"311dp"
android:layout_height=
"48dp"
android:layout_marginTop=
"52dp"
android:hint=
" title"
android:textColor=
"@color/black"
android:textSize=
"24dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<EditText
android:id=
"@+id/textBody"
android:layout_width=
"341dp"
android:layout_height=
"0dp"
android:layout_alignParentBottom=
"true"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"20dp"
android:gravity=
"top"
android:hint=
"@string/dots"
android:selectAllOnFocus=
"false"
android:textColor=
"#000000"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginStart=
"32dp"
android:layout_marginLeft=
"32dp"
android:layout_marginTop=
"32dp"
android:layout_marginEnd=
"32dp"
android:layout_marginRight=
"32dp"
android:layout_marginBottom=
"32dp"
android:background=
"@drawable/bg_border"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.492"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/myTitle"
app:layout_constraintVertical_bias=
"0.353"
/>
app:layout_constraintTop_toTopOf=
"parent"
>
<EditText
android:id=
"@+id/myTitle"
android:layout_width=
"311dp"
android:layout_height=
"48dp"
android:layout_marginTop=
"12dp"
android:hint=
" title"
android:textColor=
"?android:textColorPrimary"
android:textSize=
"24dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<EditText
android:id=
"@+id/textBody"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_alignParentBottom=
"true"
android:layout_marginStart=
"16dp"
android:layout_marginLeft=
"16dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"16dp"
android:layout_marginRight=
"16dp"
android:layout_marginBottom=
"20dp"
android:gravity=
"top"
android:hint=
"@string/dots"
android:selectAllOnFocus=
"false"
android:textColor=
"?android:textColorPrimary"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.492"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/myTitle"
app:layout_constraintVertical_bias=
"0.353"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id=
"@+id/backBtn"
...
...
app/src/main/res/layout/fragment_noted_pics.xml
View file @
1e1d10e3
<?xml version="1.0" encoding="utf-8"?>
<
Frame
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
androidx.coordinatorlayout.widget.Coordinator
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".MenuFeatures.Pics.NotedPicsListFragment"
>
tools:context=
".MenuFeatures.Pics.
Gallery.
NotedPicsListFragment"
>
</FrameLayout>
\ No newline at end of file
<androidx.recyclerview.widget.RecyclerView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scrollbars=
"vertical"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
app/src/main/res/navigation/bottom_nav_pic.xml
View file @
1e1d10e3
...
...
@@ -12,7 +12,7 @@
tools:layout=
"@layout/fragment_choosing_pics"
/>
<fragment
android:id=
"@+id/navigation_picturedNoteList"
android:name=
"com.example.mynotepad.MenuFeatures.Pics.NotedPicsListFragment"
android:name=
"com.example.mynotepad.MenuFeatures.Pics.
Gallery.
NotedPicsListFragment"
android:label=
"fragment_noted_pics"
tools:layout=
"@layout/fragment_noted_pics"
/>
</navigation>
\ No newline at end of file
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