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
Android 2017
OD-System
Commits
67a9043e
Commit
67a9043e
authored
8 years ago
by
darshanxyz
Browse files
Options
Downloads
Patches
Plain Diff
Added Email functionality
parent
d70378e1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/darshanbshah/odsystem/MainActivity.java
+22
-10
22 additions, 10 deletions
...src/main/java/com/darshanbshah/odsystem/MainActivity.java
with
22 additions
and
10 deletions
app/src/main/java/com/darshanbshah/odsystem/MainActivity.java
+
22
−
10
View file @
67a9043e
...
...
@@ -2,6 +2,7 @@ package com.darshanbshah.odsystem;
import
android.app.DatePickerDialog
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.util.Log
;
...
...
@@ -25,6 +26,8 @@ public class MainActivity extends AppCompatActivity {
TextView
from
,
to
;
FrameLayout
frameLayout
;
EditText
reason
;
String
reasonString
,
fromDate
,
toDate
,
full
;
Boolean
fullDay
=
false
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -67,17 +70,10 @@ public class MainActivity extends AppCompatActivity {
if
(
frameLayout
!=
null
)
{
frameLayout
.
setVisibility
(
View
.
INVISIBLE
);
}
fullDay
=
true
;
}
StringBuilder
checks
=
new
StringBuilder
();
public
void
hour1Checked
(
View
view
)
{
checks
.
append
(
"1, "
);
Toast
.
makeText
(
getApplicationContext
(),
checks
,
Toast
.
LENGTH_SHORT
).
show
();
}
public
void
onHoursClick
(
View
view
)
{
android
.
support
.
v4
.
app
.
FragmentManager
manager
=
getSupportFragmentManager
();
android
.
support
.
v4
.
app
.
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
...
...
@@ -87,13 +83,29 @@ public class MainActivity extends AppCompatActivity {
transaction
.
commit
();
}
String
reasonString
,
fromDate
,
toDate
;
public
void
onRequestClick
(
View
view
)
{
reasonString
=
reason
.
getText
().
toString
();
fromDate
=
from
.
getText
().
toString
();
toDate
=
to
.
getText
().
toString
();
if
(
fullDay
==
true
)
{
full
=
"Yes"
;
}
else
{
full
=
"No"
;
}
Intent
intent
=
new
Intent
(
Intent
.
ACTION_SEND
);
intent
.
setData
(
Uri
.
parse
(
"mailto:"
));
String
[]
recepients
=
{
""
};
intent
.
putExtra
(
Intent
.
EXTRA_EMAIL
,
recepients
);
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"
);
Intent
chooser
=
Intent
.
createChooser
(
intent
,
"Send email"
);
startActivity
(
chooser
);
Log
.
e
(
"DATA: "
,
reasonString
+
", "
+
fromDate
+
", "
+
toDate
);
Log
.
e
(
"DATA: "
,
reasonString
+
", "
+
fromDate
+
", "
+
toDate
+
", "
+
full
);
}
public
void
signOut
(
View
view
)
{
...
...
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