|
60 | 60 | import com.duy.pascal.frontend.R; |
61 | 61 | import com.duy.pascal.frontend.activities.IRunnablePascal; |
62 | 62 | import com.duy.pascal.frontend.code.CompileManager; |
63 | | -import com.duy.pascal.frontend.editor.completion.KeyWord; |
64 | | -import com.duy.pascal.frontend.editor.editor_view.AutoIndentEditText; |
65 | | -import com.duy.pascal.frontend.editor.editor_view.EditorView; |
66 | | -import com.duy.pascal.frontend.editor.editor_view.adapters.InfoItem; |
67 | 63 | import com.duy.pascal.frontend.code_sample.activities.DocumentActivity; |
68 | 64 | import com.duy.pascal.frontend.dialog.DialogCreateNewFile; |
69 | 65 | import com.duy.pascal.frontend.dialog.DialogFragmentFixExpectToken; |
70 | 66 | import com.duy.pascal.frontend.dialog.DialogManager; |
| 67 | +import com.duy.pascal.frontend.editor.completion.KeyWord; |
| 68 | +import com.duy.pascal.frontend.editor.editor_view.AutoIndentEditText; |
| 69 | +import com.duy.pascal.frontend.editor.editor_view.EditorView; |
| 70 | +import com.duy.pascal.frontend.editor.editor_view.adapters.InfoItem; |
71 | 71 | import com.duy.pascal.frontend.setting.PascalPreferences; |
72 | 72 | import com.duy.pascal.frontend.structure.DialogProgramStructure; |
73 | 73 | import com.duy.pascal.frontend.structure.viewholder.StructureType; |
74 | 74 | import com.duy.pascal.frontend.theme.fragment.ThemeFontActivity; |
75 | 75 | import com.duy.pascal.frontend.view.exec_screen.console.ConsoleView; |
76 | | -import com.flask.colorpicker.OnColorSelectedListener; |
| 76 | +import com.flask.colorpicker.builder.ColorPickerClickListener; |
77 | 77 | import com.flask.colorpicker.builder.ColorPickerDialogBuilder; |
78 | 78 | import com.google.common.collect.ArrayListMultimap; |
79 | 79 | import com.google.common.collect.ListMultimap; |
@@ -745,17 +745,24 @@ public void startDebug() { |
745 | 745 | } |
746 | 746 |
|
747 | 747 | public void insertColor() { |
748 | | - ColorPickerDialogBuilder.with(this).setOnColorSelectedListener(new OnColorSelectedListener() { |
749 | | - @Override |
750 | | - public void onColorSelected(int selectedColor) { |
751 | | - EditorFragment currentFragment = pagerAdapter.getCurrentFragment(); |
752 | | - if (currentFragment != null) { |
753 | | - currentFragment.insert(String.valueOf(selectedColor)); |
754 | | - Toast.makeText(EditorActivity.this, getString(R.string.inserted_color) + selectedColor, |
755 | | - Toast.LENGTH_SHORT).show(); |
756 | | - } |
757 | | - } |
758 | | - }).build().show(); |
| 748 | + ColorPickerDialogBuilder.with(this). |
| 749 | + setPositiveButton(getString(R.string.select), new ColorPickerClickListener() { |
| 750 | + @Override |
| 751 | + public void onClick(DialogInterface d, int lastSelectedColor, Integer[] allColors) { |
| 752 | + EditorFragment currentFragment = pagerAdapter.getCurrentFragment(); |
| 753 | + if (currentFragment != null) { |
| 754 | + currentFragment.insert(String.valueOf(lastSelectedColor)); |
| 755 | + Toast.makeText(EditorActivity.this, getString(R.string.inserted_color) + lastSelectedColor, |
| 756 | + Toast.LENGTH_SHORT).show(); |
| 757 | + } |
| 758 | + } |
| 759 | + }) |
| 760 | + .setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { |
| 761 | + @Override |
| 762 | + public void onClick(DialogInterface dialog, int which) { |
| 763 | + dialog.cancel(); |
| 764 | + } |
| 765 | + }).build().show(); |
759 | 766 | } |
760 | 767 |
|
761 | 768 | public void autoFix(ParsingException e) { |
|
0 commit comments