am 66f17e50: ApiDemos Clean up

Merge commit '66f17e50dbb42bc529dd12b2f26729f114b1a1a9'

* commit '66f17e50dbb42bc529dd12b2f26729f114b1a1a9':
  ApiDemos Clean up
This commit is contained in:
Xavier Ducrohet
2009-08-03 19:09:37 -07:00
committed by Android Git Automerger
23 changed files with 177 additions and 143 deletions

View File

@@ -16,8 +16,6 @@
package com.example.android.apis;
import com.example.android.apis.app.DefaultValues;
import android.app.Application;
import android.preference.PreferenceManager;
@@ -33,6 +31,7 @@ import android.preference.PreferenceManager;
*/
public class ApiDemosApplication extends Application {
@Override
public void onCreate() {
/*
* 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);
}
@Override
public void onTerminate() {
}
}

View File

@@ -22,14 +22,13 @@ import android.app.Activity;
import android.app.NotificationManager;
import android.os.Bundle;
import java.util.Map;
/**
* This activity is run as the click activity for {@link IncomingMessage}.
* When it comes up, it also clears the notification, because the "message"
* has been "read."
*/
public class IncomingMessageView extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.incoming_message_view);

View File

@@ -20,14 +20,11 @@ import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.SystemClock;
import android.util.Log;
import android.widget.RemoteViews;
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;
@@ -51,6 +48,7 @@ public class ExampleAppWidgetProvider extends AppWidgetProvider {
// log tag
private static final String TAG = "ExampleAppWidgetProvider";
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
Log.d(TAG, "onUpdate");
// 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) {
Log.d(TAG, "onDeleted");
// 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) {
Log.d(TAG, "onEnabled");
// 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);
}
@Override
public void onDisabled(Context context) {
// When the first widget is created, stop listening for the TIMEZONE_CHANGED and
// TIME_CHANGED broadcasts.
Log.d(TAG, "onDisabled");
Class clazz = ExampleBroadcastReceiver.class;
PackageManager pm = context.getPackageManager();
pm.setComponentEnabledSetting(
new ComponentName("com.example.android.apis", ".appwidget.ExampleBroadcastReceiver"),

View File

@@ -17,21 +17,13 @@
package com.example.android.apis.appwidget;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import android.util.Log;
import android.widget.RemoteViews;
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
* 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 {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("ExmampleBroadcastReceiver", "intent=" + intent);
@@ -48,8 +41,8 @@ public class ExampleBroadcastReceiver extends BroadcastReceiver {
if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)
|| action.equals(Intent.ACTION_TIME_CHANGED)) {
AppWidgetManager gm = AppWidgetManager.getInstance(context);
ArrayList<Integer> appWidgetIds = new ArrayList();
ArrayList<String> texts = new ArrayList();
ArrayList<Integer> appWidgetIds = new ArrayList<Integer>();
ArrayList<String> texts = new ArrayList<String>();
ExampleAppWidgetConfigure.loadAllTitlePrefs(context, appWidgetIds, texts);

View File

@@ -16,7 +16,6 @@
package com.example.android.apis.graphics;
import android.R;
import android.os.Bundle;
import android.app.Dialog;
import android.content.Context;
@@ -218,7 +217,7 @@ public class ColorPickerDialog extends Dialog {
mInitialColor = initialColor;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OnColorChangedListener l = new OnColorChangedListener() {

View File

@@ -37,11 +37,14 @@ public class GLColor {
this.alpha = 0x10000;
}
@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 (red == color.red &&
green == color.green &&
blue == color.blue &&
alpha == color.alpha);
}
return false;
}

View File

@@ -40,6 +40,7 @@ public class GLVertex {
this.index = (short)index;
}
@Override
public boolean equals(Object other) {
if (other instanceof GLVertex) {
GLVertex v = (GLVertex)other;
@@ -49,7 +50,7 @@ public class GLVertex {
}
static public int toFixed(float x) {
return (int)(x*65536.0f);
return (int)(x * 65536.0f);
}
public void put(IntBuffer vertexBuffer, IntBuffer colorBuffer) {

View File

@@ -18,7 +18,6 @@ package com.example.android.apis.graphics.kube;
import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

View File

@@ -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;
import com.example.android.apis.R;

View File

@@ -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;
import android.app.Activity;
@@ -23,6 +39,7 @@ public class MediaPlayerDemo_Audio extends Activity {
private TextView tx;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
tx = new TextView(this);

View File

@@ -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;
import com.example.android.apis.R;
import com.example.android.apis.app.AlarmController;
import android.app.Activity;
import android.graphics.PixelFormat;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnBufferingUpdateListener;
@@ -15,9 +29,6 @@ import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
@@ -46,6 +57,7 @@ public class MediaPlayerDemo_Video extends Activity implements
*
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.mediaplayer_2);

View File

@@ -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;
import com.example.android.apis.R;
import android.app.Activity;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;

View File

@@ -20,8 +20,6 @@ import com.example.android.apis.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* Baseline alignment includes elements within nested vertical
@@ -29,7 +27,7 @@ import android.widget.TextView;
*/
public class BaselineNested1 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -20,8 +20,6 @@ import com.example.android.apis.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* Baseline alignment includes an element within a nested horizontal
@@ -29,7 +27,7 @@ import android.widget.TextView;
*/
public class BaselineNested2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -20,8 +20,6 @@ import com.example.android.apis.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* Baseline alignment includes a {@link android.widget.LinearLayout}
@@ -29,7 +27,7 @@ import android.widget.TextView;
*/
public class BaselineNested3 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -23,6 +23,7 @@ import android.os.Bundle;
public class Focus2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -25,6 +25,7 @@ public class Focus3 extends Activity {
private Button mTopButton;
private Button mBottomButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -199,6 +199,7 @@ public class InternalSelectionView extends View {
/* (non-Javadoc)
* @see android.view.KeyEvent.Callback#onKeyDown(int, android.view.KeyEvent)
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch(event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_UP:

View File

@@ -17,7 +17,6 @@
package com.example.android.apis.view;
import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

View File

@@ -21,8 +21,6 @@ import com.example.android.apis.R;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.view.View;
public class LayoutAnimation3 extends ListActivity {
@Override

View File

@@ -25,7 +25,6 @@ import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.GridView;
import android.widget.ImageView;

View File

@@ -19,20 +19,7 @@ package com.example.android.apis.view;
import com.example.android.apis.R;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
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 {
@Override

View File

@@ -49,10 +49,12 @@ public class List5 extends ListActivity {
return mStrings.length;
}
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public boolean isEnabled(int position) {
return !mStrings[position].startsWith("-");
}