android:divider="?android:dividerVertical"
android:showDividers="middle">
- <ListView
- android:id="@+id/listItems"
- android:orientation="vertical"
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_margin="8dip">
+
+ <TextView
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:text="@string/filtershow_preset_name"
+ android:layout_margin="8dp"
+ />
+
+ <EditText
+ android:id="@+id/editView"
+ android:gravity="center"
+ android:textSize="18sp"
+ android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_margin="8dip"
- android:divider="@android:color/transparent"
- android:dividerHeight="8dip"/>
+ android:focusable="true"
+ android:imeOptions="actionDone"
+ android:singleLine="true"/>
+ </LinearLayout>
<LinearLayout
android:orientation="horizontal"
style="?android:attr/buttonBarButtonStyle" />
<Button
- android:id="@+id/addpreset"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:text="@string/filtershow_save_preset"
- style="?android:attr/buttonBarButtonStyle"/>
-
- <Button
android:id="@+id/ok"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:layout_weight=".1"
android:gravity="center"
- android:src="@drawable/ic_menu_trash_holo_light"/>
+ android:src="@drawable/ic_menu_trash_holo_light"
+ android:visibility="gone"/>
</LinearLayout>
\ No newline at end of file
<string name="filtershow_manage_preset">Manage user presets</string>
<!-- Label for newly created user preset [CHAR LIMIT=30] -->
<string name="filtershow_new_preset">New Preset</string>
+ <!-- Label for preset name [CHAR LIMIT=30] -->
+ <string name="filtershow_preset_name">Preset Name</string>
<!-- Label for showing the image information panel [CHAR LIMIT=50] -->
<string name="filtershow_show_info_panel">Information</string>
updateVersions();
}
+ public void removeLook(Action action) {
+ FilterUserPresetRepresentation rep = (FilterUserPresetRepresentation) action.getRepresentation();
+ if (rep == null) {
+ return;
+ }
+ mUserPresetsManager.delete(rep.getId());
+ }
+
private void fillEffects() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getEffects();
for (int i = 0; i < presets.size(); i++) {
FilterUserPresetRepresentation representation = presets.get(i);
mCategoryLooksAdapter.add(
- new Action(this, representation, Action.FULL_VIEW));
+ new Action(this, representation, Action.FULL_VIEW, true));
mUserPresetsAdapter.add(new Action(this, representation, Action.FULL_VIEW));
}
if (presets.size() > 0) {
mCategoryLooksAdapter.notifyDataSetInvalidated();
}
- public void saveCurrentImagePreset() {
- mUserPresetsManager.save(MasterImage.getImage().getPreset());
+ public void saveCurrentImagePreset(String name) {
+ mUserPresetsManager.save(MasterImage.getImage().getPreset(), name);
}
private void deletePreset(int id) {
@Override
public void remove(Action action) {
- if (mCategory != MainPanel.VERSIONS) {
+ if (!(mCategory == MainPanel.VERSIONS
+ || mCategory == MainPanel.LOOKS)) {
return;
}
super.remove(action);
FilterShowActivity activity = (FilterShowActivity) getContext();
- activity.removeVersion(action);
+ if (mCategory == MainPanel.LOOKS) {
+ activity.removeLook(action);
+ } else if (mCategory == MainPanel.VERSIONS) {
+ activity.removeVersion(action);
+ }
}
public void setOrientation(int orientation) {
String name;
}
- public void save(ImagePreset preset) {
+ public void save(ImagePreset preset, String name) {
Message msg = mProcessingHandler.obtainMessage(SAVE);
SaveOperation op = new SaveOperation();
op.json = preset.getJsonString(mActivity.getString(R.string.saved));
- op.name= mActivity.getString(R.string.filtershow_new_preset);
+ op.name = name;
msg.obj = op;
mProcessingHandler.sendMessage(msg);
}
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.EditText;
+import android.widget.ImageView;
import android.widget.ListView;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.FilterShowActivity;
public class PresetManagementDialog extends DialogFragment implements View.OnClickListener {
private UserPresetsAdapter mAdapter;
+ private EditText mEditText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
FilterShowActivity activity = (FilterShowActivity) getActivity();
mAdapter = activity.getUserPresetsAdapter();
- ListView panel = (ListView) view.findViewById(R.id.listItems);
- panel.setAdapter(mAdapter);
-
+ mEditText = (EditText) view.findViewById(R.id.editView);
view.findViewById(R.id.cancel).setOnClickListener(this);
- view.findViewById(R.id.addpreset).setOnClickListener(this);
view.findViewById(R.id.ok).setOnClickListener(this);
- getDialog().setTitle(getString(R.string.filtershow_manage_preset));
+ getDialog().setTitle(getString(R.string.filtershow_save_preset));
return view;
}
activity.updateUserPresetsFromAdapter(mAdapter);
dismiss();
break;
- case R.id.addpreset:
- activity.saveCurrentImagePreset();
- dismiss();
- break;
case R.id.ok:
+ String text = String.valueOf(mEditText.getText());
+ activity.saveCurrentImagePreset(text);
mAdapter.updateCurrent();
activity.updateUserPresetsFromAdapter(mAdapter);
dismiss();