List of usage examples for android.widget ListView setDivider
public void setDivider(@Nullable Drawable divider)
From source file:com.esprit.droidcon.corruption.RelationListActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maillist_layout); imageLoader = ImageLoader.getInstance(); imageLoader.init(ImageLoaderConfiguration.createDefault(this)); retry = (Button) findViewById(R.id.retry); ButterKnife.bind(this); mBackground = mImageView;//from w w w. j a v a2 s . co m moveBackground(); initToolbar(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); connexionlay = (RelativeLayout) findViewById(R.id.connexionlay); mang = new ArrayList<>(); final ListView listView = (ListView) findViewById(R.id.list_view); final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo(); if (activeNetwork != null && activeNetwork.isConnected()) { connexionlay.setVisibility(View.GONE); // notify user you are online final ParseQuery<ParseObject> query = ParseQuery.getQuery("Corruption"); query.whereEqualTo("Type", "Relation Avec Le Cityoen"); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> conThus, ParseException e) { if (e == null) { //Log.d("score", "Retrieved " + scoreList.size() + " scores"); for (int i = conThus.size() - 1; i > 0; i--) { ParseObject dong = conThus.get(i); //System.out.println(dong.getParseFile("ImageFile").toString()); if (dong.getParseFile("AudioFile") != null) { mang.add(new Corruption(dong.getString("Title"), dong.getString("Description"), dong.getString("Date"), dong.getString("Adress"), dong.getParseFile("Photo1").getUrl(), dong.getParseFile("Photo2").getUrl(), dong.getParseFile("Photo3").getUrl(), dong.getParseFile("AudioFile").getUrl(), dong.getDouble("Long"), dong.getDouble("Lat"), dong.getString("Heure"), dong.getString("Ville"), dong.getString("UserNom"), dong.getString("UserAdress"), dong.getString("UserTel"), dong.getString("UserMail"), dong.getString("Type"), dong.getString("VideoCode"), dong.getString("Etat") )); mGoogleCardsAdapter = new GoogleCardsTravelAdapter(getApplicationContext(), mang); SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( mGoogleCardsAdapter); swingBottomInAnimationAdapter.setAbsListView(listView); assert swingBottomInAnimationAdapter.getViewAnimator() != null; swingBottomInAnimationAdapter.getViewAnimator() .setInitialDelayMillis(INITIAL_DELAY_MILLIS); listView.setClipToPadding(false); listView.setDivider(null); Resources r = getResources(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); listView.setDividerHeight(px); listView.setFadingEdgeLength(0); listView.setFitsSystemWindows(true); px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics()); listView.setPadding(px, px, px, px); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setAdapter(swingBottomInAnimationAdapter); /* SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( new SwipeDismissAdapter(mGoogleCardsAdapter, this)); swingBottomInAnimationAdapter.setAbsListView(listView);*/ } else { mang.add(new Corruption(dong.getString("Title"), dong.getString("Description"), dong.getString("Date"), dong.getString("Adress"), dong.getParseFile("Photo1").getUrl(), dong.getParseFile("Photo2").getUrl(), dong.getParseFile("Photo3").getUrl(), dong.getDouble("Long"), dong.getDouble("Lat"), dong.getString("Heure"), dong.getString("Ville"), dong.getString("UserNom"), dong.getString("UserAdress"), dong.getString("UserTel"), dong.getString("UserMail"), dong.getString("Type"), dong.getString("VideoCode"), dong.getString("Etat") )); mGoogleCardsAdapter = new GoogleCardsTravelAdapter(getApplicationContext(), mang); SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( mGoogleCardsAdapter); swingBottomInAnimationAdapter.setAbsListView(listView); assert swingBottomInAnimationAdapter.getViewAnimator() != null; swingBottomInAnimationAdapter.getViewAnimator() .setInitialDelayMillis(INITIAL_DELAY_MILLIS); listView.setClipToPadding(false); listView.setDivider(null); Resources r = getResources(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); listView.setDividerHeight(px); listView.setFadingEdgeLength(0); listView.setFitsSystemWindows(true); px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics()); listView.setPadding(px, px, px, px); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setAdapter(swingBottomInAnimationAdapter); } } } else { Log.d("score", "Error: " + e.getMessage()); Toast.makeText(getApplicationContext(), "Error: " + e.getMessage(), Toast.LENGTH_LONG) .show(); } } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Corruption corp = (Corruption) parent.getItemAtPosition(position); SwipeImageAdapter.img1 = corp.getImage1(); SwipeImageAdapter.img2 = corp.getImage2(); SwipeImageAdapter.img3 = corp.getImage3(); SwipeImageAdapter.title = corp.getTitle(); SwipeImageAdapter.desc = corp.getDesc(); //prodimg = prod.getProductImage(); Intent i = new Intent(RelationListActivity.this, SingleCorruptionActivity.class); i.putExtra("audiourl", corp.getAudiofile()); i.putExtra("longi", corp.getLongi()); i.putExtra("lat", corp.getLat()); i.putExtra("date", corp.getDate()); i.putExtra("heure", corp.getHeure()); i.putExtra("ville", corp.getVille()); i.putExtra("title", corp.getTitle()); i.putExtra("desc", corp.getDesc()); i.putExtra("usernom", corp.getUserNom()); i.putExtra("useradress", corp.getUserAdress()); i.putExtra("usertel", corp.getUserTel()); i.putExtra("usermail", corp.getUserMail()); i.putExtra("type", corp.getType()); i.putExtra("videocode", corp.getVideo()); i.putExtra("etat", corp.getEtat()); startActivity(i); finish(); } }); } else { // notify user you are not online connexionlay.setVisibility(View.VISIBLE); retry.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // fabProgressCircle.show(); // startYourAsynchronousJob(); Intent refresh = new Intent(RelationListActivity.this, RelationListActivity.class); startActivity(refresh); finish(); } }); } }
From source file:com.esprit.droidcon.corruption.MusicNewsActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maillist_layout); imageLoader = ImageLoader.getInstance(); imageLoader.init(ImageLoaderConfiguration.createDefault(this)); retry = (Button) findViewById(R.id.retry); ButterKnife.bind(this); mBackground = mImageView;//w w w .j a v a2s. c o m moveBackground(); initToolbar(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); connexionlay = (RelativeLayout) findViewById(R.id.connexionlay); mang = new ArrayList<>(); final ListView listView = (ListView) findViewById(R.id.list_view); final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo(); if (activeNetwork != null && activeNetwork.isConnected()) { connexionlay.setVisibility(View.GONE); // notify user you are online final ParseQuery<ParseObject> query = ParseQuery.getQuery("Corruption"); query.whereEqualTo("Type", "Bureau d ordre"); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> conThus, ParseException e) { if (e == null) { //Log.d("score", "Retrieved " + scoreList.size() + " scores"); for (int i = conThus.size() - 1; i > 0; i--) { ParseObject dong = conThus.get(i); //System.out.println(dong.getParseFile("ImageFile").toString()); if (dong.getParseFile("AudioFile") != null) { mang.add(new Corruption(dong.getString("Title"), dong.getString("Description"), dong.getString("Date"), dong.getString("Adress"), dong.getParseFile("Photo1").getUrl(), dong.getParseFile("Photo2").getUrl(), dong.getParseFile("Photo3").getUrl(), dong.getParseFile("AudioFile").getUrl(), dong.getDouble("Long"), dong.getDouble("Lat"), dong.getString("Heure"), dong.getString("Ville"), dong.getString("UserNom"), dong.getString("UserAdress"), dong.getString("UserTel"), dong.getString("UserMail"), dong.getString("Type"), dong.getString("VideoCode"), dong.getString("Etat") )); mGoogleCardsAdapter = new GoogleCardsTravelAdapter(getApplicationContext(), mang); SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( mGoogleCardsAdapter); swingBottomInAnimationAdapter.setAbsListView(listView); assert swingBottomInAnimationAdapter.getViewAnimator() != null; swingBottomInAnimationAdapter.getViewAnimator() .setInitialDelayMillis(INITIAL_DELAY_MILLIS); listView.setClipToPadding(false); listView.setDivider(null); Resources r = getResources(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); listView.setDividerHeight(px); listView.setFadingEdgeLength(0); listView.setFitsSystemWindows(true); px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics()); listView.setPadding(px, px, px, px); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setAdapter(swingBottomInAnimationAdapter); /* SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( new SwipeDismissAdapter(mGoogleCardsAdapter, this)); swingBottomInAnimationAdapter.setAbsListView(listView);*/ } else { mang.add(new Corruption(dong.getString("Title"), dong.getString("Description"), dong.getString("Date"), dong.getString("Adress"), dong.getParseFile("Photo1").getUrl(), dong.getParseFile("Photo2").getUrl(), dong.getParseFile("Photo3").getUrl(), dong.getDouble("Long"), dong.getDouble("Lat"), dong.getString("Heure"), dong.getString("Ville"), dong.getString("UserNom"), dong.getString("UserAdress"), dong.getString("UserTel"), dong.getString("UserMail"), dong.getString("Type"), dong.getString("VideoCode"), dong.getString("Etat") )); mGoogleCardsAdapter = new GoogleCardsTravelAdapter(getApplicationContext(), mang); SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( mGoogleCardsAdapter); swingBottomInAnimationAdapter.setAbsListView(listView); assert swingBottomInAnimationAdapter.getViewAnimator() != null; swingBottomInAnimationAdapter.getViewAnimator() .setInitialDelayMillis(INITIAL_DELAY_MILLIS); listView.setClipToPadding(false); listView.setDivider(null); Resources r = getResources(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); listView.setDividerHeight(px); listView.setFadingEdgeLength(0); listView.setFitsSystemWindows(true); px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics()); listView.setPadding(px, px, px, px); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setAdapter(swingBottomInAnimationAdapter); } } } else { Log.d("score", "Error: " + e.getMessage()); Toast.makeText(getApplicationContext(), "Error: " + e.getMessage(), Toast.LENGTH_LONG) .show(); } } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Corruption corp = (Corruption) parent.getItemAtPosition(position); SwipeImageAdapter.img1 = corp.getImage1(); SwipeImageAdapter.img2 = corp.getImage2(); SwipeImageAdapter.img3 = corp.getImage3(); SwipeImageAdapter.title = corp.getTitle(); SwipeImageAdapter.desc = corp.getDesc(); //prodimg = prod.getProductImage(); Intent i = new Intent(MusicNewsActivity.this, SingleCorruptionActivity.class); i.putExtra("audiourl", corp.getAudiofile()); i.putExtra("longi", corp.getLongi()); i.putExtra("title", corp.getTitle()); i.putExtra("desc", corp.getDesc()); i.putExtra("photourl", corp.getImage1()); i.putExtra("lat", corp.getLat()); i.putExtra("date", corp.getDate()); i.putExtra("heure", corp.getHeure()); i.putExtra("ville", corp.getVille()); i.putExtra("usernom", corp.getUserNom()); i.putExtra("useradress", corp.getUserAdress()); i.putExtra("usertel", corp.getUserTel()); i.putExtra("usermail", corp.getUserMail()); i.putExtra("type", corp.getType()); i.putExtra("videocode", corp.getVideo()); i.putExtra("etat", corp.getEtat()); startActivity(i); finish(); } }); } else { // notify user you are not online connexionlay.setVisibility(View.VISIBLE); retry.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // fabProgressCircle.show(); // startYourAsynchronousJob(); Intent refresh = new Intent(MusicNewsActivity.this, MusicNewsActivity.class); startActivity(refresh); finish(); } }); } }