Commit a20c1d26 authored by Matyáš Latner's avatar Matyáš Latner

Merge branch 'devel' of gitlab.labs.nic.cz:labs/tablexia into devel

parents e02b0c9b 1ff18f40
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/white" >
<ImageView
android:id="@+id/newuser_mugshot_photo"
android:layout_width="@dimen/newuser_mugshot_picker_photo_width"
android:layout_height="match_parent"
android:src="@drawable/mugshot00"
android:adjustViewBounds="true"
android:scaleType="centerCrop"/>
<ImageView
android:id="@+id/newuser_mugshot_film"
android:layout_width="@dimen/newuser_mugshot_picker_photo_width"
android:layout_height="match_parent"
android:src="@drawable/newuser_film"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
</RelativeLayout>
......@@ -128,5 +128,6 @@
<dimen name="newuser_seekbar_framelayout_height">85dp</dimen>
<dimen name="newuser_seekbar_background_margin_top">22dp</dimen>
<dimen name="newuser_seekbar_thumb_offset">2dp</dimen>
<dimen name="newuser_mugshot_picker_photo_width">300dp</dimen>
</resources>
......@@ -93,7 +93,10 @@ import cz.nic.tablexia.widget.TablexiaButtonViewDialog;
public class NewUserFormFragment extends RoboFragment implements OnClickListener, OnDropListener {
private static final String TAG = NewUserFormFragment.class.getSimpleName();
private static final int NUMBER_OF_PHOTOS = 9;
private static final String MUGSHOT_FILE_NAME = "mugshot";
private static final String MUGSHOT_FILE_EXTENSION = ".png";
private static final int FIRST_AVAILABLE_PHOTO_INDEX = 10;
private static final int NUMBER_OF_PHOTOS = 6;
@InjectView(R.id.newuser_mugshot_image) ImageView imageViewMugshot;
@InjectView(R.id.newuser_stamper_image) @Nullable ImageView imageViewStamper;
......@@ -235,13 +238,20 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
LinearLayout ll = (LinearLayout) mugshotPicker.findViewById(R.id.newuser_avatars);
for (int i = 0; i < NUMBER_OF_PHOTOS; i++) {
ImageView iv = new ImageView(getActivity());
String avatarPictureName = "mugshot0" + (i + 1);
iv.setImageDrawable(getResources().getDrawable(R.drawable.newuser_film));
iv.setBackgroundResource((getResources().getIdentifier(avatarPictureName, "drawable", getActivity().getPackageName())));
iv.setTag(avatarPictureName);
iv.setOnClickListener(new OnClickListener() {
for (int i = FIRST_AVAILABLE_PHOTO_INDEX; i < (FIRST_AVAILABLE_PHOTO_INDEX + NUMBER_OF_PHOTOS); i++) {
View mugshotView = inflater.inflate(R.layout.newuser_mugshot_rectangle, null);
ImageView photo = (ImageView) mugshotView.findViewById(R.id.newuser_mugshot_photo);
ImageView film = (ImageView) mugshotView.findViewById(R.id.newuser_mugshot_film);
String photoNumber;
if (i < 10) {
photoNumber = "0" + i;
} else {
photoNumber = Integer.toString(i);
}
String avatarPictureName = MUGSHOT_FILE_NAME + photoNumber;
photo.setImageResource((getResources().getIdentifier(avatarPictureName, "drawable", getActivity().getPackageName())));
photo.setTag(avatarPictureName);
photo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
......@@ -258,9 +268,9 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
}
});
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
iv.setAdjustViewBounds(true);
ll.addView(iv, lp);
film.setMinimumWidth(photo.getMeasuredWidth());
ll.addView(mugshotView);
}
view.addOnLayoutChangeListener(new OnLayoutChangeListener() {
......@@ -679,7 +689,7 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
if (btnSubscribe != null) {
boolean isMale = sex == Sex.MALE;
coverName = coverNameET.getText().toString();
User newUser = new User(coverName, age, isMale, avatarName, true, false, subscriptionFileName);
User newUser = new User(coverName, age, isMale, avatarName, true, false, subscriptionFileName);
newUser.save();
Intent data = new Intent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment