Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.product_list_activity); setTitle(R.string.choose_product); useProductDetailsActivity = false; theme = new ProductDetailsTheme(getResources()); Intent intent = getIntent(); if (intent.hasExtra(EXTRA_COLLECTION_ID)) { collectionId = intent.getLongExtra(EXTRA_COLLECTION_ID, -1); if (collectionId == -1) { collectionId = null; } } productViewOptionsContainer = findViewById(R.id.product_view_options_container); productViewOptionsContainer.setVisibility(View.GONE); ((Switch) findViewById(R.id.product_details_activity_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { useProductDetailsActivity = isChecked; productViewOptionsContainer.setVisibility(isChecked ? View.VISIBLE : View.GONE); } }); ((Switch) findViewById(R.id.theme_style_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { theme.setStyle(isChecked ? ProductDetailsTheme.Style.LIGHT : ProductDetailsTheme.Style.DARK); } }); ((Switch) findViewById(R.id.product_image_bg_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { theme.setShowProductImageBackground(isChecked); } }); accentColorView = findViewById(R.id.accent_color_view); accentColorView.setBackgroundColor(theme.getAccentColor()); accentColorView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { chooseAccentColor(); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.product_list_activity); setTitle(R.string.choose_product); useProductDetailsActivity = false; theme = new ProductDetailsTheme(getResources()); Intent intent = getIntent(); if (intent.hasExtra(EXTRA_COLLECTION_ID)) { collectionId = intent.getLongExtra(EXTRA_COLLECTION_ID, -1); } productViewOptionsContainer = findViewById(R.id.product_view_options_container); productViewOptionsContainer.setVisibility(View.GONE); ((Switch) findViewById(R.id.product_details_activity_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { useProductDetailsActivity = isChecked; productViewOptionsContainer.setVisibility(isChecked ? View.VISIBLE : View.GONE); } }); ((Switch) findViewById(R.id.theme_style_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { theme.setStyle(isChecked ? ProductDetailsTheme.Style.LIGHT : ProductDetailsTheme.Style.DARK); } }); ((Switch) findViewById(R.id.product_image_bg_switch)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { theme.setShowProductImageBackground(isChecked); } }); accentColorView = findViewById(R.id.accent_color_view); accentColorView.setBackgroundColor(theme.getAccentColor()); accentColorView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { chooseAccentColor(); } }); }