mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
small lint cleanup
unused imports; strings; removed some deprecated methods
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import com.moez.QKSMS.R;
|
||||
@@ -17,7 +18,7 @@ public class ListviewHelper {
|
||||
public static void applyCustomScrollbar(Context context, ListView listView) {
|
||||
if (context != null && listView != null) {
|
||||
try {
|
||||
Drawable drawable = context.getResources().getDrawable(R.drawable.ic_scrollbar);
|
||||
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.ic_scrollbar);
|
||||
drawable.setColorFilter(Color.argb(64,
|
||||
Color.red(ThemeManager.getTextOnBackgroundSecondary()),
|
||||
Color.green(ThemeManager.getTextOnBackgroundSecondary()),
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@@ -126,7 +127,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
PackageManager manager = getPackageManager();
|
||||
try {
|
||||
ComponentInfo info = manager.getActivityInfo(getComponentName(), 0);
|
||||
imageView.setImageDrawable(getResources().getDrawable(info.getIconResource()));
|
||||
imageView.setImageDrawable(ContextCompat.getDrawable(getBaseContext(), info.getIconResource()));
|
||||
} catch (PackageManager.NameNotFoundException ignored) {
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -277,7 +278,7 @@ public class ThemeManager {
|
||||
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) {
|
||||
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.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -37,9 +38,9 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
|
||||
mRes = MainActivity.getRes(mContext);
|
||||
mPrefs = MainActivity.getPrefs(mContext);
|
||||
|
||||
mMuted = mRes.getDrawable(R.drawable.ic_mute);
|
||||
mUnread = mRes.getDrawable(R.drawable.ic_unread);
|
||||
mError = mRes.getDrawable(R.drawable.ic_error);
|
||||
mMuted = ContextCompat.getDrawable(context, R.drawable.ic_mute);
|
||||
mUnread = ContextCompat.getDrawable(context, R.drawable.ic_unread);
|
||||
mError = ContextCompat.getDrawable(context, R.drawable.ic_error);
|
||||
|
||||
LiveViewManager.registerView(this);
|
||||
LiveViewManager.registerPreference(this, SettingsFragment.THEME);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.moez.QKSMS.ui.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
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) {
|
||||
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();
|
||||
} else if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
}
|
||||
})
|
||||
.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() {
|
||||
|
||||
@@ -7,8 +7,10 @@ import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.interfaces.LiveView;
|
||||
import com.moez.QKSMS.common.LiveViewManager;
|
||||
import com.moez.QKSMS.ui.ThemeManager;
|
||||
@@ -87,7 +89,7 @@ public class QKCheckBox extends android.widget.CheckBox implements LiveView {
|
||||
int id = res.getIdentifier(name, "drawable", getContext().getPackageName());
|
||||
|
||||
try {
|
||||
setButtonDrawable(res.getDrawable(id));
|
||||
setButtonDrawable(ContextCompat.getDrawable(getContext(), id));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.moez.QKSMS.ui.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.moez.QKSMS.ui.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.moez.QKSMS.ui.view.colorpicker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -43,7 +44,7 @@ public class ColorPickerSwatch extends FrameLayout implements View.OnClickListen
|
||||
|
||||
protected void setColor(int color) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Display;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -768,7 +769,7 @@ public class SlidingMenu extends RelativeLayout {
|
||||
* @param resId the resource ID of the new shadow drawable
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public void setSecondaryShadowDrawable(int resId) {
|
||||
setSecondaryShadowDrawable(getContext().getResources().getDrawable(resId));
|
||||
setSecondaryShadowDrawable(ContextCompat.getDrawable(getContext(), resId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user