Update browseable samples for lmp-docs
Synced to commit df5e5013422b81b4fd05c0ac9fd964b13624847a. Includes new samples for Android Auto. Change-Id: I3fec46e2a6b3f196682a92f1afd91eb682dc2dc1
This commit is contained in:
@@ -13,9 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor;
|
||||
|
||||
import android.os.Bundle;
|
||||
@@ -58,7 +55,7 @@ public class MainActivity extends SampleActivityBase implements CardStream {
|
||||
}
|
||||
|
||||
// Use fragment as click listener for cards, but must implement correct interface
|
||||
if(!(fragment instanceof OnCardClickListener)){
|
||||
if (!(fragment instanceof OnCardClickListener)){
|
||||
throw new ClassCastException("BatchStepSensorFragment must " +
|
||||
"implement OnCardClickListener interface.");
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.animation.Animator;
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.BounceInterpolator;
|
||||
@@ -46,20 +45,28 @@ public class CardActionButton extends Button {
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
|
||||
switch(event.getAction()){
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
setPressed(true);
|
||||
animate().scaleX(0.98f).scaleY(0.98f).alpha(0.8f).setDuration(100).
|
||||
setInterpolator(new DecelerateInterpolator());
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
||||
animate().scaleX(0.98f).scaleY(0.98f).setDuration(100)
|
||||
.setInterpolator(new DecelerateInterpolator());
|
||||
} else {
|
||||
ViewCompat.setElevation(this, 8.f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP:
|
||||
animate().scaleX(1.0f).scaleY(1.f).alpha(1.0f).setDuration(50).
|
||||
setInterpolator(new BounceInterpolator());
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
animate().scaleX(1.0f).scaleY(1.f).alpha(1.0f).setDuration(50).
|
||||
setInterpolator(new BounceInterpolator());
|
||||
case MotionEvent.ACTION_CANCEL: {
|
||||
setPressed(false);
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
||||
animate().scaleX(1.f).scaleY(1.f).setDuration(50)
|
||||
.setInterpolator(new BounceInterpolator());
|
||||
} else {
|
||||
ViewCompat.setElevation(this, 0.f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
public interface CardStream {
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.animation.Animator;
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
public interface OnCardClickListener {
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.example.android.batchstepsensor.cardstream;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
Reference in New Issue
Block a user