/** This will be executed in ui thread */ @Override protected void onPostExecute(SimpleAdapter adapter) { /** Getting a reference to listview of main.xml layout file */ final ListView listView = (ListView) findViewById(R.id.venueList); listView.setBackgroundColor(Color.rgb(223, 223, 224)); /** Setting the adapter containing the country list to listview */ listView.setAdapter(adapter); listView.setClickable(true); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { HashMap hm = (HashMap) listView.getItemAtPosition(position); selVenueID = hm.get("id").toString(); selVenueName = hm.get("name").toString(); selVenueLat = hm.get("lat").toString(); selVenueLng = hm.get("lng").toString(); showMovies(listView); } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); list = new ListView(getActivity()); list.setBackgroundColor(Color.WHITE); borrowedBooks = new ArrayList<>(); // Initiate progressbar pb = new ProgressBar(getActivity()); // Init the progressbar pb.setId(1); // Give pb an id pb.setVisibility(View.INVISIBLE); // Set progressbar visibility // Progressbar details RelativeLayout.LayoutParams progressBarDetails = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); progressBarDetails.addRule(RelativeLayout.CENTER_HORIZONTAL); progressBarDetails.addRule(RelativeLayout.CENTER_VERTICAL); if (borrowedBooks.isEmpty()) { try { requestRequests(BookshelfConstants.CONNECTION_URI); } catch (JSONException e) { e.printStackTrace(); } } else { updateDisplay(); } return list; }
/** * Assigns a value to the backgroundColor * * @param color an alpha-red-green-blue integer for a color */ public void setBackgroundColor(int color) { backgroundColor = color; view.setBackgroundColor(backgroundColor); listViewLayout.setBackgroundColor(backgroundColor); // Keeps background color behind list elements correct when scrolling through listView view.setCacheColorHint(backgroundColor); }
void initPopupWindow() { mPopupWindow = new PopupWindow(getApplicationContext()); mPopupAdapter = new HoldDataBaseAdapter<String>() { @Override public View getView(int position, View convertView, ViewGroup parent) { TextView tv = new TextView(getApplicationContext()); int p = DimensionUtls.getPixelFromDpInt(10); tv.setPadding(p, p, p, p); tv.setText(getItem(position)); return tv; } }; ListView lv = new ListView(getApplicationContext()); lv.setAdapter(mPopupAdapter); lv.setBackgroundColor(Color.argb(0xFF, 0x2D, 0x30, 0x37)); mPopupWindow.setContentView(lv); mPopupWindow.setWidth(EpsApplication.getScreenWidth() / 2 - 50); mPopupWindow.setHeight(LayoutParams.WRAP_CONTENT); mPopupWindow.setBackgroundDrawable( new ColorDrawable(getResources().getColor(R.color.transparent))); mPopupWindow.setFocusable(true); mPopupWindow.setOutsideTouchable(true); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mPopupWindow.dismiss(); onClickPopup(mSelectedPos, position); mSelectedPos = -1; } }); }
private View getPopupWindowLayout() { if (contentView == null) { if (lAdapter != null) { contentView = new ListView(context); contentView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); contentView.setCacheColorHint(Color.argb(0, 0, 0, 0)); if (backgroundId != 0) { contentView.setBackgroundResource(backgroundId); } else { contentView.setBackgroundColor(Color.argb(0, 0, 0, 0)); } contentView.setPadding( contentPadding[0], contentPadding[1], contentPadding[2], contentPadding[3]); contentView.setFadingEdgeLength(0); if (divider == null) { contentView.setDivider(null); contentView.setDividerHeight(0); } else { contentView.setDivider(divider); contentView.setDividerHeight(dividerHeight); } contentView.setAdapter(lAdapter); } } return contentView; }
@Override public void onStart() { if (DEBUG_LIFECYCLE) logger.warn("{} onStart()", fullName); super.onStart(); started = true; activity.bind(this); //noinspection deprecation uiLines.setBackgroundColor(0xFF000000 | ColorScheme.get().defaul[ColorScheme.OPT_BG]); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); list_4view = new ListView(this); list_4view.setBackgroundColor(OtherUtils.getColor(255, 204, 255)); list_4view.setAdapter( new ArrayAdapter<String>( this, android.R.layout.simple_expandable_list_item_1, SysConts.datao)); super.setContentView(list_4view); }
@Override public void onStart() { if (DEBUG_LIFECYCLE) logger.debug("onStart()"); super.onStart(); started = true; uiSend.setVisibility(P.showSend ? View.VISIBLE : View.GONE); uiTab.setVisibility(P.showTab ? View.VISIBLE : View.GONE); uiLines.setBackgroundColor(0xFF000000 | ColorScheme.get().defaul[ColorScheme.OPT_BG]); EventBus.getDefault().registerSticky(this); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ListView listView = getListView(); listView.setBackgroundColor(Color.rgb(0, 0, 255)); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu); setListAdapter(adapter); }
/*@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cstudents);*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[] choose = getResources().getStringArray(R.array.pstudents_array); ListView lv = getListView(); LayoutInflater lf; View headerView; lf = this.getLayoutInflater(); headerView = (View) lf.inflate(R.layout.cstudents, null, false); lv.addHeaderView(headerView, null, false); lv.setTextFilterEnabled(true); lv.setBackgroundColor(Color.WHITE); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_content, choose)); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = super.onCreateView(inflater, container, savedInstanceState); ListView listView = (ListView) v.findViewById(R.id.listView); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); listView.setClickable(true); listView.setDivider(null); listView.setDividerHeight(0); listView.setBackgroundColor(getResources().getColor(R.color.grey_lighter)); return v; }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // As this is a native ListFragment I don't have defined a layout for my listView // so I need to customize it by code ListView listView = getListView(); listView.setBackgroundColor(getResources().getColor(R.color.Gray)); // listView.setSelector(R.drawable.apptheme_list_selector_holo_light); // listView.setDivider(new ColorDrawable(Color.WHITE)); // listView.setDividerHeight(3); // 3 pixels height // Restore the previously serialized activated item position. if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); } }
private void ensureList() { if (mList != null) return; mList = new ListView(this); mList.setBackgroundColor(Color.parseColor("#FFFFFF")); mList.setId(android.R.id.list); ViewFlipper viewFlipper = new ViewFlipper(this); viewFlipper.setId(R.id.uv_view_flipper); viewFlipper.addView(mList); setContentView(viewFlipper); mList.setOnItemClickListener(mOnClickListener); if (mFinishedStart) { setListAdapter(mAdapter); } mHandler.post(mRequestFocus); mFinishedStart = true; }
// Feeds initialiseren in listview private View createList(SyndFeed feed, Activity activity) { LinearLayout mainPanel = new LinearLayout(activity); ListView listView = new ListView(activity); final FeedListAdapter feedListAdapter = new FeedListAdapter(activity, feed); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick( AdapterView<?> parentView, View childView, int position, long id) { feedListAdapter.click(position); } }); listView.setAdapter(feedListAdapter); listView.setBackgroundColor(0xFFffeaab); mainPanel.addView(listView); return mainPanel; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle args) { // setContentView(R.layout.activity_my_main); View view1; view1 = inflater.inflate(R.layout.activity_my_main, container, false); ListView view = (ListView) view1.findViewById(R.id.listView1); view.setBackgroundColor(Color.BLACK); imagecustom adapter = new imagecustom(getActivity(), contacts, imageId); /* final imagecustom adapter1 = new imagecustom(raceingpart.this, contacts3, imageId); */ view.setAdapter(adapter); view.setSelector(android.R.color.black); registerForContextMenu(view); view.setOnItemClickListener(clickb); return view1; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_historia_clinica_principal); Intent dato = getIntent(); idOdontologo = dato.getStringExtra("idOdontologo"); ActionBar actionBar = getSupportActionBar(); actionBar.show(); actionBar.setDefaultDisplayHomeAsUpEnabled(true); txtCedulaPaciente = (TextView) findViewById(R.id.txtCedulaPaciente); progressBar = (ProgressBar) findViewById(R.id.progressBar); progressBar.setVisibility(View.INVISIBLE); mPanes = (SlidingPaneLayout) findViewById(R.id.slidingPane); ListView list = (ListView) findViewById(R.id.animalList); adapter = new ListViewAdapter(this, opciones, imgOpciones); list.setAdapter(adapter); list.setBackgroundColor(Color.rgb(178, 223, 219)); list.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: Intent consultorio = new Intent(getApplicationContext(), Consultorio.class); consultorio.putExtra("idOdontologo", idOdontologo); startActivity(consultorio); finish(); break; case 1: Intent infoGeneral = new Intent(getApplicationContext(), InfoGeneral.class); infoGeneral.putExtra("idOdontologo", idOdontologo); startActivity(infoGeneral); finish(); break; } } }); }
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainLayout = (ViewGroup) getLayoutInflater().inflate(R.layout.activity_current_experiments, null); setContentView(mainLayout); ActionBar actionBar = getSupportActionBar(); actionBar.setLogo(R.drawable.ic_launcher); actionBar.setDisplayUseLogoEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setBackgroundDrawable(new ColorDrawable(0xff4A53B3)); // Set up the drawer. mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); navDrawerList = (ListView) mNavigationDrawerFragment.getView().findViewById(R.id.navDrawerList); progressBar = (ProgressBar) findViewById(R.id.findExperimentsProgressBar); // TODO would this work if it is in the Systemchangereceiver ? new RingtoneUtil(this).installPacoBarkRingtone(); userPrefs = new UserPreferences(this); list = (ListView) findViewById(R.id.find_experiments_list); list.setBackgroundColor(333); createListHeader(); invitationLayout = (LinearLayout) findViewById(R.id.announcementLayout); invitationExperimentName = (TextView) findViewById(R.id.invitationExperimentNameTextView); invitationContactTextView = (TextView) findViewById(R.id.invitationContactTextView); invitationCloseButton = (ImageButton) findViewById(R.id.invitationAnnouncementCloseButton); experimentProviderUtil = new ExperimentProviderUtil(this); registerForContextMenu(list); }
/** Applies KitKat specific translucency. */ private void applyKitKatTranslucency() { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { // Calculate ActionBar and navigation bar height. TypedValue tv = new TypedValue(); int actionBarHeight = 0; if (getActivity().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); } mListView.setBackgroundColor(0xFFEEEEEE); mRootView.setPadding(0, actionBarHeight + mApp.getStatusBarHeight(mContext), 0, 0); mListView.setPadding(10, 0, 10, mApp.getNavigationBarHeight(mContext)); mListView.setClipToPadding(false); // Set the window color. getActivity() .getWindow() .setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); } }
/** Displays a list of fragments. */ private void updateFragmentList() { SFL = new ArrayList<StoryFragment>(); HashMap<Integer, StoryFragment> map = SCC.getFragments(); for (Integer key : map.keySet()) { SFL.add(map.get(key)); } String title = SCC.getStory().getStoryInfo().getTitle(); actionBar = getActionBar(); actionBar.setTitle(title); adapter = new ArrayAdapter<StoryFragment>(this, android.R.layout.simple_list_item_1, SFL); ListView listview = new ListView(this); listview.setBackgroundColor(Color.WHITE); listview.setAdapter(adapter); setContentView(listview); registerForContextMenu(listview); listview.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View v, int position, long id) { // remember destination fragment pos = position; // get decision branch label DialogFragment newFragment = new RequestTextDialog(); ((RequestTextDialog) newFragment).setParent(DecisionPickerActivity.this); ((RequestTextDialog) newFragment).setHeader("New Decision Branch Label"); ((RequestTextDialog) newFragment).setWarning("Cannot create branch with empty label."); newFragment.show(getFragmentManager(), "addBranch"); } }); }
void show_task_list(Context context, ListView list_view, Task.Freq task_freq) { SimpleAdapter adapter = new SimpleAdapter( context, task_list_for_view(task_list, task_freq), // t.get_tasks(), R.layout.task_list_item, new String[] {"TaskTitle", "TaskInfo"}, new int[] {R.id.TaskTitle, R.id.TaskInfo}); list_view.setAdapter(adapter); int bg_color = Color.RED; switch (task_freq.value()) { case 0: bg_color = Color.RED; break; case 1: bg_color = Color.BLUE; break; case 2: bg_color = Color.GREEN; break; } list_view.setBackgroundColor(bg_color); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); // Instantiate lists tasks = new ArrayList<>(); tempBookList = new ArrayList<>(); swipe = new SwipeRefreshLayout(getActivity()); // Instantiate listview list = new ListView(getActivity()); // Initiate progressbar for loading pb = new ProgressBar(getActivity()); // Init the progressbar pb.setId(1); // Give pb an id pb.setVisibility(View.INVISIBLE); // Set progressbar visibility // Set details list list.setBackgroundColor(Color.WHITE); list.setMultiChoiceModeListener(multiChoiceHandler); list.setOnItemClickListener(onItemClickHandler); list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); swipe.setOnRefreshListener(refreshListener); try { requestData(BookshelfConstants.CONNECTION_URI); } catch (JSONException e) { e.printStackTrace(); } swipe.addView(list); return swipe; }
/** In dieser Klasse wird die Ansicht erstellt. */ @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // übernimmt und speichert Daten von Activities Intent intent = getIntent(); // uebergibt Daten weiter uebermittelte Daten der vorigen Activity // von Nav_Sicht.java this.vorlesung = intent.getExtras().getString("Vorlesung"); // von Gast_Frage_Sicht.java String raumnum = intent.getExtras().getString("Nummer"); // setzt die View als aktuelle anzusehende View // setContentView(R.layout.cam_nav_sicht); setContentView(R.layout.cam_sicht); ActivityRegistry.register(this); /* * Wifi Manager (Zugriff auf WLan und GPS) */ // Den Service setzen der Activity wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); // der WifiManager wird freigeschaltet wifiWasEnabled = wifi.isWifiEnabled(); // BroadcastReceiver erzeugen und zuweisen wr = new WifiReceiver(this); // IntentFilter i = new IntentFilter(); i.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); registerReceiver(wr, i); // Netzwerk ID setzen // testen ob die beiden unteren Methoden entfernt werden können networkID = wifi.getConnectionInfo().getNetworkId(); wifi.startScan(); /* * Kompass */ sensorService = (SensorManager) getSystemService(Context.SENSOR_SERVICE); sensor = sensorService.getDefaultSensor(Sensor.TYPE_ORIENTATION); if (sensor != null) { sensorService.registerListener( mySensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL); Log.i("Compass MainActivity", "Registerered for ORIENTATION Sensor"); } else { Log.e("Compass MainActivity", "Registerered for ORIENTATION Sensor"); Toast.makeText(this, "ORIENTATION Sensor not found", Toast.LENGTH_LONG).show(); finish(); } // reine Raumnummer setzen z.B. "341" nummer = ""; // In dieser View wird der Raum + die Vorlesung dann gesetzt raum = (TextView) findViewById(R.id.textView_raum); raum.setOnClickListener(this); // dieser Button zeigt an welcher Raum ausgewählt wurde raumnummer = (Button) findViewById(R.id.button_raum); // ist die Vorlesung nicht leer splitte den String und // nehme den Index 1 aus dem Array und setze ihn als Raumnummer if (vorlesung != null) { String[] split = vorlesung.split(" "); nummer = split[1]; raumnummer.setText(nummer); // Vorlesung eintragen raum.setText(vorlesung); } // ist der String Raumnum nicht leer setze ihn als Raumnummer if (raumnum != null) { String[] split = raumnum.split(" "); nummer = split[1]; raumnummer.setText(nummer); // Raum eintragen raum.setText(raumnum); } // EventListener wenn der Button geklickt wird raumnummer.setOnClickListener(this); // EventListener für den Slider slider = (SlidingDrawer) findViewById(R.id.slidingDrawer1); slider.setOnDrawerCloseListener(this); slider.setOnDrawerOpenListener(this); /* * SlideDrawer */ ListView raumOptions = (ListView) findViewById(R.id.list_informations); String[] options = {"Rauminformationen", "Foto", "zur Website", "Raumplan"}; ArrayAdapter<String> optionsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, options); raumOptions.setBackgroundColor(Color.WHITE); raumOptions.setAdapter(optionsAdapter); raumOptions.setOnItemClickListener(this); /* * Kamera */ // In dieser SurfaceView wird das Kamerabild gezeichnet camView = (SurfaceView) findViewById(R.id.surfaceView1); holder = camView.getHolder(); holder.addCallback(this); /* * Richtungspfeil */ pfeil = (ImageView) findViewById(R.id.pfeil_richtung); abstandView = (TextView) findViewById(R.id.text_abstand); /* * Button erstellen */ /* * FLip */ flip_1_2 = (Button) findViewById(R.id.button_1_2); flip_2_1 = (Button) findViewById(R.id.button_2_1); flip_2_3 = (Button) findViewById(R.id.button_2_3); flip_3_2 = (Button) findViewById(R.id.button_3_1); flip_1_2.setOnClickListener(this); flip_2_1.setOnClickListener(this); flip_2_3.setOnClickListener(this); flip_3_2.setOnClickListener(this); flip = (ViewFlipper) findViewById(R.id.viewFlipper1); cam_camp = (TextView) findViewById(R.id.text_campus_cam); camp_cam = (TextView) findViewById(R.id.text_kamera_flip); camp_raum = (TextView) findViewById(R.id.text_raum_info); raum_camp = (TextView) findViewById(R.id.text_campus_z); cam_camp.setOnClickListener(this); camp_raum.setOnClickListener(this); camp_cam.setOnClickListener(this); raum_camp.setOnClickListener(this); }
@SuppressWarnings("unchecked") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); appContext = this; Bundle bun = getIntent().getExtras(); bookList = (ArrayList<String>) bun.get("BookList"); bookImages = (ArrayList<Bitmap>) bun.get("BookImages"); bookDescriptions = (ArrayList<String>) bun.get("BookDescriptions"); authors = getAuthors(bookDescriptions); bookArray = (String[]) bookList.toArray(new String[0]); I = new IconicAdapter(); setListAdapter(I); ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setBackgroundColor(Color.WHITE); lv.setCacheColorHint(Color.WHITE); fileNames = booksInDirectory.list(); lv.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { setPosition(position); Builder builder = new AlertDialog.Builder(appContext); builder.setTitle(bookArray[position]); Drawable d = new BitmapDrawable(bookImages.get(position)); builder.setIcon(d); builder.setMessage(bookDescriptions.get(position)); builder.setPositiveButton( "Download", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { new BookDownloader(showDialog(), bookArray[getPosition()], appContext) .execute(); } }); for (int i = 0; i < fileNames.length; i++) { if (fileNames[i].equals(bookArray[position])) { builder.setPositiveButton( "Delete", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { File deleteDirectory = new File(internalStorage + bookArray[getPosition()]); deleteDir(deleteDirectory); for (int b = 0; b < Global.books.size(); b++) { if (Global.books.get(b).getBookTitle().equals(bookArray[getPosition()])) { Global.books.remove(b); } } updateAdapter(); } }); } } builder.setNegativeButton("Cancel", null); builder.show(); } }); }
public static void openIntermediatePointsDialog( final Activity activity, final OsmandApplication app, final boolean changeOrder) { TargetPointsHelper targets = app.getTargetPointsHelper(); final List<LatLon> intermediates = targets.getIntermediatePointsWithTarget(); final TIntArrayList originalPositions = new TIntArrayList(intermediates.size()); for (int j = 1; j <= intermediates.size(); j++) { originalPositions.add(j); } final List<String> names = targets.getIntermediatePointNamesWithTarget(); final boolean[] checkedIntermediates = new boolean[intermediates.size()]; Arrays.fill(checkedIntermediates, true); final ArrayAdapter<LatLon> listadapter = getListAdapter( app, activity, changeOrder, intermediates, originalPositions, names, checkedIntermediates); ListView lv = new ListView(activity); View contentView = lv; final ProgressBar pb = new ProgressBar(activity); pb.setVisibility(View.GONE); final TextView textInfo = new TextView(activity); textInfo.setText(R.string.intermediate_items_sort_return); textInfo.setVisibility(View.GONE); if (changeOrder) { LinearLayout ll = new LinearLayout(activity); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(lv); ll.addView(pb); ll.addView(textInfo); contentView = ll; // lv.addFooterView(pb); // lv.addFooterView(textInfo); } lv.setAdapter(listadapter); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (activity instanceof MapActivity) { // AnimateDraggingMapThread thread = // mapActivity.getMapView().getAnimatedDraggingThread(); LatLon pointToNavigate = intermediates.get(position); int fZoom = ((MapActivity) activity).getMapView().getZoom() < 15 ? 15 : ((MapActivity) activity).getMapView().getZoom(); // thread.startMoving(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(), // fZoom, true); ((MapActivity) activity).getMapView().setIntZoom(fZoom); ((MapActivity) activity) .getMapView() .setLatLon(pointToNavigate.getLatitude(), pointToNavigate.getLongitude()); listadapter.notifyDataSetInvalidated(); } } }); Builder builder = new AccessibleAlertBuilder(activity); builder.setView(contentView); builder.setInverseBackgroundForced(true); lv.setBackgroundColor(Color.WHITE); builder.setPositiveButton( R.string.default_buttons_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (changeOrder) { commitChangePointsOrder(app, intermediates, names); } else { commitPointsRemoval(app, checkedIntermediates); } } }); if (!changeOrder && intermediates.size() > 1) { builder.setNeutralButton( R.string.intermediate_points_change_order, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { openIntermediatePointsDialog(activity, app, true); } }); } else if (intermediates.size() > 1) { builder.setNeutralButton( R.string.intermediate_items_sort_by_distance, new Dialog.OnClickListener() { @Override public void onClick(DialogInterface d, int which) { // Do nothing here. We override the onclick } }); } AlertDialog dlg = builder.create(); if (changeOrder) { applySortTargets( dlg, activity, intermediates, originalPositions, names, listadapter, pb, textInfo); } dlg.show(); }
/** * Called when the activity is first created. Sets up the view. * * @param savedInstanceState Um I don't even know. Read the Android documentation. */ @Override public void onCreate(Bundle savedInstanceState) { String TAG = StaticBlob.TAG(); if (android.os.Build.VERSION.SDK_INT >= 11) setTheme(R.style.Default_New); // General create stuff super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); Log.v(TAG, "Launching Activity"); mainListView = new ListView(this); Callisto.build_layout(this, mainListView); // Get the settings for this show currentShow = getIntent().getExtras().getString("current_show"); currentShowAudio = getIntent().getExtras().getString("current_show_audio"); currentShowVideo = getIntent().getExtras().getString("current_show_video"); showSettings = getSharedPreferences(currentShow, 0); filter = showSettings.getBoolean("filter", false); loading = (TextView) findViewById(android.R.id.empty); // If it has been checked before but there are no episodes, show that it is empty, not just // loading. if (StaticBlob.databaseConnector.getShow(currentShow, filter).getCount() == 0) loading.setText(this.getResources().getString(R.string.list_empty)); else loading.setText(this.getResources().getString(R.string.loading)); loading.setGravity(Gravity.CENTER_HORIZONTAL); // If it has never been checked before add a refresh button if (showSettings.getString("last_checked", null) == null) { refresh = new Button(this); refresh.setText(this.getResources().getString(R.string.refresh)); refresh.setTextColor(this.getResources().getColor(R.color.txtClr)); LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); p.setMargins(20, 10, 20, 10); refresh.setLayoutParams(p); ((LinearLayout) loading.getParent()).setGravity(Gravity.CENTER_HORIZONTAL); refresh.setPadding(100, 10, 100, 10); refresh.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { reload(); } }); ((LinearLayout) mainListView.getParent()).addView(refresh, 1); ((LinearLayout) mainListView.getParent()) .setBackgroundColor(this.getResources().getColor(R.color.backClr)); mainListView.setEmptyView(refresh); loading.setVisibility(View.INVISIBLE); } else { mainListView.setEmptyView(loading); } // Finish setting up the listview mainListView.setOnItemClickListener(selectEpisode); mainListView.setBackgroundColor(getResources().getColor(R.color.backClr)); mainListView.setCacheColorHint(getResources().getColor(R.color.backClr)); setTitle(currentShow); // Get the shows from the SQL; make it async because of reasons new GetShowTask().execute((Object[]) null); Cursor r = StaticBlob.databaseConnector.getShow(currentShow, filter); showAdapter = new ShowListCursorAdapter(ShowList.this, R.layout.row, r); mainListView.setAdapter(showAdapter); return; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); String pesan; if (mBluetoothAdapter == null) { pesan = "Tidak ada bluetooth!"; finish(); // keluar } else { pesan = "Ada bluetooth!"; } Toast toast = Toast.makeText(getApplicationContext(), pesan, Toast.LENGTH_LONG); toast.show(); // init listview ListView lv = (ListView) findViewById(R.id.listView); // set warna abu2, karena default font adalah putih lv.setBackgroundColor(Color.LTGRAY); adapter = new ArrayAdapter(this, android.R.layout.simple_expandable_list_item_1, items); lv.setAdapter(adapter); tampilkanPaired(); if (!mBluetoothAdapter.isEnabled()) { // bluetooth dalam kondisi off // menampilkan dialog untuk menyalakan bluetooth (jika sedang mati) // setelah user memilih method onActivityResult akan ditrigger Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); } // mulai android 6, device discovery bluetooth perlu ijin lokasi if (ContextCompat.checkSelfPermission( this, // hati2, jika konstanta tidak cocok, tidak ada runtimeerror Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions( this, new String[] {Manifest.permission.ACCESS_COARSE_LOCATION}, MY_PERMISSIONS_REQUEST); // MY_PERMISSIONS_REQUEST adalah konstanta, nanti digunakan di onRequestPermissionsResult } else { // sudah diijinkan isIjinLokasi = true; } tvHasil = (TextView) findViewById(R.id.tvHasil); // siapkan onclik pada listview // artinya client menghubungi server lvServer = (ListView) findViewById(R.id.listView); lvServer.setClickable(true); lvServer.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { BluetoothDevice devicePilih = arrayPairedDevices.get(position); client(devicePilih); } }); }
public void populateList(boolean all) { try { ListView lv = new ListView(this); List sts; if (all) { sts = mDbHelper.getMemory(); } else { sts = mDbHelper.getMemory(hOverlay.getRadius()); } green = R.drawable.green_gradient; yellow = R.drawable.yellow_gradient; red = R.drawable.red_gradient; ArrayAdapter adapter = new ArrayAdapter(this, R.layout.stations_list_item, sts) { LayoutInflater mInflater = getLayoutInflater(); @Override public View getView(int position, View convertView, ViewGroup parent) { View row; if (convertView == null) { row = mInflater.inflate(R.layout.stations_list_item, null); } else { row = convertView; } StationOverlay tmp = (StationOverlay) getItem(position); TextView stId = (TextView) row.findViewById(R.id.station_list_item_id); stId.setText(tmp.getStation().getName()); TextView stOc = (TextView) row.findViewById(R.id.station_list_item_ocupation); stOc.setText(tmp.getStation().getOcupation()); TextView stDst = (TextView) row.findViewById(R.id.station_list_item_distance); stDst.setText(tmp.getStation().getDistance()); TextView stWk = (TextView) row.findViewById(R.id.station_list_item_walking_time); stWk.setText(tmp.getStation().getWalking()); int bg; switch (tmp.getState()) { case StationOverlay.GREEN_STATE: bg = green; break; case StationOverlay.RED_STATE: bg = red; break; case StationOverlay.YELLOW_STATE: bg = yellow; break; default: bg = R.drawable.fancy_gradient; } LinearLayout sq = (LinearLayout) row.findViewById(R.id.station_list_item_square); sq.setBackgroundResource(bg); row.setId(tmp.getStation().getId()); return row; } }; lv.setAdapter(adapter); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { int pos = v.getId(); if (pos != -1) { StationOverlay selected = stations.findById(pos); if (selected != null) { stations.setCurrent(selected.getPosition(), getBike); Message tmp = new Message(); tmp.what = InfoLayer.POPULATE; tmp.arg1 = selected.getPosition(); infoLayerPopulator.dispatchMessage(tmp); mapView.getController().animateTo(selected.getCenter()); int height = arg0.getHeight(); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int w_height = dm.heightPixels; if (height > w_height / 2) { mSlidingDrawer.animateClose(); } } } } }); lv.setBackgroundColor(Color.BLACK); lv.setLayoutParams( new LayoutParams( android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); fl.setBackgroundColor(Color.BLACK); fl.removeAllViews(); fl.addView(lv); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int height = dm.heightPixels; int calc = (lv.getCount() * 50) + 45; if (calc > height - 145) calc = height - 145; else if (lv.getCount() == 0) calc = 0; mSlidingDrawer.setLayoutParams( new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, calc)); //// Log.i("openBicing", Integer.toString(fl.getHeight())); } catch (Exception e) { ////// Log.i("openBicing", "SHIT THIS SUCKS MEN ARGH F**K IT!"); // TODO Auto-generated catch block e.printStackTrace(); } }
/** Setup Sliding Drawer with List */ public void setupItemDrawer() { ccartList = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice); for (int i = 0; i < ccart.size(); i++) { GroceryItem temp = ccart.get(i); ccartList.add(String.valueOf(temp.getQuantity()) + " " + temp.getItemName()); } // set properties of the list view and populate the listview sd_list.setAdapter(ccartList); sd_list.setBackgroundColor(Color.WHITE); sd_list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); sd_list.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SparseBooleanArray listItems = new SparseBooleanArray(); listItems.clear(); listItems = sd_list.getCheckedItemPositions(); adb = new AccountDatabaseHelper(CartActivity.this); int groceryCount = adb.getGroceryCountFor(currentUsername); adb.close(); if (groceryCount == 1) { added.setText(groceryCount + " ITEM IN CART"); } else if (groceryCount == 0 || groceryCount > 1) { added.setText(groceryCount + " ITEMS IN CART"); } if (selectedItems != null || quantities != null) { selectedItems.clear(); quantities.clear(); deleteAndQuantityButtonsDisabled(); } else { selectedItems = new ArrayList<Item>(); quantities = new ArrayList<Integer>(); deleteAndQuantityButtonsDisabled(); } boolean isSelected = false; for (int i = 0; i < ccartList.getCount(); i++) { isSelected = listItems.get(i); if (isSelected) { String tempItemName = ccartList.getItem(i); int pos = tempItemName.indexOf(" "); String selectedItemName = tempItemName.substring(pos + 1); Item selectedItem = ndb.getItem(selectedItemName); selectedItems.add(selectedItem); for (GroceryItem gItem : ccart) { if (gItem.getItemName().equals(selectedItemName)) { quantities.add(gItem.getQuantity()); } } ndb.close(); } } if (selectedItems.size() == 1) { String itemOne; if (selectedItems.get(0).getItemName().length() > 20) { itemOne = selectedItems.get(0).getItemName().substring(0, 20) + "..."; } else { itemOne = selectedItems.get(0).getItemName(); } String one = "<font color='#7EAD1A'>" + itemOne + "</font> SELECTED"; added.setText(Html.fromHtml(one)); graph.invalidate(); deleteAndQuantityButtonsEnabled(); } else if (selectedItems.size() == 2) { String itemOne; String itemTwo; if (selectedItems.get(0).getItemName().length() > 16) { itemOne = selectedItems.get(0).getItemName().substring(0, 16) + "..."; } else { itemOne = selectedItems.get(0).getItemName(); } if (selectedItems.get(1).getItemName().length() > 16) { itemTwo = selectedItems.get(1).getItemName().substring(0, 16) + "..."; } else { itemTwo = selectedItems.get(1).getItemName(); } String two = "COMPARE <font color='#7EAD1A'>" + itemOne + "</font>" + " VS <font color='#00CCFF'>" + itemTwo + "</font>"; added.setText(Html.fromHtml(two)); graph.invalidate(); deleteAndQuantityButtonsDisabled(); } else if (selectedItems.size() == 3) { String tempItemName = ccartList.getItem(position); int pos = tempItemName.indexOf(" "); String toggledItemName = tempItemName.substring(pos + 1); Item iToRemove = null; for (Item item : selectedItems) { if (item.getItemName().equals(toggledItemName)) { iToRemove = item; } } selectedItems.remove(iToRemove); Log.d("CartActivity", "Removed: " + iToRemove.getItemName()); sd_list.setItemChecked(position, false); deleteAndQuantityButtonsDisabled(); } graph.passSelectedItems(selectedItems); graph.passSelectedQuantities(quantities); } }); // for the sliding drawer in footer activity // populates controls the sliding drawer sd_itemlist.setOnDrawerOpenListener( new OnDrawerOpenListener() { public void onDrawerOpened() { handle.setBackgroundDrawable(getResources().getDrawable(R.drawable.cart_tab_down)); } }); sd_itemlist.setOnDrawerCloseListener( new OnDrawerCloseListener() { public void onDrawerClosed() { handle.setBackgroundDrawable(getResources().getDrawable(R.drawable.cart_tab)); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_listview_travel); if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } listview = (ListView) findViewById(R.id.listView); edittext1 = (EditText) findViewById(R.id.EditText01); temp = getHTML("http://10.71.20.46/attraction/select_all.php").split("/"); System.out.println(temp[0]); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arraylist); if (temp.length < 1) { System.out.println("temp = null" + temp.length); Toast.makeText(getApplicationContext(), "ไม่มีข้อมูล", Toast.LENGTH_SHORT).show(); finish(); } else { System.out.println("temp = not null" + temp.length); for (int i = 0; i < temp.length; i++) { arraylist.add(temp[i]); } } listview.setAdapter(adapter); listview.setBackgroundColor(Color.WHITE); edittext1.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub listview_travel.this.adapter.getFilter().filter(s); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); listview.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub String item = arg0.getAdapter().getItem(arg2).toString(); Toast.makeText(getApplicationContext(), "" + item, Toast.LENGTH_SHORT).show(); // intent Intent i = new Intent(getApplicationContext(), show_travel.class); i.putExtra("item", item); startActivity(i); } }); }