mirror of https://github.com/M66B/NetGuard.git
Revert "Merge pull request #235 from rgarza/master"
This reverts commite16be9e6f8
, reversing changes made toab47fda021
. Does not work for me Refs #235
This commit is contained in:
parent
d5f7796907
commit
33ccbe3087
|
@ -28,18 +28,14 @@ import android.database.Cursor;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.FilterQueryProvider;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.Toast;
|
||||
|
@ -51,7 +47,6 @@ public class ActivityLog extends AppCompatActivity {
|
|||
private LogAdapter adapter;
|
||||
private DatabaseHelper dh;
|
||||
private boolean live;
|
||||
private MenuItem menuSearch = null;
|
||||
|
||||
private DatabaseHelper.LogChangedListener listener = new DatabaseHelper.LogChangedListener() {
|
||||
@Override
|
||||
|
@ -81,13 +76,6 @@ public class ActivityLog extends AppCompatActivity {
|
|||
|
||||
adapter = new LogAdapter(this, dh.getLog());
|
||||
lvLog.setAdapter(adapter);
|
||||
adapter.setFilterQueryProvider(new FilterQueryProvider() {
|
||||
|
||||
public Cursor runQuery(CharSequence constraint) {
|
||||
return dh.getLog(constraint.toString());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
lvLog.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
|
@ -163,36 +151,6 @@ public class ActivityLog extends AppCompatActivity {
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.log, menu);
|
||||
|
||||
menuSearch = menu.findItem(R.id.menu_search);
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch);
|
||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
if (adapter != null) {
|
||||
adapter.getFilter().filter(query);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if (adapter != null)
|
||||
adapter.getFilter().filter(newText);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
searchView.setOnCloseListener(new SearchView.OnCloseListener() {
|
||||
@Override
|
||||
public boolean onClose() {
|
||||
if (adapter != null)
|
||||
adapter.getFilter().filter(null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,15 +156,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
return db.rawQuery(query, new String[]{});
|
||||
}
|
||||
|
||||
public Cursor getLog(String filter) {
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
String query = "SELECT ID AS _id, * FROM log";
|
||||
query += " WHERE ip like ?";
|
||||
query += " ORDER BY time DESC";
|
||||
|
||||
return db.rawQuery(query, new String[]{"%" + filter + "%"});
|
||||
}
|
||||
|
||||
public static void addLogChangedListener(LogChangedListener listener) {
|
||||
logChangedListeners.add(listener);
|
||||
}
|
||||
|
|
|
@ -15,10 +15,4 @@
|
|||
<item
|
||||
android:id="@+id/menu_support"
|
||||
android:title="@string/menu_support" />
|
||||
<item
|
||||
android:id="@+id/menu_search"
|
||||
android:icon="@drawable/ic_search_white_24dp"
|
||||
android:title="@string/menu_search"
|
||||
netguard:actionViewClass="android.support.v7.widget.SearchView"
|
||||
netguard:showAsAction="always|collapseActionView" />
|
||||
</menu>
|
||||
|
|
Loading…
Reference in New Issue