Search in sources :

Example 1 with ThemeHelper

use of org.horaapps.leafpic.util.ThemeHelper in project LeafPic by HoraApps.

the class SelectAlbumBottomSheet method setupDialog.

@Override
public void setupDialog(Dialog dialog, int style) {
    super.setupDialog(dialog, style);
    View contentView = View.inflate(getContext(), R.layout.select_folder_bottom_sheet, null);
    theme = new ThemeHelper(getContext());
    RecyclerView mRecyclerView = (RecyclerView) contentView.findViewById(R.id.folders);
    mRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
    adapter = new BottomSheetAlbumsAdapter();
    mRecyclerView.setAdapter(adapter);
    exploreModePanel = (LinearLayout) contentView.findViewById(R.id.explore_mode_panel);
    currentFolderPath = (TextView) contentView.findViewById(R.id.bottom_sheet_sub_title);
    imgExploreMode = (IconicsImageView) contentView.findViewById(R.id.toggle_hidden_icon);
    imgExploreMode.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleExplorerMode(!exploreMode);
        }
    });
    toggleExplorerMode(false);
    /**SET UP THEME**/
    theme.setColorScrollBarDrawable(ContextCompat.getDrawable(dialog.getContext(), R.drawable.ic_scrollbar));
    contentView.findViewById(R.id.ll_bottom_sheet_title).setBackgroundColor(theme.getPrimaryColor());
    contentView.findViewById(R.id.ll_select_folder).setBackgroundColor(theme.getCardBackgroundColor());
    ((TextView) contentView.findViewById(R.id.bottom_sheet_title)).setText(title);
    ((IconicsImageView) contentView.findViewById(R.id.create_new_folder)).setColor(theme.getIconColor());
    ((TextView) contentView.findViewById(R.id.create_new_folder_text)).setTextColor(theme.getSubTextColor());
    ((IconicsImageView) contentView.findViewById(R.id.done)).setColor(theme.getIconColor());
    contentView.findViewById(R.id.done).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            selectAlbumInterface.folderSelected(currentFolderPath.getText().toString());
        }
    });
    contentView.findViewById(R.id.ll_create_new_folder).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            final EditText editText = new EditText(getContext());
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), theme.getDialogStyle());
            AlertDialogsHelper.getInsertTextDialog(((ThemedActivity) getActivity()), builder, editText, R.string.new_folder);
            builder.setPositiveButton(R.string.ok_action, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    File folderPath = new File(currentFolderPath.getText().toString() + File.separator + editText.getText().toString());
                    if (folderPath.mkdir())
                        displayContentFolder(folderPath);
                }
            });
            builder.show();
        }
    });
    dialog.setContentView(contentView);
    CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = layoutParams.getBehavior();
    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        ((BottomSheetBehavior) behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }
    adapter.notifyDataSetChanged();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.support.v7.app.AlertDialog) ThemeHelper(org.horaapps.leafpic.util.ThemeHelper) DialogInterface(android.content.DialogInterface) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) GridLayoutManager(android.support.v7.widget.GridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) File(java.io.File)

Example 2 with ThemeHelper

use of org.horaapps.leafpic.util.ThemeHelper in project LeafPic by HoraApps.

the class ThemedActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SP = PreferenceUtil.getInstance(getApplicationContext());
    themeHelper = new ThemeHelper(getApplicationContext());
}
Also used : ThemeHelper(org.horaapps.leafpic.util.ThemeHelper)

Aggregations

ThemeHelper (org.horaapps.leafpic.util.ThemeHelper)2 DialogInterface (android.content.DialogInterface)1 BottomSheetBehavior (android.support.design.widget.BottomSheetBehavior)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 AlertDialog (android.support.v7.app.AlertDialog)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 EditText (android.widget.EditText)1 TextView (android.widget.TextView)1 IconicsImageView (com.mikepenz.iconics.view.IconicsImageView)1 File (java.io.File)1