merge from open-source master
Change-Id: Iedee6a43e23821175148324bc2502a33112e2d59
This commit is contained in:
@@ -22,7 +22,6 @@ import com.example.android.apis.R;
|
||||
import com.example.android.apis.view.Controls1;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -20,8 +20,6 @@ package com.example.android.apis.app;
|
||||
// class is in a sub-package.
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -29,7 +27,6 @@ import android.widget.Button;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
|
||||
/**
|
||||
* Front-end for launching {@link ContactsFilterInstrumentation} example
|
||||
* instrumentation class.
|
||||
|
||||
@@ -23,8 +23,6 @@ import android.view.KeyEvent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This is an example implementation of the {@link android.app.Instrumentation}
|
||||
* class, allowing you to run tests against application code. The
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.example.android.apis.app;
|
||||
import com.example.android.apis.ApiDemosApplication;
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
@@ -49,9 +49,9 @@ public class ForegroundService extends Service {
|
||||
static final String ACTION_BACKGROUND = "com.example.android.apis.BACKGROUND";
|
||||
|
||||
// BEGIN_INCLUDE(foreground_compatibility)
|
||||
private static final Class[] mStartForegroundSignature = new Class[] {
|
||||
private static final Class<?>[] mStartForegroundSignature = new Class[] {
|
||||
int.class, Notification.class};
|
||||
private static final Class[] mStopForegroundSignature = new Class[] {
|
||||
private static final Class<?>[] mStopForegroundSignature = new Class[] {
|
||||
boolean.class};
|
||||
|
||||
private NotificationManager mNM;
|
||||
|
||||
@@ -20,8 +20,6 @@ package com.example.android.apis.app;
|
||||
// class is in a sub-package.
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -29,7 +27,6 @@ import android.widget.Button;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
|
||||
/**
|
||||
* Front-end for launching {@link LocalSampleInstrumentation} example
|
||||
* instrumentation class.
|
||||
|
||||
@@ -23,8 +23,6 @@ import android.view.KeyEvent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This is an example implementation of the {@link android.app.Instrumentation}
|
||||
* class demonstrating instrumentation against one of this application's sample
|
||||
|
||||
@@ -45,6 +45,10 @@ import com.example.android.apis.R;
|
||||
public class LocalService extends Service {
|
||||
private NotificationManager mNM;
|
||||
|
||||
// Unique Identification Number for the Notification.
|
||||
// We use it on Notification start, and to cancel it.
|
||||
private int NOTIFICATION = R.string.local_service_started;
|
||||
|
||||
/**
|
||||
* Class for clients to access. Because we know this service always
|
||||
* runs in the same process as its clients, we don't need to deal with
|
||||
@@ -75,7 +79,7 @@ public class LocalService extends Service {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
// Cancel the persistent notification.
|
||||
mNM.cancel(R.string.local_service_started);
|
||||
mNM.cancel(NOTIFICATION);
|
||||
|
||||
// Tell the user we stopped.
|
||||
Toast.makeText(this, R.string.local_service_stopped, Toast.LENGTH_SHORT).show();
|
||||
@@ -110,8 +114,7 @@ public class LocalService extends Service {
|
||||
text, contentIntent);
|
||||
|
||||
// Send the notification.
|
||||
// We use a layout id because it is a unique number. We use it later to cancel.
|
||||
mNM.notify(R.string.local_service_started, notification);
|
||||
mNM.notify(NOTIFICATION, notification);
|
||||
}
|
||||
}
|
||||
//END_INCLUDE(service)
|
||||
|
||||
@@ -24,14 +24,11 @@ import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
|
||||
/**
|
||||
* Activity used by StatusBarNotification to show the notification to the user.
|
||||
*/
|
||||
|
||||
@@ -21,14 +21,12 @@ package com.example.android.apis.app;
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
|
||||
/**
|
||||
* Controller to start and stop a service. The serivce will update a status bar
|
||||
* notification every 5 seconds for a minute.
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.os.ConditionVariable;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
/**
|
||||
* This is an example of service that will update its status bar balloon
|
||||
|
||||
@@ -18,9 +18,7 @@ package com.example.android.apis.app;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
public class PreferencesFromXml extends PreferenceActivity {
|
||||
|
||||
@@ -75,8 +75,6 @@ public class QuickContactsDemo extends ListActivity {
|
||||
@Override
|
||||
public void bindView(View view, Context context, Cursor cursor) {
|
||||
final ContactListItemCache cache = (ContactListItemCache) view.getTag();
|
||||
TextView nameView = cache.nameView;
|
||||
QuickContactBadge photoView = cache.photoView;
|
||||
// Set the name
|
||||
cursor.copyStringToBuffer(SUMMARY_NAME_COLUMN_INDEX, cache.nameBuffer);
|
||||
int size = cache.nameBuffer.sizeCopied;
|
||||
|
||||
@@ -18,8 +18,6 @@ package com.example.android.apis.app;
|
||||
|
||||
// Need the following import to get access to the app resources, since this
|
||||
// class is in a sub-package.
|
||||
import java.util.Map;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -31,8 +29,6 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Shows how an activity can send data to its launching activity when done.y.
|
||||
* <p>This can be used, for example, to implement a dialog alowing the user to
|
||||
|
||||
@@ -32,8 +32,11 @@ import android.widget.TextView;
|
||||
*/
|
||||
public class RedirectGetter extends Activity
|
||||
{
|
||||
private String mTextPref;
|
||||
private TextView mText;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@@ -45,9 +48,12 @@ public class RedirectGetter extends Activity
|
||||
|
||||
// The text being set.
|
||||
mText = (TextView)findViewById(R.id.text);
|
||||
|
||||
// Display the stored values, or if not stored initialize with an empty String
|
||||
loadPrefs();
|
||||
}
|
||||
|
||||
private final boolean loadPrefs()
|
||||
private final void loadPrefs()
|
||||
{
|
||||
// Retrieve the current redirect values.
|
||||
// NOTE: because this preference is shared between multiple
|
||||
@@ -58,10 +64,9 @@ public class RedirectGetter extends Activity
|
||||
mTextPref = preferences.getString("text", null);
|
||||
if (mTextPref != null) {
|
||||
mText.setText(mTextPref);
|
||||
return true;
|
||||
} else {
|
||||
mText.setText("");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private OnClickListener mApplyListener = new OnClickListener()
|
||||
@@ -79,8 +84,4 @@ public class RedirectGetter extends Activity
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
private String mTextPref;
|
||||
TextView mText;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* <h3>Wallpaper Activity</h3>
|
||||
|
||||
Reference in New Issue
Block a user