Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae483164 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Add (dummy) place picker

We don't have proper code to display a map (without original client library) yet. However applications using it should not crash (as reported in #65)
parent 07ab527d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -42,9 +42,9 @@ dependencies {
    compile project(':wearable-lib')
    // vtm from ./libs
    compile 'org.oscim:vtm-android:0.6.0-SNAPSHOT@aar'
    compile 'org.oscim:vtm-themes:0.6.0-SNAPSHOT'
    compile 'org.oscim:vtm-extras:0.6.0-SNAPSHOT'
    compile 'org.oscim:vtm:0.6.0-SNAPSHOT'
    compile 'org.oscim:vtm-themes:0.6.0-SNAPSHOT@jar'
    compile 'org.oscim:vtm-extras:0.6.0-SNAPSHOT@jar'
    compile 'org.oscim:vtm:0.6.0-SNAPSHOT@jar'
    // Dependencies for vtm
    compile 'com.fasterxml.jackson.core:jackson-core:2.3.0'
    compile 'com.vividsolutions:jts:1.13'
+12 −0
Original line number Diff line number Diff line
@@ -105,6 +105,18 @@
            </intent-filter>
        </service>

        <activity
            android:name="org.microg.gms.ui.PlacePickerActivity"
            android:exported="true"
            android:label="@string/pick_place_title"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
            <intent-filter>
                <action android:name="com.google.android.gms.location.places.ui.PICK_PLACE"/>

                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <!-- Services Framework -->

        <provider
+77 −0
Original line number Diff line number Diff line
/*
 * Copyright 2013-2016 microG Project Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.microg.gms.ui;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

import com.google.android.gms.R;

public class PlacePickerActivity extends AppCompatActivity {
    private static final String TAG = "GmsPlacePicker";

    private static final String EXTRA_PRIMARY_COLOR = "primary_color";
    private static final String EXTRA_PRIMARY_COLOR_DARK = "primary_color_dark";
    private static final String EXTRA_CLIENT_VERSION = "gmscore_client_jar_version";
    private static final String EXTRA_BOUNDS = "latlng_bounds";

    private static final String EXTRA_ATTRIBUTION = "third_party_attributions";
    private static final String EXTRA_FINAL_BOUNDS = "final_latlng_bounds";
    private static final String EXTRA_PLACE = "selected_place";
    private static final String EXTRA_STATUS = "status";

    private int resultCode;
    private Intent resultIntent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        resultCode = RESULT_CANCELED;
        resultIntent = new Intent();
        if (getIntent().hasExtra(EXTRA_BOUNDS))
            resultIntent.putExtra(EXTRA_FINAL_BOUNDS, getIntent().getParcelableExtra(EXTRA_BOUNDS));

        setContentView(R.layout.pick_place);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        toolbar.setBackgroundColor(getIntent().getIntExtra(EXTRA_PRIMARY_COLOR, 0));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            getWindow().setStatusBarColor(getIntent().getIntExtra(EXTRA_PRIMARY_COLOR_DARK, 0));
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        setResult(resultCode, resultIntent);
    }
}
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2013-2016 microG Project Team
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical">

    <include layout="@layout/toolbar"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:text="@string/pick_place_desc"/>

</LinearLayout>
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -84,4 +84,7 @@ This can take a couple of minutes."</string>
    <string name="games_title">Google Play Games</string>
    <string name="games_info_title">%1$s would like to use Play Games</string>
    <string name="games_info_content">To use Play Games it is required to install the Google Play Games app. The application might continue without Play Games, but it is possible that it will behave unexpectedly.</string>

    <string name="pick_place_title">Pick a place</string>
    <string name="pick_place_desc">Place picker is not yet available.</string>
</resources>