2015-10-24 18:01:55 +00:00
|
|
|
package eu.faircode.netguard;
|
|
|
|
|
2015-11-03 17:57:29 +00:00
|
|
|
/*
|
|
|
|
This file is part of NetGuard.
|
|
|
|
|
|
|
|
NetGuard is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
NetGuard is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with NetGuard. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-01-01 13:52:09 +00:00
|
|
|
Copyright 2015-2016 by Marcel Bokhorst (M66B)
|
2015-11-03 17:57:29 +00:00
|
|
|
*/
|
|
|
|
|
2015-12-02 09:42:24 +00:00
|
|
|
import android.Manifest;
|
|
|
|
import android.annotation.TargetApi;
|
|
|
|
import android.app.Activity;
|
2016-01-30 13:26:30 +00:00
|
|
|
import android.app.AlertDialog;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.content.Context;
|
2016-01-30 13:26:30 +00:00
|
|
|
import android.content.DialogInterface;
|
2015-11-09 12:50:21 +00:00
|
|
|
import android.content.Intent;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.content.SharedPreferences;
|
2015-10-25 16:52:33 +00:00
|
|
|
import android.content.res.TypedArray;
|
2016-01-30 13:26:30 +00:00
|
|
|
import android.database.Cursor;
|
2015-10-25 21:12:08 +00:00
|
|
|
import android.graphics.Color;
|
2015-11-01 14:22:50 +00:00
|
|
|
import android.graphics.Rect;
|
2015-11-01 07:20:58 +00:00
|
|
|
import android.net.Uri;
|
2015-12-02 09:42:24 +00:00
|
|
|
import android.os.Build;
|
2015-11-24 17:34:41 +00:00
|
|
|
import android.preference.PreferenceManager;
|
2015-12-25 18:40:59 +00:00
|
|
|
import android.support.v4.app.NotificationManagerCompat;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
|
import android.util.Log;
|
2016-01-02 12:22:18 +00:00
|
|
|
import android.util.TypedValue;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.view.LayoutInflater;
|
2016-01-30 13:26:30 +00:00
|
|
|
import android.view.MenuItem;
|
2015-11-01 14:22:50 +00:00
|
|
|
import android.view.TouchDelegate;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
2016-01-30 13:26:30 +00:00
|
|
|
import android.widget.AdapterView;
|
2015-10-30 11:41:05 +00:00
|
|
|
import android.widget.Button;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.CompoundButton;
|
2015-10-25 10:11:46 +00:00
|
|
|
import android.widget.Filter;
|
|
|
|
import android.widget.Filterable;
|
2015-11-09 12:50:21 +00:00
|
|
|
import android.widget.ImageButton;
|
2015-10-24 18:50:27 +00:00
|
|
|
import android.widget.ImageView;
|
2015-10-29 07:48:28 +00:00
|
|
|
import android.widget.LinearLayout;
|
2016-01-27 10:59:16 +00:00
|
|
|
import android.widget.ListView;
|
2016-01-30 13:26:30 +00:00
|
|
|
import android.widget.PopupMenu;
|
2015-10-24 18:01:55 +00:00
|
|
|
import android.widget.TextView;
|
|
|
|
|
2015-11-01 07:20:58 +00:00
|
|
|
import com.squareup.picasso.Picasso;
|
|
|
|
|
2015-10-25 10:11:46 +00:00
|
|
|
import java.util.ArrayList;
|
2015-10-24 18:01:55 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2015-10-25 10:11:46 +00:00
|
|
|
public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> implements Filterable {
|
2015-10-26 16:32:03 +00:00
|
|
|
private static final String TAG = "NetGuard.Adapter";
|
2015-10-24 18:01:55 +00:00
|
|
|
|
2015-12-02 09:42:24 +00:00
|
|
|
private Activity context;
|
2016-01-27 10:59:16 +00:00
|
|
|
private DatabaseHelper dh;
|
2015-12-08 16:00:40 +00:00
|
|
|
private boolean wifi;
|
2015-11-29 10:17:16 +00:00
|
|
|
private boolean telephony;
|
2016-01-31 09:29:43 +00:00
|
|
|
private boolean filter;
|
2015-11-09 18:28:09 +00:00
|
|
|
private boolean debuggable;
|
2015-10-25 16:52:33 +00:00
|
|
|
private int colorText;
|
|
|
|
private int colorAccent;
|
2015-11-24 19:16:56 +00:00
|
|
|
private int colorChanged;
|
2015-11-25 19:05:17 +00:00
|
|
|
private boolean wifiActive = true;
|
|
|
|
private boolean otherActive = true;
|
2015-10-31 13:15:26 +00:00
|
|
|
private List<Rule> listAll = new ArrayList<>();
|
2016-02-01 06:55:04 +00:00
|
|
|
private List<Rule> listFiltered = new ArrayList<>();
|
2015-10-24 18:01:55 +00:00
|
|
|
|
|
|
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
2015-10-24 18:50:27 +00:00
|
|
|
public View view;
|
2015-11-01 13:16:57 +00:00
|
|
|
|
2015-10-29 07:48:28 +00:00
|
|
|
public LinearLayout llApplication;
|
2015-10-24 18:50:27 +00:00
|
|
|
public ImageView ivIcon;
|
2015-10-30 07:39:17 +00:00
|
|
|
public ImageView ivExpander;
|
2015-10-24 18:01:55 +00:00
|
|
|
public TextView tvName;
|
2015-11-29 10:17:16 +00:00
|
|
|
|
2015-12-08 16:00:40 +00:00
|
|
|
public LinearLayout llWifi;
|
2015-10-24 18:01:55 +00:00
|
|
|
public CheckBox cbWifi;
|
2015-12-08 16:00:40 +00:00
|
|
|
public ImageView ivScreenWifi;
|
|
|
|
|
2015-11-29 10:17:16 +00:00
|
|
|
public LinearLayout llOther;
|
2015-10-24 18:01:55 +00:00
|
|
|
public CheckBox cbOther;
|
2015-11-21 08:48:33 +00:00
|
|
|
public ImageView ivScreenOther;
|
2015-11-01 13:16:57 +00:00
|
|
|
public TextView tvRoaming;
|
|
|
|
|
2015-10-29 11:52:36 +00:00
|
|
|
public LinearLayout llConfiguration;
|
2015-11-18 18:08:04 +00:00
|
|
|
public TextView tvUid;
|
2015-11-13 18:46:35 +00:00
|
|
|
public TextView tvPackage;
|
2015-11-18 18:08:04 +00:00
|
|
|
public TextView tvVersion;
|
2015-11-13 18:46:35 +00:00
|
|
|
public TextView tvDisabled;
|
|
|
|
public TextView tvInternet;
|
2015-12-08 16:00:40 +00:00
|
|
|
|
|
|
|
public LinearLayout llWifiAttr;
|
2015-11-21 08:48:33 +00:00
|
|
|
public CheckBox cbScreenWifi;
|
2015-12-08 16:00:40 +00:00
|
|
|
|
2015-11-29 10:17:16 +00:00
|
|
|
public LinearLayout llOtherAttr;
|
2015-11-21 08:48:33 +00:00
|
|
|
public CheckBox cbScreenOther;
|
2015-11-01 13:16:57 +00:00
|
|
|
public CheckBox cbRoaming;
|
2015-12-08 16:00:40 +00:00
|
|
|
|
2015-12-27 08:07:38 +00:00
|
|
|
public ImageButton btnClear;
|
2015-11-09 12:50:21 +00:00
|
|
|
public ImageButton btnSettings;
|
2015-10-30 11:41:05 +00:00
|
|
|
public Button btnLaunch;
|
2015-10-24 18:01:55 +00:00
|
|
|
|
2016-01-27 10:59:16 +00:00
|
|
|
public ListView lvAccess;
|
2016-02-01 07:25:08 +00:00
|
|
|
public TextView tvNolog;
|
2016-01-30 13:26:30 +00:00
|
|
|
public ImageButton btnClearAccess;
|
2015-12-09 11:59:47 +00:00
|
|
|
public TextView tvStatistics;
|
|
|
|
|
2015-10-24 18:01:55 +00:00
|
|
|
public ViewHolder(View itemView) {
|
|
|
|
super(itemView);
|
2015-10-25 09:29:49 +00:00
|
|
|
view = itemView;
|
2015-11-01 13:16:57 +00:00
|
|
|
|
2015-10-29 07:48:28 +00:00
|
|
|
llApplication = (LinearLayout) itemView.findViewById(R.id.llApplication);
|
2015-10-25 09:29:49 +00:00
|
|
|
ivIcon = (ImageView) itemView.findViewById(R.id.ivIcon);
|
2015-10-30 07:39:17 +00:00
|
|
|
ivExpander = (ImageView) itemView.findViewById(R.id.ivExpander);
|
2015-10-25 09:29:49 +00:00
|
|
|
tvName = (TextView) itemView.findViewById(R.id.tvName);
|
2015-11-01 13:16:57 +00:00
|
|
|
|
2015-12-08 16:00:40 +00:00
|
|
|
llWifi = (LinearLayout) itemView.findViewById(R.id.llWifi);
|
2015-10-25 09:29:49 +00:00
|
|
|
cbWifi = (CheckBox) itemView.findViewById(R.id.cbWifi);
|
2015-12-08 16:00:40 +00:00
|
|
|
ivScreenWifi = (ImageView) itemView.findViewById(R.id.ivScreenWifi);
|
|
|
|
|
2015-11-29 10:17:16 +00:00
|
|
|
llOther = (LinearLayout) itemView.findViewById(R.id.llOther);
|
2015-10-25 09:29:49 +00:00
|
|
|
cbOther = (CheckBox) itemView.findViewById(R.id.cbOther);
|
2015-11-21 08:48:33 +00:00
|
|
|
ivScreenOther = (ImageView) itemView.findViewById(R.id.ivScreenOther);
|
2015-11-01 13:16:57 +00:00
|
|
|
tvRoaming = (TextView) itemView.findViewById(R.id.tvRoaming);
|
|
|
|
|
2015-10-29 11:52:36 +00:00
|
|
|
llConfiguration = (LinearLayout) itemView.findViewById(R.id.llConfiguration);
|
2015-11-18 18:08:04 +00:00
|
|
|
tvUid = (TextView) itemView.findViewById(R.id.tvUid);
|
2015-11-01 13:16:57 +00:00
|
|
|
tvPackage = (TextView) itemView.findViewById(R.id.tvPackage);
|
2015-11-18 18:08:04 +00:00
|
|
|
tvVersion = (TextView) itemView.findViewById(R.id.tvVersion);
|
2015-11-13 18:46:35 +00:00
|
|
|
tvDisabled = (TextView) itemView.findViewById(R.id.tvDisabled);
|
|
|
|
tvInternet = (TextView) itemView.findViewById(R.id.tvInternet);
|
2015-12-08 16:00:40 +00:00
|
|
|
|
|
|
|
llWifiAttr = (LinearLayout) itemView.findViewById(R.id.llWifiAttr);
|
2015-11-21 08:48:33 +00:00
|
|
|
cbScreenWifi = (CheckBox) itemView.findViewById(R.id.cbScreenWifi);
|
2015-12-08 16:00:40 +00:00
|
|
|
|
2015-11-29 10:17:16 +00:00
|
|
|
llOtherAttr = (LinearLayout) itemView.findViewById(R.id.llOtherAttr);
|
2015-11-21 08:48:33 +00:00
|
|
|
cbScreenOther = (CheckBox) itemView.findViewById(R.id.cbScreenOther);
|
2015-11-01 13:16:57 +00:00
|
|
|
cbRoaming = (CheckBox) itemView.findViewById(R.id.cbRoaming);
|
2015-12-08 16:00:40 +00:00
|
|
|
|
2015-12-27 08:07:38 +00:00
|
|
|
btnClear = (ImageButton) itemView.findViewById(R.id.btnClear);
|
2015-11-09 12:50:21 +00:00
|
|
|
btnSettings = (ImageButton) itemView.findViewById(R.id.btnSettings);
|
2015-10-30 11:41:05 +00:00
|
|
|
btnLaunch = (Button) itemView.findViewById(R.id.btnLaunch);
|
2015-11-01 14:22:50 +00:00
|
|
|
|
2016-01-27 10:59:16 +00:00
|
|
|
lvAccess = (ListView) itemView.findViewById(R.id.lvAccess);
|
2016-02-01 07:25:08 +00:00
|
|
|
tvNolog = (TextView) itemView.findViewById(R.id.tvNolog);
|
2016-01-30 13:26:30 +00:00
|
|
|
btnClearAccess = (ImageButton) itemView.findViewById(R.id.btnClearAccess);
|
2015-12-09 11:59:47 +00:00
|
|
|
tvStatistics = (TextView) itemView.findViewById(R.id.tvStatistics);
|
|
|
|
|
2015-11-01 14:22:50 +00:00
|
|
|
final View wifiParent = (View) cbWifi.getParent();
|
|
|
|
wifiParent.post(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
Rect rect = new Rect();
|
|
|
|
cbWifi.getHitRect(rect);
|
|
|
|
rect.bottom += rect.top;
|
|
|
|
rect.right += rect.left;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.left = 0;
|
|
|
|
wifiParent.setTouchDelegate(new TouchDelegate(rect, cbWifi));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
final View otherParent = (View) cbOther.getParent();
|
|
|
|
otherParent.post(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
Rect rect = new Rect();
|
|
|
|
cbOther.getHitRect(rect);
|
|
|
|
rect.bottom += rect.top;
|
|
|
|
rect.right += rect.left;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.left = 0;
|
|
|
|
otherParent.setTouchDelegate(new TouchDelegate(rect, cbOther));
|
|
|
|
}
|
|
|
|
});
|
2015-10-24 18:01:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-27 10:59:16 +00:00
|
|
|
public RuleAdapter(DatabaseHelper dh, Activity context) {
|
2016-01-31 09:29:43 +00:00
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
2015-10-25 16:52:33 +00:00
|
|
|
this.context = context;
|
2016-01-27 10:59:16 +00:00
|
|
|
this.dh = dh;
|
2015-12-08 16:00:40 +00:00
|
|
|
this.wifi = Util.hasWifi(context);
|
2015-11-29 10:17:16 +00:00
|
|
|
this.telephony = Util.hasTelephony(context);
|
2016-01-31 09:29:43 +00:00
|
|
|
this.filter = prefs.getBoolean("filter", false);
|
2015-11-09 18:28:09 +00:00
|
|
|
this.debuggable = Util.isDebuggable(context);
|
2015-11-24 17:34:41 +00:00
|
|
|
|
2015-11-24 19:16:56 +00:00
|
|
|
if (prefs.getBoolean("dark_theme", false))
|
|
|
|
colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY), Color.blue(Color.DKGRAY));
|
|
|
|
else
|
|
|
|
colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY), Color.blue(Color.LTGRAY));
|
2015-11-24 17:34:41 +00:00
|
|
|
|
2015-10-25 16:52:33 +00:00
|
|
|
TypedArray ta = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary});
|
|
|
|
try {
|
|
|
|
colorText = ta.getColor(0, 0);
|
|
|
|
} finally {
|
|
|
|
ta.recycle();
|
|
|
|
}
|
2016-01-02 12:22:18 +00:00
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
context.getTheme().resolveAttribute(R.attr.colorAccent, tv, true);
|
|
|
|
colorAccent = tv.data;
|
2015-10-31 13:15:26 +00:00
|
|
|
}
|
|
|
|
|
2015-10-31 17:12:57 +00:00
|
|
|
public void set(List<Rule> listRule) {
|
2015-10-25 10:11:46 +00:00
|
|
|
listAll = listRule;
|
2016-02-01 06:55:04 +00:00
|
|
|
listFiltered = new ArrayList<>();
|
|
|
|
listFiltered.addAll(listRule);
|
2015-10-31 13:15:26 +00:00
|
|
|
notifyDataSetChanged();
|
2015-10-24 18:01:55 +00:00
|
|
|
}
|
|
|
|
|
2015-11-25 19:05:17 +00:00
|
|
|
public void setWifiActive() {
|
|
|
|
wifiActive = true;
|
|
|
|
otherActive = false;
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMobileActive() {
|
|
|
|
wifiActive = false;
|
|
|
|
otherActive = true;
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
|
2015-11-25 20:09:00 +00:00
|
|
|
public void setDisconnected() {
|
|
|
|
wifiActive = false;
|
|
|
|
otherActive = false;
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
|
2015-10-24 18:01:55 +00:00
|
|
|
@Override
|
2015-10-30 07:39:17 +00:00
|
|
|
public void onBindViewHolder(final ViewHolder holder, final int position) {
|
2015-10-25 15:28:41 +00:00
|
|
|
// Get rule
|
2016-02-01 06:55:04 +00:00
|
|
|
final Rule rule = listFiltered.get(position);
|
2015-10-24 18:50:27 +00:00
|
|
|
|
2015-10-25 15:28:41 +00:00
|
|
|
// Rule change listener
|
2015-10-25 09:29:49 +00:00
|
|
|
CompoundButton.OnCheckedChangeListener cbListener = new CompoundButton.OnCheckedChangeListener() {
|
2015-10-24 18:01:55 +00:00
|
|
|
@Override
|
2015-10-25 09:29:49 +00:00
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
2015-10-30 07:39:17 +00:00
|
|
|
// Update rule
|
2015-11-08 10:06:04 +00:00
|
|
|
String network = ((buttonView == holder.cbWifi) ? "wifi" : "other");
|
|
|
|
updateRule(rule, network, isChecked);
|
2015-11-24 17:34:41 +00:00
|
|
|
rule.updateChanged(context);
|
2015-10-24 18:01:55 +00:00
|
|
|
|
2015-11-08 10:15:18 +00:00
|
|
|
// Update relations
|
2015-11-08 09:52:48 +00:00
|
|
|
if (rule.related == null)
|
|
|
|
notifyItemChanged(position);
|
|
|
|
else {
|
2015-11-08 10:06:04 +00:00
|
|
|
for (String pkg : rule.related)
|
|
|
|
for (Rule related : listAll)
|
|
|
|
if (related.info.packageName.equals(pkg)) {
|
|
|
|
updateRule(related, network, isChecked);
|
2015-11-21 08:48:33 +00:00
|
|
|
updateScreenWifi(related, rule.screen_wifi);
|
|
|
|
updateScreenOther(related, rule.screen_other);
|
2015-11-08 10:15:18 +00:00
|
|
|
updateRoaming(related, rule.roaming);
|
2015-11-24 17:34:41 +00:00
|
|
|
related.updateChanged(context);
|
2015-11-08 09:52:48 +00:00
|
|
|
}
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
2015-10-29 08:56:22 +00:00
|
|
|
|
2015-10-30 07:39:17 +00:00
|
|
|
// Apply updated rule
|
2015-12-02 16:53:03 +00:00
|
|
|
SinkholeService.reload(network, "rule changed", context);
|
2015-10-24 18:01:55 +00:00
|
|
|
}
|
2015-10-25 09:29:49 +00:00
|
|
|
};
|
|
|
|
|
2015-11-25 19:05:17 +00:00
|
|
|
holder.llApplication.setOnClickListener(new View.OnClickListener() {
|
2015-10-29 11:52:36 +00:00
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
2015-11-25 19:05:17 +00:00
|
|
|
rule.expanded = !rule.expanded;
|
2015-10-30 07:39:17 +00:00
|
|
|
notifyItemChanged(position);
|
2015-10-29 11:52:36 +00:00
|
|
|
}
|
2015-11-25 19:05:17 +00:00
|
|
|
});
|
2015-10-29 11:52:36 +00:00
|
|
|
|
2015-11-24 19:16:56 +00:00
|
|
|
holder.itemView.setBackgroundColor(rule.changed ? colorChanged : Color.TRANSPARENT);
|
2015-11-24 17:34:41 +00:00
|
|
|
|
2015-11-09 12:35:18 +00:00
|
|
|
if (rule.info.applicationInfo == null || rule.info.applicationInfo.icon == 0)
|
2015-11-01 07:20:58 +00:00
|
|
|
Picasso.with(context).load(android.R.drawable.sym_def_app_icon).into(holder.ivIcon);
|
|
|
|
else {
|
|
|
|
Uri uri = Uri.parse("android.resource://" + rule.info.packageName + "/" + rule.info.applicationInfo.icon);
|
|
|
|
Picasso.with(context).load(uri).into(holder.ivIcon);
|
|
|
|
}
|
|
|
|
|
2015-11-25 19:05:17 +00:00
|
|
|
holder.ivExpander.setImageLevel(rule.expanded ? 1 : 0);
|
2015-10-25 15:28:41 +00:00
|
|
|
holder.tvName.setText(rule.name);
|
2015-11-01 13:16:57 +00:00
|
|
|
|
|
|
|
int color = rule.system ? colorAccent : colorText;
|
2015-12-27 08:54:25 +00:00
|
|
|
if (!rule.internet || !rule.enabled)
|
2015-11-18 08:05:43 +00:00
|
|
|
color = Color.argb(128, Color.red(color), Color.green(color), Color.blue(color));
|
2015-10-25 21:12:08 +00:00
|
|
|
holder.tvName.setTextColor(color);
|
2015-10-25 15:28:41 +00:00
|
|
|
|
2015-12-08 16:00:40 +00:00
|
|
|
holder.llWifi.setVisibility(wifi ? View.VISIBLE : View.GONE);
|
|
|
|
|
2015-11-25 19:51:44 +00:00
|
|
|
holder.cbWifi.setAlpha(wifiActive ? 1 : 0.5f);
|
2015-10-25 09:29:49 +00:00
|
|
|
holder.cbWifi.setOnCheckedChangeListener(null);
|
|
|
|
holder.cbWifi.setChecked(rule.wifi_blocked);
|
|
|
|
holder.cbWifi.setOnCheckedChangeListener(cbListener);
|
2015-10-24 18:01:55 +00:00
|
|
|
|
2015-11-25 19:51:44 +00:00
|
|
|
holder.ivScreenWifi.setAlpha(wifiActive ? 1 : 0.5f);
|
|
|
|
holder.ivScreenWifi.setVisibility(rule.screen_wifi && rule.wifi_blocked ? View.VISIBLE : View.INVISIBLE);
|
|
|
|
|
2015-11-29 10:17:16 +00:00
|
|
|
holder.llOther.setVisibility(telephony ? View.VISIBLE : View.GONE);
|
|
|
|
|
2015-11-25 19:51:44 +00:00
|
|
|
holder.cbOther.setAlpha(otherActive ? 1 : 0.5f);
|
2015-10-24 18:01:55 +00:00
|
|
|
holder.cbOther.setOnCheckedChangeListener(null);
|
|
|
|
holder.cbOther.setChecked(rule.other_blocked);
|
2015-10-25 09:29:49 +00:00
|
|
|
holder.cbOther.setOnCheckedChangeListener(cbListener);
|
2015-10-29 07:48:28 +00:00
|
|
|
|
2015-11-25 19:51:44 +00:00
|
|
|
holder.ivScreenOther.setAlpha(otherActive ? 1 : 0.5f);
|
2015-11-21 08:48:33 +00:00
|
|
|
holder.ivScreenOther.setVisibility(rule.screen_other && rule.other_blocked ? View.VISIBLE : View.INVISIBLE);
|
2015-11-25 19:51:44 +00:00
|
|
|
holder.tvRoaming.setAlpha(otherActive ? 1 : 0.5f);
|
2015-11-21 08:48:33 +00:00
|
|
|
holder.tvRoaming.setVisibility(rule.roaming && (!rule.other_blocked || rule.screen_other) ? View.VISIBLE : View.INVISIBLE);
|
2015-10-29 07:48:28 +00:00
|
|
|
|
2015-11-25 19:05:17 +00:00
|
|
|
holder.llConfiguration.setVisibility(rule.expanded ? View.VISIBLE : View.GONE);
|
2015-11-18 18:08:04 +00:00
|
|
|
|
|
|
|
holder.tvUid.setText(rule.info.applicationInfo == null ? "?" : Integer.toString(rule.info.applicationInfo.uid));
|
|
|
|
holder.tvPackage.setText(rule.info.packageName);
|
|
|
|
holder.tvVersion.setText(rule.info.versionName + '/' + rule.info.versionCode);
|
2015-11-01 13:16:57 +00:00
|
|
|
|
2015-12-27 08:54:25 +00:00
|
|
|
holder.tvDisabled.setVisibility(rule.enabled ? View.GONE : View.VISIBLE);
|
2015-11-13 18:46:35 +00:00
|
|
|
holder.tvInternet.setVisibility(rule.internet ? View.GONE : View.VISIBLE);
|
|
|
|
|
2015-11-21 08:48:33 +00:00
|
|
|
holder.cbScreenWifi.setOnCheckedChangeListener(null);
|
|
|
|
holder.cbScreenWifi.setChecked(rule.screen_wifi);
|
|
|
|
holder.cbScreenWifi.setEnabled(rule.wifi_blocked);
|
2015-10-29 07:48:28 +00:00
|
|
|
|
2015-12-08 16:00:40 +00:00
|
|
|
holder.llWifiAttr.setVisibility(wifi ? View.VISIBLE : View.GONE);
|
|
|
|
|
2015-11-21 08:48:33 +00:00
|
|
|
holder.cbScreenWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2015-10-29 07:48:28 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
2015-10-31 20:28:32 +00:00
|
|
|
// Update rule
|
2015-11-21 08:48:33 +00:00
|
|
|
updateScreenWifi(rule, isChecked);
|
2015-11-24 17:34:41 +00:00
|
|
|
rule.updateChanged(context);
|
2015-10-31 20:28:32 +00:00
|
|
|
|
2015-11-08 10:15:18 +00:00
|
|
|
// Update relations
|
|
|
|
if (rule.related == null)
|
|
|
|
notifyItemChanged(position);
|
|
|
|
else {
|
|
|
|
for (String pkg : rule.related)
|
|
|
|
for (Rule related : listAll)
|
2015-11-24 17:34:41 +00:00
|
|
|
if (related.info.packageName.equals(pkg)) {
|
2015-11-21 08:48:33 +00:00
|
|
|
updateScreenWifi(related, rule.screen_wifi);
|
2015-11-24 17:34:41 +00:00
|
|
|
related.updateChanged(context);
|
|
|
|
}
|
2015-11-21 08:48:33 +00:00
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply updated rule
|
2015-12-02 16:53:03 +00:00
|
|
|
SinkholeService.reload(null, "rule changed", context);
|
2015-11-21 08:48:33 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-11-29 10:17:16 +00:00
|
|
|
holder.llOtherAttr.setVisibility(telephony ? View.VISIBLE : View.GONE);
|
|
|
|
|
2015-11-21 08:48:33 +00:00
|
|
|
holder.cbScreenOther.setOnCheckedChangeListener(null);
|
|
|
|
holder.cbScreenOther.setChecked(rule.screen_other);
|
|
|
|
holder.cbScreenOther.setEnabled(rule.other_blocked);
|
|
|
|
|
|
|
|
holder.cbScreenOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
// Update rule
|
|
|
|
updateScreenOther(rule, isChecked);
|
2015-11-24 17:34:41 +00:00
|
|
|
rule.updateChanged(context);
|
2015-11-21 08:48:33 +00:00
|
|
|
|
|
|
|
// Update relations
|
|
|
|
if (rule.related == null)
|
|
|
|
notifyItemChanged(position);
|
|
|
|
else {
|
|
|
|
for (String pkg : rule.related)
|
|
|
|
for (Rule related : listAll)
|
2015-11-24 17:34:41 +00:00
|
|
|
if (related.info.packageName.equals(pkg)) {
|
2015-11-21 08:48:33 +00:00
|
|
|
updateScreenOther(related, rule.screen_other);
|
2015-11-24 17:34:41 +00:00
|
|
|
related.updateChanged(context);
|
|
|
|
}
|
2015-11-08 10:15:18 +00:00
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
2015-11-01 13:16:57 +00:00
|
|
|
|
|
|
|
// Apply updated rule
|
2015-12-02 16:53:03 +00:00
|
|
|
SinkholeService.reload(null, "rule changed", context);
|
2015-11-01 13:16:57 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
holder.cbRoaming.setOnCheckedChangeListener(null);
|
|
|
|
holder.cbRoaming.setChecked(rule.roaming);
|
2015-11-21 08:48:33 +00:00
|
|
|
holder.cbRoaming.setEnabled(!rule.other_blocked || rule.screen_other);
|
2015-11-01 13:16:57 +00:00
|
|
|
|
|
|
|
holder.cbRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
2015-12-02 09:42:24 +00:00
|
|
|
@TargetApi(Build.VERSION_CODES.M)
|
2015-11-01 13:16:57 +00:00
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
// Update rule
|
2015-11-08 10:15:18 +00:00
|
|
|
updateRoaming(rule, isChecked);
|
2015-11-24 17:34:41 +00:00
|
|
|
rule.updateChanged(context);
|
2015-11-01 13:16:57 +00:00
|
|
|
|
2015-11-08 10:15:18 +00:00
|
|
|
// Update relations
|
|
|
|
if (rule.related == null)
|
|
|
|
notifyItemChanged(position);
|
|
|
|
else {
|
|
|
|
for (String pkg : rule.related)
|
|
|
|
for (Rule related : listAll)
|
2015-11-24 17:34:41 +00:00
|
|
|
if (related.info.packageName.equals(pkg)) {
|
2015-11-08 10:15:18 +00:00
|
|
|
updateRoaming(related, rule.roaming);
|
2015-11-24 17:34:41 +00:00
|
|
|
related.updateChanged(context);
|
|
|
|
}
|
2015-11-08 10:15:18 +00:00
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
2015-10-30 07:39:17 +00:00
|
|
|
|
|
|
|
// Apply updated rule
|
2015-12-02 16:53:03 +00:00
|
|
|
SinkholeService.reload(null, "rule changed", context);
|
2015-12-02 09:42:24 +00:00
|
|
|
|
|
|
|
// Request permissions
|
|
|
|
if (isChecked && !Util.hasPhoneStatePermission(context))
|
|
|
|
context.requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, ActivityMain.REQUEST_ROAMING);
|
2015-10-29 07:48:28 +00:00
|
|
|
}
|
|
|
|
});
|
2015-10-30 11:41:05 +00:00
|
|
|
|
2015-12-27 08:07:38 +00:00
|
|
|
// Reset rule
|
|
|
|
holder.btnClear.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
2016-01-30 13:26:30 +00:00
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
.setTitle(R.string.msg_sure)
|
|
|
|
.setCancelable(true)
|
|
|
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
holder.cbWifi.setChecked(rule.wifi_default);
|
|
|
|
holder.cbOther.setChecked(rule.other_default);
|
|
|
|
holder.cbScreenWifi.setChecked(rule.screen_wifi_default);
|
|
|
|
holder.cbScreenOther.setChecked(rule.screen_other_default);
|
|
|
|
holder.cbRoaming.setChecked(rule.roaming_default);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.create().show();
|
2015-12-27 08:07:38 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-11-09 12:50:21 +00:00
|
|
|
// Launch application settings
|
|
|
|
final Intent settings = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
|
settings.setData(Uri.parse("package:" + rule.info.packageName));
|
|
|
|
holder.btnSettings.setVisibility(
|
2015-11-09 18:28:09 +00:00
|
|
|
!debuggable || settings.resolveActivity(context.getPackageManager()) == null ? View.GONE : View.VISIBLE);
|
2015-11-09 12:50:21 +00:00
|
|
|
holder.btnSettings.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
context.startActivity(settings);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Launch application
|
2015-11-09 18:28:09 +00:00
|
|
|
holder.btnLaunch.setVisibility(!debuggable || rule.intent == null ? View.GONE : View.VISIBLE);
|
2015-10-30 11:41:05 +00:00
|
|
|
holder.btnLaunch.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
2015-10-31 20:25:39 +00:00
|
|
|
context.startActivity(rule.intent);
|
2015-10-30 11:41:05 +00:00
|
|
|
}
|
|
|
|
});
|
2015-12-09 11:59:47 +00:00
|
|
|
|
2016-01-27 10:59:16 +00:00
|
|
|
if (rule.expanded) {
|
2016-01-30 13:26:30 +00:00
|
|
|
final AccessAdapter badapter = new AccessAdapter(context, dh.getAccess(rule.info.applicationInfo.uid));
|
|
|
|
|
2016-01-31 09:29:43 +00:00
|
|
|
if (filter)
|
|
|
|
holder.lvAccess.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(AdapterView<?> parent, View view, final int bposition, long bid) {
|
|
|
|
if (IAB.isPurchased(ActivityPro.SKU_FILTER, context)) {
|
|
|
|
Cursor cursor = (Cursor) badapter.getItem(bposition);
|
|
|
|
final long id = cursor.getLong(cursor.getColumnIndex("ID"));
|
|
|
|
String daddr = cursor.getString(cursor.getColumnIndex("daddr"));
|
|
|
|
int dport = (cursor.isNull(cursor.getColumnIndex("dport")) ? -1 : cursor.getInt(cursor.getColumnIndex("dport")));
|
|
|
|
int block = cursor.getInt(cursor.getColumnIndex("block"));
|
|
|
|
|
2016-01-31 10:04:55 +00:00
|
|
|
PopupMenu popup = new PopupMenu(context, context.findViewById(R.id.vwPopupAnchor));
|
2016-01-31 09:29:43 +00:00
|
|
|
popup.inflate(R.menu.access);
|
|
|
|
popup.getMenu().findItem(R.id.menu_host).setTitle(daddr + (dport > 0 ? ":" + dport : ""));
|
|
|
|
|
|
|
|
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
|
|
switch (menuItem.getItemId()) {
|
|
|
|
case R.id.menu_allow:
|
|
|
|
dh.setAccess(id, rule.info.applicationInfo.uid, 0);
|
|
|
|
SinkholeService.reload(null, "allow host", context);
|
|
|
|
return true;
|
|
|
|
case R.id.menu_block:
|
|
|
|
dh.setAccess(id, rule.info.applicationInfo.uid, 1);
|
|
|
|
SinkholeService.reload(null, "block host", context);
|
|
|
|
return true;
|
|
|
|
case R.id.menu_clear:
|
|
|
|
dh.setAccess(id, rule.info.applicationInfo.uid, -1);
|
|
|
|
SinkholeService.reload(null, "clear host", context);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-01-31 08:30:06 +00:00
|
|
|
}
|
2016-01-31 09:29:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (block == 0)
|
|
|
|
popup.getMenu().removeItem(R.id.menu_allow);
|
|
|
|
else if (block == 1)
|
|
|
|
popup.getMenu().removeItem(R.id.menu_block);
|
|
|
|
|
|
|
|
popup.show();
|
|
|
|
} else
|
|
|
|
context.startActivity(new Intent(context, ActivityPro.class));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
else
|
|
|
|
holder.lvAccess.setOnItemClickListener(null);
|
2016-01-30 13:26:30 +00:00
|
|
|
|
|
|
|
holder.lvAccess.setAdapter(badapter);
|
|
|
|
} else {
|
2016-01-27 10:59:16 +00:00
|
|
|
holder.lvAccess.setAdapter(null);
|
2016-01-30 13:26:30 +00:00
|
|
|
holder.lvAccess.setOnItemClickListener(null);
|
|
|
|
}
|
|
|
|
|
2016-02-01 07:25:08 +00:00
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
boolean log_app = prefs.getBoolean("log_app", false);
|
|
|
|
holder.tvNolog.setVisibility(log_app ? View.GONE : View.VISIBLE);
|
|
|
|
holder.tvNolog.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
context.startActivity(new Intent(context, ActivitySettings.class));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-01-30 13:26:30 +00:00
|
|
|
holder.btnClearAccess.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
.setTitle(R.string.msg_sure)
|
|
|
|
.setCancelable(true)
|
|
|
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
dh.clearAccess(rule.info.applicationInfo.uid);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.create().show();
|
|
|
|
}
|
|
|
|
});
|
2016-01-27 10:59:16 +00:00
|
|
|
|
2015-12-09 11:59:47 +00:00
|
|
|
// Traffic statistics
|
2015-12-28 08:09:07 +00:00
|
|
|
holder.tvStatistics.setText(context.getString(R.string.msg_mbday, rule.upspeed, rule.downspeed));
|
2015-10-25 09:29:49 +00:00
|
|
|
}
|
2015-10-24 18:01:55 +00:00
|
|
|
|
2015-11-08 10:06:04 +00:00
|
|
|
private void updateRule(Rule rule, String network, boolean blocked) {
|
|
|
|
SharedPreferences prefs = context.getSharedPreferences(network, Context.MODE_PRIVATE);
|
|
|
|
|
|
|
|
if ("wifi".equals(network)) {
|
|
|
|
rule.wifi_blocked = blocked;
|
|
|
|
if (rule.wifi_blocked == rule.wifi_default) {
|
|
|
|
Log.i(TAG, "Removing " + rule.info.packageName + " " + network);
|
|
|
|
prefs.edit().remove(rule.info.packageName).apply();
|
|
|
|
} else {
|
|
|
|
Log.i(TAG, "Setting " + rule.info.packageName + " " + network + "=" + blocked);
|
|
|
|
prefs.edit().putBoolean(rule.info.packageName, blocked).apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("other".equals(network)) {
|
|
|
|
rule.other_blocked = blocked;
|
|
|
|
if (rule.other_blocked == rule.other_default) {
|
|
|
|
Log.i(TAG, "Removing " + rule.info.packageName + " " + network);
|
|
|
|
prefs.edit().remove(rule.info.packageName).apply();
|
|
|
|
} else {
|
|
|
|
Log.i(TAG, "Setting " + rule.info.packageName + " " + network + "=" + blocked);
|
|
|
|
prefs.edit().putBoolean(rule.info.packageName, blocked).apply();
|
|
|
|
}
|
|
|
|
}
|
2015-12-25 18:40:59 +00:00
|
|
|
|
|
|
|
NotificationManagerCompat.from(context).cancel(rule.info.applicationInfo.uid);
|
2015-11-08 10:06:04 +00:00
|
|
|
}
|
|
|
|
|
2015-11-21 08:48:33 +00:00
|
|
|
private void updateScreenWifi(Rule rule, boolean enabled) {
|
|
|
|
rule.screen_wifi = enabled;
|
|
|
|
SharedPreferences screen_wifi = context.getSharedPreferences("screen_wifi", Context.MODE_PRIVATE);
|
|
|
|
if (rule.screen_wifi == rule.screen_wifi_default)
|
|
|
|
screen_wifi.edit().remove(rule.info.packageName).apply();
|
|
|
|
else
|
|
|
|
screen_wifi.edit().putBoolean(rule.info.packageName, rule.screen_wifi).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateScreenOther(Rule rule, boolean enabled) {
|
|
|
|
rule.screen_other = enabled;
|
|
|
|
SharedPreferences screen_other = context.getSharedPreferences("screen_other", Context.MODE_PRIVATE);
|
|
|
|
if (rule.screen_other == rule.screen_other_default)
|
|
|
|
screen_other.edit().remove(rule.info.packageName).apply();
|
2015-11-08 10:15:18 +00:00
|
|
|
else
|
2015-11-21 08:48:33 +00:00
|
|
|
screen_other.edit().putBoolean(rule.info.packageName, rule.screen_other).apply();
|
2015-11-08 10:15:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updateRoaming(Rule rule, boolean enabled) {
|
|
|
|
rule.roaming = enabled;
|
|
|
|
SharedPreferences roaming = context.getSharedPreferences("roaming", Context.MODE_PRIVATE);
|
|
|
|
if (rule.roaming == rule.roaming_default)
|
|
|
|
roaming.edit().remove(rule.info.packageName).apply();
|
|
|
|
else
|
|
|
|
roaming.edit().putBoolean(rule.info.packageName, rule.roaming).apply();
|
|
|
|
}
|
|
|
|
|
2015-10-25 10:11:46 +00:00
|
|
|
@Override
|
|
|
|
public Filter getFilter() {
|
|
|
|
return new Filter() {
|
|
|
|
@Override
|
|
|
|
protected FilterResults performFiltering(CharSequence query) {
|
|
|
|
List<Rule> listResult = new ArrayList<>();
|
|
|
|
if (query == null)
|
|
|
|
listResult.addAll(listAll);
|
|
|
|
else {
|
2015-11-15 14:42:38 +00:00
|
|
|
query = query.toString().toLowerCase();
|
2015-10-25 10:11:46 +00:00
|
|
|
for (Rule rule : listAll)
|
2015-11-15 14:42:38 +00:00
|
|
|
if (rule.info.packageName.toLowerCase().contains(query) ||
|
|
|
|
(rule.name != null && rule.name.toLowerCase().contains(query)) ||
|
2016-01-07 06:47:00 +00:00
|
|
|
(rule.info.applicationInfo != null && Integer.toString(rule.info.applicationInfo.uid).contains(query)))
|
2015-10-25 10:11:46 +00:00
|
|
|
listResult.add(rule);
|
|
|
|
}
|
|
|
|
|
|
|
|
FilterResults result = new FilterResults();
|
|
|
|
result.values = listResult;
|
|
|
|
result.count = listResult.size();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void publishResults(CharSequence query, FilterResults result) {
|
2016-02-01 06:55:04 +00:00
|
|
|
listFiltered.clear();
|
2015-10-25 10:11:46 +00:00
|
|
|
if (result == null)
|
2016-02-01 06:55:04 +00:00
|
|
|
listFiltered.addAll(listAll);
|
|
|
|
else {
|
|
|
|
listFiltered.addAll((List<Rule>) result.values);
|
|
|
|
if (listFiltered.size() == 1)
|
|
|
|
listFiltered.get(0).expanded = true;
|
|
|
|
}
|
2015-10-25 10:11:46 +00:00
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-10-25 09:29:49 +00:00
|
|
|
@Override
|
|
|
|
public RuleAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
2015-10-25 16:52:33 +00:00
|
|
|
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.rule, parent, false));
|
2015-10-24 18:01:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemCount() {
|
2016-02-01 06:55:04 +00:00
|
|
|
return listFiltered.size();
|
2015-10-24 18:01:55 +00:00
|
|
|
}
|
|
|
|
}
|