├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml └── runConfigurations.xml ├── README.md ├── User_manual_Make_Payment_App.pdf ├── app ├── .gitignore ├── build.gradle ├── google-services.json ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── login │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── login │ │ │ ├── CandidateDetails.java │ │ │ ├── Channel.java │ │ │ ├── DBHelper.java │ │ │ ├── Listofcandidates.java │ │ │ ├── MainActivity.java │ │ │ ├── MainActivity1.java │ │ │ ├── Newuser.java │ │ │ ├── NothingSelectedSpinnerAdapter.java │ │ │ ├── Receiver.java │ │ │ ├── a.java │ │ │ └── changepassword.java │ └── res │ │ ├── drawable-v24 │ │ ├── blueback.jpg │ │ ├── blues.jpg │ │ ├── curved_view.xml │ │ ├── curved_view1.xml │ │ ├── curved_view2.xml │ │ ├── curved_view3.xml │ │ ├── goldbutton.jpg │ │ ├── gradient1.xml │ │ ├── gradient2.xml │ │ ├── greenback.jpg │ │ └── ic_account_circle_black_24dp.xml │ │ ├── drawable │ │ ├── blueback.jpg │ │ ├── buttonback.jpg │ │ ├── curved_view2.xml │ │ └── gradient.xml │ │ ├── font │ │ └── calligraffitti.xml │ │ ├── layout │ │ ├── activity_a.xml │ │ ├── activity_candidate_details.xml │ │ ├── activity_changepassword.xml │ │ ├── activity_fetch_contacts.xml │ │ ├── activity_listofcandidates.xml │ │ ├── activity_main.xml │ │ ├── activity_main1.xml │ │ ├── activity_newuser.xml │ │ ├── contact_spinner_row_nothing_selected.xml │ │ ├── contact_spinner_row_nothing_selected1.xml │ │ ├── contact_spinner_row_nothing_selected2.xml │ │ ├── contact_spinner_row_nothing_selected3.xml │ │ ├── contact_spinner_row_nothing_selected_arr.xml │ │ ├── contact_spinner_row_nothing_selected_dept.xml │ │ └── contactlist_row.xml │ │ ├── menu │ │ └── menu.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── font_certs.xml │ │ ├── preloaded_fonts.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── login │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TicketBookingSystem 2 | For understading the working of Application: Refer the User Manual PDF File attached herewith for the same. 3 | 4 | Don't Forget to Subscribe My Channel , like video and share to your friends. If you want to learn any new things then comment over that. We will make new video on that As soon As Possible. 5 | -------------------------------------------------------------------------------- /User_manual_Make_Payment_App.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/User_manual_Make_Payment_App.pdf -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.gms.google-services' 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.example.login" 9 | minSdkVersion 16 10 | targetSdkVersion 29 11 | versionCode 1 12 | versionName "1.0" 13 | multiDexEnabled true 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation 'com.android.support:multidex:1.0.3' 29 | implementation 'com.google.firebase:firebase-auth:19.2.0' 30 | implementation 'com.google.firebase:firebase-database:19.2.0' 31 | implementation 'com.google.firebase:firebase-firestore:21.4.0' 32 | implementation 'androidx.appcompat:appcompat:1.1.0' 33 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 34 | testImplementation 'junit:junit:4.12' 35 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 36 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 37 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 38 | } 39 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "876395909774", 4 | "firebase_url": "https://login-cc143.firebaseio.com", 5 | "project_id": "login-cc143", 6 | "storage_bucket": "login-cc143.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:876395909774:android:fb90636842d9c38dbaafdf", 12 | "android_client_info": { 13 | "package_name": "com.example.login" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "876395909774-r3rnptc2lkufjt2tq7us91aoqeigmk7f.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.example.login", 22 | "certificate_hash": "e32bb730f2d809c0e057fde2ddf3f673c53ebd99" 23 | } 24 | }, 25 | { 26 | "client_id": "876395909774-irik1oinnql83c1a7n1vnvgi3luifpdj.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyBmbuC7pVc20LpoX-4F02FzIOuXWpUkjz8" 33 | } 34 | ], 35 | "services": { 36 | "appinvite_service": { 37 | "other_platform_oauth_client": [ 38 | { 39 | "client_id": "876395909774-irik1oinnql83c1a7n1vnvgi3luifpdj.apps.googleusercontent.com", 40 | "client_type": 3 41 | } 42 | ] 43 | } 44 | } 45 | } 46 | ], 47 | "configuration_version": "1" 48 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/login/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.example.login", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/CandidateDetails.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.TextView; 10 | 11 | public class CandidateDetails extends AppCompatActivity { 12 | TextView t1,t2,t3,t4,t5,t6,t7,t8,t9; 13 | Button goback; 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_candidate_details); 18 | 19 | t1=(TextView)findViewById(R.id.detail11); 20 | t2=(TextView)findViewById(R.id.detail22); 21 | t3=(TextView)findViewById(R.id.detail33); 22 | t4=(TextView)findViewById(R.id.detail44); 23 | t5=(TextView)findViewById(R.id.detail55); 24 | t6=(TextView)findViewById(R.id.detail66); 25 | t7=(TextView)findViewById(R.id.detail77); 26 | t8=(TextView)findViewById(R.id.detail88); 27 | t9=(TextView)findViewById(R.id.detail99); 28 | goback=(Button)findViewById(R.id.but1); 29 | 30 | Bundle b=getIntent().getExtras(); 31 | t1.setText(b.getString("name")); 32 | t2.setText(String.valueOf(b.getInt("age"))); 33 | t3.setText(String.valueOf(b.getLong("mobileno"))); 34 | t4.setText(b.getString("tickettype")); 35 | t5.setText(b.getString("servicetype")); 36 | t6.setText(b.getString("departure")); 37 | t7.setText(b.getString("arrival")); 38 | t8.setText(b.getString("dates")); 39 | t9.setText(b.getString("times")); 40 | 41 | goback.setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View v) { 44 | Intent int2=new Intent(CandidateDetails.this,MainActivity.class); 45 | startActivity(int2); 46 | } 47 | }); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/Channel.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import android.app.Application; 4 | import android.app.NotificationChannel; 5 | import android.app.NotificationManager; 6 | import android.os.Build; 7 | 8 | public class Channel extends Application { 9 | public static final String CHANNEL_ID = "channel"; 10 | 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | createNotification(); 15 | } 16 | 17 | public void createNotification(){ 18 | if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){ 19 | NotificationChannel notificationChannel = new NotificationChannel( 20 | CHANNEL_ID, 21 | "Channel", 22 | NotificationManager.IMPORTANCE_HIGH 23 | ); 24 | NotificationManager notificationManager = getSystemService(NotificationManager.class); 25 | notificationManager.createNotificationChannel(notificationChannel); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/DBHelper.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Context; 5 | import android.database.Cursor; 6 | import android.database.sqlite.SQLiteDatabase; 7 | import android.database.sqlite.SQLiteOpenHelper; 8 | import android.util.Log; 9 | 10 | public class DBHelper { 11 | public static final String DATABASE_NAME = "ticketdetails"; 12 | public static final int DATABASE_VERSION = 1; 13 | public static final String TABLE_NAME = "candidatedetails"; 14 | public static final String KEY_ID = "_id"; 15 | public static final String COL_NAME = "Name"; 16 | public static final String COL_NAME1 = "Age"; 17 | public static final String COL_NAME2 = "Mobile_No"; 18 | public static final String COL_NAME3 = "Ticket_Type"; 19 | public static final String COL_NAME4 = "Service_Type"; 20 | public static final String COL_NAME5 = "Departure"; 21 | public static final String COL_NAME6 = "Arrival"; 22 | public static final String COL_NAME7 = "Date"; 23 | public static final String COL_NAME8 = "Time"; 24 | public static final int COL_INDEX = 1; 25 | 26 | private static final String DB_CREATE; 27 | 28 | static { 29 | DB_CREATE = "CREATE TABLE " + TABLE_NAME + "(" 30 | + KEY_ID + " INTEGER PRIMARY KEY autoincrement, " 31 | + COL_NAME + " TEXT NOT NULL," 32 | + COL_NAME1 + " INTEGER NOT NULL," 33 | + COL_NAME2 + " INTEGER NOT NULL," 34 | + COL_NAME3 + " TEXT NOT NULL," 35 | + COL_NAME4 + " TEXT NOT NULL," 36 | + COL_NAME5 + " TEXT NOT NULL," 37 | + COL_NAME6 + " TEXT NOT NULL," 38 | + COL_NAME7 + " TEXT NOT NULL," 39 | + COL_NAME8 + " TEXT NOT NULL" + ")"; 40 | } 41 | 42 | private SQLiteDatabase database; 43 | private final Context context; 44 | private MyDBAdapter helper; 45 | 46 | public DBHelper(Context context) 47 | { 48 | this.context = context; 49 | helper = new MyDBAdapter(context,DATABASE_NAME, 50 | null, DATABASE_VERSION); 51 | } 52 | public DBHelper open() 53 | { 54 | database = helper.getWritableDatabase(); 55 | //Create and/or open a database that will be used for 56 | // reading and writing. 57 | return this; 58 | } 59 | 60 | public void close() 61 | { 62 | database.close(); 63 | } 64 | 65 | public long insertEntry(String Name, Integer Age, Long MobileNo, String TicketType, String ServiceType, String Depart, String Arrive, String Date, String Time) { 66 | 67 | ContentValues contentValues=new ContentValues(); 68 | contentValues.put(COL_NAME,Name); 69 | contentValues.put(COL_NAME1,Age); 70 | contentValues.put(COL_NAME2,MobileNo); 71 | contentValues.put(COL_NAME3,TicketType); 72 | contentValues.put(COL_NAME4,ServiceType); 73 | contentValues.put(COL_NAME5,Depart); 74 | contentValues.put(COL_NAME6,Arrive); 75 | contentValues.put(COL_NAME7,Date); 76 | contentValues.put(COL_NAME8,Time); 77 | return database.insert(TABLE_NAME, 78 | null, contentValues); 79 | /*nullColumnHack: 80 | nullColumnHack optional; may be null. 81 | SQL doesn't allow inserting a completely 82 | empty row without naming at least one column name. 83 | If your provided values is empty, 84 | no column names are known and 85 | an empty row can't be inserted. 86 | If not set to null, the nullColumnHack parameter 87 | provides the name of nullable column name 88 | to explicitly insert a NULL into in the case 89 | where your values is empty. 90 | For example, you want to insert an empty row into 91 | a table student(id, name), which id is auto generated 92 | and name is null. You could invoke like this: 93 | ContentValues cv = new ContentValues(); 94 | db.insert("student", "name", cv); 95 | */ 96 | } 97 | public boolean removeEntry(long rowIndex) { 98 | System.out.print(rowIndex); 99 | return database.delete(TABLE_NAME, 100 | KEY_ID+" = "+rowIndex, 101 | null)>0; 102 | } 103 | 104 | public Cursor getAllEntries() { 105 | return database.query(TABLE_NAME, 106 | new String[]{KEY_ID,COL_NAME,COL_NAME1,COL_NAME2,COL_NAME3,COL_NAME4,COL_NAME5,COL_NAME6,COL_NAME7,COL_NAME8}, 107 | null, null, 108 | null, null, null); 109 | } 110 | 111 | 112 | public static class MyDBAdapter extends SQLiteOpenHelper 113 | { 114 | 115 | public MyDBAdapter(Context context, String name, 116 | SQLiteDatabase.CursorFactory factory, 117 | int version) { 118 | super(context, name, factory, version); 119 | //Create a helper object to create, 120 | // open, and/or manage a database. 121 | // The reason of passing null is you want the standard SQLiteCursor behaviour. 122 | // If you want to implement a specialized Cursor you can get it by by extending the Cursor class( this is for doing additional operations on the query results). 123 | // And in these cases, you can use the CursorFactory class to return an instance of your Cursor implementation. 124 | } 125 | @Override 126 | public void onCreate(SQLiteDatabase db) { 127 | db.execSQL(DB_CREATE); 128 | //Called when the database is created 129 | // for the first time. 130 | } 131 | @Override 132 | public void onUpgrade(SQLiteDatabase db, 133 | int oldVersion, 134 | int newVersion) { 135 | Log.w("Updation", "Data base version is being updates"); 136 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); 137 | onCreate(db); 138 | } 139 | } 140 | } 141 | 142 | 143 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/Listofcandidates.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.appcompat.app.AlertDialog; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | 6 | import android.content.DialogInterface; 7 | import android.content.Intent; 8 | import android.database.Cursor; 9 | import android.os.Bundle; 10 | import android.view.View; 11 | import android.widget.AdapterView; 12 | import android.widget.ArrayAdapter; 13 | import android.widget.ListAdapter; 14 | import android.widget.ListView; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | public class Listofcandidates extends AppCompatActivity 20 | implements AdapterView.OnItemClickListener { 21 | 22 | private List username,tickettype,servicetype,departure,arrival,dates,times,combination; 23 | private List idList,ages; 24 | private List mobileno; 25 | int updateIndex; 26 | String updateusername; 27 | int updateage; 28 | long updatemobileno; 29 | String updatetickettype; 30 | String updateservicetype; 31 | String updatedeparture; 32 | String updatearrival; 33 | String updatedates; 34 | String updatetimes; 35 | ListAdapter la; 36 | ListView lv; 37 | DBHelper dhelper; 38 | 39 | @Override 40 | protected void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | setContentView(R.layout.activity_listofcandidates); 43 | lv = (ListView)findViewById(R.id.listView); 44 | combination=new ArrayList(); 45 | username=new ArrayList(); 46 | ages=new ArrayList(); 47 | mobileno=new ArrayList(); 48 | tickettype=new ArrayList(); 49 | servicetype=new ArrayList(); 50 | departure=new ArrayList(); 51 | arrival=new ArrayList(); 52 | dates=new ArrayList(); 53 | times=new ArrayList(); 54 | idList = new ArrayList(); 55 | dhelper = new DBHelper(this); 56 | dhelper.open(); 57 | Cursor c = dhelper.getAllEntries(); 58 | c.moveToFirst(); 59 | for (int i =0; i(this, 76 | android.R.layout.simple_expandable_list_item_1, 77 | combination); 78 | lv.setAdapter(la); 79 | lv.setOnItemClickListener(this); 80 | dhelper.close(); 81 | } 82 | @Override 83 | protected void onResume() { 84 | super.onResume(); 85 | dhelper = new DBHelper(this); 86 | dhelper.open(); 87 | combination.clear(); 88 | idList.clear(); 89 | username.clear(); 90 | ages.clear(); 91 | mobileno.clear(); 92 | tickettype.clear(); 93 | servicetype.clear(); 94 | departure.clear(); 95 | arrival.clear(); 96 | dates.clear(); 97 | times.clear(); 98 | Cursor c1 = dhelper.getAllEntries(); 99 | c1.moveToFirst(); 100 | for (int i =0; i(this,android.R.layout.simple_expandable_list_item_1,combination); 118 | lv.setAdapter(la); 119 | lv.setOnItemClickListener(this); 120 | } 121 | 122 | @Override 123 | public void onItemClick(AdapterView parent, View view, int position, long id) { 124 | final int indexvalue = idList.get(position); 125 | dhelper = new DBHelper(this); 126 | dhelper.open(); 127 | updateIndex = idList.get(position); 128 | updateusername = username.get(position); 129 | updateage = ages.get(position); 130 | updatemobileno = mobileno.get(position); 131 | updatetickettype = tickettype.get(position); 132 | updateservicetype = servicetype.get(position); 133 | updatedeparture = departure.get(position); 134 | updatearrival = arrival.get(position); 135 | updatedates = dates.get(position); 136 | updatetimes = times.get(position); 137 | AlertDialog.Builder dialog = new AlertDialog.Builder(this); 138 | dialog.setTitle("Delete"); 139 | dialog.setMessage("Do you want to delete "+ username.get(position) + " " + indexvalue); 140 | dialog.setPositiveButton("Delete", new DialogInterface.OnClickListener() { 141 | @Override 142 | public void onClick(DialogInterface dialogInterface, int i) { 143 | boolean result = dhelper.removeEntry(indexvalue); 144 | dhelper.close(); 145 | onResume(); 146 | } 147 | }); 148 | 149 | dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 150 | @Override 151 | public void onClick(DialogInterface dialogInterface, int i) { 152 | dhelper.close(); 153 | onResume(); 154 | } 155 | }); 156 | 157 | dialog.setNeutralButton("Show Details", new DialogInterface.OnClickListener() { 158 | public void onClick(DialogInterface dlg, int sumthin) { 159 | Bundle b = new Bundle(); 160 | b.putString("name",updateusername); 161 | b.putInt("age",updateage); 162 | b.putLong("mobileno",updatemobileno); 163 | b.putString("tickettype",updatetickettype); 164 | b.putString("servicetype",updateservicetype); 165 | b.putString("departure",updatedeparture); 166 | b.putString("arrival",updatearrival); 167 | b.putString("dates",updatedates); 168 | b.putString("times",updatetimes); 169 | 170 | Intent int1 = new Intent(Listofcandidates.this,CandidateDetails.class); 171 | int1.putExtras(b); 172 | startActivity(int1); 173 | } 174 | }); 175 | 176 | dialog.create(); 177 | dialog.show(); 178 | 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | 6 | import android.app.ProgressDialog; 7 | import android.content.Intent; 8 | import android.os.Bundle; 9 | import android.view.View; 10 | import android.widget.Button; 11 | import android.widget.EditText; 12 | import android.widget.TextView; 13 | import android.widget.Toast; 14 | 15 | import com.google.android.gms.tasks.OnCompleteListener; 16 | import com.google.android.gms.tasks.Task; 17 | import com.google.firebase.auth.AuthResult; 18 | import com.google.firebase.auth.FirebaseAuth; 19 | import com.google.firebase.auth.FirebaseUser; 20 | 21 | public class MainActivity extends AppCompatActivity { 22 | 23 | EditText email,password; 24 | Button login; 25 | TextView newuser; 26 | FirebaseAuth firebaseAuth; 27 | ProgressDialog progressDialog; 28 | TextView changepass; 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_main); 33 | firebaseAuth=FirebaseAuth.getInstance(); 34 | FirebaseUser user=firebaseAuth.getCurrentUser(); 35 | if(user!=null) 36 | { 37 | Intent intent=new Intent(this,a.class); 38 | startActivity(intent); 39 | } 40 | email=(EditText)findViewById(R.id.semail); 41 | password=(EditText)findViewById(R.id.spassword); 42 | login=(Button)findViewById(R.id.slogin); 43 | newuser=(TextView) findViewById(R.id.snewuser); 44 | progressDialog=new ProgressDialog(this); 45 | 46 | changepass=(TextView)findViewById(R.id.sforgotpassword); 47 | changepass.setOnClickListener(new View.OnClickListener() { 48 | @Override 49 | public void onClick(View v) { 50 | Intent intent=new Intent(MainActivity.this,changepassword.class); 51 | startActivity(intent); 52 | } 53 | }); 54 | 55 | newuser.setOnClickListener(new View.OnClickListener() { 56 | @Override 57 | public void onClick(View v) { 58 | Intent intent=new Intent(MainActivity.this,Newuser.class); 59 | startActivity(intent); 60 | } 61 | }); 62 | 63 | login.setOnClickListener(new View.OnClickListener() { 64 | @Override 65 | public void onClick(View v) { 66 | String uemail = email.getText().toString().trim(); 67 | String upass = password.getText().toString().trim(); 68 | if (uemail.isEmpty() || upass.isEmpty()) { 69 | Toast.makeText(MainActivity.this, "Enter all dedtails", Toast.LENGTH_SHORT).show(); 70 | } else { 71 | progressDialog.setMessage("Verifying email and password"); 72 | progressDialog.show(); 73 | firebaseAuth.signInWithEmailAndPassword(uemail, upass).addOnCompleteListener(new OnCompleteListener() { 74 | @Override 75 | public void onComplete(@NonNull Task task) { 76 | if (task.isSuccessful()) { 77 | progressDialog.dismiss(); 78 | checkEmailverification(); 79 | } else { 80 | progressDialog.dismiss(); 81 | Toast.makeText(MainActivity.this, "email or password is incorrect", Toast.LENGTH_SHORT).show(); 82 | } 83 | } 84 | }); } 85 | } 86 | }); 87 | } 88 | private void checkEmailverification() 89 | { 90 | FirebaseUser firebaseUser=firebaseAuth.getCurrentUser(); 91 | Boolean emailflag=firebaseUser.isEmailVerified(); 92 | if(emailflag==true) 93 | { finish(); 94 | Intent intent=new Intent(this,a.class); 95 | startActivity(intent); 96 | } 97 | else 98 | { 99 | Toast.makeText(this,"Please verify your email",Toast.LENGTH_SHORT).show(); 100 | firebaseAuth.signOut(); 101 | } 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/MainActivity1.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.app.DatePickerDialog; 6 | import android.app.LoaderManager; 7 | import android.app.TimePickerDialog; 8 | import android.content.Intent; 9 | import android.database.Cursor; 10 | import android.os.Bundle; 11 | import android.view.View; 12 | import android.widget.AdapterView; 13 | import android.widget.ArrayAdapter; 14 | import android.widget.Button; 15 | import android.widget.DatePicker; 16 | import android.widget.EditText; 17 | import android.widget.Spinner; 18 | import android.widget.Switch; 19 | import android.widget.TextView; 20 | import android.widget.TimePicker; 21 | import android.widget.Toast; 22 | 23 | import java.util.Calendar; 24 | 25 | public class MainActivity1 extends AppCompatActivity implements 26 | TimePickerDialog.OnTimeSetListener, 27 | DatePickerDialog.OnDateSetListener, AdapterView.OnItemSelectedListener, View.OnClickListener { 28 | private TextView mDateText, mTimeText; 29 | private Calendar mCalendar; 30 | private int mYear, mMonth, mHour, mMinute, mDay; 31 | 32 | private EditText UserName, UserAge, UserMobileNo; 33 | private Spinner TicketType, ServiceType, City1, City2; 34 | private Button BookTicket1, BookedTicket1; 35 | private String mMessage; 36 | private String mTime; 37 | private String mDate; 38 | 39 | private String[] Ticket; 40 | private String[] ServiceTrain; 41 | private String[] ServiceBus; 42 | private String[] ServiceFlight; 43 | private String[] ServiceConcert; 44 | private String[] Concert; 45 | private String[] ListOfCities; 46 | 47 | @Override 48 | protected void onCreate(Bundle savedInstanceState) { 49 | super.onCreate(savedInstanceState); 50 | setContentView(R.layout.activity_main1); 51 | 52 | UserName = (EditText)findViewById(R.id.user_name); 53 | UserAge = (EditText)findViewById(R.id.lage); 54 | UserMobileNo = (EditText)findViewById(R.id.lmobile); 55 | mDateText = (TextView) findViewById(R.id.set_date); 56 | mTimeText = (TextView) findViewById(R.id.set_time); 57 | BookTicket1 = (Button) findViewById(R.id.bookticket2); 58 | BookTicket1.setOnClickListener(this); 59 | BookedTicket1 = (Button) findViewById(R.id.bookedticket); 60 | BookedTicket1.setOnClickListener(this); 61 | 62 | Ticket = getResources().getStringArray(R.array.ticket_type); 63 | ServiceTrain = getResources().getStringArray(R.array.train_type); 64 | ServiceBus = getResources().getStringArray(R.array.bus_type); 65 | ServiceFlight = getResources().getStringArray(R.array.flight_type); 66 | ServiceConcert = getResources().getStringArray(R.array.live_concert); 67 | Concert = getResources().getStringArray(R.array.person_in_concert); 68 | ListOfCities = getResources().getStringArray(R.array.india_top_places); 69 | 70 | mCalendar = Calendar.getInstance(); 71 | mHour = mCalendar.get(Calendar.HOUR_OF_DAY); 72 | mMinute = mCalendar.get(Calendar.MINUTE); 73 | mYear = mCalendar.get(Calendar.YEAR); 74 | mMonth = mCalendar.get(Calendar.MONTH) + 1; 75 | mDay = mCalendar.get(Calendar.DATE); 76 | 77 | mDate = mDay + "/" + mMonth + "/" + mYear; 78 | mTime = mHour + ":" + mMinute; 79 | 80 | mDateText.setText(mDate); 81 | mTimeText.setText(mTime); 82 | 83 | TicketType = (Spinner)findViewById(R.id.spinner1); 84 | ServiceType = (Spinner)findViewById(R.id.spinner2); 85 | City1 = (Spinner)findViewById(R.id.spinner3); 86 | City2 = (Spinner)findViewById(R.id.spinner4); 87 | ArrayAdapteradapter = new ArrayAdapter(MainActivity1.this, 88 | android.R.layout.simple_spinner_item,Ticket); 89 | 90 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 91 | TicketType.setPrompt("Select a Service for Ticket"); 92 | 93 | TicketType.setAdapter( 94 | new NothingSelectedSpinnerAdapter( 95 | adapter, 96 | R.layout.contact_spinner_row_nothing_selected, 97 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 98 | this)); 99 | //TicketType.setAdapter(adapter); 100 | TicketType.setOnItemSelectedListener(this); 101 | } 102 | 103 | // On clicking Time picker 104 | public void setTime(View v){ 105 | // TODO Auto-generated method stub 106 | Calendar mcurrentTime = Calendar.getInstance(); 107 | int hour = mcurrentTime.get(Calendar.HOUR_OF_DAY); 108 | int minute = mcurrentTime.get(Calendar.MINUTE); 109 | TimePickerDialog mTimePicker; 110 | mTimePicker = new TimePickerDialog(MainActivity1.this, new TimePickerDialog.OnTimeSetListener() { 111 | @Override 112 | public void onTimeSet(TimePicker timePicker, int hourOfDay, int minute) { 113 | mHour = hourOfDay; 114 | mMinute = minute; 115 | if (minute < 10) { 116 | if (hourOfDay > 11) { 117 | if (hourOfDay > 12) { 118 | hourOfDay = hourOfDay - 12; 119 | } 120 | mTime = hourOfDay + ":" + "0" + minute + " PM"; 121 | } 122 | else { 123 | if (hourOfDay == 0){ 124 | hourOfDay = hourOfDay + 12; 125 | } 126 | mTime = hourOfDay + ":" + "0" + minute + " AM"; 127 | } 128 | } else { 129 | if (hourOfDay > 11) { 130 | if (hourOfDay > 12) { 131 | hourOfDay = hourOfDay - 12; 132 | } 133 | mTime = hourOfDay + ":" + minute + " PM"; 134 | } 135 | else { 136 | if (hourOfDay == 0){ 137 | hourOfDay = hourOfDay + 12; 138 | } 139 | mTime = hourOfDay + ":" + minute + " AM"; 140 | } 141 | } 142 | mTimeText.setText(mTime); 143 | } 144 | }, hour, minute, true);//Yes 24 hour time 145 | mTimePicker.setTitle("Select Time"); 146 | mTimePicker.show(); 147 | } 148 | 149 | // On clicking Date picker 150 | public void setDate(View v){ 151 | Calendar mcurrentDate = Calendar.getInstance(); 152 | int mmYear = mcurrentDate.get(Calendar.YEAR); 153 | int mmMonth = mcurrentDate.get(Calendar.MONTH); 154 | int mmDay = mcurrentDate.get(Calendar.DAY_OF_MONTH); 155 | 156 | DatePickerDialog mDatePicker; 157 | mDatePicker = new DatePickerDialog(MainActivity1.this, new DatePickerDialog.OnDateSetListener() { 158 | public void onDateSet(DatePicker datepicker, int year, int monthOfYear, int dayOfMonth) { 159 | monthOfYear ++; 160 | mDay = dayOfMonth; 161 | mMonth = monthOfYear; 162 | mYear = year; 163 | mDate = dayOfMonth + "/" + monthOfYear + "/" + year; 164 | mDateText.setText(mDate); 165 | } 166 | }, mmYear, mmMonth, mmDay); 167 | mDatePicker.setTitle("Select Date"); 168 | mDatePicker.show(); 169 | } 170 | 171 | @Override 172 | public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { 173 | month ++; 174 | mDay = dayOfMonth; 175 | mMonth = month; 176 | mYear = year; 177 | mDate = dayOfMonth + "/" + month + "/" + year; 178 | mDateText.setText(mDate); 179 | } 180 | 181 | @Override 182 | public void onTimeSet(TimePicker view, int hourOfDay, int minute) { 183 | mHour = hourOfDay; 184 | mMinute = minute; 185 | if (minute < 10) { 186 | if (hourOfDay > 11) { 187 | if (hourOfDay > 12) { 188 | hourOfDay = hourOfDay - 12; 189 | } 190 | mTime = hourOfDay + ":" + "0" + minute + " PM"; 191 | } 192 | else { 193 | if (hourOfDay == 0){ 194 | hourOfDay = hourOfDay + 12; 195 | } 196 | mTime = hourOfDay + ":" + "0" + minute + " AM"; 197 | } 198 | } else { 199 | if (hourOfDay > 11) { 200 | if (hourOfDay > 12) { 201 | hourOfDay = hourOfDay - 12; 202 | } 203 | mTime = hourOfDay + ":" + minute + " PM"; 204 | } 205 | else { 206 | if (hourOfDay == 0){ 207 | hourOfDay = hourOfDay + 12; 208 | } 209 | mTime = hourOfDay + ":" + minute + " AM"; 210 | } 211 | } 212 | mTimeText.setText(mTime); 213 | } 214 | 215 | @Override 216 | public void onItemSelected(AdapterView parent, View v, int position, long id) { 217 | //String selectedClass = parent.getItemAtPosition(position).toString(); 218 | switch (parent.getId()) { 219 | case R.id.spinner1: 220 | switch (position) { 221 | case 1: 222 | // Whatever you want to happen when the first item gets selected 223 | ServiceType.setVisibility(View.VISIBLE); 224 | ArrayAdapter adapter1 = new ArrayAdapter(MainActivity1.this, 225 | android.R.layout.simple_spinner_item, ServiceBus); 226 | 227 | adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 228 | 229 | ServiceType.setAdapter( 230 | new NothingSelectedSpinnerAdapter( 231 | adapter1, 232 | R.layout.contact_spinner_row_nothing_selected1, 233 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 234 | this)); 235 | //TicketType.setAdapter(adapter); 236 | ServiceType.setOnItemSelectedListener(this); 237 | break; 238 | case 2: 239 | // Whatever you want to happen when the second item gets selected 240 | ServiceType.setVisibility(View.VISIBLE); 241 | ArrayAdapter adapter2 = new ArrayAdapter(MainActivity1.this, 242 | android.R.layout.simple_spinner_item, ServiceTrain); 243 | 244 | adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 245 | 246 | ServiceType.setAdapter( 247 | new NothingSelectedSpinnerAdapter( 248 | adapter2, 249 | R.layout.contact_spinner_row_nothing_selected2, 250 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 251 | this)); 252 | //TicketType.setAdapter(adapter); 253 | ServiceType.setOnItemSelectedListener(this); 254 | break; 255 | case 3: 256 | // Whatever you want to happen when the thrid item gets selected 257 | ServiceType.setVisibility(View.VISIBLE); 258 | ArrayAdapter adapter3 = new ArrayAdapter(MainActivity1.this, 259 | android.R.layout.simple_spinner_item, ServiceFlight); 260 | 261 | adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 262 | 263 | ServiceType.setAdapter( 264 | new NothingSelectedSpinnerAdapter( 265 | adapter3, 266 | R.layout.contact_spinner_row_nothing_selected3, 267 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 268 | this)); 269 | //TicketType.setAdapter(adapter); 270 | ServiceType.setOnItemSelectedListener(this); 271 | break; 272 | } 273 | break; 274 | case R.id.spinner2: 275 | City1.setVisibility(View.VISIBLE); 276 | City2.setVisibility(View.VISIBLE); 277 | ArrayAdapter adapter1 = new ArrayAdapter(MainActivity1.this, 278 | android.R.layout.simple_spinner_item, ListOfCities); 279 | 280 | adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 281 | 282 | ArrayAdapter adapter2 = new ArrayAdapter(MainActivity1.this, 283 | android.R.layout.simple_spinner_item, ListOfCities); 284 | 285 | adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 286 | 287 | City1.setAdapter( 288 | new NothingSelectedSpinnerAdapter( 289 | adapter1, 290 | R.layout.contact_spinner_row_nothing_selected_arr, 291 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 292 | this)); 293 | City1.setOnItemSelectedListener(this); 294 | City2.setAdapter( 295 | new NothingSelectedSpinnerAdapter( 296 | adapter2, 297 | R.layout.contact_spinner_row_nothing_selected_dept, 298 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 299 | this)); 300 | City2.setOnItemSelectedListener(this); 301 | break; 302 | } 303 | } 304 | 305 | @Override 306 | public void onNothingSelected(AdapterView parent) { 307 | 308 | } 309 | 310 | @Override 311 | public void onClick(View v) { 312 | int id=v.getId(); 313 | switch (id) { 314 | case R.id.bookticket2: 315 | String temp = UserName.getText().toString(); 316 | String temp1 = UserAge.getText().toString(); 317 | String temp2 = UserMobileNo.getText().toString(); 318 | String temp3 = TicketType.getSelectedItem().toString(); 319 | String temp4 = ServiceType.getSelectedItem().toString(); 320 | String temp5 = City1.getSelectedItem().toString(); 321 | String temp6 = City2.getSelectedItem().toString(); 322 | String temp7 = mDateText.getText().toString(); 323 | String temp8 = mTimeText.getText().toString(); 324 | if (temp.equals("") || temp == null || temp.length() == 0 || 325 | temp1.equals("") || temp1 == null || temp1.length() == 0 || 326 | temp2.equals("") || temp2 == null || temp2.length() == 0 || 327 | temp3.equals("") || temp3 == null || temp3.length() == 0 || 328 | temp4.equals("") || temp4 == null || temp4.length() == 0 || 329 | temp5.equals("") || temp5 == null || temp5.length() == 0 || 330 | temp6.equals("") || temp6 == null || temp6.length() == 0 || 331 | temp7.equals("") || temp7 == null || temp7.length() == 0 || 332 | temp8.equals("") || temp8 == null || temp8.length() == 0) { 333 | Toast.makeText(this, "Some Field is Empty", Toast.LENGTH_LONG).show(); 334 | } else { 335 | DBHelper addb1 = new DBHelper(this); 336 | addb1.open(); 337 | addb1.insertEntry(UserName.getText().toString(), Integer.parseInt(UserAge.getText().toString()), Long.parseLong(UserMobileNo.getText().toString()), TicketType.getSelectedItem().toString(), ServiceType.getSelectedItem().toString(), City1.getSelectedItem().toString(), City2.getSelectedItem().toString(), mDateText.getText().toString(), mTimeText.getText().toString()); 338 | addb1.close(); 339 | Intent i1 = new Intent(MainActivity1.this , Receiver.class); 340 | Bundle b = new Bundle(); 341 | b.putString("name",UserName.getText().toString()); 342 | b.putInt("age",Integer.parseInt(UserAge.getText().toString())); 343 | b.putLong("mobileno",Long.parseLong(UserMobileNo.getText().toString())); 344 | b.putString("tickettype",TicketType.getSelectedItem().toString()); 345 | b.putString("servicetype",ServiceType.getSelectedItem().toString()); 346 | b.putString("departure",City1.getSelectedItem().toString()); 347 | b.putString("arrival",City2.getSelectedItem().toString()); 348 | b.putString("dates",mDateText.getText().toString()); 349 | b.putString("times",mTimeText.getText().toString()); 350 | i1.putExtras(b); 351 | sendBroadcast(i1); 352 | UserName.setText(""); 353 | UserAge.setText(""); 354 | UserMobileNo.setText(""); 355 | mDateText.setText(""); 356 | mTimeText.setText(""); 357 | ArrayAdapteradapter = new ArrayAdapter(MainActivity1.this, 358 | android.R.layout.simple_spinner_item,Ticket); 359 | 360 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 361 | TicketType.setPrompt("Select a Service for Ticket"); 362 | TicketType.setAdapter( 363 | new NothingSelectedSpinnerAdapter( 364 | adapter, 365 | R.layout.contact_spinner_row_nothing_selected, 366 | // R.layout.contact_spinner_nothing_selected_dropdown, // Optional 367 | this)); 368 | TicketType.setOnItemSelectedListener(this); 369 | ServiceType.setVisibility(View.GONE); 370 | City1.setVisibility(View.GONE); 371 | City2.setVisibility(View.GONE); 372 | Toast.makeText(this, "Ticket Booked Successfully, Proceed With Your Payment Later", Toast.LENGTH_LONG).show(); 373 | 374 | } 375 | break; 376 | case R.id.bookedticket: 377 | Intent int1=new Intent(MainActivity1.this,Listofcandidates.class); 378 | startActivity(int1); 379 | break; 380 | } 381 | } 382 | } 383 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/Newuser.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | import android.widget.ImageView; 12 | import android.widget.TextView; 13 | import android.widget.Toast; 14 | 15 | import com.google.android.gms.tasks.OnCompleteListener; 16 | import com.google.android.gms.tasks.Task; 17 | import com.google.firebase.auth.AuthResult; 18 | import com.google.firebase.auth.FirebaseAuth; 19 | import com.google.firebase.auth.FirebaseUser; 20 | import com.google.firebase.database.DatabaseReference; 21 | import com.google.firebase.database.FirebaseDatabase; 22 | 23 | public class Newuser extends AppCompatActivity { 24 | EditText username,useremail,userpassword,userage; 25 | Button usersignup; 26 | TextView userlogin; 27 | FirebaseAuth firebaseAuth; 28 | ImageView userprofile; 29 | 30 | String uname,uemail,uage; 31 | @Override 32 | protected void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.activity_newuser); 35 | firebaseAuth=FirebaseAuth.getInstance(); 36 | 37 | username=(EditText)findViewById(R.id.user_name); 38 | useremail=(EditText)findViewById(R.id.lemail); 39 | userpassword=(EditText)findViewById(R.id.lpassword); 40 | usersignup=(Button)findViewById(R.id.signup); 41 | userlogin=(TextView)findViewById(R.id.login); 42 | 43 | userage=(EditText)findViewById(R.id.lage); 44 | userprofile=(ImageView)findViewById(R.id.profile_image); 45 | 46 | usersignup.setOnClickListener(new View.OnClickListener() { 47 | @Override 48 | public void onClick(View v) { 49 | uname=username.getText().toString().trim(); 50 | uemail=useremail.getText().toString().trim(); 51 | uage=userage.getText().toString().trim(); 52 | String upassword=userpassword.getText().toString().trim(); 53 | 54 | if(uname.isEmpty() || uemail.isEmpty() || upassword.isEmpty()|| uage.isEmpty()) 55 | { 56 | Toast.makeText(Newuser.this,"Please fill all details",Toast.LENGTH_SHORT).show(); 57 | } 58 | else 59 | { 60 | firebaseAuth.createUserWithEmailAndPassword(uemail,upassword).addOnCompleteListener(new OnCompleteListener() { 61 | @Override 62 | public void onComplete(@NonNull Task task) { 63 | if(task.isSuccessful()) 64 | { 65 | sendEmailVerification1(); 66 | } 67 | else 68 | { 69 | Toast.makeText(Newuser.this,"Registation failed",Toast.LENGTH_SHORT).show(); 70 | } 71 | } 72 | }); 73 | } 74 | } 75 | }); 76 | 77 | userlogin.setOnClickListener(new View.OnClickListener() { 78 | @Override 79 | public void onClick(View v) { 80 | Intent intent=new Intent(Newuser.this,MainActivity.class); 81 | startActivity(intent); 82 | } 83 | }); 84 | } 85 | 86 | private void sendEmailVerification1() 87 | { 88 | final FirebaseUser firebaseUser=firebaseAuth.getCurrentUser(); 89 | if(firebaseUser!=null) 90 | { 91 | firebaseUser.sendEmailVerification().addOnCompleteListener(new OnCompleteListener() { 92 | @Override 93 | public void onComplete(@NonNull Task task) { 94 | if(task.isSuccessful()){ 95 | Toast.makeText(Newuser.this,"Succesfully registered,verfication mail is sent",Toast.LENGTH_SHORT).show(); 96 | firebaseAuth.signOut(); 97 | finish(); 98 | Intent intent=new Intent(Newuser.this,MainActivity.class); 99 | startActivity(intent); 100 | } 101 | else 102 | { 103 | Toast.makeText(Newuser.this,"Verification mail isn't sent",Toast.LENGTH_SHORT).show(); 104 | } 105 | } 106 | }); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/NothingSelectedSpinnerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import android.content.Context; 4 | import android.database.DataSetObserver; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ListAdapter; 9 | import android.widget.SpinnerAdapter; 10 | 11 | /** 12 | * Decorator Adapter to allow a Spinner to show a 'Nothing Selected...' initially 13 | * displayed instead of the first choice in the Adapter. 14 | */ 15 | public class NothingSelectedSpinnerAdapter implements SpinnerAdapter, ListAdapter { 16 | 17 | protected static final int EXTRA = 1; 18 | protected SpinnerAdapter adapter; 19 | protected Context context; 20 | protected int nothingSelectedLayout; 21 | protected int nothingSelectedDropdownLayout; 22 | protected LayoutInflater layoutInflater; 23 | 24 | /** 25 | * Use this constructor to have NO 'Select One...' item, instead use 26 | * the standard prompt or nothing at all. 27 | * @param spinnerAdapter wrapped Adapter. 28 | * @param nothingSelectedLayout layout for nothing selected, perhaps 29 | * you want text grayed out like a prompt... 30 | * @param context 31 | */ 32 | public NothingSelectedSpinnerAdapter( 33 | SpinnerAdapter spinnerAdapter, 34 | int nothingSelectedLayout, Context context) { 35 | 36 | this(spinnerAdapter, nothingSelectedLayout, -1, context); 37 | } 38 | 39 | /** 40 | * Use this constructor to Define your 'Select One...' layout as the first 41 | * row in the returned choices. 42 | * If you do this, you probably don't want a prompt on your spinner or it'll 43 | * have two 'Select' rows. 44 | * @param spinnerAdapter wrapped Adapter. Should probably return false for isEnabled(0) 45 | * @param nothingSelectedLayout layout for nothing selected, perhaps you want 46 | * text grayed out like a prompt... 47 | * @param nothingSelectedDropdownLayout layout for your 'Select an Item...' in 48 | * the dropdown. 49 | * @param context 50 | */ 51 | public NothingSelectedSpinnerAdapter(SpinnerAdapter spinnerAdapter, 52 | int nothingSelectedLayout, int nothingSelectedDropdownLayout, Context context) { 53 | this.adapter = spinnerAdapter; 54 | this.context = context; 55 | this.nothingSelectedLayout = nothingSelectedLayout; 56 | this.nothingSelectedDropdownLayout = nothingSelectedDropdownLayout; 57 | layoutInflater = LayoutInflater.from(context); 58 | } 59 | 60 | @Override 61 | public final View getView(int position, View convertView, ViewGroup parent) { 62 | // This provides the View for the Selected Item in the Spinner, not 63 | // the dropdown (unless dropdownView is not set). 64 | if (position == 0) { 65 | return getNothingSelectedView(parent); 66 | } 67 | return adapter.getView(position - EXTRA, null, parent); // Could re-use 68 | // the convertView if possible. 69 | } 70 | 71 | /** 72 | * View to show in Spinner with Nothing Selected 73 | * Override this to do something dynamic... e.g. "37 Options Found" 74 | * @param parent 75 | * @return 76 | */ 77 | protected View getNothingSelectedView(ViewGroup parent) { 78 | return layoutInflater.inflate(nothingSelectedLayout, parent, false); 79 | } 80 | 81 | @Override 82 | public View getDropDownView(int position, View convertView, ViewGroup parent) { 83 | // Android BUG! http://code.google.com/p/android/issues/detail?id=17128 - 84 | // Spinner does not support multiple view types 85 | if (position == 0) { 86 | return nothingSelectedDropdownLayout == -1 ? 87 | new View(context) : 88 | getNothingSelectedDropdownView(parent); 89 | } 90 | 91 | // Could re-use the convertView if possible, use setTag... 92 | return adapter.getDropDownView(position - EXTRA, null, parent); 93 | } 94 | 95 | /** 96 | * Override this to do something dynamic... For example, "Pick your favorite 97 | * of these 37". 98 | * @param parent 99 | * @return 100 | */ 101 | protected View getNothingSelectedDropdownView(ViewGroup parent) { 102 | return layoutInflater.inflate(nothingSelectedDropdownLayout, parent, false); 103 | } 104 | 105 | @Override 106 | public int getCount() { 107 | int count = adapter.getCount(); 108 | return count == 0 ? 0 : count + EXTRA; 109 | } 110 | 111 | @Override 112 | public Object getItem(int position) { 113 | return position == 0 ? null : adapter.getItem(position - EXTRA); 114 | } 115 | 116 | @Override 117 | public int getItemViewType(int position) { 118 | return 0; 119 | } 120 | 121 | @Override 122 | public int getViewTypeCount() { 123 | return 1; 124 | } 125 | 126 | @Override 127 | public long getItemId(int position) { 128 | return position >= EXTRA ? adapter.getItemId(position - EXTRA) : position - EXTRA; 129 | } 130 | 131 | @Override 132 | public boolean hasStableIds() { 133 | return adapter.hasStableIds(); 134 | } 135 | 136 | @Override 137 | public boolean isEmpty() { 138 | return adapter.isEmpty(); 139 | } 140 | 141 | @Override 142 | public void registerDataSetObserver(DataSetObserver observer) { 143 | adapter.registerDataSetObserver(observer); 144 | } 145 | 146 | @Override 147 | public void unregisterDataSetObserver(DataSetObserver observer) { 148 | adapter.unregisterDataSetObserver(observer); 149 | } 150 | 151 | @Override 152 | public boolean areAllItemsEnabled() { 153 | return false; 154 | } 155 | 156 | @Override 157 | public boolean isEnabled(int position) { 158 | return position != 0; // Don't allow the 'nothing selected' 159 | // item to be picked. 160 | } 161 | 162 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/Receiver.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import android.app.Notification; 4 | import android.app.PendingIntent; 5 | import android.content.BroadcastReceiver; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.graphics.Color; 9 | import android.os.Bundle; 10 | import android.widget.Toast; 11 | 12 | import androidx.core.app.NotificationCompat; 13 | import androidx.core.app.NotificationManagerCompat; 14 | 15 | import static com.example.login.Channel.CHANNEL_ID; 16 | 17 | public class Receiver extends BroadcastReceiver { 18 | @Override 19 | public void onReceive(Context context, Intent intent) { 20 | Intent i = new Intent(context , CandidateDetails.class); 21 | Bundle b = intent.getExtras(); 22 | Bundle b1 = new Bundle(); 23 | b1.putString("name",b.getString("name")); 24 | b1.putInt("age",b.getInt("age")); 25 | b1.putLong("mobileno",b.getLong("mobileno")); 26 | b1.putString("tickettype",b.getString("tickettype")); 27 | b1.putString("servicetype",b.getString("servicetype")); 28 | b1.putString("departure",b.getString("departure")); 29 | b1.putString("arrival",b.getString("arrival")); 30 | b1.putString("dates",b.getString("dates")); 31 | b1.putString("times",b.getString("times")); 32 | i.putExtras(b1); 33 | PendingIntent pi = PendingIntent.getActivity(context ,0 , i , 0); 34 | NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); 35 | Notification notification = new NotificationCompat.Builder(context , CHANNEL_ID) 36 | .setSmallIcon(R.drawable.ic_account_circle_black_24dp) 37 | .setContentTitle("Success, Your Ticket Has Been Booked!") 38 | .setContentText("Click for details (for confirmation, please proceed with payment later)") 39 | .setColor(Color.BLUE) 40 | .setContentIntent(pi) 41 | .setCategory(NotificationCompat.CATEGORY_MESSAGE) 42 | .setPriority(NotificationCompat.PRIORITY_HIGH) 43 | .build(); 44 | notificationManagerCompat.notify(1 , notification); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/a.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.widget.Button; 9 | 10 | public class a extends AppCompatActivity { 11 | Button button; 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_a); 16 | 17 | button=findViewById(R.id.bookticket); 18 | 19 | button.setOnClickListener(new View.OnClickListener() { 20 | @Override 21 | public void onClick(View v) { 22 | Intent intent=new Intent(a.this,MainActivity1.class); 23 | startActivity(intent); 24 | } 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/login/changepassword.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | import android.widget.Toast; 12 | 13 | import com.google.android.gms.tasks.OnCompleteListener; 14 | import com.google.android.gms.tasks.Task; 15 | import com.google.firebase.auth.FirebaseAuth; 16 | 17 | public class changepassword extends AppCompatActivity { 18 | EditText editText; 19 | Button button; 20 | FirebaseAuth firebaseAuth; 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_changepassword); 25 | 26 | editText=(EditText)findViewById(R.id.pemail); 27 | button=(Button)findViewById(R.id.pbutton); 28 | firebaseAuth=FirebaseAuth.getInstance(); 29 | 30 | button.setOnClickListener(new View.OnClickListener() { 31 | @Override 32 | public void onClick(View v) { 33 | String text=editText.getText().toString().trim(); 34 | if(text.isEmpty()) 35 | { 36 | Toast.makeText(changepassword.this,"Please enter a registered email id",Toast.LENGTH_SHORT).show(); 37 | } 38 | else 39 | { 40 | firebaseAuth.sendPasswordResetEmail(text).addOnCompleteListener(new OnCompleteListener() { 41 | @Override 42 | public void onComplete(@NonNull Task task) { 43 | if(task.isSuccessful()) 44 | { 45 | Toast.makeText(changepassword.this,"password reset email sent",Toast.LENGTH_SHORT).show(); 46 | finish(); 47 | Intent intent=new Intent(changepassword.this,MainActivity.class); 48 | startActivity(intent); 49 | }else 50 | { 51 | Toast.makeText(changepassword.this,"error in sending password reset email",Toast.LENGTH_SHORT).show(); 52 | } 53 | } 54 | }); 55 | } 56 | } 57 | }); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/blueback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/app/src/main/res/drawable-v24/blueback.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/blues.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/app/src/main/res/drawable-v24/blues.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/curved_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/curved_view1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/curved_view2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/curved_view3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/goldbutton.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/app/src/main/res/drawable-v24/goldbutton.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/gradient1.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/gradient2.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/greenback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/app/src/main/res/drawable-v24/greenback.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_account_circle_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/blueback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/app/src/main/res/drawable/blueback.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/buttonback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishkamani/TicketBookingSystem/d764a6100bccce17bc337b1852babc4bd0ab8691/app/src/main/res/drawable/buttonback.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/curved_view2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/font/calligraffitti.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_a.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 18 | 27 | 35 | 43 | 51 | 59 | 67 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_candidate_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 33 | 34 | 46 | 47 | 58 | 59 | 71 | 72 | 83 | 84 | 96 | 97 | 108 | 109 | 121 | 122 | 133 | 134 | 145 | 146 | 157 | 158 | 169 | 170 | 181 | 182 | 193 | 194 | 205 | 206 | 217 | 218 | 229 | 230 | 241 | 242 |