Commit 7376ac0a authored by Christof Wolke's avatar Christof Wolke

create Splash Activity

parent 8c12e8ed
......@@ -22,7 +22,7 @@ android {
buildscript {
repositories {
jcenter()
}
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
......@@ -38,20 +38,24 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Import Estimote SDK (https://github.com/Estimote/Android-SDK)
compile 'com.estimote:sdk:0.10.8@aar'
// Import LoganSquare JSON library (https://github.com/bluelinelabs/LoganSquare)
apt 'com.bluelinelabs:logansquare-compiler:1.3.6'
compile 'com.bluelinelabs:logansquare:1.3.6'
// Import OkHttp library (https://github.com/square/okhttp)
compile 'com.squareup.okhttp:okhttp:2.7.1'
// Import RushOrm library (https://github.com/Stuart-campbell/RushOrm)
compile 'co.uk.rushorm:rushandroid:1.2.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Import GifImageView library (https://github.com/felipecsl/GifImageView)
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
compile 'com.android.support:support-v4:24.1.1'
testCompile 'junit:junit:4.12'
apt 'com.bluelinelabs:logansquare-compiler:1.3.6'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.uni_oldenburg.bidl">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.uni_oldenburg.bidl">
<application
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".base_view.MainActivity">
<activity
android:name=".base_view.MainActivity"
android:label="Home"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".base_view.SplashActivity"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
......
......@@ -2,25 +2,14 @@ package de.uni_oldenburg.bidl.base_view;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import de.uni_oldenburg.bidl.R;
import com.estimote.sdk.Beacon;
import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Region;
import com.estimote.sdk.SystemRequirementsChecker;
import java.util.List;
import java.util.UUID;
import de.uni_oldenburg.bidl.R;
public class MainActivity extends AppCompatActivity {
private static final UUID ESTIMOTE_PROXIMITY_UUID = UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D");
private Region region;
private BeaconManager beaconManager;
/** GUI **/
private TextView beaconID;
......@@ -29,62 +18,14 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
beaconID = (TextView) findViewById(R.id.BeaconID);
//Start ranging for beacons
beaconManager = new BeaconManager(this);
beaconManager.setRangingListener(new BeaconManager.RangingListener() {
@Override
public void onBeaconsDiscovered(Region region, List<Beacon> list) {
if (!list.isEmpty()){
Beacon nearestBeacon = list.get(0);
//// TODO: 29.07.2016 Servercall to get the Event, which takes place.
showBeaconID(nearestBeacon);
}
}
});
region = new Region("ranged region", ESTIMOTE_PROXIMITY_UUID, null, null);
/** init **/
beaconID = (TextView) findViewById(R.id.BeaconID);
}
/**
* Only for Testing. Shows the BeaconIDs in the Textview with the ID = beaconID.
* @param nearestBeacon the nearest Beacon for the user
*/
//Todo delete the method
private void showBeaconID(Beacon nearestBeacon) {
beaconID.setText("UUID: "+nearestBeacon.getProximityUUID()+" \n" +
" minor: "+nearestBeacon.getMinor()+" \n" +
" major: "+nearestBeacon.getMajor());
}
@Override
protected void onResume(){
super.onResume();
// is Bluetooth on, is Location on, etc.
SystemRequirementsChecker.checkWithDefaultDialogs(this);
// Start ranging for beacons, when the activity appears on the screen
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
beaconManager.startRanging(region);
}
});
}
/**
* Ranging ist stopped, if the Activity disappears.
*/
@Override
public void onPause(){
beaconManager.stopRanging(region);
super.onPause();
}
}
......@@ -3,4 +3,7 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="white">#FFFFFF</color>
<color name="black_overlay">#66000000</color>
</resources>
<resources>
<string name="app_name">BIDL</string>
<!-- Splash Activity !-->
<string name="title_activity_splashscreen">SplashscreenActivity</string>
<string name="splashMessage">Es wird nach Beacons gesucht&#8230;</string>
<string name="imageViewDescription">University Logo</string>
<string name="gifImageViewDescription">Loadingspinner</string>
<string name="noBeaconFound">Kein Beacon in der Nähe!</string>
</resources>
......@@ -8,4 +8,16 @@
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="FullscreenTheme" parent="AppTheme">
<item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@null</item>
<item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
<item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">@color/black_overlay</item>
</style>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment