Skip to content

Instantly share code, notes, and snippets.

View mohamad-shafaee's full-sized avatar

Mohammad Shafaei mohamad-shafaee

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.msh_n.myp.myapplication.ImageBoard
android:layout_width="100dp"
public class ImageBoard extends View {
RectF mCurrentViewPort;
Rect mContentRect;
ImageView image;
int width;
int height;
int dragedWidth = 0;
int dragedHeight = 0;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ImageBoard">
<attr name="src" format="reference|color"/>
</declare-styleable>
</resources>
public class MainActivity extends AppCompatActivity {
int mActivePointerId = MotionEvent.INVALID_POINTER_ID;
float mLastTouchX;
float mLastTouchY;
float mPosX = 0f;
float mPosY = 0f;
CViewN cview;
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.msh_n.myp.canvasanim1.CViewN
android:id="@+id/cview_1"
public class CViewN extends View {
int width;
int height;
int gapV;
int x;
int y;
Paint vaweP;
Paint cPaint1;
Paint cPaint2;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.msh_n.myp.canvasanim1.CViewN
android:layout_width="200dp"
public class CViewN extends View {
int width;
int height;
int gapV;
int x;
int y;
Paint vaweP;
Paint cPaint1;
Paint cPaint2;
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
android:animateLayoutChanges="true"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.msh_n.myp.customview1.MainActivity">