Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
parkingo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SHAILESH KUMAR
parkingo
Commits
fd09b9c5
Commit
fd09b9c5
authored
Nov 26, 2019
by
SHAILESH KUMAR
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internet check adn singleton class
parent
d7a1df9e
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
117 additions
and
4 deletions
+117
-4
.idea/caches/build_file_checksums.ser
.idea/caches/build_file_checksums.ser
+0
-0
.idea/caches/gradle_models.ser
.idea/caches/gradle_models.ser
+0
-0
.idea/gradle.xml
.idea/gradle.xml
+3
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-1
app/src/main/java/com/example/infiniteLoop/parkingo/login_activity.java
...ava/com/example/infiniteLoop/parkingo/login_activity.java
+57
-1
app/src/main/java/com/example/infiniteLoop/parkingo/userInfo.java
...main/java/com/example/infiniteLoop/parkingo/userInfo.java
+33
-0
app/src/main/java/com/example/infiniteLoop/parkingo/wallets.java
.../main/java/com/example/infiniteLoop/parkingo/wallets.java
+6
-0
app/src/main/res/layout/activity_wallets.xml
app/src/main/res/layout/activity_wallets.xml
+2
-0
app/src/main/res/layout/login_layout.xml
app/src/main/res/layout/login_layout.xml
+12
-2
app/src/main/res/values/colors.xml
app/src/main/res/values/colors.xml
+1
-0
No files found.
.idea/caches/build_file_checksums.ser
View file @
fd09b9c5
No preview for this file type
.idea/caches/gradle_models.ser
View file @
fd09b9c5
No preview for this file type
.idea/gradle.xml
View file @
fd09b9c5
...
...
@@ -3,6 +3,9 @@
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild
compositeDefinitionSource=
"SCRIPT"
/>
</compositeConfiguration>
<option
name=
"distributionType"
value=
"DEFAULT_WRAPPED"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"modules"
>
...
...
app/src/main/AndroidManifest.xml
View file @
fd09b9c5
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.example.infiniteLoop.parkingo"
>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
>
</uses-permission>
<uses-permission
android:name=
"android.permission.INTERNET"
>
</uses-permission>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
...
...
app/src/main/java/com/example/infiniteLoop/parkingo/login_activity.java
View file @
fd09b9c5
...
...
@@ -3,13 +3,17 @@ package com.example.infiniteLoop.parkingo;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.app.ProgressDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
...
...
@@ -28,6 +32,7 @@ public class login_activity extends Activity {
EditText
username
,
password
;
Button
login_btn
;
ProgressDialog
progress
;
TextView
logmsg
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -35,11 +40,50 @@ public class login_activity extends Activity {
username
=
findViewById
(
R
.
id
.
username
);
password
=
findViewById
(
R
.
id
.
password
);
login_btn
=
findViewById
(
R
.
id
.
login_btn
);
logmsg
=
findViewById
(
R
.
id
.
logmsg
);
//checking if internet is on or not
final
ConnectivityManager
conMgr
=(
ConnectivityManager
)
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
if
(
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_MOBILE
).
getState
()
==
NetworkInfo
.
State
.
CONNECTED
||
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_WIFI
).
getState
()
==
NetworkInfo
.
State
.
CONNECTED
)
{
// notify user you are online
Toast
.
makeText
(
login_activity
.
this
,
"YOU ARE ONLINE"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_MOBILE
).
getState
()
==
NetworkInfo
.
State
.
DISCONNECTED
||
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_WIFI
).
getState
()
==
NetworkInfo
.
State
.
DISCONNECTED
)
{
// notify user you are not online
Toast
.
makeText
(
login_activity
.
this
,
"YOU ARE OFFLINE"
,
Toast
.
LENGTH_SHORT
).
show
();
}
login_btn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
//Toast.makeText(login_activity.this,"button clicked",Toast.LENGTH_SHORT).show();
logmsg
.
setVisibility
(
View
.
INVISIBLE
);
if
(
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_MOBILE
).
getState
()
==
NetworkInfo
.
State
.
CONNECTED
||
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_WIFI
).
getState
()
==
NetworkInfo
.
State
.
CONNECTED
)
{
// notify user you are not online
Toast
.
makeText
(
login_activity
.
this
,
"YOU ARE OFFLINE"
,
Toast
.
LENGTH_SHORT
).
show
();
logmsg
.
setText
(
"You are online"
);
logmsg
.
setVisibility
(
View
.
INVISIBLE
);
}
else
if
(
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_MOBILE
).
getState
()
==
NetworkInfo
.
State
.
DISCONNECTED
||
conMgr
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_WIFI
).
getState
()
==
NetworkInfo
.
State
.
DISCONNECTED
)
{
// notify user you are not online
Toast
.
makeText
(
login_activity
.
this
,
"YOU ARE OFFLINE"
,
Toast
.
LENGTH_SHORT
).
show
();
logmsg
.
setText
(
"You are offline"
);
logmsg
.
setVisibility
(
View
.
VISIBLE
);
return
;
}
String
uname
=
username
.
getText
().
toString
().
trim
();
String
pass
=
password
.
getText
().
toString
().
trim
();
if
(
uname
.
isEmpty
()
||
pass
.
isEmpty
()){
...
...
@@ -47,12 +91,21 @@ public class login_activity extends Activity {
username
.
requestFocus
();
}
else
{
sqlite_ops
so
=
new
sqlite_ops
(
login_activity
.
this
);
//so.insert_login_details();
login
li
=
new
login
();
li
.
setPass
(
uname
);
li
.
setUname
(
pass
);
so
.
fetch_login_details
(
li
,
login_activity
.
this
);
//com.example.infiniteLoop.parkingo.userInfo setting to use across pages
userInfo
uinfo
=
userInfo
.
getInstance
();
uinfo
.
setU_name
(
"Shailesh"
);
uinfo
.
setUsername
(
"shady"
);
//progress window
progress
=
new
ProgressDialog
(
login_activity
.
this
);
progress
.
setTitle
(
"Loading"
);
progress
.
setMessage
(
"Wait while loading..."
);
...
...
@@ -81,6 +134,7 @@ public class login_activity extends Activity {
public
void
loginSuccess
()
{
// To dismiss the dialog
progress
.
dismiss
();
Toast
.
makeText
(
login_activity
.
this
,
"Login_Success"
,
Toast
.
LENGTH_SHORT
).
show
();
startActivity
(
new
Intent
(
login_activity
.
this
,
dashboard
.
class
));
finish
();
...
...
@@ -91,9 +145,11 @@ public class login_activity extends Activity {
progress
.
dismiss
();
Toast
.
makeText
(
login_activity
.
this
,
"failed"
,
Toast
.
LENGTH_SHORT
).
show
();
username
.
setText
(
""
);
username
.
setError
(
"Wrong Credentials"
);
//
username.setError("Wrong Credentials");
password
.
setText
(
""
);
username
.
requestFocus
();
logmsg
.
setText
(
"Wrong Credentials"
);
logmsg
.
setVisibility
(
View
.
VISIBLE
);
}
@Override
...
...
app/src/main/java/com/example/infiniteLoop/parkingo/userInfo.java
0 → 100644
View file @
fd09b9c5
package
com.example.infiniteLoop.parkingo
;
import
android.util.Log
;
public
class
userInfo
{
public
static
userInfo
u_instance
=
null
;
private
String
username
=
null
;
private
String
u_name
=
null
;
public
static
userInfo
getInstance
()
{
if
(
u_instance
==
null
){
u_instance
=
new
userInfo
();
}
Log
.
d
(
"ins"
,
"called"
);
return
u_instance
;
}
public
String
getName
()
{
return
u_name
;
}
public
void
setU_name
(
String
u_name
)
{
this
.
u_name
=
u_name
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
}
app/src/main/java/com/example/infiniteLoop/parkingo/wallets.java
View file @
fd09b9c5
...
...
@@ -2,6 +2,7 @@ package com.example.infiniteLoop.parkingo;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.widget.TextView
;
public
class
wallets
extends
Activity
{
...
...
@@ -9,5 +10,10 @@ public class wallets extends Activity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_wallets
);
//TextView wdraw= findViewById(R.id.wdraw_txt);
//userInfo uinfo=userInfo.getInstance();
//wdraw.setText(uinfo.getName());
}
}
app/src/main/res/layout/activity_wallets.xml
View file @
fd09b9c5
...
...
@@ -152,6 +152,7 @@
app:cardElevation=
"15dp"
>
<TextView
android:id=
"@+id/wdraw_txt"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
...
...
@@ -168,6 +169,7 @@
</TextView>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right|center_vertical"
...
...
app/src/main/res/layout/login_layout.xml
View file @
fd09b9c5
...
...
@@ -56,6 +56,16 @@
android:fontFamily=
"sans-serif-condensed"
/>
<TextView
android:id=
"@+id/logmsg"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"20dp"
android:background=
"@color/red"
android:textColor=
"#fff"
android:textSize=
"20dp"
android:text=
"asfdff"
android:visibility=
"invisible"
></TextView>
</LinearLayout>
</LinearLayout>
app/src/main/res/values/colors.xml
View file @
fd09b9c5
...
...
@@ -4,4 +4,5 @@
<color
name=
"colorPrimaryDark"
>
#303F9F
</color>
<color
name=
"colorAccent"
>
#FF4081
</color>
<color
name=
"black"
>
#000
</color>
<color
name=
"red"
>
#f00
</color>
</resources>
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