Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
5
5711403296
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
Paded
5711403296
Commits
8f50c75e
Commit
8f50c75e
authored
Jan 19, 2018
by
Paded
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read bus data from firebase
parent
0f417f4d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
265 additions
and
46 deletions
+265
-46
build_file_checksums.ser
.idea/caches/build_file_checksums.ser
+0
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-1
CreateAccountActivity.java
...er/paded/com/ubontransitdriver/CreateAccountActivity.java
+127
-21
ItemAdapter.java
...ransitdriver/paded/com/ubontransitdriver/ItemAdapter.java
+64
-0
bg_add_bus_menu.xml
app/src/main/res/drawable/bg_add_bus_menu.xml
+9
-0
bg_add_bus_menu_clicked.xml
app/src/main/res/drawable/bg_add_bus_menu_clicked.xml
+23
-0
bg_add_bus_menu_normal.xml
app/src/main/res/drawable/bg_add_bus_menu_normal.xml
+23
-0
bg_add_bus_normal.xml
app/src/main/res/drawable/bg_add_bus_normal.xml
+0
-2
shape_window_dim.xml
app/src/main/res/drawable/shape_window_dim.xml
+7
-0
bottom_sheet_layout.xml
app/src/main/res/layout/bottom_sheet_layout.xml
+4
-22
create_account_layout.xml
app/src/main/res/layout/create_account_layout.xml
+0
-0
login_layout.xml
app/src/main/res/layout/login_layout.xml
+2
-0
reset_password_layout.xml
app/src/main/res/layout/reset_password_layout.xml
+2
-0
colors.xml
app/src/main/res/values/colors.xml
+1
-0
No files found.
.idea/caches/build_file_checksums.ser
View file @
8f50c75e
No preview for this file type
app/src/main/AndroidManifest.xml
View file @
8f50c75e
...
...
@@ -14,7 +14,9 @@
<activity
android:name=
".MainActivity"
android:windowSoftInputMode=
"adjustResize"
/>
<activity
android:name=
".CreateAccountActivity"
/>
<activity
android:name=
".CreateAccountActivity"
android:windowSoftInputMode=
"adjustResize"
/>
<activity
android:name=
".SplashActivity"
android:theme=
"@style/SplashTheme"
>
...
...
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/CreateAccountActivity.java
View file @
8f50c75e
...
...
@@ -5,14 +5,19 @@ import android.content.Intent;
import
android.support.annotation.NonNull
;
import
android.support.design.widget.BottomSheetBehavior
;
import
android.support.design.widget.BottomSheetDialog
;
import
android.support.design.widget.CoordinatorLayout
;
import
android.support.design.widget.Snackbar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.FrameLayout
;
import
android.widget.ProgressBar
;
import
android.widget.ScrollView
;
import
android.widget.TextView
;
...
...
@@ -23,21 +28,30 @@ import com.google.android.gms.tasks.Task;
import
com.google.firebase.auth.AuthResult
;
import
com.google.firebase.auth.FirebaseAuth
;
import
com.google.firebase.auth.FirebaseUser
;
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
com.google.firebase.database.ValueEventListener
;
import
com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView
;
public
class
CreateAccountActivity
extends
AppCompatActivity
{
import
java.util.ArrayList
;
public
class
CreateAccountActivity
extends
AppCompatActivity
implements
ItemAdapter
.
ItemListener
{
private
EditText
inputEmail
,
inputPassword
,
inputName
;
private
Button
btnCreateAccount
,
btnLogin
,
btnResetPassword
,
btnAddBus
;
private
ProgressBar
progressBar
;
private
FirebaseAuth
auth
;
private
ScrollView
mainLayout
;
private
String
TAG
=
"TEST22"
;
private
FrameLayout
layout_MainMenu
;
BottomSheetDialog
bottomSheetDialog
;
BottomSheetBehavior
bottomSheetBehavior
;
RecyclerView
recyclerView
;
private
ItemAdapter
mAdapter
;
CoordinatorLayout
coordinatorLayout
;
BottomSheetBehavior
behavior
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -46,7 +60,7 @@ public class CreateAccountActivity extends AppCompatActivity {
//Get Firebase auth instance
auth
=
FirebaseAuth
.
getInstance
();
mainLayout
=
(
ScrollView
)
findViewById
(
R
.
id
.
mainlayout
);
//
mainLayout = (ScrollView) findViewById(R.id.mainlayout);
inputEmail
=
(
EditText
)
findViewById
(
R
.
id
.
input_email
);
inputPassword
=
(
EditText
)
findViewById
(
R
.
id
.
input_password
);
...
...
@@ -59,31 +73,34 @@ public class CreateAccountActivity extends AppCompatActivity {
btnLogin
=
(
Button
)
findViewById
(
R
.
id
.
btnLogin
);
btnAddBus
=
(
Button
)
findViewById
(
R
.
id
.
btn_addBus
);
View
bottomSheetView
=
getLayoutInflater
().
inflate
(
R
.
layout
.
bottom_sheet_layout
,
null
);
bottomSheetDialog
=
new
BottomSheetDialog
(
CreateAccountActivity
.
this
);
bottomSheetDialog
.
setContentView
(
bottomSheetView
);
layout_MainMenu
=
(
FrameLayout
)
findViewById
(
R
.
id
.
framelayout
);
layout_MainMenu
.
getForeground
().
setAlpha
(
0
);
bottomSheetBehavior
=
BottomSheetBehavior
.
from
((
View
)
bottomSheetView
.
getParent
());
// View bottomSheetView = getLayoutInflater().inflate(R.layout.bottom_sheet_layout, null);
// bottomSheetDialog = new BottomSheetDialog(CreateAccountActivity.this);
// bottomSheetDialog.setContentView(bottomSheetView);
//
// bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetView.getParent());
//
// bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
bottomSheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
// TextView addMenu = (TextView) bottomSheetView.findViewById(R.id.menu_add_bus0);
// TextView editMenu = (TextView) bottomSheetView.findViewById(R.id.menu_add_bus1);
// TextView deleteMenu = (TextView) bottomSheetView.findViewById(R.id.menu_add_bus2);
TextView
addMenu
=
(
TextView
)
bottomSheetView
.
findViewById
(
R
.
id
.
menu_add_bus0
);
TextView
editMenu
=
(
TextView
)
bottomSheetView
.
findViewById
(
R
.
id
.
menu_add_bus1
);
TextView
deleteMenu
=
(
TextView
)
bottomSheetView
.
findViewById
(
R
.
id
.
menu_add_bus2
);
addMenu
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
bottomSheetDialog
.
hide
();
}
});
// addMenu.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// bottomSheetDialog.hide();
// }
// });
btnCreateAccount
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
InputMethodManager
imm
=
(
InputMethodManager
)
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
hideSoftInputFromWindow
(
main
Layout
.
getWindowToken
(),
0
);
imm
.
hideSoftInputFromWindow
(
coordinator
Layout
.
getWindowToken
(),
0
);
String
email
=
inputEmail
.
getText
().
toString
().
trim
();
String
password
=
inputPassword
.
getText
().
toString
().
trim
();
...
...
@@ -152,10 +169,76 @@ public class CreateAccountActivity extends AppCompatActivity {
}
});
coordinatorLayout
=
(
CoordinatorLayout
)
findViewById
(
R
.
id
.
coordinatorLayout
);
View
bottomSheet
=
findViewById
(
R
.
id
.
bottom_sheet
);
behavior
=
BottomSheetBehavior
.
from
(
bottomSheet
);
behavior
.
setBottomSheetCallback
(
new
BottomSheetBehavior
.
BottomSheetCallback
()
{
@Override
public
void
onStateChanged
(
@NonNull
View
bottomSheet
,
int
newState
)
{
Log
.
d
(
TAG
,
"onStateChanged: "
+
newState
);
}
@Override
public
void
onSlide
(
@NonNull
View
bottomSheet
,
float
slideOffset
)
{
if
(
slideOffset
==
0.0
){
layout_MainMenu
.
getForeground
().
setAlpha
(
0
);
}
Log
.
d
(
TAG
,
"slideOffset: "
+
slideOffset
);
// React to dragging events
}
});
recyclerView
=
(
RecyclerView
)
findViewById
(
R
.
id
.
recyclerView
);
recyclerView
.
setHasFixedSize
(
true
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
// Get a reference to our posts
final
FirebaseDatabase
database
=
FirebaseDatabase
.
getInstance
();
DatabaseReference
ref
=
database
.
getReference
(
"server/saving-data/fireblog/posts"
);
// Attach a listener to read the data at our posts reference
ref
.
addValueEventListener
(
new
ValueEventListener
()
{
@Override
public
void
onDataChange
(
DataSnapshot
dataSnapshot
)
{
Post
post
=
dataSnapshot
.
getValue
(
Post
.
class
);
System
.
out
.
println
(
post
);
}
@Override
public
void
onCancelled
(
DatabaseError
databaseError
)
{
System
.
out
.
println
(
"The read failed: "
+
databaseError
.
getCode
());
}
});
ArrayList
<
String
>
items
=
new
ArrayList
<>();
items
.
add
(
"Item 16"
);
items
.
add
(
"Item 2"
);
items
.
add
(
"Item 3"
);
items
.
add
(
"Item 4"
);
items
.
add
(
"Item 5"
);
items
.
add
(
"Item 6"
);
mAdapter
=
new
ItemAdapter
(
items
,
this
);
recyclerView
.
setAdapter
(
mAdapter
);
btnAddBus
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
bottomSheetDialog
.
show
();
InputMethodManager
imm
=
(
InputMethodManager
)
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
hideSoftInputFromWindow
(
coordinatorLayout
.
getWindowToken
(),
0
);
layout_MainMenu
.
getForeground
().
setAlpha
(
100
);
behavior
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
}
});
...
...
@@ -174,4 +257,27 @@ public class CreateAccountActivity extends AppCompatActivity {
super
.
onResume
();
progressBar
.
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onBackPressed
()
{
if
(
behavior
.
getState
()
==
BottomSheetBehavior
.
STATE_EXPANDED
)
{
behavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
layout_MainMenu
.
getForeground
().
setAlpha
(
0
);
Log
.
d
(
TAG
,
"onBackPressed:1 "
+
behavior
.
getState
());
}
else
{
super
.
onBackPressed
();
}
}
// for button sheet click
@Override
public
void
onItemClick
(
String
item
)
{
Snackbar
.
make
(
coordinatorLayout
,
item
+
" is selected"
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Action"
,
null
).
show
();
behavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
}
}
app/src/main/java/ubontransitdriver/paded/com/ubontransitdriver/ItemAdapter.java
0 → 100644
View file @
8f50c75e
package
ubontransitdriver
.
paded
.
com
.
ubontransitdriver
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
java.util.List
;
class
ItemAdapter
extends
RecyclerView
.
Adapter
<
ItemAdapter
.
ViewHolder
>
{
private
List
<
String
>
mItems
;
private
ItemListener
mListener
;
ItemAdapter
(
List
<
String
>
items
,
ItemListener
listener
)
{
mItems
=
items
;
mListener
=
listener
;
}
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
return
new
ViewHolder
(
LayoutInflater
.
from
(
parent
.
getContext
())
.
inflate
(
R
.
layout
.
bottom_sheet_layout
,
parent
,
false
));
}
@Override
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
holder
.
setData
(
mItems
.
get
(
position
));
}
@Override
public
int
getItemCount
()
{
return
mItems
.
size
();
}
class
ViewHolder
extends
RecyclerView
.
ViewHolder
implements
View
.
OnClickListener
{
TextView
textView
;
String
item
;
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
itemView
.
setOnClickListener
(
this
);
textView
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
bus_text
);
}
void
setData
(
String
item
)
{
this
.
item
=
item
;
textView
.
setText
(
item
);
}
@Override
public
void
onClick
(
View
v
)
{
if
(
mListener
!=
null
)
{
mListener
.
onItemClick
(
item
);
}
}
}
interface
ItemListener
{
void
onItemClick
(
String
item
);
}
}
app/src/main/res/drawable/bg_add_bus_menu.xml
0 → 100644
View file @
8f50c75e
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_focused=
"true"
android:state_pressed=
"true"
android:drawable=
"@drawable/bg_add_bus_menu_clicked"
/>
<item
android:state_focused=
"false"
android:state_pressed=
"true"
android:drawable=
"@drawable/bg_add_bus_menu_clicked"
/>
<item
android:drawable=
"@drawable/bg_add_bus_menu_normal"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/bg_add_bus_menu_clicked.xml
0 → 100644
View file @
8f50c75e
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/gray_100"
>
</solid>
<padding
android:left=
"5dp"
android:top=
"5dp"
android:right=
"5dp"
android:bottom=
"5dp"
>
</padding>
<!--<corners-->
<!--android:radius="8dp" >-->
<!--</corners>-->
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_add_bus_menu_normal.xml
0 → 100644
View file @
8f50c75e
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/white"
>
</solid>
<padding
android:left=
"5dp"
android:top=
"5dp"
android:right=
"5dp"
android:bottom=
"5dp"
>
</padding>
<!--<corners-->
<!--android:radius="8dp" >-->
<!--</corners>-->
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_add_bus_normal.xml
View file @
8f50c75e
...
...
@@ -6,8 +6,6 @@
android:color=
"@color/gray"
>
</solid>
<padding
android:left=
"5dp"
android:top=
"5dp"
...
...
app/src/main/res/drawable/shape_window_dim.xml
0 → 100644
View file @
8f50c75e
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#000000"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/bottom_sheet_layout.xml
View file @
8f50c75e
...
...
@@ -7,37 +7,20 @@
android:orientation=
"vertical"
app:layout_behavior=
"android.support.design.widget.BottomSheetBehavior"
>
<TextView
android:id=
"@+id/
menu_add_bus0
"
android:id=
"@+id/
bus_text
"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
android:drawablePadding=
"@dimen/activity_horizontal_margin"
android:textColor=
"@color/half_black"
android:background=
"@drawable/bg_add_bus_menu"
android:drawableStart=
"@drawable/ic_frontal_bus_silhouette"
android:gravity=
"center_vertical"
android:padding=
"@dimen/activity_horizontal_margin"
android:text=
"@string/Bus_no0"
/>
<TextView
android:id=
"@+id/menu_add_bus1"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
android:drawablePadding=
"@dimen/activity_horizontal_margin"
android:drawableStart=
"@drawable/ic_frontal_bus_silhouette"
android:gravity=
"center_vertical"
android:padding=
"@dimen/activity_horizontal_margin"
android:text=
"@string/Bus_no1"
/>
<TextView
android:id=
"@+id/menu_add_bus2"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
android:drawablePadding=
"@dimen/activity_horizontal_margin"
android:drawableStart=
"@drawable/ic_frontal_bus_silhouette"
android:gravity=
"center_vertical"
android:padding=
"@dimen/activity_horizontal_margin"
android:text=
"@string/Bus_no2"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/create_account_layout.xml
View file @
8f50c75e
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/login_layout.xml
View file @
8f50c75e
...
...
@@ -10,6 +10,8 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:layout_gravity=
"center"
android:orientation=
"vertical"
android:padding=
"25dp"
>
...
...
app/src/main/res/layout/reset_password_layout.xml
View file @
8f50c75e
...
...
@@ -18,6 +18,8 @@
android:layout_centerInParent=
"true"
android:orientation=
"vertical"
android:gravity=
"center"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:padding=
"25dp"
>
<TextView
...
...
app/src/main/res/values/colors.xml
View file @
8f50c75e
...
...
@@ -13,6 +13,7 @@
<color
name=
"off_green"
>
#47c75d
</color>
<color
name=
"red"
>
#ff2d55
</color>
<color
name=
"black"
>
#000000
</color>
<color
name=
"half_black"
>
#303030
</color>
<color
name=
"gray"
>
#ececec
</color>
<color
name=
"off_gray"
>
#e1e1e1
</color>
<color
name=
"gray_100"
>
#F5F5F5
</color>
...
...
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