Two space indentation

This commit is contained in:
Isaac 2016-04-03 13:08:33 +03:00
parent c83655d29c
commit 1fd4c9d0ea
2 changed files with 153 additions and 155 deletions

View File

@ -11,16 +11,15 @@ import java.util.ArrayList;
import java.util.HashMap;
public class DatabaseHelper extends SQLiteOpenHelper {
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "Kiwix.db";
public static final String CONTACTS_TABLE_NAME = "recentsearches";
public static final String CONTACTS_COLUMN_ID = "id";
public static final String CONTACTS_COLUMN_SEARCH = "search";
public DatabaseHelper(Context context)
{
super(context, DATABASE_NAME , null, 1);
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, 1);
}
@Override
@ -39,8 +38,7 @@ import java.util.HashMap;
onCreate(db);
}
public boolean insertSearch (String search)
{
public boolean insertSearch(String search) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(CONTACTS_COLUMN_SEARCH, search);
@ -48,40 +46,38 @@ import java.util.HashMap;
return true;
}
public Cursor getData(int id){
public Cursor getData(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from " + CONTACTS_TABLE_NAME + " where id="+id+"", null );
Cursor res = db.rawQuery("select * from " + CONTACTS_TABLE_NAME + " where id=" + id + "", null);
return res;
}
public int numberOfRows(){
public int numberOfRows() {
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, CONTACTS_TABLE_NAME);
return numRows;
}
public Integer deleteSearches (Integer id)
{
public Integer deleteSearches(Integer id) {
SQLiteDatabase db = this.getWritableDatabase();
return db.delete(CONTACTS_TABLE_NAME,
"id = ? ",
new String[] { Integer.toString(id) });
new String[]{Integer.toString(id)});
}
public ArrayList<String> getRecentSearches()
{
public ArrayList<String> getRecentSearches() {
ArrayList<String> array_list = new ArrayList<String>();
//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from " + CONTACTS_TABLE_NAME, null );
Cursor res = db.rawQuery("select * from " + CONTACTS_TABLE_NAME, null);
res.moveToLast();
while(res.isBeforeFirst() == false){
while (res.isBeforeFirst() == false) {
array_list.add(res.getString(res.getColumnIndex(CONTACTS_COLUMN_SEARCH)));
res.moveToPrevious();
}
return array_list;
}
}
}

View File

@ -37,25 +37,25 @@ public class HTMLUtils {
this.mHandler = handler;
}
public void initInterface(WebView webView){
public void initInterface(WebView webView) {
webView.addJavascriptInterface(new HTMLinterface(), "HTMLUtils");
}
class HTMLinterface
{
class HTMLinterface {
int i = 0;
@JavascriptInterface
@SuppressWarnings("unused")
public void parse(final String sectionTitle, final String element,final String id) {
public void parse(final String sectionTitle, final String element, final String id) {
mHandler.post(new Runnable() {
@Override
public void run() {
if (element.equals("H1")) {
mRightListView.removeHeaderView(headerView);
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
View view = inflater.inflate( R.layout.section_list, null );
headerView = (TextView) view.findViewById( R.id.textTab );
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.section_list, null);
headerView = (TextView) view.findViewById(R.id.textTab);
headerView.setText(sectionTitle);
headerView.setPadding((int) (26 * context.getResources().getDisplayMetrics().density), 0, 0, 0);
headerView.setBackgroundColor(Color.LTGRAY);
@ -96,13 +96,14 @@ public class HTMLUtils {
}
});
}
@JavascriptInterface
@SuppressWarnings("unused")
public void start() {
mHandler.post(new Runnable() {
@Override
public void run() {
i=0;
i = 0;
textViews.clear();
sectionProperties.clear();
arrayAdapter.clear();
@ -110,6 +111,7 @@ public class HTMLUtils {
}
});
}
@JavascriptInterface
@SuppressWarnings("unused")
public void stop() {