DT @20.08.2015: First Commit
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
152
app/app.iml
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="RiskAhead" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="android-gradle" name="Android-Gradle">
|
||||||
|
<configuration>
|
||||||
|
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
<facet type="android" name="Android">
|
||||||
|
<configuration>
|
||||||
|
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||||
|
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||||
|
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||||
|
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||||
|
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||||
|
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||||
|
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||||
|
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
|
||||||
|
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||||
|
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||||
|
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||||
|
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||||
|
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
|
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/google-services/debug" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/22.0.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.beardedhen/androidbootstrap/1.2.3/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.android/facebook-android-sdk/4.1.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-analytics/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appindexing/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appinvite/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appstate/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-cast/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-drive/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-fitness/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-games/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-identity/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-nearby/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-panorama/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-plus/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-safetynet/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wallet/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services/7.5.0/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.twitter.sdk.android/twitter-core/1.4.1/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.fabric.sdk.android/fabric/1.3.4/jars" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" exported="" name="androidbootstrap-1.2.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-base-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-appinvite-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-panorama-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-drive-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-gcm-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="retrofit-1.6.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="library-1.0.18" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-appindexing-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-wearable-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-safetynet-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-games-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="fabric-1.3.4" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-plus-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-maps-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-fitness-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="twitter-core-1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-analytics-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="mediarouter-v7-22.0.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-wallet-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="bolts-android-1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-identity-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-appstate-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-nearby-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="facebook-android-sdk-4.1.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-cast-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-ads-7.5.0" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="play-services-location-7.5.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
49
app/build.gradle
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url 'https://maven.fabric.io/public' }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath 'io.fabric.tools:gradle:1.+'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'io.fabric'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 22
|
||||||
|
buildToolsVersion "22.0.1"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "org.deke.risk.riskahead"
|
||||||
|
minSdkVersion 15
|
||||||
|
targetSdkVersion 22
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
maven { url 'https://maven.fabric.io/public' }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||||
|
compile 'com.google.android.gms:play-services:7.5.0'
|
||||||
|
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
|
||||||
|
compile 'com.beardedhen:androidbootstrap:+'
|
||||||
|
compile 'com.mcxiaoke.volley:library:1.0.+'
|
||||||
|
compile('com.twitter.sdk.android:twitter-core:1.4.1@aar') {
|
||||||
|
transitive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
4
app/fabric.properties
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
|
||||||
|
#Sat Jul 18 18:32:41 CEST 2015
|
||||||
|
apiSecret=c93664ec6681827d89cba7fe0f675194c2d647258169cc7912aa627437319d09
|
||||||
|
twitterPluginId=55aa7fa76bfe67e9d100a86c
|
||||||
1
app/google-services.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"project_info":{"project_id":"riskahead-61dff","project_number":"498007911848","name":"RiskAhead"},"client":[{"client_info":{"client_id":"android:org.deke.risk.riskahead","client_type":1,"android_client_info":{"package_name":"org.deke.risk.riskahead"}},"oauth_client":[{"client_id":"498007911848-ppr7ct4oa2gs5jjnmrnlnutgui8m365n.apps.googleusercontent.com","client_type":1,"android_info":{"package_name":"org.deke.risk.riskahead","certificate_hash":"4b6c989e6c0d6824f5a2d7b1a10ff36560c3397f"}}],"services":{"analytics_service":{"status":1},"cloud_messaging_service":{"status":1,"apns_config":[]},"appinvite_service":{"status":1,"other_platform_oauth_client":[]},"google_signin_service":{"status":2},"ads_service":{"status":1}}}]}
|
||||||
17
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in C:\Users\Dennis\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.test.ApplicationTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||||
|
*/
|
||||||
|
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||||
|
public ApplicationTest() {
|
||||||
|
super(Application.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
62
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="org.deke.risk.riskahead" >
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".AppController"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/AppTheme" >
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
|
||||||
|
<uses-permission android:name="com.arshad.map.permission.MAPS_RECEIVE" />
|
||||||
|
<uses-permission android:name="in.wptrafficanalyzer.locationsherlocksearchviewmapv2.permission.MAPS_RECEIVE" />
|
||||||
|
|
||||||
|
<permission
|
||||||
|
android:name="com.arshad.map.permission.MAPS_RECEIVE"
|
||||||
|
android:protectionLevel="signature" />
|
||||||
|
|
||||||
|
<!-- Google Maps Fragment API Key Data -->
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.maps.v2.API_KEY"
|
||||||
|
android:value="AIzaSyALm-1lEf5xualfyHdmNEdAsXlbwOQhbI8" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="io.fabric.ApiKey"
|
||||||
|
android:value="c44233e93b0a9702b00bd632380572d758096e3c" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.facebook.sdk.ApplicationId"
|
||||||
|
android:value="@string/facebook_app_id" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".StartActivity"
|
||||||
|
android:label="@string/title_activity_start" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".LoginActivity"
|
||||||
|
android:label="@string/app_name" >
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.twitter.sdk.android.core.identity.OAuthActivity" />
|
||||||
|
<activity
|
||||||
|
android:name="com.facebook.FacebookActivity"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:label="@string/title_activity_entrance" >
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
BIN
app/src/main/ic_launcher-web.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
51
app/src/main/java/org/deke/risk/riskahead/AppController.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.android.volley.Request;
|
||||||
|
import com.android.volley.RequestQueue;
|
||||||
|
import com.android.volley.toolbox.Volley;
|
||||||
|
|
||||||
|
public class AppController extends Application {
|
||||||
|
|
||||||
|
public static final String TAG = AppController.class.getSimpleName();
|
||||||
|
|
||||||
|
private RequestQueue mRequestQueue;
|
||||||
|
|
||||||
|
private static AppController mInstance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
mInstance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized AppController getInstance() {
|
||||||
|
return mInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestQueue getRequestQueue() {
|
||||||
|
if (mRequestQueue == null) {
|
||||||
|
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
return mRequestQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void addToRequestQueue(Request<T> req, String tag) {
|
||||||
|
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
|
||||||
|
getRequestQueue().add(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void addToRequestQueue(Request<T> req) {
|
||||||
|
req.setTag(TAG);
|
||||||
|
getRequestQueue().add(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelPendingRequests(Object tag) {
|
||||||
|
if (mRequestQueue != null) {
|
||||||
|
mRequestQueue.cancelAll(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
454
app/src/main/java/org/deke/risk/riskahead/LoginActivity.java
Normal file
@@ -0,0 +1,454 @@
|
|||||||
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.facebook.CallbackManager;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.fragments.FacebookButtonFragment;
|
||||||
|
import org.deke.risk.riskahead.fragments.GooglePlusButtonFragment;
|
||||||
|
import org.deke.risk.riskahead.fragments.TwitterButtonFragment;
|
||||||
|
import org.deke.risk.riskahead.helper.AppConfig;
|
||||||
|
import org.deke.risk.riskahead.helper.SQLiteHandler;
|
||||||
|
import org.deke.risk.riskahead.helper.SessionManager;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.android.volley.Request.Method;
|
||||||
|
import com.android.volley.Response;
|
||||||
|
import com.android.volley.VolleyError;
|
||||||
|
import com.android.volley.toolbox.StringRequest;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class LoginActivity extends AppCompatActivity implements FacebookButtonFragment.OnFragmentInteractionListener, GooglePlusButtonFragment.OnFragmentInteractionListener, TwitterButtonFragment.OnFragmentInteractionListener{
|
||||||
|
|
||||||
|
private static final String TAG = LoginActivity.class.getSimpleName();
|
||||||
|
private CallbackManager callbackManager;
|
||||||
|
private Button btnSignUpMY;
|
||||||
|
private String inputMsg;
|
||||||
|
private TextView input_email;
|
||||||
|
private TextView input_full_name;
|
||||||
|
private TextView input_password;
|
||||||
|
|
||||||
|
private ProgressDialog pDialog;
|
||||||
|
private SessionManager session;
|
||||||
|
public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE";
|
||||||
|
private SQLiteHandler db;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
inputMsg = intent.getStringExtra(StartActivity.EXTRA_MESSAGE);
|
||||||
|
callbackManager = CallbackManager.Factory.create();
|
||||||
|
|
||||||
|
// Session manager
|
||||||
|
session = new SessionManager(getApplicationContext());
|
||||||
|
|
||||||
|
// Progress dialog
|
||||||
|
pDialog = new ProgressDialog(this);
|
||||||
|
pDialog.setCancelable(false);
|
||||||
|
|
||||||
|
// SQLite database handler
|
||||||
|
db = new SQLiteHandler(getApplicationContext());
|
||||||
|
|
||||||
|
// Check if user is already logged in or not
|
||||||
|
if (session.isLoggedIn()) {
|
||||||
|
// User is already logged in. Take him to main activity
|
||||||
|
intent = new Intent(LoginActivity.this,MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(inputMsg.equals("login")){
|
||||||
|
setContentView(R.layout.activity_login);
|
||||||
|
}else if(inputMsg.equals("register")){
|
||||||
|
setContentView(R.layout.activity_register);
|
||||||
|
input_full_name = (TextView) findViewById(R.id.input_full_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
input_email = (TextView) findViewById(R.id.input_email);
|
||||||
|
input_password = (TextView) findViewById(R.id.input_password);
|
||||||
|
|
||||||
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
FacebookButtonFragment fragmentFB = new FacebookButtonFragment();
|
||||||
|
GooglePlusButtonFragment fragmentGP = new GooglePlusButtonFragment();
|
||||||
|
|
||||||
|
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||||
|
transaction.add(R.id.fragment_btn_gp, fragmentGP);
|
||||||
|
transaction.commit();
|
||||||
|
|
||||||
|
initMySigninButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initMySigninButton() {
|
||||||
|
btnSignUpMY = (Button) findViewById(R.id.btnSignUp);
|
||||||
|
btnSignUpMY.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (v.getId() == R.id.btnSignUp) {
|
||||||
|
String email = input_email.getText().toString();
|
||||||
|
String password = input_password.getText().toString();
|
||||||
|
|
||||||
|
if (inputMsg.equals("login")) {
|
||||||
|
if (isEmpty(input_email) || isEmpty(input_password)) {
|
||||||
|
showMessage("Please enter all fields before logging in");
|
||||||
|
} else {
|
||||||
|
checkLogin(email, password);
|
||||||
|
}
|
||||||
|
} else if (inputMsg.equals("register")) {
|
||||||
|
String name = input_full_name.getText().toString();
|
||||||
|
if (isEmpty(input_email) || isEmpty(input_password) || isEmpty(input_full_name)) {
|
||||||
|
showMessage("Please enter all fields before registration");
|
||||||
|
} else {
|
||||||
|
registerUser(name, email, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isEmpty(TextView etText) {
|
||||||
|
return etText.getText().toString().trim().length() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showMessage(String statusText){
|
||||||
|
Toast.makeText(this, statusText, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onFragmentInteraction(Uri uri){
|
||||||
|
//you can leave it empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.menu_login, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSocialMediaLogin(final String key, final String providerType, final String username, final String email){
|
||||||
|
if(session.isLoggedIn()){
|
||||||
|
Intent intent = new Intent(
|
||||||
|
LoginActivity.this,
|
||||||
|
MainActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "Social Media Login");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tag used to cancel the request
|
||||||
|
String tag_string_req = "sociallogin";
|
||||||
|
db.deleteUsers();
|
||||||
|
pDialog.setMessage("Social Media Login ...");
|
||||||
|
showDialog();
|
||||||
|
|
||||||
|
StringRequest strReq = new StringRequest(Method.POST,
|
||||||
|
AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
Log.d(TAG, "Social Media Login Response: " + response.toString());
|
||||||
|
hideDialog();
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jObj = new JSONObject(response);
|
||||||
|
boolean error = jObj.getBoolean("error");
|
||||||
|
if (!error) {
|
||||||
|
// user successfully logged in
|
||||||
|
// Create login session
|
||||||
|
session.setLogin(true);
|
||||||
|
|
||||||
|
// User successfully stored in MySQL
|
||||||
|
// Now store the user in sqlite
|
||||||
|
String uid = jObj.getString("uid");
|
||||||
|
|
||||||
|
JSONObject user = jObj.getJSONObject("user");
|
||||||
|
String username = user.getString("username");
|
||||||
|
String name = user.getString("name");
|
||||||
|
String surname = user.getString("surname");
|
||||||
|
String email = user.getString("email");
|
||||||
|
String status = user.getString("status");
|
||||||
|
String created_at = user.getString("created_at");
|
||||||
|
String updated_at = user.getString("updated_at");
|
||||||
|
String providerType = user.getString("providerType");
|
||||||
|
|
||||||
|
// Inserting row in users table
|
||||||
|
db.addUser(uid, username, name, surname, email, status, providerType, created_at, updated_at);
|
||||||
|
// Launch login activity
|
||||||
|
Intent intent = new Intent(
|
||||||
|
LoginActivity.this,
|
||||||
|
MainActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "Social Media Login");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Error occurred in registration. Get the error
|
||||||
|
// message
|
||||||
|
String errorMsg = jObj.getString("error_msg");
|
||||||
|
Toast.makeText(getApplicationContext(),
|
||||||
|
errorMsg, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Response.ErrorListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorResponse(VolleyError error) {
|
||||||
|
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||||
|
Toast.makeText(getApplicationContext(),
|
||||||
|
error.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
hideDialog();
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getParams() {
|
||||||
|
// Posting params to register url
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("tag", "sociallogin");
|
||||||
|
params.put("key", key);
|
||||||
|
params.put("providerType", providerType);
|
||||||
|
params.put("username", username);
|
||||||
|
params.put("email",email);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Adding request to request queue
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == GooglePlusButtonFragment.RC_SIGN_IN) {
|
||||||
|
GooglePlusButtonFragment fragment = (GooglePlusButtonFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_btn_gp);
|
||||||
|
fragment.onActivityResult(requestCode, resultCode, data);
|
||||||
|
} else {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
TwitterButtonFragment twitter_fragment = (TwitterButtonFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_btn_tw);
|
||||||
|
if (twitter_fragment != null) {
|
||||||
|
twitter_fragment.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function to verify login details in mysql db
|
||||||
|
* */
|
||||||
|
private void checkLogin(final String email, final String password) {
|
||||||
|
// Tag used to cancel the request
|
||||||
|
String tag_string_req = "req_login";
|
||||||
|
db.deleteUsers();
|
||||||
|
pDialog.setMessage("Logging in ...");
|
||||||
|
showDialog();
|
||||||
|
|
||||||
|
StringRequest strReq = new StringRequest(Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
Log.d(TAG, "Login Response: " + response.toString());
|
||||||
|
hideDialog();
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jObj = new JSONObject(response);
|
||||||
|
boolean error = jObj.getBoolean("error");
|
||||||
|
|
||||||
|
// Check for error node in json
|
||||||
|
if (!error) {
|
||||||
|
// user successfully logged in
|
||||||
|
// Create login session
|
||||||
|
session.setLogin(true);
|
||||||
|
|
||||||
|
// Now store the user in sqlite
|
||||||
|
String uid = jObj.getString("uid");
|
||||||
|
|
||||||
|
JSONObject user = jObj.getJSONObject("user");
|
||||||
|
String username = user.getString("username");
|
||||||
|
String name = user.getString("name");
|
||||||
|
String surname = user.getString("surname");
|
||||||
|
String email = user.getString("email");
|
||||||
|
String status = user.getString("status");
|
||||||
|
String created_at = user.getString("created_at");
|
||||||
|
String updated_at = user.getString("updated_at");
|
||||||
|
String providerType = "local";
|
||||||
|
|
||||||
|
// Inserting row in users table
|
||||||
|
db.addUser(uid, username, name, surname, email, status, providerType, created_at, updated_at);
|
||||||
|
|
||||||
|
// Launch main activity
|
||||||
|
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
// Error in login. Get the error message
|
||||||
|
String errorMsg = jObj.getString("error_msg");
|
||||||
|
Toast.makeText(getApplicationContext(),errorMsg, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
// JSON error
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Response.ErrorListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorResponse(VolleyError error) {
|
||||||
|
Log.e(TAG, "Login Error: " + error.getMessage());
|
||||||
|
Toast.makeText(getApplicationContext(),
|
||||||
|
error.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
hideDialog();
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getParams() {
|
||||||
|
// Posting parameters to login url
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("tag", "login");
|
||||||
|
params.put("email", email);
|
||||||
|
params.put("password", password);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Adding request to request queue
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to store user in MySQL database will post params(tag, name,* email, password) to register url
|
||||||
|
* */
|
||||||
|
private void registerUser(final String username, final String email,final String password) {
|
||||||
|
// Tag used to cancel the request
|
||||||
|
String tag_string_req = "req_register";
|
||||||
|
db.deleteUsers();
|
||||||
|
pDialog.setMessage("Registering ...");
|
||||||
|
showDialog();
|
||||||
|
|
||||||
|
StringRequest strReq = new StringRequest(Method.POST,
|
||||||
|
AppConfig.URL_REGISTER, new Response.Listener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
Log.d(TAG, "Register Response: " + response.toString());
|
||||||
|
hideDialog();
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jObj = new JSONObject(response);
|
||||||
|
boolean error = jObj.getBoolean("error");
|
||||||
|
if (!error) {
|
||||||
|
// User successfully stored in MySQL
|
||||||
|
// Now store the user in sqlite
|
||||||
|
String uid = jObj.getString("uid");
|
||||||
|
|
||||||
|
JSONObject user = jObj.getJSONObject("user");
|
||||||
|
String username = user.getString("username");
|
||||||
|
String name = user.getString("name");
|
||||||
|
String surname = user.getString("surname");
|
||||||
|
String email = user.getString("email");
|
||||||
|
String status = user.getString("status");
|
||||||
|
String created_at = user.getString("created_at");
|
||||||
|
String updated_at = user.getString("updated_at");
|
||||||
|
String providerType = "local";
|
||||||
|
|
||||||
|
// Inserting row in users table
|
||||||
|
db.addUser(uid, username, name, surname, email, status, providerType, created_at, updated_at);
|
||||||
|
// Launch login activity
|
||||||
|
Intent intent = new Intent(
|
||||||
|
LoginActivity.this,
|
||||||
|
LoginActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Error occurred in registration. Get the error
|
||||||
|
// message
|
||||||
|
String errorMsg = jObj.getString("error_msg");
|
||||||
|
Toast.makeText(getApplicationContext(),
|
||||||
|
errorMsg, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Response.ErrorListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorResponse(VolleyError error) {
|
||||||
|
Log.e(TAG, "Registration Error: " + error.getMessage());
|
||||||
|
Toast.makeText(getApplicationContext(),
|
||||||
|
error.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
hideDialog();
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getParams() {
|
||||||
|
// Posting params to register url
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("tag", "register");
|
||||||
|
params.put("username", username);
|
||||||
|
params.put("email", email);
|
||||||
|
params.put("password", password);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Adding request to request queue
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showDialog() {
|
||||||
|
if (!pDialog.isShowing())
|
||||||
|
pDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideDialog() {
|
||||||
|
if (pDialog.isShowing())
|
||||||
|
pDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
219
app/src/main/java/org/deke/risk/riskahead/MainActivity.java
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v4.view.MenuItemCompat;
|
||||||
|
import android.support.v4.widget.DrawerLayout;
|
||||||
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.ShareActionProvider;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.fragments.MapFragment;
|
||||||
|
import org.deke.risk.riskahead.fragments.UserInfo;
|
||||||
|
import org.deke.risk.riskahead.helper.SQLiteHandler;
|
||||||
|
import org.deke.risk.riskahead.helper.SessionManager;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity implements UserInfo.OnFragmentInteractionListener, MapFragment.OnFragmentInteractionListener{
|
||||||
|
|
||||||
|
public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE";
|
||||||
|
public String inputMsg;
|
||||||
|
|
||||||
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
|
private DrawerLayout mDrawerLayout;
|
||||||
|
private String mActivityTitle;
|
||||||
|
ShareActionProvider mShareActionProvider;
|
||||||
|
private ListView mDrawerList;
|
||||||
|
private ArrayAdapter<String> mAdapter;
|
||||||
|
|
||||||
|
private SQLiteHandler db;
|
||||||
|
private SessionManager session;
|
||||||
|
|
||||||
|
public HashMap<String, String> user;
|
||||||
|
public static FragmentManager fragmentManager;
|
||||||
|
|
||||||
|
final String[] fragments = {UserInfo.class.getName(),MapFragment.class.getName()};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
inputMsg = intent.getStringExtra(StartActivity.EXTRA_MESSAGE);
|
||||||
|
|
||||||
|
// SqLite database handler
|
||||||
|
db = new SQLiteHandler(getApplicationContext());
|
||||||
|
|
||||||
|
// session manager
|
||||||
|
session = new SessionManager(getApplicationContext());
|
||||||
|
|
||||||
|
if (!session.isLoggedIn()) {
|
||||||
|
logoutUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetching user details from sqlite
|
||||||
|
user = db.getUserDetails();
|
||||||
|
|
||||||
|
mDrawerList = (ListView)findViewById(R.id.navList);
|
||||||
|
mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
|
||||||
|
addDrawerItems();
|
||||||
|
setupDrawer();
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
|
mActivityTitle = getTitle().toString();
|
||||||
|
|
||||||
|
fragmentManager = getSupportFragmentManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupDrawer() {
|
||||||
|
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
|
||||||
|
R.string.drawer_open, R.string.drawer_close) {
|
||||||
|
|
||||||
|
/** Called when a drawer has settled in a completely open state. */
|
||||||
|
public void onDrawerOpened(View drawerView) {
|
||||||
|
super.onDrawerOpened(drawerView);
|
||||||
|
getSupportActionBar().setTitle("Navigation!");
|
||||||
|
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Called when a drawer has settled in a completely closed state. */
|
||||||
|
public void onDrawerClosed(View view) {
|
||||||
|
super.onDrawerClosed(view);
|
||||||
|
getSupportActionBar().setTitle(mActivityTitle);
|
||||||
|
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mDrawerToggle.setDrawerIndicatorEnabled(true);
|
||||||
|
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addDrawerItems() {
|
||||||
|
String[] osArray = { "Start", "Maps", "Profile", "Settings", "Subscription", "Logout" };
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
|
||||||
|
mDrawerList.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
|
||||||
|
mDrawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
|
||||||
|
@Override
|
||||||
|
public void onDrawerClosed(View drawerView) {
|
||||||
|
super.onDrawerClosed(drawerView);
|
||||||
|
|
||||||
|
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
|
||||||
|
tx.replace(R.id.content, Fragment.instantiate(MainActivity.this, fragments[position]));
|
||||||
|
tx.commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mDrawerLayout.closeDrawer(mDrawerList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
|
||||||
|
tx.replace(R.id.content, Fragment.instantiate(MainActivity.this, fragments[0]));
|
||||||
|
tx.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
super.onPostCreate(savedInstanceState);
|
||||||
|
mDrawerToggle.syncState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.menu_main_share, menu);
|
||||||
|
|
||||||
|
// Access the Share Item defined in menu XML
|
||||||
|
MenuItem shareItem = menu.findItem(R.id.menu_item_share);
|
||||||
|
|
||||||
|
// Access the object responsible for
|
||||||
|
// putting together the sharing submenu
|
||||||
|
if (shareItem != null) {
|
||||||
|
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an Intent to share your content
|
||||||
|
setShareIntent();
|
||||||
|
getMenuInflater().inflate(R.menu.menu_login, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setShareIntent() {
|
||||||
|
if (mShareActionProvider != null) {
|
||||||
|
|
||||||
|
// create an Intent with the contents of the TextView
|
||||||
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
shareIntent.setType("text/plain");
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Android Development");
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_TEXT, "Ich empfehle RiskAhead!");
|
||||||
|
|
||||||
|
// Make sure the provider knows
|
||||||
|
// it should work with that Intent
|
||||||
|
mShareActionProvider.setShareIntent(shareIntent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate the navigation drawer toggle
|
||||||
|
if (mDrawerToggle.onOptionsItemSelected(item)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFragmentInteraction(Uri uri) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logging out the user. Will set isLoggedIn flag to false in shared
|
||||||
|
* preferences Clears the user data from sqlite users table
|
||||||
|
* */
|
||||||
|
public void logoutUser() {
|
||||||
|
session.setLogin(false);
|
||||||
|
db.deleteUsers();
|
||||||
|
|
||||||
|
// Launching the login activity
|
||||||
|
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
82
app/src/main/java/org/deke/risk/riskahead/StartActivity.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.helper.SessionManager;
|
||||||
|
|
||||||
|
|
||||||
|
public class StartActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE";
|
||||||
|
|
||||||
|
Button btnLogin;
|
||||||
|
Button btnRegister;
|
||||||
|
|
||||||
|
private SessionManager session;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_start);
|
||||||
|
btnLogin = (Button) findViewById(R.id.btn_start_login);
|
||||||
|
btnRegister = (Button) findViewById(R.id.btn_start_register);
|
||||||
|
|
||||||
|
// Session manager
|
||||||
|
session = new SessionManager(getApplicationContext());
|
||||||
|
|
||||||
|
// Check if user is already logged in or not
|
||||||
|
if (session.isLoggedIn()) {
|
||||||
|
// User is already logged in. Take him to main activity
|
||||||
|
Intent intent = new Intent(StartActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void gotoLogin(View view) {
|
||||||
|
Intent intent = new Intent(this, LoginActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void gotoRegister(View view) {
|
||||||
|
Intent intent = new Intent(this, LoginActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "register");
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.menu_start, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isEmpty(TextView etText) {
|
||||||
|
return etText.getText().toString().trim().length() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showMessage(String statusText){
|
||||||
|
Toast.makeText(this, statusText, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
package org.deke.risk.riskahead.fragments;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||||
|
import com.facebook.CallbackManager;
|
||||||
|
import com.facebook.FacebookCallback;
|
||||||
|
import com.facebook.FacebookException;
|
||||||
|
import com.facebook.FacebookSdk;
|
||||||
|
import com.facebook.login.LoginManager;
|
||||||
|
import com.facebook.login.LoginResult;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.LoginActivity;
|
||||||
|
import org.deke.risk.riskahead.R;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class FacebookButtonFragment extends Fragment {
|
||||||
|
|
||||||
|
private BootstrapButton btnLoginFB;
|
||||||
|
CallbackManager callbackManager;
|
||||||
|
OnFragmentInteractionListener mListener;
|
||||||
|
View view;
|
||||||
|
|
||||||
|
public FacebookButtonFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||||
|
view = inflater.inflate(R.layout.fragment_facebook_button, container, false);
|
||||||
|
initFacebookButton();
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
callbackManager.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
try {
|
||||||
|
mListener = (OnFragmentInteractionListener) activity;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
throw new ClassCastException(activity.toString()
|
||||||
|
+ " must implement OnFragmentInteractionListener");
|
||||||
|
}
|
||||||
|
|
||||||
|
FacebookSdk.sdkInitialize(activity.getApplicationContext());
|
||||||
|
callbackManager = CallbackManager.Factory.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
public void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initFacebookButton() {
|
||||||
|
btnLoginFB = (BootstrapButton) view.findViewById(R.id.btn_login_fb);
|
||||||
|
|
||||||
|
btnLoginFB.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LoginManager.getInstance().logInWithReadPermissions(getActivity(), Arrays.asList("public_profile", "user_friends"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
LoginManager.getInstance().registerCallback(callbackManager,
|
||||||
|
new FacebookCallback<LoginResult>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(LoginResult loginResult) {
|
||||||
|
((LoginActivity) getActivity()).handleSocialMediaLogin(loginResult.getAccessToken().getToken(),"facebook",loginResult.getAccessToken().getUserId(),"");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel() {
|
||||||
|
((LoginActivity) getActivity()).showMessage("Facebook LogIn canceled");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(FacebookException exception) {
|
||||||
|
((LoginActivity) getActivity()).showMessage("Error while SignIn: ErrorMsg: " + exception.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
package org.deke.risk.riskahead.fragments;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentSender;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||||
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||||
|
import com.google.android.gms.common.SignInButton;
|
||||||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||||||
|
import com.google.android.gms.plus.Plus;
|
||||||
|
import com.google.android.gms.plus.model.people.Person;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.LoginActivity;
|
||||||
|
import org.deke.risk.riskahead.R;
|
||||||
|
|
||||||
|
public class GooglePlusButtonFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
|
||||||
|
|
||||||
|
public static final int RC_SIGN_IN = 0;
|
||||||
|
|
||||||
|
private static final String TAG = "MainActivity";
|
||||||
|
|
||||||
|
private static final int PROFILE_PIC_SIZE = 800;
|
||||||
|
|
||||||
|
private GoogleApiClient mGoogleApiClient;
|
||||||
|
|
||||||
|
private boolean mIntentInProgress;
|
||||||
|
|
||||||
|
private boolean mSignInClicked;
|
||||||
|
|
||||||
|
private ConnectionResult mConnectionResult;
|
||||||
|
|
||||||
|
private BootstrapButton btnSignIn;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private Activity mActivity;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mActivity = getActivity();
|
||||||
|
mContext = getActivity().getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_googleplus_button,container, false);
|
||||||
|
|
||||||
|
btnSignIn = (BootstrapButton) view.findViewById(R.id.btn_login_gp);
|
||||||
|
|
||||||
|
mGoogleApiClient = new GoogleApiClient.Builder(view.getContext())
|
||||||
|
.addConnectionCallbacks(this)
|
||||||
|
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
||||||
|
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
||||||
|
|
||||||
|
btnSignIn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
performClickAction();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateUI(mGoogleApiClient.isConnected());
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void performClickAction() {
|
||||||
|
if(mGoogleApiClient.isConnected()){
|
||||||
|
signOutFromGplus();
|
||||||
|
}else{
|
||||||
|
signInWithGplus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
if (mGoogleApiClient.isConnected()) {
|
||||||
|
mGoogleApiClient.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int responseCode, Intent intent) {
|
||||||
|
|
||||||
|
if (requestCode == RC_SIGN_IN) {
|
||||||
|
if (responseCode != Activity.RESULT_OK) {
|
||||||
|
mSignInClicked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mIntentInProgress = false;
|
||||||
|
|
||||||
|
if (!mGoogleApiClient.isConnecting()) {
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionFailed(ConnectionResult result) {
|
||||||
|
if (!result.hasResolution()) {
|
||||||
|
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(),
|
||||||
|
mActivity, 0).show();
|
||||||
|
Log.e(TAG, "" + result.getErrorCode());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mIntentInProgress) {
|
||||||
|
|
||||||
|
mConnectionResult = result;
|
||||||
|
|
||||||
|
if (mSignInClicked) {
|
||||||
|
|
||||||
|
Log.e(TAG, "" + result.getErrorCode());
|
||||||
|
resolveSignInError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnected(Bundle arg0) {
|
||||||
|
Person currentPerson = getProfileInformation();
|
||||||
|
if(mSignInClicked) ((LoginActivity) getActivity()).handleSocialMediaLogin(currentPerson.getId(),"google",currentPerson.getDisplayName(),Plus.AccountApi.getAccountName(mGoogleApiClient));
|
||||||
|
|
||||||
|
mSignInClicked = false;
|
||||||
|
updateUI(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectionSuspended(int arg0) {
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
updateUI(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUI(boolean isSignedIn) {
|
||||||
|
if (isSignedIn) {
|
||||||
|
this.btnSignIn.setText("Log out from G+");
|
||||||
|
} else {
|
||||||
|
this.btnSignIn.setText("Google+");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign-in into google
|
||||||
|
* */
|
||||||
|
private void signInWithGplus() {
|
||||||
|
if (!mGoogleApiClient.isConnecting()) {
|
||||||
|
mSignInClicked = true;
|
||||||
|
resolveSignInError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to resolve any signin errors
|
||||||
|
* */
|
||||||
|
private void resolveSignInError() {
|
||||||
|
if (mConnectionResult.hasResolution()) {
|
||||||
|
try {
|
||||||
|
mIntentInProgress = true;
|
||||||
|
mConnectionResult.startResolutionForResult(mActivity,RC_SIGN_IN);
|
||||||
|
} catch (IntentSender.SendIntentException e) {
|
||||||
|
mIntentInProgress = false;
|
||||||
|
mGoogleApiClient.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetching user's information name, email, profile pic
|
||||||
|
* */
|
||||||
|
private Person getProfileInformation() {
|
||||||
|
Person currentPerson = null;
|
||||||
|
try {
|
||||||
|
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
|
||||||
|
currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
|
||||||
|
String personName = currentPerson.getDisplayName();
|
||||||
|
String personPhotoUrl = currentPerson.getImage().getUrl();
|
||||||
|
String personGooglePlusProfile = currentPerson.getUrl();
|
||||||
|
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
|
||||||
|
|
||||||
|
Log.e(TAG, "Name: " + personName + ", plusProfile: "
|
||||||
|
+ personGooglePlusProfile + ", email: " + email
|
||||||
|
+ ", Image: " + personPhotoUrl + " user id:"
|
||||||
|
+ currentPerson.getId());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Toast.makeText(mContext, "Person information is null",
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return currentPerson;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign-out from google
|
||||||
|
* */
|
||||||
|
private void signOutFromGplus() {
|
||||||
|
if (mGoogleApiClient.isConnected()) {
|
||||||
|
mGoogleApiClient.clearDefaultAccountAndReconnect();
|
||||||
|
updateUI(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) {
|
||||||
|
for (int i = 0; i < signInButton.getChildCount(); i++) {
|
||||||
|
View v = signInButton.getChildAt(i);
|
||||||
|
if (v instanceof TextView) {
|
||||||
|
TextView mTextView = (TextView) v;
|
||||||
|
mTextView.setAllCaps(false);
|
||||||
|
mTextView.setText(buttonText);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
public void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
package org.deke.risk.riskahead.fragments;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||||
|
import com.google.android.gms.maps.GoogleMap;
|
||||||
|
import com.google.android.gms.maps.SupportMapFragment;
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
import com.google.android.gms.maps.model.MarkerOptions;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.R;
|
||||||
|
import org.deke.risk.riskahead.helper.GeocodeJSONParser;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MapFragment extends Fragment {
|
||||||
|
|
||||||
|
private static View view;
|
||||||
|
private static GoogleMap mMap;
|
||||||
|
private static Double latitude, longitude;
|
||||||
|
Button mBtnFind;
|
||||||
|
EditText etPlace;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
if (container == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
view = (RelativeLayout) inflater.inflate(R.layout.fragment_map, container, false);
|
||||||
|
// Passing harcoded values for latitude & longitude. Please change as per your need. This is just used to drop a Marker on the Map
|
||||||
|
latitude = 53.33;
|
||||||
|
longitude = 10.02;
|
||||||
|
|
||||||
|
setUpMapIfNeeded(); // For setting up the MapFragment
|
||||||
|
// Getting reference to the find button
|
||||||
|
mBtnFind = (Button) view.findViewById(R.id.btn_show);
|
||||||
|
etPlace = (EditText) view.findViewById(R.id.et_place);
|
||||||
|
|
||||||
|
mBtnFind.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// Getting the place entered
|
||||||
|
String location = etPlace.getText().toString();
|
||||||
|
|
||||||
|
if(location==null || location.equals("")){
|
||||||
|
Toast.makeText(getActivity(), "No Place is entered", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String url = "https://maps.googleapis.com/maps/api/geocode/json?";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// encoding special characters like space in the user input place
|
||||||
|
location = URLEncoder.encode(location, "utf-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
String address = "address=" + location;
|
||||||
|
|
||||||
|
String sensor = "sensor=false";
|
||||||
|
|
||||||
|
// url , from where the geocoding data is fetched
|
||||||
|
url = url + address + "&" + sensor;
|
||||||
|
|
||||||
|
// Instantiating DownloadTask to get places from Google Geocoding service
|
||||||
|
// in a non-ui thread
|
||||||
|
DownloadTask downloadTask = new DownloadTask();
|
||||||
|
|
||||||
|
// Start downloading the geocoding places
|
||||||
|
downloadTask.execute(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Sets up the map if it is possible to do so *****/
|
||||||
|
public void setUpMapIfNeeded() {
|
||||||
|
// Do a null check to confirm that we have not already instantiated the map.
|
||||||
|
if (mMap == null) {
|
||||||
|
// Try to obtain the map from the SupportMapFragment.
|
||||||
|
//mMap = ((SupportMapFragment) MainActivity.fragmentManager.findFragmentById(R.id.location_map)).getMap();
|
||||||
|
mMap = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.location_map)).getMap();
|
||||||
|
// Check if we were successful in obtaining the map.
|
||||||
|
if (mMap != null)
|
||||||
|
setUpMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is where we can add markers or lines, add listeners or move the
|
||||||
|
* camera.
|
||||||
|
* <p>
|
||||||
|
* This should only be called once and when we are sure that {@link #mMap}
|
||||||
|
* is not null.
|
||||||
|
*/
|
||||||
|
private static void setUpMap() {
|
||||||
|
// For showing a move to my loction button
|
||||||
|
mMap.setMyLocationEnabled(true);
|
||||||
|
mMap.getUiSettings().setZoomControlsEnabled(true);
|
||||||
|
// For dropping a marker at a point on the Map
|
||||||
|
mMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title("My Home").snippet("Home Address"));
|
||||||
|
// For zooming automatically to the Dropped PIN Location
|
||||||
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude,longitude), 12.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
if (mMap != null)
|
||||||
|
setUpMap();
|
||||||
|
|
||||||
|
if (mMap == null) {
|
||||||
|
// Try to obtain the map from the SupportMapFragment.
|
||||||
|
mMap = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.location_map)).getMap(); // getMap is deprecated
|
||||||
|
// Check if we were successful in obtaining the map.
|
||||||
|
if (mMap != null)
|
||||||
|
setUpMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** The mapfragment's id must be removed from the FragmentManager
|
||||||
|
**** or else if the same it is passed on the next time then
|
||||||
|
**** app will crash ****/
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
if (mMap != null) {
|
||||||
|
getChildFragmentManager().beginTransaction().remove(getChildFragmentManager().findFragmentById(R.id.location_map)).commitAllowingStateLoss();
|
||||||
|
mMap = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
public void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String downloadUrl(String strUrl) throws IOException {
|
||||||
|
String data = "";
|
||||||
|
InputStream iStream = null;
|
||||||
|
HttpURLConnection urlConnection = null;
|
||||||
|
try{
|
||||||
|
URL url = new URL(strUrl);
|
||||||
|
// Creating an http connection to communicate with url
|
||||||
|
urlConnection = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
|
// Connecting to url
|
||||||
|
urlConnection.connect();
|
||||||
|
|
||||||
|
// Reading data from url
|
||||||
|
iStream = urlConnection.getInputStream();
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(iStream));
|
||||||
|
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
|
String line = "";
|
||||||
|
while( ( line = br.readLine()) != null){
|
||||||
|
sb.append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
data = sb.toString();
|
||||||
|
br.close();
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
Log.d("Exception while downloading url", e.toString());
|
||||||
|
}finally{
|
||||||
|
iStream.close();
|
||||||
|
urlConnection.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
/** A class, to download Places from Geocoding webservice */
|
||||||
|
private class DownloadTask extends AsyncTask<String, Integer, String> {
|
||||||
|
|
||||||
|
String data = null;
|
||||||
|
|
||||||
|
// Invoked by execute() method of this object
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(String... url) {
|
||||||
|
try{
|
||||||
|
data = downloadUrl(url[0]);
|
||||||
|
}catch(Exception e){
|
||||||
|
Log.d("Background Task",e.toString());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Executed after the complete execution of doInBackground() method
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String result){
|
||||||
|
|
||||||
|
// Instantiating ParserTask which parses the json data from Geocoding webservice
|
||||||
|
// in a non-ui thread
|
||||||
|
ParserTask parserTask = new ParserTask();
|
||||||
|
|
||||||
|
// Start parsing the places in JSON format
|
||||||
|
// Invokes the "doInBackground()" method of the class ParseTask
|
||||||
|
parserTask.execute(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A class to parse the Geocoding Places in non-ui thread */
|
||||||
|
class ParserTask extends AsyncTask<String, Integer, List<HashMap<String,String>>> {
|
||||||
|
|
||||||
|
JSONObject jObject;
|
||||||
|
|
||||||
|
// Invoked by execute() method of this object
|
||||||
|
@Override
|
||||||
|
protected List<HashMap<String, String>> doInBackground(String... jsonData) {
|
||||||
|
|
||||||
|
List<HashMap<String, String>> places = null;
|
||||||
|
GeocodeJSONParser parser = new GeocodeJSONParser();
|
||||||
|
|
||||||
|
try {
|
||||||
|
jObject = new JSONObject(jsonData[0]);
|
||||||
|
|
||||||
|
/** Getting the parsed data as a an ArrayList */
|
||||||
|
places = parser.parse(jObject);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d("Exception", e.toString());
|
||||||
|
}
|
||||||
|
return places;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
package org.deke.risk.riskahead.fragments;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import io.fabric.sdk.android.Fabric;
|
||||||
|
|
||||||
|
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||||
|
import com.twitter.sdk.android.core.Callback;
|
||||||
|
import com.twitter.sdk.android.core.Result;
|
||||||
|
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||||
|
import com.twitter.sdk.android.core.TwitterCore;
|
||||||
|
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||||
|
import com.twitter.sdk.android.core.TwitterException;
|
||||||
|
import com.twitter.sdk.android.core.TwitterSession;
|
||||||
|
import com.twitter.sdk.android.core.identity.TwitterAuthClient;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.LoginActivity;
|
||||||
|
import org.deke.risk.riskahead.R;
|
||||||
|
|
||||||
|
public class TwitterButtonFragment extends Fragment {
|
||||||
|
|
||||||
|
private BootstrapButton btnLoginTW;
|
||||||
|
private TwitterAuthClient client;
|
||||||
|
TwitterSession session = null;
|
||||||
|
Context mContext;
|
||||||
|
View view;
|
||||||
|
|
||||||
|
// Note: Your consumer key and secret should be obfuscated in your source code before shipping.
|
||||||
|
private static final String TWITTER_KEY = "t8o7YBmzj3JMRf6RjIBg7hF20";
|
||||||
|
private static final String TWITTER_SECRET = "HTt4mOqyDStslzq1RXHUqU6HcZpOuSuzC2iWH45MlUsZBRI704";
|
||||||
|
|
||||||
|
public TwitterButtonFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||||
|
mContext = getActivity().getApplicationContext();
|
||||||
|
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
|
||||||
|
Fabric.with(mContext, new TwitterCore(authConfig));
|
||||||
|
client = new TwitterAuthClient();
|
||||||
|
|
||||||
|
view = inflater.inflate(R.layout.fragment_twitter_button, container, false);
|
||||||
|
btnLoginTW = (BootstrapButton) view.findViewById(R.id.btn_login_twitter);
|
||||||
|
|
||||||
|
btnLoginTW.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
client.authorize(getActivity(), new Callback<TwitterSession>() {
|
||||||
|
@Override
|
||||||
|
public void success(Result<TwitterSession> result) {
|
||||||
|
Log.e("Debug", "onSuccess wird ausgeführt");
|
||||||
|
session = result.data;
|
||||||
|
TwitterAuthToken authToken = session.getAuthToken();
|
||||||
|
String token = authToken.token;
|
||||||
|
String secret = authToken.secret;
|
||||||
|
|
||||||
|
((LoginActivity) getActivity()).handleSocialMediaLogin((Long.toString(session.getUserId())),"twitter",session.getUserName(),"");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failure(TwitterException exception) {
|
||||||
|
Log.e("Debug", "onFailure wird ausgeführt");
|
||||||
|
showMessage("Twitter Login failed with exception " + exception.getMessage().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//TO-DO
|
||||||
|
if(isAuthed()){
|
||||||
|
// log out
|
||||||
|
}else{
|
||||||
|
// log in
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUpSignOut() {
|
||||||
|
btnLoginTW.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
TwitterCore.getInstance().getSessionManager().clearActiveSession();
|
||||||
|
|
||||||
|
Toast.makeText(mContext, "All accounts are cleared",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAuthed() {
|
||||||
|
final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
|
||||||
|
return session != null && session.getAuthToken() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showMessage(String statusText){
|
||||||
|
Toast.makeText(mContext,statusText,Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
client.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
public void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package org.deke.risk.riskahead.fragments;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.LoginActivity;
|
||||||
|
import org.deke.risk.riskahead.R;
|
||||||
|
import org.deke.risk.riskahead.helper.SQLiteHandler;
|
||||||
|
import org.deke.risk.riskahead.helper.SessionManager;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class UserInfo extends Fragment {
|
||||||
|
private TextView txtName;
|
||||||
|
private TextView txtTest;
|
||||||
|
private TextView txtEmail;
|
||||||
|
private Button btnLogout;
|
||||||
|
Activity mActivity;
|
||||||
|
private SQLiteHandler db;
|
||||||
|
public HashMap<String, String> user;
|
||||||
|
private OnFragmentInteractionListener mListener;
|
||||||
|
private SessionManager session;
|
||||||
|
|
||||||
|
public final static String EXTRA_MESSAGE = "com.mycompany.myfirstapp.MESSAGE";
|
||||||
|
|
||||||
|
|
||||||
|
public static UserInfo newInstance(String param1, String param2) {
|
||||||
|
UserInfo fragment = new UserInfo();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserInfo() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_user_info, container, false);
|
||||||
|
session = new SessionManager(getActivity().getApplicationContext());
|
||||||
|
|
||||||
|
txtTest = (TextView) view.findViewById(R.id.test);
|
||||||
|
txtName = (TextView) view.findViewById(R.id.name);
|
||||||
|
txtEmail = (TextView) view.findViewById(R.id.email);
|
||||||
|
btnLogout = (Button) view.findViewById(R.id.btnLogout);
|
||||||
|
|
||||||
|
// Logout button click event
|
||||||
|
btnLogout.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
logoutUser();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// SqLite database handler
|
||||||
|
db = new SQLiteHandler(getActivity().getApplicationContext());
|
||||||
|
// Fetching user details from sqlite
|
||||||
|
user = db.getUserDetails();
|
||||||
|
txtName.setText(user.get("username"));
|
||||||
|
txtEmail.setText(user.get("email"));
|
||||||
|
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
mActivity = activity;
|
||||||
|
try {
|
||||||
|
mListener = (OnFragmentInteractionListener) activity;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
throw new ClassCastException(activity.toString()
|
||||||
|
+ " must implement OnFragmentInteractionListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface must be implemented by activities that contain this
|
||||||
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
|
* to the activity and potentially other fragments contained in that
|
||||||
|
* activity.
|
||||||
|
* <p/>
|
||||||
|
* See the Android Training lesson <a href=
|
||||||
|
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||||
|
* >Communicating with Other Fragments</a> for more information.
|
||||||
|
*/
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
public void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logging out the user. Will set isLoggedIn flag to false in shared
|
||||||
|
* preferences Clears the user data from sqlite users table
|
||||||
|
* */
|
||||||
|
public void logoutUser() {
|
||||||
|
session.setLogin(false);
|
||||||
|
db.deleteUsers();
|
||||||
|
|
||||||
|
// Launching the login activity
|
||||||
|
Intent intent = new Intent(getActivity(), LoginActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||||
|
startActivity(intent);
|
||||||
|
getActivity().finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Dennis on 09.08.2015.
|
||||||
|
*/
|
||||||
|
public class AppConfig {
|
||||||
|
// Server user login url
|
||||||
|
public static String URL_LOGIN = "http://192.168.178.31/riskahead/rest/";
|
||||||
|
|
||||||
|
// Server user register url
|
||||||
|
public static String URL_REGISTER = "http://192.168.178.31/riskahead/rest/";
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Dennis on 18.08.2015.
|
||||||
|
*/
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class GeocodeJSONParser {
|
||||||
|
|
||||||
|
/** Receives a JSONObject and returns a list */
|
||||||
|
public List<HashMap<String,String>> parse(JSONObject jObject){
|
||||||
|
|
||||||
|
JSONArray jPlaces = null;
|
||||||
|
try {
|
||||||
|
/** Retrieves all the elements in the 'places' array */
|
||||||
|
jPlaces = jObject.getJSONArray("results");
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
/** Invoking getPlaces with the array of json object
|
||||||
|
* where each json object represent a place
|
||||||
|
*/
|
||||||
|
return getPlaces(jPlaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<HashMap<String, String>> getPlaces(JSONArray jPlaces){
|
||||||
|
int placesCount = jPlaces.length();
|
||||||
|
List<HashMap<String, String>> placesList = new ArrayList<HashMap<String,String>>();
|
||||||
|
HashMap<String, String> place = null;
|
||||||
|
|
||||||
|
/** Taking each place, parses and adds to list object */
|
||||||
|
for(int i=0; i<placesCount;i++){
|
||||||
|
try {
|
||||||
|
/** Call getPlace with place JSON object to parse the place */
|
||||||
|
place = getPlace((JSONObject)jPlaces.get(i));
|
||||||
|
placesList.add(place);
|
||||||
|
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return placesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parsing the Place JSON object */
|
||||||
|
private HashMap<String, String> getPlace(JSONObject jPlace){
|
||||||
|
|
||||||
|
HashMap<String, String> place = new HashMap<String, String>();
|
||||||
|
String formatted_address = "-NA-";
|
||||||
|
String lat="";
|
||||||
|
String lng="";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Extracting formatted address, if available
|
||||||
|
if(!jPlace.isNull("formatted_address")){
|
||||||
|
formatted_address = jPlace.getString("formatted_address");
|
||||||
|
}
|
||||||
|
|
||||||
|
lat = jPlace.getJSONObject("geometry").getJSONObject("location").getString("lat");
|
||||||
|
lng = jPlace.getJSONObject("geometry").getJSONObject("location").getString("lng");
|
||||||
|
|
||||||
|
place.put("formatted_address", formatted_address);
|
||||||
|
place.put("lat", lat);
|
||||||
|
place.put("lng", lng);
|
||||||
|
|
||||||
|
}catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return place;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
public class SQLiteHandler extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
private static final String TAG = SQLiteHandler.class.getSimpleName();
|
||||||
|
|
||||||
|
// All Static variables
|
||||||
|
// Database Version
|
||||||
|
private static final int DATABASE_VERSION = 1;
|
||||||
|
|
||||||
|
// Database Name
|
||||||
|
private static final String DATABASE_NAME = "android_api";
|
||||||
|
|
||||||
|
// Login table name
|
||||||
|
private static final String TABLE_LOGIN = "login";
|
||||||
|
|
||||||
|
// Login Table Columns names
|
||||||
|
private static final String KEY_UID = "uid";
|
||||||
|
private static final String KEY_USERNAME = "username";
|
||||||
|
private static final String KEY_NAME = "name";
|
||||||
|
private static final String KEY_SURNAME = "surname";
|
||||||
|
private static final String KEY_EMAIL = "email";
|
||||||
|
private static final String KEY_STATUS = "status";
|
||||||
|
private static final String PROVIDER_TYPE = "providerType";
|
||||||
|
private static final String KEY_CREATED_AT = "created_at";
|
||||||
|
private static final String KEY_UPDATED_AT = "updated_at";
|
||||||
|
|
||||||
|
public SQLiteHandler(Context context) {
|
||||||
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating Tables
|
||||||
|
@Override
|
||||||
|
public void onCreate(SQLiteDatabase db) {
|
||||||
|
String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "("
|
||||||
|
+ KEY_UID + " INTEGER PRIMARY KEY,"
|
||||||
|
+ KEY_USERNAME + " TEXT,"
|
||||||
|
+ KEY_NAME + " TEXT,"
|
||||||
|
+ KEY_SURNAME + " TEXT,"
|
||||||
|
+ KEY_EMAIL + " TEXT UNIQUE,"
|
||||||
|
+ KEY_STATUS + " TEXT,"
|
||||||
|
+ PROVIDER_TYPE + " TEXT,"
|
||||||
|
+ KEY_UPDATED_AT + " TEXT,"
|
||||||
|
+ KEY_CREATED_AT + " TEXT" + ")";
|
||||||
|
db.execSQL(CREATE_LOGIN_TABLE);
|
||||||
|
|
||||||
|
Log.d(TAG, "Database tables created");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upgrading database
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN);
|
||||||
|
onCreate(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Storing user details in database
|
||||||
|
* */
|
||||||
|
public void addUser(String uid, String username, String name, String surname, String email, String status, String provider_type, String created_at, String updated_at) {
|
||||||
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(KEY_UID, uid); //UID
|
||||||
|
values.put(KEY_USERNAME, username); // Username
|
||||||
|
values.put(KEY_NAME, name); // Name
|
||||||
|
values.put(KEY_SURNAME, surname); // Surame
|
||||||
|
values.put(KEY_EMAIL, email); // Email
|
||||||
|
values.put(KEY_STATUS, status); // Status
|
||||||
|
values.put(PROVIDER_TYPE, provider_type); // ProviderType
|
||||||
|
values.put(KEY_CREATED_AT, created_at); // Created At
|
||||||
|
values.put(KEY_UPDATED_AT, updated_at); // Updated At
|
||||||
|
|
||||||
|
// Inserting Row
|
||||||
|
long id = db.insert(TABLE_LOGIN, null, values);
|
||||||
|
db.close(); // Closing database connection
|
||||||
|
|
||||||
|
Log.d(TAG, "New user inserted into sqlite: " + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getting user data from database
|
||||||
|
* */
|
||||||
|
public HashMap<String, String> getUserDetails() {
|
||||||
|
HashMap<String, String> user = new HashMap<String, String>();
|
||||||
|
String selectQuery = "SELECT * FROM " + TABLE_LOGIN;
|
||||||
|
|
||||||
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
||||||
|
// Move to first row
|
||||||
|
cursor.moveToFirst();
|
||||||
|
if (cursor.getCount() > 0) {
|
||||||
|
user.put("uid", cursor.getString(0));
|
||||||
|
user.put("username", cursor.getString(1));
|
||||||
|
user.put("name", cursor.getString(2));
|
||||||
|
user.put("surname", cursor.getString(3));
|
||||||
|
user.put("email", cursor.getString(4));
|
||||||
|
user.put("status", cursor.getString(5));
|
||||||
|
user.put("providerType", cursor.getString(6));
|
||||||
|
user.put("created_at", cursor.getString(7));
|
||||||
|
user.put("updated_at", cursor.getString(8));
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
db.close();
|
||||||
|
// return user
|
||||||
|
Log.d(TAG, "Fetching user from Sqlite: " + user.toString());
|
||||||
|
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getting user login status return true if rows are there in table
|
||||||
|
* */
|
||||||
|
public int getRowCount() {
|
||||||
|
String countQuery = "SELECT * FROM " + TABLE_LOGIN;
|
||||||
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
|
Cursor cursor = db.rawQuery(countQuery, null);
|
||||||
|
int rowCount = cursor.getCount();
|
||||||
|
db.close();
|
||||||
|
cursor.close();
|
||||||
|
|
||||||
|
// return row count
|
||||||
|
return rowCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re crate database Delete all tables and create them again
|
||||||
|
* */
|
||||||
|
public void deleteUsers() {
|
||||||
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
|
// Delete All Rows
|
||||||
|
db.delete(TABLE_LOGIN, null, null);
|
||||||
|
db.close();
|
||||||
|
|
||||||
|
Log.d(TAG, "Deleted all user info from sqlite");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.SharedPreferences.Editor;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
public class SessionManager {
|
||||||
|
// LogCat tag
|
||||||
|
private static String TAG = SessionManager.class.getSimpleName();
|
||||||
|
|
||||||
|
// Shared Preferences
|
||||||
|
SharedPreferences pref;
|
||||||
|
|
||||||
|
Editor editor;
|
||||||
|
Context _context;
|
||||||
|
|
||||||
|
// Shared pref mode
|
||||||
|
int PRIVATE_MODE = 0;
|
||||||
|
|
||||||
|
// Shared preferences file name
|
||||||
|
private static final String PREF_NAME = "AndroidHiveLogin";
|
||||||
|
|
||||||
|
private static final String KEY_IS_LOGGEDIN = "isLoggedIn";
|
||||||
|
|
||||||
|
public SessionManager(Context context) {
|
||||||
|
this._context = context;
|
||||||
|
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
|
||||||
|
editor = pref.edit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogin(boolean isLoggedIn) {
|
||||||
|
|
||||||
|
editor.putBoolean(KEY_IS_LOGGEDIN, isLoggedIn);
|
||||||
|
|
||||||
|
// commit changes
|
||||||
|
editor.commit();
|
||||||
|
|
||||||
|
Log.d(TAG, "User login session modified!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLoggedIn(){
|
||||||
|
return pref.getBoolean(KEY_IS_LOGGEDIN, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/src/main/res/drawable-hdpi/drawer_shadow.9.png
Normal file
|
After Width: | Height: | Size: 161 B |
BIN
app/src/main/res/drawable-hdpi/ic_drawer.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-mdpi/drawer_shadow.9.png
Normal file
|
After Width: | Height: | Size: 142 B |
BIN
app/src/main/res/drawable-mdpi/ic_drawer.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
app/src/main/res/drawable-xhdpi/ic_drawer.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
Normal file
|
After Width: | Height: | Size: 208 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_drawer.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
app/src/main/res/drawable/Thumbs.db
Normal file
BIN
app/src/main/res/drawable/logo_riskahead.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
127
app/src/main/res/layout/activity_login.xml
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:background="@color/bg_login"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".LoginActivity">
|
||||||
|
|
||||||
|
<TextView android:text="@string/txt_welcome_login"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:id="@+id/hello" />
|
||||||
|
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/input_email"
|
||||||
|
android:hint="@string/hint_email"
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/input_login"
|
||||||
|
android:textColorHint="@color/input_login_hint"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_below="@+id/hello" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/input_password"
|
||||||
|
android:hint="@string/hint_password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/input_login"
|
||||||
|
android:textColorHint="@color/input_login_hint"
|
||||||
|
android:layout_below="@+id/input_email"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginTop="5dp" />
|
||||||
|
|
||||||
|
<!-- Login Button -->
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dip"
|
||||||
|
android:layout_marginTop="20dip"
|
||||||
|
android:id="@+id/btnSignUp"
|
||||||
|
android:background="@color/btn_login_bg"
|
||||||
|
android:text="@string/btn_login"
|
||||||
|
android:textColor="@color/btn_login"
|
||||||
|
android:minWidth="120dp"
|
||||||
|
android:layout_below="@+id/input_password"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:gravity="end"
|
||||||
|
android:id="@+id/txt_policy"
|
||||||
|
android:text="@string/txt_policy"
|
||||||
|
android:layout_alignTop="@+id/txt_resend_password"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="@string/txt_useFBorGP"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_above="@+id/fragment_btn_gp"
|
||||||
|
android:layout_centerHorizontal="true" />
|
||||||
|
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:name="org.deke.risk.riskahead.fragments.GooglePlusButtonFragment"
|
||||||
|
android:id="@+id/fragment_btn_gp"
|
||||||
|
tools:layout="@layout/fragment_googleplus_button"
|
||||||
|
android:layout_above="@+id/fragment_btn_tw"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="5dp"/>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:name="org.deke.risk.riskahead.fragments.TwitterButtonFragment"
|
||||||
|
android:id="@+id/fragment_btn_tw"
|
||||||
|
tools:layout="@layout/fragment_twitter_button"
|
||||||
|
android:layout_above="@+id/fragment_btn_fb"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:name="org.deke.risk.riskahead.fragments.FacebookButtonFragment"
|
||||||
|
android:id="@+id/fragment_btn_fb"
|
||||||
|
tools:layout="@layout/fragment_facebook_button"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="5dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:text="@string/txt_resend_password"
|
||||||
|
android:id="@+id/txt_resend_password"
|
||||||
|
android:layout_below="@+id/btnSignUp"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
27
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<android.support.v4.widget.DrawerLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/navList"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:background="#ffeeee"/>
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
131
app/src/main/res/layout/activity_register.xml
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:background="@color/bg_register"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".LoginActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/hello"
|
||||||
|
android:text="@string/txt_welcome_register"
|
||||||
|
android:textColor="@color/input_register"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/input_full_name"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@color/input_register_bg"
|
||||||
|
android:hint="@string/hint_name"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:inputType="textCapWords"
|
||||||
|
android:textColor="@color/input_register"
|
||||||
|
android:textColorHint="@color/input_register_hint"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_below="@+id/hello" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/input_email"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@color/input_register_bg"
|
||||||
|
android:hint="@string/hint_email"
|
||||||
|
android:inputType="textEmailAddress"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/input_register"
|
||||||
|
android:textColorHint="@color/input_register_hint"
|
||||||
|
android:layout_below="@+id/input_full_name"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/input_password"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@color/input_register_bg"
|
||||||
|
android:hint="@string/hint_password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/input_register"
|
||||||
|
android:textColorHint="@color/input_register_hint"
|
||||||
|
android:layout_below="@+id/input_email" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:minWidth="120dp"
|
||||||
|
android:id="@+id/btnSignUp"
|
||||||
|
android:background="#ffea7f8a"
|
||||||
|
android:text="@string/btn_register"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:layout_below="@+id/input_password"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/input_register"
|
||||||
|
android:id="@+id/txt_policy"
|
||||||
|
android:text="@string/txt_policy"
|
||||||
|
android:layout_alignTop="@+id/btnSignUp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="@string/txt_useFBorGP"
|
||||||
|
android:textColor="@color/input_register"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_above="@+id/fragment_btn_gp"
|
||||||
|
android:layout_alignRight="@+id/hello"
|
||||||
|
android:layout_alignEnd="@+id/hello" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:name="org.deke.risk.riskahead.fragments.GooglePlusButtonFragment"
|
||||||
|
android:id="@+id/fragment_btn_gp"
|
||||||
|
tools:layout="@layout/fragment_googleplus_button"
|
||||||
|
android:layout_above="@+id/fragment_btn_tw"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="5dp"/>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:name="org.deke.risk.riskahead.fragments.TwitterButtonFragment"
|
||||||
|
android:id="@+id/fragment_btn_tw"
|
||||||
|
tools:layout="@layout/fragment_twitter_button"
|
||||||
|
android:layout_above="@+id/fragment_btn_fb"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:name="org.deke.risk.riskahead.fragments.FacebookButtonFragment"
|
||||||
|
android:id="@+id/fragment_btn_fb"
|
||||||
|
tools:layout="@layout/fragment_facebook_button"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="5dp"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
45
app/src/main/res/layout/activity_start.xml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
tools:context="org.deke.risk.riskahead.StartActivity"
|
||||||
|
android:background="#ffffff">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:src="@drawable/logo_riskahead"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:background="#00ffffff" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/LinearLayout02"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_alignParentBottom="true">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/btn_login"
|
||||||
|
android:id="@+id/btn_start_login"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="gotoLogin"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/btn_register"
|
||||||
|
android:id="@+id/btn_start_register"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="gotoRegister"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
27
app/src/main/res/layout/fragment_facebook_button.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
|
xmlns:fb="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="org.deke.risk.riskahead.fragments.FacebookButtonFragment">
|
||||||
|
<!--
|
||||||
|
<com.facebook.login.widget.LoginButton
|
||||||
|
android:id="@+id/btn_login_fb"
|
||||||
|
android:layout_width="225dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
fb:com_facebook_login_text="Facebook"
|
||||||
|
fb:com_facebook_logout_text="Facebook"
|
||||||
|
/>
|
||||||
|
-->
|
||||||
|
<com.beardedhen.androidbootstrap.BootstrapButton
|
||||||
|
android:id="@+id/btn_login_fb"
|
||||||
|
android:layout_width="225dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="Facebook"
|
||||||
|
android:layout_above="@+id/btn_login_fb"
|
||||||
|
bootstrap:bb_icon_left="fa-facebook-f"
|
||||||
|
bootstrap:bb_type="primary"
|
||||||
|
bootstrap:bb_roundedCorners="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
19
app/src/main/res/layout/fragment_googleplus_button.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<FrameLayout android:id="@+id/gp_frame_layout" xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
|
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="org.deke.risk.riskahead.fragments.GooglePlusButtonFragment">
|
||||||
|
|
||||||
|
<com.beardedhen.androidbootstrap.BootstrapButton
|
||||||
|
android:id="@+id/btn_login_gp"
|
||||||
|
android:layout_width="225dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="Google+"
|
||||||
|
android:layout_above="@+id/btn_login_gp"
|
||||||
|
bootstrap:bb_icon_left="fa-google-plus-square"
|
||||||
|
bootstrap:bb_type="danger"
|
||||||
|
bootstrap:bb_roundedCorners="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
29
app/src/main/res/layout/fragment_map.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="org.deke.risk.riskahead.fragments.MapFragment">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_show"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/find"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentTop="true" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_place"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/hint"
|
||||||
|
android:inputType="text"
|
||||||
|
android:layout_toLeftOf="@id/btn_show" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/location_map"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/et_place"
|
||||||
|
class="com.google.android.gms.maps.SupportMapFragment" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
19
app/src/main/res/layout/fragment_twitter_button.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
|
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="org.deke.risk.riskahead.fragments.TwitterButtonFragment">
|
||||||
|
|
||||||
|
<com.beardedhen.androidbootstrap.BootstrapButton
|
||||||
|
android:id="@+id/btn_login_twitter"
|
||||||
|
android:layout_width="225dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="Twitter"
|
||||||
|
android:layout_above="@+id/btn_login_gp"
|
||||||
|
bootstrap:bb_icon_left="fa-twitter"
|
||||||
|
bootstrap:bb_type="info"
|
||||||
|
bootstrap:bb_roundedCorners="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
55
app/src/main/res/layout/fragment_user_info.xml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" tools:context="org.deke.risk.riskahead.fragments.UserInfo">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/welcome"
|
||||||
|
android:textSize="20dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="@color/lbl_name"
|
||||||
|
android:textSize="24dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/email"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="13dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnLogout"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dip"
|
||||||
|
android:background="@color/btn_logut_bg"
|
||||||
|
android:text="@string/btn_logout"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="15dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/test"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="@color/lbl_name"
|
||||||
|
android:textSize="24dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
5
app/src/main/res/menu/global.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
</menu>
|
||||||
7
app/src/main/res/menu/menu_login.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" tools:context=".LoginActivity">
|
||||||
|
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
|
||||||
|
</menu>
|
||||||
9
app/src/main/res/menu/menu_main_share.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:omgandroid="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_item_share"
|
||||||
|
android:title="Share"
|
||||||
|
omgandroid:showAsAction="ifRoom"
|
||||||
|
omgandroid:actionProviderClass= "android.support.v7.widget.ShareActionProvider" />
|
||||||
|
</menu>
|
||||||
9
app/src/main/res/menu/menu_main_usersettings.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="org.deke.risk.riskahead.StartActivity">
|
||||||
|
<item android:id="@+id/settings_user" android:title="@string/settings_user"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
<item android:id="@+id/settings_logout" android:title="@string/settings_logout"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
</menu>
|
||||||
6
app/src/main/res/menu/menu_start.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="org.deke.risk.riskahead.StartActivity">
|
||||||
|
|
||||||
|
</menu>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/Thumbs.db
Normal file
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
6
app/src/main/res/values-w820dp/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<resources>
|
||||||
|
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||||
|
(such as screen margins) for screens with more than 820dp of available width. This
|
||||||
|
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||||
|
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||||
|
</resources>
|
||||||
17
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<color name="bg_login">#26ae90</color>
|
||||||
|
<color name="bg_register">#2e3237</color>
|
||||||
|
<color name="bg_main">#428bca</color>
|
||||||
|
<color name="white">#ffffff</color>
|
||||||
|
<color name="input_login">#222222</color>
|
||||||
|
<color name="input_login_hint">#999999</color>
|
||||||
|
<color name="input_register">#888888</color>
|
||||||
|
<color name="input_register_bg">#3b4148</color>
|
||||||
|
<color name="input_register_hint">#5e6266</color>
|
||||||
|
<color name="btn_login">#26ae90</color>
|
||||||
|
<color name="btn_login_bg">#eceef1</color>
|
||||||
|
<color name="lbl_name">#333333</color>
|
||||||
|
<color name="btn_logut_bg">#ff6861</color>
|
||||||
|
|
||||||
|
</resources>
|
||||||
15
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<resources>
|
||||||
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
<dimen name="fb_margin_override_top">13dp</dimen>
|
||||||
|
<dimen name="fb_margin_override_bottom">13dp</dimen>
|
||||||
|
<!--The next value changes the margin between the FB icon and the left border:-->
|
||||||
|
<dimen name="fb_margin_override_lr">10dp</dimen>
|
||||||
|
<!--The next value changes the margin between the FB icon and the login text:-->
|
||||||
|
<dimen name="fb_margin_override_textpadding">17dp</dimen>
|
||||||
|
|
||||||
|
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
||||||
|
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
||||||
|
<dimen name="navigation_drawer_width">240dp</dimen>
|
||||||
|
</resources>
|
||||||
34
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">RiskAhead</string>
|
||||||
|
<string name="facebook_app_id">658657714234846</string>
|
||||||
|
<string name="txt_welcome_register">New here? Please register to use our service!</string>
|
||||||
|
<string name="txt_welcome_login">Already registrated? Please log in to use our service!</string>
|
||||||
|
<string name="txt_resend_password"><a href="test.com">Resend Password</a> </string>
|
||||||
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="txt_policy"><a href="test.com">Terms of Service</a> and\n<a href="test.com">Privacy Policy</a></string>
|
||||||
|
<string name="hint_full_name">Full Name</string>
|
||||||
|
<string name="hint_email">E-Mail</string>
|
||||||
|
<string name="hint_password">Password</string>
|
||||||
|
<string name="status_signing_in">Signing in...</string>
|
||||||
|
<string name="status_signing_out">Signing out...</string>
|
||||||
|
<string name="login_with_gp">Log in with Google+</string>
|
||||||
|
<string name="logout_with_gp">Log out from Google+</string>
|
||||||
|
<string name="login_with_fb">Log in with Facebook</string>
|
||||||
|
<string name="logout_with_fb">Log out from Facebook</string>
|
||||||
|
<string name="txt_welcome_signin">In order to use our service please create an account or login with your Facebook or G+ Account</string>
|
||||||
|
<string name="txt_useFBorGP">Or use following social networks to sign in</string>
|
||||||
|
<string name="title_activity_start">RiskAhead</string>
|
||||||
|
<string name="btn_login">Login</string>
|
||||||
|
<string name="btn_register">Register</string>
|
||||||
|
<string name="title_activity_entrance">Risk Ahead</string>
|
||||||
|
<string name="hint_name">Full Name</string>
|
||||||
|
<string name="btn_logout">Logout</string>
|
||||||
|
<string name="welcome">Welcome</string>
|
||||||
|
|
||||||
|
<string name="drawer_open">Open navigation drawer</string>
|
||||||
|
<string name="drawer_close">Close navigation drawer</string>
|
||||||
|
<string name="settings_user">Account</string>
|
||||||
|
<string name="settings_logout">Logout</string>
|
||||||
|
<string name="find">Find</string>
|
||||||
|
<string name="hint">Enter Place</string>
|
||||||
|
</resources>
|
||||||
5
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<resources>
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||