Commit 0f417f4d authored by Paded's avatar Paded

add bottom sheet

parent 2bf11c00
......@@ -5,7 +5,7 @@ android {
defaultConfig {
applicationId "ubontransitdriver.paded.com.ubontransitdriver"
minSdkVersion 22
targetSdkVersion 27
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
......@@ -22,6 +22,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
......
......@@ -27,7 +27,8 @@
<activity
android:name=".LoginActivity"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".ResetPasswordActivity"></activity>
<activity android:name=".ResetPasswordActivity" />
<activity android:name=".AddBusActivity"></activity>
</application>
</manifest>
\ No newline at end of file
package ubontransitdriver.paded.com.ubontransitdriver;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class AddBusActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add__bus_layout);
}
}
package ubontransitdriver.paded.com.ubontransitdriver;
public class AddBusDataItem {
String BusName;
String Bus_ID;
public AddBusDataItem(String busName, String bus_ID) {
BusName = busName;
Bus_ID = bus_ID;
}
}
......@@ -3,6 +3,8 @@ package ubontransitdriver.paded.com.ubontransitdriver;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
......@@ -13,6 +15,7 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
......@@ -26,11 +29,15 @@ import com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView;
public class CreateAccountActivity extends AppCompatActivity {
private EditText inputEmail, inputPassword, inputName;
private Button btnCreateAccount, btnLogin, btnResetPassword;
private Button btnCreateAccount, btnLogin, btnResetPassword, btnAddBus;
private ProgressBar progressBar;
private FirebaseAuth auth;
ScrollView mainLayout;
private ScrollView mainLayout;
private String TAG = "TEST22";
BottomSheetDialog bottomSheetDialog;
BottomSheetBehavior bottomSheetBehavior;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -50,6 +57,26 @@ public class CreateAccountActivity extends AppCompatActivity {
btnCreateAccount = (Button)findViewById(R.id.btn_create_account);
btnResetPassword = (Button)findViewById(R.id.btn_reset_password);
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);
bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetView.getParent());
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);
addMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
bottomSheetDialog.hide();
}
});
btnCreateAccount.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -122,7 +149,13 @@ public class CreateAccountActivity extends AppCompatActivity {
public void onClick(View view) {
Intent intent = new Intent(CreateAccountActivity.this, ResetPasswordActivity.class);
startActivity(intent);
finish();
}
});
btnAddBus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
bottomSheetDialog.show();
}
});
......
package ubontransitdriver.paded.com.ubontransitdriver;
import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.widget.ArrayAdapter;
import java.util.ArrayList;
import java.util.List;
public class CustomAdapterAddBus extends ArrayAdapter<AddBusDataItem> {
Context context;
int layoutResourceId;
List<AddBusDataItem> data=null;
public CustomAdapterAddBus(@NonNull Context context, @LayoutRes int resource, @NonNull List<AddBusDataItem> objects) {
super(context, resource, objects);
this.layoutResourceId = resource;
this.context = context;
this.data=objects;
}
}
package ubontransitdriver.paded.com.ubontransitdriver;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import java.util.Objects;
......@@ -47,6 +53,34 @@ public class ResetPasswordActivity extends AppCompatActivity {
}
});
btn_resetPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = input_email.getText().toString().trim();
if (TextUtils.isEmpty(email)) {
Toast.makeText(getApplication(), "Enter your registered email id", Toast.LENGTH_SHORT).show();
return;
}
progressBar.setVisibility(View.VISIBLE);
auth.sendPasswordResetEmail(email)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(ResetPasswordActivity.this, R.string.send_password_reset_success_msg, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ResetPasswordActivity.this, R.string.send_password_reset_failed_msg, Toast.LENGTH_SHORT).show();
}
progressBar.setVisibility(View.GONE);
}
});
}
});
}
......
......@@ -19,7 +19,7 @@
</padding>
<corners
android:radius="360dp" >
android:radius="8dp" >
</corners>
</shape>
\ No newline at end of file
......@@ -16,7 +16,7 @@
</padding>
<corners
android:radius="360dp" >
android:radius="8dp" >
</corners>
</shape>
\ No newline at end of file
<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
......@@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/blue"
android:fillColor="@color/red"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/red"
android:pathData="M4,16c0,0.88 0.39,1.67 1,2.22L5,20c0,0.55 0.45,1 1,1h1c0.55,0 1,-0.45 1,-1v-1h8v1c0,0.55 0.45,1 1,1h1c0.55,0 1,-0.45 1,-1v-1.78c0.61,-0.55 1,-1.34 1,-2.22L20,6c0,-3.5 -3.58,-4 -8,-4s-8,0.5 -8,4v10zM7.5,17c-0.83,0 -1.5,-0.67 -1.5,-1.5S6.67,14 7.5,14s1.5,0.67 1.5,1.5S8.33,17 7.5,17zM16.5,17c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM18,11L6,11L6,6h12v5z"/>
</vector>
<vector android:height="24dp" android:viewportHeight="513.0"
android:viewportWidth="513.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/gray_400" android:pathData="M453.5,78c-3.333,-14 -9,-24.667 -17,-32s-19.667,-14 -35,-20c-15.333,-6.667 -37.333,-12.667 -66,-18S280.666,0 257,0c-23.667,0 -49.833,2.667 -78.5,8s-50.667,11.333 -66,18c-15.333,6 -27,12.667 -35,20s-13.333,18 -16,32l-20,160v223h31v20c0,13.333 4.167,22.667 12.5,28s16.833,5.333 25.5,0s13,-14.667 13,-28v-20h256v20c0,13.333 5.167,22.667 15.5,28s20.5,5.333 30.5,0s15,-14.667 15,-28v-20h31V238L453.5,78zM150.5,38.5c2.667,-5 7.334,-7.5 14,-7.5h205v30h-205c-6.667,0 -11.333,-2.5 -14,-7.5S147.833,43.5 150.5,38.5zM77.5,234l17,-122c1.333,-6.667 7,-10 17,-10h293c10,0 15.667,3.333 17,10l17,124c0.667,2 1,3.333 1,4c0,4.667 -1.667,8.5 -5,11.5s-7.667,4.5 -13,4.5h-327c-5.333,0 -9.667,-1.667 -13,-5s-5,-7.667 -5,-13C76.5,236.667 76.833,235.333 77.5,234zM130.5,383.5c-6.667,6.333 -14.5,9.5 -23.5,9.5s-16.833,-3.167 -23.5,-9.5s-10,-14 -10,-23s3.333,-16.667 10,-23c6.667,-6.333 14.5,-9.5 23.5,-9.5s16.833,3.167 23.5,9.5s10,14 10,23S137.167,377.167 130.5,383.5zM432.5,383.5c-6.667,6.333 -14.5,9.5 -23.5,9.5s-16.833,-3.167 -23.5,-9.5s-10,-14 -10,-23s3.333,-16.667 10,-23S400,328 409,328s16.833,3.167 23.5,9.5s10,14 10,23S439.167,377.167 432.5,383.5z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="#b5b5b5"
android:dividerHeight="0.1dp" />
</LinearLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fragment_history_menu_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="vertical"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<TextView
android:id="@+id/menu_add_bus0"
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_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
......@@ -63,21 +63,24 @@
android:background="@drawable/bg_edittext"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/btn_addBus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/input_password"
android:layout_marginTop="10dp"
android:drawableLeft="@drawable/ic_plus"
android:drawablePadding="10dp"
android:background="@drawable/bg_add_bus"
android:padding="15dp"
android:gravity="left|center_vertical"
style="?android:attr/borderlessButtonStyle"
android:text="@string/add_bus_label"
android:textColor="@color/blue" />
<Button
android:id="@+id/input_busline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/input_password"
android:layout_marginTop="20dp"
android:drawableLeft="@drawable/ic_plus"
android:drawablePadding="10dp"
android:background="@drawable/bg_add_bus"
android:padding="15dp"
android:gravity="left|center_vertical"
style="?android:attr/borderlessButtonStyle"
android:text="@string/add_bus_label"
android:textColor="@color/blue" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
>
<ImageView
android:id="@+id/head_icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="6dp"
android:src="@drawable/ic_bus"
/>
<TextView
android:id="@+id/status_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/head_icon"
android:layout_centerVertical="true"
android:text="รอการตอบรับ"
android:textSize="22dp"
android:layout_marginTop="5dp"
/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<!--<?xml version="1.0" encoding="utf-8"?>-->
<!--<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--xmlns:app="http://schemas.android.com/apk/res-auto"-->
<!--xmlns:tools="http://schemas.android.com/tools"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--tools:context=".MainActivity">-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="MainActivity"-->
<!--app:layout_constraintBottom_toBottomOf="parent"-->
<!--app:layout_constraintLeft_toLeftOf="parent"-->
<!--app:layout_constraintRight_toRightOf="parent"-->
<!--app:layout_constraintTop_toTopOf="parent" />-->
<!--</android.support.constraint.ConstraintLayout>-->
<com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView
xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/ms9_DefaultShadowStyle"
android:id="@+id/shadow_item_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:ms9_shadowTranslationZ="2dp"
app:ms9_shadowElevation="4dp">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- NOTE 1: only 1 child can be accepted -->
<!-- NOTE 2: margins are required to draw shadow properly -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@android:color/white"
android:text="Inner content view" />
android:text="MainActivity"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<!--<com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--xmlns:app="http://schemas.android.com/apk/res-auto"-->
<!--style="@style/ms9_DefaultShadowStyle"-->
<!--android:id="@+id/shadow_item_container"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--app:ms9_shadowTranslationZ="2dp"-->
<!--app:ms9_shadowElevation="4dp">-->
<!--&lt;!&ndash; NOTE 1: only 1 child can be accepted &ndash;&gt;-->
<!--&lt;!&ndash; NOTE 2: margins are required to draw shadow properly &ndash;&gt;-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginLeft="8dp"-->
<!--android:layout_marginTop="8dp"-->
<!--android:layout_marginRight="8dp"-->
<!--android:layout_marginBottom="8dp"-->
<!--android:background="@android:color/white"-->
<!--android:text="Inner content view" />-->
</com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView>
\ No newline at end of file
<!--</com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView>-->
\ No newline at end of file
......@@ -12,23 +12,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn_back"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="25dp"
style="?android:attr/borderlessButtonStyle"
android:background="@drawable/bg_back_btn"
android:drawableLeft="@drawable/ic_arrow_back_24dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
android:gravity="center"
android:padding="25dp">
<TextView
......@@ -73,6 +62,17 @@
android:text="@string/btn_resetPassword"
android:textColor="#ffffffff" />
<Button
android:id="@+id/btn_back"
android:drawableLeft="@drawable/ic_arrow_back_24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Back"
android:textColor="@color/red"
style="?android:attr/borderlessButtonStyle"
/>
<!-- Link to Login Screen -->
......
......@@ -15,6 +15,13 @@
<color name="black">#000000</color>
<color name="gray">#ececec</color>
<color name="off_gray">#e1e1e1</color>
<color name="gray_100">#F5F5F5</color>
<color name="gray_500">#9E9E9E</color>
<color name="gray_400">#BDBDBD</color>
......
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
\ No newline at end of file
......@@ -18,11 +18,25 @@
<string name="forgot_password_msg">We just need your registered Email Id to sent you password reset instructions.</string>
<!--Toast-->
<string name="minimum_password">Password too short, enter minimum 6 characters!</string>
<string name="auth_failed">Authentication failed, check your email and password or sign up</string>
<string name="send_password_reset_email">Send Password reset email</string>
<string name="send_password_reset_success_msg">We have sent you instructions to reset your password!</string>
<string name="send_password_reset_failed_msg">Failed to send reset email!</string>
<!--Bus stop-->
<string name="Bus_no0">ม.</string>
<string name="Bus_no1">1</string>
<string name="Bus_no2">สาย 2</string>
<string name="Bus_no3">สาย 3</string>
<string name="Bus_no4">สาย 7</string>
<string name="Bus_no5">สาย 8</string>
<string name="Bus_no6">สาย 9</string>
<string name="Bus_no7">สาย 10</string>
<string name="Bus_no8">สาย 11</string>
<string name="Bus_no9">สาย 12</string>
</resources>
......@@ -8,6 +8,14 @@
<item name="android:windowLightStatusBar">true</item>
</style>
<!-- Base application theme. -->
<style name="AppThemeActionbar" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/off_white</item>
<item name="colorPrimaryDark">@color/off_white</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/bg_splash</item>
</style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment