Subversion Repository Public Repository

Nextrek

Diff Revisions 761 vs 762 for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Controller/FullInfoFragment.java

Diff revisions: vs.
  @@ -19,6 +19,9 @@
19 19 import android.view.animation.Animation;
20 20 import android.view.animation.AnimationUtils;
21 21 import android.widget.*;
22 +
23 + import com.rey.material.widget.ProgressView;
24 +
22 25 import it.fedeloper.smartcharging.Manager.Utils;
23 26 import it.fedeloper.smartcharging.R;
24 27 import it.fedeloper.smartcharging.Service.EndPoint;
  @@ -38,7 +41,7 @@
38 41 ViewGroup v;
39 42 int idlocale = -1;
40 43 Context c;
41 -
44 + private ProgressView loadingAll;
42 45 Bundle b;
43 46 boolean haveScrolled = false;
44 47 LayoutInflater li;
  @@ -69,7 +72,7 @@
69 72 c = getActivity();
70 73
71 74 idlocale = b.getInt("idlocale");
72 -
75 + loadingAll =(ProgressView) container.findViewById(R.id.loadingAll);
73 76 mainLayout = (LinearLayout) container.findViewById(R.id.main_layout);
74 77
75 78 new Thread(new Runnable() {
  @@ -97,13 +100,16 @@
97 100
98 101 image.setBackgroundColor(getResources().getColor(R.color.btn_background));
99 102 image.setScaleType(ImageView.ScaleType.FIT_CENTER);
100 - image.setLayoutParams(new LinearLayout.LayoutParams((int) convertDpToPixel(130), (int) convertDpToPixel(130)));
101 103
104 + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int) convertDpToPixel(130), (int) convertDpToPixel(130));
105 + lp.setMargins(10, 0, 10, 0);
106 + image.setLayoutParams(lp);
102 107 ((LinearLayout) v.findViewById(R.id.images)).addView(image);
103 108 Animation aAnimation = (Animation) AnimationUtils.loadAnimation(c, R.anim.zoom);
104 109
105 110 image.startAnimation(aAnimation);
106 111 if (haveScrolled == false) {
112 + loadingAll.setVisibility(View.GONE);
107 113 ObjectAnimator objectAnimator = ObjectAnimator.ofInt(((ScrollView) getActivity().findViewById(R.id.scrollView)), "scrollY", 0, ((ScrollView) getActivity().findViewById(R.id.scrollView)).getBottom()).setDuration(500);
108 114 objectAnimator.start();
109 115 // ((ScrollView)getActivity().findViewById(R.id.scrollView)).fullScroll(ScrollView.FOCUS_DOWN);
  @@ -119,7 +125,11 @@
119 125 @Override
120 126 public void run() {
121 127 image.clearAnimation();
122 - image.setLayoutParams(new LinearLayout.LayoutParams((int) (convertDpToPixel(130) * imgweb.getWidth() / imgweb.getHeight()), (int) convertDpToPixel(130)));
128 +
129 + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int) (convertDpToPixel(130) * imgweb.getWidth() / imgweb.getHeight()), (int) convertDpToPixel(130));
130 + lp.setMargins(10, 0, 10, 0);
131 + image.setLayoutParams(lp);
132 +
123 133 image.setImageBitmap(imgweb);
124 134
125 135 image.setOnClickListener(new View.OnClickListener() {
  @@ -181,8 +191,12 @@
181 191 final View child = li.inflate(R.layout.commento_layout, null);
182 192
183 193 // ((ImageView) child.findViewById(R.id.user_image)).setImageBitmap(bitm);
194 + if ( jdata.getString("username").contains("$"))
195 + ((TextView) child.findViewById(R.id.nameText)).setText(jdata.getString("username").substring(0, jdata.getString("username").indexOf("$")));
196 + else
197 + ((TextView) child.findViewById(R.id.nameText)).setText(jdata.getString("username"));
198 +
184 199
185 - ((TextView) child.findViewById(R.id.nameText)).setText(jdata.getString("username").replace("$"," "));
186 200 ((TextView) child.findViewById(R.id.DescText)).setText(jdata.getString("descrizione"));
187 201 ((TextView) child.findViewById(R.id.textView18)).setText(jdata.getString("data"));
188 202 ((RatingBar) child.findViewById(R.id.ratingBar3)).setRating(jdata.getLong("voto"));
  @@ -256,6 +270,19 @@
256 270 }
257 271 });
258 272 }
273 + getActivity().runOnUiThread(new Runnable() {
274 + @Override
275 + public void run() {
276 +
277 + if (haveScrolled == false) {
278 + loadingAll.setVisibility(View.GONE);
279 + ObjectAnimator objectAnimator = ObjectAnimator.ofInt(((ScrollView) getActivity().findViewById(R.id.scrollView)), "scrollY", 0, ((ScrollView) getActivity().findViewById(R.id.scrollView)).getBottom()).setDuration(500);
280 + objectAnimator.start();
281 + // ((ScrollView)getActivity().findViewById(R.id.scrollView)).fullScroll(ScrollView.FOCUS_DOWN);
282 + haveScrolled = true;
283 + }
284 + }});
285 +
259 286 } catch (JSONException e) {
260 287 e.printStackTrace();
261 288 }