Merge pull request #159 from l3d00m/develop

small lint cleanup
This commit is contained in:
Moez Bhatti
2015-08-21 19:37:15 -04:00
34 changed files with 57 additions and 140 deletions
@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface SdkConstant { public @interface SdkConstant {
public static enum SdkConstantType { public static enum SdkConstantType {
ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE; ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE
} }
SdkConstantType value(); SdkConstantType value();
@@ -566,11 +566,8 @@ public class ConnectivityManager {
public boolean requestRouteToHost(int networkType, int hostAddress) { public boolean requestRouteToHost(int networkType, int hostAddress) {
InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress);
if (inetAddress == null) { return inetAddress != null && requestRouteToHostAddress(networkType, inetAddress);
return false;
}
return requestRouteToHostAddress(networkType, inetAddress);
} }
/** /**
@@ -112,12 +112,12 @@ public class DhcpInfoInternal {
p.addRoute(route); p.addRoute(route);
} }
//if empty, connectivity configures default DNS //if empty, connectivity configures default DNS
if (TextUtils.isEmpty(dns1) == false) { if (!TextUtils.isEmpty(dns1)) {
p.addDns(NetworkUtils.numericToInetAddress(dns1)); p.addDns(NetworkUtils.numericToInetAddress(dns1));
} else { } else {
if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns1!"); if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns1!");
} }
if (TextUtils.isEmpty(dns2) == false) { if (!TextUtils.isEmpty(dns2)) {
p.addDns(NetworkUtils.numericToInetAddress(dns2)); p.addDns(NetworkUtils.numericToInetAddress(dns2));
} else { } else {
if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns2!"); if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns2!");
@@ -152,11 +152,7 @@ public class DhcpInfoInternal {
* metered, and sensitive to heavy data transfers. * metered, and sensitive to heavy data transfers.
*/ */
public boolean hasMeteredHint() { public boolean hasMeteredHint() {
if (vendorInfo != null) { return vendorInfo != null && vendorInfo.contains("ANDROID_METERED");
return vendorInfo.contains("ANDROID_METERED");
} else {
return false;
}
} }
public String toString() { public String toString() {
@@ -204,8 +204,7 @@ public class LinkProperties implements Parcelable {
*/ */
public boolean isIdenticalDnses(LinkProperties target) { public boolean isIdenticalDnses(LinkProperties target) {
Collection<InetAddress> targetDnses = target.getDnses(); Collection<InetAddress> targetDnses = target.getDnses();
return (mDnses.size() == targetDnses.size()) ? return (mDnses.size() == targetDnses.size()) && mDnses.containsAll(targetDnses);
mDnses.containsAll(targetDnses) : false;
} }
/** /**
@@ -216,8 +215,7 @@ public class LinkProperties implements Parcelable {
*/ */
public boolean isIdenticalRoutes(LinkProperties target) { public boolean isIdenticalRoutes(LinkProperties target) {
Collection<RouteInfo> targetRoutes = target.getRoutes(); Collection<RouteInfo> targetRoutes = target.getRoutes();
return (mRoutes.size() == targetRoutes.size()) ? return (mRoutes.size() == targetRoutes.size()) && mRoutes.containsAll(targetRoutes);
mRoutes.containsAll(targetRoutes) : false;
} }
/** /**
@@ -331,13 +331,8 @@ public class NetworkTemplate implements Parcelable {
* Check if mobile network with matching IMSI. * Check if mobile network with matching IMSI.
*/ */
private boolean matchesMobile(NetworkIdentity ident) { private boolean matchesMobile(NetworkIdentity ident) {
if (ident.mType == TYPE_WIMAX) { // TODO: consider matching against WiMAX subscriber identity
// TODO: consider matching against WiMAX subscriber identity return ident.mType == TYPE_WIMAX || ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType)) && Objects.equal(mSubscriberId, ident.mSubscriberId));
return true;
} else {
return ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType))
&& Objects.equal(mSubscriberId, ident.mSubscriberId));
}
} }
/** /**
@@ -391,18 +386,11 @@ public class NetworkTemplate implements Parcelable {
* Check if matches Ethernet network template. * Check if matches Ethernet network template.
*/ */
private boolean matchesEthernet(NetworkIdentity ident) { private boolean matchesEthernet(NetworkIdentity ident) {
if (ident.mType == TYPE_ETHERNET) { return ident.mType == TYPE_ETHERNET;
return true;
}
return false;
} }
private boolean matchesMobileWildcard(NetworkIdentity ident) { private boolean matchesMobileWildcard(NetworkIdentity ident) {
if (ident.mType == TYPE_WIMAX) { return ident.mType == TYPE_WIMAX || sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType);
return true;
} else {
return sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType);
}
} }
private boolean matchesWifiWildcard(NetworkIdentity ident) { private boolean matchesWifiWildcard(NetworkIdentity ident) {
@@ -149,13 +149,12 @@ public class ProxyProperties implements Parcelable {
if (!(o instanceof ProxyProperties)) return false; if (!(o instanceof ProxyProperties)) return false;
ProxyProperties p = (ProxyProperties) o; ProxyProperties p = (ProxyProperties) o;
if (mExclusionList != null && !mExclusionList.equals(p.getExclusionList())) return false; if (mExclusionList != null && !mExclusionList.equals(p.getExclusionList())) return false;
if (mHost != null && p.getHost() != null && mHost.equals(p.getHost()) == false) { if (mHost != null && p.getHost() != null && !mHost.equals(p.getHost())) {
return false; return false;
} }
if (mHost != null && p.mHost == null) return false; if (mHost != null && p.mHost == null) return false;
if (mHost == null && p.mHost != null) return false; if (mHost == null && p.mHost != null) return false;
if (mPort != p.mPort) return false; return mPort == p.mPort;
return true;
} }
/** /**
@@ -168,7 +168,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != parser.START_TAG while ((type=parser.next()) != parser.START_TAG
&& type != parser.END_DOCUMENT) { && type != parser.END_DOCUMENT) {
;
} }
if (type != parser.START_TAG) { if (type != parser.START_TAG) {
@@ -186,7 +185,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != parser.START_TAG while ((type=parser.next()) != parser.START_TAG
&& type != parser.END_DOCUMENT) { && type != parser.END_DOCUMENT) {
;
} }
} }
@@ -65,7 +65,7 @@ public class RetryScheduler implements Observer {
ConnectivityManager mConnMgr = (ConnectivityManager) ConnectivityManager mConnMgr = (ConnectivityManager)
mContext.getSystemService(Context.CONNECTIVITY_SERVICE); mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = mConnMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS); NetworkInfo ni = mConnMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS);
return (ni == null ? false : ni.isConnected()); return (ni != null && ni.isConnected());
} }
public void update(Observable observable) { public void update(Observable observable) {
@@ -132,11 +132,7 @@ public class Base64 {
private static boolean isBase64(byte octect) { private static boolean isBase64(byte octect) {
if (octect == PAD) { if (octect == PAD) {
return true; return true;
} else if (base64Alphabet[octect] == -1) { } else return base64Alphabet[octect] != -1;
return false;
} else {
return true;
}
} }
/** /**
@@ -810,7 +810,7 @@ public class PduComposer {
} }
// Need at least one of "cc", "bcc" and "to". // Need at least one of "cc", "bcc" and "to".
if (false == recipient) { if (!recipient) {
return PDU_COMPOSE_CONTENT_ERROR; return PDU_COMPOSE_CONTENT_ERROR;
} }
@@ -154,7 +154,7 @@ public class MmsConfig {
} }
public static boolean getMmsEnabled() { public static boolean getMmsEnabled() {
return mMmsEnabled == 1 ? true : false; return mMmsEnabled == 1;
} }
public static int getMaxMessageSize() { public static int getMaxMessageSize() {
@@ -294,7 +294,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != XmlPullParser.START_TAG while ((type=parser.next()) != XmlPullParser.START_TAG
&& type != XmlPullParser.END_DOCUMENT) { && type != XmlPullParser.END_DOCUMENT) {
;
} }
if (type != XmlPullParser.START_TAG) { if (type != XmlPullParser.START_TAG) {
@@ -312,7 +311,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != XmlPullParser.START_TAG while ((type=parser.next()) != XmlPullParser.START_TAG
&& type != XmlPullParser.END_DOCUMENT) { && type != XmlPullParser.END_DOCUMENT) {
;
} }
} }
@@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.view.View; import android.view.View;
import android.widget.ListView; import android.widget.ListView;
import com.moez.QKSMS.R; import com.moez.QKSMS.R;
@@ -17,7 +18,7 @@ public class ListviewHelper {
public static void applyCustomScrollbar(Context context, ListView listView) { public static void applyCustomScrollbar(Context context, ListView listView) {
if (context != null && listView != null) { if (context != null && listView != null) {
try { try {
Drawable drawable = context.getResources().getDrawable(R.drawable.ic_scrollbar); Drawable drawable = ContextCompat.getDrawable(context, R.drawable.ic_scrollbar);
drawable.setColorFilter(Color.argb(64, drawable.setColorFilter(Color.argb(64,
Color.red(ThemeManager.getTextOnBackgroundSecondary()), Color.red(ThemeManager.getTextOnBackgroundSecondary()),
Color.green(ThemeManager.getTextOnBackgroundSecondary()), Color.green(ThemeManager.getTextOnBackgroundSecondary()),
@@ -755,11 +755,8 @@ public class MessageUtils {
// "foo+caf_=6505551212=tmomail.net@gmail.com", which is the 'from' address from a forwarded email // "foo+caf_=6505551212=tmomail.net@gmail.com", which is the 'from' address from a forwarded email
// message from Gmail. We don't want to treat "foo+caf_=6505551212=tmomail.net@gmail.com" and // message from Gmail. We don't want to treat "foo+caf_=6505551212=tmomail.net@gmail.com" and
// "6505551212" to be the same. // "6505551212" to be the same.
if (number.indexOf('@') >= 0) { return number.indexOf('@') < 0 && PhoneNumberUtils.compare(number, getLocalNumber());
return false;
}
return PhoneNumberUtils.compare(number, getLocalNumber());
} }
public static void handleReadReport(final Context context, public static void handleReadReport(final Context context,
@@ -919,7 +916,7 @@ public class MessageUtils {
public static void viewMmsMessageAttachment(final Activity activity, final Uri msgUri, public static void viewMmsMessageAttachment(final Activity activity, final Uri msgUri,
final SlideshowModel slideshow, final int requestCode, AsyncDialog asyncDialog) { final SlideshowModel slideshow, final int requestCode, AsyncDialog asyncDialog) {
boolean isSimple = (slideshow == null) ? false : slideshow.isSimple(); boolean isSimple = (slideshow != null) && slideshow.isSimple();
if (isSimple) { if (isSimple) {
// In attachment-editor mode, we only ever have one slide. // In attachment-editor mode, we only ever have one slide.
MessageUtils.viewSimpleSlideshow(activity, slideshow); MessageUtils.viewSimpleSlideshow(activity, slideshow);
@@ -313,11 +313,8 @@ public class PhoneNumberUtils extends android.telephony.PhoneNumberUtils {
// if the number of dialable chars in a and b match, but the matched chars < MIN_MATCH, // if the number of dialable chars in a and b match, but the matched chars < MIN_MATCH,
// treat them as equal (i.e. 404-04 and 40404) // treat them as equal (i.e. 404-04 and 40404)
if (effectiveALen == effectiveBLen && effectiveALen == matched) { return effectiveALen == effectiveBLen && effectiveALen == matched;
return true;
}
return false;
} }
// At least one string has matched completely; // At least one string has matched completely;
@@ -346,13 +343,9 @@ public class PhoneNumberUtils extends android.telephony.PhoneNumberUtils {
return true; return true;
} }
if (matchTrunkPrefix(b, ib + 1) return matchTrunkPrefix(b, ib + 1)
&& matchIntlPrefixAndCC(a, ia +1) && matchIntlPrefixAndCC(a, ia + 1);
) {
return true;
}
return false;
} }
/** all of 'a' up to len must be a (+|00|011)country code) /** all of 'a' up to len must be a (+|00|011)country code)
@@ -20,9 +20,6 @@ public class ViewUtils {
int vw = view.getWidth(); int vw = view.getWidth();
int vh = view.getHeight(); int vh = view.getHeight();
if (x < vx || x > vx + vw || y < vy || y > vy + vh) { return !(x < vx || x > vx + vw || y < vy || y > vy + vh);
return false;
}
return true;
} }
} }
@@ -43,7 +43,7 @@ public class RecipientIdCache {
this.id = id; this.id = id;
this.number = number; this.number = number;
} }
}; }
static void init(Context context) { static void init(Context context) {
sInstance = new RecipientIdCache(context); sInstance = new RecipientIdCache(context);
@@ -1400,10 +1400,7 @@ public class ExifInterface {
public boolean isTagCountDefined(int tagId) { public boolean isTagCountDefined(int tagId) {
int info = getTagInfo().get(tagId); int info = getTagInfo().get(tagId);
// No value in info can be zero, as all tags have a non-zero type // No value in info can be zero, as all tags have a non-zero type
if (info == 0) { return info != 0 && getComponentCountFromInfo(info) != ExifTag.SIZE_UNDEFINED;
return false;
}
return getComponentCountFromInfo(info) != ExifTag.SIZE_UNDEFINED;
} }
/** /**
@@ -1550,10 +1547,7 @@ public class ExifInterface {
*/ */
public boolean setTagValue(int tagId, int ifdId, Object val) { public boolean setTagValue(int tagId, int ifdId, Object val) {
ExifTag t = getTag(tagId, ifdId); ExifTag t = getTag(tagId, ifdId);
if (t == null) { return t != null && t.setValue(val);
return false;
}
return t.setValue(val);
} }
/** /**
@@ -1829,10 +1823,7 @@ public class ExifInterface {
*/ */
public boolean setCompressedThumbnail(Bitmap thumb) { public boolean setCompressedThumbnail(Bitmap thumb) {
ByteArrayOutputStream thumbnail = new ByteArrayOutputStream(); ByteArrayOutputStream thumbnail = new ByteArrayOutputStream();
if (!thumb.compress(Bitmap.CompressFormat.JPEG, 90, thumbnail)) { return thumb.compress(Bitmap.CompressFormat.JPEG, 90, thumbnail) && setCompressedThumbnail(thumbnail.toByteArray());
return false;
}
return setCompressedThumbnail(thumbnail.toByteArray());
} }
/** /**
@@ -636,10 +636,7 @@ public class ExifParser {
private boolean checkAllowed(int ifd, int tagId) { private boolean checkAllowed(int ifd, int tagId) {
int info = mInterface.getTagInfo().get(tagId); int info = mInterface.getTagInfo().get(tagId);
if (info == ExifInterface.DEFINITION_NULL) { return info != ExifInterface.DEFINITION_NULL && ExifInterface.isIfdAllowed(info, ifd);
return false;
}
return ExifInterface.isIfdAllowed(info, ifd);
} }
protected void readFullTagValue(ExifTag tag) throws IOException { protected void readFullTagValue(ExifTag tag) throws IOException {
@@ -880,10 +880,7 @@ public class ExifTag {
} }
private boolean checkBadComponentCount(int count) { private boolean checkBadComponentCount(int count) {
if (mHasDefinedDefaultComponentCount && (mComponentCountActual != count)) { return mHasDefinedDefaultComponentCount && (mComponentCountActual != count);
return true;
}
return false;
} }
private static String convertTypeToString(short type) { private static String convertTypeToString(short type) {
@@ -974,20 +971,11 @@ public class ExifTag {
if (tag.mValue == null) { if (tag.mValue == null) {
return false; return false;
} else if (mValue instanceof long[]) { } else if (mValue instanceof long[]) {
if (!(tag.mValue instanceof long[])) { return tag.mValue instanceof long[] && Arrays.equals((long[]) mValue, (long[]) tag.mValue);
return false;
}
return Arrays.equals((long[]) mValue, (long[]) tag.mValue);
} else if (mValue instanceof Rational[]) { } else if (mValue instanceof Rational[]) {
if (!(tag.mValue instanceof Rational[])) { return tag.mValue instanceof Rational[] && Arrays.equals((Rational[]) mValue, (Rational[]) tag.mValue);
return false;
}
return Arrays.equals((Rational[]) mValue, (Rational[]) tag.mValue);
} else if (mValue instanceof byte[]) { } else if (mValue instanceof byte[]) {
if (!(tag.mValue instanceof byte[])) { return tag.mValue instanceof byte[] && Arrays.equals((byte[]) mValue, (byte[]) tag.mValue);
return false;
}
return Arrays.equals((byte[]) mValue, (byte[]) tag.mValue);
} else { } else {
return mValue.equals(tag.mValue); return mValue.equals(tag.mValue);
} }
@@ -276,7 +276,7 @@ public class Base64 {
// If doPadding is false, set length to truncate '=' // If doPadding is false, set length to truncate '='
// padding characters // padding characters
while (doPadding == false && outLen > 0) { while (!doPadding && outLen > 0) {
if (outBuff[outLen - 1] != '=') { if (outBuff[outLen - 1] != '=') {
break; break;
} }
@@ -322,11 +322,7 @@ public class Transaction {
private boolean checkIfMessageExistsAfterDelay(Uri messageUti) { private boolean checkIfMessageExistsAfterDelay(Uri messageUti) {
Cursor query = context.getContentResolver().query(messageUti, new String[] {"_id"}, null, null, null); Cursor query = context.getContentResolver().query(messageUti, new String[] {"_id"}, null, null, null);
if (query != null && query.moveToFirst()) { return query != null && query.moveToFirst();
return true;
} else {
return false;
}
} }
private void sendMmsMessage(String text, String[] addresses, Bitmap[] image, String[] imageNames, byte[] media, String mimeType, String subject) { private void sendMmsMessage(String text, String[] addresses, Bitmap[] image, String[] imageNames, byte[] media, String mimeType, String subject) {
@@ -401,9 +401,6 @@ public class Utils {
* @return true if app is default * @return true if app is default
*/ */
public static boolean isDefaultSmsApp(Context context) { public static boolean isDefaultSmsApp(Context context) {
if (hasKitKat()) { return !hasKitKat() || context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context));
return context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context));
}
return true;
} }
} }
@@ -643,10 +643,8 @@ public class SlideshowModel extends Model
return false; return false;
// No audio allowed. // No audio allowed.
if (slide.hasAudio()) return !slide.hasAudio();
return false;
return true;
} }
/** /**
@@ -15,6 +15,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
@@ -126,7 +127,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
PackageManager manager = getPackageManager(); PackageManager manager = getPackageManager();
try { try {
ComponentInfo info = manager.getActivityInfo(getComponentName(), 0); ComponentInfo info = manager.getActivityInfo(getComponentName(), 0);
imageView.setImageDrawable(getResources().getDrawable(info.getIconResource())); imageView.setImageDrawable(ContextCompat.getDrawable(getBaseContext(), info.getIconResource()));
} catch (PackageManager.NameNotFoundException ignored) { } catch (PackageManager.NameNotFoundException ignored) {
} }
@@ -14,6 +14,7 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
@@ -277,7 +278,7 @@ public class ThemeManager {
sTintManager.setNavigationBarTintColor(sResources.getColor(R.color.black)); sTintManager.setNavigationBarTintColor(sResources.getColor(R.color.black));
} }
sStatusBarTintDrawable = sResources.getDrawable(R.drawable.status_bar_background); sStatusBarTintDrawable = ContextCompat.getDrawable(context, R.drawable.status_bar_background);
if (sStatusBarTintDrawable != null) { if (sStatusBarTintDrawable != null) {
sStatusBarTintDrawable.setColorFilter(status_tint ? sColor : sResources.getColor(R.color.black), PorterDuff.Mode.MULTIPLY); sStatusBarTintDrawable.setColorFilter(status_tint ? sColor : sResources.getColor(R.color.black), PorterDuff.Mode.MULTIPLY);
} }
@@ -5,6 +5,7 @@ import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -25,7 +26,6 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
implements LiveView { implements LiveView {
private final Resources mRes;
private final SharedPreferences mPrefs; private final SharedPreferences mPrefs;
private final Drawable mMuted; private final Drawable mMuted;
@@ -34,12 +34,11 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
public ConversationListAdapter(Context context) { public ConversationListAdapter(Context context) {
mContext = context; mContext = context;
mRes = MainActivity.getRes(mContext);
mPrefs = MainActivity.getPrefs(mContext); mPrefs = MainActivity.getPrefs(mContext);
mMuted = mRes.getDrawable(R.drawable.ic_mute); mMuted = ContextCompat.getDrawable(context, R.drawable.ic_mute);
mUnread = mRes.getDrawable(R.drawable.ic_unread); mUnread = ContextCompat.getDrawable(context, R.drawable.ic_unread);
mError = mRes.getDrawable(R.drawable.ic_error); mError = ContextCompat.getDrawable(context, R.drawable.ic_error);
LiveViewManager.registerView(this); LiveViewManager.registerView(this);
LiveViewManager.registerPreference(this, SettingsFragment.THEME); LiveViewManager.registerPreference(this, SettingsFragment.THEME);
@@ -1,6 +1,5 @@
package com.moez.QKSMS.ui.dialog; package com.moez.QKSMS.ui.dialog;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
@@ -320,11 +320,11 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
if (requestCode == REQUEST_CODE_IMAGE && resultCode == Activity.RESULT_OK) { if (requestCode == REQUEST_CODE_IMAGE && resultCode == Activity.RESULT_OK) {
result = true; result = true;
Toast.makeText(mContext, "Loading attachment", Toast.LENGTH_LONG).show(); Toast.makeText(mContext, R.string.compose_loading_attachment, Toast.LENGTH_LONG).show();
new ImageLoaderTask(mContext, data.getData()).execute(); new ImageLoaderTask(mContext, data.getData()).execute();
} else if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) { } else if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) {
result = true; result = true;
Toast.makeText(mContext, "Loading attachment", Toast.LENGTH_LONG).show(); Toast.makeText(mContext, R.string.compose_loading_attachment, Toast.LENGTH_LONG).show();
new ImageLoaderFromCameraTask().execute((Void[]) null); new ImageLoaderFromCameraTask().execute((Void[]) null);
} }
@@ -543,7 +543,7 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
} }
}) })
.show(((QKActivity) mContext).getFragmentManager(), "delayed message info"); .show(((QKActivity) mContext).getFragmentManager(), "delayed message info");
mPrefs.edit().putBoolean(KEY_DELAYED_INFO_DIALOG_SHOWN, true).apply(); mPrefs.edit().putBoolean(KEY_DELAYED_INFO_DIALOG_SHOWN, true).apply(); //This should be changed, the dialog should be shown each time when delayed messaging is disabled.
} }
private void handleComposeButtonClick() { private void handleComposeButtonClick() {
@@ -7,6 +7,7 @@ import android.graphics.Canvas;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.moez.QKSMS.interfaces.LiveView; import com.moez.QKSMS.interfaces.LiveView;
@@ -87,7 +88,7 @@ public class QKCheckBox extends android.widget.CheckBox implements LiveView {
int id = res.getIdentifier(name, "drawable", getContext().getPackageName()); int id = res.getIdentifier(name, "drawable", getContext().getPackageName());
try { try {
setButtonDrawable(res.getDrawable(id)); setButtonDrawable(ContextCompat.getDrawable(getContext(), id));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -2,7 +2,6 @@ package com.moez.QKSMS.ui.view;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@@ -1,7 +1,6 @@
package com.moez.QKSMS.ui.view; package com.moez.QKSMS.ui.view;
import android.content.Context; import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@@ -2,6 +2,7 @@ package com.moez.QKSMS.ui.view.colorpicker;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@@ -43,7 +44,7 @@ public class ColorPickerSwatch extends FrameLayout implements View.OnClickListen
protected void setColor(int color) { protected void setColor(int color) {
Drawable[] drawables = new Drawable[1]; Drawable[] drawables = new Drawable[1];
drawables[0] = getContext().getResources().getDrawable(R.drawable.color_picker_swatch); drawables[0] = ContextCompat.getDrawable(getContext(), R.drawable.color_picker_swatch);
mSwatchImage.setImageDrawable(new ColorStateDrawable(drawables, color)); mSwatchImage.setImageDrawable(new ColorStateDrawable(drawables, color));
} }
@@ -14,6 +14,7 @@ import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.Display; import android.view.Display;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -768,7 +769,7 @@ public class SlidingMenu extends RelativeLayout {
* @param resId the resource ID of the new shadow drawable * @param resId the resource ID of the new shadow drawable
*/ */
public void setShadowDrawable(int resId) { public void setShadowDrawable(int resId) {
setShadowDrawable(getContext().getResources().getDrawable(resId)); setShadowDrawable(ContextCompat.getDrawable(getContext(), resId));
} }
/** /**
@@ -786,7 +787,7 @@ public class SlidingMenu extends RelativeLayout {
* @param resId the resource ID of the new shadow drawable * @param resId the resource ID of the new shadow drawable
*/ */
public void setSecondaryShadowDrawable(int resId) { public void setSecondaryShadowDrawable(int resId) {
setSecondaryShadowDrawable(getContext().getResources().getDrawable(resId)); setSecondaryShadowDrawable(ContextCompat.getDrawable(getContext(), resId));
} }
/** /**
+1 -10
View File
@@ -712,15 +712,7 @@
<string name="auto_select_failed">Try searching for your carrier\'s APN settings (MMSC, Port, and Proxy) and entering them in Settings > Advanced.</string> <string name="auto_select_failed">Try searching for your carrier\'s APN settings (MMSC, Port, and Proxy) and entering them in Settings > Advanced.</string>
<string name="date_yesterday">Yesterday</string> <string name="date_yesterday">Yesterday</string>
<string name="date_just_now">Just now</string> <string name="date_just_now">Just now</string>
<string name="compose_loading_attachment">Loading attachment</string>
<string-array name="qksms_plus_about_feature_titles">
<item>Bonus theme colors</item>
<item>Delayed messaging</item>
<item>Custom notifications</item>
<item>Automatic night mode</item>
<item>Android Wear responses</item>
<item>And more for free!</item>
</string-array>
<string-array name="resend_menu"> <string-array name="resend_menu">
<item>Resend</item> <item>Resend</item>
@@ -742,7 +734,6 @@
<item>Black</item> <item>Black</item>
</string-array> </string-array>
<string-array name="background_values"> <string-array name="background_values">
<item>white</item> <item>white</item>
<item>offwhite</item> <item>offwhite</item>