This file contains hidden or 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.mlatu.tv.ui.views; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Path; | |
import android.util.AttributeSet; | |
import android.widget.FrameLayout; | |
public class ClipRevealFrame extends FrameLayout { |
This file contains hidden or 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
mRatingView = view.findViewById(R.id.rating_view); | |
mRatingClip = (ClipDrawable) mRatingView.getBackground(); | |
BitmapDrawable star = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_fab_star); | |
Bitmap bitmap = star.getBitmap(); | |
int side = bitmap.getHeight(); | |
ViewGroup.LayoutParams lp = mRatingView.getLayoutParams(); | |
lp.width = side * 10; | |
lp.height = side; |
This file contains hidden or 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
if (mServiceConn != null) { | |
if (mContext != null) mContext.unbindService(mServiceConn); | |
} |
This file contains hidden or 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
<uses-feature android:required="true" android:name="android.hardware.sensor.accelerometer" /> | |
<uses-feature android:required="false" android:name="android.hardware.sensor.gyroscope" /> |
This file contains hidden or 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
private Sensor getDefaultSensor() { | |
Sensor gravitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); | |
Sensor accelSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); | |
if (gravitySensor != null) | |
return gravitySensor; | |
else if (accelSensor != null) | |
return accelSensor; | |
else { | |
throw new RuntimeException("It seems device has neither gravity nor accelerometer sensor"); | |
} |
This file contains hidden or 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 void invokePicker(Integer requestCode) { | |
Intent intentGetContent = new Intent(Intent.ACTION_GET_CONTENT, | |
MediaStore.Images.Media.INTERNAL_CONTENT_URI); | |
intentGetContent.setType("image/*"); | |
final PackageManager pm = getPackageManager(); | |
final Intent i = new Intent(intentGetContent); | |
final List list = pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY); | |
if (list.size() > 0) { | |
startActivityForResult(intentGetContent, requestCode); | |
} else { |
This file contains hidden or 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
(on-ui | |
(set-content-view! this | |
[:linear-layout {} | |
[:button {:id ::mybtn | |
:text "A button" | |
:on-click (fn [w] | |
(let [edit (find-view this ::myedit)] | |
(config edit :text "Clicked!")))}] | |
[:edit-text {:id ::myedit}]])) |
This file contains hidden or 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
PROCESS STATE CODES | |
Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process: | |
D uninterruptible sleep (usually IO) | |
R running or runnable (on run queue) | |
S interruptible sleep (waiting for an event to complete) | |
T stopped, either by a job control signal or because it is being traced | |
W paging (not valid since the 2.6.xx kernel) | |
X dead (should never be seen) | |
Z defunct ("zombie") process, terminated but not reaped by its parent |
This file contains hidden or 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 onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
float scale = getMeasuredWidth() / mMaxImageWidth; | |
int width = Math.round(getMeasuredWidth() * scale); | |
int height = Math.round(getMeasuredHeight() * scale); | |
setMeasuredDimension(width, height); | |
} |
This file contains hidden or 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
private void init() { | |
paint = new Paint(); | |
paint.setColor(Color.BLUE); | |
paint.setAntiAlias(true); | |
paint.setStrokeWidth(50); | |
paint.setStyle(Paint.Style.STROKE); | |
paintFill = new Paint(); | |
paintFill.setColor(Color.RED); | |
paint.setAntiAlias(true); |