[Samsung Galaxy Nexus] kai4000:
Coding Help

Hi Guys,

Sorry for my noobness.

This is android 4.2.1

I'm trying to make it so that the settings button doesn't have an action in the Status Bar - Quick Settings, or so that I can have it ask for a password to access the settings.

Everytime I edit the java file and try to build I get:

Here is the original code.

QuickSettingsModel.RefreshCallback() {
@Override
public void refreshView(QuickSettingsTileView view, State alarmState) {
TextView tv = (TextView) view.findViewById(R.id.alarm_textview);
tv.setText(alarmState.label);
view.setVisibility(alarmState.enabled ? View.VISIBLE : View.GONE);
view.setContentDescription(mContext.getString(
R.string.accessibility_quick_settings_alarm, alarmState.label));
}
});
parent.addView(alarmTile);

// Location
QuickSettingsTileView locationTile = (QuickSettingsTileView)
inflater.inflate(R.layout.quick_settings_tile, parent, false);
locationTile.setContent(R.layout.quick_settings_tile_location, inflater);
locationTile.setOnClickListener(new View.OnClickListener() {
@Override[CODE]

public void onClick(View v) {

startSettingsActivity(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);

}

});

mModel.addLocationTile(locationTile, new QuickSettingsModel.RefreshCallback() {

@Override

public void refreshView(QuickSettingsTileView view, State state) {

TextView tv = (TextView) view.findViewById(R.id.location_textview);

tv.setText(state.label);

view.setVisibility(state.enabled ? View.VISIBLE : View.GONE);

}

});

parent.addView(locationTile);

// Wifi Display

QuickSettingsTileView wifiDisplayTile = (QuickSettingsTileView)

inflater.inflate(R.layout.quick_settings_tile, parent, false);

wifiDisplayTile.setContent(R.layout.quick_settings_tile_wifi_display, inflater);

wifiDisplayTile.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

startSettingsActivity(android.provider.Settings.ACTION_WIFI_DISPLAY_SETTINGS);

}

});

mModel.addWifiDisplayTile(wifiDisplayTile, new QuickSettingsModel.RefreshCallback() {

@Override

public void refreshView(QuickSettingsTileView view, State state) {

TextView tv = (TextView) view.findViewById(R.id.wifi_display_textview);

tv.setText(state.label);

tv.setCompoundDrawablesWithIntrinsicBounds(0, state.iconId, 0, 0);

view.setVisibility(state.enabled ? View.VISIBLE : View.GONE);

}

});

parent.addView(wifiDisplayTile);

if (SHOW_IME_TILE) {

// IME

QuickSettingsTileView imeTile = (QuickSettingsTileView)

inflater.inflate(R.layout.quick_settings_tile, parent, false);

imeTile.setContent(R.layout.quick_settings_tile_ime, inflater);

imeTile.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

try {

mBar.collapseAllPanels(true);

Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER);

PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);

pendingIntent.send();

} catch (Exception e) {}

}

});

mModel.addImeTile(imeTile, new QuickSettingsModel.RefreshCallback() {

@Override

public void refreshView(QuickSettingsTileView view, State state) {

TextView tv = (TextView) view.findViewById(R.id.ime_textview);

if (state.label != null) {

tv.setText(state.label);

}

view.setVisibility(state.enabled ? View.VISIBLE : View.GONE);

}

});

parent.addView(imeTile);

}

// Bug reports

QuickSettingsTileView bugreportTile = (QuickSettingsTileView)

inflater.inflate(R.layout.quick_settings_tile, parent, false);

bugreportTile.setContent(R.layout.quick_settings_tile_bugreport, inflater);

bugreportTile.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

mBar.collapseAllPanels(true);

showBugreportDialog();

}

});

mModel.addBugreportTile(bugreportTile, new QuickSettingsModel.RefreshCallback() {

@Override

public void refreshView(QuickSettingsTileView view, State state) {

view.setVisibility(state.enabled ? View.VISIBLE : View.GONE);

}

});

parent.addView(bugreportTile);

/*

QuickSettingsTileView mediaTile = (QuickSettingsTileView)

inflater.inflate(R.layout.quick_settings_tile, parent, false);

mediaTile.setContent(R.layout.quick_settings_tile_media, inflater);

parent.addView(mediaTile);

QuickSettingsTileView imeTile = (QuickSettingsTileView)

inflater.inflate(R.layout.quick_settings_tile, parent, false);

imeTile.setContent(R.layout.quick_settings_tile_ime, inflater);

imeTile.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

parent.removeViewAt(0);

}

});

parent.addView(imeTile);

*/

}

void updateResources() {

Resources r = mContext.getResources();

// Update the model

mModel.updateResources();

// Update the User, Time, and Settings tiles spans, and reset everything else

int span = r.getInteger(R.integer.quick_settings_user_time_settings_tile_span);

for (QuickSettingsTileView v : mDynamicSpannedTiles) {

v.setColumnSpan(span);

}

((QuickSettingsContainerView)mContainerView).updateResources();

mContainerView.requestLayout();

// Reset the dialog

boolean isBrightnessDialogVisible = false;

if (mBrightnessDialog != null) {

removeAllBrightnessDialogCallbacks();

isBrightnessDialogVisible = mBrightnessDialog.isShowing();

mBrightnessDialog.dismiss();

}

mBrightnessDialog = null;

if (isBrightnessDialogVisible) {

showBrightnessDialog();

}

}

private void removeAllBrightnessDialogCallbacks() {

mHandler.removeCallbacks(mDismissBrightnessDialogRunnable);

}

private Runnable mDismissBrightnessDialogRunnable = new Runnable() {

public void run() {

if (mBrightnessDialog != null && mBrightnessDialog.isShowing()) {

mBrightnessDialog.dismiss();

}

removeAllBrightnessDialogCallbacks();

};

};

private void showBrightnessDialog() {

if (mBrightnessDialog == null) {

mBrightnessDialog = new Dialog(mContext);

mBrightnessDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

mBrightnessDialog.setContentView(R.layout.quick_settings_brightness_dialog);

mBrightnessDialog.setCanceledOnTouchOutside(true);

mBrightnessController = new BrightnessController(mContext,

(ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon),

(ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider));

mBrightnessController.addStateChangedCallback(mModel);

mBrightnessDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

@Override

public void onDismiss(DialogInterface dialog) {

mBrightnessController = null;

}

});

mBrightnessDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

mBrightnessDialog.getWindow().getAttributes().privateFlags |=

WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;

mBrightnessDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

}

if (!mBrightnessDialog.isShowing()) {

try {

WindowManagerGlobal.getWindowManagerService().dismissKeyguard();

} catch (RemoteException e) {

}

mBrightnessDialog.show();

dismissBrightnessDialog(mBrightnessDialogLongTimeout);

}

}

private void dismissBrightnessDialog(int timeout) {

removeAllBrightnessDialogCallbacks();

if (mBrightnessDialog != null) {

mHandler.postDelayed(mDismissBrightnessDialogRunnable, timeout);

}

}

private void showBugreportDialog() {

final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

if (which == DialogInterface.BUTTON_POSITIVE) {

// Add a little delay before executing, to give the

// dialog a chance to go away before it takes a

// screenshot.

mHandler.postDelayed(new Runnable() {

@Override public void run() {

try {

ActivityManagerNative.getDefault()

.requestBugReport();

} catch (RemoteException e) {

}

}

}, 500);

}

}

});

builder.setMessage(com.android.internal.R.string.bugreport_message);

builder.setTitle(com.android.internal.R.string.bugreport_title);

builder.setCancelable(true);

final Dialog dialog = builder.create();

dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

try {

WindowManagerGlobal.getWindowManagerService().dismissKeyguard();

} catch (RemoteException e) {

}

dialog.show();

}

private void updateWifiDisplayStatus() {

mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();

applyWifiDisplayStatus();

}

private void applyWifiDisplayStatus() {

mModel.onWifiDisplayStateChanged(mWifiDisplayStatus);

}

private void applyBluetoothStatus() {

mModel.onBluetoothStateChange(mBluetoothState);

}

void reloadUserInfo() {

if (mUserInfoTask != null) {

mUserInfoTask.cancel(false);

mUserInfoTask = null;

}

if (mTilesSetUp) {

queryForUserInformation();

}

}

private final BroadcastReceiver mReceiver = new BroadcastReceiver() {

@Override

public void onReceive(Context context, Intent intent) {

final String action = intent.getAction();

if (DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED.equals(action)) {

WifiDisplayStatus status = (WifiDisplayStatus)intent.getParcelableExtra(

DisplayManager.EXTRA_WIFI_DISPLAY_STATUS);

mWifiDisplayStatus = status;

applyWifiDisplayStatus();

} else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {

int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,

BluetoothAdapter.ERROR);

mBluetoothState.enabled = (state == BluetoothAdapter.STATE_ON);

applyBluetoothStatus();

} else if (BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {

int status = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE,

BluetoothAdapter.STATE_DISCONNECTED);

mBluetoothState.connected = (status == BluetoothAdapter.STATE_CONNECTED);

applyBluetoothStatus();

} else if (Intent.ACTION_USER_SWITCHED.equals(action)) {

reloadUserInfo();

}

}

};

private final BroadcastReceiver mProfileReceiver = new BroadcastReceiver() {

@Override

public void onReceive(Context context, Intent intent) {

final String action = intent.getAction();

if (ContactsContract.Intents.ACTION_PROFILE_CHANGED.equals(action) ||

Intent.ACTION_USER_INFO_CHANGED.equals(action)) {

try {

final int userId = ActivityManagerNative.getDefault().getCurrentUser().id;

if (getSendingUserId() == userId) {

reloadUserInfo();

}

} catch (RemoteException e) {

Log.e(TAG, "Couldn't get current user id for profile change", e);

}

}

}

};

}[/CODE]