com.wit.and.dialog.internal.xml.XmlWebDialog.java Source code

Java tutorial

Introduction

Here is the source code for com.wit.and.dialog.internal.xml.XmlWebDialog.java

Source

/*
 * =================================================================================
 * Copyright (C) 2013 Martin Albedinsky [Wolf-ITechnologies]
 * =================================================================================
 * Licensed under the Apache License, Version 2.0 or later (further "License" only);
 * ---------------------------------------------------------------------------------
 * You may use this file only in compliance with the License. More details and copy
 * of this License you may obtain at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 * You can redistribute, modify or publish any part of the code written in this
 * file but as it is described in the License, the software distributed under the 
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES or CONDITIONS OF
 * ANY KIND.
 * 
 * See the License for the specific language governing permissions and limitations
 * under the License.
 * =================================================================================
 */
package com.wit.and.dialog.internal.xml;

import android.content.res.XmlResourceParser;
import android.support.v4.app.DialogFragment;

import com.wit.and.dialog.R;
import com.wit.and.dialog.WebDialog;
import com.wit.and.dialog.manage.DialogFactory;
import com.wit.and.dialog.manage.DialogOptions;
import com.wit.and.dialog.xml.XmlDialogParser;

/**
 * <h4>Class Overview</h4>
 * <p>
 * </p>
 *
 * @author Martin Albedinsky
 */
class XmlWebDialog extends XmlDialogParser<WebDialog.WebOptions> {

    /**
     * Constants =============================
     */

    /**
     * Log TAG.
     */
    // private static final String TAG = XmlWebDialog.class.getSimpleName();

    /**
     * Indicates if debug private output trough log-cat is enabled.
     */
    // private static final boolean DEBUG = true;

    /**
     * Indicates if logging for user output trough log-cat is enabled.
     */
    // private static final boolean USER_LOG = true;

    /**
     * <p>
     * XML tag of this XML dialog.
     * </p>
     */
    public static final String XML_TAG = "WebDialog";

    /**
     * Enums =================================
     */

    /**
     * Static members ========================
     */

    /**
     * Members ===============================
     */

    /**
     * Listeners -----------------------------
     */

    /**
     * Arrays --------------------------------
     */

    /**
     * Booleans ------------------------------
     */

    /**
     * Constructors ==========================
     */

    /**
     * Methods ===============================
     */

    /**
     * Public --------------------------------
     */

    /**
     * Getters + Setters ---------------------
     */

    /**
     */
    @Override
    public String getXmlTag() {
        return XmlWebDialog.XML_TAG;
    }

    /**
     */
    @Override
    public int getDefaultIcon() {
        return DialogOptions.DIALOG_ICON_WEB;
    }

    /**
     * Protected -----------------------------
     */

    /**
     */
    @Override
    protected WebDialog.WebOptions onCreateEmptyOptions() {
        return new WebDialog.WebOptions();
    }

    /**
      */
    @Override
    protected void onParseAttribute(XmlResourceParser xmlParser, int attr, int index,
            WebDialog.WebOptions options) {
        if (attr == R.attr.dialogJavascriptEnabled) {
            options.javascriptEnabled(xmlParser.getAttributeBooleanValue(index, true));
        } else {
            super.onParseAttribute(xmlParser, attr, index, options);
        }
    }

    /**
     */
    @Override
    protected DialogFragment onCreateDialog(WebDialog.WebOptions options) {
        return DialogFactory.web(options);
    }

    /**
     * Private -------------------------------
     */

    /**
     * Abstract methods ----------------------
     */

    /**
     * Inner classes =========================
     */

    /**
     * Interface =============================
     */
}