Skip to content

Commit

Permalink
fixed some issues with images
Browse files Browse the repository at this point in the history
  • Loading branch information
youstinus committed Jan 9, 2020
1 parent 2e983bb commit 6786ca4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/CrochetingGuide/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ dependencies {
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
// Add the dependency for the Performance Monitoring library
implementation 'com.google.firebase:firebase-perf:19.0.4'
//implementation 'com.squareup.picasso:picasso:2.71828'

//implementation 'com.squareup.picasso:picasso:2.71828'
// annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.bumptech.glide.Glide
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdView
import com.google.gson.Gson
//import com.squareup.picasso.Picasso
import com.youstinus.crochetingguide.R
import com.youstinus.crochetingguide.fragments.schemes.SchemeViewModel
import com.youstinus.crochetingguide.utilities.FireFun.Companion.downloadImages
Expand Down Expand Up @@ -58,9 +59,9 @@ class SchemeFragment : Fragment() {
var imagesIndex = 0
var textsIndex = 0

val dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4.toFloat(), resources.displayMetrics).roundToInt()
val dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8.toFloat(), resources.displayMetrics).roundToInt()
val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
params.setMargins(2*dp, 2*dp, 2*dp, 2*dp)
params.setMargins(dp, dp, dp, dp)

for (type in scheme!!.sequence.split(",".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) {
when (type) {
Expand All @@ -69,7 +70,7 @@ class SchemeFragment : Fragment() {
val textView = TextView(activity)
textView.text = texts[textsIndex]
textView.background = resources.getDrawable(R.drawable.shape_border)
textView.setPadding(2*dp, 2*dp, 2*dp, 2*dp)
textView.setPadding(dp, dp, dp, dp)
textsIndex++
textView.layoutParams = params
layout.addView(textView)
Expand All @@ -80,10 +81,11 @@ class SchemeFragment : Fragment() {
downloadImages(scheme, imagesIndex) { uri ->
if (uri != null) {
Glide.with(activity!!).load(uri).into(image)
//Picasso.get().load(uri).into(image)
}
}
imagesIndex++
image.setPadding(2*dp, dp, 2*dp, dp)
image.setPadding(dp, dp, dp, dp)
//image.layoutParams = params
layout.addView(image)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
android:layout_centerHorizontal="true"
android:visibility="visible"
app:adSize="SMART_BANNER"
app:adUnitId="ca-app-pub-3940256099942544/6300978111"
app:adUnitId="ca-app-pub-8162832251478705/1679778601"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:layout_centerHorizontal="true"
android:visibility="visible"
app:adSize="SMART_BANNER"
app:adUnitId="ca-app-pub-3940256099942544/6300978111"
app:adUnitId="ca-app-pub-8162832251478705/8518305965"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down

0 comments on commit 6786ca4

Please # to comment.