com.google.zxing.client.android.history.HistoryManager Java Examples

The following examples show how to use com.google.zxing.client.android.history.HistoryManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SupplementalInfoRetriever.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #2
Source File: SupplementalInfoRetriever.java    From ZXing-Standalone-library with Apache License 2.0 6 votes vote down vote up
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #3
Source File: SupplementalInfoRetriever.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #4
Source File: CaptureActivity.java    From reacteu-app with MIT License 6 votes vote down vote up
@Override
 public void onCreate(Bundle icicle) {
   super.onCreate(icicle);

fakeR = new FakeR(this);

   Window window = getWindow();
   window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   setContentView(fakeR.getId("layout", "capture"));

   hasSurface = false;
   historyManager = new HistoryManager(this);
   historyManager.trimHistory();
   inactivityTimer = new InactivityTimer(this);
   beepManager = new BeepManager(this);

   PreferenceManager.setDefaultValues(this, fakeR.getId("xml", "preferences"), false);

   //showHelpOnFirstLaunch();
 }
 
Example #5
Source File: SupplementalInfoRetriever.java    From zxingfragmentlib with Apache License 2.0 6 votes vote down vote up
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #6
Source File: SupplementalInfoRetriever.java    From reacteu-app with MIT License 6 votes vote down vote up
@Override
protected void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (Spannable content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #7
Source File: CaptureActivity.java    From android-apps with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
  super.onCreate(icicle);

  Window window = getWindow();
  window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  setContentView(R.layout.capture);

  hasSurface = false;
  historyManager = new HistoryManager(this);
  historyManager.trimHistory();
  inactivityTimer = new InactivityTimer(this);
  beepManager = new BeepManager(this);

  PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

  //showHelpOnFirstLaunch();
}
 
Example #8
Source File: SupplementalInfoRetriever.java    From android-apps with MIT License 6 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        Handler handler,
                                        HistoryManager historyManager,
                                        Context context) {

  Collection<SupplementalInfoRetriever> retrievers = new ArrayList<SupplementalInfoRetriever>(1);

  if (result instanceof URIParsedResult) {
    retrievers.add(new URIResultInfoRetriever(textView, (URIParsedResult) result, handler, historyManager, context));
  } else if (result instanceof ProductParsedResult) {
    String productID = ((ProductParsedResult) result).getProductID();
    retrievers.add(new ProductResultInfoRetriever(textView, productID, handler, historyManager, context));
  } else if (result instanceof ISBNParsedResult) {
    String isbn = ((ISBNParsedResult) result).getISBN();
    retrievers.add(new ProductResultInfoRetriever(textView, isbn, handler, historyManager, context));
    retrievers.add(new BookResultInfoRetriever(textView, isbn, handler, historyManager, context));
  }

  for (SupplementalInfoRetriever retriever : retrievers) {
    ExecutorService executor = getExecutorService();
    Future<?> future = executor.submit(retriever);
    // Make sure it's interrupted after a short time though
    executor.submit(new KillerCallable(future, 10, TimeUnit.SECONDS));
  }
}
 
Example #9
Source File: SupplementalInfoRetriever.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #10
Source File: SupplementalInfoRetriever.java    From weex with Apache License 2.0 6 votes vote down vote up
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
Example #11
Source File: SupplementalInfoRetriever.java    From reacteu-app with MIT License 6 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  AsyncTaskExecInterface taskExec = new AsyncTaskExecManager().build();
  if (result instanceof URIParsedResult) {
    taskExec.execute(new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context));
    taskExec.execute(new TitleRetriever(textView, (URIParsedResult) result, historyManager));
  } else if (result instanceof ProductParsedResult) {
    String productID = ((ProductParsedResult) result).getProductID();
    taskExec.execute(new ProductResultInfoRetriever(textView, productID, historyManager, context));
  } else if (result instanceof ISBNParsedResult) {
    String isbn = ((ISBNParsedResult) result).getISBN();
    taskExec.execute(new ProductResultInfoRetriever(textView, isbn, historyManager, context));
    taskExec.execute(new BookResultInfoRetriever(textView, isbn, historyManager, context));
  }
}
 
Example #12
Source File: URIResultInfoRetriever.java    From android-apps with MIT License 5 votes vote down vote up
URIResultInfoRetriever(TextView textView,
                       URIParsedResult result,
                       Handler handler,
                       HistoryManager historyManager,
                       Context context) {
  super(textView, handler, historyManager);
  redirectString = context.getString(R.string.msg_redirect);
  this.result = result;
}
 
Example #13
Source File: SupplementalInfoRetriever.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  try {
    if (result instanceof URIParsedResult) {
      SupplementalInfoRetriever uriRetriever =
          new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context);
      uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever titleRetriever =
          new TitleRetriever(textView, (URIParsedResult) result, historyManager);
      titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ProductParsedResult) {
      ProductParsedResult productParsedResult = (ProductParsedResult) result;
      String productID = productParsedResult.getProductID();
      SupplementalInfoRetriever productRetriever =
          new ProductResultInfoRetriever(textView, productID, historyManager, context);
      productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ISBNParsedResult) {
      String isbn = ((ISBNParsedResult) result).getISBN();
      SupplementalInfoRetriever productInfoRetriever =
          new ProductResultInfoRetriever(textView, isbn, historyManager, context);
      productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever bookInfoRetriever =
          new BookResultInfoRetriever(textView, isbn, historyManager, context);
      bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  } catch (RejectedExecutionException ree) {
    // do nothing
  }
}
 
Example #14
Source File: SupplementalInfoRetriever.java    From weex with Apache License 2.0 5 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  try {
    if (result instanceof URIParsedResult) {
      SupplementalInfoRetriever uriRetriever =
          new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context);
      uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever titleRetriever =
          new TitleRetriever(textView, (URIParsedResult) result, historyManager);
      titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ProductParsedResult) {
      ProductParsedResult productParsedResult = (ProductParsedResult) result;
      String productID = productParsedResult.getProductID();
      SupplementalInfoRetriever productRetriever =
          new ProductResultInfoRetriever(textView, productID, historyManager, context);
      productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ISBNParsedResult) {
      String isbn = ((ISBNParsedResult) result).getISBN();
      SupplementalInfoRetriever productInfoRetriever =
          new ProductResultInfoRetriever(textView, isbn, historyManager, context);
      productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever bookInfoRetriever =
          new BookResultInfoRetriever(textView, isbn, historyManager, context);
      bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  } catch (RejectedExecutionException ree) {
    // do nothing
  }
}
 
Example #15
Source File: ProductResultInfoRetriever.java    From android-apps with MIT License 5 votes vote down vote up
ProductResultInfoRetriever(TextView textView,
                           String productID,
                           Handler handler,
                           HistoryManager historyManager,
                           Context context) {
  super(textView, handler, historyManager);
  this.productID = productID;
  this.source = context.getString(R.string.msg_google_product);
  this.context = context;
}
 
Example #16
Source File: BookResultInfoRetriever.java    From android-apps with MIT License 5 votes vote down vote up
BookResultInfoRetriever(TextView textView,
                        String isbn,
                        Handler handler,
                        HistoryManager historyManager,
                        Context context) {
  super(textView, handler, historyManager);
  this.isbn = isbn;
  this.source = context.getString(R.string.msg_google_books);
  this.context = context;
}
 
Example #17
Source File: SupplementalInfoRetriever.java    From zxingfragmentlib with Apache License 2.0 5 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  if (result instanceof URIParsedResult) {
    SupplementalInfoRetriever uriRetriever = 
        new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context);
    uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    SupplementalInfoRetriever titleRetriever = 
        new TitleRetriever(textView, (URIParsedResult) result, historyManager);
    titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  } else if (result instanceof ProductParsedResult) {
    ProductParsedResult productParsedResult = (ProductParsedResult) result;
    String productID = productParsedResult.getProductID();
    SupplementalInfoRetriever productRetriever =
        new ProductResultInfoRetriever(textView, productID, historyManager, context);
    productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  } else if (result instanceof ISBNParsedResult) {
    String isbn = ((ISBNParsedResult) result).getISBN();
    SupplementalInfoRetriever productInfoRetriever = 
        new ProductResultInfoRetriever(textView, isbn, historyManager, context);
    productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    SupplementalInfoRetriever bookInfoRetriever = 
        new BookResultInfoRetriever(textView, isbn, historyManager, context);
    bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
}
 
Example #18
Source File: SupplementalInfoRetriever.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  try {
    if (result instanceof URIParsedResult) {
      SupplementalInfoRetriever uriRetriever =
          new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context);
      uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever titleRetriever =
          new TitleRetriever(textView, (URIParsedResult) result, historyManager);
      titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ProductParsedResult) {
      ProductParsedResult productParsedResult = (ProductParsedResult) result;
      String productID = productParsedResult.getProductID();
      SupplementalInfoRetriever productRetriever =
          new ProductResultInfoRetriever(textView, productID, historyManager, context);
      productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ISBNParsedResult) {
      String isbn = ((ISBNParsedResult) result).getISBN();
      SupplementalInfoRetriever productInfoRetriever =
          new ProductResultInfoRetriever(textView, isbn, historyManager, context);
      productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever bookInfoRetriever =
          new BookResultInfoRetriever(textView, isbn, historyManager, context);
      bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  } catch (RejectedExecutionException ree) {
    // do nothing
  }
}
 
Example #19
Source File: SupplementalInfoRetriever.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  try {
    if (result instanceof URIParsedResult) {
      SupplementalInfoRetriever uriRetriever =
          new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context);
      uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever titleRetriever =
          new TitleRetriever(textView, (URIParsedResult) result, historyManager);
      titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ProductParsedResult) {
      ProductParsedResult productParsedResult = (ProductParsedResult) result;
      String productID = productParsedResult.getProductID();
      SupplementalInfoRetriever productRetriever =
          new ProductResultInfoRetriever(textView, productID, historyManager, context);
      productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ISBNParsedResult) {
      String isbn = ((ISBNParsedResult) result).getISBN();
      SupplementalInfoRetriever productInfoRetriever =
          new ProductResultInfoRetriever(textView, isbn, historyManager, context);
      productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever bookInfoRetriever =
          new BookResultInfoRetriever(textView, isbn, historyManager, context);
      bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  } catch (RejectedExecutionException ree) {
    // do nothing
  }
}
 
Example #20
Source File: SupplementalInfoRetriever.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        HistoryManager historyManager,
                                        Context context) {
  try {
    if (result instanceof URIParsedResult) {
      SupplementalInfoRetriever uriRetriever =
          new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context);
      uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever titleRetriever =
          new TitleRetriever(textView, (URIParsedResult) result, historyManager);
      titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ProductParsedResult) {
      ProductParsedResult productParsedResult = (ProductParsedResult) result;
      String productID = productParsedResult.getProductID();
      SupplementalInfoRetriever productRetriever =
          new ProductResultInfoRetriever(textView, productID, historyManager, context);
      productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else if (result instanceof ISBNParsedResult) {
      String isbn = ((ISBNParsedResult) result).getISBN();
      SupplementalInfoRetriever productInfoRetriever =
          new ProductResultInfoRetriever(textView, isbn, historyManager, context);
      productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      SupplementalInfoRetriever bookInfoRetriever =
          new BookResultInfoRetriever(textView, isbn, historyManager, context);
      bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  } catch (RejectedExecutionException ree) {
    // do nothing
  }
}
 
Example #21
Source File: URIResultInfoRetriever.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
URIResultInfoRetriever(TextView textView, URIParsedResult result, HistoryManager historyManager, Context context) {
  super(textView, historyManager);
  redirectString = context.getString(R.string.msg_redirect);
  this.result = result;
}
 
Example #22
Source File: TitleRetriever.java    From reacteu-app with MIT License 4 votes vote down vote up
TitleRetriever(TextView textView, URIParsedResult result, HistoryManager historyManager) {
  super(textView, historyManager);
  this.httpUrl = result.getURI();
}
 
Example #23
Source File: SupplementalInfoRetriever.java    From reacteu-app with MIT License 4 votes vote down vote up
SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
  textViewRef = new WeakReference<TextView>(textView);
  historyManagerRef = new WeakReference<HistoryManager>(historyManager);
  newContents = new ArrayList<Spannable>();
  newHistories = new ArrayList<String[]>();
}
 
Example #24
Source File: URIResultInfoRetriever.java    From zxingfragmentlib with Apache License 2.0 4 votes vote down vote up
URIResultInfoRetriever(TextView textView, URIParsedResult result, HistoryManager historyManager, Context context) {
  super(textView, historyManager);
  redirectString = context.getString(R.string.msg_redirect);
  this.result = result;
}
 
Example #25
Source File: ProductResultInfoRetriever.java    From reacteu-app with MIT License 4 votes vote down vote up
ProductResultInfoRetriever(TextView textView, String productID, HistoryManager historyManager, Context context) {
  super(textView, historyManager);
  this.productID = productID;
  this.source = context.getString(FakeR.getId(context, "string", "msg_google_product"));
  this.context = context;
}
 
Example #26
Source File: BookResultInfoRetriever.java    From reacteu-app with MIT License 4 votes vote down vote up
BookResultInfoRetriever(TextView textView, String isbn, HistoryManager historyManager, Context context) {
  super(textView, historyManager);
  this.isbn = isbn;
  this.source = context.getString(FakeR.getId(context, "string", "msg_google_books"));
  this.context = context;
}
 
Example #27
Source File: URIResultInfoRetriever.java    From reacteu-app with MIT License 4 votes vote down vote up
URIResultInfoRetriever(TextView textView, URIParsedResult result, HistoryManager historyManager, Context context) {
  super(textView, historyManager);
  redirectString = context.getString(FakeR.getId(context, "string", "msg_redirect"));
  this.result = result;
}
 
Example #28
Source File: SupplementalInfoRetriever.java    From android-apps with MIT License 4 votes vote down vote up
SupplementalInfoRetriever(TextView textView, Handler handler, HistoryManager historyManager) {
  this.textViewRef = new WeakReference<TextView>(textView);
  this.handler = handler;
  this.historyManager = historyManager;
}
 
Example #29
Source File: TitleRetriever.java    From zxingfragmentlib with Apache License 2.0 4 votes vote down vote up
TitleRetriever(TextView textView, URIParsedResult result, HistoryManager historyManager) {
  super(textView, historyManager);
  this.httpUrl = result.getURI();
}
 
Example #30
Source File: SupplementalInfoRetriever.java    From zxingfragmentlib with Apache License 2.0 4 votes vote down vote up
SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
  textViewRef = new WeakReference<>(textView);
  historyManagerRef = new WeakReference<>(historyManager);
  newContents = new ArrayList<>();
  newHistories = new ArrayList<>();
}