alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Android example source code file (grant_credentials_permission.xml)

This example Android source code file (grant_credentials_permission.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Android by Example" TM.

Java - Android tags/keywords

button, imageview, linearlayout, relativelayout, scrollview, textview, the, uid

The grant_credentials_permission.xml Android example source code

<?xml version="1.0" encoding="utf-8"?>
<!--
/**
 * Copyright (c) 2008, Google Inc.
 *
 * 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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- The header -->
    <TextView
        android:id="@+id/header_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/white"
        android:textStyle="bold"
        android:text="@string/grant_permissions_header_text"
        android:shadowColor="@color/shadow"
        android:shadowRadius="2"
        android:singleLine="true"
        android:background="@drawable/title_bar_medium"
        android:gravity="left|center_vertical"
	android:paddingLeft="19dip"
        android:ellipsize="marquee" />

    <!-- The list of packages that correspond to the requesting UID
    and the account/authtokenType that is being requested -->
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:layout_weight="1"
        android:gravity="top|center_horizontal"
        android:foreground="@drawable/title_bar_shadow">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="14dip"
            android:orientation="vertical">

            <TextView
                android:id="@+id/grant_credentials_permission_message_header"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/grant_credentials_permission_message_header"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:paddingLeft="19dip"
                android:paddingBottom="12dip" />

            <LinearLayout
                android:id="@+id/packages_list"
                android:orientation="vertical"
                android:paddingLeft="16dip"
                android:paddingRight="12dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <RelativeLayout
                android:paddingLeft="16dip"
                android:paddingRight="12dip"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:id="@+id/permission_icon"
                    android:layout_width="30dip"
                    android:layout_height="30dip"
                    android:src="@drawable/ic_bullet_key_permission"
                    android:layout_alignParentLeft="true"
                    android:scaleType="fitCenter" />

                <TextView
                    android:id="@+id/account_type"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textColor="@color/perms_dangerous_perm_color"
                    android:textStyle="bold"
                    android:paddingLeft="6dip"
                    android:layout_toRightOf="@id/permission_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/account_name"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="@color/perms_dangerous_perm_color"
                    android:layout_marginTop="-4dip"
                    android:paddingBottom="8dip"
                    android:paddingLeft="6dip"
                    android:layout_below="@id/account_type"
                    android:layout_toRightOf="@id/permission_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/authtoken_type"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textColor="@color/perms_dangerous_perm_color"
                    android:textStyle="bold"
                    android:layout_marginTop="-4dip"
                    android:paddingBottom="8dip"
                    android:paddingLeft="6dip"
                    android:layout_below="@id/account_name"
                    android:layout_toRightOf="@id/permission_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </RelativeLayout>

            <TextView
                android:id="@+id/grant_credentials_permission_message_footer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/grant_credentials_permission_message_footer"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:paddingLeft="19dip"
                android:paddingBottom="12dip" />
        </LinearLayout>
    </ScrollView>

    <!-- The buttons to allow or deny -->
    <LinearLayout
        android:id="@+id/buttons"
        android:layout_width="match_parent"
        android:layout_height="52dip"
        android:background="@drawable/bottom_bar"
        android:paddingTop="4dip"
        android:paddingLeft="2dip"
        android:paddingRight="2dip">

        <Button
            android:id="@+id/allow_button"
            android:text="@string/allow"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="2" />

        <Button
            android:id="@+id/deny_button"
            android:text="@string/deny"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="2" />

    </LinearLayout>
</LinearLayout>

Other Android examples (source code examples)

Here is a short list of links related to this Android grant_credentials_permission.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.