From 7e71628b98ae236d8bf359a9c1b001e5428a6a9c Mon Sep 17 00:00:00 2001 From: Timothy Rae Date: Thu, 3 Dec 2015 17:54:55 +0900 Subject: [PATCH 1/2] Remove redundant Google Translate filter --- .../main/java/com/ichi2/anki/NoteEditor.java | 8 +-- .../java/com/ichi2/filters/FilterFacade.java | 49 ---------------- .../ichi2/filters/GoogleTranslaterFilter.java | 58 ------------------- .../src/main/res/values/10-preferences.xml | 2 - .../src/main/res/xml/preferences_advanced.xml | 5 -- 5 files changed, 2 insertions(+), 120 deletions(-) delete mode 100644 AnkiDroid/src/main/java/com/ichi2/filters/FilterFacade.java delete mode 100644 AnkiDroid/src/main/java/com/ichi2/filters/GoogleTranslaterFilter.java diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.java b/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.java index 714071fe17..f69d05e615 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.java +++ b/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.java @@ -66,7 +66,6 @@ import com.ichi2.anki.multimediacard.impl.MultimediaEditableNote; import com.ichi2.anki.receiver.SdCardReceiver; import com.ichi2.anki.servicelayer.NoteService; import com.ichi2.async.DeckTask; -import com.ichi2.filters.FilterFacade; import com.ichi2.libanki.Card; import com.ichi2.libanki.Collection; import com.ichi2.libanki.Note; @@ -574,12 +573,9 @@ public class NoteEditor extends AnkiActivity { } Pair messages = new Pair(first, second); - /* Filter garbage information */ - Pair cleanMessages = new FilterFacade(getBaseContext()).filter(messages); - mSourceText = new String[2]; - mSourceText[0] = cleanMessages.first; - mSourceText[1] = cleanMessages.second; + mSourceText[0] = messages.first; + mSourceText[1] = messages.second; } } diff --git a/AnkiDroid/src/main/java/com/ichi2/filters/FilterFacade.java b/AnkiDroid/src/main/java/com/ichi2/filters/FilterFacade.java deleted file mode 100644 index ced5b8f09d..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/filters/FilterFacade.java +++ /dev/null @@ -1,49 +0,0 @@ - -package com.ichi2.filters; - -import android.content.Context; -import android.util.Pair; - -import com.ichi2.anki.AnkiDroidApp; - -import java.util.ArrayList; -import java.util.List; - -/** - * Filter-facade execute all filtering operations. - * - * @author evgenij.kozhevnikov@gmail.com - */ -public class FilterFacade { - - /* Context for checking preferences */ - private Context context; - - /* All filters, that are will running */ - private final List filters = new ArrayList() { - { - add(new GoogleTranslaterFilter()); - } - }; - - - public FilterFacade(Context context) { - this.context = context; - } - - - /** - * Run all filters processes. Messages in params will be updated. - * - * @param messages data, received from external application, where first attribute is the SUBJECT information and - * second attribute is the TEXT information. - */ - public Pair filter(Pair messages) { - Pair result = new Pair(messages.first, messages.second); - for (CardFilter cardFilter : filters) { - result = cardFilter.filter(result, AnkiDroidApp.getSharedPrefs(context)); - } - return result; - } - -} diff --git a/AnkiDroid/src/main/java/com/ichi2/filters/GoogleTranslaterFilter.java b/AnkiDroid/src/main/java/com/ichi2/filters/GoogleTranslaterFilter.java deleted file mode 100644 index 7fffc6bc39..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/filters/GoogleTranslaterFilter.java +++ /dev/null @@ -1,58 +0,0 @@ - -package com.ichi2.filters; - -import android.content.SharedPreferences; -import android.util.Pair; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Remove unnecessary information from Google Translate. - * - * @author evgenij.kozhevnikov@gmail.com - */ -public class GoogleTranslaterFilter extends AbstractCardFilter { - - public static final String CHECK_PATTERN = "Google"; - - private static final String SEARCH_PATTERN = "(?:\\):\\s*)(.*)(?:\\s|\\b)"; - - - public Pair filter(Pair messages, SharedPreferences preferences) { - Pair result = new Pair(messages.first, messages.second); - Pattern pattern = Pattern.compile(SEARCH_PATTERN); - Matcher matcher = pattern.matcher(getSearchText(messages)); - if (isCanBeExecuted(messages, preferences) && matcher.find()) { - String translate = matcher.group(1); - if (matcher.find()) { - result = new Pair(matcher.group(1), translate); - } - } - return result; - } - - - /** - * Check conditions to running current filter. - * - * @param messages original messages. - * @param preferences program settings. - * @return true, if filter could be run, otherwise false. - */ - private boolean isCanBeExecuted(Pair messages, SharedPreferences preferences) { - return useFilter(preferences) && messages.first.contains(CHECK_PATTERN); - } - - - /** - * Forming full text message for search. - * - * @param messages original messages. - * @return full text message for search. - */ - private String getSearchText(Pair messages) { - return new StringBuilder(messages.first).append(messages.second).append(' ').toString(); - } - -} diff --git a/AnkiDroid/src/main/res/values/10-preferences.xml b/AnkiDroid/src/main/res/values/10-preferences.xml index 070560782c..4baed3a51c 100644 --- a/AnkiDroid/src/main/res/values/10-preferences.xml +++ b/AnkiDroid/src/main/res/values/10-preferences.xml @@ -136,8 +136,6 @@ Keep screen on Disable screen timeout Chess notation support - From Google Translate - Just save source word and translation Draw chessboard from Forsyth–Edwards Notation. The notation must be enclosed in [fen][/fen] tags. Enable AnkiDroid API Let other apps connect to AnkiDroid and read / write data without your intervention diff --git a/AnkiDroid/src/main/res/xml/preferences_advanced.xml b/AnkiDroid/src/main/res/xml/preferences_advanced.xml index 6d23ea2051..9111959721 100644 --- a/AnkiDroid/src/main/res/xml/preferences_advanced.xml +++ b/AnkiDroid/src/main/res/xml/preferences_advanced.xml @@ -108,11 +108,6 @@ android:positiveButtonText="@string/dialog_ok" android:summary="@string/reset_languages_summ" android:title="@string/reset_languages" /> - Date: Thu, 3 Dec 2015 18:00:39 +0900 Subject: [PATCH 2/2] Remove Google image search --- AnkiDroid/src/main/AndroidManifest.xml | 5 - .../activity/SearchImageActivity.java | 536 ------------------ .../fields/BasicTextFieldController.java | 43 -- .../googleimagesearch/json/Cursor.java | 96 ---- .../json/ImageSearchResponse.java | 67 --- .../googleimagesearch/json/Page.java | 50 -- .../googleimagesearch/json/ResponseData.java | 52 -- .../googleimagesearch/json/Result.java | 193 ------- 8 files changed, 1042 deletions(-) delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/activity/SearchImageActivity.java delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Cursor.java delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ImageSearchResponse.java delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Page.java delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ResponseData.java delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Result.java diff --git a/AnkiDroid/src/main/AndroidManifest.xml b/AnkiDroid/src/main/AndroidManifest.xml index 9e747cd836..f9b794042a 100644 --- a/AnkiDroid/src/main/AndroidManifest.xml +++ b/AnkiDroid/src/main/AndroidManifest.xml @@ -301,11 +301,6 @@ android:configChanges="keyboardHidden|orientation|locale|screenSize" android:label="@string/title_activity_load_pronounciation" > - - * - * Copyright (c) 2013 Zaur Molotnikov * - * Copyright (c) 2013 Nicolas Raoul * - * Copyright (c) 2013 Flavio Lerda * - * * - * This program 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki.multimediacard.activity; - -import android.app.Activity; -import android.app.ProgressDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.graphics.Bitmap; -import android.os.AsyncTask; -import android.os.Bundle; -import android.util.DisplayMetrics; -import android.view.Menu; -import android.view.View; -import android.view.View.OnClickListener; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.Button; -import android.widget.Toast; - -import com.google.gson.Gson; -import com.ichi2.anki.R; -import com.ichi2.anki.multimediacard.googleimagesearch.json.ImageSearchResponse; -import com.ichi2.anki.multimediacard.googleimagesearch.json.ResponseData; -import com.ichi2.anki.multimediacard.googleimagesearch.json.Result; -import com.ichi2.anki.web.HttpFetcher; -import com.ichi2.anki.web.UrlTools; -import com.ichi2.async.Connection; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.List; - -public class SearchImageActivity extends Activity implements DialogInterface.OnCancelListener { - private static final String BUNDLE_KEY_SHUT_OFF = "key.multimedia.shut.off"; - - public static final String EXTRA_SOURCE = "search.image.activity.extra.source"; - // Passed out as a result - public static String EXTRA_IMAGE_FILE_PATH = "com.ichi2.anki.search.image.activity.extra.image.file.path"; - - private String mSource; - private WebView mWebView = null; - private Button mPrevButton; - private Button mNextButton; - private ProgressDialog progressDialog; - private ArrayList mImages; - private int mCurrentImage; - private String mTemplate = null; - private Button mPickButton; - private DownloadFileTask mDownloadMp3Task; - - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - - outState.putBoolean(BUNDLE_KEY_SHUT_OFF, true); - - } - - - @Override - protected void onDestroy() { - super.onDestroy(); - - if (mWebView != null) { - // Saving memory - mWebView.clearCache(true); - } - } - - - private void finishCancel() { - Intent resultData = new Intent(); - setResult(RESULT_CANCELED, resultData); - finish(); - } - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - if (savedInstanceState != null) { - boolean b = savedInstanceState.getBoolean(BUNDLE_KEY_SHUT_OFF, false); - if (b) { - finishCancel(); - return; - } - } - - setContentView(R.layout.activity_search_image); - - try { - mSource = getIntent().getExtras().getString(EXTRA_SOURCE); - } catch (Exception e) { - mSource = ""; - } - - // If translation fails this is a default - source will be returned. - - mWebView = (WebView) findViewById(R.id.ImageSearchWebView); - mWebView.setWebViewClient(new WebViewClient() { - @Override - public void onPageFinished(WebView view, String url) { - super.onPageFinished(view, url); - processPageLoadFinished(); - } - - - @Override - public void onPageStarted(WebView view, String url, Bitmap favicon) { - super.onPageStarted(view, url, favicon); - processPageLoadStarted(); - } - - }); - - mPickButton = (Button) findViewById(R.id.ImageSearchPick); - mPickButton.setEnabled(false); - mPickButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - pickImage(); - } - }); - - mNextButton = (Button) findViewById(R.id.ImageSearchNext); - - mNextButton.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - nextClicked(); - } - }); - - mPrevButton = (Button) findViewById(R.id.ImageSearchPrev); - - mPrevButton.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - prevClicked(); - } - }); - - mPrevButton.setEnabled(false); - - } - - /** - * @author zaur This is to load finally the MP3 file with pronunciation. - */ - private class DownloadFileTask extends AsyncTask { - - private String mAddress; - private Context mActivity; - - - @Override - protected String doInBackground(Void... params) { - return HttpFetcher.downloadFileToSdCard(mAddress, mActivity, "imgsearch"); - } - - - public void setAddress(String address) { - mAddress = address; - } - - - @Override - protected void onPostExecute(String result) { - receiveImageFile(result); - } - - - public void setActivity(Context mActivity) { - this.mActivity = mActivity; - } - - } - - - protected void pickImage() { - if(!Connection.isOnline()) { - returnFailure(gtxt(R.string.network_no_connection)); - return; - } - - String imageUrl = mImages.get(mCurrentImage); - - // And here it is possible to download it... so on, - // then return file path. - - // Download MP3 file - try { - progressDialog = ProgressDialog.show(this, gtxt(R.string.multimedia_editor_progress_wait_title), - gtxt(R.string.multimedia_editor_imgs_saving_image), true, false); - mDownloadMp3Task = new DownloadFileTask(); - mDownloadMp3Task.setActivity(this); - mDownloadMp3Task.setAddress(imageUrl); - mDownloadMp3Task.execute(); - } catch (Exception e) { - progressDialog.dismiss(); - returnFailure(gtxt(R.string.multimedia_editor_something_wrong)); - } - } - - - public void receiveImageFile(String result) { - dismissCarefullyProgressDialog(); - - Intent resultData = new Intent(); - - resultData.putExtra(EXTRA_IMAGE_FILE_PATH, result); - - setResult(RESULT_OK, resultData); - - finish(); - - } - - - protected void processPageLoadStarted() { - mPickButton.setEnabled(false); - progressDialog = ProgressDialog.show(this, getText(R.string.multimedia_editor_progress_wait_title), - gtxt(R.string.multimedia_editor_imgs_loading_image), true, false); - - progressDialog.setCancelable(true); - } - - - protected void processPageLoadFinished() { - dismissCarefullyProgressDialog(); - mPickButton.setEnabled(true); - } - - - public String getLocalIpAddress() { - try { - for (Enumeration en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { - NetworkInterface intf = en.nextElement(); - for (Enumeration enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { - InetAddress inetAddress = enumIpAddr.nextElement(); - if (!inetAddress.isLoopbackAddress()) { - return inetAddress.getHostAddress(); - } - } - } - } catch (Exception ex) { - return ""; - } - return ""; - } - - private class BackgroundPost extends AsyncTask { - - private String mQuery; - - - @Override - protected ImageSearchResponse doInBackground(Void... params) { - try { - String ip = getLocalIpAddress(); - - URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?" - + "v=1.0&q=Q&userip=IP".replaceAll("Q", getQuery()).replaceAll("IP", UrlTools.encodeUrl(ip))); - URLConnection connection = url.openConnection(); - connection.addRequestProperty("Referer", "anki.ichi2.com"); - connection.setConnectTimeout(10000); - connection.setReadTimeout(60000); - - String line; - StringBuilder builder = new StringBuilder(); - BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); - while ((line = reader.readLine()) != null) { - builder.append(line); - } - - Gson gson = new Gson(); - ImageSearchResponse resp = gson.fromJson(builder.toString(), ImageSearchResponse.class); - - resp.setOk(true); - return resp; - - } catch (Exception e) { - return new ImageSearchResponse(); - } - } - - - @Override - protected void onPostExecute(ImageSearchResponse result) { - postFinished(result); - } - - - /** - * @param query Used to set the download address - */ - public void setQuery(String query) { - mQuery = query; - } - - - /** - * @return Used to know, which of the posts finished, to differentiate. - */ - public String getQuery() { - return UrlTools.encodeUrl(mQuery); - } - - } - - - @Override - protected void onResume() { - super.onResume(); - - progressDialog = ProgressDialog.show(this, getText(R.string.multimedia_editor_progress_wait_title), - getText(R.string.multimedia_editor_imgs_searching_for_images), true, false); - - progressDialog.setCancelable(true); - progressDialog.setOnCancelListener(this); - - if(!Connection.isOnline()) { - returnFailure(gtxt(R.string.network_no_connection)); - return; - } - - BackgroundPost p = new BackgroundPost(); - p.setQuery(mSource); - p.execute(); - } - - - public void postFinished(ImageSearchResponse response) { - - ArrayList theImages = new ArrayList(); - - // No loop, just a good construct to break out from - do { - if (response == null) { - break; - } - - if (!response.getOk()) { - break; - } - - ResponseData rdata = response.getResponseData(); - - if (rdata == null) { - break; - } - - List results = rdata.getResults(); - - if (results == null) { - break; - } - - for (Result result : results) { - if (result == null) { - continue; - } - - String url = result.getUrl(); - - if (url != null) { - theImages.add(url); - } - } - - if (theImages.size() == 0) { - break; - } - - proceedWithImages(theImages); - - return; - - } while (false); - - returnFailure(gtxt(R.string.multimedia_editor_imgs_no_results)); - } - - - private void proceedWithImages(ArrayList theImages) { - showToast(gtxt(R.string.multimedia_editor_imgs_images_found)); - dismissCarefullyProgressDialog(); - - mImages = theImages; - mCurrentImage = 0; - - showCurrentImage(); - - } - - - private void showCurrentImage() { - if (mCurrentImage <= 0) { - mCurrentImage = 0; - mPrevButton.setEnabled(false); - mNextButton.setEnabled(mImages.size() > 0); - } - - if (mCurrentImage > 0) { - mCurrentImage = Math.min(mImages.size() - 1, mCurrentImage); - mPrevButton.setEnabled(true); - mNextButton.setEnabled(mCurrentImage < mImages.size() - 1); - } - - String source = makeImageCodeTemplate(); - - source = source.replaceAll("URL", mImages.get(mCurrentImage)); - - mWebView.loadData(source, "text/html", null); - - } - - - private void returnFailure(String explanation) { - showToast(explanation); - setResult(RESULT_CANCELED); - dismissCarefullyProgressDialog(); - finish(); - } - - - private void dismissCarefullyProgressDialog() { - try { - if (progressDialog != null) { - if (progressDialog.isShowing()) { - progressDialog.dismiss(); - } - } - } catch (Exception e) { - // nothing is done intentionally - } - } - - - private void showToast(CharSequence text) { - int duration = Toast.LENGTH_SHORT; - Toast toast = Toast.makeText(this, text, duration); - toast.show(); - } - - - protected void prevClicked() { - --mCurrentImage; - showCurrentImage(); - - } - - - protected void nextClicked() { - ++mCurrentImage; - showCurrentImage(); - } - - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.activity_search_image, menu); - return true; - } - - - private String makeImageCodeTemplate() { - if (mTemplate != null) { - return mTemplate; - } - - String source = "
" + gtxt(R.string.multimedia_editor_imgs_pow_by_google) - + "

"; - - int currentapiVersion = android.os.Build.VERSION.SDK_INT; - if (currentapiVersion <= android.os.Build.VERSION_CODES.HONEYCOMB_MR2) { - DisplayMetrics metrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(metrics); - - int height = metrics.heightPixels; - int width = metrics.widthPixels; - - int min = Math.min(height, width); - - source = source.replaceAll("WIDTH", (int) Math.round(min * 0.85) + ""); - } else { - source = source.replaceAll("WIDTH", "80%"); - } - - mTemplate = source; - - return source; - } - - - @Override - public void onCancel(DialogInterface dialog) { - // nothing - } - - - private String gtxt(int id) { - return getText(id).toString(); - } - -} diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicTextFieldController.java b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicTextFieldController.java index c65b21b2d6..d13bea6489 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicTextFieldController.java +++ b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicTextFieldController.java @@ -37,7 +37,6 @@ import android.widget.Toast; import com.ichi2.anki.R; import com.ichi2.anki.multimediacard.activity.LoadPronounciationActivity; import com.ichi2.anki.multimediacard.activity.PickStringDialogFragment; -import com.ichi2.anki.multimediacard.activity.SearchImageActivity; import com.ichi2.anki.multimediacard.activity.TranslationActivity; import com.ichi2.compat.CompatHelper; @@ -92,8 +91,6 @@ public class BasicTextFieldController extends FieldControllerBase implements IFi layout.addView(layoutTools2); createTranslateButton(layoutTools2, p); createPronounceButton(layoutTools2, p); - createSearchImageButton(layoutTools2, p); - } @@ -102,35 +99,6 @@ public class BasicTextFieldController extends FieldControllerBase implements IFi } - /** - * Google Image Search - * - * @param layoutTools - * @param p - */ - private void createSearchImageButton(LinearLayout layoutTools, LayoutParams p) { - Button clearButton = new Button(mActivity); - clearButton.setText(gtxt(R.string.multimedia_editor_text_field_editing_show)); - layoutTools.addView(clearButton, p); - - clearButton.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - String source = mEditText.getText().toString(); - - if (source.length() == 0) { - showToast(gtxt(R.string.multimedia_editor_text_field_editing_no_text)); - return; - } - - Intent intent = new Intent(mActivity, SearchImageActivity.class); - intent.putExtra(SearchImageActivity.EXTRA_SOURCE, source); - mActivity.startActivityForResult(intent, REQUEST_CODE_IMAGE_SEARCH); - } - }); - } - private void createClearButton(LinearLayout layoutTools, LayoutParams p) { Button clearButton = new Button(mActivity); @@ -346,17 +314,6 @@ public class BasicTextFieldController extends FieldControllerBase implements IFi mEditText.setText(text); - } else if (requestCode == REQUEST_CODE_IMAGE_SEARCH && resultCode == Activity.RESULT_OK) { - String imgPath = data.getExtras().get(SearchImageActivity.EXTRA_IMAGE_FILE_PATH).toString(); - File f = new File(imgPath); - if (!f.exists()) { - showToast(gtxt(R.string.multimedia_editor_imgs_failed)); - } - - ImageField imgField = new ImageField(); - imgField.setImagePath(imgPath); - imgField.setHasTemporaryMedia(true); - mActivity.handleFieldChanged(imgField); } } diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Cursor.java b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Cursor.java deleted file mode 100644 index 18fe805bd0..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Cursor.java +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2013 Bibek Shrestha * - * Copyright (c) 2013 Zaur Molotnikov * - * Copyright (c) 2013 Nicolas Raoul * - * Copyright (c) 2013 Flavio Lerda * - * * - * This program 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki.multimediacard.googleimagesearch.json; - -import java.util.List; - -/** - * One of the JSON classes. generated, corrected by Zaur. - *

- * Google Image search response. - */ -public class Cursor { - private Number currentPageIndex; - private String estimatedResultCount; - private String moreResultsUrl; - private List pages; - private String resultCount; - private String searchResultTime; - - - public Number getCurrentPageIndex() { - return this.currentPageIndex; - } - - - public void setCurrentPageIndex(Number currentPageIndex) { - this.currentPageIndex = currentPageIndex; - } - - - public String getEstimatedResultCount() { - return this.estimatedResultCount; - } - - - public void setEstimatedResultCount(String estimatedResultCount) { - this.estimatedResultCount = estimatedResultCount; - } - - - public String getMoreResultsUrl() { - return this.moreResultsUrl; - } - - - public void setMoreResultsUrl(String moreResultsUrl) { - this.moreResultsUrl = moreResultsUrl; - } - - - public List getPages() { - return this.pages; - } - - - public void setPages(List pages) { - this.pages = pages; - } - - - public String getResultCount() { - return this.resultCount; - } - - - public void setResultCount(String resultCount) { - this.resultCount = resultCount; - } - - - public String getSearchResultTime() { - return this.searchResultTime; - } - - - public void setSearchResultTime(String searchResultTime) { - this.searchResultTime = searchResultTime; - } -} diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ImageSearchResponse.java b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ImageSearchResponse.java deleted file mode 100644 index 31c0e19795..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ImageSearchResponse.java +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2013 Bibek Shrestha * - * Copyright (c) 2013 Zaur Molotnikov * - * Copyright (c) 2013 Nicolas Raoul * - * Copyright (c) 2013 Flavio Lerda * - * * - * This program 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki.multimediacard.googleimagesearch.json; - -public class ImageSearchResponse { - private ResponseData responseData; - private String responseDetails; - private Number responseStatus; - private boolean Ok = false; - - - public void setOk(boolean ok) { - Ok = ok; - } - - - public boolean getOk() { - return Ok; - } - - - public ResponseData getResponseData() { - return this.responseData; - } - - - public void setResponseData(ResponseData responseData) { - this.responseData = responseData; - } - - - public String getResponseDetails() { - return this.responseDetails; - } - - - public void setResponseDetails(String responseDetails) { - this.responseDetails = responseDetails; - } - - - public Number getResponseStatus() { - return this.responseStatus; - } - - - public void setResponseStatus(Number responseStatus) { - this.responseStatus = responseStatus; - } -} diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Page.java b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Page.java deleted file mode 100644 index 78a8f6920c..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Page.java +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2013 Bibek Shrestha * - * Copyright (c) 2013 Zaur Molotnikov * - * Copyright (c) 2013 Nicolas Raoul * - * Copyright (c) 2013 Flavio Lerda * - * * - * This program 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki.multimediacard.googleimagesearch.json; - -/** - * One of the JSON classes. generated, corrected by Zaur. - *

- * Google Image search response. - */ -public class Page { - private Number label; - private String start; - - - public Number getLabel() { - return this.label; - } - - - public void setLabel(Number label) { - this.label = label; - } - - - public String getStart() { - return this.start; - } - - - public void setStart(String start) { - this.start = start; - } -} diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ResponseData.java b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ResponseData.java deleted file mode 100644 index 943eaa8bd1..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/ResponseData.java +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2013 Bibek Shrestha * - * Copyright (c) 2013 Zaur Molotnikov * - * Copyright (c) 2013 Nicolas Raoul * - * Copyright (c) 2013 Flavio Lerda * - * * - * This program 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki.multimediacard.googleimagesearch.json; - -import java.util.List; - -/** - * One of the JSON classes. generated, corrected by Zaur. - *

- * Google Image search response. - */ -public class ResponseData { - private Cursor cursor; - private List results; - - - public Cursor getCursor() { - return this.cursor; - } - - - public void setCursor(Cursor cursor) { - this.cursor = cursor; - } - - - public List getResults() { - return this.results; - } - - - public void setResults(List results) { - this.results = results; - } -} diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Result.java b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Result.java deleted file mode 100644 index 6cbd16f50b..0000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/googleimagesearch/json/Result.java +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2013 Bibek Shrestha * - * Copyright (c) 2013 Zaur Molotnikov * - * Copyright (c) 2013 Nicolas Raoul * - * Copyright (c) 2013 Flavio Lerda * - * * - * This program 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki.multimediacard.googleimagesearch.json; - -/** - * One of the JSON classes. generated, corrected by Zaur. - *

- * Google Image search response. - */ -public class Result { - private String gsearchResultClass; - private String content; - private String contentNoFormatting; - private String height; - private String imageId; - private String originalContextUrl; - private String tbHeight; - private String tbUrl; - private String tbWidth; - private String title; - private String titleNoFormatting; - private String unescapedUrl; - private String url; - private String visibleUrl; - private String width; - - - public String getGsearchResultClass() { - return this.gsearchResultClass; - } - - - public void setGsearchResultClass(String gsearchResultClass) { - this.gsearchResultClass = gsearchResultClass; - } - - - public String getContent() { - return this.content; - } - - - public void setContent(String content) { - this.content = content; - } - - - public String getContentNoFormatting() { - return this.contentNoFormatting; - } - - - public void setContentNoFormatting(String contentNoFormatting) { - this.contentNoFormatting = contentNoFormatting; - } - - - public String getHeight() { - return this.height; - } - - - public void setHeight(String height) { - this.height = height; - } - - - public String getImageId() { - return this.imageId; - } - - - public void setImageId(String imageId) { - this.imageId = imageId; - } - - - public String getOriginalContextUrl() { - return this.originalContextUrl; - } - - - public void setOriginalContextUrl(String originalContextUrl) { - this.originalContextUrl = originalContextUrl; - } - - - public String getTbHeight() { - return this.tbHeight; - } - - - public void setTbHeight(String tbHeight) { - this.tbHeight = tbHeight; - } - - - public String getTbUrl() { - return this.tbUrl; - } - - - public void setTbUrl(String tbUrl) { - this.tbUrl = tbUrl; - } - - - public String getTbWidth() { - return this.tbWidth; - } - - - public void setTbWidth(String tbWidth) { - this.tbWidth = tbWidth; - } - - - public String getTitle() { - return this.title; - } - - - public void setTitle(String title) { - this.title = title; - } - - - public String getTitleNoFormatting() { - return this.titleNoFormatting; - } - - - public void setTitleNoFormatting(String titleNoFormatting) { - this.titleNoFormatting = titleNoFormatting; - } - - - public String getUnescapedUrl() { - return this.unescapedUrl; - } - - - public void setUnescapedUrl(String unescapedUrl) { - this.unescapedUrl = unescapedUrl; - } - - - public String getUrl() { - return this.url; - } - - - public void setUrl(String url) { - this.url = url; - } - - - public String getVisibleUrl() { - return this.visibleUrl; - } - - - public void setVisibleUrl(String visibleUrl) { - this.visibleUrl = visibleUrl; - } - - - public String getWidth() { - return this.width; - } - - - public void setWidth(String width) { - this.width = width; - } -}