Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import android.app.Notification;

import android.os.Build;

import android.widget.RemoteViews;

import java.util.HashMap;
import java.util.Map;

public class Main {
    private static Map<Integer, String> sSystemLayoutResIds = new HashMap<Integer, String>(0);

    public static boolean isCustomNotification(Notification notification) {
        if (isCustomNotification(notification.contentView)) {
            return true;
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            if (isCustomNotification(notification.tickerView)) {
                return true;
            }
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            if (isCustomNotification(notification.bigContentView)) {
                return true;
            }
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (isCustomNotification(notification.headsUpContentView)) {
                return true;
            }
        }
        return false;
    }

    public static boolean isCustomNotification(RemoteViews remoteViews) {
        if (remoteViews == null) {
            return false;
        } else if (sSystemLayoutResIds.containsKey(remoteViews.getLayoutId())) {
            return false;
        } else {
            return true;
        }
    }
}