am 66f17e50: ApiDemos Clean up
Merge commit '66f17e50dbb42bc529dd12b2f26729f114b1a1a9' * commit '66f17e50dbb42bc529dd12b2f26729f114b1a1a9': ApiDemos Clean up
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.example.android.apis;
|
package com.example.android.apis;
|
||||||
|
|
||||||
import com.example.android.apis.app.DefaultValues;
|
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
@@ -33,6 +31,7 @@ import android.preference.PreferenceManager;
|
|||||||
*/
|
*/
|
||||||
public class ApiDemosApplication extends Application {
|
public class ApiDemosApplication extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
/*
|
/*
|
||||||
* This populates the default values from the preferences XML file. See
|
* This populates the default values from the preferences XML file. See
|
||||||
@@ -41,6 +40,7 @@ public class ApiDemosApplication extends Application {
|
|||||||
PreferenceManager.setDefaultValues(this, R.xml.default_values, false);
|
PreferenceManager.setDefaultValues(this, R.xml.default_values, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onTerminate() {
|
public void onTerminate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,14 +22,13 @@ import android.app.Activity;
|
|||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This activity is run as the click activity for {@link IncomingMessage}.
|
* This activity is run as the click activity for {@link IncomingMessage}.
|
||||||
* When it comes up, it also clears the notification, because the "message"
|
* When it comes up, it also clears the notification, because the "message"
|
||||||
* has been "read."
|
* has been "read."
|
||||||
*/
|
*/
|
||||||
public class IncomingMessageView extends Activity {
|
public class IncomingMessageView extends Activity {
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.incoming_message_view);
|
setContentView(R.layout.incoming_message_view);
|
||||||
|
|||||||
@@ -20,14 +20,11 @@ import android.appwidget.AppWidgetManager;
|
|||||||
import android.appwidget.AppWidgetProvider;
|
import android.appwidget.AppWidgetProvider;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
// Need the following import to get access to the app resources, since this
|
// Need the following import to get access to the app resources, since this
|
||||||
// class is in a sub-package.
|
// class is in a sub-package.
|
||||||
import com.example.android.apis.R;
|
import com.example.android.apis.R;
|
||||||
@@ -51,6 +48,7 @@ public class ExampleAppWidgetProvider extends AppWidgetProvider {
|
|||||||
// log tag
|
// log tag
|
||||||
private static final String TAG = "ExampleAppWidgetProvider";
|
private static final String TAG = "ExampleAppWidgetProvider";
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||||
Log.d(TAG, "onUpdate");
|
Log.d(TAG, "onUpdate");
|
||||||
// For each widget that needs an update, get the text that we should display:
|
// For each widget that needs an update, get the text that we should display:
|
||||||
@@ -65,6 +63,7 @@ public class ExampleAppWidgetProvider extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onDeleted(Context context, int[] appWidgetIds) {
|
public void onDeleted(Context context, int[] appWidgetIds) {
|
||||||
Log.d(TAG, "onDeleted");
|
Log.d(TAG, "onDeleted");
|
||||||
// When the user deletes the widget, delete the preference associated with it.
|
// When the user deletes the widget, delete the preference associated with it.
|
||||||
@@ -74,6 +73,7 @@ public class ExampleAppWidgetProvider extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onEnabled(Context context) {
|
public void onEnabled(Context context) {
|
||||||
Log.d(TAG, "onEnabled");
|
Log.d(TAG, "onEnabled");
|
||||||
// When the first widget is created, register for the TIMEZONE_CHANGED and TIME_CHANGED
|
// When the first widget is created, register for the TIMEZONE_CHANGED and TIME_CHANGED
|
||||||
@@ -87,11 +87,11 @@ public class ExampleAppWidgetProvider extends AppWidgetProvider {
|
|||||||
PackageManager.DONT_KILL_APP);
|
PackageManager.DONT_KILL_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onDisabled(Context context) {
|
public void onDisabled(Context context) {
|
||||||
// When the first widget is created, stop listening for the TIMEZONE_CHANGED and
|
// When the first widget is created, stop listening for the TIMEZONE_CHANGED and
|
||||||
// TIME_CHANGED broadcasts.
|
// TIME_CHANGED broadcasts.
|
||||||
Log.d(TAG, "onDisabled");
|
Log.d(TAG, "onDisabled");
|
||||||
Class clazz = ExampleBroadcastReceiver.class;
|
|
||||||
PackageManager pm = context.getPackageManager();
|
PackageManager pm = context.getPackageManager();
|
||||||
pm.setComponentEnabledSetting(
|
pm.setComponentEnabledSetting(
|
||||||
new ComponentName("com.example.android.apis", ".appwidget.ExampleBroadcastReceiver"),
|
new ComponentName("com.example.android.apis", ".appwidget.ExampleBroadcastReceiver"),
|
||||||
|
|||||||
@@ -17,21 +17,13 @@
|
|||||||
package com.example.android.apis.appwidget;
|
package com.example.android.apis.appwidget;
|
||||||
|
|
||||||
import android.appwidget.AppWidgetManager;
|
import android.appwidget.AppWidgetManager;
|
||||||
import android.appwidget.AppWidgetProvider;
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.RemoteViews;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
// Need the following import to get access to the app resources, since this
|
|
||||||
// class is in a sub-package.
|
|
||||||
import com.example.android.apis.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A BroadcastReceiver that listens for updates for the ExampleAppWidgetProvider. This
|
* A BroadcastReceiver that listens for updates for the ExampleAppWidgetProvider. This
|
||||||
* BroadcastReceiver starts off disabled, and we only enable it when there is a widget
|
* BroadcastReceiver starts off disabled, and we only enable it when there is a widget
|
||||||
@@ -39,6 +31,7 @@ import com.example.android.apis.R;
|
|||||||
*/
|
*/
|
||||||
public class ExampleBroadcastReceiver extends BroadcastReceiver {
|
public class ExampleBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.d("ExmampleBroadcastReceiver", "intent=" + intent);
|
Log.d("ExmampleBroadcastReceiver", "intent=" + intent);
|
||||||
|
|
||||||
@@ -48,8 +41,8 @@ public class ExampleBroadcastReceiver extends BroadcastReceiver {
|
|||||||
if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)
|
if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)
|
||||||
|| action.equals(Intent.ACTION_TIME_CHANGED)) {
|
|| action.equals(Intent.ACTION_TIME_CHANGED)) {
|
||||||
AppWidgetManager gm = AppWidgetManager.getInstance(context);
|
AppWidgetManager gm = AppWidgetManager.getInstance(context);
|
||||||
ArrayList<Integer> appWidgetIds = new ArrayList();
|
ArrayList<Integer> appWidgetIds = new ArrayList<Integer>();
|
||||||
ArrayList<String> texts = new ArrayList();
|
ArrayList<String> texts = new ArrayList<String>();
|
||||||
|
|
||||||
ExampleAppWidgetConfigure.loadAllTitlePrefs(context, appWidgetIds, texts);
|
ExampleAppWidgetConfigure.loadAllTitlePrefs(context, appWidgetIds, texts);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.example.android.apis.graphics;
|
package com.example.android.apis.graphics;
|
||||||
|
|
||||||
import android.R;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -218,7 +217,7 @@ public class ColorPickerDialog extends Dialog {
|
|||||||
mInitialColor = initialColor;
|
mInitialColor = initialColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
OnColorChangedListener l = new OnColorChangedListener() {
|
OnColorChangedListener l = new OnColorChangedListener() {
|
||||||
|
|||||||
@@ -18,31 +18,34 @@ package com.example.android.apis.graphics.kube;
|
|||||||
|
|
||||||
public class GLColor {
|
public class GLColor {
|
||||||
|
|
||||||
public final int red;
|
public final int red;
|
||||||
public final int green;
|
public final int green;
|
||||||
public final int blue;
|
public final int blue;
|
||||||
public final int alpha;
|
public final int alpha;
|
||||||
|
|
||||||
public GLColor(int red, int green, int blue, int alpha) {
|
|
||||||
this.red = red;
|
|
||||||
this.green = green;
|
|
||||||
this.blue = blue;
|
|
||||||
this.alpha = alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GLColor(int red, int green, int blue) {
|
public GLColor(int red, int green, int blue, int alpha) {
|
||||||
this.red = red;
|
this.red = red;
|
||||||
this.green = green;
|
this.green = green;
|
||||||
this.blue = blue;
|
this.blue = blue;
|
||||||
this.alpha = 0x10000;
|
this.alpha = alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
public GLColor(int red, int green, int blue) {
|
||||||
if (other instanceof GLColor) {
|
this.red = red;
|
||||||
GLColor color = (GLColor)other;
|
this.green = green;
|
||||||
return (red == color.red && green == color.green &&
|
this.blue = blue;
|
||||||
blue == color.blue && alpha == color.alpha);
|
this.alpha = 0x10000;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other instanceof GLColor) {
|
||||||
|
GLColor color = (GLColor)other;
|
||||||
|
return (red == color.red &&
|
||||||
|
green == color.green &&
|
||||||
|
blue == color.blue &&
|
||||||
|
alpha == color.alpha);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,70 +19,71 @@ package com.example.android.apis.graphics.kube;
|
|||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
public class GLVertex {
|
public class GLVertex {
|
||||||
|
|
||||||
public float x;
|
|
||||||
public float y;
|
|
||||||
public float z;
|
|
||||||
final short index; // index in vertex table
|
|
||||||
GLColor color;
|
|
||||||
|
|
||||||
GLVertex() {
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.z = 0;
|
|
||||||
this.index = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLVertex(float x, float y, float z, int index) {
|
public float x;
|
||||||
this.x = x;
|
public float y;
|
||||||
this.y = y;
|
public float z;
|
||||||
this.z = z;
|
final short index; // index in vertex table
|
||||||
this.index = (short)index;
|
GLColor color;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
GLVertex() {
|
||||||
if (other instanceof GLVertex) {
|
this.x = 0;
|
||||||
GLVertex v = (GLVertex)other;
|
this.y = 0;
|
||||||
return (x == v.x && y == v.y && z == v.z);
|
this.z = 0;
|
||||||
}
|
this.index = -1;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public int toFixed(float x) {
|
|
||||||
return (int)(x*65536.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void put(IntBuffer vertexBuffer, IntBuffer colorBuffer) {
|
GLVertex(float x, float y, float z, int index) {
|
||||||
vertexBuffer.put(toFixed(x));
|
this.x = x;
|
||||||
vertexBuffer.put(toFixed(y));
|
this.y = y;
|
||||||
vertexBuffer.put(toFixed(z));
|
this.z = z;
|
||||||
if (color == null) {
|
this.index = (short)index;
|
||||||
colorBuffer.put(0);
|
}
|
||||||
colorBuffer.put(0);
|
|
||||||
colorBuffer.put(0);
|
@Override
|
||||||
colorBuffer.put(0);
|
public boolean equals(Object other) {
|
||||||
} else {
|
if (other instanceof GLVertex) {
|
||||||
colorBuffer.put(color.red);
|
GLVertex v = (GLVertex)other;
|
||||||
colorBuffer.put(color.green);
|
return (x == v.x && y == v.y && z == v.z);
|
||||||
colorBuffer.put(color.blue);
|
}
|
||||||
colorBuffer.put(color.alpha);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
static public int toFixed(float x) {
|
||||||
public void update(IntBuffer vertexBuffer, M4 transform) {
|
return (int)(x * 65536.0f);
|
||||||
// skip to location of vertex in mVertex buffer
|
}
|
||||||
vertexBuffer.position(index * 3);
|
|
||||||
|
public void put(IntBuffer vertexBuffer, IntBuffer colorBuffer) {
|
||||||
if (transform == null) {
|
vertexBuffer.put(toFixed(x));
|
||||||
vertexBuffer.put(toFixed(x));
|
vertexBuffer.put(toFixed(y));
|
||||||
vertexBuffer.put(toFixed(y));
|
vertexBuffer.put(toFixed(z));
|
||||||
vertexBuffer.put(toFixed(z));
|
if (color == null) {
|
||||||
} else {
|
colorBuffer.put(0);
|
||||||
GLVertex temp = new GLVertex();
|
colorBuffer.put(0);
|
||||||
transform.multiply(this, temp);
|
colorBuffer.put(0);
|
||||||
vertexBuffer.put(toFixed(temp.x));
|
colorBuffer.put(0);
|
||||||
vertexBuffer.put(toFixed(temp.y));
|
} else {
|
||||||
vertexBuffer.put(toFixed(temp.z));
|
colorBuffer.put(color.red);
|
||||||
}
|
colorBuffer.put(color.green);
|
||||||
}
|
colorBuffer.put(color.blue);
|
||||||
|
colorBuffer.put(color.alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(IntBuffer vertexBuffer, M4 transform) {
|
||||||
|
// skip to location of vertex in mVertex buffer
|
||||||
|
vertexBuffer.position(index * 3);
|
||||||
|
|
||||||
|
if (transform == null) {
|
||||||
|
vertexBuffer.put(toFixed(x));
|
||||||
|
vertexBuffer.put(toFixed(y));
|
||||||
|
vertexBuffer.put(toFixed(z));
|
||||||
|
} else {
|
||||||
|
GLVertex temp = new GLVertex();
|
||||||
|
transform.multiply(this, temp);
|
||||||
|
vertexBuffer.put(toFixed(temp.x));
|
||||||
|
vertexBuffer.put(toFixed(temp.y));
|
||||||
|
vertexBuffer.put(toFixed(temp.z));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.example.android.apis.graphics.kube;
|
|||||||
|
|
||||||
import android.opengl.GLSurfaceView;
|
import android.opengl.GLSurfaceView;
|
||||||
|
|
||||||
import javax.microedition.khronos.egl.EGL10;
|
|
||||||
import javax.microedition.khronos.egl.EGLConfig;
|
import javax.microedition.khronos.egl.EGLConfig;
|
||||||
import javax.microedition.khronos.opengles.GL10;
|
import javax.microedition.khronos.opengles.GL10;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.example.android.apis.media;
|
package com.example.android.apis.media;
|
||||||
|
|
||||||
import com.example.android.apis.R;
|
import com.example.android.apis.R;
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.example.android.apis.media;
|
package com.example.android.apis.media;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -23,6 +39,7 @@ public class MediaPlayerDemo_Audio extends Activity {
|
|||||||
|
|
||||||
private TextView tx;
|
private TextView tx;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
tx = new TextView(this);
|
tx = new TextView(this);
|
||||||
|
|||||||
@@ -1,10 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.example.android.apis.media;
|
package com.example.android.apis.media;
|
||||||
|
|
||||||
import com.example.android.apis.R;
|
import com.example.android.apis.R;
|
||||||
import com.example.android.apis.app.AlarmController;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.media.MediaPlayer.OnBufferingUpdateListener;
|
import android.media.MediaPlayer.OnBufferingUpdateListener;
|
||||||
@@ -15,9 +29,6 @@ import android.os.Bundle;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +57,7 @@ public class MediaPlayerDemo_Video extends Activity implements
|
|||||||
*
|
*
|
||||||
* Called when the activity is first created.
|
* Called when the activity is first created.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
setContentView(R.layout.mediaplayer_2);
|
setContentView(R.layout.mediaplayer_2);
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.example.android.apis.media;
|
package com.example.android.apis.media;
|
||||||
|
|
||||||
import com.example.android.apis.R;
|
import com.example.android.apis.R;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.MediaController;
|
import android.widget.MediaController;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.VideoView;
|
import android.widget.VideoView;
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import com.example.android.apis.R;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baseline alignment includes elements within nested vertical
|
* Baseline alignment includes elements within nested vertical
|
||||||
@@ -29,7 +27,7 @@ import android.widget.TextView;
|
|||||||
*/
|
*/
|
||||||
public class BaselineNested1 extends Activity {
|
public class BaselineNested1 extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import com.example.android.apis.R;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baseline alignment includes an element within a nested horizontal
|
* Baseline alignment includes an element within a nested horizontal
|
||||||
@@ -29,7 +27,7 @@ import android.widget.TextView;
|
|||||||
*/
|
*/
|
||||||
public class BaselineNested2 extends Activity {
|
public class BaselineNested2 extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import com.example.android.apis.R;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baseline alignment includes a {@link android.widget.LinearLayout}
|
* Baseline alignment includes a {@link android.widget.LinearLayout}
|
||||||
@@ -29,7 +27,7 @@ import android.widget.TextView;
|
|||||||
*/
|
*/
|
||||||
public class BaselineNested3 extends Activity {
|
public class BaselineNested3 extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
public class Focus2 extends Activity {
|
public class Focus2 extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class Focus3 extends Activity {
|
|||||||
private Button mTopButton;
|
private Button mTopButton;
|
||||||
private Button mBottomButton;
|
private Button mBottomButton;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ public class InternalSelectionView extends View {
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see android.view.KeyEvent.Callback#onKeyDown(int, android.view.KeyEvent)
|
* @see android.view.KeyEvent.Callback#onKeyDown(int, android.view.KeyEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
switch(event.getKeyCode()) {
|
switch(event.getKeyCode()) {
|
||||||
case KeyEvent.KEYCODE_DPAD_UP:
|
case KeyEvent.KEYCODE_DPAD_UP:
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.example.android.apis.view;
|
package com.example.android.apis.view;
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.animation.AlphaAnimation;
|
import android.view.animation.AlphaAnimation;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import com.example.android.apis.R;
|
|||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
public class LayoutAnimation3 extends ListActivity {
|
public class LayoutAnimation3 extends ListActivity {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import android.os.Bundle;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.Gallery;
|
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
|||||||
@@ -19,20 +19,7 @@ package com.example.android.apis.view;
|
|||||||
import com.example.android.apis.R;
|
import com.example.android.apis.R;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.animation.AlphaAnimation;
|
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.GridLayoutAnimationController;
|
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.Gallery;
|
|
||||||
import android.widget.GridView;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class LayoutAnimation7 extends Activity {
|
public class LayoutAnimation7 extends Activity {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -49,10 +49,12 @@ public class List5 extends ListActivity {
|
|||||||
return mStrings.length;
|
return mStrings.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean areAllItemsEnabled() {
|
public boolean areAllItemsEnabled() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEnabled(int position) {
|
public boolean isEnabled(int position) {
|
||||||
return !mStrings[position].startsWith("-");
|
return !mStrings[position].startsWith("-");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user