_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q155800
Payout.retrieve
train
public static Payout retrieve(String payout) throws StripeException { return retrieve(payout, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155801
StripeHeaders.get
train
public String get(String name) { List<String> valuesList = values(name); String value = null; if (valuesList != null && valuesList.size() > 0) { value = valuesList.get(0); } return value; }
java
{ "resource": "" }
q155802
UsageRecord.createOnSubscriptionItem
train
public static UsageRecord createOnSubscriptionItem( String subscriptionItem, Map<String, Object> params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), String.format( "/v1/subscription_...
java
{ "resource": "" }
q155803
TransferReversal.update
train
@Override public TransferReversal update(Map<String, Object> params, RequestOptions options) throws StripeException { String url; if (this.getTransfer() != null) { url = String.format( "%s%s", Stripe.getApiBase(), String.format( ...
java
{ "resource": "" }
q155804
Coupon.retrieve
train
public static Coupon retrieve(String coupon, RequestOptions options) throws StripeException { return retrieve(coupon, (Map<String, Object>) null, options); }
java
{ "resource": "" }
q155805
Topup.create
train
public static Topup create(Map<String, Object> params) throws StripeException { return create(params, (RequestOptions) null); }
java
{ "resource": "" }
q155806
Topup.retrieve
train
public static Topup retrieve(String topup) throws StripeException { return retrieve(topup, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155807
CountrySpec.retrieve
train
public static CountrySpec retrieve(String country) throws StripeException { return retrieve(country, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155808
PaymentIntent.retrieve
train
public static PaymentIntent retrieve(String intent) throws StripeException { return retrieve(intent, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155809
PaymentIntent.confirm
train
public PaymentIntent confirm() throws StripeException { return confirm((Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155810
Invoice.upcoming
train
public static Invoice upcoming() throws StripeException { return upcoming((Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155811
Invoice.retrieve
train
public static Invoice retrieve(String invoice) throws StripeException { return retrieve(invoice, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155812
Invoice.markUncollectible
train
public Invoice markUncollectible() throws StripeException { return markUncollectible((Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155813
Charge.retrieve
train
public static Charge retrieve(String charge) throws StripeException { return retrieve(charge, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155814
ExchangeRate.retrieve
train
public static ExchangeRate retrieve(String currency) throws StripeException { return retrieve(currency, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155815
ThreeDSecure.retrieve
train
public static ThreeDSecure retrieve(String threeDSecure) throws StripeException { return retrieve(threeDSecure, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155816
PaymentMethod.retrieve
train
public static PaymentMethod retrieve(String paymentMethod, RequestOptions options) throws StripeException { return retrieve(paymentMethod, (Map<String, Object>) null, options); }
java
{ "resource": "" }
q155817
PaymentMethod.attach
train
public PaymentMethod attach(Map<String, Object> params) throws StripeException { return attach(params, (RequestOptions) null); }
java
{ "resource": "" }
q155818
PaymentMethod.detach
train
public PaymentMethod detach(RequestOptions options) throws StripeException { return detach((Map<String, Object>) null, options); }
java
{ "resource": "" }
q155819
Transfer.retrieve
train
public static Transfer retrieve(String transfer) throws StripeException { return retrieve(transfer, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155820
Subscription.retrieve
train
public static Subscription retrieve(String subscriptionExposedId) throws StripeException { return retrieve(subscriptionExposedId, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155821
Stripe.setAppInfo
train
public static void setAppInfo(String name, String version, String url, String partnerId) { if (appInfo == null) { appInfo = new HashMap<String, String>(); } appInfo.put("name", name); appInfo.put("version", version); appInfo.put("url", url); appInfo.put("partner_id", partnerId); }
java
{ "resource": "" }
q155822
TaxIdCollection.list
train
public TaxIdCollection list(TaxIdCollectionListParams params, RequestOptions options) throws StripeException { String url = String.format("%s%s", Stripe.getApiBase(), this.getUrl()); return ApiResource.requestCollection(url, params, TaxIdCollection.class, options); }
java
{ "resource": "" }
q155823
Token.retrieve
train
public static Token retrieve(String token) throws StripeException { return retrieve(token, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155824
CreditNote.retrieve
train
public static CreditNote retrieve(String id, RequestOptions options) throws StripeException { return retrieve(id, (Map<String, Object>) null, options); }
java
{ "resource": "" }
q155825
EphemeralKey.delete
train
public EphemeralKey delete(RequestOptions options) throws StripeException { return request(RequestMethod.DELETE, instanceUrl(EphemeralKey.class, this.id), (Map<String,Object>) null, EphemeralKey.class, options); }
java
{ "resource": "" }
q155826
ApiResource.urlEncodeId
train
public static String urlEncodeId(String id) throws InvalidRequestException { try { return urlEncode(id); } catch (UnsupportedEncodingException e) { throw new InvalidRequestException(String.format( "Unable to encode `%s` in the url to %s. " + "Please contact support@stripe.com for...
java
{ "resource": "" }
q155827
ApiResource.checkNullTypedParams
train
public static void checkNullTypedParams(String url, ApiRequestParams params) { if (params == null) { throw new IllegalArgumentException(String.format("Found null params for %s. " + "Please pass empty params using param builder via `builder().build()` instead.", url )); } }
java
{ "resource": "" }
q155828
ApiResource.setExpandableFieldId
train
public static <T extends HasId> ExpandableField<T> setExpandableFieldId(String newId, ExpandableField<T> currentObject) { if (currentObject == null || (currentObject.isExpanded() && !Objects.equals(currentObject.getId(), newId))) { return new ExpandableField<>(newId, null); } return new...
java
{ "resource": "" }
q155829
StripeCollection.autoPagingIterable
train
public Iterable<T> autoPagingIterable(Map<String, Object> params, RequestOptions options) { this.setRequestOptions(options); this.setRequestParams(params); return new PagingIterable<>(this); }
java
{ "resource": "" }
q155830
MultipartProcessor.addFileField
train
public void addFileField(String name, String fileName, InputStream inputStream) throws IOException { writer.append("--").append(boundary).append(LINE_BREAK); writer.append("Content-Disposition: form-data; name=\"").append(name) .append("\"; filename=\"").append(fileName).append("\"").append(LI...
java
{ "resource": "" }
q155831
MultipartProcessor.streamToOutput
train
private void streamToOutput(InputStream inputStream) throws IOException { try { byte[] buffer = new byte[4096]; int bytesRead = -1; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.flush(); } finally { inp...
java
{ "resource": "" }
q155832
MultipartProcessor.finish
train
public void finish() throws IOException { writer.append("--" + boundary + "--").append(LINE_BREAK); writer.flush(); writer.close(); outputStream.flush(); outputStream.close(); }
java
{ "resource": "" }
q155833
OAuth.authorizeUrl
train
public static String authorizeUrl(Map<String, Object> params, RequestOptions options) throws AuthenticationException, InvalidRequestException { final String base = Stripe.getConnectBase(); params.put("client_id", getClientId(params, options)); if (params.get("response_type") == null) { params.p...
java
{ "resource": "" }
q155834
OAuth.token
train
public static TokenResponse token(Map<String, Object> params, RequestOptions options) throws StripeException { String url = Stripe.getConnectBase() + "/oauth/token"; return OAuth.stripeResponseGetter.oauthRequest(ApiResource.RequestMethod.POST, url, params, TokenResponse.class, ApiResource.Request...
java
{ "resource": "" }
q155835
OAuth.deauthorize
train
public static DeauthorizedAccount deauthorize(Map<String, Object> params, RequestOptions options) throws StripeException { String url = Stripe.getConnectBase() + "/oauth/deauthorize"; params.put("client_id", getClientId(params, options)); return OAuth.stripeResponseGetter.oauthRequest(ApiResource.Requ...
java
{ "resource": "" }
q155836
OAuth.getClientId
train
private static String getClientId(Map<String, Object> params, RequestOptions options) throws AuthenticationException { String clientId = Stripe.clientId; if ((options != null) && (options.getClientId() != null)) { clientId = options.getClientId(); } if ((params != null) && (params.get("clien...
java
{ "resource": "" }
q155837
FileLink.retrieve
train
public static FileLink retrieve(String link) throws StripeException { return retrieve(link, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155838
InvoiceItem.retrieve
train
public static InvoiceItem retrieve(String invoiceitem) throws StripeException { return retrieve(invoiceitem, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155839
ApplePayDomain.retrieve
train
public static ApplePayDomain retrieve(String domain) throws StripeException { return retrieve(domain, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155840
Plan.retrieve
train
public static Plan retrieve(String plan) throws StripeException { return retrieve(plan, (Map<String, Object>) null, (RequestOptions) null); }
java
{ "resource": "" }
q155841
RemoteApplicationEventRegistrar.registerBeanDefinitions
train
@Override public void registerBeanDefinitions(final AnnotationMetadata importingClassMetadata, final BeanDefinitionRegistry registry) { Map<String, Object> componentScan = importingClassMetadata .getAnnotationAttributes(RemoteApplicationEventScan.class.getName(), false); Set<String> basePackages = n...
java
{ "resource": "" }
q155842
BusJacksonAutoConfiguration.busJsonConverter
train
@Bean @ConditionalOnMissingBean(name = "busJsonConverter") @StreamMessageConverter public AbstractMessageConverter busJsonConverter( @Autowired(required = false) ObjectMapper objectMapper) { return new BusJacksonMessageConverter(objectMapper); }
java
{ "resource": "" }
q155843
GraphPanelChart.computeChartSteps
train
private void computeChartSteps() { //if special type if (chartType == GraphPanelChart.CHART_PERCENTAGE) { minYVal = 0; maxYVal = 100; return; } //try to find the best range... //first, avoid special cases where maxY equal or close to minY ...
java
{ "resource": "" }
q155844
GraphPanelChart.paintAd
train
private void paintAd(Graphics2D g) { Font oldFont = g.getFont(); g.setFont(g.getFont().deriveFont(10F)); g.setColor(axisColor); Composite oldComposite = g.getComposite(); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f)); g.drawString(AD_TEXT, ...
java
{ "resource": "" }
q155845
GraphPanelChart.registerPopup
train
private void registerPopup(boolean allowCsvExport) { this.setComponentPopupMenu(popup); JMenuItem itemCopy = new JMenuItem("Copy Image to Clipboard"); itemCopy.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/copy.png"))); JMenuItem itemSave = new JMenuItem("S...
java
{ "resource": "" }
q155846
AbstractGraphPanelVisualizer.stateChanged
train
@Override public void stateChanged(ChangeEvent e) { log.debug("getting new collector"); collector = (CorrectedResultCollector) createTestElement(); if (collector instanceof CorrectedResultCollector) { setUpFiltering((CorrectedResultCollector) collector); } collect...
java
{ "resource": "" }
q155847
Parameter.setValue
train
@Override public String setValue(String value) { String result = this.value; this.value = value; calculateCompareKey(); return result; }
java
{ "resource": "" }
q155848
AbstractThreadStarter.cloneTree
train
protected ListedHashTree cloneTree(ListedHashTree tree) { TreeCloner cloner = new TreeCloner(true); tree.traverse(cloner); ListedHashTree clonedTree = cloner.getClonedTree(); if (!clonedTree.isEmpty()) { Object firstElement = clonedTree.getArray()[0]; Controller s...
java
{ "resource": "" }
q155849
MonitoringResultsCollector.syncContext
train
private void syncContext(boolean isInit) { // jmeter context synchronisation JMeterContext current = JMeterContextService.getContext(); JMeterContext ctx = this.getThreadContext(); if (isInit) { current.setCurrentSampler(ctx.getCurrentSampler()); current.setEngine(ctx.getEngine());...
java
{ "resource": "" }
q155850
GraphPanel.replaceRowTab
train
public void replaceRowTab(String tabLabel, Component object, String toolTipText) { int index = indexOfComponent(rowsTab); remove(index); ImageIcon rowsIcon = createImageIcon("/kg/apc/jmeter/img/checks.png"); insertTab(tabLabel, rowsIcon, object, toolTipText, index); }
java
{ "resource": "" }
q155851
AbstractDynamicThreadGroup.stop
train
@Override public void stop() { running = false; threadStarter.interrupt(); for (DynamicThread thread : threads) { thread.interrupt(); thread.interruptOSThread(); } }
java
{ "resource": "" }
q155852
ArrivalsThreadStarter.getCurrentRate
train
protected double getCurrentRate() { long rampUp = owner.getRampUpSeconds(); long hold = owner.getHoldSeconds(); long steps = owner.getStepsAsLong(); double throughput = owner.getTargetLevelFactored(); double timeOffset = rollingTime / 1000.0 - startTime; if (timeOffset >...
java
{ "resource": "" }
q155853
JMeterPluginsUtils.buildHelpPageUrl
train
public static String buildHelpPageUrl(String helpPage) { try { if (helpPage.matches("[hH][tT][tT][pP][sS]?://.*")) { log.debug("Help page URL found, skipping building link to "+WIKI_BASE); return helpPage; } } catch (PatternSyntaxException ex) { ...
java
{ "resource": "" }
q155854
JMeterPluginsUtils.addHelpLinkToPanel
train
public static Component addHelpLinkToPanel(Container panel, String helpPage) { if (!java.awt.Desktop.isDesktopSupported()) { return panel; } JLabel icon = new JLabel(); icon.setIcon(new javax.swing.ImageIcon(JMeterPluginsUtils.class.getResource("vizualizers/information.png"))...
java
{ "resource": "" }
q155855
JMeterPluginsUtils.initializeProperties
train
private static void initializeProperties() { JMeterUtils.loadJMeterProperties(JMeterUtils.getJMeterHome() + File.separator + "bin" + File.separator + "jmeter.properties"); //JMeterUtils.initLogging(); JMeterUtils.initLocale(); Properties ...
java
{ "resource": "" }
q155856
AbstractSimpleThreadGroup.scheduleThread
train
public void scheduleThread(JMeterThread thread) { if(System.currentTimeMillis()-tgStartTime > TOLERANCE) { tgStartTime = System.currentTimeMillis(); } scheduleThread(thread, tgStartTime); }
java
{ "resource": "" }
q155857
ConcurrencyThreadStarter.checkNeedsPropertiesReloading
train
void checkNeedsPropertiesReloading(long now) { if (CACHING_VALIDITY_MS > 0 && now - lastCachedTime > CACHING_VALIDITY_MS) { this.rampUp = owner.getRampUpSeconds(); this.hold = owner.getHoldSeconds(); this.steps = owner.getStepsAsLong(); this.maxConcurr = owner.get...
java
{ "resource": "" }
q155858
SteppingThreadGroupGui.initGui
train
private void initGui() { totalThreads.setText("100"); initialDelay.setText("0"); incUserCount.setText("10"); incUserCountBurst.setText("0"); incUserPeriod.setText("30"); flightTime.setText("60"); decUserCount.setText("5"); decUserPeriod.setText("1"); ...
java
{ "resource": "" }
q155859
ComponentBorder.paintBorder
train
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { float x2 = (width - component.getWidth()) * component.getAlignmentX() + x; float y2 = (height - component.getHeight()) * component.getAlignmentY() + y; component.setLocation((int) x2, (int) y2);...
java
{ "resource": "" }
q155860
ComponentBorder.determineInsetsAndAlignment
train
private void determineInsetsAndAlignment() { borderInsets = new Insets(0, 0, 0, 0); // The insets will only be updated for the edge the component will be // diplayed on. // // The X, Y alignment of the component is controlled by both the edge // and alignment paramet...
java
{ "resource": "" }
q155861
ConcurrencyThreadGroup.waitThreadStopped
train
public void waitThreadStopped() { // FIXME: method named in confusing way long sleepTime = threads.isEmpty() ? DEFAULT_TEMPORISATION : MIN_CHECK_TIME; lock.lock(); try { condition.await(sleepTime, TimeUnit.MILLISECONDS); // NOSONAR } catch (InterruptedException e) { ...
java
{ "resource": "" }
q155862
PerfMonCollector.generateSample
train
@Override public void generateSample(double value, String label) { PerfMonSampleResult res = new PerfMonSampleResult(); res.setSampleLabel(label); res.setValue(value); res.setSuccessful(true); SampleEvent e = new SampleEvent(res, PERFMON); super.sampleOccurred(e); ...
java
{ "resource": "" }
q155863
PerfMonCollector.generate2Samples
train
@Override public void generate2Samples(long[] values, String label1, String label2, double dividingFactor) { if (oldValues.containsKey(label1) && oldValues.containsKey(label2)) { generateSample(((double) (values[0] - oldValues.get(label1))) / dividingFactor, label1); generateSample((...
java
{ "resource": "" }
q155864
NanoHTTPD.stop
train
public void stop() { try { safeClose(myServerSocket); closeAllConnections(); myThread.join(); } catch (Exception e) { e.printStackTrace(); } }
java
{ "resource": "" }
q155865
FlexibleFileWriter.compileColumns
train
private void compileColumns() { log.debug("Compiling columns string: " + getColumns()); String[] chunks = JMeterPluginsUtils.replaceRNT(getColumns()).split("\\|"); log.debug("Chunks " + chunks.length); compiledFields = new int[chunks.length]; compiledVars = new int[chunks.length]...
java
{ "resource": "" }
q155866
SynthesisReportGui.createObjectTableModel
train
static ObjectTableModel createObjectTableModel() { return new ObjectTableModel(COLUMNS, SamplingStatCalculator.class, new Functor[]{ new Functor("getLabel"), new Functor("getCount"), new Functor("getMeanAsNumber"), ...
java
{ "resource": "" }
q155867
SynthesisReportGui.getAllTableData
train
public static List<List<Object>> getAllTableData(ObjectTableModel model, Format[] formats) { List<List<Object>> data = new ArrayList<>(); if (model.getRowCount() > 0) { for (int rw = 0; rw < model.getRowCount(); rw++) { int cols = model.getColumnCount(); List<...
java
{ "resource": "" }
q155868
SynthesisReportGui.getAllDataAsTable
train
public static DefaultTableModel getAllDataAsTable(ObjectTableModel model, Format[] formats, String[] columns) { final List<List<Object>> table = getAllTableData(model, formats); final DefaultTableModel tableModel = new DefaultTableModel(); for (String header : columns) { tableModel...
java
{ "resource": "" }
q155869
VariableThroughputTimer.delay
train
public synchronized long delay() { while (true) { long curTimeMs = System.currentTimeMillis(); long millisSinceLastSecond = curTimeMs % 1000; long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond; checkNextSecond(nowInMsRoundedAtSec); int delayM...
java
{ "resource": "" }
q155870
CaseFormat.changeCase
train
protected String changeCase(String originalString, String mode) { String targetString = originalString; // mode is case insensitive, allow upper for example CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase()); if (changeCaseMode != null) { switch (changeCaseMode) { case LOWER_CAMEL_CASE...
java
{ "resource": "" }
q155871
CaseFormat.camelFormat
train
private static String camelFormat(String str, boolean isFirstCapitalized) { StringBuilder builder = new StringBuilder(str.length()); String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str); for (int i = 0; i < tokens.length; i++) { String lowerCased = StringUtils.lowerCase(tokens[i]); if (i == 0) { builder....
java
{ "resource": "" }
q155872
CaseFormat.caseFormatWithDelimiter
train
private static String caseFormatWithDelimiter(String str, String delimiter, boolean isAllUpper, boolean isAllLower) { StringBuilder builder = new StringBuilder(str.length()); String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str); boolean shouldAddDelimiter = StringUtils.isNotEmpty(delimiter); for (int i = 0; i < ...
java
{ "resource": "" }
q155873
CaseFormat.addVariableValue
train
private final void addVariableValue(String value, String variableName) { if (StringUtils.isNotEmpty(variableName)) { JMeterVariables vars = getVariables(); if (vars != null) { vars.put(variableName, value); } } }
java
{ "resource": "" }
q155874
ShareActionProviders.copyPrivateRawResourceToPubliclyAccessibleFile
train
private void copyPrivateRawResourceToPubliclyAccessibleFile() { InputStream inputStream = null; FileOutputStream outputStream = null; try { inputStream = getResources().openRawResource(R.raw.robot); outputStream = openFileOutput(SHARED_FILE_NAME, Conte...
java
{ "resource": "" }
q155875
BaseMenuPresenter.addItemView
train
protected void addItemView(View itemView, int childIndex) { final ViewGroup currentParent = (ViewGroup) itemView.getParent(); if (currentParent != null) { currentParent.removeView(itemView); } ((ViewGroup) mMenuView).addView(itemView, childIndex); }
java
{ "resource": "" }
q155876
BaseMenuPresenter.createItemView
train
public MenuView.ItemView createItemView(ViewGroup parent) { return (MenuView.ItemView) mSystemInflater.inflate(mItemLayoutRes, parent, false); }
java
{ "resource": "" }
q155877
BaseMenuPresenter.getItemView
train
public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) { MenuView.ItemView itemView; if (convertView instanceof MenuView.ItemView) { itemView = (MenuView.ItemView) convertView; } else { itemView = createItemView(parent); } bindItemV...
java
{ "resource": "" }
q155878
ActionMenuPresenter.showOverflowMenu
train
public boolean showOverflowMenu() { if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null && mPostedOpenRunnable == null && !mMenu.getNonActionItems().isEmpty()) { OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true); ...
java
{ "resource": "" }
q155879
ActionMenuPresenter.hideOverflowMenu
train
public boolean hideOverflowMenu() { if (mPostedOpenRunnable != null && mMenuView != null) { ((View) mMenuView).removeCallbacks(mPostedOpenRunnable); mPostedOpenRunnable = null; return true; } MenuPopupHelper popup = mOverflowPopup; if (popup != null) ...
java
{ "resource": "" }
q155880
SuggestionsAdapter.changeCursor
train
@Override public void changeCursor(Cursor c) { if (DBG) Log.d(LOG_TAG, "changeCursor(" + c + ")"); if (mClosed) { Log.w(LOG_TAG, "Tried to change cursor after adapter was closed."); if (c != null) c.close(); return; } try { super.chan...
java
{ "resource": "" }
q155881
SuggestionsAdapter.newView
train
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View v = super.newView(context, cursor, parent); v.setTag(new ChildViewCache(v)); return v; }
java
{ "resource": "" }
q155882
SuggestionsAdapter.setViewDrawable
train
private void setViewDrawable(ImageView v, Drawable drawable, int nullVisibility) { // Set the icon even if the drawable is null, since we need to clear any // previous icon. v.setImageDrawable(drawable); if (drawable == null) { v.setVisibility(nullVisibility); } else...
java
{ "resource": "" }
q155883
SuggestionsAdapter.getView
train
@Override public View getView(int position, View convertView, ViewGroup parent) { try { return super.getView(position, convertView, parent); } catch (RuntimeException e) { Log.w(LOG_TAG, "Search suggestions cursor threw exception.", e); // Put exception string in ...
java
{ "resource": "" }
q155884
SuggestionsAdapter.getDrawableFromResourceValue
train
private Drawable getDrawableFromResourceValue(String drawableId) { if (drawableId == null || drawableId.length() == 0 || "0".equals(drawableId)) { return null; } try { // First, see if it's just an integer int resourceId = Integer.parseInt(drawableId); ...
java
{ "resource": "" }
q155885
SuggestionsAdapter.getActivityIconWithCache
train
private Drawable getActivityIconWithCache(ComponentName component) { // First check the icon cache String componentIconKey = component.flattenToShortString(); // Using containsKey() since we also store null values. if (mOutsideDrawablesCache.containsKey(componentIconKey)) { D...
java
{ "resource": "" }
q155886
SuggestionsAdapter.getActivityIcon
train
private Drawable getActivityIcon(ComponentName component) { PackageManager pm = mContext.getPackageManager(); final ActivityInfo activityInfo; try { activityInfo = pm.getActivityInfo(component, PackageManager.GET_META_DATA); } catch (NameNotFoundException ex) { Lo...
java
{ "resource": "" }
q155887
SuggestionsAdapter.getColumnString
train
public static String getColumnString(Cursor cursor, String columnName) { int col = cursor.getColumnIndex(columnName); return getStringOrNull(cursor, col); }
java
{ "resource": "" }
q155888
IcsAdapterView.performItemClick
train
public boolean performItemClick(View view, int position, long id) { if (mOnItemClickListener != null) { playSoundEffect(SoundEffectConstants.CLICK); if (view != null) { view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); } mOnItemCli...
java
{ "resource": "" }
q155889
IcsAdapterView.getPositionForView
train
public int getPositionForView(View view) { View listItem = view; try { View v; while (!(v = (View) listItem.getParent()).equals(this)) { listItem = v; } } catch (ClassCastException e) { // We made it up to the window without find th...
java
{ "resource": "" }
q155890
IcsAdapterView.getItemAtPosition
train
public Object getItemAtPosition(int position) { T adapter = getAdapter(); return (adapter == null || position < 0) ? null : adapter.getItem(position); }
java
{ "resource": "" }
q155891
ResourcesCompat.loadLogoFromManifest
train
public static int loadLogoFromManifest(Activity activity) { int logo = 0; try { final String thisPackage = activity.getClass().getName(); if (ActionBarSherlock.DEBUG) Log.i(TAG, "Parsing AndroidManifest.xml for " + thisPackage); final String packageName = activity.ge...
java
{ "resource": "" }
q155892
ShareActionProvider.setActivityChooserPolicyIfNeeded
train
private void setActivityChooserPolicyIfNeeded() { if (mOnShareTargetSelectedListener == null) { return; } if (mOnChooseActivityListener == null) { mOnChooseActivityListener = new ShareAcitivityChooserModelPolicy(); } ActivityChooserModel dataModel = Activi...
java
{ "resource": "" }
q155893
ActivityChooserModel.sortActivities
train
private void sortActivities() { synchronized (mInstanceLock) { if (mActivitySorter != null && !mActivites.isEmpty()) { mActivitySorter.sort(mIntent, mActivites, Collections.unmodifiableList(mHistoricalRecords)); notifyChanged(); } ...
java
{ "resource": "" }
q155894
ActivityChooserModel.loadActivitiesLocked
train
private void loadActivitiesLocked() { mActivites.clear(); if (mIntent != null) { List<ResolveInfo> resolveInfos = mContext.getPackageManager().queryIntentActivities(mIntent, 0); final int resolveInfoCount = resolveInfos.size(); for (int i = 0; i < reso...
java
{ "resource": "" }
q155895
SearchView.onKeyDown
train
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (mSearchable == null) { return false; } // if it's an action specified by the searchable activity, launch the // entered query with the action key // TODO SearchableInfo.ActionKeyInfo actionKey ...
java
{ "resource": "" }
q155896
SearchView.onSuggestionsKey
train
private boolean onSuggestionsKey(View v, int keyCode, KeyEvent event) { // guard against possible race conditions (late arrival after dismiss) if (mSearchable == null) { return false; } if (mSuggestionsAdapter == null) { return false; } if (event.g...
java
{ "resource": "" }
q155897
SearchView.updateVoiceButton
train
private void updateVoiceButton(boolean empty) { int visibility = GONE; if (mVoiceButtonEnabled && !isIconified() && empty) { visibility = VISIBLE; mSubmitButton.setVisibility(GONE); } mVoiceButton.setVisibility(visibility); }
java
{ "resource": "" }
q155898
SearchView.rewriteQueryFromSuggestion
train
private void rewriteQueryFromSuggestion(int position) { CharSequence oldQuery = mQueryTextView.getText(); Cursor c = mSuggestionsAdapter.getCursor(); if (c == null) { return; } if (c.moveToPosition(position)) { // Get the new query from the suggestion. ...
java
{ "resource": "" }
q155899
SearchView.launchSuggestion
train
private boolean launchSuggestion(int position, int actionKey, String actionMsg) { Cursor c = mSuggestionsAdapter.getCursor(); if ((c != null) && c.moveToPosition(position)) { Intent intent = createIntentFromSuggestion(c, actionKey, actionMsg); // launch the intent l...
java
{ "resource": "" }