List of usage examples for android.widget ListView setScrollBarStyle
@Override public void setScrollBarStyle(int style)
From source file:org.solovyev.android.games.game2048.PreferenceListFragment.java
protected void prepareListView(@Nonnull ListView lv) { lv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); }
From source file:it.gulch.linuxday.android.fragments.PersonInfoListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.no_data)); int contentMargin = getResources().getDimensionPixelSize(R.dimen.content_margin); ListView listView = getListView(); listView.setPadding(contentMargin, contentMargin, contentMargin, contentMargin); listView.setClipToPadding(false);/*from ww w . j av a 2s.c om*/ listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.header_person_info, null); ((TextView) headerView.findViewById(R.id.title)) .setText(person.getCompleteName(Person.CompleteNameEnum.NAME_FIRST)); listView.addHeaderView(headerView, null, false); setListAdapter(adapter); setListShown(false); setupLoaderCallbacks(); }
From source file:com.android.browser.GearsSettingsDialog.java
public void setup() { // First let's add the permissions' resources LOCAL_STORAGE.setResources(R.string.settings_storage_title, R.string.settings_storage_subtitle_on, R.string.settings_storage_subtitle_off); LOCATION_DATA.setResources(R.string.settings_location_title, R.string.settings_location_subtitle_on, R.string.settings_location_subtitle_off); // add the permissions to the list of permissions. mPermissions = new Vector<PermissionType>(); mPermissions.add(LOCAL_STORAGE);/*from www . ja va 2 s . c om*/ mPermissions.add(LOCATION_DATA); OriginPermissions.setListener(this); setupDialog(); // We manage the permissions using three vectors, mSitesPermissions, // mOriginalPermissions and mCurrentPermissions. // The dialog's arguments are parsed and a list of permissions is // generated and stored in those three vectors. // mOriginalPermissions is a separate copy and will not be modified; // mSitesPermissions contains the current permissions _only_ -- // if an origin is removed, it is also removed from mSitesPermissions. // Finally, mCurrentPermissions contains the current permissions and // is a clone of mSitesPermissions, but removed sites aren't removed, // their permissions are simply set to PERMISSION_NOT_SET. This // allows us to easily generate the final difference between the // original permissions and the final permissions, while directly // using mSitesPermissions for the listView adapter (SettingsAdapter). mSitesPermissions = new Vector<OriginPermissions>(); mOriginalPermissions = new Vector<OriginPermissions>(); try { JSONObject json = new JSONObject(mDialogArguments); if (json.has("permissions")) { JSONArray jsonArray = json.getJSONArray("permissions"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject infos = jsonArray.getJSONObject(i); String name = null; int localStorage = PermissionType.PERMISSION_NOT_SET; int locationData = PermissionType.PERMISSION_NOT_SET; if (infos.has("name")) { name = infos.getString("name"); } if (infos.has(LOCAL_STORAGE_STRING)) { JSONObject perm = infos.getJSONObject(LOCAL_STORAGE_STRING); if (perm.has("permissionState")) { localStorage = perm.getInt("permissionState"); } } if (infos.has(LOCATION_DATA_STRING)) { JSONObject perm = infos.getJSONObject(LOCATION_DATA_STRING); if (perm.has("permissionState")) { locationData = perm.getInt("permissionState"); } } OriginPermissions perms = new OriginPermissions(name); perms.setPermission(LOCAL_STORAGE, localStorage); perms.setPermission(LOCATION_DATA, locationData); mSitesPermissions.add(perms); mOriginalPermissions.add(new OriginPermissions(perms)); } } } catch (JSONException e) { Log.e(TAG, "JSON exception ", e); } mCurrentPermissions = (Vector<OriginPermissions>) mSitesPermissions.clone(); View listView = findViewById(R.id.sites_list); if (listView != null) { ListView list = (ListView) listView; mListAdapter = new SettingsAdapter(mActivity, mSitesPermissions); list.setAdapter(mListAdapter); list.setScrollBarStyle(android.view.View.SCROLLBARS_OUTSIDE_INSET); list.setOnItemClickListener(mListAdapter); } if (mDebug) { printPermissions(); } }
From source file:com.juick.android.MessagesFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); LayoutInflater li = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); viewLoading = li.inflate(R.layout.listitem_loading, null); if (!messagesSource.canNext()) { viewLoading.findViewById(R.id.loadingg).setVisibility(View.GONE); viewLoading.findViewById(R.id.end_of_messages).setVisibility(View.VISIBLE); viewLoading.findViewById(R.id.progress_bar).setVisibility(View.GONE); viewLoading.findViewById(R.id.progress_loading_more).setVisibility(View.GONE); }/*w w w . ja v a2 s . co m*/ mRefreshView = (RelativeLayout) li.inflate(R.layout.pull_to_refresh_header, null); mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text); mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image); mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress); mRefreshViewImage.setMinimumHeight(50); mRefreshView.setOnClickListener(this); mRefreshOriginalTopPadding = mRefreshView.getPaddingTop(); mRefreshState = TAP_TO_REFRESH; final ListView listView = getListView(); listView.setBackgroundDrawable(null); listView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); installDividerColor(listView); MainActivity.restyleChildrenOrWidget(listView); listAdapter = new JuickMessagesAdapter(getActivity(), this, JuickMessagesAdapter.TYPE_MESSAGES, allMessages ? JuickMessagesAdapter.SUBTYPE_ALL : JuickMessagesAdapter.SUBTYPE_OTHER); listAdapter.setOnForgetListener(new Utils.Function<Void, JuickMessage>() { @Override public Void apply(final JuickMessage jm) { Network.executeJAHTTPS( getActivity(), null, JA_API_URL + "/pending?command=ignore&mid=" + ((JuickMessageID) jm.getMID()).getMid() + "&rid=" + jm.getRID(), new Utils.Function<Void, RESTResponse>() { @Override public Void apply(final RESTResponse response) { final Activity activity = getActivity(); if (activity == null) return null; // gone. if (response.getErrorText() != null) { activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, response.getErrorText(), Toast.LENGTH_SHORT) .show(); } }); } else { activity.runOnUiThread(new Runnable() { @Override public void run() { listAdapter.remove(jm); //To change body of implemented methods use File | Settings | File Templates. if (listAdapter.getCount() == 0) { if ((activity instanceof MainActivity)) { ((MainActivity) activity).doReload(); } } } }); } return null; } }); return null; } }); listView.setOnTouchListener(this); listView.setOnScrollListener(this); listView.setOnItemClickListener(this); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) { if (view instanceof ImageGallery) { return false; // no need that! (possibly, make this condition work only if not scrolled meanwhile) } final Object itemAtPosition = parent.getItemAtPosition(position); if (itemAtPosition instanceof JuickMessage) { doOnClickActualTime = System.currentTimeMillis(); doOnClick = new Runnable() { @Override public void run() { JuickMessage msg = (JuickMessage) itemAtPosition; MessageMenu messageMenu = MainActivity.getMicroBlog(msg).getMessageMenu(getActivity(), messagesSource, listView, listAdapter); if (messageMenu != null) { messageMenu.onItemLongClick(parent, view, position, id); } else { Toast.makeText(getActivity(), "Not implemented ;-(", Toast.LENGTH_LONG).show(); } } }; if (alternativeLongClick) { listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } else { doOnClick.run(); doOnClick = null; return true; } } return false; } }); listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { System.out.println(); } @Override public void onNothingSelected(AdapterView<?> adapterView) { System.out.println(); } }); init(false); if (parent != null) { parent.onFragmentCreated(); } }
From source file:com.esprit.droidcon.corruption.AutreListActivity.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 ww . ja v a 2 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", "Autre"); 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(AutreListActivity.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("title", corp.getTitle()); i.putExtra("desc", corp.getDesc()); 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(AutreListActivity.this, AutreListActivity.class); startActivity(refresh); finish(); } }); } }
From source file:com.esprit.droidcon.corruption.SiteWebListActivity.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 a 2s . 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", "Site Web"); 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(SiteWebListActivity.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("title", corp.getTitle()); i.putExtra("desc", corp.getDesc()); 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(SiteWebListActivity.this, SiteWebListActivity.class); startActivity(refresh); finish(); } }); } }
From source file:com.esprit.droidcon.corruption.EtatCivileListActivity.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 a 2s .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", "Etat Civil"); 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(EtatCivileListActivity.this, SingleCorruptionActivity.class); i.putExtra("audiourl", corp.getAudiofile()); i.putExtra("longi", corp.getLongi()); i.putExtra("lat", corp.getLat()); i.putExtra("title", corp.getTitle()); i.putExtra("desc", corp.getDesc()); 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(EtatCivileListActivity.this, EtatCivileListActivity.class); startActivity(refresh); finish(); } }); } }
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 ww. j ava 2 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 ww. j av a 2 s . 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(); } }); } }