Merge remote-tracking branch 'refs/remotes/origin/master'
Conflicts: mobile/src/main/AndroidManifest.xml mobile/src/main/java/htdinc/howtodrink/MainActivity.java mobile/src/main/res/layout/activity_main.xml
This commit is contained in:
@@ -23,4 +23,6 @@ dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:23.2.1'
|
||||
compile 'com.android.support:design:23.2.1'
|
||||
compile 'com.android.support:support-v4:23.2.1'
|
||||
compile 'com.google.android.gms:play-services:8.4.0'
|
||||
}
|
||||
|
||||
21
mobile/src/debug/res/values/google_maps_api.xml
Normal file
21
mobile/src/debug/res/values/google_maps_api.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<resources>
|
||||
<!--
|
||||
TODO: Before you run your application, you need a Google Maps API key.
|
||||
|
||||
To get one, follow this link, follow the directions and press "Create" at the end:
|
||||
|
||||
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=E9:60:CD:76:86:55:1F:5A:40:5B:0F:EE:89:E9:FC:1E:60:6B:C9:AB%3Bhtdinc.howtodrink
|
||||
|
||||
You can also add your credentials to an existing key, using this line:
|
||||
E9:60:CD:76:86:55:1F:5A:40:5B:0F:EE:89:E9:FC:1E:60:6B:C9:AB;htdinc.howtodrink
|
||||
|
||||
Alternatively, follow the directions here:
|
||||
https://developers.google.com/maps/documentation/android/start#get-key
|
||||
|
||||
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
|
||||
string in this file.
|
||||
-->
|
||||
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
|
||||
AIzaSyDPBQN-KCbyQp02BzPdWfFXKGo0C97sYzk
|
||||
</string>
|
||||
</resources>
|
||||
@@ -2,18 +2,48 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="htdinc.howtodrink">
|
||||
|
||||
<!--
|
||||
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
|
||||
Google Maps Android API v2, but you must specify either coarse or fine
|
||||
location permissions for the 'MyLocation' functionality.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity" >
|
||||
<activity
|
||||
android:name=".display.Container"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!--
|
||||
The API key for Google Maps-based APIs is defined as a string resource.
|
||||
(See the file "res/values/google_maps_api.xml").
|
||||
Note that the API key is linked to the encryption key used to sign the APK.
|
||||
You need a different API key for each encryption key, including the release key that is used to
|
||||
sign the APK for publishing.
|
||||
You can define the keys for the debug and release targets in src/debug/ and src/release/.
|
||||
-->
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="@string/google_maps_key" />
|
||||
|
||||
<activity
|
||||
android:name=".display.MapsActivity"
|
||||
android:label="@string/title_activity_maps">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".display.Container" />
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
|
||||
|
||||
@@ -13,5 +13,18 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
final Button bouton = (Button) findViewById(R.id.button);
|
||||
bouton.setOnClickListener(new View.OnClickListener(){
|
||||
public void onClick(View v)
|
||||
{
|
||||
Context context = getApplicationContext();
|
||||
CharSequence text = "Ceci est un boutton bite !";
|
||||
int duration = Toast.LENGTH_SHORT;
|
||||
|
||||
Toast.makeText(context,text,duration).show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package htdinc.howtodrink.display;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import htdinc.howtodrink.R;
|
||||
|
||||
/**
|
||||
* An example full-screen activity that shows and hides the system UI (i.e.
|
||||
* status bar and navigation/system bar) with user interaction.
|
||||
*/
|
||||
public class Container extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* Touch listener to use for in-layout UI controls to delay hiding the
|
||||
* system UI. This is to prevent the jarring behavior of controls going away
|
||||
* while interacting with activity UI.
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_container);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package htdinc.howtodrink.display;
|
||||
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
|
||||
import htdinc.howtodrink.R;
|
||||
|
||||
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
|
||||
|
||||
private GoogleMap mMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_maps);
|
||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
mapFragment.getMapAsync(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manipulates the map once available.
|
||||
* This callback is triggered when the map is ready to be used.
|
||||
* This is where we can add markers or lines, add listeners or move the camera. In this case,
|
||||
* we just add a marker near Sydney, Australia.
|
||||
* If Google Play services is not installed on the device, the user will be prompted to install
|
||||
* it inside the SupportMapFragment. This method will only be triggered once the user has
|
||||
* installed Google Play services and returned to the app.
|
||||
*/
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
|
||||
// Add a marker in Sydney and move the camera
|
||||
LatLng sydney = new LatLng(-34, 151);
|
||||
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
|
||||
}
|
||||
}
|
||||
35
mobile/src/main/res/layout/activity_container.xml
Normal file
35
mobile/src/main/res/layout/activity_container.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<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"
|
||||
android:background="#868686"
|
||||
tools:context=".display.Container"
|
||||
android:transitionGroup="false">
|
||||
|
||||
<!-- The primary full-screen view. This can be replaced with whatever view
|
||||
is needed to present your content, e.g. VideoView, SurfaceView,
|
||||
TextureView, etc. -->
|
||||
|
||||
<!-- This FrameLayout insets its children based on system windows using
|
||||
android:fitsSystemWindows. -->
|
||||
<FrameLayout
|
||||
android:id="@+id/fullscreen_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<include
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="362dp"
|
||||
layout="@layout/activity_maps"
|
||||
android:layout_gravity="left|right"
|
||||
android:layout_marginTop="0dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_gravity="bottom|center_horizontal"></FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -9,5 +9,11 @@
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="htdinc.howtodrink.MainActivity">
|
||||
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bite"
|
||||
android:id="@+id/button"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
8
mobile/src/main/res/layout/activity_maps.xml
Normal file
8
mobile/src/main/res/layout/activity_maps.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:map="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".display.MapsActivity" />
|
||||
12
mobile/src/main/res/values/attrs.xml
Normal file
12
mobile/src/main/res/values/attrs.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<!-- Declare custom theme attributes that allow changing which styles are
|
||||
used for button bars depending on the API level.
|
||||
?android:attr/buttonBarStyle is new as of API 11 so this is
|
||||
necessary to support previous API levels. -->
|
||||
<declare-styleable name="ButtonBarContainerTheme">
|
||||
<attr name="metaButtonBarStyle" format="reference" />
|
||||
<attr name="metaButtonBarButtonStyle" format="reference" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -3,4 +3,6 @@
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
|
||||
<color name="black_overlay">#66000000</color>
|
||||
</resources>
|
||||
|
||||
@@ -2,4 +2,13 @@
|
||||
<string name="app_name">How To Drink</string>
|
||||
<string name="title_activity_launch_menu">LaunchMenu</string>
|
||||
<string name="title_activity_launch">How to drink</string>
|
||||
|
||||
<string name="title_activity_content_main_frame">ContentMainFrame</string>
|
||||
<string name="dummy_button">Dummy Button</string>
|
||||
<string name="dummy_content">DUMMY\nCONTENT</string>
|
||||
|
||||
<string name="title_activity_ontainer">OntainerActivity</string>
|
||||
|
||||
<string name="title_activity_container">Container</string>
|
||||
<string name="title_activity_maps">Map</string>
|
||||
</resources>
|
||||
|
||||
@@ -17,4 +17,16 @@
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<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>
|
||||
|
||||
22
mobile/src/release/res/values/google_maps_api.xml
Normal file
22
mobile/src/release/res/values/google_maps_api.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<resources>
|
||||
<!--
|
||||
TODO: Before you release your application, you need a Google Maps API key.
|
||||
|
||||
To do this, you can either add your release key credentials to your existing
|
||||
key, or create a new key.
|
||||
|
||||
Note that this file specifies the API key for the release build target.
|
||||
If you have previously set up a key for the debug target with the debug signing certificate,
|
||||
you will also need to set up a key for your release certificate.
|
||||
|
||||
Follow the directions here:
|
||||
|
||||
https://developers.google.com/maps/documentation/android/signup
|
||||
|
||||
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
|
||||
string in this file.
|
||||
-->
|
||||
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
|
||||
YOUR_KEY_HERE
|
||||
</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user