This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InnerClassReferenceLeakActivity extends AppCompatActivity { | |
private LeakyClass leakyClass; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_first); | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InnerClassReferenceLeakActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_first); | |
new LeakyClass(this).redirectToAnotherActivity(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PieView extends View { | |
public PieView(Context context){ | |
//this(context, null, 0); | |
super(context); | |
} | |
public PieView(Context context, AttributeSet attrs){ | |
//this(context, attrs, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onSizeChanged(int w, int h, int oldw, int oldh) { | |
super.onSizeChanged(w, h, oldw, oldh); | |
width = w; | |
height = h; | |
} | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onDraw(Canvas canvas) { | |
super.onDraw(canvas); | |
rect.left = 0; | |
rect.top = 0; | |
if(ori == Configuration.ORIENTATION_PORTRAIT) { | |
rect.bottom = height / 3; | |
rect.right = width; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.msh_n.myp.customview1; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.res.Configuration; | |
import android.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<com.msh_n.myp.customview1.PieView | |
android:id="@+id/pieView" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
app:backgroundColor="@color/light_green" | |
app:titleText="Foreground color" | |
app:viewColor="@color/pink" /> | |
<com.msh_n.myp.customview1.PieView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<declare-styleable name="PieView"> | |
<attr name="titleText" format="string" localization="suggested" /> | |
<attr name="backgroundColor" format="color" /> | |
<attr name="viewColor" format="color" /> | |
</declare-styleable> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.msh_n.myp.customview1; | |
import android.animation.ObjectAnimator; | |
import android.animation.ValueAnimator; | |
import android.animation.ValueAnimator.AnimatorUpdateListener; | |
import android.content.Context; | |
import android.widget.Button; | |
import android.widget.EditText; | |
import android.widget.TextView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"> |
OlderNewer