List of usage examples for android.widget ListView setDividerHeight
public void setDividerHeight(int height)
From source file:com.kncwallet.wallet.ui.SendCoinsFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.send_coins_fragment, container, false); contactsListView = (ListView) view.findViewById(R.id.send_coins_contacts_list); viewBalanceBtc = (CurrencyTextView) view.findViewById(R.id.wallet_balance_btc); txText = (EditText) view.findViewById(R.id.send_coins_text); viewBalanceLocal = (CurrencyTextView) view.findViewById(R.id.wallet_balance_local); viewBalanceLocal.setPrecision(Constants.LOCAL_PRECISION, 0); viewBalanceLocal.setStrikeThru(Constants.TEST); viewBalanceBtc.setOnClickListener(new OnClickListener() { @Override/*w ww . j av a2 s . co m*/ public void onClick(final View v) { SendCoinsFragment.this.switchBalance(); } }); viewBalanceLocal.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { SendCoinsFragment.this.switchBalance(); } }); receivingAddressView = (AutoCompleteTextView) view.findViewById(R.id.send_coins_receiving_address); receivingAddressView.setAdapter(new AutoCompleteAddressAdapter(activity, null)); receivingAddressView.setOnFocusChangeListener(receivingAddressListener); receivingAddressView.addTextChangedListener(receivingAddressListener); receivingStaticView = view.findViewById(R.id.send_coins_receiving_static); receivingStaticAddressView = (TextView) view.findViewById(R.id.send_coins_receiving_static_address); receivingStaticLabelView = (TextView) view.findViewById(R.id.send_coins_receiving_static_label); receivingStaticView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { startReceivingAddressActionMode(); } else { clearActionMode(); } } }); btcAmountView = (CurrencyAmountView) view.findViewById(R.id.send_coins_amount_btc); btcAmountView.setCurrencySymbol(DenominationUtil.getCurrencyCode(btcShift)); btcAmountView.setInputPrecision(DenominationUtil.getMaxPrecision(btcShift)); btcAmountView.setHintPrecision(btcPrecision); btcAmountView.setShift(btcShift); final CurrencyAmountView localAmountView = (CurrencyAmountView) view .findViewById(R.id.send_coins_amount_local); localAmountView.setInputPrecision(Constants.LOCAL_PRECISION); localAmountView.setHintPrecision(Constants.LOCAL_PRECISION); amountCalculatorLink = new CurrencyCalculatorLink(btcAmountView, localAmountView); bluetoothEnableView = (CheckBox) view.findViewById(R.id.send_coins_bluetooth_enable); bluetoothEnableView.setChecked(bluetoothAdapter != null && bluetoothAdapter.isEnabled()); bluetoothEnableView.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { if (isChecked && !bluetoothAdapter.isEnabled()) { // try to enable bluetooth startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), REQUEST_CODE_ENABLE_BLUETOOTH); } } }); bluetoothMessageView = (TextView) view.findViewById(R.id.send_coins_bluetooth_message); sentTransactionView = (ListView) view.findViewById(R.id.send_coins_sent_transaction); sentTransactionListAdapter = new TransactionsListAdapter(activity, wallet, application.maxConnectedPeers(), false); sentTransactionView.setAdapter(sentTransactionListAdapter); viewGo = (Button) view.findViewById(R.id.send_coins_go); viewGo.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { validateReceivingAddress(true); validateAmounts(true); if (everythingValid()) handleGo(); } }); if (savedInstanceState != null) { restoreInstanceState(savedInstanceState); } else { final Intent intent = activity.getIntent(); final String action = intent.getAction(); final Uri intentUri = intent.getData(); final String scheme = intentUri != null ? intentUri.getScheme() : null; if ((Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) && intentUri != null && "bitcoin".equals(scheme)) initStateFromBitcoinUri(intentUri); else if (intent.hasExtra(SendCoinsFragment.INTENT_EXTRA_ADDRESS)) initStateFromIntentExtras(intent.getExtras()); } TextView header = ((TextView) view.findViewById(R.id.header_text)); header.setText(R.string.send_heading); contactListAdapter = new SimpleCursorAdapter(activity, R.layout.address_book_row_small, null, new String[] { AddressBookProvider.KEY_ADDRESS, AddressBookProvider.KEY_LABEL, AddressBookProvider.KEY_ADDRESS, AddressBookProvider.KEY_ADDRESS }, new int[] { R.id.address_book_contact_image, R.id.address_book_row_label, R.id.address_book_row_address, R.id.address_book_row_source_image }); contactListAdapter.setViewBinder(new ViewBinder() { @Override public boolean setViewValue(final View view, final Cursor cursor, final int columnIndex) { if (view.getId() == R.id.address_book_contact_image) { //... SmartImageView img = (SmartImageView) view; //img.setImageBitmap(bm); String address = cursor.getString(columnIndex); Bitmap contactImage = AddressBookProvider.bitmapForAddress(SendCoinsFragment.this.getActivity(), address); if (contactImage != null) { img.setImageBitmap(contactImage); } else { String imageUrl = ContactImage.getImageUrl(activity, AddressBookProvider.resolveRowId(activity, address)); if (imageUrl != null) { img.setImageUrl(imageUrl, R.drawable.contact_placeholder); } else { img.setImageResource(R.drawable.contact_placeholder); } } return true; //true because the data was bound to the view } else if (view.getId() == R.id.address_book_row_source_image) { ((ImageView) view).setImageResource(cachedSourceImageResource(cursor.getString(columnIndex))); return true; } //Constants.ADDRESS_FORMAT_LINE_SIZE)); return false; } }); boolean smallScreen = getResources().getBoolean(R.bool.values_small); if (!smallScreen) { ListView list = (ListView) contactsListView; Drawable divider = getResources().getDrawable(R.drawable.transaction_list_divider); list.setDivider(divider); list.setDividerHeight(1); list.setAdapter(contactListAdapter); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //to save a lookup TextView addr = (TextView) view.findViewById(R.id.address_book_row_address); TextView label = (TextView) view.findViewById(R.id.address_book_row_label); if (setSendAddress(addr.getText().toString(), label.getText().toString())) { startReceivingAddressActionMode(); } else { informInvalidAddress(addr.getText().toString(), label.getText().toString()); } } }); } else { contactsListView.setVisibility(View.GONE); } return view; }
From source file:org.cafemember.ui.LaunchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Date now = new Date(); /*int year = now.getYear(); int month = now.getMonth();//from ww w . ja va2 s.co m int day = now.getDay(); now.getDate(); long curr = 147083220000l; if(System.currentTimeMillis() > curr ){ Toast.makeText(this," . ? ",Toast.LENGTH_LONG).show(); finish(); }*/ ApplicationLoader.postInitApplication(); NativeCrashManager.handleDumpFiles(this); if (!UserConfig.isClientActivated()) { Intent intent = getIntent(); if (intent != null && intent.getAction() != null && (Intent.ACTION_SEND.equals(intent.getAction()) || intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE))) { super.onCreate(savedInstanceState); finish(); return; } if (intent != null && !intent.getBooleanExtra("fromIntro", false)) { SharedPreferences preferences = ApplicationLoader.applicationContext .getSharedPreferences("logininfo2", MODE_PRIVATE); Map<String, ?> state = preferences.getAll(); if (state.isEmpty()) { Intent intent2 = new Intent(this, IntroActivity.class); startActivity(intent2); super.onCreate(savedInstanceState); finish(); return; } } } requestWindowFeature(Window.FEATURE_NO_TITLE); setTheme(R.style.Theme_TMessages); getWindow().setBackgroundDrawableResource(R.drawable.transparent); super.onCreate(savedInstanceState); Theme.loadRecources(this); if (UserConfig.passcodeHash.length() != 0 && UserConfig.appLocked) { UserConfig.lastPauseTime = ConnectionsManager.getInstance().getCurrentTime(); } int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { AndroidUtilities.statusBarHeight = getResources().getDimensionPixelSize(resourceId); } actionBarLayout = new ActionBarLayout(this); drawerLayoutContainer = new DrawerLayoutContainer(this); setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); if (AndroidUtilities.isTablet()) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); RelativeLayout launchLayout = new RelativeLayout(this); drawerLayoutContainer.addView(launchLayout); FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) launchLayout.getLayoutParams(); layoutParams1.width = LayoutHelper.MATCH_PARENT; layoutParams1.height = LayoutHelper.MATCH_PARENT; launchLayout.setLayoutParams(layoutParams1); backgroundTablet = new ImageView(this); backgroundTablet.setScaleType(ImageView.ScaleType.CENTER_CROP); backgroundTablet.setImageResource(R.drawable.cats); launchLayout.addView(backgroundTablet); RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) backgroundTablet .getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; backgroundTablet.setLayoutParams(relativeLayoutParams); launchLayout.addView(actionBarLayout); relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; actionBarLayout.setLayoutParams(relativeLayoutParams); rightActionBarLayout = new ActionBarLayout(this); launchLayout.addView(rightActionBarLayout); relativeLayoutParams = (RelativeLayout.LayoutParams) rightActionBarLayout.getLayoutParams(); relativeLayoutParams.width = AndroidUtilities.dp(320); relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; rightActionBarLayout.setLayoutParams(relativeLayoutParams); rightActionBarLayout.init(rightFragmentsStack); rightActionBarLayout.setDelegate(this); shadowTabletSide = new FrameLayout(this); shadowTabletSide.setBackgroundColor(0x40295274); launchLayout.addView(shadowTabletSide); relativeLayoutParams = (RelativeLayout.LayoutParams) shadowTabletSide.getLayoutParams(); relativeLayoutParams.width = AndroidUtilities.dp(1); relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; shadowTabletSide.setLayoutParams(relativeLayoutParams); shadowTablet = new FrameLayout(this); shadowTablet.setVisibility(View.GONE); shadowTablet.setBackgroundColor(0x7F000000); launchLayout.addView(shadowTablet); relativeLayoutParams = (RelativeLayout.LayoutParams) shadowTablet.getLayoutParams(); relativeLayoutParams.width = LayoutHelper.MATCH_PARENT; relativeLayoutParams.height = LayoutHelper.MATCH_PARENT; shadowTablet.setLayoutParams(relativeLayoutParams); shadowTablet.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (!actionBarLayout.fragmentsStack.isEmpty() && event.getAction() == MotionEvent.ACTION_UP) { float x = event.getX(); float y = event.getY(); int location[] = new int[2]; layersActionBarLayout.getLocationOnScreen(location); int viewX = location[0]; int viewY = location[1]; if (layersActionBarLayout.checkTransitionAnimation() || x > viewX && x < viewX + layersActionBarLayout.getWidth() && y > viewY && y < viewY + layersActionBarLayout.getHeight()) { return false; } else { if (!layersActionBarLayout.fragmentsStack.isEmpty()) { for (int a = 0; a < layersActionBarLayout.fragmentsStack.size() - 1; a++) { layersActionBarLayout .removeFragmentFromStack(layersActionBarLayout.fragmentsStack.get(0)); a--; } layersActionBarLayout.closeLastFragment(true); } return true; } } return false; } }); shadowTablet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); layersActionBarLayout = new ActionBarLayout(this); layersActionBarLayout.setRemoveActionBarExtraHeight(true); layersActionBarLayout.setBackgroundView(shadowTablet); layersActionBarLayout.setUseAlphaAnimations(true); layersActionBarLayout.setBackgroundResource(R.drawable.boxshadow); launchLayout.addView(layersActionBarLayout); relativeLayoutParams = (RelativeLayout.LayoutParams) layersActionBarLayout.getLayoutParams(); relativeLayoutParams.width = AndroidUtilities.dp(530); relativeLayoutParams.height = AndroidUtilities.dp(528); layersActionBarLayout.setLayoutParams(relativeLayoutParams); layersActionBarLayout.init(layerFragmentsStack); layersActionBarLayout.setDelegate(this); layersActionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer); layersActionBarLayout.setVisibility(View.GONE); } else { drawerLayoutContainer.addView(actionBarLayout, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); } ListView listView = new ListView(this) { @Override public boolean hasOverlappingRendering() { return false; } }; listView.setBackgroundColor(0xffffffff); listView.setAdapter(drawerLayoutAdapter = new DrawerLayoutAdapter(this)); listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); drawerLayoutContainer.setDrawerLayout(listView); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); Point screenSize = AndroidUtilities.getRealScreenSize(); layoutParams.width = AndroidUtilities.isTablet() ? AndroidUtilities.dp(320) : Math.min(screenSize.x, screenSize.y) - AndroidUtilities.dp(56); layoutParams.height = LayoutHelper.MATCH_PARENT; listView.setLayoutParams(layoutParams); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if (position == 12) { presentFragment(new SettingsActivity()); drawerLayoutContainer.closeDrawer(false); } else if (position == 11) { try { RulesActivity his = new RulesActivity(); presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } else if (position == 2) { Defaults def = Defaults.getInstance(); boolean open = def.openOnJoin(); def.setOpenOnJoin(!open); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!open); } } else if (position == 4) { try { HistoryActivity his = new HistoryActivity(); presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } else if (position == 3) { Intent telegram = new Intent(Intent.ACTION_VIEW, Uri.parse("https://telegram.me/cafemember")); startActivity(telegram); drawerLayoutContainer.closeDrawer(false); } else if (position == 5) { try { FAQActivity his = new FAQActivity(); presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } else if (position == 6) { Intent telegram = new Intent(Intent.ACTION_VIEW, Uri.parse("https://telegram.me/" + Defaults.getInstance().getSupport())); startActivity(telegram); drawerLayoutContainer.closeDrawer(false); } else if (position == 7) { try { HelpActivity his = new HelpActivity(); presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } else if (position == 8) { try { AddRefActivity his = new AddRefActivity(); presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } else if (position == 9) { try { Log.d("TAB", "Triggering"); ShareActivity his = new ShareActivity(); Log.d("TAB", "Triggered"); presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } else if (position == 10) { try { // TransfareActivity his = new TransfareActivity(); // presentFragment(his); } catch (Exception e) { FileLog.e("tmessages", e); } drawerLayoutContainer.closeDrawer(false); } } }); drawerLayoutContainer.setParentActionBarLayout(actionBarLayout); actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer); actionBarLayout.init(mainFragmentsStack); actionBarLayout.setDelegate(this); ApplicationLoader.loadWallpaper(); passcodeView = new PasscodeView(this); drawerLayoutContainer.addView(passcodeView); FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) passcodeView.getLayoutParams(); layoutParams1.width = LayoutHelper.MATCH_PARENT; layoutParams1.height = LayoutHelper.MATCH_PARENT; passcodeView.setLayoutParams(layoutParams1); NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeOtherAppActivities, this); currentConnectionState = ConnectionsManager.getInstance().getConnectionState(); NotificationCenter.getInstance().addObserver(this, NotificationCenter.appDidLogout); NotificationCenter.getInstance().addObserver(this, NotificationCenter.mainUserInfoChanged); NotificationCenter.getInstance().addObserver(this, NotificationCenter.closeOtherAppActivities); NotificationCenter.getInstance().addObserver(this, NotificationCenter.didUpdatedConnectionState); NotificationCenter.getInstance().addObserver(this, NotificationCenter.needShowAlert); NotificationCenter.getInstance().addObserver(this, NotificationCenter.wasUnableToFindCurrentLocation); if (Build.VERSION.SDK_INT < 14) { NotificationCenter.getInstance().addObserver(this, NotificationCenter.screenStateChanged); } if (actionBarLayout.fragmentsStack.isEmpty()) { if (!UserConfig.isClientActivated()) { actionBarLayout.addFragmentToStack(new LoginActivity()); drawerLayoutContainer.setAllowOpenDrawer(false, false); } else { dialogsFragment = new DialogsActivity(null); actionBarLayout.addFragmentToStack(dialogsFragment); drawerLayoutContainer.setAllowOpenDrawer(true, false); } try { if (savedInstanceState != null) { String fragmentName = savedInstanceState.getString("fragment"); if (fragmentName != null) { Bundle args = savedInstanceState.getBundle("args"); switch (fragmentName) { case "chat": if (args != null) { ChatActivity chat = new ChatActivity(args); if (actionBarLayout.addFragmentToStack(chat)) { chat.restoreSelfArgs(savedInstanceState); } } break; case "settings": { SettingsActivity settings = new SettingsActivity(); actionBarLayout.addFragmentToStack(settings); settings.restoreSelfArgs(savedInstanceState); break; } case "group": if (args != null) { GroupCreateFinalActivity group = new GroupCreateFinalActivity(args); if (actionBarLayout.addFragmentToStack(group)) { group.restoreSelfArgs(savedInstanceState); } } break; case "channel": if (args != null) { ChannelCreateActivity channel = new ChannelCreateActivity(args); if (actionBarLayout.addFragmentToStack(channel)) { channel.restoreSelfArgs(savedInstanceState); } } break; case "edit": if (args != null) { ChannelEditActivity channel = new ChannelEditActivity(args); if (actionBarLayout.addFragmentToStack(channel)) { channel.restoreSelfArgs(savedInstanceState); } } break; case "chat_profile": if (args != null) { ProfileActivity profile = new ProfileActivity(args); if (actionBarLayout.addFragmentToStack(profile)) { profile.restoreSelfArgs(savedInstanceState); } } break; case "wallpapers": { WallpapersActivity settings = new WallpapersActivity(); actionBarLayout.addFragmentToStack(settings); settings.restoreSelfArgs(savedInstanceState); break; } } } } } catch (Exception e) { FileLog.e("tmessages", e); } } else { boolean allowOpen = true; if (AndroidUtilities.isTablet()) { allowOpen = actionBarLayout.fragmentsStack.size() <= 1 && layersActionBarLayout.fragmentsStack.isEmpty(); if (layersActionBarLayout.fragmentsStack.size() == 1 && layersActionBarLayout.fragmentsStack.get(0) instanceof LoginActivity) { allowOpen = false; } } if (actionBarLayout.fragmentsStack.size() == 1 && actionBarLayout.fragmentsStack.get(0) instanceof LoginActivity) { allowOpen = false; } drawerLayoutContainer.setAllowOpenDrawer(allowOpen, false); } handleIntent(getIntent(), false, savedInstanceState != null, false); needLayout(); final View view = getWindow().getDecorView().getRootView(); view.getViewTreeObserver() .addOnGlobalLayoutListener(onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { int height = view.getMeasuredHeight(); if (height > AndroidUtilities.dp(100) && height < AndroidUtilities.displaySize.y && height + AndroidUtilities.dp(100) > AndroidUtilities.displaySize.y) { AndroidUtilities.displaySize.y = height; FileLog.e("tmessages", "fix display size y to " + AndroidUtilities.displaySize.y); } } }); }
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;/* w w w .j av 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", "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 a2 s . c om*/ 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;//from w w w . j a v a2 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", "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 a 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", "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;/*from w w w. j a 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", "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(); } }); } }