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

Java tutorial

Introduction

Here is the source code for com.wit.and.dialog.internal.xml.XmlEditDialog.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.EditDialog;
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 XmlEditDialog extends XmlDialogParser<EditDialog.EditOptions> {

    /**
     * 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 = "EditDialog";

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     */
    @Override
    protected EditDialog.EditOptions onCreateEmptyOptions() {
        return new EditDialog.EditOptions();
    }

    /**
      */
    @Override
    protected void onParseAttribute(XmlResourceParser xmlParser, int attr, int index,
            EditDialog.EditOptions options) {
        if (attr == android.R.attr.editTextStyle) {
            options.editStyle(xmlParser.getAttributeResourceValue(index, 0));
        } else if (attr == android.R.attr.hint) {
            options.hint(resolveString(xmlParser, index));
        } else {
            super.onParseAttribute(xmlParser, attr, index, options);
        }
    }

    /**
     */
    @Override
    protected DialogFragment onCreateDialog(EditDialog.EditOptions options) {
        return DialogFactory.edit(options);
    }

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

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

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

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