Commit b396ad08 authored by v.tarantik's avatar v.tarantik

#342 oprava odanimovani pera a razitka zpet an puvodni pozice

parent 8eef805e
......@@ -102,26 +102,18 @@
android:id="@+id/newuser_stamper_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:scaleX="0.8"
android:scaleY="0.8"
android:src="@drawable/newuser_stamp_left_dropped"
android:translationX="0dp"
android:translationY="60dp" >
android:src="@drawable/newuser_stamp_left_dropped" >
</ImageView>
<ImageView
android:id="@+id/newuser_pen_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:scaleX="0.8"
android:scaleY="0.8"
android:src="@drawable/newuser_pencil_dropped"
android:transformPivotX="0dp"
android:transformPivotY="0dp" >
android:src="@drawable/newuser_pencil_dropped" >
</ImageView>
<RelativeLayout
......
......@@ -102,19 +102,13 @@
android:id="@+id/newuser_stamper_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:src="@drawable/newuser_stamp_left_dropped"
android:translationX="20dp"
android:translationY="20dp" >
android:src="@drawable/newuser_stamp_left_dropped">
</ImageView>
<ImageView
android:id="@+id/newuser_pen_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:scaleType="matrix"
android:src="@drawable/newuser_pencil_dropped" >
</ImageView>
......
......@@ -30,32 +30,32 @@ import cz.nic.tablexia.game.games.GamesDefinition;
@Table(name = "Users")
public class User extends Model {
public static class UserTutorial extends Model {
@Column(name = "User")
private User user;
@Column(name = "Game")
private int game;
private UserTutorial setUser(User user) {
this.user = user;
return this;
}
private UserTutorial setGame(GamesDefinition gamesDefinition) {
this.game = gamesDefinition.getPosition();
return this;
}
public static void createUserTutorialRecord(User user, GamesDefinition gamesDefinition) {
(new UserTutorial().setUser(user).setGame(gamesDefinition)).save();
}
public static boolean existsUserTutorialRecord(User user, GamesDefinition gamesDefinition) {
return new Select().from(UserTutorial.class).where("User = ? AND Game = ?", user.getId(), gamesDefinition.getPosition()).executeSingle() != null;
}
}
public static class UserTutorial extends Model {
@Column(name = "User")
private User user;
@Column(name = "Game")
private int game;
private UserTutorial setUser(User user) {
this.user = user;
return this;
}
private UserTutorial setGame(GamesDefinition gamesDefinition) {
game = gamesDefinition.getPosition();
return this;
}
public static void createUserTutorialRecord(User user, GamesDefinition gamesDefinition) {
(new UserTutorial().setUser(user).setGame(gamesDefinition)).save();
}
public static boolean existsUserTutorialRecord(User user, GamesDefinition gamesDefinition) {
return new Select().from(UserTutorial.class).where("User = ? AND Game = ?", user.getId(), gamesDefinition.getPosition()).executeSingle() != null;
}
}
@Expose
@Column(name = "NickName")
......@@ -235,7 +235,7 @@ public class User extends Model {
}
public static boolean existsUsersForName(String nickName) {
return (new Select().from(User.class).where("NickName = ?", nickName).executeSingle()) != null;
return (new Select().from(User.class).where("NickName = ? and deleted = 0", nickName).executeSingle()) != null;
}
public static User getUsersForId(long id) {
......@@ -245,13 +245,13 @@ public class User extends Model {
public static List<User> getAllUsers() {
return new Select().from(User.class).where("deleted = 0").execute();
}
public void markTutorialAsPlayed(GamesDefinition gamesDefinition) {
UserTutorial.createUserTutorialRecord(this, gamesDefinition);
UserTutorial.createUserTutorialRecord(this, gamesDefinition);
}
public boolean wasGameTutorialPlayed(GamesDefinition gamesDefinition) {
return UserTutorial.existsUserTutorialRecord(this, gamesDefinition);
return UserTutorial.existsUserTutorialRecord(this, gamesDefinition);
}
@Override
......
......@@ -33,7 +33,6 @@ public class OnDragListener implements OnTouchListener {
private Point firstTouchPoint; // bod doteku na prvku pro vypocitani offsetu
private Point displaySize;
private Point viewOriginalPosition;
public OnDragListener(Point displaySize) {
super();
......@@ -44,7 +43,7 @@ public class OnDragListener implements OnTouchListener {
public void setOnDropListener(OnDropListener onDropListener) {
this.onDropListener = onDropListener;
viewOriginalPosition = new Point();
startPoint = null;
}
@Override
......@@ -54,8 +53,6 @@ public class OnDragListener implements OnTouchListener {
case MotionEvent.ACTION_DOWN: {
startPoint = new Point((int) v.getTranslationX(), (int) v.getTranslationY());
firstTouchPoint = new Point((int) event.getX(), (int) event.getY());
viewOriginalPosition.set((int) v.getX(), (int) v.getY());
break;
}
case MotionEvent.ACTION_UP:
......
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