AI2 Component  (Version nb184)
KitkatUtil.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2017 MIT, All rights reserved
3 // Released under the Apache License, Version 2.0
4 // http://www.apache.org/licenses/LICENSE-2.0
5 
6 package com.google.appinventor.components.runtime.util;
7 
8 import java.util.ArrayList;
9 import java.util.Collections;
10 import java.util.List;
11 
12 import android.content.Intent;
13 import android.os.Build;
14 import android.provider.Telephony.Sms.Intents;
15 import android.telephony.SmsMessage;
16 import android.widget.TextView;
17 
24 public final class KitkatUtil {
25 
26  private KitkatUtil() {
27  }
28 
36  public static List<SmsMessage> getMessagesFromIntent(Intent intent) {
37  List<SmsMessage> result = new ArrayList<SmsMessage>();
38  SmsMessage[] messages = Intents.getMessagesFromIntent(intent);
39  if (messages != null && messages.length >= 0) {
40  Collections.addAll(result, messages);
41  }
42  return result;
43  }
44 
51  public static int getMinWidth(TextView view) {
52  if (Build.VERSION.SDK_INT >= 16) {
53  return view.getMinWidth();
54  } else {
55  return view.getWidth();
56  }
57  }
58 
65  public static int getMinHeight(TextView view) {
66  if (Build.VERSION.SDK_INT >= 16) {
67  return view.getMinHeight();
68  } else {
69  return view.getHeight();
70  }
71  }
72 }
com.google.appinventor.components.runtime.util.KitkatUtil.getMinHeight
static int getMinHeight(TextView view)
Definition: KitkatUtil.java:65
com.google.appinventor.components.runtime.util.KitkatUtil
Definition: KitkatUtil.java:24
com.google.appinventor.components.runtime.util.KitkatUtil.getMinWidth
static int getMinWidth(TextView view)
Definition: KitkatUtil.java:51
com.google.appinventor.components.runtime.util.KitkatUtil.getMessagesFromIntent
static List< SmsMessage > getMessagesFromIntent(Intent intent)
Definition: KitkatUtil.java:36