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();
}
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());
}
Aggregations