// Path: GreenMatter/src/main/java/com/negusoft/greenmatter/util/NativeResources.java
// public class NativeResources {
// 
//     private static final String NATIVE_PACKAGE = "android";
// 
//     private static final String TYPE_ID = "id";
//     private static final String TYPE_STRING = "string";
//     private static final String TYPE_DRAWABLE = "drawable";
// 
//     /** Get a native identifier by name as in 'R.id.name'. */
//     public static int getIdentifier(String name) {
//         Resources res = Resources.getSystem();
//         return res.getIdentifier(name, TYPE_ID, NATIVE_PACKAGE);
//     }
// 
//     /** Get a native string id by name as in 'R.string.name'. */
//     public static int getStringIdentifier(String name) {
//         Resources res = Resources.getSystem();
//         return res.getIdentifier(name, TYPE_STRING, NATIVE_PACKAGE);
//     }
// 
//     /** Get a native drawable by name as in 'R.drawable.name'. */
//     public static String getString(String name) {
//         Resources res = Resources.getSystem();
//         int id = res.getIdentifier(name, TYPE_STRING, NATIVE_PACKAGE);
//         return id == 0 ? null : res.getString(id);
//     }
// 
//     /** Get a native drawable id by name as in 'R.drawable.name'. */
//     public static int getDrawableIdentifier(String name) {
//         Resources res = Resources.getSystem();
//         return res.getIdentifier(name, TYPE_DRAWABLE, NATIVE_PACKAGE);
//     }
// 
//     /** Get a native drawable by name as in 'R.drawable.name'. */
//     public static Drawable getDrawable(String name) {
//         Resources res = Resources.getSystem();
//         int id = res.getIdentifier(name, TYPE_DRAWABLE, NATIVE_PACKAGE);
//         return id == 0 ? null : res.getDrawable(id);
//     }
// 
// }


import android.app.ActionBar;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.negusoft.greenmatter.R;
import com.negusoft.greenmatter.util.NativeResources;
import org.w3c.dom.Text;
/*******************************************************************************
 * Copyright 2015 NEGU Soft
 * 
 * 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 com.negusoft.greenmatter.dialog;




/**
 * Utility class to help give the dialogs a Material style.
 */
public class DialogUtils {

    private static final String IDENTIFIER_NAME_DIVIDER = "titleDivider";
    private static final String IDENTIFIER_NAME_BUTTON_PANEL = "buttonPanel";

    public static void prepareDialog(Context context, Window window) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            return;

        removeDivider(window);
        arrangeButtons(context, window);
        arrangeContentSpacing(context, window);
        prepareList(context, window);
    }

    /** Change the button order and alignment. */
    public static void removeDivider(Window window) {
// Path: GreenMatter/src/main/java/com/negusoft/greenmatter/util/NativeResources.java
// public class NativeResources {
// 
//     private static final String NATIVE_PACKAGE = "android";
// 
//     private static final String TYPE_ID = "id";
//     private static final String TYPE_STRING = "string";
//     private static final String TYPE_DRAWABLE = "drawable";
// 
//     /** Get a native identifier by name as in 'R.id.name'. */
//     public static int getIdentifier(String name) {
//         Resources res = Resources.getSystem();
//         return res.getIdentifier(name, TYPE_ID, NATIVE_PACKAGE);
//     }
// 
//     /** Get a native string id by name as in 'R.string.name'. */
//     public static int getStringIdentifier(String name) {
//         Resources res = Resources.getSystem();
//         return res.getIdentifier(name, TYPE_STRING, NATIVE_PACKAGE);
//     }
// 
//     /** Get a native drawable by name as in 'R.drawable.name'. */
//     public static String getString(String name) {
//         Resources res = Resources.getSystem();
//         int id = res.getIdentifier(name, TYPE_STRING, NATIVE_PACKAGE);
//         return id == 0 ? null : res.getString(id);
//     }
// 
//     /** Get a native drawable id by name as in 'R.drawable.name'. */
//     public static int getDrawableIdentifier(String name) {
//         Resources res = Resources.getSystem();
//         return res.getIdentifier(name, TYPE_DRAWABLE, NATIVE_PACKAGE);
//     }
// 
//     /** Get a native drawable by name as in 'R.drawable.name'. */
//     public static Drawable getDrawable(String name) {
//         Resources res = Resources.getSystem();
//         int id = res.getIdentifier(name, TYPE_DRAWABLE, NATIVE_PACKAGE);
//         return id == 0 ? null : res.getDrawable(id);
//     }
// 
// }


// Path: GreenMatter/src/main/java/com/negusoft/greenmatter/dialog/DialogUtils.java
import android.app.ActionBar;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.negusoft.greenmatter.R;
import com.negusoft.greenmatter.util.NativeResources;
import org.w3c.dom.Text;

/*******************************************************************************
 * Copyright 2015 NEGU Soft
 * 
 * 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 com.negusoft.greenmatter.dialog;




/**
 * Utility class to help give the dialogs a Material style.
 */
public class DialogUtils {

    private static final String IDENTIFIER_NAME_DIVIDER = "titleDivider";
    private static final String IDENTIFIER_NAME_BUTTON_PANEL = "buttonPanel";

    public static void prepareDialog(Context context, Window window) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            return;

        removeDivider(window);
        arrangeButtons(context, window);
        arrangeContentSpacing(context, window);
        prepareList(context, window);
    }

    /** Change the button order and alignment. */
    public static void removeDivider(Window window) {
        int id = NativeResources.getIdentifier(IDENTIFIER_NAME_DIVIDER);