use of net.iGap.libs.rippleeffect.RippleView in project iGap-Android by KianIranian-STDG.
the class ActivityCrop method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_crop);
attachFile = new AttachFile(this);
ProgressBar prgWaiting = (ProgressBar) findViewById(R.id.crop_prgWaiting);
AppUtils.setProgresColler(prgWaiting);
imgPic = (ImageView) findViewById(R.id.pu_img_imageBefore);
TextView txtAgreeImage = (TextView) findViewById(R.id.pu_txt_agreeImage);
TextView txtCancel = (TextView) findViewById(R.id.pu_txt_cancel_crop);
txtSet = (TextView) findViewById(R.id.pu_txt_set_crop);
final Bundle bundle = getIntent().getExtras();
if (bundle != null) {
path = bundle.getString("IMAGE_CAMERA");
String newPath = "file://" + path;
uri = Uri.parse(newPath);
page = bundle.getString("PAGE");
type = bundle.getString("TYPE");
id = bundle.getInt("ID");
}
if (uri != null || path != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
G.imageLoader.displayImage(AndroidUtils.suitablePath(path), imgPic);
} else {
G.imageLoader.displayImage(AndroidUtils.suitablePath(uri.getPath()), imgPic);
}
prgWaiting.setVisibility(View.GONE);
}
RippleView rippleCrop = (RippleView) findViewById(R.id.pu_ripple_crop);
TextView txtCrop = (TextView) findViewById(R.id.pu_txt_crop);
/*
open crop page
*/
if (uri != null && !uri.toString().equals("")) {
rippleCrop.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) {
nzmeFile = path.substring(path.lastIndexOf("/"));
String newPath = "file://" + path;
Uri uri = Uri.parse(newPath);
UCrop.Options options = new UCrop.Options();
options.setStatusBarColor(ContextCompat.getColor(G.context, R.color.black));
options.setToolbarColor(ContextCompat.getColor(G.context, R.color.black));
options.setCompressionQuality(80);
UCrop.of(uri, Uri.fromFile(new File(G.context.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath(), nzmeFile))).withAspectRatio(16, 9).withOptions(options).start(ActivityCrop.this);
}
});
}
RippleView rippleBack = (RippleView) findViewById(R.id.pu_ripple_back);
rippleBack.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) throws IOException {
if (type.equals("camera") || type.equals("crop_camera")) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
new AttachFile(ActivityCrop.this).dispatchTakePictureIntent();
} else {
new AttachFile(ActivityCrop.this).requestTakePicture();
}
} else if (type.equals("gallery")) {
attachFile.requestOpenGalleryForImageMultipleSelect();
}
}
});
txtCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
txtSet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (uri != null && type.equals("crop_camera")) {
pathImageUser = getRealPathFromURI(uri);
result = G.imageFile.toString() + "_" + id + ".jpg";
HelperCopyFile.copyFile(pathImageUser, result);
} else {
result = getRealPathFromURI(uri);
}
if (page != null) {
Intent data = new Intent();
data.setData(Uri.parse(result));
setResult(Activity.RESULT_OK, data);
finish();
}
}
});
}
use of net.iGap.libs.rippleeffect.RippleView in project iGap-Android by KianIranian-STDG.
the class PhotoViewer method createView.
@SuppressLint("ResourceType")
@Override
public View createView(Context context) {
if (getActivity() != null) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
rootView = new NotifyFrameLayout(context) {
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
if (isKeyboardVisible()) {
showPopUPView(-1);
return true;
}
return false;
}
return super.dispatchKeyEventPreIme(event);
}
};
rootView.setListener(this);
rootView.setBackgroundColor(context.getResources().getColor(R.color.black_register));
rootView.setClickable(true);
toolbar = new Toolbar(context);
toolbar.setContentInsetStartWithNavigation(0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
toolbar.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
rootView.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
} else {
ViewCompat.setLayoutDirection(toolbar, ViewCompat.LAYOUT_DIRECTION_LTR);
ViewCompat.setLayoutDirection(rootView, ViewCompat.LAYOUT_DIRECTION_LTR);
}
toolbar.setBackgroundColor(context.getResources().getColor(R.color.colorEditImageBlack));
viewPager = new CustomViewPager(context);
rootView.addView(viewPager, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
cancelCropLayout = new LinearLayout(context);
cancelCropLayout.setOrientation(LinearLayout.HORIZONTAL);
cancelCropLayout.setBackgroundColor(context.getResources().getColor(R.color.colorEditImageBlack2));
rippleView = new RippleView(context);
rippleView.setCentered(true);
rippleView.setRippleAlpha(200);
rippleView.setRippleDuration(0);
rippleView.setRipplePadding(5);
cancelCropLayout.addView(rippleView, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT));
designTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
designTextView.setText(context.getString(R.string.icon_close));
designTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
designTextView.setGravity(Gravity.CENTER);
rippleView.addView(designTextView, LayoutCreator.createRelative(48, LayoutCreator.MATCH_PARENT));
emptyView = new View(context);
cancelCropLayout.addView(emptyView, LayoutCreator.createLinear(0, LayoutCreator.MATCH_PARENT, 1F));
revertTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
revertTextView.setText(context.getString(R.string.icon_forward));
revertTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
revertTextView.setGravity(Gravity.CENTER);
revertTextView.setVisibility(View.GONE);
cancelCropLayout.addView(revertTextView, LayoutCreator.createLinear(52, 52));
cropTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
cropTextView.setGravity(Gravity.CENTER);
cropTextView.setText(context.getString(R.string.icon_crop_picture));
cropTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
cancelCropLayout.addView(cropTextView, LayoutCreator.createLinear(52, LayoutCreator.MATCH_PARENT));
editTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
editTextView.setGravity(Gravity.CENTER);
editTextView.setText(getString(R.string.icon_edit_picture));
editTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
cancelCropLayout.addView(editTextView, LayoutCreator.createLinear(52, LayoutCreator.MATCH_PARENT, 0, 0, 8, 0));
emoji = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
emoji.setGravity(Gravity.CENTER);
emoji.setText(getString(R.string.icon_emoji_smile));
emoji.setTextColor(context.getResources().getColor(R.color.white));
emoji.setTextSize(26);
cancelCropLayout.addView(emoji, LayoutCreator.createLinear(52, LayoutCreator.MATCH_PARENT, 0, 0, 8, 0));
addTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
addTextView.setGravity(Gravity.CENTER);
addTextView.setBackground(context.getResources().getDrawable(R.drawable.ic_cam_text));
addTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
cancelCropLayout.addView(addTextView, LayoutCreator.createLinear(30, 30, 0, 0, 8, 0));
paintTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
paintTextView.setGravity(Gravity.CENTER);
paintTextView.setText(getString(R.string.icon_edit));
paintTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
cancelCropLayout.addView(paintTextView, LayoutCreator.createLinear(52, 52, 0, 0, 8, 0));
rootView.addView(cancelCropLayout, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 60, Gravity.TOP));
LinearLayout bottomRootView = new LinearLayout(context);
bottomRootView.setOrientation(LinearLayout.VERTICAL);
LinearLayout bottomRecyclerViewContainer = new LinearLayout(context);
bottomRecyclerViewContainer.setOrientation(LinearLayout.VERTICAL);
bottomRecyclerViewContainer.setBackground(context.getResources().getDrawable(R.drawable.background_transparent));
bottomRootView.addView(bottomRecyclerViewContainer, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, 7));
previewRecycler = new RecyclerView(context);
previewRecycler.setLayoutManager(new LinearLayoutManager(context, RecyclerView.HORIZONTAL, false));
bottomRecyclerViewContainer.addView(previewRecycler, LayoutCreator.createLinear(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
bottomLayoutPanel = new LinearLayout(context);
bottomLayoutPanel.setOrientation(LinearLayout.VERTICAL);
bottomLayoutPanel.setBackgroundColor(context.getResources().getColor(R.color.colorEditImageBlack));
bottomRootView.addView(bottomLayoutPanel, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
layoutCaption = new LinearLayout(context);
layoutCaption.setOrientation(LinearLayout.HORIZONTAL);
layoutCaption.setMinimumHeight(48);
layoutCaption.setPadding(4, 0, 4, 0);
bottomLayoutPanel.addView(layoutCaption, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 60, Gravity.CENTER));
keyboardEmoji = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
keyboardEmoji.setGravity(Gravity.CENTER);
keyboardEmoji.setPadding(8, 0, 8, 8);
keyboardEmoji.setText(context.getString(R.string.icon_emoji_smile));
keyboardEmoji.setTextColor(context.getResources().getColor(R.color.white));
keyboardEmoji.setTextSize(26);
layoutCaption.addView(keyboardEmoji, LayoutCreator.createLinear(30, 30, Gravity.CENTER, 0, 0, 0, 0));
captionEditText = new EventEditText(context);
captionEditText.setGravity(Gravity.BOTTOM);
captionEditText.setHint(context.getString(R.string.type_message));
captionEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
captionEditText.setMaxLines(4);
captionEditText.setPadding(10, 0, 10, 8);
captionEditText.setTextColor(context.getResources().getColor(R.color.white));
captionEditText.setHintTextColor(context.getResources().getColor(R.color.light_gray));
captionEditText.setTextSize(14);
captionEditText.setBackground(null);
layoutCaption.addView(captionEditText, LayoutCreator.createLinear(0, LayoutCreator.WRAP_CONTENT, 1, Gravity.CENTER));
iconOkTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
iconOkTextView.setGravity(Gravity.BOTTOM);
iconOkTextView.setPadding(8, 0, 8, 8);
iconOkTextView.setText(context.getString(R.string.icon_check_ok));
iconOkTextView.setTextColor(context.getResources().getColor(R.color.white));
iconOkTextView.setTextSize(26);
iconOkTextView.setVisibility(View.GONE);
layoutCaption.addView(iconOkTextView, LayoutCreator.createLinear(52, 52, Gravity.BOTTOM));
chatKeyBoardContainer = new FrameLayout(context);
bottomLayoutPanel.addView(chatKeyBoardContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT));
pickerViewSendButton = new ImageView(context);
pickerViewSendButton.setScaleType(ImageView.ScaleType.CENTER);
pickerViewSendButton.setImageResource(R.drawable.attach_send);
layoutCaption.addView(pickerViewSendButton, LayoutCreator.createLinear(40, 40, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 8, 0));
progressBar = new ProgressBar(context);
progressBar.setVisibility(View.GONE);
layoutCaption.addView(progressBar, LayoutCreator.createLinear(40, 40, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 8, 0));
sendTextView = new MaterialDesignTextView(new ContextThemeWrapper(context, R.style.myIconToolbarStyle));
sendTextView.setGravity(Gravity.CENTER);
sendTextView.setText(context.getString(R.string.icon_send));
sendTextView.setTextColor(context.getResources().getColor(R.color.whit_background));
sendTextView.setVisibility(View.GONE);
rootView.addView(bottomRootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
return rootView;
}
use of net.iGap.libs.rippleeffect.RippleView in project iGap-Android by KianIranian-STDG.
the class FragmentToolBarBack method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
titleTextView = view.findViewById(R.id.title);
titleTextView.setTypeface(ResourcesCompat.getFont(titleTextView.getContext(), R.font.main_font));
appBarLayout = view.findViewById(R.id.ac_appBarLayout);
menu_item1 = view.findViewById(R.id.menu_item1);
menu_item1.setVisibility(View.VISIBLE);
RippleView rippleBackButton = view.findViewById(R.id.chl_ripple_back_Button);
rippleBackButton.setOnClickListener(this::onBackButtonClicked);
}
use of net.iGap.libs.rippleeffect.RippleView in project iGap-Android by KianIranian-STDG.
the class FragmentNewGroup method initComponent.
public void initComponent(View view) {
G.onGroupAvatarResponse = this;
G.onChannelAvatarAdd = this;
AppUtils.setProgresColler(fragmentNewGroupBinding.ngPrgWaiting);
mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setLeftIcon(R.string.icon_back).setRightIcons(R.string.icon_sent).setListener(this);
LinearLayout toollbarLayout = view.findViewById(R.id.ng_layout_toolbar);
toollbarLayout.addView(mHelperToolbar.getView());
fragmentNewGroupViewModel.titleToolbar.observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
mHelperToolbar.setDefaultTitle(s);
}
});
G.fragmentActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
// =======================set image for group
imgCircleImageView = fragmentNewGroupBinding.ngProfileCircleImage;
imgProfileHelper = fragmentNewGroupBinding.ngProfileCircleImageHolder;
// AndroidUtils.setBackgroundShapeColor(imgCircleImageView, Color.parseColor(G.appBarColor));
RippleView rippleCircleImage = fragmentNewGroupBinding.ngRippleCircleImage;
rippleCircleImage.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) throws IOException {
HelperPermission.getStoragePermission(G.fragmentActivity, new OnGetPermission() {
@Override
public void Allow() {
showDialogSelectGallery();
}
@Override
public void deny() {
showDeniedPermissionMessage(G.context.getString(R.string.permission_storage));
}
});
}
});
// =======================name of group
// =======================description group
edtDescription = fragmentNewGroupBinding.ngEdtDescription;
edtDescription.setPadding(0, 8, 0, 8);
edtDescription.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
lastSpecialRequestsCursorPosition = edtDescription.getSelectionStart();
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
edtDescription.removeTextChangedListener(this);
if (edtDescription.getLineCount() > 2) {
edtDescription.setText(specialRequests);
edtDescription.setSelection(lastSpecialRequestsCursorPosition);
} else {
specialRequests = edtDescription.getText().toString();
}
edtDescription.addTextChangedListener(this);
}
});
}
use of net.iGap.libs.rippleeffect.RippleView in project iGap-Android by KianIranian-STDG.
the class FragmentShowAvatars method initComponent.
private void initComponent(View view) {
// ViewGroup rooShowImage = (ViewGroup) view.findViewById(R.id.rooShowImage);
// rooShowImage.setBackgroundColor(G.fragmentActivity.getResources().getColor(R.color.black));
RippleView rippleBack = view.findViewById(R.id.asi_ripple_back);
rippleBack.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) {
G.fragmentActivity.onBackPressed();
}
});
RippleView rippleMenu = view.findViewById(R.id.asi_ripple_menu);
rippleMenu.setOnRippleCompleteListener(rippleView -> {
if (getContext() == null)
return;
List<Integer> items = new ArrayList<>();
items.add(R.string.save_to_gallery);
switch(from) {
case setting:
items.add(R.string.array_Delete_photo);
break;
case group:
if (roleGroup == GroupChatRole.OWNER || roleGroup == GroupChatRole.ADMIN) {
items.add(R.string.array_Delete_photo);
}
break;
case channel:
if (roleChannel == ChannelChatRole.OWNER || roleChannel == ChannelChatRole.ADMIN) {
items.add(R.string.array_Delete_photo);
}
break;
}
new TopSheetDialog(getContext()).setListDataWithResourceId(items, -1, position -> {
if (items.get(position) == R.string.save_to_gallery) {
saveToGallery();
} else if (items.get(position) == array_Delete_photo) {
switch(from) {
case setting:
deletePhotoSetting();
break;
case group:
deletePhotoGroup();
break;
case channel:
deletePhotoChannel();
break;
case chat:
deletePhotoChat();
break;
}
}
}).show();
});
viewPager = view.findViewById(R.id.asi_view_pager);
txtImageNumber = view.findViewById(R.id.asi_txt_image_number);
toolbarShowImage = view.findViewById(R.id.showAvatarToolbar);
initViewPager();
}
Aggregations