Dataset Viewer (First 5GB)
Auto-converted to Parquet
id
stringlengths
52
144
question
stringlengths
3
879
target
stringlengths
1
248
answers
sequence
ctxs
list
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_0_0
import android.net.Uri;
package ru.a402d.rawbtapidemo;
[ "package ru.a402d.rawbtapidemo;\n" ]
[ { "title": "in_file#lines#0.5", "text": "\nimport android.net.Uri;\nimport android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n ", "score": 1 }, { "title": "in_file#lines#0.75", "text": "\nimport android.net.Uri;\nimport android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }\n\n // ------------------------------\n\n private ArrayList<String> getPrinterList() {\n ArrayList<String> arrayList = new ArrayList<>();\n arrayList.add(RawbtPrintJob.PRINTER_CURRENT);\n arrayList.add(RawbtPrintJob.PRINTER_VIRTUAL);\n return arrayList;\n }\n\n private ArrayList<String> getTemplateList() {\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(RawbtPrintJob.TEMPLATE_DEFAULT);\n arrayList.add(RawbtPrintJob.TEMPLATE_NONE);\n\n return arrayList;\n }\n\n private static ArrayList<String> getNumbersCopies(){\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(\"1\");\n arrayList.add(\"2\");\n arrayList.add(\"3\");\n arrayList.add(\"4\");\n arrayList.add(\"5\");\n arrayList.add(\"6\");\n arrayList.add(\"7\");\n arrayList.add(\"8\");\n arrayList.add(\"9\");\n arrayList.add(\"10\");\n\n return arrayList;\n }\n\n // ------------------------------\n\n private void demo_job(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n job.println(\"Hello,World!\");\n\n Toast.makeText(this, getString(R.string.btnTxtPrint), Toast.LENGTH_SHORT).show();\n printJob(job);\n }\n\n private void demo_font(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n // default values\n AttributesString attrStr = new AttributesString();\n attrStr.setPrinterFont(FONT_A);\n attrStr.setAlignment(ALIGNMENT_LEFT);\n attrStr.setBold(false);\n attrStr.setUnderline(false);\n attrStr.setDoubleHeight(false);\n attrStr.setDoubleWidth(false);\n\n // set it as default for job\n job.setDefaultAttrString(attrStr);\n\n // attr for title\n AttributesString attrStrTitle = (new AttributesString()).setAlignment(ALIGNMENT_CENTER).setDoubleHeight(true);\n\n job.println(\"Important\",attrStrTitle);\n\n\n job.println(\"If a document requires several styles, then specify them explicitly for each purpose.\");\n job.println(\"Since the", "score": 0.5 }, { "title": "in_file#lines#0.25", "text": "\nimport android.net.Uri;\nimport android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this", "score": 0.3333333333333333 }, { "title": "in_file#identifiers#0.5", "text": "android net Uri android os Bundle android view MenuItem android view View android widget AdapterView android widget ArrayAdapter android widget Spinner android widget Toast androidx annotation Nullable androidx appcompat widget Toolbar com google android material appbar CollapsingToolbarLayout java util ArrayList rawbt api AppCompatWithRawbtActivity rawbt api attributes AttributesBarcode rawbt api attributes AttributesString rawbt api attributes AttributesImage rawbt api command CommandBarcode rawbt api RawbtPrintJob rawbt api Constant DemoSdkActivity attrJob Override onCreate savedInstanceState onCreate savedInstanceState setContentView R layout activity_demo_sdk toolbar findViewById R id toolbar setSupportActionBar toolbar toolBarLayout findViewById R id toolbar_layout toolBarLayout setTitle getTitle getSupportActionBar getSupportActionBar setDisplayHomeAsUpEnabled getSupportActionBar setDisplayShowHomeEnabled attrJob setCopies spinnerSelectPrinter findViewById R id spinnerSelectPrinter adapterSelectPrinter android R layout simple_spinner_item getPrinterList adapterSelectPrinter setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectPrinter setAdapter adapterSelectPrinter spinnerSelectPrinter setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setPrinter RawbtPrintJob PRINTER_VIRTUAL attrJob setPrinter RawbtPrintJob PRINTER_CURRENT Override onNothingSelected parent spinnerSelectTemplate findViewById R id spinnerSelectTemplate adapterSelectTemplate android R layout simple_spinner_item getTemplateList adapterSelectTemplate setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectTemplate setAdapter adapterSelectTemplate spinnerSelectTemplate setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setTemplate RawbtPrintJob TEMPLATE_NONE attrJob setTemplate RawbtPrintJob TEMPLATE_DEFAULT Override onNothingSelected parent spinnerNumbersCopies findViewById R id spinnerNumbersCopies adapterNumbersCopies android R layout simple_spinner_item getNumbersCopies adapterNumbersCopies setDropDownViewResource android R layout simple_list_item_single_choice spinnerNumbersCopies setAdapter adapterNumbersCopies spinnerNumbersCopies setSelection attrJob getCopies spinnerNumbersCopies setOnItemSelectedListener Override onItemSelected parent view position id attrJob setCopies position Override onNothingSelected parent findViewById R id sdk_test1 setOnClickListener v demo_job findViewById R id sdk_test_font setOnClickListener v demo_font findViewById R id sdk_test_image setOnClickListener v demo_image findViewById R id sdk_test_barcode setOnClickListener v demo_barcode findViewById R id sdk_test_barcode2 setOnClickListener v demo_barcode2 findViewById R id sdk_test_rich_format setOnClickListener v demo_rich_format Override onOptionsItemSelected item id item getItemId id android R id home finish onOptionsItemSelected item getPrinterList arrayList arrayList add RawbtPrintJob PRINTER_CURRENT arrayList add RawbtPrintJob PRINTER_VIRTUAL arrayList getTemplateList arrayList arrayList add RawbtPrintJob TEMPLATE_DEFAULT arrayList add RawbtPrintJob TEMPLATE_NONE arrayList getNumbersCopies arrayList arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList demo_job job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies job println Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_font job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job println job ln job println attrStrTitle fAw1h1 setPrinterFont FONT_A fAw1h2 setPrinterFont FONT_A setDoubleHeight fAw2h1 setPrinterFont FONT_A setDoubleWidth fAw2h2 setPrinterFont FONT_A setDoubleHeight setDoubleWidth fBw1h1 setPrinterFont FONT_B fBw1h2 setPrinterFont FONT_B setDoubleHeight fBw2h1 setPrinterFont FONT_B setDoubleWidth fBw2h2 setPrinterFont FONT_B setDoubleHeight setDoubleWidth job println fAw1h1 job println fAw1h2 job println fAw2h1 job println fAw2h2 job ln job println fBw1h1 job println fBw1h2 job println fBw2h1 job println fBw2h2 job ln job println attrStrTitle attrTrueType setPrinterFont FONT_TRUE_TYPE job println attrTrueType job println job ln job println attrStrTitle left setAlignment ALIGNMENT_LEFT right setAlignment ALIGNMENT_RIGHT center setAlignment ALIGNMENT_CENTER job println left job println center job println right job ln job println attrStrTitle bold setBold underline setUnderline underlineBold setUnderline setBold job println job println bold job println underline job println underlineBold job ln job println bold job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_rich_format job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setPrinterFont FONT_A setAlignment ALIGNMENT_CENTER setDoubleHeight setDoubleWidth job println attrStrTitle job drawLine attrStrTitle job println job drawLine job drawLine job drawLine job ln job println job drawLine job leftRightText job leftIndentRightText job leftRightIndentText job drawLine job leftRightTextWithFormat attrStrTitle job leftRightText job leftRightTextWithBothFormat attrStr build setDoubleWidth attrStr build setDoubleHeight Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_image job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies uri Uri parse getPackageName R raw bwlogo attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job image uri job ln job println job ln im50center setScale setAlignment ALIGNMENT_CENTER job image uri im50center job ln job println job ln im75right setScale setAlignment ALIGNMENT_RIGHT job image uri im75right job ln job println job ln im25left setScale setAlignment ALIGNMENT_LEFT job image uri im25left job ln job println job ln imRotated setRotateImage job image uri imRotated job ln job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_barcode job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job ln job println job add BARCODE_UPC_A setHeight setAlignment ALIGNMENT_CENTER job ln job println job add BARCODE_UPC_A setHeight setHri HRI_ABOVE setAlignment ALIGNMENT_LEFT job ln job println job add BARCODE_UPC_A setHeight setHri HRI_BELOW setAlignment ALIGNMENT_RIGHT job ln job println setBold job ln job println job add BARCODE_UPC_E setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println setBold job ln job println job add BARCODE_E", "score": 0.25 }, { "title": "sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.2 }, { "title": "sibling_file#identifiers#0.5", "text": "", "score": 0.16666666666666666 }, { "title": "in_file#type_identifiers#0.5", "text": "AppCompatWithRawbtActivity RawbtPrintJob RawbtPrintJob Bundle Toolbar CollapsingToolbarLayout Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView MenuItem ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList RawbtPrintJob RawbtPrintJob RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob Uri AttributesString AttributesString AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage RawbtPrintJob RawbtPrintJob AttributesString AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode RawbtPrintJob RawbtPrintJob AttributesBarcode AttributesBarcode AttributesString AttributesString String String String String String Float", "score": 0.14285714285714285 }, { "title": "in_file#method_names#0.5", "text": "onCreate onItemSelected onNothingSelected onItemSelected onNothingSelected onItemSelected onNothingSelected onOptionsItemSelected getPrinterList getTemplateList getNumbersCopies demo_job demo_font demo_rich_format demo_image demo_barcode demo_barcode2 handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress", "score": 0.125 }, { "title": "sibling_file#field_declarations#0.5", "text": "", "score": 0.1111111111111111 }, { "title": "in_file#string_literals#0.5", "text": "\"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\" \"9\" \"10\" \"Hello,World!\" \"Important\" \"If a document requires several styles, then specify them explicitly for each purpose.\" \"Since the arguments are passed by reference, do not change the values of the arguments along the way.\" \"Font sizes\" \"Normal Font A\" \"Double height\" \"Double width\" \"width & height\" \"Normal Font B\" \"Double height\" \"Double width\" \"width & height\" \"True Type\" \"If the printer does not support the required language, then text printing is available by creating a picture with text displayed in a truetype font.\" \"à, è, ì, ò, ù, À, È, Ì, Ò, Ù, á, é, í, ó, ú, ý, Á, É, Í, Ó, Ú, Ý, â, ê, î, ô, û, ð, Â, Ê, Î, Ô, Û, Ð, ã, ñ, õ, Ã, Ñ, Õ, ä, ë, ï, ö, ü, ÿ, Ä, Ë, Ï, Ö, Ü, Ÿ, å, Å, æ, œ, Æ, Œ or ß, ç, Ç, ¿, ¡\",attrTrueType); \"Alignment\" \"left\" \"center\" \"right\" \"Decoration\" \"Normal text\" \"Bold text.\" \"Underline text\" \"Underline bold\" \"Notice\" \"Using different styles on the same line is not supported. See rich format.\" \"Rich Format\" \"drawLine(char) - print full line of char\" \"leftRightText() \" \"left part\" \"right part\" \"left indent 6\" \"right part\" \"left part\" \"right indent 4\" \"Total\" \"100.00\" \"Long text as left part\" \"compare 58/80 mm\" \"width\" \"Height\" \"android.resource://\" \"/\" \"Images\" \"The picture is scaled to the width of the printer as a fraction. 16/16 means full width.Values 1-16 allowed.\" \"Scale 16(default) - full width\" \"Scale: 8(50%). Alignment: center\" \"Scale: 12(75%). Alignment: right\" \"Scale: 4(25%). Alignment: left\" \"Rotate\" \"Barcode\" \"HRI & Alignment\" \"Center / HRI none\" \"012345678905\" \"Left / HRI above\" \"012345678905\" \"Right / HRI bellow\" \"012345678905\" \"Height\" \"Default look\" \"0123456\" \"Minimum. 12 dots\" \"0123456\" \"Safe max. 192 dots\" \"01234565\" \"Width\" \"Default look\" \"012345678901\" \"1-4 for 58mm\" \"012345678901\" \"012345678901\" \"012345678901\" \"012345678901\" \"5-6 for 80mm or for 300 dpi\" \"5)\" \"012345678901\" \"6)\" \"012345678901\" \"Reduces the width when overflow\" \"7)\" \"012345678901\" \"8)\" \"012345678901\" \"UPC-A\" \"40204020402\" \"UPC-E\" \"0402402\" \"EAN13\" \"4606224236582\" \"EAN8\" \"4020402\" \"CODE39\" \"RAWBT-402D\" \"ITF\" \"30712345000010\" \"CODOBAR\" \"A4020402A\" \"CODE93\" \"RAWBT-402-/+\" \"CODE128\" \"RawBT402d\" \"Success\" \"Canceled\"", "score": 0.1 }, { "title": "sibling_file#type_identifiers#0.5", "text": "", "score": 0.09090909090909091 }, { "title": "sibling_file#string_literals#0.5", "text": "", "score": 0.08333333333333333 }, { "title": "similar_name_file#identifiers#0.5", "text": "[AppCompatWithRawbtActivity] rawbt api android content ComponentName android content Context android content ServiceConnection android content pm PackageManager android os Build android os Bundle android os Handler android os IBinder android os Looper androidx activity result ActivityResultLauncher androidx activity result contract ActivityResultContracts androidx annotation NonNull androidx annotation Nullable androidx appcompat app AppCompatActivity rawbt sdk ICallback rawbt sdk IRawBtPrintService AppCompatWithRawbtActivity handler Looper getMainLooper serviceRawBT connectService Override onServiceConnected name s serviceRawBT IRawBtPrintService Stub asInterface s serviceRawBT registerCallback serviceCallback handler post handleServiceConnected e handlePrintError e getLocalizedMessage Override onServiceDisconnected name serviceRawBT handler postDelayed bindRawBT serviceCallback Override onPrintSuccess jobId finalJobId jobId handler post handlePrintSuccess finalJobId Override onPrintError jobId errMessage finalJobId jobId finalMes errMessage handler post handlePrintError finalJobId finalMes Override onPrintCancel jobId finalJobId jobId handler post handlePrintCancel finalJobId Override onProgress jobId p finalJobId jobId finalP p handler post handlePrintProgress finalJobId finalP bindRawBT allowRequestPerm bindService RawbtApiHelper createExplicitIntent connectService Context BIND_AUTO_CREATE s allowRequestPerm Build VERSION SDK_INT Build VERSION_CODES M checkSelfPermission RawbtApiHelper SERVICE_PERMISSION PackageManager PERMISSION_GRANTED mRequestPermission launch RawbtApiHelper SERVICE_PERMISSION handlePrintError getString R string rawbt_permission_not_granted e handlePrintError getString R string rawbt_connect_error mRequestPermission registerForActivityResult isGranted bindRawBT Override onCreate savedInstanceState onCreate savedInstanceState serviceRawBT bindRawBT Override onDestroy onDestroy serviceRawBT unbindService connectService printJob NonNull job serviceRawBT RawbtApiHelper isServiceInstalled handlePrintError job idJob getString R string rawb_not_installed bindRawBT handlePrintError job idJob getString R string rawbt_please_wait serviceRawBT printRawbtPrintJob job GSON s handlePrintError job idJob getString R string rawbt_permission_not_granted e handlePrintError job idJob e getLocalizedMessage handleServiceConnected handlePrintSuccess jobId handlePrintCancel jobId handlePrintError Nullable jobId message handlePrintProgress jobId p AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.07692307692307693 }, { "title": "similar_name_file#method_names_and_bodies#0.5", "text": "[AppCompatWithRawbtActivity] [onServiceConnected] try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n } [onServiceDisconnected] public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n } [onPrintSuccess] public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n } [onPrintError] final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n } [onPrintCancel] public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n } [onProgress] final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n } [bindRawBT] \n }\n }catch (Exception e) {\n handlePrintError(null,getString(R.string.rawbt_connect_error));\n }\n } [onCreate] Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n if(serviceRawBT==null) {\n bindRawBT(true);\n }\n } [onDestroy] protected void onDestroy() {\n super.onDestroy();\n if(serviceRawBT!= null){\n unbindService(connectService);\n }\n } [printJob] R.string.rawbt_permission_not_granted));\n }catch (Exception e){\n handlePrintError(job.idJob,e.getLocalizedMessage());\n }\n } [handleServiceConnected] abstract protected void handleServiceConnected();\n [handlePrintSuccess] abstract protected void handlePrintSuccess(String jobId);\n [handlePrintCancel] protected void handlePrintCancel(String jobId);\n [handlePrintError] (@Nullable String jobId, String message);\n [handlePrintProgress] handlePrintProgress(String jobId,Float p);\n \n", "score": 0.07142857142857142 }, { "title": "in_file#field_declarations#0.5", "text": "private final RawbtPrintJob attrJob = new RawbtPrintJob();", "score": 0.06666666666666667 }, { "title": "sibling_file#method_names#0.5", "text": "", "score": 0.0625 }, { "title": "codex", "text": "", "score": 0.058823529411764705 }, { "title": "similar_name_file#field_declarations#0.5", "text": "[AppCompatWithRawbtActivity] final protected Handler handler = new Handler(Looper.getMainLooper()); public volatile IRawBtPrintService serviceRawBT = null; private final ServiceConnection connectService = new ServiceConnection() {\n\n @Override\n public void onServiceConnected(ComponentName name, IBinder s) {\n serviceRawBT = IRawBtPrintService.Stub.asInterface(s);\n try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n }\n\n @Override\n public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n }\n\n }; final ICallback serviceCallback = new ICallback.Stub() {\n\n @Override\n public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n }\n\n @Override\n public void onPrintError(String jobId,String errMessage) {\n final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n }\n\n @Override\n public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n }\n\n @Override\n public void onProgress(String jobId, float p) {\n final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n }\n\n\n }; private final ActivityResultLauncher<String> mRequestPermission = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> bindRawBT(false)); \n", "score": 0.05555555555555555 }, { "title": "similar_name_file#method_names#0.5", "text": "[AppCompatWithRawbtActivity] onServiceConnected onServiceDisconnected onPrintSuccess onPrintError onPrintCancel onProgress bindRawBT onCreate onDestroy printJob handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress \n", "score": 0.05263157894736842 }, { "title": "similar_name_file#type_identifiers#0.5", "text": "[AppCompatWithRawbtActivity] AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.05 }, { "title": "similar_name_file#string_literals#0.5", "text": "[AppCompatWithRawbtActivity] \n", "score": 0.047619047619047616 }, { "title": "parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.045454545454545456 }, { "title": "child_class_file#identifiers#0.5", "text": "", "score": 0.043478260869565216 }, { "title": "child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.041666666666666664 }, { "title": "parent_class_file#identifiers#0.5", "text": "", "score": 0.04 }, { "title": "child_class_file#method_names#0.5", "text": "", "score": 0.038461538461538464 }, { "title": "parent_class_file#method_names#0.5", "text": "", "score": 0.037037037037037035 }, { "title": "child_class_file#type_identifiers#0.5", "text": "", "score": 0.03571428571428571 }, { "title": "parent_class_file#field_declarations#0.5", "text": "", "score": 0.034482758620689655 }, { "title": "parent_class_file#type_identifiers#0.5", "text": "", "score": 0.03333333333333333 }, { "title": "parent_class_file#string_literals#0.5", "text": "", "score": 0.03225806451612903 }, { "title": "child_class_file#string_literals#0.5", "text": "", "score": 0.03125 }, { "title": "import_of_similar_name_file#identifiers#0.5", "text": "", "score": 0.030303030303030304 }, { "title": "import_of_similar_name_file#method_names_and_bodies#0.5", "text": "", "score": 0.029411764705882353 }, { "title": "import_file#identifiers#0.5", "text": "", "score": 0.02857142857142857 }, { "title": "import_file#method_names_and_bodies#0.5", "text": "", "score": 0.027777777777777776 }, { "title": "import_of_similar_name_file#field_declarations#0.5", "text": "", "score": 0.02702702702702703 }, { "title": "import_of_similar_name_file#method_names#0.5", "text": "", "score": 0.02631578947368421 }, { "title": "import_of_similar_name_file#string_literals#0.5", "text": "", "score": 0.02564102564102564 }, { "title": "import_of_sibling_file#identifiers#0.5", "text": "", "score": 0.025 }, { "title": "import_of_sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.024390243902439025 }, { "title": "import_file#field_declarations#0.5", "text": "", "score": 0.023809523809523808 }, { "title": "import_file#method_names#0.5", "text": "", "score": 0.023255813953488372 }, { "title": "import_file#string_literals#0.5", "text": "", "score": 0.022727272727272728 }, { "title": "import_of_sibling_file#method_names#0.5", "text": "", "score": 0.022222222222222223 }, { "title": "import_of_sibling_file#field_declarations#0.5", "text": "", "score": 0.021739130434782608 }, { "title": "import_of_similar_name_file#type_identifiers#0.5", "text": "", "score": 0.02127659574468085 }, { "title": "import_file#type_identifiers#0.5", "text": "", "score": 0.020833333333333332 }, { "title": "import_of_sibling_file#string_literals#0.5", "text": "", "score": 0.02040816326530612 }, { "title": "import_of_sibling_file#type_identifiers#0.5", "text": "", "score": 0.02 }, { "title": "import_of_child_class_file#identifiers#0.5", "text": "", "score": 0.0196078431372549 }, { "title": "import_of_child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.019230769230769232 }, { "title": "import_of_child_class_file#method_names#0.5", "text": "", "score": 0.018867924528301886 }, { "title": "import_of_child_class_file#field_declarations#0.5", "text": "", "score": 0.018518518518518517 }, { "title": "import_of_child_class_file#type_identifiers#0.5", "text": "", "score": 0.01818181818181818 }, { "title": "import_of_child_class_file#string_literals#0.5", "text": "", "score": 0.017857142857142856 }, { "title": "child_class_file#field_declarations#0.5", "text": "", "score": 0.017543859649122806 }, { "title": "import_of_parent_class_file#identifiers#0.5", "text": "", "score": 0.017241379310344827 }, { "title": "import_of_parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.01694915254237288 }, { "title": "import_of_parent_class_file#type_identifiers#0.5", "text": "", "score": 0.016666666666666666 }, { "title": "import_of_parent_class_file#field_declarations#0.5", "text": "", "score": 0.01639344262295082 }, { "title": "import_of_parent_class_file#string_literals#0.5", "text": "", "score": 0.016129032258064516 }, { "title": "import_of_parent_class_file#method_names#0.5", "text": "", "score": 0.015873015873015872 } ]
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_2_15
import android.os.Bundle; import android.view.MenuItem; package ru.a402d.rawbtapidemo; import android.
net.Uri;
[ "net.Uri;\n" ]
[ { "title": "in_file#lines#0.5", "text": "import android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();", "score": 1 }, { "title": "in_file#lines#0.75", "text": "import android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }\n\n // ------------------------------\n\n private ArrayList<String> getPrinterList() {\n ArrayList<String> arrayList = new ArrayList<>();\n arrayList.add(RawbtPrintJob.PRINTER_CURRENT);\n arrayList.add(RawbtPrintJob.PRINTER_VIRTUAL);\n return arrayList;\n }\n\n private ArrayList<String> getTemplateList() {\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(RawbtPrintJob.TEMPLATE_DEFAULT);\n arrayList.add(RawbtPrintJob.TEMPLATE_NONE);\n\n return arrayList;\n }\n\n private static ArrayList<String> getNumbersCopies(){\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(\"1\");\n arrayList.add(\"2\");\n arrayList.add(\"3\");\n arrayList.add(\"4\");\n arrayList.add(\"5\");\n arrayList.add(\"6\");\n arrayList.add(\"7\");\n arrayList.add(\"8\");\n arrayList.add(\"9\");\n arrayList.add(\"10\");\n\n return arrayList;\n }\n\n // ------------------------------\n\n private void demo_job(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n job.println(\"Hello,World!\");\n\n Toast.makeText(this, getString(R.string.btnTxtPrint), Toast.LENGTH_SHORT).show();\n printJob(job);\n }\n\n private void demo_font(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n // default values\n AttributesString attrStr = new AttributesString();\n attrStr.setPrinterFont(FONT_A);\n attrStr.setAlignment(ALIGNMENT_LEFT);\n attrStr.setBold(false);\n attrStr.setUnderline(false);\n attrStr.setDoubleHeight(false);\n attrStr.setDoubleWidth(false);\n\n // set it as default for job\n job.setDefaultAttrString(attrStr);\n\n // attr for title\n AttributesString attrStrTitle = (new AttributesString()).setAlignment(ALIGNMENT_CENTER).setDoubleHeight(true);\n\n job.println(\"Important\",attrStrTitle);\n\n\n job.println(\"If a document requires several styles, then specify them explicitly for each purpose.\");\n job.println(\"Since the arguments are passed by reference, do not change the", "score": 0.5 }, { "title": "in_file#lines#0.25", "text": "import android.os.Bundle;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_sp", "score": 0.3333333333333333 }, { "title": "in_file#identifiers#0.5", "text": "android os Bundle android view MenuItem android view View android widget AdapterView android widget ArrayAdapter android widget Spinner android widget Toast androidx annotation Nullable androidx appcompat widget Toolbar com google android material appbar CollapsingToolbarLayout java util ArrayList rawbt api AppCompatWithRawbtActivity rawbt api attributes AttributesBarcode rawbt api attributes AttributesString rawbt api attributes AttributesImage rawbt api command CommandBarcode rawbt api RawbtPrintJob rawbt api Constant DemoSdkActivity attrJob Override onCreate savedInstanceState onCreate savedInstanceState setContentView R layout activity_demo_sdk toolbar findViewById R id toolbar setSupportActionBar toolbar toolBarLayout findViewById R id toolbar_layout toolBarLayout setTitle getTitle getSupportActionBar getSupportActionBar setDisplayHomeAsUpEnabled getSupportActionBar setDisplayShowHomeEnabled attrJob setCopies spinnerSelectPrinter findViewById R id spinnerSelectPrinter adapterSelectPrinter android R layout simple_spinner_item getPrinterList adapterSelectPrinter setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectPrinter setAdapter adapterSelectPrinter spinnerSelectPrinter setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setPrinter RawbtPrintJob PRINTER_VIRTUAL attrJob setPrinter RawbtPrintJob PRINTER_CURRENT Override onNothingSelected parent spinnerSelectTemplate findViewById R id spinnerSelectTemplate adapterSelectTemplate android R layout simple_spinner_item getTemplateList adapterSelectTemplate setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectTemplate setAdapter adapterSelectTemplate spinnerSelectTemplate setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setTemplate RawbtPrintJob TEMPLATE_NONE attrJob setTemplate RawbtPrintJob TEMPLATE_DEFAULT Override onNothingSelected parent spinnerNumbersCopies findViewById R id spinnerNumbersCopies adapterNumbersCopies android R layout simple_spinner_item getNumbersCopies adapterNumbersCopies setDropDownViewResource android R layout simple_list_item_single_choice spinnerNumbersCopies setAdapter adapterNumbersCopies spinnerNumbersCopies setSelection attrJob getCopies spinnerNumbersCopies setOnItemSelectedListener Override onItemSelected parent view position id attrJob setCopies position Override onNothingSelected parent findViewById R id sdk_test1 setOnClickListener v demo_job findViewById R id sdk_test_font setOnClickListener v demo_font findViewById R id sdk_test_image setOnClickListener v demo_image findViewById R id sdk_test_barcode setOnClickListener v demo_barcode findViewById R id sdk_test_barcode2 setOnClickListener v demo_barcode2 findViewById R id sdk_test_rich_format setOnClickListener v demo_rich_format Override onOptionsItemSelected item id item getItemId id android R id home finish onOptionsItemSelected item getPrinterList arrayList arrayList add RawbtPrintJob PRINTER_CURRENT arrayList add RawbtPrintJob PRINTER_VIRTUAL arrayList getTemplateList arrayList arrayList add RawbtPrintJob TEMPLATE_DEFAULT arrayList add RawbtPrintJob TEMPLATE_NONE arrayList getNumbersCopies arrayList arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList demo_job job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies job println Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_font job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job println job ln job println attrStrTitle fAw1h1 setPrinterFont FONT_A fAw1h2 setPrinterFont FONT_A setDoubleHeight fAw2h1 setPrinterFont FONT_A setDoubleWidth fAw2h2 setPrinterFont FONT_A setDoubleHeight setDoubleWidth fBw1h1 setPrinterFont FONT_B fBw1h2 setPrinterFont FONT_B setDoubleHeight fBw2h1 setPrinterFont FONT_B setDoubleWidth fBw2h2 setPrinterFont FONT_B setDoubleHeight setDoubleWidth job println fAw1h1 job println fAw1h2 job println fAw2h1 job println fAw2h2 job ln job println fBw1h1 job println fBw1h2 job println fBw2h1 job println fBw2h2 job ln job println attrStrTitle attrTrueType setPrinterFont FONT_TRUE_TYPE job println attrTrueType job println job ln job println attrStrTitle left setAlignment ALIGNMENT_LEFT right setAlignment ALIGNMENT_RIGHT center setAlignment ALIGNMENT_CENTER job println left job println center job println right job ln job println attrStrTitle bold setBold underline setUnderline underlineBold setUnderline setBold job println job println bold job println underline job println underlineBold job ln job println bold job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_rich_format job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setPrinterFont FONT_A setAlignment ALIGNMENT_CENTER setDoubleHeight setDoubleWidth job println attrStrTitle job drawLine attrStrTitle job println job drawLine job drawLine job drawLine job ln job println job drawLine job leftRightText job leftIndentRightText job leftRightIndentText job drawLine job leftRightTextWithFormat attrStrTitle job leftRightText job leftRightTextWithBothFormat attrStr build setDoubleWidth attrStr build setDoubleHeight Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_image job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies uri Uri parse getPackageName R raw bwlogo attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job image uri job ln job println job ln im50center setScale setAlignment ALIGNMENT_CENTER job image uri im50center job ln job println job ln im75right setScale setAlignment ALIGNMENT_RIGHT job image uri im75right job ln job println job ln im25left setScale setAlignment ALIGNMENT_LEFT job image uri im25left job ln job println job ln imRotated setRotateImage job image uri imRotated job ln job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_barcode job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job ln job println job add BARCODE_UPC_A setHeight setAlignment ALIGNMENT_CENTER job ln job println job add BARCODE_UPC_A setHeight setHri HRI_ABOVE setAlignment ALIGNMENT_LEFT job ln job println job add BARCODE_UPC_A setHeight setHri HRI_BELOW setAlignment ALIGNMENT_RIGHT job ln job println setBold job ln job println job add BARCODE_UPC_E setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println setBold job ln job println job add BARCODE_EAN13 set", "score": 0.25 }, { "title": "sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.2 }, { "title": "sibling_file#identifiers#0.5", "text": "", "score": 0.16666666666666666 }, { "title": "in_file#type_identifiers#0.5", "text": "AppCompatWithRawbtActivity RawbtPrintJob RawbtPrintJob Bundle Toolbar CollapsingToolbarLayout Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView MenuItem ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList RawbtPrintJob RawbtPrintJob RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob Uri AttributesString AttributesString AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage RawbtPrintJob RawbtPrintJob AttributesString AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode RawbtPrintJob RawbtPrintJob AttributesBarcode AttributesBarcode AttributesString AttributesString String String String String String Float", "score": 0.14285714285714285 }, { "title": "in_file#method_names#0.5", "text": "onCreate onItemSelected onNothingSelected onItemSelected onNothingSelected onItemSelected onNothingSelected onOptionsItemSelected getPrinterList getTemplateList getNumbersCopies demo_job demo_font demo_rich_format demo_image demo_barcode demo_barcode2 handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress", "score": 0.125 }, { "title": "sibling_file#field_declarations#0.5", "text": "", "score": 0.1111111111111111 }, { "title": "in_file#string_literals#0.5", "text": "\"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\" \"9\" \"10\" \"Hello,World!\" \"Important\" \"If a document requires several styles, then specify them explicitly for each purpose.\" \"Since the arguments are passed by reference, do not change the values of the arguments along the way.\" \"Font sizes\" \"Normal Font A\" \"Double height\" \"Double width\" \"width & height\" \"Normal Font B\" \"Double height\" \"Double width\" \"width & height\" \"True Type\" \"If the printer does not support the required language, then text printing is available by creating a picture with text displayed in a truetype font.\" \"à, è, ì, ò, ù, À, È, Ì, Ò, Ù, á, é, í, ó, ú, ý, Á, É, Í, Ó, Ú, Ý, â, ê, î, ô, û, ð, Â, Ê, Î, Ô, Û, Ð, ã, ñ, õ, Ã, Ñ, Õ, ä, ë, ï, ö, ü, ÿ, Ä, Ë, Ï, Ö, Ü, Ÿ, å, Å, æ, œ, Æ, Œ or ß, ç, Ç, ¿, ¡\",attrTrueType); \"Alignment\" \"left\" \"center\" \"right\" \"Decoration\" \"Normal text\" \"Bold text.\" \"Underline text\" \"Underline bold\" \"Notice\" \"Using different styles on the same line is not supported. See rich format.\" \"Rich Format\" \"drawLine(char) - print full line of char\" \"leftRightText() \" \"left part\" \"right part\" \"left indent 6\" \"right part\" \"left part\" \"right indent 4\" \"Total\" \"100.00\" \"Long text as left part\" \"compare 58/80 mm\" \"width\" \"Height\" \"android.resource://\" \"/\" \"Images\" \"The picture is scaled to the width of the printer as a fraction. 16/16 means full width.Values 1-16 allowed.\" \"Scale 16(default) - full width\" \"Scale: 8(50%). Alignment: center\" \"Scale: 12(75%). Alignment: right\" \"Scale: 4(25%). Alignment: left\" \"Rotate\" \"Barcode\" \"HRI & Alignment\" \"Center / HRI none\" \"012345678905\" \"Left / HRI above\" \"012345678905\" \"Right / HRI bellow\" \"012345678905\" \"Height\" \"Default look\" \"0123456\" \"Minimum. 12 dots\" \"0123456\" \"Safe max. 192 dots\" \"01234565\" \"Width\" \"Default look\" \"012345678901\" \"1-4 for 58mm\" \"012345678901\" \"012345678901\" \"012345678901\" \"012345678901\" \"5-6 for 80mm or for 300 dpi\" \"5)\" \"012345678901\" \"6)\" \"012345678901\" \"Reduces the width when overflow\" \"7)\" \"012345678901\" \"8)\" \"012345678901\" \"UPC-A\" \"40204020402\" \"UPC-E\" \"0402402\" \"EAN13\" \"4606224236582\" \"EAN8\" \"4020402\" \"CODE39\" \"RAWBT-402D\" \"ITF\" \"30712345000010\" \"CODOBAR\" \"A4020402A\" \"CODE93\" \"RAWBT-402-/+\" \"CODE128\" \"RawBT402d\" \"Success\" \"Canceled\"", "score": 0.1 }, { "title": "sibling_file#type_identifiers#0.5", "text": "", "score": 0.09090909090909091 }, { "title": "sibling_file#string_literals#0.5", "text": "", "score": 0.08333333333333333 }, { "title": "similar_name_file#identifiers#0.5", "text": "[AppCompatWithRawbtActivity] rawbt api android content ComponentName android content Context android content ServiceConnection android content pm PackageManager android os Build android os Bundle android os Handler android os IBinder android os Looper androidx activity result ActivityResultLauncher androidx activity result contract ActivityResultContracts androidx annotation NonNull androidx annotation Nullable androidx appcompat app AppCompatActivity rawbt sdk ICallback rawbt sdk IRawBtPrintService AppCompatWithRawbtActivity handler Looper getMainLooper serviceRawBT connectService Override onServiceConnected name s serviceRawBT IRawBtPrintService Stub asInterface s serviceRawBT registerCallback serviceCallback handler post handleServiceConnected e handlePrintError e getLocalizedMessage Override onServiceDisconnected name serviceRawBT handler postDelayed bindRawBT serviceCallback Override onPrintSuccess jobId finalJobId jobId handler post handlePrintSuccess finalJobId Override onPrintError jobId errMessage finalJobId jobId finalMes errMessage handler post handlePrintError finalJobId finalMes Override onPrintCancel jobId finalJobId jobId handler post handlePrintCancel finalJobId Override onProgress jobId p finalJobId jobId finalP p handler post handlePrintProgress finalJobId finalP bindRawBT allowRequestPerm bindService RawbtApiHelper createExplicitIntent connectService Context BIND_AUTO_CREATE s allowRequestPerm Build VERSION SDK_INT Build VERSION_CODES M checkSelfPermission RawbtApiHelper SERVICE_PERMISSION PackageManager PERMISSION_GRANTED mRequestPermission launch RawbtApiHelper SERVICE_PERMISSION handlePrintError getString R string rawbt_permission_not_granted e handlePrintError getString R string rawbt_connect_error mRequestPermission registerForActivityResult isGranted bindRawBT Override onCreate savedInstanceState onCreate savedInstanceState serviceRawBT bindRawBT Override onDestroy onDestroy serviceRawBT unbindService connectService printJob NonNull job serviceRawBT RawbtApiHelper isServiceInstalled handlePrintError job idJob getString R string rawb_not_installed bindRawBT handlePrintError job idJob getString R string rawbt_please_wait serviceRawBT printRawbtPrintJob job GSON s handlePrintError job idJob getString R string rawbt_permission_not_granted e handlePrintError job idJob e getLocalizedMessage handleServiceConnected handlePrintSuccess jobId handlePrintCancel jobId handlePrintError Nullable jobId message handlePrintProgress jobId p AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.07692307692307693 }, { "title": "similar_name_file#method_names_and_bodies#0.5", "text": "[AppCompatWithRawbtActivity] [onServiceConnected] try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n } [onServiceDisconnected] public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n } [onPrintSuccess] public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n } [onPrintError] final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n } [onPrintCancel] public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n } [onProgress] final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n } [bindRawBT] \n }\n }catch (Exception e) {\n handlePrintError(null,getString(R.string.rawbt_connect_error));\n }\n } [onCreate] Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n if(serviceRawBT==null) {\n bindRawBT(true);\n }\n } [onDestroy] protected void onDestroy() {\n super.onDestroy();\n if(serviceRawBT!= null){\n unbindService(connectService);\n }\n } [printJob] R.string.rawbt_permission_not_granted));\n }catch (Exception e){\n handlePrintError(job.idJob,e.getLocalizedMessage());\n }\n } [handleServiceConnected] abstract protected void handleServiceConnected();\n [handlePrintSuccess] abstract protected void handlePrintSuccess(String jobId);\n [handlePrintCancel] protected void handlePrintCancel(String jobId);\n [handlePrintError] (@Nullable String jobId, String message);\n [handlePrintProgress] handlePrintProgress(String jobId,Float p);\n \n", "score": 0.07142857142857142 }, { "title": "in_file#field_declarations#0.5", "text": "private final RawbtPrintJob attrJob = new RawbtPrintJob();", "score": 0.06666666666666667 }, { "title": "sibling_file#method_names#0.5", "text": "", "score": 0.0625 }, { "title": "codex", "text": "package ru.a402d.rawbtapidemo;\n\nimport android.", "score": 0.058823529411764705 }, { "title": "similar_name_file#field_declarations#0.5", "text": "[AppCompatWithRawbtActivity] final protected Handler handler = new Handler(Looper.getMainLooper()); public volatile IRawBtPrintService serviceRawBT = null; private final ServiceConnection connectService = new ServiceConnection() {\n\n @Override\n public void onServiceConnected(ComponentName name, IBinder s) {\n serviceRawBT = IRawBtPrintService.Stub.asInterface(s);\n try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n }\n\n @Override\n public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n }\n\n }; final ICallback serviceCallback = new ICallback.Stub() {\n\n @Override\n public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n }\n\n @Override\n public void onPrintError(String jobId,String errMessage) {\n final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n }\n\n @Override\n public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n }\n\n @Override\n public void onProgress(String jobId, float p) {\n final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n }\n\n\n }; private final ActivityResultLauncher<String> mRequestPermission = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> bindRawBT(false)); \n", "score": 0.05555555555555555 }, { "title": "similar_name_file#method_names#0.5", "text": "[AppCompatWithRawbtActivity] onServiceConnected onServiceDisconnected onPrintSuccess onPrintError onPrintCancel onProgress bindRawBT onCreate onDestroy printJob handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress \n", "score": 0.05263157894736842 }, { "title": "similar_name_file#type_identifiers#0.5", "text": "[AppCompatWithRawbtActivity] AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.05 }, { "title": "similar_name_file#string_literals#0.5", "text": "[AppCompatWithRawbtActivity] \n", "score": 0.047619047619047616 }, { "title": "parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.045454545454545456 }, { "title": "child_class_file#identifiers#0.5", "text": "", "score": 0.043478260869565216 }, { "title": "child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.041666666666666664 }, { "title": "parent_class_file#identifiers#0.5", "text": "", "score": 0.04 }, { "title": "child_class_file#method_names#0.5", "text": "", "score": 0.038461538461538464 }, { "title": "parent_class_file#method_names#0.5", "text": "", "score": 0.037037037037037035 }, { "title": "child_class_file#type_identifiers#0.5", "text": "", "score": 0.03571428571428571 }, { "title": "parent_class_file#field_declarations#0.5", "text": "", "score": 0.034482758620689655 }, { "title": "parent_class_file#type_identifiers#0.5", "text": "", "score": 0.03333333333333333 }, { "title": "parent_class_file#string_literals#0.5", "text": "", "score": 0.03225806451612903 }, { "title": "child_class_file#string_literals#0.5", "text": "", "score": 0.03125 }, { "title": "import_of_similar_name_file#identifiers#0.5", "text": "", "score": 0.030303030303030304 }, { "title": "import_of_similar_name_file#method_names_and_bodies#0.5", "text": "", "score": 0.029411764705882353 }, { "title": "import_file#identifiers#0.5", "text": "", "score": 0.02857142857142857 }, { "title": "import_file#method_names_and_bodies#0.5", "text": "", "score": 0.027777777777777776 }, { "title": "import_of_similar_name_file#field_declarations#0.5", "text": "", "score": 0.02702702702702703 }, { "title": "import_of_similar_name_file#method_names#0.5", "text": "", "score": 0.02631578947368421 }, { "title": "import_of_similar_name_file#string_literals#0.5", "text": "", "score": 0.02564102564102564 }, { "title": "import_of_sibling_file#identifiers#0.5", "text": "", "score": 0.025 }, { "title": "import_of_sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.024390243902439025 }, { "title": "import_file#field_declarations#0.5", "text": "", "score": 0.023809523809523808 }, { "title": "import_file#method_names#0.5", "text": "", "score": 0.023255813953488372 }, { "title": "import_file#string_literals#0.5", "text": "", "score": 0.022727272727272728 }, { "title": "import_of_sibling_file#method_names#0.5", "text": "", "score": 0.022222222222222223 }, { "title": "import_of_sibling_file#field_declarations#0.5", "text": "", "score": 0.021739130434782608 }, { "title": "import_of_similar_name_file#type_identifiers#0.5", "text": "", "score": 0.02127659574468085 }, { "title": "import_file#type_identifiers#0.5", "text": "", "score": 0.020833333333333332 }, { "title": "import_of_sibling_file#string_literals#0.5", "text": "", "score": 0.02040816326530612 }, { "title": "import_of_sibling_file#type_identifiers#0.5", "text": "", "score": 0.02 }, { "title": "import_of_child_class_file#identifiers#0.5", "text": "", "score": 0.0196078431372549 }, { "title": "import_of_child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.019230769230769232 }, { "title": "import_of_child_class_file#method_names#0.5", "text": "", "score": 0.018867924528301886 }, { "title": "import_of_child_class_file#field_declarations#0.5", "text": "", "score": 0.018518518518518517 }, { "title": "import_of_child_class_file#type_identifiers#0.5", "text": "", "score": 0.01818181818181818 }, { "title": "import_of_child_class_file#string_literals#0.5", "text": "", "score": 0.017857142857142856 }, { "title": "child_class_file#field_declarations#0.5", "text": "", "score": 0.017543859649122806 }, { "title": "import_of_parent_class_file#identifiers#0.5", "text": "", "score": 0.017241379310344827 }, { "title": "import_of_parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.01694915254237288 }, { "title": "import_of_parent_class_file#type_identifiers#0.5", "text": "", "score": 0.016666666666666666 }, { "title": "import_of_parent_class_file#field_declarations#0.5", "text": "", "score": 0.01639344262295082 }, { "title": "import_of_parent_class_file#string_literals#0.5", "text": "", "score": 0.016129032258064516 }, { "title": "import_of_parent_class_file#method_names#0.5", "text": "", "score": 0.015873015873015872 } ]
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_3_0
import android.view.MenuItem; import android.view.View; import android.net.Uri;
import android.os.Bundle;
[ "import android.os.Bundle;\n" ]
[ { "title": "in_file#lines#0.5", "text": "import android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }", "score": 1 }, { "title": "in_file#lines#0.75", "text": "import android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }\n\n // ------------------------------\n\n private ArrayList<String> getPrinterList() {\n ArrayList<String> arrayList = new ArrayList<>();\n arrayList.add(RawbtPrintJob.PRINTER_CURRENT);\n arrayList.add(RawbtPrintJob.PRINTER_VIRTUAL);\n return arrayList;\n }\n\n private ArrayList<String> getTemplateList() {\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(RawbtPrintJob.TEMPLATE_DEFAULT);\n arrayList.add(RawbtPrintJob.TEMPLATE_NONE);\n\n return arrayList;\n }\n\n private static ArrayList<String> getNumbersCopies(){\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(\"1\");\n arrayList.add(\"2\");\n arrayList.add(\"3\");\n arrayList.add(\"4\");\n arrayList.add(\"5\");\n arrayList.add(\"6\");\n arrayList.add(\"7\");\n arrayList.add(\"8\");\n arrayList.add(\"9\");\n arrayList.add(\"10\");\n\n return arrayList;\n }\n\n // ------------------------------\n\n private void demo_job(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n job.println(\"Hello,World!\");\n\n Toast.makeText(this, getString(R.string.btnTxtPrint), Toast.LENGTH_SHORT).show();\n printJob(job);\n }\n\n private void demo_font(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n // default values\n AttributesString attrStr = new AttributesString();\n attrStr.setPrinterFont(FONT_A);\n attrStr.setAlignment(ALIGNMENT_LEFT);\n attrStr.setBold(false);\n attrStr.setUnderline(false);\n attrStr.setDoubleHeight(false);\n attrStr.setDoubleWidth(false);\n\n // set it as default for job\n job.setDefaultAttrString(attrStr);\n\n // attr for title\n AttributesString attrStrTitle = (new AttributesString()).setAlignment(ALIGNMENT_CENTER).setDoubleHeight(true);\n\n job.println(\"Important\",attrStrTitle);\n\n\n job.println(\"If a document requires several styles, then specify them explicitly for each purpose.\");\n job.println(\"Since the arguments are passed by reference, do not change the values of the arguments along the way.\");", "score": 0.5 }, { "title": "in_file#lines#0.25", "text": "import android.view.MenuItem;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n", "score": 0.3333333333333333 }, { "title": "in_file#identifiers#0.5", "text": "android view MenuItem android view View android widget AdapterView android widget ArrayAdapter android widget Spinner android widget Toast androidx annotation Nullable androidx appcompat widget Toolbar com google android material appbar CollapsingToolbarLayout java util ArrayList rawbt api AppCompatWithRawbtActivity rawbt api attributes AttributesBarcode rawbt api attributes AttributesString rawbt api attributes AttributesImage rawbt api command CommandBarcode rawbt api RawbtPrintJob rawbt api Constant DemoSdkActivity attrJob Override onCreate savedInstanceState onCreate savedInstanceState setContentView R layout activity_demo_sdk toolbar findViewById R id toolbar setSupportActionBar toolbar toolBarLayout findViewById R id toolbar_layout toolBarLayout setTitle getTitle getSupportActionBar getSupportActionBar setDisplayHomeAsUpEnabled getSupportActionBar setDisplayShowHomeEnabled attrJob setCopies spinnerSelectPrinter findViewById R id spinnerSelectPrinter adapterSelectPrinter android R layout simple_spinner_item getPrinterList adapterSelectPrinter setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectPrinter setAdapter adapterSelectPrinter spinnerSelectPrinter setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setPrinter RawbtPrintJob PRINTER_VIRTUAL attrJob setPrinter RawbtPrintJob PRINTER_CURRENT Override onNothingSelected parent spinnerSelectTemplate findViewById R id spinnerSelectTemplate adapterSelectTemplate android R layout simple_spinner_item getTemplateList adapterSelectTemplate setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectTemplate setAdapter adapterSelectTemplate spinnerSelectTemplate setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setTemplate RawbtPrintJob TEMPLATE_NONE attrJob setTemplate RawbtPrintJob TEMPLATE_DEFAULT Override onNothingSelected parent spinnerNumbersCopies findViewById R id spinnerNumbersCopies adapterNumbersCopies android R layout simple_spinner_item getNumbersCopies adapterNumbersCopies setDropDownViewResource android R layout simple_list_item_single_choice spinnerNumbersCopies setAdapter adapterNumbersCopies spinnerNumbersCopies setSelection attrJob getCopies spinnerNumbersCopies setOnItemSelectedListener Override onItemSelected parent view position id attrJob setCopies position Override onNothingSelected parent findViewById R id sdk_test1 setOnClickListener v demo_job findViewById R id sdk_test_font setOnClickListener v demo_font findViewById R id sdk_test_image setOnClickListener v demo_image findViewById R id sdk_test_barcode setOnClickListener v demo_barcode findViewById R id sdk_test_barcode2 setOnClickListener v demo_barcode2 findViewById R id sdk_test_rich_format setOnClickListener v demo_rich_format Override onOptionsItemSelected item id item getItemId id android R id home finish onOptionsItemSelected item getPrinterList arrayList arrayList add RawbtPrintJob PRINTER_CURRENT arrayList add RawbtPrintJob PRINTER_VIRTUAL arrayList getTemplateList arrayList arrayList add RawbtPrintJob TEMPLATE_DEFAULT arrayList add RawbtPrintJob TEMPLATE_NONE arrayList getNumbersCopies arrayList arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList demo_job job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies job println Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_font job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job println job ln job println attrStrTitle fAw1h1 setPrinterFont FONT_A fAw1h2 setPrinterFont FONT_A setDoubleHeight fAw2h1 setPrinterFont FONT_A setDoubleWidth fAw2h2 setPrinterFont FONT_A setDoubleHeight setDoubleWidth fBw1h1 setPrinterFont FONT_B fBw1h2 setPrinterFont FONT_B setDoubleHeight fBw2h1 setPrinterFont FONT_B setDoubleWidth fBw2h2 setPrinterFont FONT_B setDoubleHeight setDoubleWidth job println fAw1h1 job println fAw1h2 job println fAw2h1 job println fAw2h2 job ln job println fBw1h1 job println fBw1h2 job println fBw2h1 job println fBw2h2 job ln job println attrStrTitle attrTrueType setPrinterFont FONT_TRUE_TYPE job println attrTrueType job println job ln job println attrStrTitle left setAlignment ALIGNMENT_LEFT right setAlignment ALIGNMENT_RIGHT center setAlignment ALIGNMENT_CENTER job println left job println center job println right job ln job println attrStrTitle bold setBold underline setUnderline underlineBold setUnderline setBold job println job println bold job println underline job println underlineBold job ln job println bold job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_rich_format job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setPrinterFont FONT_A setAlignment ALIGNMENT_CENTER setDoubleHeight setDoubleWidth job println attrStrTitle job drawLine attrStrTitle job println job drawLine job drawLine job drawLine job ln job println job drawLine job leftRightText job leftIndentRightText job leftRightIndentText job drawLine job leftRightTextWithFormat attrStrTitle job leftRightText job leftRightTextWithBothFormat attrStr build setDoubleWidth attrStr build setDoubleHeight Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_image job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies uri Uri parse getPackageName R raw bwlogo attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job image uri job ln job println job ln im50center setScale setAlignment ALIGNMENT_CENTER job image uri im50center job ln job println job ln im75right setScale setAlignment ALIGNMENT_RIGHT job image uri im75right job ln job println job ln im25left setScale setAlignment ALIGNMENT_LEFT job image uri im25left job ln job println job ln imRotated setRotateImage job image uri imRotated job ln job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_barcode job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job ln job println job add BARCODE_UPC_A setHeight setAlignment ALIGNMENT_CENTER job ln job println job add BARCODE_UPC_A setHeight setHri HRI_ABOVE setAlignment ALIGNMENT_LEFT job ln job println job add BARCODE_UPC_A setHeight setHri HRI_BELOW setAlignment ALIGNMENT_RIGHT job ln job println setBold job ln job println job add BARCODE_UPC_E setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println setBold job ln job println job add BARCODE_EAN13 setHeight setH", "score": 0.25 }, { "title": "sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.2 }, { "title": "sibling_file#identifiers#0.5", "text": "", "score": 0.16666666666666666 }, { "title": "in_file#type_identifiers#0.5", "text": "AppCompatWithRawbtActivity RawbtPrintJob RawbtPrintJob Bundle Toolbar CollapsingToolbarLayout Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView MenuItem ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList RawbtPrintJob RawbtPrintJob RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob Uri AttributesString AttributesString AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage RawbtPrintJob RawbtPrintJob AttributesString AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode RawbtPrintJob RawbtPrintJob AttributesBarcode AttributesBarcode AttributesString AttributesString String String String String String Float", "score": 0.14285714285714285 }, { "title": "in_file#method_names#0.5", "text": "onCreate onItemSelected onNothingSelected onItemSelected onNothingSelected onItemSelected onNothingSelected onOptionsItemSelected getPrinterList getTemplateList getNumbersCopies demo_job demo_font demo_rich_format demo_image demo_barcode demo_barcode2 handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress", "score": 0.125 }, { "title": "sibling_file#field_declarations#0.5", "text": "", "score": 0.1111111111111111 }, { "title": "in_file#string_literals#0.5", "text": "\"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\" \"9\" \"10\" \"Hello,World!\" \"Important\" \"If a document requires several styles, then specify them explicitly for each purpose.\" \"Since the arguments are passed by reference, do not change the values of the arguments along the way.\" \"Font sizes\" \"Normal Font A\" \"Double height\" \"Double width\" \"width & height\" \"Normal Font B\" \"Double height\" \"Double width\" \"width & height\" \"True Type\" \"If the printer does not support the required language, then text printing is available by creating a picture with text displayed in a truetype font.\" \"à, è, ì, ò, ù, À, È, Ì, Ò, Ù, á, é, í, ó, ú, ý, Á, É, Í, Ó, Ú, Ý, â, ê, î, ô, û, ð, Â, Ê, Î, Ô, Û, Ð, ã, ñ, õ, Ã, Ñ, Õ, ä, ë, ï, ö, ü, ÿ, Ä, Ë, Ï, Ö, Ü, Ÿ, å, Å, æ, œ, Æ, Œ or ß, ç, Ç, ¿, ¡\",attrTrueType); \"Alignment\" \"left\" \"center\" \"right\" \"Decoration\" \"Normal text\" \"Bold text.\" \"Underline text\" \"Underline bold\" \"Notice\" \"Using different styles on the same line is not supported. See rich format.\" \"Rich Format\" \"drawLine(char) - print full line of char\" \"leftRightText() \" \"left part\" \"right part\" \"left indent 6\" \"right part\" \"left part\" \"right indent 4\" \"Total\" \"100.00\" \"Long text as left part\" \"compare 58/80 mm\" \"width\" \"Height\" \"android.resource://\" \"/\" \"Images\" \"The picture is scaled to the width of the printer as a fraction. 16/16 means full width.Values 1-16 allowed.\" \"Scale 16(default) - full width\" \"Scale: 8(50%). Alignment: center\" \"Scale: 12(75%). Alignment: right\" \"Scale: 4(25%). Alignment: left\" \"Rotate\" \"Barcode\" \"HRI & Alignment\" \"Center / HRI none\" \"012345678905\" \"Left / HRI above\" \"012345678905\" \"Right / HRI bellow\" \"012345678905\" \"Height\" \"Default look\" \"0123456\" \"Minimum. 12 dots\" \"0123456\" \"Safe max. 192 dots\" \"01234565\" \"Width\" \"Default look\" \"012345678901\" \"1-4 for 58mm\" \"012345678901\" \"012345678901\" \"012345678901\" \"012345678901\" \"5-6 for 80mm or for 300 dpi\" \"5)\" \"012345678901\" \"6)\" \"012345678901\" \"Reduces the width when overflow\" \"7)\" \"012345678901\" \"8)\" \"012345678901\" \"UPC-A\" \"40204020402\" \"UPC-E\" \"0402402\" \"EAN13\" \"4606224236582\" \"EAN8\" \"4020402\" \"CODE39\" \"RAWBT-402D\" \"ITF\" \"30712345000010\" \"CODOBAR\" \"A4020402A\" \"CODE93\" \"RAWBT-402-/+\" \"CODE128\" \"RawBT402d\" \"Success\" \"Canceled\"", "score": 0.1 }, { "title": "sibling_file#type_identifiers#0.5", "text": "", "score": 0.09090909090909091 }, { "title": "sibling_file#string_literals#0.5", "text": "", "score": 0.08333333333333333 }, { "title": "similar_name_file#identifiers#0.5", "text": "[AppCompatWithRawbtActivity] rawbt api android content ComponentName android content Context android content ServiceConnection android content pm PackageManager android os Build android os Bundle android os Handler android os IBinder android os Looper androidx activity result ActivityResultLauncher androidx activity result contract ActivityResultContracts androidx annotation NonNull androidx annotation Nullable androidx appcompat app AppCompatActivity rawbt sdk ICallback rawbt sdk IRawBtPrintService AppCompatWithRawbtActivity handler Looper getMainLooper serviceRawBT connectService Override onServiceConnected name s serviceRawBT IRawBtPrintService Stub asInterface s serviceRawBT registerCallback serviceCallback handler post handleServiceConnected e handlePrintError e getLocalizedMessage Override onServiceDisconnected name serviceRawBT handler postDelayed bindRawBT serviceCallback Override onPrintSuccess jobId finalJobId jobId handler post handlePrintSuccess finalJobId Override onPrintError jobId errMessage finalJobId jobId finalMes errMessage handler post handlePrintError finalJobId finalMes Override onPrintCancel jobId finalJobId jobId handler post handlePrintCancel finalJobId Override onProgress jobId p finalJobId jobId finalP p handler post handlePrintProgress finalJobId finalP bindRawBT allowRequestPerm bindService RawbtApiHelper createExplicitIntent connectService Context BIND_AUTO_CREATE s allowRequestPerm Build VERSION SDK_INT Build VERSION_CODES M checkSelfPermission RawbtApiHelper SERVICE_PERMISSION PackageManager PERMISSION_GRANTED mRequestPermission launch RawbtApiHelper SERVICE_PERMISSION handlePrintError getString R string rawbt_permission_not_granted e handlePrintError getString R string rawbt_connect_error mRequestPermission registerForActivityResult isGranted bindRawBT Override onCreate savedInstanceState onCreate savedInstanceState serviceRawBT bindRawBT Override onDestroy onDestroy serviceRawBT unbindService connectService printJob NonNull job serviceRawBT RawbtApiHelper isServiceInstalled handlePrintError job idJob getString R string rawb_not_installed bindRawBT handlePrintError job idJob getString R string rawbt_please_wait serviceRawBT printRawbtPrintJob job GSON s handlePrintError job idJob getString R string rawbt_permission_not_granted e handlePrintError job idJob e getLocalizedMessage handleServiceConnected handlePrintSuccess jobId handlePrintCancel jobId handlePrintError Nullable jobId message handlePrintProgress jobId p AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.07692307692307693 }, { "title": "similar_name_file#method_names_and_bodies#0.5", "text": "[AppCompatWithRawbtActivity] [onServiceConnected] try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n } [onServiceDisconnected] public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n } [onPrintSuccess] public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n } [onPrintError] final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n } [onPrintCancel] public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n } [onProgress] final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n } [bindRawBT] \n }\n }catch (Exception e) {\n handlePrintError(null,getString(R.string.rawbt_connect_error));\n }\n } [onCreate] Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n if(serviceRawBT==null) {\n bindRawBT(true);\n }\n } [onDestroy] protected void onDestroy() {\n super.onDestroy();\n if(serviceRawBT!= null){\n unbindService(connectService);\n }\n } [printJob] R.string.rawbt_permission_not_granted));\n }catch (Exception e){\n handlePrintError(job.idJob,e.getLocalizedMessage());\n }\n } [handleServiceConnected] abstract protected void handleServiceConnected();\n [handlePrintSuccess] abstract protected void handlePrintSuccess(String jobId);\n [handlePrintCancel] protected void handlePrintCancel(String jobId);\n [handlePrintError] (@Nullable String jobId, String message);\n [handlePrintProgress] handlePrintProgress(String jobId,Float p);\n \n", "score": 0.07142857142857142 }, { "title": "in_file#field_declarations#0.5", "text": "private final RawbtPrintJob attrJob = new RawbtPrintJob();", "score": 0.06666666666666667 }, { "title": "sibling_file#method_names#0.5", "text": "", "score": 0.0625 }, { "title": "codex", "text": "package ru.a402d.rawbtapidemo;\n\nimport android.net.Uri;\n", "score": 0.058823529411764705 }, { "title": "similar_name_file#field_declarations#0.5", "text": "[AppCompatWithRawbtActivity] final protected Handler handler = new Handler(Looper.getMainLooper()); public volatile IRawBtPrintService serviceRawBT = null; private final ServiceConnection connectService = new ServiceConnection() {\n\n @Override\n public void onServiceConnected(ComponentName name, IBinder s) {\n serviceRawBT = IRawBtPrintService.Stub.asInterface(s);\n try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n }\n\n @Override\n public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n }\n\n }; final ICallback serviceCallback = new ICallback.Stub() {\n\n @Override\n public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n }\n\n @Override\n public void onPrintError(String jobId,String errMessage) {\n final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n }\n\n @Override\n public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n }\n\n @Override\n public void onProgress(String jobId, float p) {\n final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n }\n\n\n }; private final ActivityResultLauncher<String> mRequestPermission = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> bindRawBT(false)); \n", "score": 0.05555555555555555 }, { "title": "similar_name_file#method_names#0.5", "text": "[AppCompatWithRawbtActivity] onServiceConnected onServiceDisconnected onPrintSuccess onPrintError onPrintCancel onProgress bindRawBT onCreate onDestroy printJob handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress \n", "score": 0.05263157894736842 }, { "title": "similar_name_file#type_identifiers#0.5", "text": "[AppCompatWithRawbtActivity] AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.05 }, { "title": "similar_name_file#string_literals#0.5", "text": "[AppCompatWithRawbtActivity] \n", "score": 0.047619047619047616 }, { "title": "parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.045454545454545456 }, { "title": "child_class_file#identifiers#0.5", "text": "", "score": 0.043478260869565216 }, { "title": "child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.041666666666666664 }, { "title": "parent_class_file#identifiers#0.5", "text": "", "score": 0.04 }, { "title": "child_class_file#method_names#0.5", "text": "", "score": 0.038461538461538464 }, { "title": "parent_class_file#method_names#0.5", "text": "", "score": 0.037037037037037035 }, { "title": "child_class_file#type_identifiers#0.5", "text": "", "score": 0.03571428571428571 }, { "title": "parent_class_file#field_declarations#0.5", "text": "", "score": 0.034482758620689655 }, { "title": "parent_class_file#type_identifiers#0.5", "text": "", "score": 0.03333333333333333 }, { "title": "parent_class_file#string_literals#0.5", "text": "", "score": 0.03225806451612903 }, { "title": "child_class_file#string_literals#0.5", "text": "", "score": 0.03125 }, { "title": "import_of_similar_name_file#identifiers#0.5", "text": "", "score": 0.030303030303030304 }, { "title": "import_of_similar_name_file#method_names_and_bodies#0.5", "text": "", "score": 0.029411764705882353 }, { "title": "import_file#identifiers#0.5", "text": "", "score": 0.02857142857142857 }, { "title": "import_file#method_names_and_bodies#0.5", "text": "", "score": 0.027777777777777776 }, { "title": "import_of_similar_name_file#field_declarations#0.5", "text": "", "score": 0.02702702702702703 }, { "title": "import_of_similar_name_file#method_names#0.5", "text": "", "score": 0.02631578947368421 }, { "title": "import_of_similar_name_file#string_literals#0.5", "text": "", "score": 0.02564102564102564 }, { "title": "import_of_sibling_file#identifiers#0.5", "text": "", "score": 0.025 }, { "title": "import_of_sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.024390243902439025 }, { "title": "import_file#field_declarations#0.5", "text": "", "score": 0.023809523809523808 }, { "title": "import_file#method_names#0.5", "text": "", "score": 0.023255813953488372 }, { "title": "import_file#string_literals#0.5", "text": "", "score": 0.022727272727272728 }, { "title": "import_of_sibling_file#method_names#0.5", "text": "", "score": 0.022222222222222223 }, { "title": "import_of_sibling_file#field_declarations#0.5", "text": "", "score": 0.021739130434782608 }, { "title": "import_of_similar_name_file#type_identifiers#0.5", "text": "", "score": 0.02127659574468085 }, { "title": "import_file#type_identifiers#0.5", "text": "", "score": 0.020833333333333332 }, { "title": "import_of_sibling_file#string_literals#0.5", "text": "", "score": 0.02040816326530612 }, { "title": "import_of_sibling_file#type_identifiers#0.5", "text": "", "score": 0.02 }, { "title": "import_of_child_class_file#identifiers#0.5", "text": "", "score": 0.0196078431372549 }, { "title": "import_of_child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.019230769230769232 }, { "title": "import_of_child_class_file#method_names#0.5", "text": "", "score": 0.018867924528301886 }, { "title": "import_of_child_class_file#field_declarations#0.5", "text": "", "score": 0.018518518518518517 }, { "title": "import_of_child_class_file#type_identifiers#0.5", "text": "", "score": 0.01818181818181818 }, { "title": "import_of_child_class_file#string_literals#0.5", "text": "", "score": 0.017857142857142856 }, { "title": "child_class_file#field_declarations#0.5", "text": "", "score": 0.017543859649122806 }, { "title": "import_of_parent_class_file#identifiers#0.5", "text": "", "score": 0.017241379310344827 }, { "title": "import_of_parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.01694915254237288 }, { "title": "import_of_parent_class_file#type_identifiers#0.5", "text": "", "score": 0.016666666666666666 }, { "title": "import_of_parent_class_file#field_declarations#0.5", "text": "", "score": 0.01639344262295082 }, { "title": "import_of_parent_class_file#string_literals#0.5", "text": "", "score": 0.016129032258064516 }, { "title": "import_of_parent_class_file#method_names#0.5", "text": "", "score": 0.015873015873015872 } ]
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_4_7
import android.view.View; import android.widget.AdapterView; import android.net.Uri; import android.os.Bundle; import
android.view.MenuItem;
[ "android.view.MenuItem;\n" ]
[ { "title": "in_file#lines#0.5", "text": "import android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return", "score": 1 }, { "title": "in_file#lines#0.75", "text": "import android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelectTemplate.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectTemplate.setAdapter(adapterSelectTemplate);\n spinnerSelectTemplate.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position == 1){\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_NONE);\n }else{\n attrJob.setTemplate(RawbtPrintJob.TEMPLATE_DEFAULT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n Spinner spinnerNumbersCopies = findViewById(R.id.spinnerNumbersCopies);\n ArrayAdapter<String> adapterNumbersCopies = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getNumbersCopies());\n adapterNumbersCopies.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerNumbersCopies.setAdapter(adapterNumbersCopies);\n spinnerNumbersCopies.setSelection(attrJob.getCopies()-1);\n spinnerNumbersCopies.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n attrJob.setCopies(position+1);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n // Examples\n\n findViewById(R.id.sdk_test1).setOnClickListener((v)->demo_job());\n findViewById(R.id.sdk_test_font).setOnClickListener((v)->demo_font());\n findViewById(R.id.sdk_test_image).setOnClickListener((v)->demo_image());\n\n findViewById(R.id.sdk_test_barcode).setOnClickListener((v)->demo_barcode());\n findViewById(R.id.sdk_test_barcode2).setOnClickListener((v)->demo_barcode2());\n\n findViewById(R.id.sdk_test_rich_format).setOnClickListener((v)->demo_rich_format());\n\n }\n\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }\n\n // ------------------------------\n\n private ArrayList<String> getPrinterList() {\n ArrayList<String> arrayList = new ArrayList<>();\n arrayList.add(RawbtPrintJob.PRINTER_CURRENT);\n arrayList.add(RawbtPrintJob.PRINTER_VIRTUAL);\n return arrayList;\n }\n\n private ArrayList<String> getTemplateList() {\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(RawbtPrintJob.TEMPLATE_DEFAULT);\n arrayList.add(RawbtPrintJob.TEMPLATE_NONE);\n\n return arrayList;\n }\n\n private static ArrayList<String> getNumbersCopies(){\n ArrayList<String> arrayList = new ArrayList<>();\n\n arrayList.add(\"1\");\n arrayList.add(\"2\");\n arrayList.add(\"3\");\n arrayList.add(\"4\");\n arrayList.add(\"5\");\n arrayList.add(\"6\");\n arrayList.add(\"7\");\n arrayList.add(\"8\");\n arrayList.add(\"9\");\n arrayList.add(\"10\");\n\n return arrayList;\n }\n\n // ------------------------------\n\n private void demo_job(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n job.println(\"Hello,World!\");\n\n Toast.makeText(this, getString(R.string.btnTxtPrint), Toast.LENGTH_SHORT).show();\n printJob(job);\n }\n\n private void demo_font(){\n RawbtPrintJob job = new RawbtPrintJob();\n\n job.setPrinter(attrJob.getPrinter());\n job.setTemplate(attrJob.getTemplate());\n job.setCopies(attrJob.getCopies());\n\n // default values\n AttributesString attrStr = new AttributesString();\n attrStr.setPrinterFont(FONT_A);\n attrStr.setAlignment(ALIGNMENT_LEFT);\n attrStr.setBold(false);\n attrStr.setUnderline(false);\n attrStr.setDoubleHeight(false);\n attrStr.setDoubleWidth(false);\n\n // set it as default for job\n job.setDefaultAttrString(attrStr);\n\n // attr for title\n AttributesString attrStrTitle = (new AttributesString()).setAlignment(ALIGNMENT_CENTER).setDoubleHeight(true);\n\n job.println(\"Important\",attrStrTitle);\n\n\n job.println(\"If a document requires several styles, then specify them explicitly for each purpose.\");\n job.println(\"Since the arguments are passed by reference, do not change the values of the arguments along the way.\");\n job", "score": 0.5 }, { "title": "in_file#lines#0.25", "text": "import android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\nimport android.widget.Spinner;\nimport android.widget.Toast;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.widget.Toolbar;\n\nimport com.google.android.material.appbar.CollapsingToolbarLayout;\n\nimport java.util.ArrayList;\n\nimport rawbt.api.AppCompatWithRawbtActivity;\nimport rawbt.api.attributes.AttributesBarcode;\nimport rawbt.api.attributes.AttributesString;\nimport rawbt.api.attributes.AttributesImage;\nimport rawbt.api.command.CommandBarcode;\nimport rawbt.api.RawbtPrintJob;\nimport static rawbt.api.Constant.*;\n\n\npublic class DemoSdkActivity extends AppCompatWithRawbtActivity {\n\n private final RawbtPrintJob attrJob = new RawbtPrintJob();\n\n // -----------------------------------------\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.activity_demo_sdk);\n Toolbar toolbar = findViewById(R.id.toolbar);\n setSupportActionBar(toolbar);\n CollapsingToolbarLayout toolBarLayout = findViewById(R.id.toolbar_layout);\n toolBarLayout.setTitle(getTitle());\n\n // add back arrow to toolbar\n if (getSupportActionBar()!= null) {\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n }\n\n // AttrJob\n\n attrJob.setCopies(1);\n\n Spinner spinnerSelectPrinter = findViewById(R.id.spinnerSelectPrinter);\n ArrayAdapter<String> adapterSelectPrinter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item,getPrinterList());\n adapterSelectPrinter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);\n spinnerSelectPrinter.setAdapter(adapterSelectPrinter);\n spinnerSelectPrinter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if(position==1){\n attrJob.setPrinter(RawbtPrintJob.PRINTER_VIRTUAL);\n }else{\n attrJob.setPrinter(RawbtPrintJob.PRINTER_CURRENT);\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n Spinner spinnerSelectTemplate = findViewById(R.id.spinnerSelectTemplate);\n ArrayAdapter<String> adapterSelectTemplate = new ArrayAdapter<>(this,android.R.layout.simple_spinner_item, getTemplateList());\n adapterSelect", "score": 0.3333333333333333 }, { "title": "in_file#identifiers#0.5", "text": "android view View android widget AdapterView android widget ArrayAdapter android widget Spinner android widget Toast androidx annotation Nullable androidx appcompat widget Toolbar com google android material appbar CollapsingToolbarLayout java util ArrayList rawbt api AppCompatWithRawbtActivity rawbt api attributes AttributesBarcode rawbt api attributes AttributesString rawbt api attributes AttributesImage rawbt api command CommandBarcode rawbt api RawbtPrintJob rawbt api Constant DemoSdkActivity attrJob Override onCreate savedInstanceState onCreate savedInstanceState setContentView R layout activity_demo_sdk toolbar findViewById R id toolbar setSupportActionBar toolbar toolBarLayout findViewById R id toolbar_layout toolBarLayout setTitle getTitle getSupportActionBar getSupportActionBar setDisplayHomeAsUpEnabled getSupportActionBar setDisplayShowHomeEnabled attrJob setCopies spinnerSelectPrinter findViewById R id spinnerSelectPrinter adapterSelectPrinter android R layout simple_spinner_item getPrinterList adapterSelectPrinter setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectPrinter setAdapter adapterSelectPrinter spinnerSelectPrinter setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setPrinter RawbtPrintJob PRINTER_VIRTUAL attrJob setPrinter RawbtPrintJob PRINTER_CURRENT Override onNothingSelected parent spinnerSelectTemplate findViewById R id spinnerSelectTemplate adapterSelectTemplate android R layout simple_spinner_item getTemplateList adapterSelectTemplate setDropDownViewResource android R layout simple_list_item_single_choice spinnerSelectTemplate setAdapter adapterSelectTemplate spinnerSelectTemplate setOnItemSelectedListener Override onItemSelected parent view position id position attrJob setTemplate RawbtPrintJob TEMPLATE_NONE attrJob setTemplate RawbtPrintJob TEMPLATE_DEFAULT Override onNothingSelected parent spinnerNumbersCopies findViewById R id spinnerNumbersCopies adapterNumbersCopies android R layout simple_spinner_item getNumbersCopies adapterNumbersCopies setDropDownViewResource android R layout simple_list_item_single_choice spinnerNumbersCopies setAdapter adapterNumbersCopies spinnerNumbersCopies setSelection attrJob getCopies spinnerNumbersCopies setOnItemSelectedListener Override onItemSelected parent view position id attrJob setCopies position Override onNothingSelected parent findViewById R id sdk_test1 setOnClickListener v demo_job findViewById R id sdk_test_font setOnClickListener v demo_font findViewById R id sdk_test_image setOnClickListener v demo_image findViewById R id sdk_test_barcode setOnClickListener v demo_barcode findViewById R id sdk_test_barcode2 setOnClickListener v demo_barcode2 findViewById R id sdk_test_rich_format setOnClickListener v demo_rich_format Override onOptionsItemSelected item id item getItemId id android R id home finish onOptionsItemSelected item getPrinterList arrayList arrayList add RawbtPrintJob PRINTER_CURRENT arrayList add RawbtPrintJob PRINTER_VIRTUAL arrayList getTemplateList arrayList arrayList add RawbtPrintJob TEMPLATE_DEFAULT arrayList add RawbtPrintJob TEMPLATE_NONE arrayList getNumbersCopies arrayList arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList add arrayList demo_job job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies job println Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_font job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job println job ln job println attrStrTitle fAw1h1 setPrinterFont FONT_A fAw1h2 setPrinterFont FONT_A setDoubleHeight fAw2h1 setPrinterFont FONT_A setDoubleWidth fAw2h2 setPrinterFont FONT_A setDoubleHeight setDoubleWidth fBw1h1 setPrinterFont FONT_B fBw1h2 setPrinterFont FONT_B setDoubleHeight fBw2h1 setPrinterFont FONT_B setDoubleWidth fBw2h2 setPrinterFont FONT_B setDoubleHeight setDoubleWidth job println fAw1h1 job println fAw1h2 job println fAw2h1 job println fAw2h2 job ln job println fBw1h1 job println fBw1h2 job println fBw2h1 job println fBw2h2 job ln job println attrStrTitle attrTrueType setPrinterFont FONT_TRUE_TYPE job println attrTrueType job println job ln job println attrStrTitle left setAlignment ALIGNMENT_LEFT right setAlignment ALIGNMENT_RIGHT center setAlignment ALIGNMENT_CENTER job println left job println center job println right job ln job println attrStrTitle bold setBold underline setUnderline underlineBold setUnderline setBold job println job println bold job println underline job println underlineBold job ln job println bold job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_rich_format job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStr attrStr setPrinterFont FONT_A attrStr setAlignment ALIGNMENT_LEFT attrStr setBold attrStr setUnderline attrStr setDoubleHeight attrStr setDoubleWidth job setDefaultAttrString attrStr attrStrTitle setPrinterFont FONT_A setAlignment ALIGNMENT_CENTER setDoubleHeight setDoubleWidth job println attrStrTitle job drawLine attrStrTitle job println job drawLine job drawLine job drawLine job ln job println job drawLine job leftRightText job leftIndentRightText job leftRightIndentText job drawLine job leftRightTextWithFormat attrStrTitle job leftRightText job leftRightTextWithBothFormat attrStr build setDoubleWidth attrStr build setDoubleHeight Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_image job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies uri Uri parse getPackageName R raw bwlogo attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job image uri job ln job println job ln im50center setScale setAlignment ALIGNMENT_CENTER job image uri im50center job ln job println job ln im75right setScale setAlignment ALIGNMENT_RIGHT job image uri im75right job ln job println job ln im25left setScale setAlignment ALIGNMENT_LEFT job image uri im25left job ln job println job ln imRotated setRotateImage job image uri imRotated job ln job println job ln Toast makeText getString R string btnTxtPrint Toast LENGTH_SHORT show printJob job demo_barcode job job setPrinter attrJob getPrinter job setTemplate attrJob getTemplate job setCopies attrJob getCopies attrStrTitle setAlignment ALIGNMENT_CENTER setDoubleHeight job println attrStrTitle job println job ln job println job add BARCODE_UPC_A setHeight setAlignment ALIGNMENT_CENTER job ln job println job add BARCODE_UPC_A setHeight setHri HRI_ABOVE setAlignment ALIGNMENT_LEFT job ln job println job add BARCODE_UPC_A setHeight setHri HRI_BELOW setAlignment ALIGNMENT_RIGHT job ln job println setBold job ln job println job add BARCODE_UPC_E setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println job add BARCODE_UPC_E setHeight setHri HRI_BOTH job ln job println setBold job ln job println job add BARCODE_EAN13 setHeight setHri HRI_", "score": 0.25 }, { "title": "sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.2 }, { "title": "sibling_file#identifiers#0.5", "text": "", "score": 0.16666666666666666 }, { "title": "in_file#type_identifiers#0.5", "text": "AppCompatWithRawbtActivity RawbtPrintJob RawbtPrintJob Bundle Toolbar CollapsingToolbarLayout Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView Spinner ArrayAdapter String ArrayAdapter AdapterView OnItemSelectedListener AdapterView View AdapterView MenuItem ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList ArrayList String ArrayList String ArrayList RawbtPrintJob RawbtPrintJob RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob AttributesString AttributesString AttributesString AttributesString RawbtPrintJob RawbtPrintJob Uri AttributesString AttributesString AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage AttributesImage RawbtPrintJob RawbtPrintJob AttributesString AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode AttributesString CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode CommandBarcode RawbtPrintJob RawbtPrintJob AttributesBarcode AttributesBarcode AttributesString AttributesString String String String String String Float", "score": 0.14285714285714285 }, { "title": "in_file#method_names#0.5", "text": "onCreate onItemSelected onNothingSelected onItemSelected onNothingSelected onItemSelected onNothingSelected onOptionsItemSelected getPrinterList getTemplateList getNumbersCopies demo_job demo_font demo_rich_format demo_image demo_barcode demo_barcode2 handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress", "score": 0.125 }, { "title": "sibling_file#field_declarations#0.5", "text": "", "score": 0.1111111111111111 }, { "title": "in_file#string_literals#0.5", "text": "\"1\" \"2\" \"3\" \"4\" \"5\" \"6\" \"7\" \"8\" \"9\" \"10\" \"Hello,World!\" \"Important\" \"If a document requires several styles, then specify them explicitly for each purpose.\" \"Since the arguments are passed by reference, do not change the values of the arguments along the way.\" \"Font sizes\" \"Normal Font A\" \"Double height\" \"Double width\" \"width & height\" \"Normal Font B\" \"Double height\" \"Double width\" \"width & height\" \"True Type\" \"If the printer does not support the required language, then text printing is available by creating a picture with text displayed in a truetype font.\" \"à, è, ì, ò, ù, À, È, Ì, Ò, Ù, á, é, í, ó, ú, ý, Á, É, Í, Ó, Ú, Ý, â, ê, î, ô, û, ð, Â, Ê, Î, Ô, Û, Ð, ã, ñ, õ, Ã, Ñ, Õ, ä, ë, ï, ö, ü, ÿ, Ä, Ë, Ï, Ö, Ü, Ÿ, å, Å, æ, œ, Æ, Œ or ß, ç, Ç, ¿, ¡\",attrTrueType); \"Alignment\" \"left\" \"center\" \"right\" \"Decoration\" \"Normal text\" \"Bold text.\" \"Underline text\" \"Underline bold\" \"Notice\" \"Using different styles on the same line is not supported. See rich format.\" \"Rich Format\" \"drawLine(char) - print full line of char\" \"leftRightText() \" \"left part\" \"right part\" \"left indent 6\" \"right part\" \"left part\" \"right indent 4\" \"Total\" \"100.00\" \"Long text as left part\" \"compare 58/80 mm\" \"width\" \"Height\" \"android.resource://\" \"/\" \"Images\" \"The picture is scaled to the width of the printer as a fraction. 16/16 means full width.Values 1-16 allowed.\" \"Scale 16(default) - full width\" \"Scale: 8(50%). Alignment: center\" \"Scale: 12(75%). Alignment: right\" \"Scale: 4(25%). Alignment: left\" \"Rotate\" \"Barcode\" \"HRI & Alignment\" \"Center / HRI none\" \"012345678905\" \"Left / HRI above\" \"012345678905\" \"Right / HRI bellow\" \"012345678905\" \"Height\" \"Default look\" \"0123456\" \"Minimum. 12 dots\" \"0123456\" \"Safe max. 192 dots\" \"01234565\" \"Width\" \"Default look\" \"012345678901\" \"1-4 for 58mm\" \"012345678901\" \"012345678901\" \"012345678901\" \"012345678901\" \"5-6 for 80mm or for 300 dpi\" \"5)\" \"012345678901\" \"6)\" \"012345678901\" \"Reduces the width when overflow\" \"7)\" \"012345678901\" \"8)\" \"012345678901\" \"UPC-A\" \"40204020402\" \"UPC-E\" \"0402402\" \"EAN13\" \"4606224236582\" \"EAN8\" \"4020402\" \"CODE39\" \"RAWBT-402D\" \"ITF\" \"30712345000010\" \"CODOBAR\" \"A4020402A\" \"CODE93\" \"RAWBT-402-/+\" \"CODE128\" \"RawBT402d\" \"Success\" \"Canceled\"", "score": 0.1 }, { "title": "sibling_file#type_identifiers#0.5", "text": "", "score": 0.09090909090909091 }, { "title": "sibling_file#string_literals#0.5", "text": "", "score": 0.08333333333333333 }, { "title": "similar_name_file#identifiers#0.5", "text": "[AppCompatWithRawbtActivity] rawbt api android content ComponentName android content Context android content ServiceConnection android content pm PackageManager android os Build android os Bundle android os Handler android os IBinder android os Looper androidx activity result ActivityResultLauncher androidx activity result contract ActivityResultContracts androidx annotation NonNull androidx annotation Nullable androidx appcompat app AppCompatActivity rawbt sdk ICallback rawbt sdk IRawBtPrintService AppCompatWithRawbtActivity handler Looper getMainLooper serviceRawBT connectService Override onServiceConnected name s serviceRawBT IRawBtPrintService Stub asInterface s serviceRawBT registerCallback serviceCallback handler post handleServiceConnected e handlePrintError e getLocalizedMessage Override onServiceDisconnected name serviceRawBT handler postDelayed bindRawBT serviceCallback Override onPrintSuccess jobId finalJobId jobId handler post handlePrintSuccess finalJobId Override onPrintError jobId errMessage finalJobId jobId finalMes errMessage handler post handlePrintError finalJobId finalMes Override onPrintCancel jobId finalJobId jobId handler post handlePrintCancel finalJobId Override onProgress jobId p finalJobId jobId finalP p handler post handlePrintProgress finalJobId finalP bindRawBT allowRequestPerm bindService RawbtApiHelper createExplicitIntent connectService Context BIND_AUTO_CREATE s allowRequestPerm Build VERSION SDK_INT Build VERSION_CODES M checkSelfPermission RawbtApiHelper SERVICE_PERMISSION PackageManager PERMISSION_GRANTED mRequestPermission launch RawbtApiHelper SERVICE_PERMISSION handlePrintError getString R string rawbt_permission_not_granted e handlePrintError getString R string rawbt_connect_error mRequestPermission registerForActivityResult isGranted bindRawBT Override onCreate savedInstanceState onCreate savedInstanceState serviceRawBT bindRawBT Override onDestroy onDestroy serviceRawBT unbindService connectService printJob NonNull job serviceRawBT RawbtApiHelper isServiceInstalled handlePrintError job idJob getString R string rawb_not_installed bindRawBT handlePrintError job idJob getString R string rawbt_please_wait serviceRawBT printRawbtPrintJob job GSON s handlePrintError job idJob getString R string rawbt_permission_not_granted e handlePrintError job idJob e getLocalizedMessage handleServiceConnected handlePrintSuccess jobId handlePrintCancel jobId handlePrintError Nullable jobId message handlePrintProgress jobId p AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.07692307692307693 }, { "title": "similar_name_file#method_names_and_bodies#0.5", "text": "[AppCompatWithRawbtActivity] [onServiceConnected] try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n } [onServiceDisconnected] public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n } [onPrintSuccess] public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n } [onPrintError] final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n } [onPrintCancel] public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n } [onProgress] final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n } [bindRawBT] \n }\n }catch (Exception e) {\n handlePrintError(null,getString(R.string.rawbt_connect_error));\n }\n } [onCreate] Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n if(serviceRawBT==null) {\n bindRawBT(true);\n }\n } [onDestroy] protected void onDestroy() {\n super.onDestroy();\n if(serviceRawBT!= null){\n unbindService(connectService);\n }\n } [printJob] R.string.rawbt_permission_not_granted));\n }catch (Exception e){\n handlePrintError(job.idJob,e.getLocalizedMessage());\n }\n } [handleServiceConnected] abstract protected void handleServiceConnected();\n [handlePrintSuccess] abstract protected void handlePrintSuccess(String jobId);\n [handlePrintCancel] protected void handlePrintCancel(String jobId);\n [handlePrintError] (@Nullable String jobId, String message);\n [handlePrintProgress] handlePrintProgress(String jobId,Float p);\n \n", "score": 0.07142857142857142 }, { "title": "in_file#field_declarations#0.5", "text": "private final RawbtPrintJob attrJob = new RawbtPrintJob();", "score": 0.06666666666666667 }, { "title": "sibling_file#method_names#0.5", "text": "", "score": 0.0625 }, { "title": "codex", "text": "package ru.a402d.rawbtapidemo;\n\nimport android.net.Uri;\nimport android.os.Bundle;\nimport ", "score": 0.058823529411764705 }, { "title": "similar_name_file#field_declarations#0.5", "text": "[AppCompatWithRawbtActivity] final protected Handler handler = new Handler(Looper.getMainLooper()); public volatile IRawBtPrintService serviceRawBT = null; private final ServiceConnection connectService = new ServiceConnection() {\n\n @Override\n public void onServiceConnected(ComponentName name, IBinder s) {\n serviceRawBT = IRawBtPrintService.Stub.asInterface(s);\n try {\n serviceRawBT.registerCallback(serviceCallback);\n handler.post(()-> handleServiceConnected());\n } catch (Exception e) {\n handlePrintError(null,e.getLocalizedMessage());\n }\n }\n\n @Override\n public void onServiceDisconnected(ComponentName name) {\n serviceRawBT = null;\n handler.postDelayed(()-> bindRawBT(false),5000);\n }\n\n }; final ICallback serviceCallback = new ICallback.Stub() {\n\n @Override\n public void onPrintSuccess(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintSuccess(finalJobId));\n }\n\n @Override\n public void onPrintError(String jobId,String errMessage) {\n final String finalJobId = jobId;\n final String finalMes = errMessage;\n handler.post(()-> handlePrintError(finalJobId,finalMes));\n }\n\n @Override\n public void onPrintCancel(String jobId) {\n final String finalJobId = jobId;\n handler.post(()-> handlePrintCancel(finalJobId));\n }\n\n @Override\n public void onProgress(String jobId, float p) {\n final String finalJobId = jobId;\n final float finalP = p;\n handler.post(()-> handlePrintProgress(finalJobId,finalP));\n }\n\n\n }; private final ActivityResultLauncher<String> mRequestPermission = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> bindRawBT(false)); \n", "score": 0.05555555555555555 }, { "title": "similar_name_file#method_names#0.5", "text": "[AppCompatWithRawbtActivity] onServiceConnected onServiceDisconnected onPrintSuccess onPrintError onPrintCancel onProgress bindRawBT onCreate onDestroy printJob handleServiceConnected handlePrintSuccess handlePrintCancel handlePrintError handlePrintProgress \n", "score": 0.05263157894736842 }, { "title": "similar_name_file#type_identifiers#0.5", "text": "[AppCompatWithRawbtActivity] AppCompatActivity Handler Handler IRawBtPrintService ServiceConnection ServiceConnection ComponentName IBinder Exception ComponentName ICallback ICallback Stub String String String String String String String String String String SecurityException Exception ActivityResultLauncher String ActivityResultContracts RequestPermission Bundle RawbtPrintJob SecurityException Exception String String String String String Float \n", "score": 0.05 }, { "title": "similar_name_file#string_literals#0.5", "text": "[AppCompatWithRawbtActivity] \n", "score": 0.047619047619047616 }, { "title": "parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.045454545454545456 }, { "title": "child_class_file#identifiers#0.5", "text": "", "score": 0.043478260869565216 }, { "title": "child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.041666666666666664 }, { "title": "parent_class_file#identifiers#0.5", "text": "", "score": 0.04 }, { "title": "child_class_file#method_names#0.5", "text": "", "score": 0.038461538461538464 }, { "title": "parent_class_file#method_names#0.5", "text": "", "score": 0.037037037037037035 }, { "title": "child_class_file#type_identifiers#0.5", "text": "", "score": 0.03571428571428571 }, { "title": "parent_class_file#field_declarations#0.5", "text": "", "score": 0.034482758620689655 }, { "title": "parent_class_file#type_identifiers#0.5", "text": "", "score": 0.03333333333333333 }, { "title": "parent_class_file#string_literals#0.5", "text": "", "score": 0.03225806451612903 }, { "title": "child_class_file#string_literals#0.5", "text": "", "score": 0.03125 }, { "title": "import_of_similar_name_file#identifiers#0.5", "text": "", "score": 0.030303030303030304 }, { "title": "import_of_similar_name_file#method_names_and_bodies#0.5", "text": "", "score": 0.029411764705882353 }, { "title": "import_file#identifiers#0.5", "text": "", "score": 0.02857142857142857 }, { "title": "import_file#method_names_and_bodies#0.5", "text": "", "score": 0.027777777777777776 }, { "title": "import_of_similar_name_file#field_declarations#0.5", "text": "", "score": 0.02702702702702703 }, { "title": "import_of_similar_name_file#method_names#0.5", "text": "", "score": 0.02631578947368421 }, { "title": "import_of_similar_name_file#string_literals#0.5", "text": "", "score": 0.02564102564102564 }, { "title": "import_of_sibling_file#identifiers#0.5", "text": "", "score": 0.025 }, { "title": "import_of_sibling_file#method_names_and_bodies#0.5", "text": "", "score": 0.024390243902439025 }, { "title": "import_file#field_declarations#0.5", "text": "", "score": 0.023809523809523808 }, { "title": "import_file#method_names#0.5", "text": "", "score": 0.023255813953488372 }, { "title": "import_file#string_literals#0.5", "text": "", "score": 0.022727272727272728 }, { "title": "import_of_sibling_file#method_names#0.5", "text": "", "score": 0.022222222222222223 }, { "title": "import_of_sibling_file#field_declarations#0.5", "text": "", "score": 0.021739130434782608 }, { "title": "import_of_similar_name_file#type_identifiers#0.5", "text": "", "score": 0.02127659574468085 }, { "title": "import_file#type_identifiers#0.5", "text": "", "score": 0.020833333333333332 }, { "title": "import_of_sibling_file#string_literals#0.5", "text": "", "score": 0.02040816326530612 }, { "title": "import_of_sibling_file#type_identifiers#0.5", "text": "", "score": 0.02 }, { "title": "import_of_child_class_file#identifiers#0.5", "text": "", "score": 0.0196078431372549 }, { "title": "import_of_child_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.019230769230769232 }, { "title": "import_of_child_class_file#method_names#0.5", "text": "", "score": 0.018867924528301886 }, { "title": "import_of_child_class_file#field_declarations#0.5", "text": "", "score": 0.018518518518518517 }, { "title": "import_of_child_class_file#type_identifiers#0.5", "text": "", "score": 0.01818181818181818 }, { "title": "import_of_child_class_file#string_literals#0.5", "text": "", "score": 0.017857142857142856 }, { "title": "child_class_file#field_declarations#0.5", "text": "", "score": 0.017543859649122806 }, { "title": "import_of_parent_class_file#identifiers#0.5", "text": "", "score": 0.017241379310344827 }, { "title": "import_of_parent_class_file#method_names_and_bodies#0.5", "text": "", "score": 0.01694915254237288 }, { "title": "import_of_parent_class_file#type_identifiers#0.5", "text": "", "score": 0.016666666666666666 }, { "title": "import_of_parent_class_file#field_declarations#0.5", "text": "", "score": 0.01639344262295082 }, { "title": "import_of_parent_class_file#string_literals#0.5", "text": "", "score": 0.016129032258064516 }, { "title": "import_of_parent_class_file#method_names#0.5", "text": "", "score": 0.015873015873015872 } ]
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_5_0
"import android.widget.AdapterView;\nimport android.widget.ArrayAdapter;\n import android.os.Bundle;(...TRUNCATED)
import android.view.View;
[ "import android.view.View;\n" ]
[{"title":"in_file#lines#0.5","text":"import android.widget.AdapterView;\nimport android.widget.Arra(...TRUNCATED)
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_6_0
"import android.widget.ArrayAdapter;\nimport android.widget.Spinner;\n import android.view.MenuItem;(...TRUNCATED)
import android.widget.AdapterView;
[ "import android.widget.AdapterView;\n" ]
[{"title":"in_file#lines#0.5","text":"import android.widget.ArrayAdapter;\nimport android.widget.Spi(...TRUNCATED)
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_7_7
"import android.widget.Spinner;\nimport android.widget.Toast;\n import android.view.View;\nimport an(...TRUNCATED)
android.widget.ArrayAdapter;
[ "android.widget.ArrayAdapter;\n" ]
[{"title":"in_file#lines#0.5","text":"import android.widget.Spinner;\nimport android.widget.Toast;\n(...TRUNCATED)
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_8_0
"import android.widget.Toast;\n\n import android.widget.AdapterView;\nimport android.widget.ArrayAda(...TRUNCATED)
import android.widget.Spinner;
[ "import android.widget.Spinner;\n" ]
[{"title":"in_file#lines#0.5","text":"import android.widget.Toast;\n\nimport androidx.annotation.Nul(...TRUNCATED)
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_9_7
"\nimport androidx.annotation.Nullable;\n import android.widget.ArrayAdapter;\nimport android.widget(...TRUNCATED)
android.widget.Toast;
[ "android.widget.Toast;\n" ]
[{"title":"in_file#lines#0.5","text":"\nimport androidx.annotation.Nullable;\nimport androidx.appcom(...TRUNCATED)
data/train/402d/RawbtAPI/sample/src/main/java/ru/a402d/rawbtapidemo/DemoSdkActivity.java_11_35
"import androidx.appcompat.widget.Toolbar;\n\n import android.widget.Toast;\n\nimport androidx.annot(...TRUNCATED)
;
[ ";\n" ]
[{"title":"in_file#lines#0.5","text":"import androidx.appcompat.widget.Toolbar;\n\nimport com.google(...TRUNCATED)
End of preview. Expand in Data Studio

This version of the dataset is strictly permitted for use exclusively in conjunction with the review process for the paper. Upon completion of the review process, a de-anonymized version of the dataset will be released under a license similar to that of The Stack, which can be found at https://huggingface.co/datasets/bigcode/the-stack.

Downloads last month
315