Skip to content
Snippets Groups Projects
Commit c0c47346 authored by rohan reddy's avatar rohan reddy
Browse files

:wq

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1096 additions and 0 deletions
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<component name="CopyrightManager">
<settings default="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio3\gradle\gradle-2.14.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<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="4">
<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="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<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" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" 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>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Smart_tours2.iml" filepath="$PROJECT_DIR$/Smart_tours2.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?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>
\ No newline at end of file
/build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.rohanreddy.smart_tours"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in E:\Android Setup Files\adt-bundle-windows-x86_64-20140702\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# 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 *;
#}
package com.example.rohanreddy.smart_tours;
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.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.rohanreddy.smart_tours", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rohanreddy.smart_tours">
<!-- 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" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Register_page" />
<activity android:name=".Place_season_selection" />
<SQLite android:name=".Database" />
<activity android:name=".Tour_info" />
<SQLite android:name=".Tour_Database" />
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
\ No newline at end of file
app/src/main/ic_launcher-web.png

89.1 KiB

package com.example.rohanreddy.smart_tours;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
//import android.support.annotation.RequiresPermission;
//import java.util.HashMap;
public class Database extends SQLiteOpenHelper {
// public static final int DATABASE_VERSION = 1;
//public static final String DATABASE_NAME = "Database.db";
public Database(Context context, String name, CursorFactory factory,
int version) {
super(context, name, factory, version);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
String str = "create table sRegistered_details(sFirst_name varchar,sLast_name varchar,sPassword varchar,sEmail varchar PRIMARY KEY,sCountry varchar,sLanguage varchar,sGender varchar)";
db.execSQL(str);
ContentValues cv = new ContentValues();// stores the data and directly inserts the row
cv.put("sFirst_name", "aaa");
cv.put("sLast_name", "bbb");
cv.put("sPassword", "aaaaa");
cv.put("sEmail", "aaa@aaa.com");
cv.put("sCountry", "india");
cv.put("sLanguage", "telugu");
cv.put("sGender", "male");
db.insert("sRegistered_details", null, cv);
// String row1="insert into sRegistered_details(sFirst_name varchar,sLast_name varchar,sPassword varchar,sEmail varchar PRIMARY KEY,sCountry varchar,sLanguage varchar,sGender varchar) values (0,'Rohan','Reddy','omkar@123','guntakarohanreddy@gmail.com','India','Telugu','male')";
//db.execSQL(row1);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
String str ="drop table if exists sRegistered_details";
db.execSQL(str);
onCreate(db);
}
}
package com.example.rohanreddy.smart_tours;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
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.database.sqlite.SQLiteDatabase;
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.ListView;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
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 {
SharedPreferences m_preference;
SQLiteDatabase db = null;
protected Cursor c;
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
private String[] values;
String strPassword;
EditText et_Email,et_password ;
ArrayList<String> regionList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Database SQLdb= new Database(this,"sRegistered_details",null,1);
db = SQLdb.getWritableDatabase();
final SQLiteDatabase db = this.openOrCreateDatabase( "sRegistered_details", MODE_PRIVATE, null);
et_Email = (EditText)findViewById(R.id.email);
et_password = (EditText)findViewById(R.id.password);
regionList= new ArrayList<String>();
Cursor cursorTwo = db.rawQuery("SELECT sEmail FROM sRegistered_details", null);
if (cursorTwo != null && cursorTwo.getCount() != 0)
{
cursorTwo.moveToFirst();
while (!cursorTwo.isAfterLast())
{
String strEmail = cursorTwo.getString(0) ;
regionList.add(strEmail);
cursorTwo.moveToNext();
}
}
Button m_btn_register = (Button) findViewById(R.id.btn_register);
m_btn_register.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(LoginActivity.this,Register_page.class);
startActivity(intent);
}
});
Button btn_login = (Button)findViewById(R.id.btn_login);
btn_login.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String email = et_Email.getText().toString().trim();
if(regionList.contains(email))
{
Cursor cursorTwo = db.rawQuery("SELECT sPassword FROM sRegistered_details where sEmail ='"+email+"'", null);
if (cursorTwo != null && cursorTwo.getCount() != 0)
{
//String strPassword = "" ;
cursorTwo.moveToFirst();
while (!cursorTwo.isAfterLast())
{
strPassword = cursorTwo.getString(0) ;
cursorTwo.moveToNext();
}
if((et_password.getText().toString()).equalsIgnoreCase(strPassword))
{
Intent intent = new Intent(LoginActivity.this,Place_season_selection.class);
startActivity(intent);
Toast.makeText(LoginActivity.this, "LOGIN SUCCESSFULL", Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(LoginActivity.this, "LOGIN FAILED", Toast.LENGTH_LONG).show();
Toast.makeText(LoginActivity.this, "PLEASE CHECK YOUR LOGIN CREDENTIALS", Toast.LENGTH_LONG).show();
}
}
}/*
String query="select * from sRegistered_details where sEmail='"+email+"' and sPassword='"+et_password.getText().toString().trim()+"'";
Cursor c=db.rawQuery(query,null);
System.out.println(query+" "+c.getCount());
c.moveToFirst();
if(c.getCount()>0){
Toast.makeText(LoginActivity.this,"Login success",Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(LoginActivity.this,"Login failed",Toast.LENGTH_SHORT).show();
}*/
}
});
mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress);
}
private void attemptLogin() {
/* if (mAuthTask != null) {
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_field_required));
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);
//mAuthTask = new UserLoginTask(email, password);
/*mAuthTask.execute((Void) null);public void loadImage(View view){
String query =mEditText.getText().toString();
new
}*/
}
}
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() > 4;
}
}
package com.example.rohanreddy.smart_tours;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Toast;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.appindexing.Thing;
import com.google.android.gms.common.api.GoogleApiClient;
import java.util.ArrayList;
/**
* Created by rohan reddy on 16-Nov-16.
*/
public class Place_season_selection extends Activity {
SQLiteDatabase tdb = null;
protected Cursor c;
SharedPreferences m_preference;
SharedPreferences.Editor m_editor;
AutoCompleteTextView m_auto_place;
Spinner m_spn_season;
ArrayList<String> regionList1=new ArrayList<String>();
ArrayList<String> regionList2=new ArrayList<String>();
//String nDescription;
String[] strArrPlace = {"Chennai", "Madhurai", "Ooty", "kodaicanal","Coimbatore"};
String[] strArrSeason = {"RAINY", "WINTER", "SUMMER", "SPRING", "AUTOM"};
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.place_season_selection);
Tour_Database SQLdb = new Tour_Database(this, "Tour_details", null, 1);
tdb = SQLdb.getWritableDatabase();
m_preference = getSharedPreferences("MY_PREFERENCE", MODE_PRIVATE);
m_editor = m_preference.edit();
m_auto_place = (AutoCompleteTextView) findViewById(R.id.auto_place);
m_spn_season = (Spinner) findViewById(R.id.spn_season);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Place_season_selection.this, android.R.layout.simple_selectable_list_item, strArrPlace);
m_auto_place.setAdapter(adapter);
m_auto_place.setThreshold(1);
ArrayAdapter<String> lang_adapter = new ArrayAdapter<String>(Place_season_selection.this, android.R.layout.simple_selectable_list_item, strArrSeason);
m_spn_season.setAdapter(lang_adapter);
regionList1 = new ArrayList<String>();
Cursor cursorTwo = tdb.rawQuery("SELECT place FROM Tour_details", null);
if (cursorTwo != null && cursorTwo.getCount() != 0 ) {
{
cursorTwo.moveToFirst();
while (!cursorTwo.isAfterLast()) {
String strPlace = cursorTwo.getString(0);
regionList1.add(strPlace);
cursorTwo.moveToNext();
}
}
}
Button btn_search = (Button) findViewById(R.id.btn_search);
btn_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String place = m_auto_place.getText().toString();
//String season = m_spn_season.getSelectedItem().toString();
if (regionList1.contains(place )) {
Cursor cursorTwo = tdb.rawQuery("SELECT season FROM Tour_details where place ='" + place + "'", null);
if (cursorTwo != null && cursorTwo.getCount() != 0) {
cursorTwo.moveToFirst();
while (!cursorTwo.isAfterLast()) {
String strSeason = cursorTwo.getString(0);
regionList2.add(strSeason);
cursorTwo.moveToNext();
}
String season = m_spn_season.getSelectedItem().toString();
if (regionList2.contains(season)) {
Cursor cursorThree = tdb.rawQuery("SELECT description FROM Tour_details where place ='" + place + "'and season = '"+ season +"'", null);
cursorThree.moveToFirst();
String strdescription = cursorThree.getString(0);
Intent intent = new Intent(Place_season_selection.this, Tour_info.class);
intent.putExtra("nDescription",strdescription);
startActivity(intent);
Toast.makeText(Place_season_selection.this, "Search complete", Toast.LENGTH_LONG).show();
}
}
}
}
});
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
public Action getIndexApiAction() {
Thing object = new Thing.Builder()
.setName("Place_season_selection Page") // TODO: Define a title for the content shown.
// TODO: Make sure this auto-generated URL is correct.
.setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]"))
.build();
return new Action.Builder(Action.TYPE_VIEW)
.setObject(object)
.setActionStatus(Action.STATUS_TYPE_COMPLETED)
.build();
}
@Override
public void onStart() {
super.onStart();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
AppIndex.AppIndexApi.start(client, getIndexApiAction());
}
@Override
public void onStop() {
super.onStop();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
AppIndex.AppIndexApi.end(client, getIndexApiAction());
client.disconnect();
}
}
\ No newline at end of file
package com.example.rohanreddy.smart_tours;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.LoaderManager;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.nsd.NsdManager.RegistrationListener;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.Spinner;
import android.widget.Toast;
public class Register_page extends Activity {
EditText et_firstname;
EditText et_lastname;
EditText et_password;
EditText et_Email;
AutoCompleteTextView auto_country;
Spinner sp_lang;
RadioGroup rg_gender;
Editor m_editor;
SharedPreferences m_preference;
SQLiteDatabase db = null;
String[] strArrCountry = {"India", "Pakistan", "SriLanka", "paris", "indonesia", "switzerland", "Italy"};
String[] strArrLang = {"telugu", "tamil", "english", "hindi", "marathi", "spanish", "malayalam"};
@SuppressLint("ShowToast")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_page);
Database SQLdb = new Database(this,"sRegistered_details", null, 1);
db = SQLdb.getWritableDatabase();
m_preference = getSharedPreferences("MY_PREFERENCE", MODE_PRIVATE);
m_editor = m_preference.edit();
rg_gender = (RadioGroup) findViewById(R.id.rg_gender);
rg_gender.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
// TODO Auto-generated method stub
RadioButton rg_gender = (RadioButton) findViewById(arg1);
String strGender = rg_gender.getText().toString();
System.out.println(strGender);
}
});
et_firstname = (EditText) findViewById(R.id.et_firstname);
et_lastname = (EditText) findViewById(R.id.et_lastname);
et_password = (EditText) findViewById(R.id.et_password);
et_Email = (EditText) findViewById(R.id.et_Email);
auto_country = (AutoCompleteTextView) findViewById(R.id.auto_country);
sp_lang = (Spinner) findViewById(R.id.sp_lang);
ArrayAdapter<String> lang_adapter = new ArrayAdapter<String>(Register_page.this, android.R.layout.simple_selectable_list_item, strArrLang);
sp_lang.setAdapter(lang_adapter);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Register_page.this, android.R.layout.simple_selectable_list_item, strArrCountry);
auto_country.setAdapter(adapter);
auto_country.setThreshold(1);
Button btnRegister = (Button) findViewById(R.id.btn_register);
btnRegister.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String strFirst_name = et_firstname.getText().toString();
String strLast_name = et_lastname.getText().toString().trim();
String strPassword = et_password.getText().toString().trim();
String strEmail = et_Email.getText().toString().trim();
String strCountry = auto_country.getText().toString().trim();
String strLanguage = sp_lang.getSelectedItem().toString().trim();
String strGender = Integer.toString(rg_gender.getId()).trim();
if (TextUtils.isEmpty(strFirst_name)) {
et_firstname.setError(getString(R.string.error_field_required));
//et_firstname.requestFocus();
}
if (TextUtils.isEmpty(strLast_name)) {
et_lastname.setError(getString(R.string.error_field_required));
//et_lastname.requestFocus();
}
if (TextUtils.isEmpty(strEmail)) {
et_Email.setError(getString(R.string.error_field_required));
// et_Email.requestFocus();
}
if (!isEmailValid(strEmail)) {
et_Email.setError(getString(R.string.error_invalid_email));
// et_Email.requestFocus();
}
if (TextUtils.isEmpty(strPassword)){
et_password.setError(getString(R.string.error_invalid_password));
//et_password.requestFocus();
}
if ( !isPasswordValid(strPassword)) {
et_password.setError(getString(R.string.error_invalid_password));
//et_password.requestFocus();
}
if (TextUtils.isEmpty(strCountry)) {
auto_country.setError(getString(R.string.error_field_required));
//auto_country.requestFocus();
}
if(strFirst_name.isEmpty()||strLast_name.isEmpty()||strPassword.isEmpty()||strEmail.isEmpty()||strCountry.isEmpty()||strLanguage.isEmpty()||strGender.isEmpty()) {
// if(strFirst_name==null||strLast_name==null||strPassword==null||strEmail==null||strCountry==null||strLanguage==null||strGender==null) {
Toast.makeText(Register_page.this, "FIRST FILL ALL THE DETAILS", Toast.LENGTH_LONG).show();
}else {
ContentValues cv = new ContentValues();// stores the data and directly inserts the row
cv.put("sFirst_name", strFirst_name);
cv.put("sLast_name", strLast_name);
cv.put("sPassword", strPassword);
cv.put("sEmail", strEmail);
cv.put("sCountry", strCountry);
cv.put("sLanguage", strLanguage);
cv.put("sGender", strGender);
System.out.println(strFirst_name + strLast_name + strEmail + strPassword + strCountry + strGender + strLanguage);
db.insert("sRegistered_details", null, cv);
Toast.makeText(Register_page.this, "Register successful", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Register_page.this, LoginActivity.class);
startActivity(intent);
/* String query = "select * from sRegistered_details where sEmail='" + strEmail + "' and sPassword='" + et_password.getText().toString().trim() + "'";
Cursor c = db.rawQuery(query, null);
System.out.println(query + " " + c.getCount());
c.moveToFirst();
if (c.getCount() > 0) {
Toast.makeText(Register_page.this, "Register success", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Register_page.this, LoginActivity.class);
startActivity(intent);
}*/
}
et_firstname.setText("");
et_lastname.setText("");
et_password.setText("");
// et_mobileno.setText("");
et_Email.setText("");
auto_country.setText("");
sp_lang.setOnItemSelectedListener(null);
rg_gender.setOnClickListener(null);
//String strUsername = strFirst_name+ " " +strLast_name;
String E_mail = strEmail;
String Password = strPassword;
m_editor.putString("Email", E_mail);
m_editor.putString("Password", Password);
//m_editor.putBoolean("Registered", true);
m_editor.commit();
et_password.setError(null);
//System.out.println("button");
boolean cancel = false;
View focusView = null;
}
});
}
private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic
return password.length() > 4;
}
private boolean isEmailValid(String email) {
//TODO: Replace this with your own logic
return email.contains("@");
}
}
package com.example.rohanreddy.smart_tours;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
//import android.support.annotation.RequiresPermission;
//import java.util.HashMap;
public class Tour_Database extends SQLiteOpenHelper {
public static final int version = 1;
public static final String name = "Tour_Database.tdb";
public Tour_Database(Context context, String name, SQLiteDatabase.CursorFactory factory,
int version) {
super(context, name, factory, version);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase tdb) {
// TODO Auto-generated method stub
String str = "create table Tour_details(id primary key,place varchar,season varchar,description text)";
tdb.execSQL(str);
System.out.println(tdb);
String row1="insert into Tour_details(id,place,season,description) values (1,'Madhurai','SUMMER','Minakshi_Temple')";
tdb.execSQL(row1);
String row2="insert into Tour_details(id,place,season,description) values (2,'Coimbatore','RAINY','ooty')";
tdb.execSQL(row2);
String row3="insert into Tour_details(id,place,season,description) values (3,'Chennai','SUMMER','beach')";
tdb.execSQL(row3);
}
@Override
public void onUpgrade(SQLiteDatabase tdb, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
String str ="drop table if exists Tour_details";
tdb.execSQL(str);
onCreate(tdb);
}
}
package com.example.rohanreddy.smart_tours;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.view.View;
import android.widget.TextView;
/**
* Created by rohan reddy on 25-Nov-16.
*/
public class Tour_info extends Activity {
//String nFeasibility;
TextView textView;
String Description;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.tour_info);
if (savedInstanceState == null) {
Bundle extras = getIntent().getExtras();
if (extras != null) {
Description = extras.getString("nDescription");
System.out.println(Description);
textView = (TextView) findViewById(R.id.textView);
textView.setText(Description.toUpperCase());
textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
}
}
}
}
<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"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.rohanreddy.smart_tours.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:imeActionId="@+id/btn_login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Login"
android:textStyle="bold" />
<Button
android:text="Sign up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:id="@+id/btn_register" />
</LinearLayout>
</ScrollView>
</LinearLayout>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment