mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-23 02:57:47 +01:00
Start adding ask permission dialog
This commit is contained in:
parent
a759c64077
commit
7ecc5e9fc1
@ -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"
|
||||
|
@ -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')
|
||||
|
||||
|
46
res/layout/ask_permission.xml
Normal file
46
res/layout/ask_permission.xml
Normal 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>
|
@ -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
|
30
src/org/microg/gms/auth/AskPermissionActivity.java
Normal file
30
src/org/microg/gms/auth/AskPermissionActivity.java
Normal 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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user