Commit f1d870fb authored by Balasuriya D.A.M.'s avatar Balasuriya D.A.M.

MinerDocMobile Updated after errors

parent 6c060088
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
# Default ignored files
/shelf/
/workspace.xml
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\Nipuna\.android\avd\Pixel_3_XL_API_30.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-07-12T17:29:20.864290700Z" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.google.com" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/drawable/et_custom.xml" value="0.134" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/drawable/my_border.xml" value="0.1205" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/Inquiry_design_load.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_accepted_enquiries.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_doctor_homepage.xml" value="0.15052083333333333" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_doctors_pendingreqs.xml" value="0.15052083333333333" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_doctors_submittedz.xml" value="0.13645833333333332" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_home_bothmain.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_login_doctor.xml" value="0.15052083333333333" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_login_doctor2.xml" value="0.15052083333333333" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_main_home.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_make_an_inquire_doctor.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_miner_home_page.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_miner_login.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_miners_register.xml" value="0.24583333333333332" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_missingperson_report.xml" value="0.25" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_pending_enquirires.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_pre_load_doctor.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_pre_load_miner.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_register_doctor.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_search_button_doc.xml" value="0.13229166666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_search_doctors.xml" value="0.13229166666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_select_enquiry_home.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_show_all_doctors.xml" value="0.109375" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_single_doctor_details.xml" value="0.1" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_single_report_detais.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_single_view_completed_inq.xml" value="0.13229166666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_single_view_pending_inquiry.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_single_view_pendinginquiry_doctor.xml" value="0.16145833333333334" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_sub_miner_doctor_home.xml" value="0.109375" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/activity_testmailz.xml" value="0.11041666666666666" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/doctor_design_load.xml" value="0.109375" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/enqdoctorz.xml" value="0.17447916666666666" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/et_custom.xml" value="0.14635416666666667" />
<entry key="..\:/Projects/ZZZNEWZ/2020/File uploading andoid/AndroidFinal1/app/src/main/res/layout/inquiry_design_load.xml" value="0.14635416666666667" />
</map>
</option>
</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="13">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="android.annotation.Nullable" />
<item index="7" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
<item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="12">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="android.annotation.NonNull" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="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
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.dushan.crimeandmissingrepoter"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.0.0'
implementation 'com.android.support:support-v4:27.0.0'
implementation 'com.android.support:cardview-v7:27.0.0'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'android.arch.lifecycle:livedata:1.1.1'
implementation 'android.arch.lifecycle:viewmodel:1.1.1'
testImplementation 'junit:junit:4.+'
implementation files('libs/mysql-connector-java-5.1.23-bin.jar')
implementation files('libs/mail.jar')
implementation files('libs/additionnal.jar')
implementation files('libs/activation.jar')
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'net.gotev:uploadservice:3.4'
compile files('libs/GenAsync.jar')
implementation 'com.google.android.gms:play-services-maps:16.0.0'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.dushan.crimeandmissingrepoter", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%"
android:fromYDelta="100%"
android:duration="1500"
/> >
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500"
/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%"
android:fromYDelta="-50%"
android:duration="2000"
/> >
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500"
/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dushan.crimeandmissingrepoter">
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@drawable/online"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".Testmailz"
android:exported="false" />
<activity
android:name=".SingleViewPendinginquiryDoctor"
android:exported="false" />
<activity
android:name=".DoctorsSubmittedz"
android:exported="false" />
<activity
android:name=".DoctorsPendingreqs"
android:exported="false" />
<activity
android:name=".LoginDoctor"
android:exported="false" />
<!-- <activity-->
<!-- android:name=".ui.login.LoginDoctor"-->
<!-- android:exported="false"-->
<!-- android:label="@string/title_activity_login_doctor" />-->
<activity
android:name=".DoctorHomepage"
android:exported="false" />
<activity
android:name=".SingleViewCompletedInq"
android:exported="false" />
<activity
android:name=".SingleViewPendingInquiry"
android:exported="false" />
<activity
android:name=".AcceptedEnquiries"
android:exported="false" />
<activity
android:name=".PendingEnquirires"
android:exported="false" />
<activity
android:name=".SelectEnquiryHome"
android:exported="false" />
<activity
android:name=".MakeAnInquireDoctor"
android:exported="false" />
<activity
android:name=".SearchDoctors"
android:exported="false" />
<activity
android:name=".SearchButtonDoc"
android:exported="false" />
<activity
android:name=".SingleDoctorDetails"
android:exported="false" />
<activity
android:name=".ShowAllDoctors"
android:exported="false" />
<activity
android:name=".SubMinerDoctorHome"
android:exported="false" />
<activity
android:name=".MinerHomePage"
android:exported="false" />
<activity
android:name=".MinerLogin"
android:exported="false" />
<activity
android:name=".MinersRegister"
android:exported="false" />
<activity
android:name=".RegisterDoctor"
android:exported="false" />
<activity
android:name=".PreLoadMiner"
android:exported="false" />
<activity
android:name=".PreLoadDoctor"
android:exported="false" />
<activity
android:name=".HomeBothmain"
android:exported="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/map_key" />
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
<activity android:name=".locationsend" />
<activity android:name=".singlemissingpersondetail" />
<activity android:name=".SingleReportDetais" />
<activity android:name=".LoadCrimeReports" />
<activity android:name=".SingleCrimeDetails" />
<activity android:name=".loadcrimelist" />
<activity android:name=".coplogin" />
<activity android:name=".mainHome">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MissingpersonReport" />
<activity android:name=".RepotCrime" />
<activity android:name=".UserHome" />
<activity android:name=".missingpersons" />
<activity android:name=".Login" />
<activity android:name=".CreateAccount" />
<activity
android:name=".HomePagePolice"
android:label="@string/title_activity_home_page_police"
android:theme="@style/AppTheme" />
</application>
</manifest>
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.util.ArrayList;
public class AcceptedEnquiries extends AppCompatActivity {
ListView listView;
ArrayList<LoadInquiries> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_accepted_enquiries);
listView = findViewById(R.id.submittedqntt);
arrayList = new ArrayList<LoadInquiries>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
try {
String useremptype = DbConnection.emailzloadingz;
String stat = "Active";
String sqlload = "SELECT * FROM inquirydetailz where orgemailz='"+useremptype+"' and statusz='Submitted' ORDER BY id DESC";
ResultSet rs = DbConnection.search(sqlload);
while (rs.next()){
LoadInquiries i = new LoadInquiries();
i.id =rs.getString("id");
i.doctorname=rs.getString("docnamez");
i.datez=rs.getString("datez");
i.timez=rs.getString("timez");
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
class missingloadAdapter extends ArrayAdapter {
Context c;
ArrayList<LoadInquiries> list;
public missingloadAdapter(Context context ,ArrayList<LoadInquiries> ar) {
super(context, R.layout.doctor_design_load,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.inquiry_design_load,null);
final LoadInquiries loadTimeTables = list.get(position);
final TextView orderidhidden =(TextView) v.findViewById(R.id.hiddeniddeninq);
orderidhidden.setText(loadTimeTables.id);
// localVari.Preg_topic_Name = loadTimeTables.topicname;
final TextView electionnamez =(TextView) v.findViewById(R.id.doctor_name_load_inquiry);
electionnamez.setText("Doctor name : "+loadTimeTables.doctorname);
final TextView dateheldz =(TextView) v.findViewById(R.id.date_inqui);
dateheldz.setText("Date : "+loadTimeTables.datez);
final TextView timeheldz =(TextView) v.findViewById(R.id.timez_inqui);
timeheldz.setText("Time : "+loadTimeTables.timez);
Button vieworderdetailsz =(Button) v.findViewById(R.id.viewconsult_singeledetails);
vieworderdetailsz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.single_inquid = election_nameloadz;
Intent ii = new Intent(AcceptedEnquiries.this, SingleViewCompletedInq.class);
startActivity(ii);
}
});
return v;
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.opengl.EGLExt;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import java.util.HashMap;
public class CreateAccount extends AppCompatActivity implements AsyncResponse{
static String[] districs=new String[]{"Ampara","Anuradhapura","Badulla","Batticaloa","Colombo","Galle","Gampaha","Hambantota","Matara","Nuwara Eliya","Matale"};
TextView tv;
EditText fname,lname,emai,password,confirmpw,nic;
AutoCompleteTextView atv;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_account);
StrictMode.ThreadPolicy di = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(di);
tv = (TextView) findViewById(R.id.textViewlogoinz);
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(CreateAccount.this, Login.class);
startActivity(ii);
}
});
fname =(EditText) findViewById(R.id.userfname);
lname =(EditText) findViewById(R.id.userlname);
emai =(EditText) findViewById(R.id.useremail);
password =(EditText) findViewById(R.id.pasword);
confirmpw =(EditText) findViewById(R.id.password2);
nic =(EditText) findViewById(R.id.nicekacreate);
atv =(AutoCompleteTextView) findViewById(R.id.districtype);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,districs);
atv.setAdapter(adapter);
btn = (Button)findViewById(R.id.createaccount);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String firstname = fname.getText().toString();
String lastname = lname.getText().toString();
String email = emai.getText().toString();
String password1 = password.getText().toString();
String passwordconfirm = confirmpw.getText().toString();
String niceka = nic.getText().toString();
String distrixz = atv.getText().toString();
if(firstname.equals("") || lastname.equals("") || email.equals("") || password1.equals("") || passwordconfirm.equals("")){
Toast.makeText(CreateAccount.this, "Fill All Feilds To Continue..!", Toast.LENGTH_LONG).show();
}else{
try {
HashMap postdata = new HashMap();
postdata.put("firtname",firstname);
postdata.put("lastname",lastname);
postdata.put("emailz",email);
postdata.put("passwordz",password1);
postdata.put("nicz",niceka);
postdata.put("districz",distrixz);
PostResponseAsyncTask task = new PostResponseAsyncTask(CreateAccount.this,postdata);
task.execute("http://potcantalk.com/mobileapp/createaccount.php");
}catch (Exception e){
Toast.makeText(CreateAccount.this, "---"+e, Toast.LENGTH_LONG).show();
}
}
}
});
}
@Override
public void processFinish(String s) {
String getresponse =s;
//Toast.makeText(CreateAccount.this, "---"+s, Toast.LENGTH_LONG).show();
if(getresponse.equals("ok")){
Toast.makeText(CreateAccount.this, "User Registered Succescfully..", Toast.LENGTH_LONG).show();
}else if(getresponse.equals("Already")){
Toast.makeText(CreateAccount.this, "This NIC is Alredy Registered..", Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
public class DbConnection {
public static Connection c;
public static String usernameloadingz;
public static String emailzloadingz;
public static String load_usertypez;
public static String load_user_passwordz;
public static String load_user_single_id;
public static String search_text;
public static String single_inquid;
public static String doctorid_load;
public static Connection createCon() throws Exception {
Class.forName("com.mysql.jdbc.Driver");
// c = DriverManager.getConnection("jdbc:mysql://192.168.43.200:3307/finalhadcraft", "root", "123");
//c = DriverManager.getConnection("jdbc:mysql://192.168.42.157:3307/finalhadcraft", "root", "123");
System.out.println("Sql errorz" +"Call Unaa");
c = DriverManager.getConnection("jdbc:mysql://192.168.1.10:3307/doctorminers", "root", "123");
//c = DriverManager.getConnection("jdbc:mysql://localhost:3306/doctorminers", "root", "");
return c;
}
public static void iud(String sql) throws Exception {
System.out.println("Sql errorz" +"Call insert");
if (c == null) {
createCon();
}
c.createStatement().executeUpdate(sql);
}
public static ResultSet search(String sql) throws Exception {
System.out.println("Sql errorz" +"Call Unaa searc");
if (c == null) {
createCon();
}
return c.createStatement().executeQuery(sql);
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
public class DoctorHomepage extends AppCompatActivity {
Button b1,b2,b3;
TextView tv1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_doctor_homepage);
b1 = findViewById(R.id.pendingreqz2);
b2 = findViewById(R.id.acceptrequesz2);
b3 = findViewById(R.id.logoutdocz);
tv1 = findViewById(R.id.loadnamedoca);
tv1.setText("Hello "+DbConnection.usernameloadingz);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(DoctorHomepage.this,DoctorsPendingreqs.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(DoctorHomepage.this,DoctorsSubmittedz.class);
startActivity(i);
}
});
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(DoctorHomepage.this,HomeBothmain.class);
startActivity(i);
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.util.ArrayList;
public class DoctorsPendingreqs extends AppCompatActivity {
ListView listView;
ArrayList<LoadEnquirisDoc> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_doctors_pendingreqs);
listView = findViewById(R.id.lstreqzdoc);
arrayList = new ArrayList<LoadEnquirisDoc>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
try {
String useremptype = DbConnection.doctorid_load;
String stat = "Active";
String sqlload = "SELECT * FROM inquirydetailz where doctoridz='"+useremptype+"' and statusz='Pending' ORDER BY id DESC";
ResultSet rs = DbConnection.search(sqlload);
while (rs.next()){
LoadEnquirisDoc i = new LoadEnquirisDoc();
i.id =rs.getString("id");
i.doctorname=rs.getString("organizationname");
i.datez=rs.getString("datez");
i.timez=rs.getString("timez");
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
class missingloadAdapter extends ArrayAdapter {
Context c;
ArrayList<LoadEnquirisDoc> list;
public missingloadAdapter(Context context ,ArrayList<LoadEnquirisDoc> ar) {
super(context, R.layout.doctor_design_load,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.enqdoctorz,null);
final LoadEnquirisDoc loadTimeTables = list.get(position);
final TextView orderidhidden =(TextView) v.findViewById(R.id.hiddeniddeninq2);
orderidhidden.setText(loadTimeTables.id);
// localVari.Preg_topic_Name = loadTimeTables.topicname;
final TextView electionnamez =(TextView) v.findViewById(R.id.doctor_name_load_inquiry2);
electionnamez.setText("Organization name : "+loadTimeTables.doctorname);
final TextView dateheldz =(TextView) v.findViewById(R.id.date_inqui2);
dateheldz.setText("Date : "+loadTimeTables.datez);
final TextView timeheldz =(TextView) v.findViewById(R.id.timez_inqui2);
timeheldz.setText("Time : "+loadTimeTables.timez);
Button vieworderdetailsz =(Button) v.findViewById(R.id.viewconsult_singeledetails2);
vieworderdetailsz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.single_inquid = election_nameloadz;
Intent ii = new Intent(DoctorsPendingreqs.this, SingleViewPendinginquiryDoctor.class);
startActivity(ii);
}
});
return v;
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.util.ArrayList;
public class DoctorsSubmittedz extends AppCompatActivity {
ListView listView;
ArrayList<LoadEnquirisDoc> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_doctors_submittedz);
listView = findViewById(R.id.lstreqzdocsub);
arrayList = new ArrayList<LoadEnquirisDoc>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
try {
String useremptype = DbConnection.doctorid_load;
String stat = "Active";
String sqlload = "SELECT * FROM inquirydetailz where doctoridz='"+useremptype+"' and statusz='submitted' ORDER BY id DESC";
ResultSet rs = DbConnection.search(sqlload);
while (rs.next()){
LoadEnquirisDoc i = new LoadEnquirisDoc();
i.id =rs.getString("id");
i.doctorname=rs.getString("organizationname");
i.datez=rs.getString("datez");
i.timez=rs.getString("timez");
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
class missingloadAdapter extends ArrayAdapter {
Context c;
ArrayList<LoadEnquirisDoc> list;
public missingloadAdapter(Context context ,ArrayList<LoadEnquirisDoc> ar) {
super(context, R.layout.doctor_design_load,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.enqdoctorz,null);
final LoadEnquirisDoc loadTimeTables = list.get(position);
final TextView orderidhidden =(TextView) v.findViewById(R.id.hiddeniddeninq2);
orderidhidden.setText(loadTimeTables.id);
// localVari.Preg_topic_Name = loadTimeTables.topicname;
final TextView electionnamez =(TextView) v.findViewById(R.id.doctor_name_load_inquiry2);
electionnamez.setText("Organization name : "+loadTimeTables.doctorname);
final TextView dateheldz =(TextView) v.findViewById(R.id.date_inqui2);
dateheldz.setText("Date : "+loadTimeTables.datez);
final TextView timeheldz =(TextView) v.findViewById(R.id.timez_inqui2);
timeheldz.setText("Time : "+loadTimeTables.timez);
Button vieworderdetailsz =(Button) v.findViewById(R.id.viewconsult_singeledetails2);
vieworderdetailsz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.single_inquid = election_nameloadz;
Intent ii = new Intent(DoctorsSubmittedz.this, SingleViewPendinginquiryDoctor.class);
startActivity(ii);
}
});
return v;
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.Security;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.security.AccessController;
import java.security.Provider;
public class GMailSender extends javax.mail.Authenticator {
private String mailhost = "smtp.gmail.com";
private String user;
private String password;
private Session session;
static {
Security.addProvider(new JSSEProvider("HarmonyJSSE", 1.0, "Harmony JSSE Provider"));
}
public GMailSender(String user, String password) {
this.user = user;
this.password = password;
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");
session = Session.getDefaultInstance(props, this);
}
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password);
}
public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception {
try{
MimeMessage message = new MimeMessage(session);
DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain"));
message.setSender(new InternetAddress(sender));
message.setSubject(subject);
message.setDataHandler(handler);
if (recipients.indexOf(',') > 0)
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));
else
message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));
Transport.send(message);
}catch(Exception e){
}
}
public class ByteArrayDataSource implements DataSource {
private byte[] data;
private String type;
public ByteArrayDataSource(byte[] data, String type) {
super();
this.data = data;
this.type = type;
}
public ByteArrayDataSource(byte[] data) {
super();
this.data = data;
}
public void setType(String type) {
this.type = type;
}
public String getContentType() {
if (type == null)
return "application/octet-stream";
else
return type;
}
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(data);
}
public String getName() {
return "ByteArrayDataSource";
}
public OutputStream getOutputStream() throws IOException {
throw new IOException("Not Supported");
}
}
private static class JSSEProvider extends Provider {
protected JSSEProvider(String name, double version, String info) {
super("HarmonyJSSE", 1.0, "Harmony JSSE Provider");
AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
public Void run() {
put("SSLContext.TLS",
"org.apache.harmony.xnet.provider.jsse.SSLContextImpl");
put("Alg.Alias.SSLContext.TLSv1", "TLS");
put("KeyManagerFactory.X509",
"org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl");
put("TrustManagerFactory.X509",
"org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl");
return null;
}
});
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
public class HomeBothmain extends AppCompatActivity {
Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_home_bothmain);
b1 = findViewById(R.id.btn1);
b2 = findViewById(R.id.btn2);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(HomeBothmain.this,PreLoadDoctor.class);
startActivity(ii);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(HomeBothmain.this,PreLoadMiner.class);
startActivity(ii);
}
});
}
@Override
public void onBackPressed() {
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
public class HomePagePolice extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page_police);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home_page_police, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
Intent ii = new Intent(HomePagePolice.this,missingpersons.class);
startActivity(ii);
} else if (id == R.id.nav_gallery) {
Intent ii = new Intent(HomePagePolice.this,LoadCrimeReports.class);
startActivity(ii);
} else if (id == R.id.nav_manage) {
Intent ii = new Intent(HomePagePolice.this,loadcrimelist.class);
startActivity(ii);
} else if (id == R.id.nav_share) {
Intent ii = new Intent(HomePagePolice.this,locationsend.class);
startActivity(ii);
} else if (id == R.id.nav_send) {
Intent ii = new Intent(HomePagePolice.this,mainHome.class);
startActivity(ii);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
package com.example.dushan.crimeandmissingrepoter;
import java.security.AccessController;
import java.security.Provider;
public final class JSSEProvider extends Provider {
public JSSEProvider() {
super("HarmonyJSSE", 1.0, "Harmony JSSE Provider");
AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
public Void run() {
put("SSLContext.TLS",
"org.apache.harmony.xnet.provider.jsse.SSLContextImpl");
put("Alg.Alias.SSLContext.TLSv1", "TLS");
put("KeyManagerFactory.X509",
"org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl");
put("TrustManagerFactory.X509",
"org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl");
return null;
}
});
}
}
package com.example.dushan.crimeandmissingrepoter;
public class LoadAllDoctos {
String id;
String doctorname;
String doctortype;
String regno;
LoadAllDoctos(String id,String doctorname,String doctortype,String regno){
id = this.id;
doctorname = this.doctorname;
doctortype = this.doctortype;
regno = this.regno;
}
LoadAllDoctos(){
}
}
package com.example.dushan.crimeandmissingrepoter;
public class LoadCrimeReport {
String idcrimedetails;
String crimetype;
String reportby;
LoadCrimeReport(String idcrimedetails,String crimetype,String reportby){
idcrimedetails = this.idcrimedetails;
crimetype = this.crimetype;
reportby = this.reportby;
}
LoadCrimeReport(){
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
public class LoadCrimeReports extends AppCompatActivity implements AsyncResponse{
ListView listloadlistz;
ArrayList<LoadCrimeReport> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_load_crime_reports);
setTitle("");
listloadlistz =(ListView) findViewById(R.id.timetablez1zz);
arrayList = new ArrayList<LoadCrimeReport>();
HashMap postdata = new HashMap();
// Toast.makeText(this, "dis eka"+ManyVariables.copdistricrz, Toast.LENGTH_SHORT).show();
postdata.put("copdistrictz", ManyVariables.copdistricrz);
PostResponseAsyncTask task = new PostResponseAsyncTask(LoadCrimeReports.this,postdata);
task.execute("http://potcantalk.com/mobileapp/loadreportcrimez.php");
}
@Override
public void processFinish(String s) {
try {
//Toast.makeText(this, "--"+s, Toast.LENGTH_SHORT).show();
JSONArray ja = new JSONArray(s);
//Toast.makeText(this, ja.toString(), Toast.LENGTH_SHORT).show();
for (int f = 0;f < ja.length(); f++){
JSONObject job = ja.getJSONObject(f);
LoadCrimeReport i = new LoadCrimeReport();
i.idcrimedetails =job.get("idcrimes").toString();
i.reportby=job.get("reportedby").toString();
i.crimetype=job.get("crimedes").toString();
arrayList.add(i);
}
reportcrimeadapter my = new reportcrimeadapter(this,arrayList);
listloadlistz.setAdapter(my);
}catch (Exception e){
Toast.makeText(this, "error"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
public class LoadEnquirisDoc {
String id;
String doctorname;
String datez;
String timez;
LoadEnquirisDoc(String id,String doctorname,String datez,String timez){
id = this.id;
doctorname = this.doctorname;
datez= this.datez;
timez = this.timez;
}
LoadEnquirisDoc(){
}
}
package com.example.dushan.crimeandmissingrepoter;
public class LoadInquiries {
String id;
String doctorname;
String datez;
String timez;
LoadInquiries(String id,String doctorname,String datez,String timez){
id = this.id;
doctorname = this.doctorname;
datez= this.datez;
timez = this.timez;
}
LoadInquiries(){
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.HashMap;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
public class Login extends AppCompatActivity implements AsyncResponse{
private EditText emailEditText;
private EditText passEditText;
private TextView createaccount;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
emailEditText = (EditText) findViewById(R.id.username);
passEditText = (EditText) findViewById(R.id.password);
createaccount = (TextView) findViewById(R.id.textView3);
createaccount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Login.this,CreateAccount.class);
startActivity(i);
}
});
}
public void checkLogin(View arg0) {
String uname = emailEditText.getText().toString();
String paasswd = passEditText.getText().toString();
if(uname.equals("") || paasswd.equals("")){
Toast.makeText(this, "Please Fill All Feilds..", Toast.LENGTH_SHORT).show();
}else {
try{
HashMap postdata = new HashMap();
postdata.put("useremail", uname);
postdata.put("uerpassword", paasswd);
PostResponseAsyncTask task = new PostResponseAsyncTask(Login.this, postdata);
task.execute("http://potcantalk.com/mobileapp/loginuser.php");
}catch(Exception e){
Toast.makeText(Login.this, "---"+e, Toast.LENGTH_LONG).show();
}
}
}
// private boolean isValidEmail(String email) {
// String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
// + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
//
// Pattern pattern = Pattern.compile(EMAIL_PATTERN);
// Matcher matcher = pattern.matcher(email);
// return matcher.matches();
// }
@Override
public void processFinish(String s) {
String getresponse =s;
//Toast.makeText(Login.this, "---"+s, Toast.LENGTH_LONG).show();
if(getresponse.equals("error")){
Toast.makeText(Login.this, "Invalid Login Login Details", Toast.LENGTH_LONG).show();
}else {
String dataget[] = getresponse.split(",,");
ManyVariables.fname =dataget[0];
ManyVariables.lname =dataget[1];
ManyVariables.district =dataget[2];
ManyVariables.nicz =dataget[3];
Intent jj = new Intent(Login.this, UserHome.class);
startActivity(jj);
}
}
// validating password
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class LoginDoctor extends AppCompatActivity {
Button bz;
TextView tv1;
EditText username,passw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_login_doctor2);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
StrictMode.setThreadPolicy(policy);
username = findViewById(R.id.usernamelogz2);
passw = findViewById(R.id.passwordlogz2);
tv1 = findViewById(R.id.gotoregister2);
bz = findViewById(R.id.logz2);
tv1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(LoginDoctor.this,RegisterDoctor.class);
startActivity(ii);
}
});
bz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String unman = username.getText().toString();
String pass1 = passw.getText().toString();
try{
if(unman.equals("") || pass1.equals("")){
Toast.makeText(LoginDoctor.this, "Please fill all the feilds..", Toast.LENGTH_SHORT).show();
}else {
String searchquer = "select * from doctordetails where nic='" + unman + "' and passwords='" + pass1 + "'";
ResultSet rs = DbConnection.search(searchquer);
if (rs.next()) {
String userstat = rs.getString("statusz");
DbConnection.emailzloadingz = unman;
DbConnection.usernameloadingz = rs.getString("namez");
DbConnection.load_usertypez = rs.getString("statusz");
DbConnection.doctorid_load = rs.getString("id");
System.out.println("Sqlzz"+userstat);
if (userstat.equals("pending")) {
Toast.makeText(LoginDoctor.this, "Account still not accepted by admin", Toast.LENGTH_SHORT).show();
} else {
DbConnection.load_user_passwordz = pass1;
Toast.makeText(LoginDoctor.this, "Login sucess", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginDoctor.this, DoctorHomepage.class);
startActivity(intent);
}
} else {
Toast.makeText(LoginDoctor.this, "Invalid login details", Toast.LENGTH_SHORT).show();
}
}
}catch(Exception e){
System.out.println("Sql errorz"+e);
Toast.makeText(LoginDoctor.this, "---"+e, Toast.LENGTH_SHORT).show();
}
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MakeAnInquireDoctor extends AppCompatActivity {
TextView tv1,tv2,tv3;
EditText ed1;
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_make_an_inquire_doctor);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
tv1 = findViewById(R.id.doctornamezloading);
tv2 = findViewById(R.id.loaddoctortypezloadingtype);
tv3 = findViewById(R.id.doctorcontactszloadingz);
ed1 = findViewById(R.id.descriptiondoczll);
b1 = findViewById(R.id.makeenquiryz);
try {
String canid = DbConnection.load_user_single_id;
String sqlload = "SELECT * FROM doctordetails where id='"+canid+"'";
ResultSet rs = DbConnection.search(sqlload);
if (rs.next()){
tv1.setText(rs.getString("namez"));
tv2.setText(rs.getString("speciaalicedin"));
tv3.setText(rs.getString("contactinemergancy"));
}
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String desc = ed1.getText().toString();
if(desc.equals("")){
Toast.makeText(MakeAnInquireDoctor.this, "Please enter your description", Toast.LENGTH_SHORT).show();
}else{
String user_emailz = DbConnection.emailzloadingz;
String orgnamez = "";
String doc_id = DbConnection.load_user_single_id;
String doc_name = tv1.getText().toString();
String doc_type = tv2.getText().toString();
String doc_contactz = tv3.getText().toString();
Date dd = new Date();
Date dd2 = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/dd/MM");
SimpleDateFormat sdf2 = new SimpleDateFormat("hh:mm:ss a");
String datez = sdf.format(dd);
String timez = sdf2.format(dd2);
String statuz = "pending";
try {
String sqlload2 = "SELECT * FROM minersregister where orgemailz='"+user_emailz+"'";
ResultSet rs2 = DbConnection.search(sqlload2);
if (rs2.next()){
orgnamez = rs2.getString("orgname");
}
String que = "insert into inquirydetailz\n" +
" (orgemailz,\n" +
" organizationname,\n" +
" docnamez,\n" +
" doctortypez,\n" +
" doctorcontactz,\n" +
" doctoridz,\n" +
" descriptz,\n" +
" datez,\n" +
" timez,\n" +
" statusz)\n" +
"values ('"+user_emailz+"',\n" +
" '"+orgnamez+"',\n" +
" '"+doc_name+"',\n" +
" '"+doc_type+"',\n" +
" '"+doc_contactz+"',\n" +
" '"+doc_id+"',\n" +
" '"+desc+"',\n" +
" '"+datez+"',\n" +
" '"+timez+"',\n" +
" '"+statuz+"');";
DbConnection.iud(que);
Toast.makeText(MakeAnInquireDoctor.this, "Your inquiry has being sent..", Toast.LENGTH_LONG).show();
Intent intent =new Intent(MakeAnInquireDoctor.this,MinerHomePage.class);
startActivity(intent);
}catch (Exception ez){
Toast.makeText(MakeAnInquireDoctor.this, "Sql errorz"+ez, Toast.LENGTH_SHORT).show();
}
}
}
});
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "Sql errorz"+ee, Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
public class ManyVariables {
public static String fname;
public static String lname;
public static String district;
public static String nicz;
public static String contactz;
public static String copfname;
public static String coplname;
public static String copdistricrz;
public static String crimeidz;
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class MinerHomePage extends AppCompatActivity {
RelativeLayout relativeLayout1,relativeLayout2;
TextView textView,textView2;
Button btn,btn2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_miner_home_page);
relativeLayout1 = findViewById(R.id.electionhomeload2);
relativeLayout2 = findViewById(R.id.feedbackhomeload);
textView = findViewById(R.id.loadinghomenamez);
textView.setText(""+DbConnection.usernameloadingz);
btn = findViewById(R.id.logoutzmin);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(MinerHomePage.this,HomeBothmain.class);
startActivity(ii);
}
});
relativeLayout2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(MinerHomePage.this,SubMinerDoctorHome.class);
startActivity(ii);
}
});
relativeLayout1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(MinerHomePage.this,SelectEnquiryHome.class);
startActivity(ii);
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class MinerLogin extends AppCompatActivity {
Button bz;
TextView tv1;
EditText username,passw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_miner_login);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
StrictMode.setThreadPolicy(policy);
username = findViewById(R.id.usernamelogz);
passw = findViewById(R.id.passwordlogz);
tv1 = findViewById(R.id.gotoregister);
bz = findViewById(R.id.logz);
tv1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(MinerLogin.this,MinersRegister.class);
startActivity(ii);
}
});
bz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String unman = username.getText().toString();
String pass1 = passw.getText().toString();
try{
if(unman.equals("") || pass1.equals("")){
Toast.makeText(MinerLogin.this, "Please fill all the feilds..", Toast.LENGTH_SHORT).show();
}else {
String searchquer = "select * from minersregister where orgemailz='" + unman + "' and pwz='" + pass1 + "'";
ResultSet rs = DbConnection.search(searchquer);
if (rs.next()) {
String userstat = rs.getString("statusz");
DbConnection.emailzloadingz = unman;
DbConnection.usernameloadingz = rs.getString("orgname");
DbConnection.load_usertypez = rs.getString("statusz");
if (userstat.equals("Pending")) {
Toast.makeText(MinerLogin.this, "Account still not accepted by admin", Toast.LENGTH_SHORT).show();
} else {
DbConnection.load_user_passwordz = pass1;
Toast.makeText(MinerLogin.this, "Login sucess", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MinerLogin.this, MinerHomePage.class);
startActivity(intent);
}
} else {
Toast.makeText(MinerLogin.this, "Invalid login details", Toast.LENGTH_SHORT).show();
}
}
}catch(Exception e){
System.out.println("Sql errorz"+e);
Toast.makeText(MinerLogin.this, "---"+e, Toast.LENGTH_SHORT).show();
}
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class MinersRegister extends AppCompatActivity {
EditText ed1,ed2,ed3,ed4,ed5,ed6,ed7,ed8;
Button b1;
TextView tv1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_miners_register);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
StrictMode.setThreadPolicy(policy);
b1= findViewById(R.id.btnregisterminer);
ed1 = findViewById(R.id.minername);
ed2 = findViewById(R.id.minernic);
ed3 = findViewById(R.id.minregno);
ed4 = findViewById(R.id.mincontact);
ed5 = findViewById(R.id.descmin);
ed6 = findViewById(R.id.emailz);
ed7 = findViewById(R.id.pw1min);
ed8 = findViewById(R.id.pw2min);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
String organizationname = ed1.getText().toString();
String organizationaddress = ed2.getText().toString();
String organizatioregno = ed3.getText().toString();
String organizationcontact = ed4.getText().toString();
String organizationdesc = ed5.getText().toString();
String organizatioemailz = ed6.getText().toString();
String organizationpw1 = ed7.getText().toString();
String organizationpw2 = ed8.getText().toString();
if(organizationname.equals("") || organizationaddress.equals("") || organizatioregno.equals("") || organizationcontact.equals("")
|| organizationdesc.equals("")|| organizatioemailz.equals("") || organizationpw1.equals("")|| organizationpw2.equals("")){
Toast.makeText(MinersRegister.this, "Please Fill all feilds..!", Toast.LENGTH_LONG).show();
}else if(!(organizationpw1.equals(organizationpw2))){
Toast.makeText(MinersRegister.this, "Passwords Are not Matched..!", Toast.LENGTH_LONG).show();
}else{
String stat = "Pending";
String ss = "select * from minersregister where orgemailz='"+organizatioemailz+"'";
ResultSet rs = DbConnection.search(ss);
if(rs.next()){
Toast.makeText(MinersRegister.this, "This Email address is already registered...!", Toast.LENGTH_SHORT).show();
}else{
String que = "insert into minersregister\n" +
" (orgname,\n" +
" orgaddress,\n" +
" orgregisternumber,\n" +
" orgcontact,\n" +
" orgdesc,\n" +
" orgemailz,\n" +
" pwz,\n" +
" statusz)\n" +
"values ('"+organizationname+"',\n" +
" '"+organizationaddress+"',\n" +
" '"+organizatioregno+"',\n" +
" '"+organizationcontact+"',\n" +
" '"+organizationdesc+"',\n" +
" '"+organizatioemailz+"',\n" +
" '"+organizationpw1+"',\n" +
" '"+stat+"');";
DbConnection.iud(que);
Toast.makeText(MinersRegister.this, "Your account has been sent to approval..", Toast.LENGTH_LONG).show();
Intent intent =new Intent(MinersRegister.this,PreLoadMiner.class);
startActivity(intent);
}
}
}catch (Exception ez){
System.out.println("Sql errorz"+ez);
Toast.makeText(MinersRegister.this, "er"+ez, Toast.LENGTH_SHORT).show();
}
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.Manifest;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import net.gotev.uploadservice.MultipartUploadRequest;
import net.gotev.uploadservice.UploadNotificationConfig;
import net.gotev.uploadservice.UploadService;
public class MissingpersonReport extends AppCompatActivity{
EditText editText1,editText2,editText3,editText4;
Button btn,btn2;
ImageView img;
private static final int STORAGE_PERMISSION_CODE = 4655;
private static final String upload_uri = "http://potcantalk.com/mobileapp/uploadimagez.php";
private int PICK_IMAGE_RESULT = 1;
private Uri filepath;
private Bitmap bitmap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_missingperson_report);
UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;
storagePermission();
editText1 =(EditText) findViewById(R.id.namemissing);
editText2 =(EditText) findViewById(R.id.address);
editText3 =(EditText) findViewById(R.id.loctionz);
editText4 =(EditText) findViewById(R.id.decription);
btn =(Button) findViewById(R.id.reportmissing);
btn2 =(Button) findViewById(R.id.imageselect);
img = (ImageView) findViewById(R.id.selectedimage);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String name_missing = editText1.getText().toString();
String missingaddress = editText2.getText().toString();
String missinglocation = editText3.getText().toString();
String missingdescription = editText4.getText().toString();
UploadData(name_missing,missingaddress,missinglocation,missingdescription);
}
});
}
private void storagePermission(){
if(ContextCompat.checkSelfPermission(MissingpersonReport.this, Manifest.permission.READ_EXTERNAL_STORAGE ) == PackageManager.PERMISSION_GRANTED ) {
return;
}
ActivityCompat.requestPermissions(MissingpersonReport.this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},STORAGE_PERMISSION_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if(requestCode == STORAGE_PERMISSION_CODE){
if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(this, "Permission Denied", Toast.LENGTH_SHORT).show();
}
}
}
public void selectImage(View view){
showFileChooser();
}
private void showFileChooser(){
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Image"),PICK_IMAGE_RESULT);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == PICK_IMAGE_RESULT && data != null && data.getData() != null){
filepath = data.getData();
try{
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(),filepath);
img.setImageBitmap(bitmap);
}catch (Exception e){
Toast.makeText(this, "error----"+e, Toast.LENGTH_SHORT).show();
}
}
}
private String getPath(Uri uri){
Cursor cursor = getContentResolver().query(uri,null,null,null,null);
cursor.moveToFirst();
String document_id = cursor.getString(0);
document_id = document_id.substring(document_id.lastIndexOf(":")+1);
cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,null,MediaStore.Images.Media._ID+"=?",new String[]{document_id},null);
cursor.moveToFirst();
String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
cursor.close();
return path;
}
public void UploadData(String name,String address,String location,String description){
try {
Date dd = new Date();
Date dd2 = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/dd/MM");
SimpleDateFormat sdf2 = new SimpleDateFormat("hh:mm:ss a");
String datez = sdf.format(dd);
String timez = sdf2.format(dd2);
String path = getPath(filepath);
String upload_Id = UUID.randomUUID().toString();
MultipartUploadRequest uploadRequest= new MultipartUploadRequest(this,upload_Id,upload_uri)
.addFileToUpload(path,"image")
.addParameter("missingname",name)
.addParameter("name",ManyVariables.nicz)
.addParameter("reportusername", ManyVariables.fname)
.addParameter("missingaddress",address)
.addParameter("missinglocation",location)
.addParameter("datez",datez)
.addParameter("timez",timez)
.addParameter("missingdescription",description)
.setMaxRetries(3);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager notificationManager = (NotificationManager) getSystemService(Service.NOTIFICATION_SERVICE);
NotificationChannel channel = new NotificationChannel("Upload", "Upload service", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
UploadNotificationConfig notificationConfig = new UploadNotificationConfig();
notificationConfig.setNotificationChannelId("Upload");
uploadRequest.setNotificationConfig(notificationConfig);
} else {
// If android < Oreo, just set a simple notification (or remove if you don't wanna any notification
// Notification is mandatory for Android > 8
uploadRequest.setNotificationConfig(new UploadNotificationConfig());
}
uploadRequest.startUpload();
}catch (Exception e){
Toast.makeText(this, "Upload Error--"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.util.ArrayList;
public class PendingEnquirires extends AppCompatActivity {
ListView listView;
ArrayList<LoadInquiries> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_pending_enquirires);
listView = findViewById(R.id.lstreqz);
arrayList = new ArrayList<LoadInquiries>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
try {
String useremptype = DbConnection.emailzloadingz;
String stat = "Active";
String sqlload = "SELECT * FROM inquirydetailz where orgemailz='"+useremptype+"' and statusz='Pending' ORDER BY id DESC";
ResultSet rs = DbConnection.search(sqlload);
while (rs.next()){
LoadInquiries i = new LoadInquiries();
i.id =rs.getString("id");
i.doctorname=rs.getString("docnamez");
i.datez=rs.getString("datez");
i.timez=rs.getString("timez");
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
class missingloadAdapter extends ArrayAdapter {
Context c;
ArrayList<LoadInquiries> list;
public missingloadAdapter(Context context ,ArrayList<LoadInquiries> ar) {
super(context, R.layout.doctor_design_load,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.inquiry_design_load,null);
final LoadInquiries loadTimeTables = list.get(position);
final TextView orderidhidden =(TextView) v.findViewById(R.id.hiddeniddeninq);
orderidhidden.setText(loadTimeTables.id);
// localVari.Preg_topic_Name = loadTimeTables.topicname;
final TextView electionnamez =(TextView) v.findViewById(R.id.doctor_name_load_inquiry);
electionnamez.setText("Doctor name : "+loadTimeTables.doctorname);
final TextView dateheldz =(TextView) v.findViewById(R.id.date_inqui);
dateheldz.setText("Date : "+loadTimeTables.datez);
final TextView timeheldz =(TextView) v.findViewById(R.id.timez_inqui);
timeheldz.setText("Time : "+loadTimeTables.timez);
Button vieworderdetailsz =(Button) v.findViewById(R.id.viewconsult_singeledetails);
vieworderdetailsz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.single_inquid = election_nameloadz;
Intent ii = new Intent(PendingEnquirires.this, SingleViewPendingInquiry.class);
startActivity(ii);
}
});
return v;
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
public class PreLoadDoctor extends AppCompatActivity {
Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_pre_load_doctor);
b1 = findViewById(R.id.btnlog_doc);
b2 = findViewById(R.id.btnreg_doc);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(PreLoadDoctor.this,LoginDoctor.class);
startActivity(ii);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent ii = new Intent(PreLoadDoctor.this,RegisterDoctor.class);
startActivity(ii);
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
public class PreLoadMiner extends AppCompatActivity {
Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_pre_load_miner);
b1 = findViewById(R.id.btnlog_min);
b2 = findViewById(R.id.btnreg_min);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(PreLoadMiner.this,MinerLogin.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(PreLoadMiner.this,MinersRegister.class);
startActivity(i);
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
public class RepotCrime extends AppCompatActivity implements AsyncResponse{
private static final int REQUEST_LOCATION=1;
LocationManager locationManager;
String latitude,longitude;
EditText teleno,crimedescription;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_repot_crime);
ActivityCompat.requestPermissions(this,new String[]
{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION);
teleno = (EditText) findViewById(R.id.telephoneno);
crimedescription = (EditText) findViewById(R.id.crimedes);
btn = (Button) findViewById(R.id.reportcrimezzz);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String tele = teleno.getText().toString();
String des = crimedescription.getText().toString();
Date dd = new Date();
Date dd2 = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/dd/MM");
SimpleDateFormat sdf2 = new SimpleDateFormat("hh:mm:ss a");
String datez = sdf.format(dd);
String timez = sdf2.format(dd2);
locationManager=(LocationManager) getSystemService(RepotCrime.this.LOCATION_SERVICE);
if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
{
//Write Function To enable gps
OnGPS();
}
else
{
//GPS is already On then
getLocation();
}
try {
String userfullname = ManyVariables.fname+" "+ManyVariables.lname;
HashMap postdata = new HashMap();
postdata.put("nameinfull",userfullname);
postdata.put("datez",datez);
postdata.put("timez",timez);
postdata.put("contactz",tele);
postdata.put("district",ManyVariables.district);
postdata.put("Nic",ManyVariables.nicz);
postdata.put("lateka",latitude);
postdata.put("longeka",longitude);
postdata.put("crimede",des);
PostResponseAsyncTask task = new PostResponseAsyncTask(RepotCrime.this,postdata);
task.execute("http://potcantalk.com/mobileapp/reportcrimeuser.php");
}catch (Exception e){
Toast.makeText(RepotCrime.this, "---"+e, Toast.LENGTH_LONG).show();
}
}
});
}
private void getLocation() {
if (ActivityCompat.checkSelfPermission(RepotCrime.this,Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(RepotCrime.this,
Manifest.permission.ACCESS_COARSE_LOCATION) !=PackageManager.PERMISSION_GRANTED)
{
ActivityCompat.requestPermissions(this,new String[]
{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION);
}
else
{
Location LocationGps= locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Location LocationNetwork=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Location LocationPassive=locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
if (LocationGps !=null)
{
double lat=LocationGps.getLatitude();
double longi=LocationGps.getLongitude();
latitude=String.valueOf(lat);
longitude=String.valueOf(longi);
}
else if (LocationNetwork !=null)
{
double lat=LocationNetwork.getLatitude();
double longi=LocationNetwork.getLongitude();
latitude=String.valueOf(lat);
longitude=String.valueOf(longi);
}
else if (LocationPassive !=null)
{
double lat=LocationPassive.getLatitude();
double longi=LocationPassive.getLongitude();
latitude=String.valueOf(lat);
longitude=String.valueOf(longi);
}
else
{
Toast.makeText(this, "Can't Get Your Location", Toast.LENGTH_SHORT).show();
}
//Thats All Run Your App
}
}
private void OnGPS() {
final AlertDialog.Builder builder= new AlertDialog.Builder(this);
builder.setMessage("Enable GPS").setCancelable(false).setPositiveButton("YES", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
}).setNegativeButton("NO", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
final AlertDialog alertDialog=builder.create();
alertDialog.show();
}
@Override
public void processFinish(String s) {
String getresponse =s;
if(getresponse.equals("ok")){
Toast.makeText(RepotCrime.this, "Crime Reported..", Toast.LENGTH_LONG).show();
}else{
Toast.makeText(RepotCrime.this, "Something Went Wrong..", Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class SearchButtonDoc extends AppCompatActivity {
EditText ed1;
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_search_button_doc);
ed1 = findViewById(R.id.typingsearch);
b1 = findViewById(R.id.Searchdoc);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
String text = ed1.getText().toString();
if(text.equals("")){
Toast.makeText(SearchButtonDoc.this, "Enter Reg Number to search", Toast.LENGTH_SHORT).show();
}else{
DbConnection.search_text = text;
Intent intent = new Intent(SearchButtonDoc.this, SearchDoctors.class);
startActivity(intent);
}
}catch (Exception ee){
Toast.makeText(SearchButtonDoc.this, "ee"+ee, Toast.LENGTH_SHORT).show();
}
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.util.ArrayList;
public class SearchDoctors extends AppCompatActivity {
ListView listView;
ArrayList<LoadAllDoctos> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_search_doctors);
listView = findViewById(R.id.rvlistz1);
arrayList = new ArrayList<LoadAllDoctos>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
try {
String tt = DbConnection.search_text;
String useremptype = DbConnection.load_usertypez;
String stat = "Active";
String sqlload = "SELECT * FROM doctordetails where statusz='Active' and docregno like '%"+tt+"%' ORDER BY id DESC";
ResultSet rs = DbConnection.search(sqlload);
while (rs.next()){
LoadAllDoctos i = new LoadAllDoctos();
i.id =rs.getString("id");
i.doctorname=rs.getString("namez");
i.doctortype=rs.getString("speciaalicedin");
i.regno=rs.getString("docregno");
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
class missingloadAdapter extends ArrayAdapter {
Context c;
ArrayList<LoadAllDoctos> list;
public missingloadAdapter(Context context ,ArrayList<LoadAllDoctos> ar) {
super(context, R.layout.doctor_design_load,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.doctor_design_load,null);
final LoadAllDoctos loadTimeTables = list.get(position);
final TextView orderidhidden =(TextView) v.findViewById(R.id.hiddeniddocz);
orderidhidden.setText(loadTimeTables.id);
// localVari.Preg_topic_Name = loadTimeTables.topicname;
final TextView electionnamez =(TextView) v.findViewById(R.id.doctor_name_load);
electionnamez.setText("Doctor name : "+loadTimeTables.doctorname);
final TextView dateheldz =(TextView) v.findViewById(R.id.doctor_type_load);
dateheldz.setText("Type : "+loadTimeTables.doctortype);
final TextView timeheldz =(TextView) v.findViewById(R.id.doctor_regno_load);
timeheldz.setText("Reg No : "+loadTimeTables.regno);
Button vieworderdetailsz =(Button) v.findViewById(R.id.viewdoctot_singeledetails);
Button make_aninq =(Button) v.findViewById(R.id.manageenuire);
vieworderdetailsz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.load_user_single_id = election_nameloadz;
Intent ii = new Intent(SearchDoctors.this, SingleDoctorDetails.class);
startActivity(ii);
}
});
make_aninq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.load_user_single_id = election_nameloadz;
Intent ii = new Intent(SearchDoctors.this, MakeAnInquireDoctor.class);
startActivity(ii);
}
});
return v;
}}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
public class SelectEnquiryHome extends AppCompatActivity {
Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_select_enquiry_home);
b1 = findViewById(R.id.pendingreqz);
b2 = findViewById(R.id.acceptrequesz);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(SelectEnquiryHome.this,PendingEnquirires.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(SelectEnquiryHome.this,AcceptedEnquiries.class);
startActivity(i);
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
import java.util.ArrayList;
public class ShowAllDoctors extends AppCompatActivity {
ListView listView;
ArrayList<LoadAllDoctos> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_show_all_doctors);
listView = findViewById(R.id.rvlistz);
arrayList = new ArrayList<LoadAllDoctos>();
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
try {
String useremptype = DbConnection.load_usertypez;
String stat = "Active";
String sqlload = "SELECT * FROM doctordetails where statusz='Active' ORDER BY id DESC";
ResultSet rs = DbConnection.search(sqlload);
while (rs.next()){
LoadAllDoctos i = new LoadAllDoctos();
i.id =rs.getString("id");
i.doctorname=rs.getString("namez");
i.doctortype=rs.getString("speciaalicedin");
i.regno=rs.getString("docregno");
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
class missingloadAdapter extends ArrayAdapter {
Context c;
ArrayList<LoadAllDoctos> list;
public missingloadAdapter(Context context ,ArrayList<LoadAllDoctos> ar) {
super(context, R.layout.doctor_design_load,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.doctor_design_load,null);
final LoadAllDoctos loadTimeTables = list.get(position);
final TextView orderidhidden =(TextView) v.findViewById(R.id.hiddeniddocz);
orderidhidden.setText(loadTimeTables.id);
// localVari.Preg_topic_Name = loadTimeTables.topicname;
final TextView electionnamez =(TextView) v.findViewById(R.id.doctor_name_load);
electionnamez.setText("Doctor name : "+loadTimeTables.doctorname);
final TextView dateheldz =(TextView) v.findViewById(R.id.doctor_type_load);
dateheldz.setText("Type : "+loadTimeTables.doctortype);
final TextView timeheldz =(TextView) v.findViewById(R.id.doctor_regno_load);
timeheldz.setText("Reg No : "+loadTimeTables.regno);
Button vieworderdetailsz =(Button) v.findViewById(R.id.viewdoctot_singeledetails);
Button make_aninq =(Button) v.findViewById(R.id.manageenuire);
vieworderdetailsz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.load_user_single_id = election_nameloadz;
Intent ii = new Intent(ShowAllDoctors.this, SingleDoctorDetails.class);
startActivity(ii);
}
});
make_aninq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String election_nameloadz = orderidhidden.getText().toString();
DbConnection.load_user_single_id = election_nameloadz;
Intent ii = new Intent(ShowAllDoctors.this, MakeAnInquireDoctor.class);
startActivity(ii);
}
});
return v;
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import java.util.HashMap;
public class SingleCrimeDetails extends AppCompatActivity implements AsyncResponse {
TextView textView1,textView2,textView3,textView4,textView5,textView6;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_crime_details);
textView1 = findViewById(R.id.textviewone);
textView2 = findViewById(R.id.textviewtwo);
textView3 = findViewById(R.id.textviewthree);
textView4 = findViewById(R.id.textviefour);
textView5 = findViewById(R.id.textviefive);
textView6 = findViewById(R.id.textviewsix);
button = (Button) findViewById(R.id.markasreported);
final String crimeidekaloadz =getIntent().getStringExtra("crimeidz");
try{
// Toast.makeText(SingleCrimeDetails.this, "crime id eka"+crimeidekaloadz, Toast.LENGTH_LONG).show();
HashMap postdata = new HashMap();
postdata.put("crimeidz", crimeidekaloadz);
PostResponseAsyncTask task = new PostResponseAsyncTask(SingleCrimeDetails.this, postdata);
task.execute("http://potcantalk.com/mobileapp/loadsinglecrimedetails.php");
}catch(Exception e){
Toast.makeText(SingleCrimeDetails.this, "---"+e, Toast.LENGTH_LONG).show();
}
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try{
// Toast.makeText(SingleCrimeDetails.this, "crime id eka"+crimeidekaloadz, Toast.LENGTH_LONG).show();
HashMap postdata = new HashMap();
postdata.put("crimeidekareportz", crimeidekaloadz);
PostResponseAsyncTask task = new PostResponseAsyncTask(SingleCrimeDetails.this, postdata);
task.execute("http://potcantalk.com/mobileapp/makecrimereported.php");
}catch(Exception e){
Toast.makeText(SingleCrimeDetails.this, "---"+e, Toast.LENGTH_LONG).show();
}
}
});
}
@Override
public void processFinish(String s) {
try {
String getresponse =s;
//Toast.makeText(SingleCrimeDetails.this, "---"+s, Toast.LENGTH_LONG).show();
if(getresponse.equals("error")){
Toast.makeText(SingleCrimeDetails.this, "Invalid Login Login Details", Toast.LENGTH_LONG).show();
}else if(getresponse.equals("ok")){
Toast.makeText(SingleCrimeDetails.this, "Crime Marked As Reported", Toast.LENGTH_LONG).show();
}else {
String dataget[] = getresponse.split(",,");
textView1.setText("Crime Date-"+ dataget[0]);
textView2.setText("Crime time-"+dataget[1]);
textView3.setText("Report By-"+dataget[2]);
textView4.setText("Contact No-"+dataget[3]);
textView5.setText("NIC-"+dataget[4]);
textView6.setText("Crime Description-"+dataget[5]);
}
}catch (Exception e){
Toast.makeText(SingleCrimeDetails.this, "error--"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class SingleDoctorDetails extends AppCompatActivity {
TextView tv1,tv2,tv3,tv4,tv5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_single_doctor_details);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
tv1 = findViewById(R.id.doctornamez);
tv2 = findViewById(R.id.loaddoctortypez);
tv3 = findViewById(R.id.doccitiz);
tv4 = findViewById(R.id.doctorcontactsz);
tv5 = findViewById(R.id.descriptiondocz);
try {
String canid = DbConnection.load_user_single_id;
String sqlload = "SELECT * FROM doctordetails where id='"+canid+"'";
ResultSet rs = DbConnection.search(sqlload);
if (rs.next()){
tv1.setText("Doctor Name :"+rs.getString("namez"));
tv2.setText("Type :"+rs.getString("speciaalicedin"));
tv3.setText("City :"+rs.getString("city"));
tv4.setText("Contact :"+rs.getString("contactinemergancy"));
ImageView imv = findViewById(R.id.loaddoczimage);
tv5.setText("Description :"+rs.getString("description"));
// Glide.with(SingleDoctorDetails.this).load(rs.getString("imgurlz")).into(imv);
}
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import java.util.HashMap;
public class SingleReportDetais extends AppCompatActivity implements AsyncResponse {
TextView textView1,textView2,textView3,textView4,textView5,textView6;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_report_detais);
textView1 = findViewById(R.id.textviewonezz);
textView2 = findViewById(R.id.textviewtwozz);
textView3 = findViewById(R.id.textviewthreezz);
textView4 = findViewById(R.id.textviefourzz);
textView5 = findViewById(R.id.textviefivezz);
textView6 = findViewById(R.id.textviewsixzz);
String crimeidekaloadz =getIntent().getStringExtra("crimeidreport");
try{
//Toast.makeText(SingleReportDetais.this, "crime id eka"+crimeidekaloadz, Toast.LENGTH_LONG).show();
HashMap postdata = new HashMap();
postdata.put("crimeidz", crimeidekaloadz);
PostResponseAsyncTask task = new PostResponseAsyncTask(SingleReportDetais.this, postdata);
task.execute("http://potcantalk.com/mobileapp/loadsinglecrimereportdetails.php");
}catch(Exception e){
Toast.makeText(SingleReportDetais.this, "---"+e, Toast.LENGTH_LONG).show();
}
}
@Override
public void processFinish(String s) {
try {
String getresponse =s;
// Toast.makeText(SingleReportDetais.this, "---"+s, Toast.LENGTH_LONG).show();
if(getresponse.equals("error")){
Toast.makeText(SingleReportDetais.this, "Invalid Login Login Details", Toast.LENGTH_LONG).show();
}else {
String dataget[] = getresponse.split(",,");
textView1.setText("Crime Date-"+ dataget[0]);
textView2.setText("Crime time-"+dataget[1]);
textView3.setText("Report By-"+dataget[2]);
textView4.setText("Contact No-"+dataget[3]);
textView5.setText("NIC-"+dataget[4]);
textView6.setText("Crime Description-"+dataget[5]);
}
}catch (Exception e){
Toast.makeText(SingleReportDetais.this, "error--"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class SingleViewCompletedInq extends AppCompatActivity {
TextView tv1,tv2,tv3,tv4,tv5,tv6;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_single_view_completed_inq);
tv1 = findViewById(R.id.doctornamez23);
tv2 = findViewById(R.id.loaddoctortypez23);
tv3 = findViewById(R.id.datezinz3);
tv4 = findViewById(R.id.timezinz3);
tv5 = findViewById(R.id.descriptioninquz3);
tv6= findViewById(R.id.commentzz3);
try {
String canid = DbConnection.single_inquid;
String sqlload = "SELECT * FROM inquirydetailz where id='"+canid+"'";
ResultSet rs = DbConnection.search(sqlload);
if (rs.next()){
tv1.setText("Doctor Name : "+rs.getString("docnamez"));
tv2.setText("Type : "+rs.getString("doctortypez"));
tv3.setText("Date : "+rs.getString("datez"));
tv4.setText("Time : "+rs.getString("timez"));
tv5.setText("Description : "+rs.getString("descriptz"));
tv5.setText("Comment : "+rs.getString("comment"));
// Glide.with(SingleDoctorDetails.this).load(rs.getString("imgurlz")).into(imv);
}
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class SingleViewPendingInquiry extends AppCompatActivity {
TextView tv1,tv2,tv3,tv4,tv5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_single_view_pending_inquiry);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
tv1 = findViewById(R.id.doctornamez2);
tv2 = findViewById(R.id.loaddoctortypez2);
tv3 = findViewById(R.id.datezinz);
tv4 = findViewById(R.id.timezinz);
tv5 = findViewById(R.id.descriptioninquz);
try {
String canid = DbConnection.single_inquid;
String sqlload = "SELECT * FROM inquirydetailz where id='"+canid+"'";
ResultSet rs = DbConnection.search(sqlload);
if (rs.next()){
tv1.setText("Doctor Name : "+rs.getString("docnamez"));
tv2.setText("Type : "+rs.getString("doctortypez"));
tv3.setText("Date : "+rs.getString("datez"));
tv4.setText("Time : "+rs.getString("timez"));
tv5.setText("Description : "+rs.getString("descriptz"));
// Glide.with(SingleDoctorDetails.this).load(rs.getString("imgurlz")).into(imv);
}
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import java.sql.ResultSet;
public class SingleViewPendinginquiryDoctor extends AppCompatActivity {
TextView tv1,tv2,tv3,tv4,tv5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_single_view_pendinginquiry_doctor);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build();
tv1 = findViewById(R.id.doctornamez23);
tv2 = findViewById(R.id.loaddoctortypez23);
tv3 = findViewById(R.id.datezinz3);
tv4 = findViewById(R.id.timezinz3);
tv5 = findViewById(R.id.descriptioninquz3);
try {
String canid = DbConnection.single_inquid;
String sqlload = "SELECT * FROM inquirydetailz where id='"+canid+"'";
ResultSet rs = DbConnection.search(sqlload);
if (rs.next()){
tv1.setText("Organization Name : "+rs.getString("organizationname"));
String unmz3 = rs.getString("orgemailz");
String sqlload2 = "SELECT * FROM minersregister where orgemailz='"+unmz3+"'";
ResultSet rs2 = DbConnection.search(sqlload2);
if (rs2.next()){
tv2.setText("Organization Contact : "+rs2.getString("orgcontact"));
}
tv3.setText("Date : "+rs.getString("datez"));
tv4.setText("Time : "+rs.getString("timez"));
tv5.setText("Description : "+rs.getString("descriptz"));
// Glide.with(SingleDoctorDetails.this).load(rs.getString("imgurlz")).into(imv);
}
}catch (Exception ee){
System.out.println("Sql errorz"+ee);
Toast.makeText(this, "err--"+ee, Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
public class SubMinerDoctorHome extends AppCompatActivity {
Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_sub_miner_doctor_home);
b1 = findViewById(R.id.alldoc);
b2 = findViewById(R.id.searchdog);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent ii = new Intent(SubMinerDoctorHome.this,ShowAllDoctors.class);
startActivity(ii);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent ii = new Intent(SubMinerDoctorHome.this,SearchButtonDoc.class);
startActivity(ii);
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class Testmailz extends AppCompatActivity {
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_testmailz);
b1= findViewById(R.id.sendmailz);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
GMailSender sender = new GMailSender("", "");
sender.sendMail("This is Subject",
"This is Body",
"k.nipunaliyanage@gmail.com",
"liyanagenipu4@gmail.com");
} catch (Exception e) {
Log.e("SendMail", e.getMessage(), e);
}
}
});
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class UserHome extends AppCompatActivity {
Button btn1,btn2,btn3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_home);
btn1 =(Button) findViewById(R.id.rptcrime);
btn2 = (Button) findViewById(R.id.rptmissing);
btn3 = (Button) findViewById(R.id.logouruser);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent jj = new Intent(UserHome.this, RepotCrime.class);
startActivity(jj);
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent jj = new Intent(UserHome.this, MissingpersonReport.class);
startActivity(jj);
}
});
btn3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent jj = new Intent(UserHome.this, mainHome.class);
startActivity(jj);
}
});
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import java.util.HashMap;
public class coplogin extends AppCompatActivity implements AsyncResponse{
private EditText emailEditText;
private EditText passEditText;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_coplogin);
emailEditText = (EditText) findViewById(R.id.copnic);
passEditText = (EditText) findViewById(R.id.coppassword);
btn = (Button)findViewById(R.id.buttoncoplog);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String serial = passEditText.getText().toString();
String nic = emailEditText.getText().toString();
if(serial.equals("") || nic.equals("")){
Toast.makeText(coplogin.this, "Fill All Feilds To Continue..!", Toast.LENGTH_LONG).show();
}else{
try{
HashMap postdata = new HashMap();
postdata.put("serialz", serial);
postdata.put("nicz", nic);
PostResponseAsyncTask task = new PostResponseAsyncTask(coplogin.this, postdata);
task.execute("http://potcantalk.com/HealthApp/logincop.php");
// task.execute("http://192.168.1.100/crimenew/mobilefiles/logincop.php");
}catch(Exception e){
Toast.makeText(coplogin.this, "---"+e, Toast.LENGTH_LONG).show();
}
}
}
});
}
@Override
public void processFinish(String s) {
try {
String getresponse =s;
//Toast.makeText(coplogin.this, "---"+s, Toast.LENGTH_LONG).show();
if(getresponse.equals("error")){
Toast.makeText(coplogin.this, "Invalid Login Login Details", Toast.LENGTH_LONG).show();
}else {
String dataget[] = getresponse.split(",,");
ManyVariables.copfname =dataget[0];
ManyVariables.coplname =dataget[1];
ManyVariables.copdistricrz =dataget[2];
Intent jj = new Intent(coplogin.this, HomePagePolice.class);
startActivity(jj);
}
}catch (Exception e){
Toast.makeText(coplogin.this, "error"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter.data;
import com.example.dushan.crimeandmissingrepoter.data.model.LoggedInUser;
import java.io.IOException;
/**
* Class that handles authentication w/ login credentials and retrieves user information.
*/
public class LoginDataSource {
public Result<LoggedInUser> login(String username, String password) {
try {
// TODO: handle loggedInUser authentication
LoggedInUser fakeUser =
new LoggedInUser(
java.util.UUID.randomUUID().toString(),
"Jane Doe");
return new Result.Success<>(fakeUser);
} catch (Exception e) {
return new Result.Error(new IOException("Error logging in", e));
}
}
public void logout() {
// TODO: revoke authentication
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter.data;
import com.example.dushan.crimeandmissingrepoter.data.model.LoggedInUser;
/**
* Class that requests authentication and user information from the remote data source and
* maintains an in-memory cache of login status and user credentials information.
*/
public class LoginRepository {
private static volatile LoginRepository instance;
private LoginDataSource dataSource;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
private LoggedInUser user = null;
// private constructor : singleton access
private LoginRepository(LoginDataSource dataSource) {
this.dataSource = dataSource;
}
public static LoginRepository getInstance(LoginDataSource dataSource) {
if (instance == null) {
instance = new LoginRepository(dataSource);
}
return instance;
}
public boolean isLoggedIn() {
return user != null;
}
public void logout() {
user = null;
dataSource.logout();
}
private void setLoggedInUser(LoggedInUser user) {
this.user = user;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
}
public Result<LoggedInUser> login(String username, String password) {
// handle login
Result<LoggedInUser> result = dataSource.login(username, password);
if (result instanceof Result.Success) {
setLoggedInUser(((Result.Success<LoggedInUser>) result).getData());
}
return result;
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter.data;
/**
* A generic class that holds a result success w/ data or an error exception.
*/
public class Result<T> {
// hide the private constructor to limit subclass types (Success, Error)
private Result() {
}
@Override
public String toString() {
if (this instanceof Result.Success) {
Result.Success success = (Result.Success) this;
return "Success[data=" + success.getData().toString() + "]";
} else if (this instanceof Result.Error) {
Result.Error error = (Result.Error) this;
return "Error[exception=" + error.getError().toString() + "]";
}
return "";
}
// Success sub-class
public final static class Success<T> extends Result {
private T data;
public Success(T data) {
this.data = data;
}
public T getData() {
return this.data;
}
}
// Error sub-class
public final static class Error extends Result {
private Exception error;
public Error(Exception error) {
this.error = error;
}
public Exception getError() {
return this.error;
}
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter.data.model;
/**
* Data class that captures user information for logged in users retrieved from LoginRepository
*/
public class LoggedInUser {
private String userId;
private String displayName;
public LoggedInUser(String userId, String displayName) {
this.userId = userId;
this.displayName = displayName;
}
public String getUserId() {
return userId;
}
public String getDisplayName() {
return displayName;
}
}
\ No newline at end of file
package com.example.dushan.crimeandmissingrepoter;
import android.Manifest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
public class loadcrimelist extends AppCompatActivity implements AsyncResponse {
ListView listloadlistz;
ArrayList<locrimedetails> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loadcrimelist);
setTitle("");
listloadlistz =(ListView) findViewById(R.id.timetablez1);
arrayList = new ArrayList<locrimedetails>();
HashMap postdata = new HashMap();
// Toast.makeText(this, "dis eka"+ManyVariables.copdistricrz, Toast.LENGTH_SHORT).show();
postdata.put("copdistrictz", ManyVariables.copdistricrz);
PostResponseAsyncTask task = new PostResponseAsyncTask(loadcrimelist.this,postdata);
task.execute("http://potcantalk.com/mobileapp/loadcrimezcopz.php");
}
@Override
public void processFinish(String s) {
try {
// Toast.makeText(this, "--"+s, Toast.LENGTH_SHORT).show();
JSONArray ja = new JSONArray(s);
//Toast.makeText(this, ja.toString(), Toast.LENGTH_SHORT).show();
for (int f = 0;f < ja.length(); f++){
JSONObject job = ja.getJSONObject(f);
locrimedetails i = new locrimedetails();
i.idcrimedetails =job.get("idcrimes").toString();
i.reportby=job.get("reportedby").toString();
i.crimetype=job.get("crimedes").toString();
arrayList.add(i);
}
loadcrimesadapter my = new loadcrimesadapter(this,arrayList);
listloadlistz.setAdapter(my);
}catch (Exception e){
Toast.makeText(this, "error"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
public class loadcrimesadapter extends ArrayAdapter {
Context c;
ArrayList<locrimedetails> list;
public loadcrimesadapter(Context context ,ArrayList<locrimedetails> ar) {
super(context, R.layout.loadcrimelistadapter,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.loadcrimelistadapter,null);
final locrimedetails loadTimeTables = list.get(position);
// TextView loadgrade =(TextView) v.findViewById(R.id.loadgradez);
// loadgrade.setText(loadTimeTables.gradez);
TextView reportuserz =(TextView) v.findViewById(R.id.reptzuserz);
reportuserz.setText(loadTimeTables.reportby);
TextView crimetypez =(TextView) v.findViewById(R.id.crimetypeeka);
crimetypez.setText(loadTimeTables.crimetype);
final TextView crimeideka =(TextView) v.findViewById(R.id.hiddenidz);
crimeideka.setText(loadTimeTables.idcrimedetails);
Button viewcrime =(Button) v.findViewById(R.id.crimeviewbtn);
viewcrime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i= new Intent(c,SingleCrimeDetails.class);
i.putExtra("crimeidz", crimeideka.getText().toString());
c.startActivity(i);
}
});
return v;
}
}
package com.example.dushan.crimeandmissingrepoter;
public class locationadapter {
String idcrimedetails;
String latitute;
String longtube;
String des;
locationadapter(String idcrimedetails,String latitute,String longtube,String des){
idcrimedetails = this.idcrimedetails;
latitute = this.latitute;
longtube = this.longtube;
des = this.des;
}
locationadapter(){
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
public class locationsend extends FragmentActivity implements OnMapReadyCallback , AsyncResponse {
GoogleMap mapAPI;
SupportMapFragment mapFragment;
ArrayList<locationadapter> arrayList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_locationsend);
arrayList = new ArrayList<locationadapter>();
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapAPIz);
HashMap postdata = new HashMap();
Toast.makeText(this, "dis eka "+ManyVariables.copdistricrz, Toast.LENGTH_SHORT).show();
postdata.put("copdistrictzlocation", ManyVariables.copdistricrz);
PostResponseAsyncTask task = new PostResponseAsyncTask(locationsend.this,postdata);
task.execute("http://potcantalk.com/mobileapp/loadmaplocationz.php");
}
@Override
public void onMapReady(GoogleMap googleMap) {
mapAPI =googleMap;
for(int i=0;i< arrayList.size() ;i++ ){
locationadapter kk = arrayList.get(i);
//Set Latitute and Longtude to map
double lat = Double.parseDouble(kk.latitute);
double lang = Double.parseDouble(kk.longtube);
LatLng ahangama = new LatLng(lat,lang);
mapAPI.addMarker(new MarkerOptions().position(ahangama).title(kk.des));
mapAPI.moveCamera(CameraUpdateFactory.newLatLng(ahangama));
}
}
@Override
public void processFinish(String s) {
try {
// Toast.makeText(this, "--"+s, Toast.LENGTH_SHORT).show();
JSONArray ja = new JSONArray(s);
// Toast.makeText(this, ja.toString(), Toast.LENGTH_SHORT).show();
for (int f = 0;f < ja.length(); f++){
JSONObject job = ja.getJSONObject(f);
locationadapter i = new locationadapter();
i.idcrimedetails =job.get("idcrimes").toString();
i.latitute=job.get("latitude").toString();
i.longtube=job.get("longtude").toString();
i.des=job.get("crimedes").toString();
arrayList.add(i);
}
mapFragment.getMapAsync(locationsend.this);
}catch (Exception e){
Toast.makeText(this, "error"+e, Toast.LENGTH_LONG).show();
}
}
}
package com.example.dushan.crimeandmissingrepoter;
public class locrimedetails {
String idcrimedetails;
String crimetype;
String reportby;
locrimedetails(String idcrimedetails,String crimetype,String reportby){
idcrimedetails = this.idcrimedetails;
crimetype = this.crimetype;
reportby = this.reportby;
}
locrimedetails(){
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class mainHome extends AppCompatActivity {
Animation topanim,bottomanim;
ImageView img;
TextView tv1,tv22;
private static int splash_screen = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main_home);
topanim = AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomanim = AnimationUtils.loadAnimation(this,R.anim.bottom_animation);
img = findViewById(R.id.imageView);
tv1 = findViewById(R.id.textView);
tv22 = findViewById(R.id.textView2);
img.setAnimation(topanim);
tv1.setAnimation(bottomanim);
tv22.setAnimation(bottomanim);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent ii = new Intent(mainHome.this,HomeBothmain.class);
startActivity(ii);
finish();
}
},splash_screen);
}
}
package com.example.dushan.crimeandmissingrepoter;
public class missingPerson {
String idcrimedetails;
String missingname;
String lastlocation;
missingPerson(String idcrimedetails,String missingname,String lastlocation){
idcrimedetails = this.idcrimedetails;
missingname = this.missingname;
lastlocation = this.lastlocation;
}
missingPerson(){
}
}
package com.example.dushan.crimeandmissingrepoter;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.kosalgeek.asynctask.AsyncResponse;
import com.kosalgeek.asynctask.PostResponseAsyncTask;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
public class missingpersons extends AppCompatActivity implements AsyncResponse {
ListView listView;
ArrayList<missingPerson> arrayList;
ArrayAdapter adp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_missingpersons);
listView = findViewById(R.id.listviewmissing);
arrayList = new ArrayList<missingPerson>();
// Myadapter myadapter = new Myadapter(this,mtitle,mdescrition,images);
// listView.setAdapter(myadapter);
HashMap postdata = new HashMap();
//Toast.makeText(this, "dis eka"+ManyVariables.copdistricrz, Toast.LENGTH_SHORT).show();
postdata.put("fff", "ok");
PostResponseAsyncTask task = new PostResponseAsyncTask(missingpersons.this,postdata);
task.execute("http://potcantalk.com/mobileapp/loadmissingz.php");
}
@Override
public void processFinish(String s) {
try {
//Toast.makeText(this, "--"+s, Toast.LENGTH_SHORT).show();
JSONArray ja = new JSONArray(s);
//Toast.makeText(this, ja.toString(), Toast.LENGTH_SHORT).show();
for (int f = 0;f < ja.length(); f++){
JSONObject job = ja.getJSONObject(f);
missingPerson i = new missingPerson();
i.idcrimedetails =job.get("idmising").toString();
i.missingname=job.get("namemissing").toString();
i.lastlocation=job.get("lastlocation").toString();
arrayList.add(i);
}
missingloadAdapter my = new missingloadAdapter(this,arrayList);
listView.setAdapter(my);
}catch (Exception e){
Toast.makeText(this, "error"+e, Toast.LENGTH_LONG).show();
}
}
class missingloadAdapter extends ArrayAdapter{
Context c;
ArrayList<missingPerson> list;
public missingloadAdapter(Context context ,ArrayList<missingPerson> ar) {
super(context, R.layout.missingadapterz,ar);
c= context;
list = ar;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater li =(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v= li.inflate(R.layout.missingadapterz,null);
final missingPerson loadTimeTables = list.get(position);
TextView reportuserz =(TextView) v.findViewById(R.id.reptzuserzremissing);
reportuserz.setText(loadTimeTables.missingname);
TextView crimetypez =(TextView) v.findViewById(R.id.crimetypeekaremissing);
crimetypez.setText(loadTimeTables.lastlocation);
final TextView crimeideka =(TextView) v.findViewById(R.id.hiddenidzremissing);
crimeideka.setText(loadTimeTables.idcrimedetails);
Button viewcrime =(Button) v.findViewById(R.id.crimeviewbtnremissing);
viewcrime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i= new Intent(c,singlemissingpersondetail.class);
i.putExtra("crimeidmissing", crimeideka.getText().toString());
c.startActivity(i);
}
});
return v;
}
}
}
import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.ArrayAdapter;
import com.example.dushan.crimeandmissingrepoter.LoadCrimeReport;
import com.example.dushan.crimeandmissingrepoter.R;
import com.example.dushan.crimeandmissingrepoter.locrimedetails;
import java.util.ArrayList;
public class loadcrimesadapter extends ArrayAdapter {
Context c;
ArrayList<LoadCrimeReport> list;
public loadcrimesadapter(Context context ,ArrayList<LoadCrimeReport> ar) {
super(context, R.layout.loadcrimelistadapter,ar);
c= context;
list = ar;
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
<path
android:fillColor="#FF000000"
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" />
</vector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" />
</vector>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment