Initial commit
11
.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches/build_file_checksums.ser
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
14
.idea/assetWizardSettings.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WizardSettings">
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="imageWizard">
|
||||
<value>
|
||||
<PersistentState />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
29
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
||||
18
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
38
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="7">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="6">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
38
app/build.gradle
Normal file
@@ -0,0 +1,38 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
applicationId "h_mal.appttude.com.driver"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation 'com.android.support:cardview-v7:26.1.0'
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
implementation 'com.google.firebase:firebase-core:16.0.1'
|
||||
implementation 'com.google.firebase:firebase-auth:16.0.1'
|
||||
implementation 'com.google.firebase:firebase-storage:16.0.1'
|
||||
implementation 'com.google.firebase:firebase-database:16.0.1'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
42
app/google-services.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "311398117829",
|
||||
"firebase_url": "https://driver-8f4a1.firebaseio.com",
|
||||
"project_id": "driver-8f4a1",
|
||||
"storage_bucket": "driver-8f4a1.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:311398117829:android:cd8a17ae21224023",
|
||||
"android_client_info": {
|
||||
"package_name": "h_mal.appttude.com.driver"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "311398117829-ma5nflm7hviakaq16o2r0pubce6ar4rn.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDGShfTzdvwsoYOqtb5pwcnxPxec9u9f8Y"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("h_mal.appttude.com.driver", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
53
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="h_mal.appttude.com.driver">
|
||||
|
||||
<!-- To auto-complete the email text field in the login form with the user's emails -->
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Design.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
||||
</activity>
|
||||
<activity android:name=".RegisterActivity">
|
||||
|
||||
</activity>
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="h_mal.appttude.com.driver"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths"></meta-data>
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
121
app/src/main/java/h_mal/appttude/com/driver/DateDialog.java
Normal file
@@ -0,0 +1,121 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateDialog extends DatePickerDialog {
|
||||
|
||||
int mYear;
|
||||
int mMonth;
|
||||
int mDay;
|
||||
|
||||
EditText editText;
|
||||
|
||||
public DateDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public DateDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
public DateDialog(@NonNull Context context,
|
||||
@Nullable DatePickerDialog.OnDateSetListener listener,
|
||||
int year, int month, int dayOfMonth) {
|
||||
super(context, listener, year, month, dayOfMonth);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public DateDialog(@NonNull Context context, int themeResId, @Nullable DatePickerDialog.OnDateSetListener listener, int year, int monthOfYear, int dayOfMonth) {
|
||||
super(context, themeResId, listener, year, monthOfYear, dayOfMonth);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(CharSequence title) {
|
||||
super.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDateSetListener(@Nullable DatePickerDialog.OnDateSetListener listener) {
|
||||
super.setOnDateSetListener(dateSetListener);
|
||||
}
|
||||
|
||||
public void init(EditText editText){
|
||||
this.editText = editText;
|
||||
|
||||
String dateString = editText.getText().toString();
|
||||
|
||||
Date javaDate = null;
|
||||
|
||||
if(TextUtils.isEmpty(dateString)){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
mYear = calendar.get(Calendar.YEAR);
|
||||
mMonth = calendar.get(Calendar.MONTH);
|
||||
mDay = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}else {
|
||||
try {
|
||||
SimpleDateFormat sdfrmt = new SimpleDateFormat("dd-MM-yyyy");
|
||||
sdfrmt.setLenient(false);
|
||||
javaDate = sdfrmt.parse(dateString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if (javaDate != null) {
|
||||
mYear = Integer.parseInt(dateString.substring(6, 9));
|
||||
mMonth = Integer.parseInt(dateString.substring(4, 5));
|
||||
mDay = Integer.parseInt(dateString.substring(1, 2));
|
||||
}else {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
mYear = calendar.get(Calendar.YEAR);
|
||||
mMonth = calendar.get(Calendar.MONTH);
|
||||
mDay = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Log.i(this.getClass().getSimpleName(), "init: year =" + mYear +
|
||||
"month = " + mMonth +
|
||||
"day = " + mDay);
|
||||
|
||||
|
||||
updateDate(mYear,mMonth,mDay);
|
||||
|
||||
setOnDateSetListener(null);
|
||||
|
||||
this.setTitle(getContext().getString(R.string.set_date));
|
||||
this.show();
|
||||
}
|
||||
|
||||
DatePickerDialog.OnDateSetListener dateSetListener = new OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
|
||||
mYear = year;
|
||||
mMonth = month + 1;
|
||||
mDay = dayOfMonth;
|
||||
|
||||
editText.setText(String.format("%02d", mDay) + "-" +
|
||||
String.format("%02d", (mMonth)) +"-" +
|
||||
mYear
|
||||
);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import h_mal.appttude.com.driver.Objects.DriversLicenseObject;
|
||||
import h_mal.appttude.com.driver.Objects.PrivateHireObject;
|
||||
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.DRIVERS_LICENSE_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.DRIVER_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.PRIVATE_HIRE_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.USER_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.CAMERA_REQUEST;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.MY_CAMERA_PERMISSION_CODE;
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
import static h_mal.appttude.com.driver.MainActivity.getDateStamp;
|
||||
import static h_mal.appttude.com.driver.MainActivity.mDatabase;
|
||||
|
||||
public class DriverLicenseFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
|
||||
private ImageView imageView;
|
||||
|
||||
EditText licenseNo;
|
||||
EditText expiry;
|
||||
|
||||
public Uri filePath;
|
||||
public Uri picUri;
|
||||
|
||||
String li_numberString;
|
||||
String li_exprString;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_driver_license, container, false);
|
||||
|
||||
imageView = view.findViewById(R.id.driversli_img);
|
||||
|
||||
DatabaseReference reference = mDatabase.child(USER_FIREBASE).child(auth.getCurrentUser().getUid())
|
||||
.child(DRIVER_FIREBASE).child(DRIVERS_LICENSE_FIREBASE);
|
||||
|
||||
reference.addListenerForSingleValueEvent(valueEventListener);
|
||||
|
||||
TextView uploadLic = view.findViewById(R.id.upload_lic);
|
||||
|
||||
licenseNo = view.findViewById(R.id.lic_no);
|
||||
expiry = view.findViewById(R.id.lic_expiry);
|
||||
|
||||
expiry.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DateDialog dateDialog = new DateDialog(getContext());
|
||||
dateDialog.init(expiry);
|
||||
}
|
||||
});
|
||||
|
||||
Button submit = view.findViewById(R.id.submit);
|
||||
submit.setOnClickListener(submitOnClickListener);
|
||||
|
||||
uploadLic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageSelectorDialog imageSelectorDialog = new ImageSelectorDialog(getContext());
|
||||
imageSelectorDialog.setImageName("drivers_license");
|
||||
imageSelectorDialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
View.OnClickListener submitOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
li_numberString = licenseNo.getText().toString().trim();
|
||||
li_exprString = expiry.getText().toString().trim();
|
||||
|
||||
if (!TextUtils.isEmpty(li_numberString) &&
|
||||
!TextUtils.isEmpty(li_exprString)){
|
||||
if (filePath != null){
|
||||
Log.i(TAG, "onClick: new Image uploaded");
|
||||
new FirebaseClass(getContext(),filePath,new FirebaseClass.Response(){
|
||||
@Override
|
||||
public void processFinish(Uri output) {
|
||||
Log.i(TAG, "processFinish: ");
|
||||
if (output != null){
|
||||
picUri = output;
|
||||
publishObject();
|
||||
fragmentManager.popBackStack();
|
||||
}
|
||||
|
||||
}
|
||||
}).uploadImage(DRIVERS_LICENSE_FIREBASE,DRIVERS_LICENSE_FIREBASE + getDateStamp());
|
||||
}else{
|
||||
Log.i(TAG, "onClick: pushing with same image");
|
||||
publishObject();
|
||||
}
|
||||
|
||||
}else {
|
||||
if (TextUtils.isEmpty(li_numberString)){
|
||||
licenseNo.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(li_exprString)){
|
||||
expiry.setError("Field required");
|
||||
}
|
||||
if (picUri == null){
|
||||
Toast.makeText(getContext(), getString(R.string.image_required), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ValueEventListener valueEventListener = new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
|
||||
DriversLicenseObject driversLicenseObject = null;
|
||||
try{
|
||||
driversLicenseObject = dataSnapshot.getValue(DriversLicenseObject.class);
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "onDataChange: ", e);
|
||||
}finally {
|
||||
if (driversLicenseObject != null){
|
||||
picUri = Uri.parse(driversLicenseObject.getLicenseImageString());
|
||||
li_numberString = driversLicenseObject.getLicenseNumber();
|
||||
li_exprString = driversLicenseObject.getLicenseExpiry();
|
||||
|
||||
licenseNo.setText(li_numberString);
|
||||
expiry.setText(li_exprString);
|
||||
Picasso.get()
|
||||
.load(picUri)
|
||||
.placeholder(R.mipmap.ic_launcher_round)
|
||||
.into(imageView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private void publishObject(){
|
||||
|
||||
DriversLicenseObject driversLicenseObject = new DriversLicenseObject(picUri.toString(),li_numberString,li_exprString);
|
||||
|
||||
mDatabase.child(USER_FIREBASE).child(auth.getCurrentUser().getUid()).child(DRIVER_FIREBASE).child(DRIVERS_LICENSE_FIREBASE)
|
||||
.setValue(driversLicenseObject).addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
|
||||
Log.i(TAG, "onComplete: publish = " + task.isSuccessful());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == MY_CAMERA_PERMISSION_CODE) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(getContext(), "camera permission granted", Toast.LENGTH_LONG).show();
|
||||
Intent cameraIntent = new
|
||||
Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
startActivityForResult(cameraIntent, CAMERA_REQUEST);
|
||||
} else {
|
||||
Toast.makeText(getContext(), "camera permission denied", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
new ImageSelectorResults(new ImageSelectorResults.FilepathResponse() {
|
||||
@Override
|
||||
public void processFinish(Uri output) {
|
||||
filePath = output;
|
||||
}
|
||||
}).Results(getActivity(),requestCode, resultCode, data,
|
||||
filePath,imageView);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class FindAddressFragment extends Fragment {
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_find_address, container, false);
|
||||
|
||||
TextView findAddress = view.findViewById(R.id.findaddress);
|
||||
Button sumbit = view.findViewById(R.id.submit);
|
||||
|
||||
LinearLayout linearLayout = view.findViewById(R.id.lin_lay);
|
||||
|
||||
EditText address = view.findViewById(R.id.address);
|
||||
EditText postcode = view.findViewById(R.id.postcode);
|
||||
|
||||
findAddress.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageSelectorDialog dialogAddress = new ImageSelectorDialog(getContext());
|
||||
dialogAddress.show();
|
||||
}
|
||||
});
|
||||
|
||||
sumbit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
100
app/src/main/java/h_mal/appttude/com/driver/FirebaseClass.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.Continuation;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.storage.OnProgressListener;
|
||||
import com.google.firebase.storage.StorageReference;
|
||||
import com.google.firebase.storage.UploadTask;
|
||||
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
import static h_mal.appttude.com.driver.MainActivity.storageReference;
|
||||
|
||||
public class FirebaseClass {
|
||||
|
||||
public static final String USER_FIREBASE = "user";
|
||||
public static final String DRIVER_FIREBASE = "driver_profile";
|
||||
public static final String DRIVER_DETAILS_FIREBASE = "driver_details";
|
||||
public static final String PRIVATE_HIRE_FIREBASE = "private_hire";
|
||||
public static final String DRIVERS_LICENSE_FIREBASE = "driver_license";
|
||||
|
||||
public static final String VEHICLE_FIREBASE = "vehicle_profile";
|
||||
public static final String MOT_FIREBASE = "mot_details";
|
||||
public static final String VEHICLE_DETAILS_FIREBASE = "vehicle_details";
|
||||
public static final String INSURANCE_FIREBASE = "insurance_details";
|
||||
public static final String LOG_BOOK_FIREBASE = "log_book";
|
||||
|
||||
Context context;
|
||||
Uri filePath;
|
||||
|
||||
public interface Response {
|
||||
void processFinish(Uri output);
|
||||
}
|
||||
|
||||
public Response delegate;
|
||||
|
||||
public FirebaseClass(Context context, Uri filePath, Response delegate) {
|
||||
this.context = context;
|
||||
this.filePath = filePath;
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
public void uploadImage(String path, String name) {
|
||||
|
||||
if(filePath != null)
|
||||
{
|
||||
final ProgressDialog progressDialog = new ProgressDialog(context);
|
||||
progressDialog.setTitle("Uploading...");
|
||||
progressDialog.show();
|
||||
|
||||
final StorageReference ref = storageReference.child("images/"+ auth.getCurrentUser().getUid() + "/" + path
|
||||
+ "/" + name);
|
||||
|
||||
UploadTask uploadTask = ref.putFile(filePath);
|
||||
|
||||
uploadTask.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
|
||||
@Override
|
||||
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
double progress = (100.0*taskSnapshot.getBytesTransferred()/taskSnapshot
|
||||
.getTotalByteCount());
|
||||
progressDialog.setMessage("Uploaded "+(int)progress+"%");
|
||||
}
|
||||
}).continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
|
||||
@Override
|
||||
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
|
||||
if (!task.isSuccessful()) {
|
||||
throw task.getException();
|
||||
}
|
||||
|
||||
// Continue with the task to get the download URL
|
||||
return ref.getDownloadUrl();
|
||||
}
|
||||
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Uri> task) {
|
||||
if (task.isSuccessful()) {
|
||||
delegate.processFinish(task.getResult());
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(context, "Uploaded Successfully", Toast.LENGTH_SHORT).show();
|
||||
Log.i(context.getClass().getSimpleName(), "onComplete: uploaded Successful uri: " + task.getResult());
|
||||
} else {
|
||||
delegate.processFinish(null);
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(context, "Failed to upload", Toast.LENGTH_SHORT).show();
|
||||
Log.i(context.getClass().getSimpleName(), "onComplete: failed to get url");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.firebase.storage.FirebaseStorage;
|
||||
import com.google.firebase.storage.StorageReference;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static android.support.v4.app.ActivityCompat.requestPermissions;
|
||||
import static android.support.v4.app.ActivityCompat.startActivityForResult;
|
||||
import static android.support.v4.content.PermissionChecker.checkSelfPermission;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
import static h_mal.appttude.com.driver.MainActivity.verifyStoragePermissions;
|
||||
|
||||
public class ImageSelectorDialog extends Dialog{
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
public static final int PICK_IMAGE_REQUEST = 71;
|
||||
public static final int CAMERA_REQUEST = 1888;
|
||||
public static final int MY_CAMERA_PERMISSION_CODE = 100;
|
||||
|
||||
private String saveFileName;
|
||||
public static Uri photoURI;
|
||||
|
||||
Fragment fragment;
|
||||
|
||||
public ImageSelectorDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
|
||||
this.saveFileName = "default_name";
|
||||
}
|
||||
|
||||
public ImageSelectorDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
this.saveFileName = "default_name";
|
||||
}
|
||||
|
||||
protected ImageSelectorDialog(@NonNull Context context, boolean cancelable, @Nullable DialogInterface.OnCancelListener cancelListener) {
|
||||
super(context, cancelable, cancelListener);
|
||||
this.saveFileName = "default_name";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.address_dialog);
|
||||
|
||||
//check if we have we have storage rights
|
||||
int permission = ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
|
||||
if (permission != PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(getContext(), "Storage permissions not granted", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
|
||||
fragment = fragmentManager.getFragments().get(0);
|
||||
|
||||
Button upload = findViewById(R.id.upload);
|
||||
Button takePic = findViewById(R.id.take_pic);
|
||||
|
||||
upload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
chooseImage();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
takePic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (
|
||||
checkSelfPermission(fragment.getActivity(), Manifest.permission.CAMERA)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(fragment.getActivity(), new String[]{Manifest.permission.CAMERA},
|
||||
MY_CAMERA_PERMISSION_CODE);
|
||||
} else {
|
||||
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
File file = createFile();
|
||||
photoURI = Uri.fromFile(file);
|
||||
Uri imageUri = FileProvider.getUriForFile(
|
||||
getContext(),
|
||||
"h_mal.appttude.com.driver",
|
||||
file);
|
||||
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
|
||||
fragment.startActivityForResult(cameraIntent, CAMERA_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setImageName(String saveFileName){
|
||||
this.saveFileName = saveFileName;
|
||||
}
|
||||
|
||||
private File createFile(){
|
||||
//create directory
|
||||
File root = getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
//create file
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm");
|
||||
String currentDateandTime = sdf.format(new Date());
|
||||
String fname = saveFileName+ currentDateandTime;
|
||||
File image = new File(root,fname);
|
||||
|
||||
return image;
|
||||
|
||||
}
|
||||
|
||||
private void chooseImage() {
|
||||
Intent intent = new Intent();
|
||||
intent.setType("image/*");
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
|
||||
fragment.startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Picture;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import h_mal.appttude.com.driver.Objects.PrivateHireObject;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.os.Environment.DIRECTORY_PICTURES;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.CAMERA_REQUEST;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.PICK_IMAGE_REQUEST;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.photoURI;
|
||||
import static h_mal.appttude.com.driver.MainActivity.getDateStamp;
|
||||
|
||||
public class ImageSelectorResults {
|
||||
|
||||
Activity activity;
|
||||
|
||||
public interface FilepathResponse {
|
||||
void processFinish(Uri output);
|
||||
}
|
||||
|
||||
public FilepathResponse delegate;
|
||||
|
||||
public ImageSelectorResults(FilepathResponse delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
public void Results(Activity activity, int requestCode, int resultCode, Intent data, Uri filePath,
|
||||
ImageView imageView){
|
||||
|
||||
this.activity = activity;
|
||||
|
||||
if(requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
|
||||
&& data != null && data.getData() != null )
|
||||
{
|
||||
filePath = data.getData();
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
bitmap = MediaStore.Images.Media.getBitmap(activity.getContentResolver(), filePath);
|
||||
if (imageView.getVisibility() != View.VISIBLE) {
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (bitmap != null){
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
//check if we have we have storage rights
|
||||
int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
|
||||
if (permission != PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(activity, "Storage permissions not granted", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}else {
|
||||
|
||||
try {
|
||||
File f = Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES);
|
||||
String fname = "driver"+ getDateStamp() + ".jpg";
|
||||
File image = new File(f,fname);
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(image);
|
||||
|
||||
filePath = photoURI;
|
||||
|
||||
Bitmap bitmap = MediaStore.Images.Media
|
||||
.getBitmap(activity.getContentResolver(), photoURI);
|
||||
|
||||
imageView.setImageBitmap(bitmap);
|
||||
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90,fileOutputStream);
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
galleryAddPic();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delegate.processFinish(filePath);
|
||||
Log.i(getClass().getSimpleName(), "Results: " + filePath);
|
||||
}
|
||||
|
||||
private void galleryAddPic() {
|
||||
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||
File f = new File(photoURI.getPath());
|
||||
Uri contentUri = Uri.fromFile(f);
|
||||
mediaScanIntent.setData(contentUri);
|
||||
activity.sendBroadcast(mediaScanIntent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class InsuranceFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_insurance, container, false);
|
||||
|
||||
TextView uploadInsurance = view.findViewById(R.id.uploadInsurance);
|
||||
|
||||
|
||||
|
||||
uploadInsurance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
230
app/src/main/java/h_mal/appttude/com/driver/LoginActivity.java
Normal file
@@ -0,0 +1,230 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
|
||||
import android.content.CursorLoader;
|
||||
import android.content.Loader;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.AuthResult;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.Manifest.permission.READ_CONTACTS;
|
||||
|
||||
/**
|
||||
* A login screen that offers login via email/password.
|
||||
*/
|
||||
public class LoginActivity extends AppCompatActivity{
|
||||
|
||||
private FirebaseAuth auth;
|
||||
|
||||
private static final String[] DUMMY_CREDENTIALS = new String[]{
|
||||
"driver@example.com:hello", "bar@example.com:world"
|
||||
};
|
||||
|
||||
// UI references.
|
||||
private EditText mEmailView;
|
||||
private EditText mPasswordView;
|
||||
private View mProgressView;
|
||||
private View mLoginView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
auth = FirebaseAuth.getInstance();
|
||||
// Set up the login form.
|
||||
mEmailView = findViewById(R.id.email);
|
||||
|
||||
mPasswordView = (EditText) findViewById(R.id.password);
|
||||
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
|
||||
if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) {
|
||||
attemptLogin();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
|
||||
mEmailSignInButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
attemptLogin();
|
||||
}
|
||||
});
|
||||
|
||||
mProgressView = findViewById(R.id.login_progress);
|
||||
mLoginView = findViewById(R.id.email_login_form);
|
||||
|
||||
TextView register = findViewById(R.id.register);
|
||||
register.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getApplication(),RegisterActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Attempts to sign in or register the account specified by the login form.
|
||||
* If there are form errors (invalid email, missing fields, etc.), the
|
||||
* errors are presented and no actual login attempt is made.
|
||||
*/
|
||||
private void attemptLogin() {
|
||||
if (auth == null) {
|
||||
Toast.makeText(this, "Login invalid", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset errors.
|
||||
mEmailView.setError(null);
|
||||
mPasswordView.setError(null);
|
||||
|
||||
// Store values at the time of the login attempt.
|
||||
String email = mEmailView.getText().toString();
|
||||
String password = mPasswordView.getText().toString();
|
||||
|
||||
boolean cancel = false;
|
||||
View focusView = null;
|
||||
|
||||
// Check for a valid password, if the user entered one.
|
||||
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
|
||||
mPasswordView.setError(getString(R.string.error_invalid_password));
|
||||
focusView = mPasswordView;
|
||||
cancel = true;
|
||||
}
|
||||
|
||||
// Check for a valid email address.
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
mEmailView.setError(getString(R.string.error_field_required));
|
||||
focusView = mEmailView;
|
||||
cancel = true;
|
||||
} else if (!isEmailValid(email)) {
|
||||
mEmailView.setError(getString(R.string.error_invalid_email));
|
||||
focusView = mEmailView;
|
||||
cancel = true;
|
||||
}
|
||||
|
||||
if (cancel) {
|
||||
// There was an error; don't attempt login and focus the first
|
||||
// form field with an error.
|
||||
focusView.requestFocus();
|
||||
} else {
|
||||
// Show a progress spinner, and kick off a background task to
|
||||
// perform the user login attempt.
|
||||
|
||||
showProgress(true);
|
||||
auth.signInWithEmailAndPassword(email,password)
|
||||
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||
showProgress(false);
|
||||
|
||||
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(LoginActivity.this, getString(R.string.login_failed), Toast.LENGTH_SHORT).show();
|
||||
showProgress(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmailValid(String email) {
|
||||
//TODO: Replace this with your own logic
|
||||
return email.contains("@");
|
||||
}
|
||||
|
||||
private boolean isPasswordValid(String password) {
|
||||
//TODO: Replace this with your own logic
|
||||
return password.length() > 6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the progress UI and hides the login form.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
|
||||
private void showProgress(final boolean show) {
|
||||
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
|
||||
// for very easy animations. If available, use these APIs to fade-in
|
||||
// the progress spinner.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
|
||||
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
|
||||
mLoginView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
mLoginView.animate().setDuration(shortAnimTime).alpha(
|
||||
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mLoginView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
mProgressView.animate().setDuration(shortAnimTime).alpha(
|
||||
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// The ViewPropertyAnimator APIs are not available, so simply show
|
||||
// and hide the relevant UI components.
|
||||
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
mLoginView.setVisibility(show ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
205
app/src/main/java/h_mal/appttude/com/driver/MainActivity.java
Normal file
@@ -0,0 +1,205 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.storage.FirebaseStorage;
|
||||
import com.google.firebase.storage.StorageReference;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
private static String TAG = MainActivity.class.getSimpleName();
|
||||
|
||||
public static FragmentManager fragmentManager;
|
||||
public static FirebaseAuth auth;
|
||||
public static FirebaseStorage storage;
|
||||
public static StorageReference storageReference;
|
||||
public static DatabaseReference mDatabase;
|
||||
|
||||
public static NavigationView navigationView;
|
||||
|
||||
private static final int REQUEST_EXTERNAL_STORAGE = 1;
|
||||
private static String[] PERMISSIONS_STORAGE = {
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
auth = FirebaseAuth.getInstance();
|
||||
storage = FirebaseStorage.getInstance();
|
||||
storageReference = storage.getReference();
|
||||
mDatabase = FirebaseDatabase.getInstance().getReference();
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawer.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
executeFragment(new homeFragment());
|
||||
|
||||
setupDrawer();
|
||||
|
||||
}
|
||||
|
||||
public static void executeFragment(Fragment f){
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(R.id.container,f).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).addToBackStack(f.getClass().getSimpleName()).commit();
|
||||
}
|
||||
|
||||
public static void setupDrawer(){
|
||||
View header = navigationView.getHeaderView(0);
|
||||
|
||||
TextView driverEmail = header.findViewById(R.id.driver_email);
|
||||
TextView driverName = header.findViewById(R.id.driver_name);
|
||||
ImageView driverImage = header.findViewById(R.id.profileImage);
|
||||
|
||||
if (auth != null){
|
||||
FirebaseUser user = auth.getCurrentUser();
|
||||
if (user.getEmail() != null){
|
||||
driverEmail.setText(user.getEmail());
|
||||
}
|
||||
if (user.getDisplayName() != null){
|
||||
driverName.setText(user.getDisplayName());
|
||||
}
|
||||
|
||||
Log.i(TAG, "setupDrawer: "+ storageReference.child("images/"+auth.getCurrentUser().getEmail()+"/profile_pic").getDownloadUrl());
|
||||
|
||||
Picasso.get()
|
||||
.load(user.getPhotoUrl())
|
||||
.placeholder(R.mipmap.ic_launcher_round)
|
||||
.into(driverImage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
if (drawer.isDrawerOpen(GravityCompat.START)) {
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
if (fragmentManager.getBackStackEntryCount() > 1) {
|
||||
fragmentManager.popBackStack();
|
||||
}else{
|
||||
new AlertDialog.Builder(this,R.style.Theme_AppCompat_Dialog_Alert)
|
||||
.setTitle("Leave?")
|
||||
.setMessage("Are you sure you want to exit?")
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
finish();
|
||||
System.exit(0);
|
||||
}
|
||||
}).create().show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem item) {
|
||||
// Handle navigation view item clicks here.
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.nav_camera) {
|
||||
// Handle the camera action
|
||||
executeFragment(new profileFragment());
|
||||
} else if (id == R.id.nav_gallery) {
|
||||
executeFragment(new driverProfileFragment());
|
||||
} else if (id == R.id.nav_slideshow) {
|
||||
executeFragment(new VehicleSetupFragment());
|
||||
}
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void verifyStoragePermissions(Activity activity) {
|
||||
// Check if we have write permission
|
||||
int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
|
||||
if (permission != PackageManager.PERMISSION_GRANTED) {
|
||||
// We don't have permission so prompt the user
|
||||
ActivityCompat.requestPermissions(
|
||||
activity,
|
||||
PERMISSIONS_STORAGE,
|
||||
REQUEST_EXTERNAL_STORAGE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDateStamp(){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmm");
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
}
|
||||
43
app/src/main/java/h_mal/appttude/com/driver/MotFragment.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class MotFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_mot, container, false);
|
||||
|
||||
TextView uploadMot = view.findViewById(R.id.uploadmot);
|
||||
|
||||
|
||||
|
||||
uploadMot.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
public class DriverProfileObject {
|
||||
|
||||
public String driverPic;
|
||||
public String forenames;
|
||||
public String address;
|
||||
public String postcode;
|
||||
public String dob;
|
||||
public String ni;
|
||||
public String dateFirst;
|
||||
|
||||
public DriverProfileObject() {
|
||||
}
|
||||
|
||||
public DriverProfileObject(String driverPic, String forenames, String address,
|
||||
String postcode, String dob, String ni, String dateFirst) {
|
||||
this.driverPic = driverPic;
|
||||
this.forenames = forenames;
|
||||
this.address = address;
|
||||
this.postcode = postcode;
|
||||
this.dob = dob;
|
||||
this.ni = ni;
|
||||
this.dateFirst = dateFirst;
|
||||
}
|
||||
|
||||
public String getDriverPic() {
|
||||
return driverPic;
|
||||
}
|
||||
|
||||
public String getForenames() {
|
||||
return forenames;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public String getPostcode() {
|
||||
return postcode;
|
||||
}
|
||||
|
||||
public String getDob() {
|
||||
return dob;
|
||||
}
|
||||
|
||||
public String getNi() {
|
||||
return ni;
|
||||
}
|
||||
|
||||
public String getDateFirst() {
|
||||
return dateFirst;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
public class DriversLicenseObject {
|
||||
|
||||
public String licenseImageString;
|
||||
public String licenseNumber;
|
||||
public String licenseExpiry;
|
||||
|
||||
public DriversLicenseObject() {
|
||||
}
|
||||
|
||||
public DriversLicenseObject(String licenseImageString, String licenseNumber, String licenseExpiry) {
|
||||
this.licenseImageString = licenseImageString;
|
||||
this.licenseNumber = licenseNumber;
|
||||
this.licenseExpiry = licenseExpiry;
|
||||
}
|
||||
|
||||
public String getLicenseImageString() {
|
||||
return licenseImageString;
|
||||
}
|
||||
|
||||
public String getLicenseNumber() {
|
||||
return licenseNumber;
|
||||
}
|
||||
|
||||
public String getLicenseExpiry() {
|
||||
return licenseExpiry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
class InsuranceObject {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
class LogbookObject {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
public class MotObject {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
public class PrivateHireObject {
|
||||
|
||||
public String phImageString;
|
||||
public String phNumber;
|
||||
public String phExpiry;
|
||||
|
||||
public PrivateHireObject() {
|
||||
}
|
||||
|
||||
public PrivateHireObject(String phImageString, String phNumber, String phExpiry) {
|
||||
this.phImageString = phImageString;
|
||||
this.phNumber = phNumber;
|
||||
this.phExpiry = phExpiry;
|
||||
}
|
||||
|
||||
public String getPhImageString() {
|
||||
return phImageString;
|
||||
}
|
||||
|
||||
public String getPhNumber() {
|
||||
return phNumber;
|
||||
}
|
||||
|
||||
public String getPhExpiry() {
|
||||
return phExpiry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package h_mal.appttude.com.driver.Objects;
|
||||
|
||||
public class VehicleProfileObject {
|
||||
|
||||
public String reg;
|
||||
public String make;
|
||||
public String model;
|
||||
public String colour;
|
||||
public String keeperName;
|
||||
public String keeperAddress;
|
||||
public String keeperPostCode;
|
||||
public String startDate;
|
||||
public boolean seized;
|
||||
public MotObject motObject;
|
||||
public InsuranceObject insuranceObject;
|
||||
public LogbookObject logbookObject;
|
||||
|
||||
public VehicleProfileObject() {
|
||||
}
|
||||
|
||||
public String getReg() {
|
||||
return reg;
|
||||
}
|
||||
|
||||
public String getMake() {
|
||||
return make;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public String getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
public String getKeeperName() {
|
||||
return keeperName;
|
||||
}
|
||||
|
||||
public String getKeeperAddress() {
|
||||
return keeperAddress;
|
||||
}
|
||||
|
||||
public String getKeeperPostCode() {
|
||||
return keeperPostCode;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public boolean isSeized() {
|
||||
return seized;
|
||||
}
|
||||
|
||||
public MotObject getMotObject() {
|
||||
return motObject;
|
||||
}
|
||||
|
||||
public InsuranceObject getInsuranceObject() {
|
||||
return insuranceObject;
|
||||
}
|
||||
|
||||
public LogbookObject getLogbookObject() {
|
||||
return logbookObject;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import h_mal.appttude.com.driver.Objects.PrivateHireObject;
|
||||
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.*;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.CAMERA_REQUEST;
|
||||
import static h_mal.appttude.com.driver.ImageSelectorDialog.MY_CAMERA_PERMISSION_CODE;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
import static h_mal.appttude.com.driver.MainActivity.getDateStamp;
|
||||
import static h_mal.appttude.com.driver.MainActivity.mDatabase;
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
|
||||
public class PrivateHireLicenseFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
|
||||
private ImageView imageView;
|
||||
String fname;
|
||||
|
||||
EditText phNo;
|
||||
EditText phExpiry;
|
||||
|
||||
public Uri filePath;
|
||||
|
||||
public Uri picUri;
|
||||
String Ph_numberString;
|
||||
String Ph_exprString;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_private_hire_license, container, false);
|
||||
|
||||
DatabaseReference reference = mDatabase.child(USER_FIREBASE).child(auth.getCurrentUser().getUid())
|
||||
.child(DRIVER_FIREBASE).child(PRIVATE_HIRE_FIREBASE);
|
||||
|
||||
reference.addListenerForSingleValueEvent(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
|
||||
PrivateHireObject privateHireObject = null;
|
||||
try{
|
||||
privateHireObject = dataSnapshot.getValue(PrivateHireObject.class);
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "onDataChange: ", e);
|
||||
}finally {
|
||||
if (privateHireObject != null){
|
||||
picUri = Uri.parse(privateHireObject.getPhImageString());
|
||||
Ph_numberString = privateHireObject.getPhNumber();
|
||||
Ph_exprString = privateHireObject.getPhExpiry();
|
||||
|
||||
phNo.setText(Ph_numberString);
|
||||
phExpiry.setText(Ph_exprString);
|
||||
Picasso.get()
|
||||
.load(picUri)
|
||||
.placeholder(R.mipmap.ic_launcher_round)
|
||||
.into(imageView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
TextView uploadPH = view.findViewById(R.id.uploadphlic);
|
||||
imageView = view.findViewById(R.id.imageView2);
|
||||
|
||||
phNo = view.findViewById(R.id.ph_no);
|
||||
phExpiry = view.findViewById(R.id.ph_expiry);
|
||||
|
||||
phExpiry.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DateDialog dateDialog = new DateDialog(getContext());
|
||||
dateDialog.init(phExpiry);
|
||||
}
|
||||
});
|
||||
|
||||
Button submit = view.findViewById(R.id.submit);
|
||||
|
||||
uploadPH.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageSelectorDialog imageSelectorDialog = new ImageSelectorDialog(getContext());
|
||||
imageSelectorDialog.setImageName("private_hire");
|
||||
imageSelectorDialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
submit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Ph_numberString = phNo.getText().toString().trim();
|
||||
Ph_exprString = phExpiry.getText().toString().trim();
|
||||
|
||||
//validation for data then submit
|
||||
|
||||
if (!TextUtils.isEmpty(Ph_numberString) &&
|
||||
!TextUtils.isEmpty(Ph_exprString)){
|
||||
if (filePath != null){
|
||||
Log.i(TAG, "onClick: new Image uploaded");
|
||||
new FirebaseClass(getContext(),filePath,new Response(){
|
||||
@Override
|
||||
public void processFinish(Uri output) {
|
||||
Log.i(TAG, "processFinish: ");
|
||||
if (output != null){
|
||||
picUri = output;
|
||||
publishObject();
|
||||
fragmentManager.popBackStack();
|
||||
}
|
||||
|
||||
}
|
||||
}).uploadImage(PRIVATE_HIRE_FIREBASE,PRIVATE_HIRE_FIREBASE + getDateStamp());
|
||||
}else{
|
||||
Log.i(TAG, "onClick: pushing with same image");
|
||||
publishObject();
|
||||
}
|
||||
|
||||
}else {
|
||||
if (TextUtils.isEmpty(Ph_numberString)){
|
||||
phNo.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(Ph_exprString)){
|
||||
phExpiry.setError("Field required");
|
||||
}
|
||||
if (picUri == null){
|
||||
Toast.makeText(getContext(), getString(R.string.image_required), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void publishObject(){
|
||||
|
||||
PrivateHireObject privateHireObject = new PrivateHireObject(picUri.toString(),Ph_numberString,Ph_exprString);
|
||||
|
||||
mDatabase.child(USER_FIREBASE).child(auth.getCurrentUser().getUid()).child(DRIVER_FIREBASE).child(PRIVATE_HIRE_FIREBASE)
|
||||
.setValue(privateHireObject).addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
|
||||
Log.i(TAG, "onComplete: publish = " + task.isSuccessful());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == MY_CAMERA_PERMISSION_CODE) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(getContext(), "camera permission granted", Toast.LENGTH_LONG).show();
|
||||
Intent cameraIntent = new
|
||||
Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
startActivityForResult(cameraIntent, CAMERA_REQUEST);
|
||||
} else {
|
||||
Toast.makeText(getContext(), "camera permission denied", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
new ImageSelectorResults(new ImageSelectorResults.FilepathResponse() {
|
||||
@Override
|
||||
public void processFinish(Uri output) {
|
||||
filePath = output;
|
||||
}
|
||||
}).Results(getActivity(),requestCode, resultCode, data,
|
||||
filePath,imageView);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.AuthResult;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
|
||||
public class RegisterActivity extends AppCompatActivity {
|
||||
|
||||
private FirebaseAuth auth;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_register);
|
||||
|
||||
auth = FirebaseAuth.getInstance();
|
||||
|
||||
final EditText email = findViewById(R.id.email_register);
|
||||
final EditText passwordTop = findViewById(R.id.password_top);
|
||||
final EditText passwordBottom = findViewById(R.id.password_bottom);
|
||||
final ProgressBar progressBar = findViewById(R.id.pb);
|
||||
Button submit = findViewById(R.id.email_sign_up);
|
||||
|
||||
submit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
String emailText = email.getText().toString().trim();
|
||||
String passwordText = passwordTop.getText().toString().trim();
|
||||
String passwordTextBottom = passwordBottom.getText().toString().trim();
|
||||
|
||||
if (TextUtils.isEmpty(emailText)) {
|
||||
Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show();
|
||||
email.setError(getString(R.string.error_field_required));
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(passwordText)) {
|
||||
Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show();
|
||||
passwordTop.setError(getString(R.string.error_field_required));
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(passwordTextBottom)) {
|
||||
Toast.makeText(getApplicationContext(), "Enter password again!", Toast.LENGTH_SHORT).show();
|
||||
passwordBottom.setError(getString(R.string.error_field_required));
|
||||
return;
|
||||
}
|
||||
|
||||
if (passwordText.length() < 6) {
|
||||
passwordTop.setError(getString(R.string.error_invalid_password));
|
||||
return;
|
||||
}
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
//create user
|
||||
auth.createUserWithEmailAndPassword(emailText, passwordText)
|
||||
.addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||
Toast.makeText(RegisterActivity.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (!task.isSuccessful()) {
|
||||
Toast.makeText(RegisterActivity.this, "Authentication failed." + task.getException(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
|
||||
import h_mal.appttude.com.driver.Objects.PrivateHireObject;
|
||||
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.DRIVERS_LICENSE_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.DRIVER_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.PRIVATE_HIRE_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.USER_FIREBASE;
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
import static h_mal.appttude.com.driver.MainActivity.executeFragment;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
import static h_mal.appttude.com.driver.MainActivity.getDateStamp;
|
||||
import static h_mal.appttude.com.driver.MainActivity.mDatabase;
|
||||
|
||||
|
||||
public class VehicleSetupFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
|
||||
EditText reg;
|
||||
EditText make;
|
||||
EditText model;
|
||||
EditText color;
|
||||
EditText keeperName;
|
||||
EditText address;
|
||||
EditText postcode;
|
||||
EditText startDate;
|
||||
CheckBox seized;
|
||||
TextView mot;
|
||||
TextView retrievedmot;
|
||||
TextView insurance;
|
||||
TextView retrievedIns;
|
||||
TextView logbook;
|
||||
TextView logbook_retrieved;
|
||||
Button Submit;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_vehicle_setup, container, false);
|
||||
|
||||
reg = view.findViewById(R.id.reg);
|
||||
make = view.findViewById(R.id.make);
|
||||
model = view.findViewById(R.id.model);
|
||||
color = view.findViewById(R.id.colour);
|
||||
keeperName = view.findViewById(R.id.keeper_name);
|
||||
address = view.findViewById(R.id.address);
|
||||
postcode = view.findViewById(R.id.postcode);
|
||||
startDate = view.findViewById(R.id.start_date);
|
||||
seized = view.findViewById(R.id.seized);
|
||||
mot = view.findViewById(R.id.mot);
|
||||
retrievedmot = view.findViewById(R.id.retrievedmot);
|
||||
insurance = view.findViewById(R.id.insurance);
|
||||
retrievedIns = view.findViewById(R.id.insurance_retrieved);
|
||||
logbook = view.findViewById(R.id.log_book);
|
||||
logbook_retrieved = view.findViewById(R.id.log_book_retrieved);
|
||||
Submit = view.findViewById(R.id.submit_vehicle);
|
||||
|
||||
initiateViewsFromFb();
|
||||
|
||||
mot.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new MotFragment());
|
||||
}
|
||||
});
|
||||
|
||||
insurance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new InsuranceFragment());
|
||||
}
|
||||
});
|
||||
|
||||
logbook.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new logbookFragment());
|
||||
}
|
||||
});
|
||||
|
||||
Submit.setOnClickListener(submitOnClickListener);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void initiateViewsFromFb() {
|
||||
//todo: retrieve object and set data in fields
|
||||
}
|
||||
|
||||
View.OnClickListener submitOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//TODO: get strings from views
|
||||
String regString = reg.getText().toString().trim();
|
||||
String makeString = make.getText().toString().trim();
|
||||
String modelString = model.getText().toString().trim();
|
||||
String colourString = color.getText().toString().trim();
|
||||
String keeperNameStrin = keeperName.getText().toString().trim();
|
||||
String addressString = address.getText().toString().trim();
|
||||
String postcodeString = postcode.getText().toString().trim();
|
||||
String driverForename = startDate.getText().toString().trim();
|
||||
|
||||
//TODO: validate the strings
|
||||
// if ( !TextUtils.isEmpty(driverForename) &&
|
||||
// !TextUtils.isEmpty(AddressString) &&
|
||||
// !TextUtils.isEmpty(postCodeString) &&
|
||||
// !TextUtils.isEmpty(dobString) &&
|
||||
// !TextUtils.isEmpty(niString) &&
|
||||
// !TextUtils.isEmpty(dateFirstString)){
|
||||
|
||||
// Log.i(TAG, "onClick: new Image uploaded");
|
||||
// new FirebaseClass(getContext(),filePath,new FirebaseClass.Response(){
|
||||
// @Override
|
||||
// public void processFinish(Uri output) {
|
||||
// Log.i(TAG, "processFinish: ");
|
||||
// if (output != null){
|
||||
// picUri = output;
|
||||
// writeDriverToDb();
|
||||
// fragmentManager.popBackStack();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }).uploadImage(DRIVERS_LICENSE_FIREBASE,DRIVERS_LICENSE_FIREBASE + getDateStamp());
|
||||
// Log.i(TAG, "onClick: pushing with same image");
|
||||
// writeDriverToDb();
|
||||
|
||||
//todo: set error if invalid
|
||||
// }else {
|
||||
// if (TextUtils.isEmpty(driverForename)){
|
||||
// forenames.setError("Field required");
|
||||
// }
|
||||
// if (TextUtils.isEmpty(AddressString)){
|
||||
// address.setError("Field required");
|
||||
// }
|
||||
// if (TextUtils.isEmpty(postCodeString)){
|
||||
// postcode.setError("Field required");
|
||||
// }
|
||||
// if (TextUtils.isEmpty(dobString)){
|
||||
// dob.setError("Field required");
|
||||
// }
|
||||
// if (TextUtils.isEmpty(niString)){
|
||||
// ni.setError("Field required");
|
||||
// }
|
||||
// if (TextUtils.isEmpty(dateFirstString)){
|
||||
// dateFirst.setError("Field required");
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private void publishObject(){
|
||||
//TODO: publish vehicle object
|
||||
// PrivateHireObject privateHireObject = new PrivateHireObject(picUri.toString(),Ph_numberString,Ph_exprString);
|
||||
//
|
||||
// mDatabase.child(USER_FIREBASE).child(auth.getCurrentUser().getUid()).child(DRIVER_FIREBASE).child(PRIVATE_HIRE_FIREBASE)
|
||||
// .setValue(privateHireObject).addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
// @Override
|
||||
// public void onComplete(@NonNull Task<Void> task) {
|
||||
//
|
||||
// Log.i(TAG, "onComplete: publish = " + task.isSuccessful());
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import h_mal.appttude.com.driver.Objects.DriverProfileObject;
|
||||
import h_mal.appttude.com.driver.Objects.DriversLicenseObject;
|
||||
import h_mal.appttude.com.driver.Objects.PrivateHireObject;
|
||||
|
||||
import static h_mal.appttude.com.driver.FirebaseClass.*;
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
import static h_mal.appttude.com.driver.MainActivity.executeFragment;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
import static h_mal.appttude.com.driver.MainActivity.getDateStamp;
|
||||
import static h_mal.appttude.com.driver.MainActivity.mDatabase;
|
||||
|
||||
|
||||
public class driverProfileFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
|
||||
ImageView driverPic;
|
||||
TextView addPic;
|
||||
EditText forenames;
|
||||
EditText address;
|
||||
EditText postcode;
|
||||
EditText dob;
|
||||
EditText ni;
|
||||
TextView privateHire;
|
||||
TextView retrievedPH;
|
||||
EditText dateFirst;
|
||||
TextView driverLi;
|
||||
TextView retrievedDl;
|
||||
Button submit_driver;
|
||||
|
||||
Uri filePath;
|
||||
Uri picUri;
|
||||
|
||||
DatabaseReference driverProfileReference;
|
||||
|
||||
PrivateHireObject privateHireObject;
|
||||
DriverProfileObject driverProfileObject;
|
||||
DriversLicenseObject driversLicenseObject;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
driverProfileReference = mDatabase.child(USER_FIREBASE).child(auth.getCurrentUser().getUid())
|
||||
.child(DRIVER_FIREBASE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_driver_profile, container, false);
|
||||
|
||||
driverPic = view.findViewById(R.id.driver_pic);
|
||||
addPic = view.findViewById(R.id.add_driver_pic);
|
||||
forenames = view.findViewById(R.id.names);
|
||||
address = view.findViewById(R.id.address);
|
||||
postcode = view.findViewById(R.id.postcode);
|
||||
dob = view.findViewById(R.id.dob);
|
||||
ni = view.findViewById(R.id.ni_number);
|
||||
privateHire = view.findViewById(R.id.private_hire);
|
||||
retrievedPH = view.findViewById(R.id.retrievedPH);
|
||||
dateFirst = view.findViewById(R.id.date_first);
|
||||
driverLi = view.findViewById(R.id.drivers_li);
|
||||
retrievedDl = view.findViewById(R.id.retrieved_dl);
|
||||
submit_driver = view.findViewById(R.id.submit_driver);
|
||||
|
||||
driverPic.setVisibility(View.GONE);
|
||||
|
||||
driverProfileReference.addListenerForSingleValueEvent(valueEventListener);
|
||||
|
||||
addPic.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImageSelectorDialog imageSelectorDialog = new ImageSelectorDialog(getContext());
|
||||
imageSelectorDialog.setImageName("driver_pic"+getDateStamp());
|
||||
imageSelectorDialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
privateHire.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new PrivateHireLicenseFragment());
|
||||
}
|
||||
});
|
||||
|
||||
driverLi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new DriverLicenseFragment());
|
||||
}
|
||||
});
|
||||
|
||||
dob.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DateDialog dateDialog = new DateDialog(getContext());
|
||||
dateDialog.init(dob);
|
||||
}
|
||||
});
|
||||
|
||||
dateFirst.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DateDialog dateDialog = new DateDialog(getContext());
|
||||
dateDialog.init(dateFirst);
|
||||
}
|
||||
});
|
||||
|
||||
submit_driver.setOnClickListener(submitOnClickListener);
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
ValueEventListener valueEventListener = new ValueEventListener(){
|
||||
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
|
||||
try{
|
||||
privateHireObject = dataSnapshot.child(PRIVATE_HIRE_FIREBASE).getValue(PrivateHireObject.class);
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "onDataChange: ", e);
|
||||
}finally {
|
||||
if (privateHireObject != null){
|
||||
|
||||
retrievedPH.setText("Private Hire License no.: " +privateHireObject.getPhNumber()
|
||||
+"\nPrivate Hire License expiry: " + privateHireObject.getPhExpiry());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
driverProfileObject = dataSnapshot.child(DRIVER_DETAILS_FIREBASE).getValue(DriverProfileObject.class);
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "onDataChange: ", e);
|
||||
}finally {
|
||||
if (driverProfileObject != null){
|
||||
forenames.setText(driverProfileObject.getForenames());
|
||||
address.setText(driverProfileObject.getAddress());
|
||||
postcode.setText(driverProfileObject.getPostcode());
|
||||
dob.setText(driverProfileObject.getDob());
|
||||
dateFirst.setText(driverProfileObject.getDateFirst());
|
||||
ni.setText(driverProfileObject.getNi());
|
||||
driverPic.setVisibility(View.VISIBLE);
|
||||
Picasso.get().load(driverProfileObject.getDriverPic()).into(driverPic);
|
||||
picUri = Uri.parse(driverProfileObject.getDriverPic());
|
||||
|
||||
}else {
|
||||
driverPic.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
driversLicenseObject = dataSnapshot.child(DRIVERS_LICENSE_FIREBASE).getValue(DriversLicenseObject.class);
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "onDataChange: ", e);
|
||||
}finally {
|
||||
if (driversLicenseObject != null){
|
||||
retrievedDl.setText("Driving License no.: " +driversLicenseObject.getLicenseNumber()
|
||||
+"\nDriving License expiry: " + driversLicenseObject.getLicenseExpiry());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError databaseError) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
View.OnClickListener submitOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String driverForename = forenames.getText().toString().trim();
|
||||
String AddressString = address.getText().toString().trim();
|
||||
String postCodeString = postcode.getText().toString().trim();
|
||||
String dobString = dob.getText().toString().trim();
|
||||
String niString = ni.getText().toString().trim();
|
||||
String dateFirstString = dateFirst.getText().toString().trim();
|
||||
|
||||
if ( !TextUtils.isEmpty(driverForename) &&
|
||||
!TextUtils.isEmpty(AddressString) &&
|
||||
!TextUtils.isEmpty(postCodeString) &&
|
||||
!TextUtils.isEmpty(dobString) &&
|
||||
!TextUtils.isEmpty(niString) &&
|
||||
!TextUtils.isEmpty(dateFirstString)){
|
||||
if (filePath != null){
|
||||
Log.i(TAG, "onClick: new Image uploaded");
|
||||
new FirebaseClass(getContext(),filePath,new FirebaseClass.Response(){
|
||||
@Override
|
||||
public void processFinish(Uri output) {
|
||||
Log.i(TAG, "processFinish: ");
|
||||
if (output != null){
|
||||
picUri = output;
|
||||
writeDriverToDb();
|
||||
fragmentManager.popBackStack();
|
||||
}
|
||||
|
||||
}
|
||||
}).uploadImage(DRIVERS_LICENSE_FIREBASE,DRIVERS_LICENSE_FIREBASE + getDateStamp());
|
||||
}else{
|
||||
Log.i(TAG, "onClick: pushing with same image");
|
||||
writeDriverToDb();
|
||||
}
|
||||
|
||||
}else {
|
||||
if (TextUtils.isEmpty(driverForename)){
|
||||
forenames.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(AddressString)){
|
||||
address.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(postCodeString)){
|
||||
postcode.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(dobString)){
|
||||
dob.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(niString)){
|
||||
ni.setError("Field required");
|
||||
}
|
||||
if (TextUtils.isEmpty(dateFirstString)){
|
||||
dateFirst.setError("Field required");
|
||||
}
|
||||
if (picUri == null){
|
||||
Toast.makeText(getContext(), getString(R.string.image_required), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
new ImageSelectorResults(new ImageSelectorResults.FilepathResponse() {
|
||||
@Override
|
||||
public void processFinish(Uri output) {
|
||||
filePath = output;
|
||||
}
|
||||
}).Results(getActivity(),requestCode, resultCode, data,
|
||||
filePath,driverPic);
|
||||
driverPic.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
private void writeDriverToDb(){
|
||||
|
||||
String forenameText = forenames.getText().toString().trim();
|
||||
String addressText = address.getText().toString().trim();
|
||||
String postcodeText = postcode.getText().toString().trim();
|
||||
String dobText = dob.getText().toString().trim();
|
||||
String niText = ni.getText().toString().trim();
|
||||
String datefirstText = dateFirst.getText().toString().trim();
|
||||
|
||||
DriverProfileObject driverProfileObject = new DriverProfileObject(picUri.toString(),forenameText,
|
||||
addressText,postcodeText,dobText,niText,datefirstText);
|
||||
|
||||
driverProfileReference.child(DRIVER_DETAILS_FIREBASE).setValue(driverProfileObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
import static h_mal.appttude.com.driver.MainActivity.executeFragment;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
|
||||
|
||||
public class homeFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||
|
||||
Button button = view.findViewById(R.id.driver);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new driverProfileFragment());
|
||||
}
|
||||
});
|
||||
|
||||
CardView second= view.findViewById(R.id.car);
|
||||
second.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
executeFragment(new VehicleSetupFragment());
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
||||
public class logbookFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_logbook, container, false);
|
||||
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
257
app/src/main/java/h_mal/appttude/com/driver/profileFragment.java
Normal file
@@ -0,0 +1,257 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.tasks.Continuation;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.auth.UserProfileChangeRequest;
|
||||
import com.google.firebase.storage.FirebaseStorage;
|
||||
import com.google.firebase.storage.OnProgressListener;
|
||||
import com.google.firebase.storage.StorageReference;
|
||||
import com.google.firebase.storage.UploadTask;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static h_mal.appttude.com.driver.MainActivity.auth;
|
||||
import static h_mal.appttude.com.driver.MainActivity.fragmentManager;
|
||||
import static h_mal.appttude.com.driver.MainActivity.setupDrawer;
|
||||
|
||||
public class profileFragment extends Fragment {
|
||||
|
||||
private String TAG = this.getClass().getSimpleName();
|
||||
private final int PICK_IMAGE_REQUEST = 70;
|
||||
|
||||
private ImageView imageView;
|
||||
private EditText email;
|
||||
private EditText name;
|
||||
|
||||
FirebaseStorage storage;
|
||||
StorageReference storageReference;
|
||||
|
||||
private FirebaseUser user;
|
||||
|
||||
private Uri filePath;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
user = auth.getCurrentUser();
|
||||
storage = FirebaseStorage.getInstance();
|
||||
storageReference = storage.getReference();
|
||||
|
||||
setRetainInstance(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||
|
||||
imageView = view.findViewById(R.id.profile_pic);
|
||||
email = view.findViewById(R.id.profile_email);
|
||||
name = view.findViewById(R.id.profile_name);
|
||||
|
||||
TextView upload = view.findViewById(R.id.uploadprofilepic);
|
||||
|
||||
upload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
chooseImage();
|
||||
}
|
||||
});
|
||||
|
||||
retrieveProfile();
|
||||
|
||||
Button button = view.findViewById(R.id.submit_profile);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
updateProfile();
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void retrieveProfile(){
|
||||
email.setText(user.getEmail());
|
||||
if (user.getDisplayName() != null){
|
||||
name.setText(user.getDisplayName());
|
||||
}
|
||||
|
||||
if(imageView != null){
|
||||
Picasso.get()
|
||||
.load(user.getPhotoUrl())
|
||||
.placeholder(R.mipmap.ic_launcher_round)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateProfile(){
|
||||
UserProfileChangeRequest.Builder profileUpdatesBuilder = new UserProfileChangeRequest.Builder();
|
||||
|
||||
String profileName = name.getText().toString().trim();
|
||||
|
||||
|
||||
if (!TextUtils.isEmpty(profileName)){
|
||||
profileUpdatesBuilder.setDisplayName(profileName);
|
||||
}
|
||||
if (filePath != null ||
|
||||
imageView.getDrawable().getConstantState() != getResources().getDrawable( R.mipmap.ic_launcher_round).getConstantState()){
|
||||
profileUpdatesBuilder.setPhotoUri(filePath);
|
||||
}
|
||||
|
||||
UserProfileChangeRequest profileUpdates = profileUpdatesBuilder.build();
|
||||
|
||||
user.updateProfile(profileUpdates)
|
||||
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
if (task.isSuccessful()) {
|
||||
Log.d(TAG, "User profile updated.");
|
||||
setupDrawer();
|
||||
fragmentManager.popBackStack();
|
||||
}
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(getContext(), "Update Failed", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void uploadImage() {
|
||||
|
||||
if(filePath != null)
|
||||
{
|
||||
final ProgressDialog progressDialog = new ProgressDialog(getContext());
|
||||
progressDialog.setTitle("Uploading...");
|
||||
progressDialog.show();
|
||||
|
||||
final StorageReference ref = storageReference.child("images/"+ user.getUid() + "/profile_pic");
|
||||
UploadTask uploadTask = ref.putFile(filePath);
|
||||
|
||||
uploadTask.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
|
||||
@Override
|
||||
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
double progress = (100.0*taskSnapshot.getBytesTransferred()/taskSnapshot
|
||||
.getTotalByteCount());
|
||||
progressDialog.setMessage("Uploaded "+(int)progress+"%");
|
||||
}
|
||||
}).continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
|
||||
@Override
|
||||
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
|
||||
if (!task.isSuccessful()) {
|
||||
throw task.getException();
|
||||
}
|
||||
|
||||
// Continue with the task to get the download URL
|
||||
return ref.getDownloadUrl();
|
||||
}
|
||||
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Uri> task) {
|
||||
if (task.isSuccessful()) {
|
||||
filePath = task.getResult();
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(), "Uploaded Successfully", Toast.LENGTH_SHORT).show();
|
||||
Log.i(TAG, "onComplete: uploaded Successful uri: " + task.getResult());
|
||||
} else {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(), "Failed to upload", Toast.LENGTH_SHORT).show();
|
||||
Log.i(TAG, "onComplete: failed to get url");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
||||
// @Override
|
||||
// public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
//
|
||||
// }
|
||||
// })
|
||||
// .addOnFailureListener(new OnFailureListener() {
|
||||
// @Override
|
||||
// public void onFailure(@NonNull Exception e) {
|
||||
//
|
||||
// }
|
||||
// })
|
||||
// .addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
|
||||
// @Override
|
||||
// public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
// double progress = (100.0*taskSnapshot.getBytesTransferred()/taskSnapshot
|
||||
// .getTotalByteCount());
|
||||
// progressDialog.setMessage("Uploaded "+(int)progress+"%");
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void chooseImage() {
|
||||
Intent intent = new Intent();
|
||||
intent.setType("image/*");
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if(requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
|
||||
&& data != null && data.getData() != null )
|
||||
{
|
||||
filePath = data.getData();
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), filePath);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (bitmap != null){
|
||||
uploadImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
7
app/src/main/res/drawable-v21/cardviewoutline.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/transparent"/>
|
||||
<stroke android:width="2dip" android:color="#03a9f4" />
|
||||
<corners android:radius="22dip"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable-v21/cars.jpg
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
9
app/src/main/res/drawable-v21/gradient_colour.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="@color/colour_three"
|
||||
android:endColor="@color/colour_two"
|
||||
android:type="linear"
|
||||
android:angle="45"/>
|
||||
</shape>
|
||||
12
app/src/main/res/drawable-v21/ic_menu_camera.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<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="#FF000000"
|
||||
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable-v21/ic_menu_gallery.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<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="#FF000000"
|
||||
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable-v21/ic_menu_manage.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<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="#FF000000"
|
||||
android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable-v21/ic_menu_send.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<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="#FF000000"
|
||||
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable-v21/ic_menu_share.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<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="#FF000000"
|
||||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable-v21/ic_menu_slideshow.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<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="#FF000000"
|
||||
android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" />
|
||||
</vector>
|
||||
10
app/src/main/res/drawable-v21/round_edit_text.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" android:padding="10dp">
|
||||
<solid android:color="#03a9f4" />
|
||||
<corners
|
||||
android:bottomRightRadius="22dp"
|
||||
android:bottomLeftRadius="22dp"
|
||||
android:topLeftRadius="22dp"
|
||||
android:topRightRadius="22dp" />
|
||||
</shape>
|
||||
34
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable-xxhdpi/background.jpg
Normal file
|
After Width: | Height: | Size: 277 KiB |
BIN
app/src/main/res/drawable-xxhdpi/bg.jpg
Normal file
|
After Width: | Height: | Size: 566 KiB |
BIN
app/src/main/res/drawable-xxhdpi/cars.jpg
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
BIN
app/src/main/res/drawable/background.jpg
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
app/src/main/res/drawable/cars.jpg
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/side_nav_bar.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:centerColor="@color/colorAccent"
|
||||
android:endColor="#00695C"
|
||||
android:startColor="@color/colorAccent"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
9
app/src/main/res/layout/activity_image_selector.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?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=".ImageSelectorActivity">
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
127
app/src/main/res/layout/activity_login.xml
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:background="@drawable/cars"
|
||||
tools:context=".LoginActivity">
|
||||
|
||||
<!-- Login progress -->
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/email_login_form">
|
||||
<LinearLayout
|
||||
android:id="@+id/fields_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
style="@style/cardview_theme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:cardBackgroundColor="#03a9f4">
|
||||
<!--<android.support.design.widget.TextInputLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content">-->
|
||||
<EditText
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginRight="18dp"
|
||||
android:autofilledHighlight="@android:color/transparent"
|
||||
android:ems="10"
|
||||
android:hint="@string/prompt_email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#03a9f4" />
|
||||
|
||||
<!--</android.support.design.widget.TextInputLayout>-->
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
style="@style/cardview_theme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="#03a9f4">
|
||||
|
||||
<!--<android.support.design.widget.TextInputLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content">-->
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginRight="18dp"
|
||||
android:autofilledHighlight="@android:color/transparent"
|
||||
android:ems="10"
|
||||
android:hint="@string/prompt_password"
|
||||
android:imeActionId="6"
|
||||
android:imeActionLabel="@string/action_sign_in_short"
|
||||
android:imeOptions="actionUnspecified"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<!--</android.support.design.widget.TextInputLayout>-->
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/register"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="18dp"
|
||||
android:text="Sign up"
|
||||
android:textColor="#03a9f4"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/email_sign_in_button"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/action_sign_in_short"
|
||||
android:textColor="#91ddff"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/login_progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
25
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<include
|
||||
layout="@layout/app_bar_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
88
app/src/main/res/layout/activity_register.xml
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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=".RegisterActivity">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/pb"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/email_register"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Enter Email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Enter Password"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Enter Password Again"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/email_sign_up"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="Sign Up"
|
||||
android:textColor="#91ddff"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
63
app/src/main/res/layout/address_dialog.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_margin="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/upload"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/upload_pic"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@id/or"
|
||||
android:background="#616161"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/or"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="4dp"
|
||||
android:text="OR" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/or"
|
||||
android:background="#616161"
|
||||
android:gravity="center" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/take_pic"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/take_pic"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
31
app/src/main/res/layout/app_bar_main.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/container">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
20
app/src/main/res/layout/content_main.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".MainActivity"
|
||||
tools:showIn="@layout/app_bar_main">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
96
app/src/main/res/layout/fragment_driver_license.xml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".DriverLicenseFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/driversli_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/dl_view"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:scaleType="centerInside"
|
||||
android:adjustViewBounds="true"
|
||||
tools:src="@drawable/bg" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:id="@+id/dl_view"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/upload_lic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/lin_lay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Upload Drivers License"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/lic_no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Drivers License no."
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/lic_expiry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Drivers License Expiry"
|
||||
android:inputType="date"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
207
app/src/main/res/layout/fragment_driver_profile.xml
Normal file
@@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".driverProfileFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/driver_pic"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="12dp"
|
||||
tools:src="@mipmap/ic_launcher_round" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_driver_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Add Driver photo"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/names"
|
||||
style="@style/edittexttheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Forename(s)"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:gravity="top|left"
|
||||
android:hint="Address"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="4"
|
||||
android:maxLines="7"
|
||||
android:minLines="4"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/postcode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Postcode"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dob"
|
||||
style="@style/edittexttheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:focusable="false"
|
||||
android:hint="Date of birth"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ni_number"
|
||||
style="@style/edittexttheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="NI number"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/date_first"
|
||||
style="@style/edittexttheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:focusable="false"
|
||||
android:hint="Date first available"
|
||||
android:maxLines="1" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/private_hire"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Add Private Hire License"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/retrievedPH"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:text="Private hire number : 254215751 \nExpiry Date: 22/10/2019" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/drivers_li"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Add Drivers License"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/retrieved_dl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:text="Drivers license number : AGSCE83858HP4DB \nExpiry Date: 22/10/2019" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit_driver"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="#91ddff"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
140
app/src/main/res/layout/fragment_find_address.xml
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="12dp"
|
||||
tools:context=".FindAddressFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/findaddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/lin_lay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Find Address"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
<!--<RelativeLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content">-->
|
||||
|
||||
<!--<view-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="1dp"-->
|
||||
<!--android:layout_alignParentLeft="true"-->
|
||||
<!--android:layout_centerVertical="true"-->
|
||||
<!--android:layout_toLeftOf="@id/or"-->
|
||||
<!--android:background="#000000" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/or"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_centerHorizontal="true"-->
|
||||
<!--android:layout_centerVertical="true"-->
|
||||
<!--android:layout_margin="4dp"-->
|
||||
<!--android:textColor="#000000"-->
|
||||
<!--android:textStyle="bold"-->
|
||||
<!--android:text="OR" />-->
|
||||
|
||||
<!--<view-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="1dp"-->
|
||||
<!--android:layout_alignParentRight="true"-->
|
||||
<!--android:layout_centerVertical="true"-->
|
||||
<!--android:layout_toRightOf="@id/or"-->
|
||||
<!--android:background="#000000" />-->
|
||||
|
||||
<!--</RelativeLayout>-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/entermanually"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:background="@drawable/round_edit_text"-->
|
||||
<!--android:ems="10"-->
|
||||
<!--android:gravity="center"-->
|
||||
<!--android:padding="12dp"-->
|
||||
<!--android:selectAllOnFocus="true"-->
|
||||
<!--android:singleLine="true"-->
|
||||
<!--android:text="Enter Address Manually"-->
|
||||
<!--android:textColorHighlight="#608d91" />-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lin_lay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:gravity="top|left"
|
||||
android:hint="Address"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="4"
|
||||
android:maxLines="7"
|
||||
android:minLines="4"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/postcode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Postcode"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
56
app/src/main/res/layout/fragment_home.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".homeFragment"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--<android.support.v7.widget.CardView-->
|
||||
<!--android:id="@+id/driver"-->
|
||||
<!--style="@style/cardview_theme"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="0dp"-->
|
||||
<!--android:layout_margin="16dp"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--app:background="@drawable/cardviewoutline">-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_gravity="center"-->
|
||||
<!--android:text="Driver Profile"-->
|
||||
<!--android:textSize="22sp" />-->
|
||||
|
||||
<!--</android.support.v7.widget.CardView>-->
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="16dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:id="@+id/driver"
|
||||
android:text="Driver Profile"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/car"
|
||||
style="@style/cardview_theme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="16dp"
|
||||
app:cardBackgroundColor="#ffa200">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Vehicle Profile"
|
||||
android:textSize="22sp" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
105
app/src/main/res/layout/fragment_insurance.xml
Normal file
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploadInsurance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/lin_lay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Upload Insurance Documents"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/insurer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Insurer:"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ins_no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Insurance No.:"
|
||||
android:inputType="date"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/insurance_exp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Insurance expiry:"
|
||||
android:inputType="date"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
9
app/src/main/res/layout/fragment_logbook.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".logbookFragment">
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
86
app/src/main/res/layout/fragment_mot.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".PrivateHireLicenseFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_centerInParent="true">
|
||||
<TextView
|
||||
android:id="@+id/uploadmot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/lin_lay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Upload M.O.T"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mot_no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="MOT Number"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mot_expiry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="MOT Expiry"
|
||||
android:inputType="date"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
101
app/src/main/res/layout/fragment_private_hire_license.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
android:orientation="vertical"
|
||||
tools:context=".PrivateHireLicenseFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ph_view_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_centerInParent="true">
|
||||
<TextView
|
||||
android:id="@+id/uploadphlic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/lin_lay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Upload Private hire photo"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ph_no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Private Hire License no."
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ph_expiry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Private Hire License Expiry"
|
||||
android:inputType="date"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/ph_view_holder"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:scaleType="centerInside"
|
||||
android:adjustViewBounds="true"
|
||||
tools:src="@drawable/bg" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
104
app/src/main/res/layout/fragment_profile.xml
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
android:orientation="vertical"
|
||||
tools:context=".PrivateHireLicenseFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ph_view_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploadprofilepic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/lin_lay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Upload new profile picture"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/profile_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Profile Name"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/profile_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Profile Email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit_profile"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/ph_view_holder"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
245
app/src/main/res/layout/fragment_vehicle_setup.xml
Normal file
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/reg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Car reg"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/make"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Make"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/model"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Model"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/colour"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Colour"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/keeper_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Name of keeper"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:gravity="top|left"
|
||||
android:hint="Address of Keeper"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="4"
|
||||
android:maxLines="7"
|
||||
android:minLines="4"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/postcode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Postcode of Keeper"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:ems="10"
|
||||
android:hint="Start date"
|
||||
android:inputType="date"
|
||||
android:maxLines="1"
|
||||
style="@style/edittexttheme" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/seized"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:hint="Vehicle Siezed"
|
||||
android:padding="12dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Add MOT details"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/retrievedmot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:padding="12dp"
|
||||
android:text="MOT number : 254215751 \nExpiry Date: 22/10/2019" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/insurance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Add insurance details"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/insurance_retrieved"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:padding="12dp"
|
||||
android:text="Insurer : Admiral \nInsurance No.: 483sdf4623\nExpiry Date: 22/10/2019"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/log_book"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/round_edit_text"
|
||||
android:ems="10"
|
||||
android:padding="12dp"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:text="Add Log Book"
|
||||
android:textColorHighlight="#608d91" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/log_book_retrieved"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:padding="12dp"
|
||||
android:text="V5C number: 483sdf4623"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit_vehicle"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/cardviewoutline"
|
||||
android:text="@string/submit"
|
||||
android:textColor="#91ddff"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
58
app/src/main/res/layout/nav_header_main.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_above="@id/id_holder"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="18dp"
|
||||
app:cardCornerRadius="50dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profileImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/nav_header_desc"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@mipmap/ic_launcher_round" />
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/id_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/driver_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
android:text="@string/nav_header_title"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/driver_email"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/nav_header_subtitle" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
27
app/src/main/res/menu/activity_main_drawer.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:showIn="navigation_view">
|
||||
|
||||
<group android:checkableBehavior="none">
|
||||
<item
|
||||
android:id="@+id/nav_gallery"
|
||||
android:icon="@drawable/ic_menu_gallery"
|
||||
android:title="Driver profile" />
|
||||
<item
|
||||
android:id="@+id/nav_slideshow"
|
||||
android:icon="@drawable/ic_menu_slideshow"
|
||||
android:title="Vehicle Profile" />
|
||||
|
||||
</group>
|
||||
|
||||
<item android:title="User Profile">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/nav_camera"
|
||||
android:icon="@drawable/ic_menu_camera"
|
||||
android:title="Update User Profile" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
</menu>
|
||||
9
app/src/main/res/menu/main.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
8
app/src/main/res/values-v21/styles.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
12
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#000b85</color>
|
||||
<color name="colorPrimaryDark">#010057</color>
|
||||
<color name="colorAccent">#03a9f4</color>
|
||||
|
||||
<color name="colour_one">#03a9f4</color>
|
||||
<color name="colour_two">#f78626</color>
|
||||
<color name="colour_three">#a5b0b6</color>
|
||||
<color name="colour_four">#8549ff</color>
|
||||
<color name="colour_five">#020122</color>
|
||||
</resources>
|
||||
9
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
||||
<dimen name="nav_header_height">200dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="floating_hint_margin">22dp</dimen>
|
||||
</resources>
|
||||
8
app/src/main/res/values/drawables.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item name="ic_menu_camera" type="drawable">@android:drawable/ic_menu_camera</item>
|
||||
<item name="ic_menu_gallery" type="drawable">@android:drawable/ic_menu_gallery</item>
|
||||
<item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item>
|
||||
<item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item>
|
||||
<item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item>
|
||||
<item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item>
|
||||
</resources>
|
||||
30
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<resources>
|
||||
<string name="app_name">Driver</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="nav_header_title">Driver Name</string>
|
||||
<string name="nav_header_subtitle">driver@example.com</string>
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="title_activity_login">Sign in</string>
|
||||
<!-- Strings related to login -->
|
||||
<string name="prompt_email">Email</string>
|
||||
<string name="prompt_password">Password</string>
|
||||
<string name="action_sign_in">Log in</string>
|
||||
<string name="action_sign_in_short">Sign in</string>
|
||||
<string name="error_invalid_email">This email address is invalid</string>
|
||||
<string name="error_invalid_password">This password is too short</string>
|
||||
<string name="error_incorrect_password">This password is incorrect</string>
|
||||
<string name="error_field_required">This field is required</string>
|
||||
<string name="permission_rationale">"Contacts permissions are needed for providing email
|
||||
completions."
|
||||
</string>
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="error_fields_non_match">Passwords Do Not Match</string>
|
||||
<string name="login_failed">Login Failed!</string>
|
||||
<string name="submit">Submit</string>
|
||||
<string name="take_pic">Open Camera</string>
|
||||
<string name="upload_pic">Upload from Storage</string>
|
||||
<string name="set_date">Select date</string>
|
||||
<string name="image_required">Driving License Image Required</string>
|
||||
</resources>
|
||||
45
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
|
||||
<item name="android:windowBackground">@drawable/bg</item>
|
||||
|
||||
<item name="android:textColorHint">@color/colour_five</item>
|
||||
<item name="android:textColor">@color/colour_five</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--<item name="android:textColorHint">@color/colour_three</item>-->
|
||||
<!--<item name="android:autofilledHighlight">@android:color/transparent</item>-->
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" >
|
||||
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="cardview_theme" parent="CardView">
|
||||
<!--<item name="android:layout_width">match_parent</item>-->
|
||||
<!--<item name="android:layout_height">match_parent</item>-->
|
||||
<!--<item name="cardBackgroundColor">#00fffb</item>-->
|
||||
<item name="cardCornerRadius">22dp</item>
|
||||
</style>
|
||||
|
||||
<style name="edittexttheme">
|
||||
<item name="android:backgroundTint">@color/colour_five</item>
|
||||
<item name="android:padding">12dp</item>
|
||||
<item name="android:selectAllOnFocus">true</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:textColorHighlight">#608d91</item>
|
||||
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
4
app/src/main/res/xml/file_paths.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-path name="my_images" path="Android/data/h_mal.appttude.com.driver/files/Pictures" />
|
||||
</paths>
|
||||
@@ -0,0 +1,17 @@
|
||||
package h_mal.appttude.com.driver;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
27
build.gradle
Normal file
@@ -0,0 +1,27 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.google.gms:google-services:4.0.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
15
gradle.properties
Normal file
@@ -0,0 +1,15 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
172
gradlew
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||