Set drawable for the entity header app preference button.
In the entity header layout, the action buttons resource is set to null by default. When we bind the button with the app preference action, we should also set the drawable to the settings icon as well. Change-Id: Ic259b4c538f529671ca5a9c67664ef32fbbb25ae Fixes: 64826061 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -336,6 +336,7 @@ public class EntityHeaderController {
|
||||
final Intent intent = resolveIntent(
|
||||
new Intent(Intent.ACTION_APPLICATION_PREFERENCES).setPackage(mPackageName));
|
||||
if (intent == null) {
|
||||
button.setImageDrawable(null);
|
||||
button.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
@@ -348,6 +349,7 @@ public class EntityHeaderController {
|
||||
mFragment.startActivity(intent);
|
||||
}
|
||||
});
|
||||
button.setImageResource(R.drawable.ic_settings_24dp);
|
||||
button.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.widget;
|
||||
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
@@ -30,6 +29,7 @@ import android.os.UserHandle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
@@ -148,8 +148,9 @@ public class EntityHeaderControllerTest {
|
||||
EntityHeaderController.ActionType.ACTION_NONE);
|
||||
mController.done(mActivity);
|
||||
|
||||
assertThat(appLinks.findViewById(android.R.id.button1).getVisibility())
|
||||
.isEqualTo(View.VISIBLE);
|
||||
final ImageButton button1 = appLinks.findViewById(android.R.id.button1);
|
||||
assertThat(button1.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(button1.getDrawable()).isNotNull();
|
||||
assertThat(appLinks.findViewById(android.R.id.button2).getVisibility())
|
||||
.isEqualTo(View.GONE);
|
||||
try {
|
||||
@@ -176,8 +177,9 @@ public class EntityHeaderControllerTest {
|
||||
EntityHeaderController.ActionType.ACTION_NONE);
|
||||
mController.done(mActivity);
|
||||
|
||||
assertThat(appLinks.findViewById(android.R.id.button1).getVisibility())
|
||||
.isEqualTo(View.GONE);
|
||||
final ImageButton button1 = appLinks.findViewById(android.R.id.button1);
|
||||
assertThat(button1.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(button1.getDrawable()).isNull();
|
||||
assertThat(appLinks.findViewById(android.R.id.button2).getVisibility())
|
||||
.isEqualTo(View.GONE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user