Update InstallConfirmActivity and permissions_list from AOSP

This commit is contained in:
Dominik Schürmann 2016-05-05 20:18:27 +03:00
parent 06a8ff5787
commit 2da380a04d
5 changed files with 44 additions and 52 deletions

View File

@ -60,9 +60,7 @@ import java.util.Set;
* extended information consisting of all groups and permissions. * extended information consisting of all groups and permissions.
* To use this view define a LinearLayout or any ViewGroup and add this * To use this view define a LinearLayout or any ViewGroup and add this
* view by instantiating AppSecurityPermissions and invoking getPermissionsView. * view by instantiating AppSecurityPermissions and invoking getPermissionsView.
*/ *
/**
* NOTES: * NOTES:
* Based on AOSP core/java/android/widget/AppSecurityPermissions * Based on AOSP core/java/android/widget/AppSecurityPermissions
* latest included commit: a3f68ef2f6811cf72f1282214c0883db5a30901d * latest included commit: a3f68ef2f6811cf72f1282214c0883db5a30901d

View File

@ -41,6 +41,11 @@ import android.widget.TextView;
import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.R; import org.fdroid.fdroid.R;
/**
* NOTES:
* Parts are based on AOSP src/com/android/packageinstaller/PackageInstallerActivity.java
* latest included commit: c23d802958158d522e7350321ad9ac6d43013883
*/
public class InstallConfirmActivity extends Activity implements OnCancelListener, OnClickListener { public class InstallConfirmActivity extends Activity implements OnCancelListener, OnClickListener {
public static final int RESULT_CANNOT_PARSE = RESULT_FIRST_USER + 1; public static final int RESULT_CANNOT_PARSE = RESULT_FIRST_USER + 1;
@ -107,9 +112,8 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener
findViewById(R.id.tabscontainer).setVisibility(View.GONE); findViewById(R.id.tabscontainer).setVisibility(View.GONE);
findViewById(R.id.divider).setVisibility(View.VISIBLE); findViewById(R.id.divider).setVisibility(View.VISIBLE);
} }
final int np = perms.getPermissionCount(AppSecurityPermissions.WHICH_PERSONAL); final int N = perms.getPermissionCount(AppSecurityPermissions.WHICH_ALL);
final int nd = perms.getPermissionCount(AppSecurityPermissions.WHICH_DEVICE); if (N > 0) {
if (np > 0 || nd > 0) {
permVisible = true; permVisible = true;
LayoutInflater inflater = (LayoutInflater) getSystemService( LayoutInflater inflater = (LayoutInflater) getSystemService(
Context.LAYOUT_INFLATER_SERVICE); Context.LAYOUT_INFLATER_SERVICE);
@ -117,18 +121,8 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener
if (mScrollView == null) { if (mScrollView == null) {
mScrollView = (CaffeinatedScrollView) root.findViewById(R.id.scrollview); mScrollView = (CaffeinatedScrollView) root.findViewById(R.id.scrollview);
} }
final ViewGroup privacyList = (ViewGroup) root.findViewById(R.id.privacylist); final ViewGroup permList = (ViewGroup) root.findViewById(R.id.permission_list);
if (np > 0) { permList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
privacyList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_PERSONAL));
} else {
privacyList.setVisibility(View.GONE);
}
final ViewGroup deviceList = (ViewGroup) root.findViewById(R.id.devicelist);
if (nd > 0) {
deviceList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_DEVICE));
} else {
root.findViewById(R.id.devicelist).setVisibility(View.GONE);
}
adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator( adapter.addTab(tabHost.newTabSpec(TAB_ID_ALL).setIndicator(
getText(R.string.allPerms)), root); getText(R.string.allPerms)), root);
} }

View File

@ -0,0 +1,21 @@
<!--
Copyright (C) 2015 The Android Open Source Project
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:pathData="M26.0,14.0l-4.0,0.0l0.0,4.0l4.0,0.0l0.0,-4.0zm0.0,8.0l-4.0,0.0l0.0,12.0l4.0,0.0L26.0,22.0zm8.0,-19.98L14.0,2.0c-2.21,0.0 -4.0,1.79 -4.0,4.0l0.0,36.0c0.0,2.21 1.79,4.0 4.0,4.0l20.0,0.0c2.21,0.0 4.0,-1.79 4.0,-4.0L38.0,6.0c0.0,-2.21 -1.79,-3.98 -4.0,-3.98zM34.0,38.0L14.0,38.0L14.0,10.0l20.0,0.0l0.0,28.0z"/>
</vector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2012 The Android Open Source Project
<!-- Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -17,37 +16,19 @@
<!-- <!--
This is the structure for the list of all permissions. This is the structure for the list of all permissions.
--> -->
<org.fdroid.fdroid.privileged.views.CaffeinatedScrollView <org.fdroid.fdroid.privileged.views.CaffeinatedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollview" android:id="@+id/scrollview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true"> android:fillViewport="true">
<LinearLayout <LinearLayout
android:orientation="vertical" android:id="@+id/permission_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
<LinearLayout android:id="@+id/privacylist" android:orientation="vertical"
android:orientation="vertical" android:paddingEnd="4dp"
android:layout_width="match_parent" android:paddingRight="4dp"
android:layout_height="wrap_content" tools:ignore="RtlSymmetry" />
android:layout_marginTop="4dp" </org.fdroid.fdroid.privileged.views.CaffeinatedScrollView>
android:layout_marginBottom="4dp">
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/privacyPerms" />
</LinearLayout>
<LinearLayout android:id="@+id/devicelist"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp">
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/devicePerms" />
</LinearLayout>
</LinearLayout>
</org.fdroid.fdroid.privileged.views.CaffeinatedScrollView>

View File

@ -361,8 +361,6 @@
be lost. It does not require any special access.</string> be lost. It does not require any special access.</string>
<string name="newPerms">New</string> <string name="newPerms">New</string>
<string name="allPerms">All</string> <string name="allPerms">All</string>
<string name="privacyPerms">Privacy</string>
<string name="devicePerms">Device Access</string>
<string name="perm_costs_money">This may cost you money</string> <string name="perm_costs_money">This may cost you money</string>
<string name="uninstall_update_confirm">Do you want to replace this app with the factory version?</string> <string name="uninstall_update_confirm">Do you want to replace this app with the factory version?</string>
<string name="uninstall_confirm">Do you want to uninstall this app?</string> <string name="uninstall_confirm">Do you want to uninstall this app?</string>