Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OD-System
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Prashanth Sadasivan
OD-System
Commits
dd126151
Commit
dd126151
authored
8 years ago
by
darshanxyz
Browse files
Options
Downloads
Patches
Plain Diff
Collected advisor email ids and populated list1
parent
65762dba
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/com/darshanbshah/odsystem/MainActivity.java
+70
-2
70 additions, 2 deletions
...src/main/java/com/darshanbshah/odsystem/MainActivity.java
app/src/main/java/com/darshanbshah/odsystem/RollNumber.java
+19
-7
19 additions, 7 deletions
app/src/main/java/com/darshanbshah/odsystem/RollNumber.java
with
89 additions
and
9 deletions
app/src/main/java/com/darshanbshah/odsystem/MainActivity.java
+
70
−
2
View file @
dd126151
...
...
@@ -11,10 +11,18 @@ import android.widget.DatePicker;
import
android.widget.EditText
;
import
android.widget.FrameLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.google.firebase.auth.FirebaseAuth
;
import
com.google.firebase.database.ChildEventListener
;
import
com.google.firebase.database.DataSnapshot
;
import
com.google.firebase.database.DatabaseError
;
import
com.google.firebase.database.DatabaseReference
;
import
com.google.firebase.database.FirebaseDatabase
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
public
class
MainActivity
extends
AppCompatActivity
{
...
...
@@ -27,22 +35,80 @@ public class MainActivity extends AppCompatActivity {
String
reasonString
,
fromDate
,
toDate
,
full
;
Boolean
fullDay
=
false
;
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
root
;
DatabaseReference
student
;
DatabaseReference
adv
;
DatabaseReference
id
;
DatabaseReference
roll_no
;
DatabaseReference
email
;
DatabaseReference
advisor
;
String
recepient
=
""
;
List
<
String
>
list1
=
new
ArrayList
<
String
>();
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
mAuth
=
FirebaseAuth
.
getInstance
();
root
=
database
.
getReference
();
student
=
root
.
child
(
"Student"
);
adv
=
root
.
child
(
"Advisors"
);
id
=
student
.
child
(
mAuth
.
getCurrentUser
().
getUid
());
roll_no
=
id
.
child
(
"RollNumber"
);
email
=
id
.
child
(
"Email"
);
advisor
=
id
.
child
(
"Advisor"
);
welcomeText
=
(
TextView
)
findViewById
(
R
.
id
.
welcomeText
);
welcomeText
.
setText
(
"Welcome "
+
mAuth
.
getCurrentUser
().
getEmail
());
from
=
(
TextView
)
findViewById
(
R
.
id
.
fromDateTV
);
to
=
(
TextView
)
findViewById
(
R
.
id
.
toDateTV
);
frameLayout
=
(
FrameLayout
)
findViewById
(
R
.
id
.
hours_frame_layout
);
reason
=
(
EditText
)
findViewById
(
R
.
id
.
reasonEditText
);
student
.
addChildEventListener
(
new
ChildEventListener
()
{
@Override
public
void
onChildAdded
(
DataSnapshot
dataSnapshot
,
String
s
)
{
for
(
DataSnapshot
dsp
:
dataSnapshot
.
getChildren
()){
if
(
dsp
.
getKey
().
toString
().
equals
(
"Advisor"
))
{
list1
.
add
(
String
.
valueOf
(
dsp
.
getValue
()));
Log
.
e
(
"E-MAIL "
,
String
.
valueOf
(
dsp
.
getValue
()));
}
}
}
@Override
public
void
onChildChanged
(
DataSnapshot
dataSnapshot
,
String
s
)
{
}
@Override
public
void
onChildRemoved
(
DataSnapshot
dataSnapshot
)
{
}
@Override
public
void
onChildMoved
(
DataSnapshot
dataSnapshot
,
String
s
)
{
}
@Override
public
void
onCancelled
(
DatabaseError
databaseError
)
{
}
});
}
public
void
onClickFromDatePicker
(
View
view
)
{
new
DatePickerDialog
(
this
,
fromListener
,
calendar
.
get
(
Calendar
.
YEAR
),
calendar
.
get
(
Calendar
.
MONTH
),
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
)).
show
();
}
...
...
@@ -95,8 +161,10 @@ public class MainActivity extends AppCompatActivity {
Intent
intent
=
new
Intent
(
Intent
.
ACTION_SEND
);
intent
.
setData
(
Uri
.
parse
(
"mailto:"
));
String
[]
recepients
=
{
""
};
intent
.
putExtra
(
Intent
.
EXTRA_EMAIL
,
recepients
);
// Log.e("Recepient", recepient);
intent
.
putExtra
(
Intent
.
EXTRA_EMAIL
,
recepient
);
intent
.
putExtra
(
Intent
.
EXTRA_SUBJECT
,
"OD Request"
);
intent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
"Reason: "
+
reasonString
+
'\n'
+
"From: "
+
fromDate
+
'\n'
+
"To: "
+
toDate
+
'\n'
+
"Full day: "
+
full
);
intent
.
setType
(
"message/rfc822"
);
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/com/darshanbshah/odsystem/RollNumber.java
+
19
−
7
View file @
dd126151
...
...
@@ -4,6 +4,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.support.annotation.MainThread
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
...
...
@@ -36,19 +37,28 @@ public class RollNumber extends AppCompatActivity implements AdapterView.OnItemS
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
root
=
database
.
getReference
()
;
DatabaseReference
student
=
root
.
child
(
"Student"
)
;
DatabaseReference
adv
=
root
.
child
(
"Advisors"
)
;
DatabaseReference
id
=
student
.
child
(
mAuth
.
getCurrentUser
().
getUid
())
;
DatabaseReference
roll_no
=
id
.
child
(
"RollNumber"
)
;
DatabaseReference
email
=
id
.
child
(
"Email"
)
;
DatabaseReference
advisor
=
id
.
child
(
"Advisor"
)
;
DatabaseReference
root
;
DatabaseReference
student
;
DatabaseReference
adv
;
DatabaseReference
id
;
DatabaseReference
roll_no
;
DatabaseReference
email
;
DatabaseReference
advisor
;
List
<
String
>
list
=
new
ArrayList
<
String
>();
List
<
String
>
lst
=
new
ArrayList
<
String
>();
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
root
=
database
.
getReference
();
student
=
root
.
child
(
"Student"
);
adv
=
root
.
child
(
"Advisors"
);
id
=
student
.
child
(
mAuth
.
getCurrentUser
().
getUid
());
roll_no
=
id
.
child
(
"RollNumber"
);
email
=
id
.
child
(
"Email"
);
advisor
=
id
.
child
(
"Advisor"
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_roll_number
);
rollNumber
=
(
EditText
)
findViewById
(
R
.
id
.
rollNumberEditText
);
...
...
@@ -108,6 +118,8 @@ public class RollNumber extends AppCompatActivity implements AdapterView.OnItemS
});
// SharedPreferences preferences = getSharedPreferences("ActivityPREF", Context.MODE_PRIVATE);
//
// if(preferences.getBoolean("activity_executed", false)){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment