Start adding ask permission dialog

This commit is contained in:
mar-v-in 2015-02-07 20:56:49 +01:00
parent a759c64077
commit 7ecc5e9fc1
9 changed files with 93 additions and 4 deletions

View File

@ -113,6 +113,11 @@
</intent-filter>
</activity>
<activity
android:name="org.microg.gms.auth.AskPermissionActivity"
android:theme="@style/Theme.AppCompat.Light.Dialog"
android:exported="true" />
<provider
android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
android:authorities="subscribedfeeds"

View File

@ -36,6 +36,8 @@ dependencies {
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile project(':GmsApi')
compile project(':UnifiedNlpLib')

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2013-2015 µg 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:padding="50dp"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:src="@color/login_blue_theme_accent"
android:id="@+id/account_photo"
android:layout_marginRight="-5dp"
android:layout_width="64dp"
android:layout_height="64dp"
app:border_width="1dp"
app:border_color="?attr/colorControlHighlight"/>
<de.hdodenhof.circleimageview.CircleImageView
android:src="@color/login_blue_theme_primary"
android:id="@+id/app_icon"
android:layout_marginLeft="-5dp"
android:layout_width="64dp"
android:layout_height="64dp"
app:border_width="1dp"
app:border_color="?attr/colorControlHighlight"/>
</LinearLayout>
</LinearLayout>

View File

@ -50,7 +50,7 @@
android:layout_height="0dip"
android:layout_weight="1">
<include layout="@layout/login_loading" />
<include layout="@layout/login_assistant_loading" />
</FrameLayout>
<View

View File

@ -0,0 +1,30 @@
/*
* Copyright 2013-2015 µg 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.auth;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.gms.R;
public class AskPermissionActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ask_permission);
}
}

View File

@ -60,6 +60,12 @@ public class AuthManager {
return true;
}
public static void storePermission(Context context, Account account, String packageName,
String sig, String service) {
AccountManager accountManager = AccountManager.get(context);
accountManager.setUserData(account, buildPermKey(packageName, sig, service), "1");
}
private static String buildTokenKey(String packageName, String sig, String service) {
return packageName + ":" + sig + ":" + service;
}

View File

@ -23,14 +23,14 @@ import android.util.DisplayMetrics;
import com.google.android.gms.R;
public abstract class BaseActivity extends Activity {
public abstract class AssistantActivity extends Activity {
private static final int TITLE_MIN_HEIGHT = 64;
private static final double TITLE_WIDTH_FACTOR = (8.0 / 18.0);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_base);
setContentView(R.layout.login_assistant);
formatTitle();
}

View File

@ -46,7 +46,7 @@ import org.microg.gms.common.Utils;
import java.util.Locale;
public class LoginActivity extends BaseActivity {
public class LoginActivity extends AssistantActivity {
public static final String TMPL_NEW_ACCOUNT = "new_account";
public static final String EXTRA_TMPL = "tmpl";
public static final String EXTRA_EMAIL = "email";