use of android.widget.ArrayAdapter in project dialogplus by orhanobut.
the class ListHolderTest method testOnItemClickWithoutItemListenerOnly.
@Test
public void testOnItemClickWithoutItemListenerOnly() {
ListHolder holder = getListHolder();
ListView listView = (ListView) holder.getInflatedView();
//with adapter set
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, new String[] { "test" });
holder.setAdapter(adapter);
try {
listView.performItemClick(null, 0, 0);
} catch (Exception e) {
fail("it should not crash");
}
}
use of android.widget.ArrayAdapter in project bee by orhanobut.
the class SettingsAdapter method createSpinner.
private View createSpinner(ViewGroup parent, MethodInfo methodInfo) {
final Method method = methodInfo.getMethod();
final Object instance = methodInfo.getInstance();
final Context context = parent.getContext();
View view = inflater.inflate(R.layout.item_settings_spinner, parent, false);
((TextView) view.findViewById(R.id.title)).setText(methodInfo.getTitle());
String[] dataList = (String[]) methodInfo.getData();
ArrayAdapter<String> adapter = new ArrayAdapter<>(parent.getContext(), R.layout.simple_spinner_item, dataList);
Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String value = (String) parent.getItemAtPosition(position);
try {
method.invoke(instance, value);
} catch (Exception e) {
Log.e("Bee", e.getMessage());
}
PrefHelper.setInt(context, method.getName(), position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
spinner.setSelection(PrefHelper.getInt(context, method.getName()));
return view;
}
use of android.widget.ArrayAdapter in project android-app-common-tasks by multidots.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = MainActivity.this;
//Activity mActivity = MainActivity.this;
tvText = (TextView) findViewById(R.id.text);
String[] sdkFunctionalityListValue = new String[] { "Validations", /* 0 */
"Internet availability", /* 1 */
"Date formats", /* 2 */
"Device id", /* 3 */
"Set preferences", /* 4 */
"Get preferences", /* 5 */
"Get current location", /* 6 */
"Pinchzoom image", /* 7 */
"Get application icon", /* 8 */
"Send notification", /* 9 */
"Get random character from A to Z", /* 10 */
"Screen sleep mode on off", /* 11 */
"Open image from path", /* 12 */
"Open video from path", /* 13 */
"Open url in browser", /* 14 */
"Show address on map", /* 15 */
"Create folder or directory", /* 16 */
"Download image from url", /* 17 */
"Open date picker", /* 18 */
"Open time picker", /* 19 */
"Get files count in directory", /* 20 */
"Get date difference", /* 21 */
"Convert string date to dateformat", /* 22 */
"Get device height", /* 23 */
"Get device width", /* 24 */
"Generate random number", /* 25 */
"Postfix for number", /* 26 */
"Convert comma separated string to arraylist and viseversa", /* 27 */
"Music ON OFF", /* 28 */
"Apply blur bffect on image", /* 29 */
"Drawable to bitmap and viceversa", /* 30 */
"Set device volume as app volume", /* 31 */
"Set and get image from preferences", /* 32 */
"Application version", /* 33 */
"Vertical text views", /* 34 */
"Is SDCard available?", /* 35 */
"Show share dialog", /* 36 */
"Change device profile", /* 37 */
"Change bitmap to rounded cornered", /* 38 */
"Show toast", /* 39 */
"Prevent double click", /* 40 */
"Bluetooth/wifi ON OFF", /* 41 */
"Pick/capture/preview image/video and crop image", /* 42 */
"Url validation & ripple effect", /* 43 */
"Contacts with email id & screenshot", /* 44 */
"Social integration", /* 45 */
"Pick color", /* 46 */
"Remote file size or download file" };
ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
sdkFunctionalityList.setAdapter(stringArrayAdapter);
sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
selectedListItem(position);
}
});
sdkFunctionalityList.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
tvText.setText("");
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
}
use of android.widget.ArrayAdapter in project android-app-common-tasks by multidots.
the class MaterialLibrariesListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_library_list);
//Context mContext = MaterialLibrariesListActivity.this;
//Activity mActivity = MaterialLibrariesListActivity.this;
String[] sdkFunctionalityListValue = new String[] { "Material Design Library", /* 0 */
"Drawer Arrow Drawable", /* 1 */
"Material Tabs", /* 2 */
"Pager Sliding Tab Strip", /* 3 */
"Material Ripple", /* 4 */
"Ripple Effect", /* 5 */
"L Drawer", /* 6 */
"Material Design Icons", /* 7 */
"Android Material Design Toolbar", /* 8 */
"Material Edit Text", /* 9 */
"Material Menu", /* 10 */
"Material Dialogs", /* 11 */
"Alert Dialog Pro", /* 12 */
"Material Navigation Drawer", /* 13 */
"Material Dialog", /* 14 */
"Materialish Progress", /* 15 */
"Floating Action Button", /* 16 */
"Android Floating Action Button", /* 17 */
"Snack Bar", /* 18 */
"Circular Reveal", /* 19 */
"Material Range Bar", /* 20 */
"Lollipop AppCompat Widgets Skeleton", /* 21 */
"Carbon", /* 22 */
"Material Calendar View", /* 23 */
"Material", /* 24 */
"Wave View", /* 25 */
"Reside Layout", /* 26 */
"Android Swipe Layout", /* 27 */
"Free Flow", /* 28 */
"Swipe Back Layout", /* 29 */
"Maskable Layout", /* 30 */
"Expandable Layout", /* 31 */
"Android Pull Refresh Layout", /* 32 */
"Tile View", /* 33 */
"Showcase View", /* 34 */
"Ultra Pull To Refresh", /* 35 */
"Android View Hover", /* 36 */
"Draggable Panel", /* 37 */
"Pull to Refresh Rentals Android", /* 38 */
"Pull to Refresh Tours", /* 39 */
"Inbox Layout", /* 40 */
"Swipe Back", /* 41 */
"Arc Layout", /* 42 */
"Dragger", // Buttons
"Circular Progress Button", /* 44 */
"Android Process Button", /* 45 */
"Android Circle Button", /* 46 */
"Android Flat Button", /* 47 */
"Moving Button", "Label View", // List / Grid
"Super Recycler View", "Flabby List View", "Recycler View Sticky Headers", "Parallax List View", "Pull Zoom View", "Swipe Menu List View", "Discroll View", "Sticky List Headers", "List Buddies", "Android Observable Scroll View", "Asymmetric Grid View", "Dynamic Grid", "Android Staggered Grid", "Swipe List View", "Android Parallax Recycler View", "Blur Sticky Header List View", "Recycler View Animators", "Recycler View Flexible Divider", "Android Tree View", "Recycler View Fast Scroller", "Recycler View Multiple View Types Adapter", // ViewPager
"Parallax Pager Transformer", "View Pager Transforms", "Circle Indicator", "Android ViewPager Indicator", "Android Parallax Header ViewPager", "FreePager", "Spring Indicator", "Smart Tab Layout", // Label / Form
"Shimmer Android", "Shimmer for Android", "Titanic", "MatchView", "Android AutoFitTextView", "Secret TextView", "TextJustify Android", "Rounded Letter View", "TextDrawable", "Babushka Text", "Expandable TextView", "Float Labeled EditText" };
ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
sdkFunctionalityList.setAdapter(stringArrayAdapter);
sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
selectedListItem(position);
}
});
}
use of android.widget.ArrayAdapter in project Rashr by DsLNeXuS.
the class FlashFragment method showUnifiedBuildsDialog.
/**
* Check if Device uses a Unified base like some Galaxy S4: htle, htltespr htltexx uses the same
* sources so they can use the unified kernels and recoveries. Let the User choice which one is
* the correct for him. PLEASE BE CAREFUL!
*/
public void showUnifiedBuildsDialog() {
final AppCompatDialog UnifiedBuildsDialog = new AppCompatDialog(mContext);
UnifiedBuildsDialog.setTitle(R.string.make_choice);
final ArrayList<String> DevName = new ArrayList<>();
ArrayList<String> DevNamesCarriers = new ArrayList<>();
UnifiedBuildsDialog.setContentView(R.layout.dialog_unified_build);
ListView UnifiedList = (ListView) UnifiedBuildsDialog.findViewById(R.id.lvUnifiedList);
ArrayAdapter<String> UnifiedAdapter = new ArrayAdapter<>(mContext, android.R.layout.simple_list_item_1, DevNamesCarriers);
if (UnifiedList != null) {
UnifiedList.setAdapter(UnifiedAdapter);
UnifiedList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
UnifiedBuildsDialog.dismiss();
final ProgressDialog reloading = new ProgressDialog(mContext);
reloading.setMessage(mContext.getString(R.string.reloading));
reloading.setCancelable(false);
reloading.show();
new Thread(new Runnable() {
@Override
public void run() {
Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
RashrApp.DEVICE.setName(DevName.get(position));
RashrApp.DEVICE.loadRecoveryList();
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
reloading.dismiss();
mActivity.switchTo(FlashFragment.newInstance(mActivity));
}
});
}
}).start();
}
});
}
if (RashrApp.DEVICE.getManufacture().equals("samsung")) {
String[] unifiedGalaxyS3 = { "d2lte", "d2att", "d2cri", "d2mtr", "d2spr", "d2tmo", "d2usc", "d2vzw" };
String[] unifiedGalaxyNote3 = { "hlte", "hltespr", "hltetmo", "hltevzw", "htlexx" };
String[] unifiedGalaxyS4 = { "jflte", "jflteatt", "jfltecan", "jfltecri", "jfltecsp", "jfltespr", "jfltetmo", "jflteusc", "jfltevzw", "jfltexx", "jgedlte" };
String[] unifiedGalaxyNote4 = { "trlte", "trltecan", "trltedt", "trltexx", "trltespr", "trltetmo", "trltevzw", "trlteusc" };
if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS3)) {
DevName.addAll(Arrays.asList(unifiedGalaxyS3));
} else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS3)) {
DevName.addAll(Arrays.asList(unifiedGalaxyNote3));
} else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyS4)) {
DevName.addAll(Arrays.asList(unifiedGalaxyS4));
} else if (Common.stringEndsWithArray(RashrApp.DEVICE.getName(), unifiedGalaxyNote4)) {
DevName.addAll(Arrays.asList(unifiedGalaxyNote4));
}
}
if (RashrApp.DEVICE.getManufacture().equals("motorola")) {
String[] unifiedMsm8960 = { "moto_msm8960" };
if (RashrApp.DEVICE.getBOARD().equals("msm8960")) {
DevName.addAll(Arrays.asList(unifiedMsm8960));
}
}
for (String i : DevName) {
if (i.contains("att")) {
DevNamesCarriers.add(i + " (AT&T Mobility)");
} else if (i.contains("can")) {
DevNamesCarriers.add(i + " (Canada)");
} else if (i.contains("cri")) {
DevNamesCarriers.add(i + " (Cricket Wireless)");
} else if (i.contains("csp")) {
DevNamesCarriers.add(i + " (C Spire Wireless)");
} else if (i.contains("mtr")) {
DevNamesCarriers.add(i + " (MetroPCS)");
} else if (i.contains("spr")) {
DevNamesCarriers.add(i + " (Sprint Corporation)");
} else if (i.contains("tmo")) {
DevNamesCarriers.add(i + " (T-Mobile US)");
} else if (i.contains("usc")) {
DevNamesCarriers.add(i + " (U.S. Cellular)");
} else if (i.contains("vzw")) {
DevNamesCarriers.add(i + " (Verizon Wireless)");
} else if (i.contains("xx")) {
DevNamesCarriers.add(i + " (International)");
} else if (i.contains("ged")) {
DevNamesCarriers.add(i + " (Google Play Edition)");
} else if (i.contains("dt")) {
DevNamesCarriers.add(i + " (India)");
} else {
DevNamesCarriers.add(i + " (Unified)");
}
}
AppCompatButton KeepCurrent = (AppCompatButton) UnifiedBuildsDialog.findViewById(R.id.bKeepCurrent);
if (KeepCurrent != null) {
KeepCurrent.setText(String.format(getString(R.string.keep_current_name), RashrApp.DEVICE.getName()));
KeepCurrent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
UnifiedBuildsDialog.dismiss();
}
});
}
if (DevName.size() > 0) {
UnifiedBuildsDialog.show();
UnifiedBuildsDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
Common.setBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED, false);
}
});
}
}
Aggregations