Closed nicolesbn closed 5 months ago
Hi @nicolesbn, can you provide the code for the custom dialog
you want to use or a sample one?
Also, when do you call Instabug.addPrivateViews(notesEditText);
?
Thanks
Hi @mhashim6 Thanks for reply. Hopefully the code part could help to resolve the issue. :)
public class NotesDialog extends AlertDialog {
@BindView(R.id.title) TextView titleText; @BindView(R.id.notes_edt) EditText notesInputEdt; @BindView(R.id.save_btn) Button saveButton; @BindView(R.id.cancel_btn) Button cancelButton;
private BaseActivity activity;
public NotesDialog(BaseActivity activity) { super(activity); this.activity = activity; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = LayoutInflater.from(getContext()); final View dialogView = inflater.inflate(R.layout.notes_dialog, null); setContentView(dialogView); ButterKnife.bind(this, dialogView); ((TestActivityComponent) Injector.getActivitySpecificComponent(activity)).inject(this);
setupCancelButton();
initNotesEdit();
setCanceledOnTouchOutside(false);
**Instabug.addPrivateViews(notesInputEdt);**
}
private void initNotesEdit() { this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); notesInputEdt.requestFocus(); } }
@OnClick(R.id.save_btn) public void onSaveClicked() { // some save logic is here this.dismiss(); }
private void setupCancelButton() { cancelButton.setText("CANCEL"); cancelButton.setOnClickListener(view -> { this.dismiss(); }); }
public EditText getNotesInputEdt() { return notesInputEdt; } }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_option_dialog" android:layout_width="700dp" android:minWidth="700dp" android:layout_height="520dp" android:layout_gravity="center" android:orientation="vertical">
<TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="38dp" android:gravity="center" android:text="@string/notes_dialog_title" android:textAlignment="center" android:textAllCaps="true" android:textColor="@color/black" android:textSize="25sp" />
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginStart="38dp" android:layout_marginTop="@38dp" android:layout_marginEnd="38dp" android:layout_marginBottom="38dp">
<EditText
android:id="@+id/notes_edt"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@color/grey"
android:gravity="top|left"
android:imeActionLabel="Next"
android:imeOptions="actionNext"
android:inputType="textMultiLine|text|textCapSentences" />
<TextView
android:id="@+id/text_lines"
android:layout_alignEnd="@id/notes_edt"
android:layout_below="@id/notes_edt"
android:text="0/15 Lines"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/save_btn"
style="@style/AlertDialog.Button"
android:layout_below="@id/notes_edt"
android:layout_marginTop="38dp"
android:layout_toLeftOf="@+id/cancel_btn"
android:text="Save />
<Button
android:id="@+id/cancel_btn"
style="@style/AlertDialog.Button"
android:layout_below="@id/notes_edt"
android:layout_alignEnd="@+id/notes_edt"
android:layout_marginTop="38dp"
android:text="Cancel" />
<TextView
android:id="@+id/text_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cancel_btn"
android:layout_alignStart="@id/notes_edt"
android:layout_marginTop="38dp"
android:text="Notes Dialog Hint />
@OnClick(R.id.btn_note) void onNoteClicked() { synchronized (MainActivity.this) {
NotesDialog notesDialog = new NotesDialog(this);
notesDialog.show();
Instabug.addPrivateViews(notesDialog.getNotesInputEdt());
}
}
we call the addPrivateViews(notesInputEdt) in the onCreate method of the Dialog.
Hi @nicolesbn, can you provide the code for the custom
dialog
you want to use or a sample one?Also, when do you call
Instabug.addPrivateViews(notesEditText);
?Thanks
Hi @mhashim6 Thanks for reply. Hopefully the code part could help to resolve the issue. :)
this is the code for Custom Dialog public class NotesDialog extends AlertDialog {
@BindView(R.id.title) TextView titleText; @BindView(R.id.notes_edt) EditText notesInputEdt; @BindView(R.id.save_btn) Button saveButton; @BindView(R.id.cancel_btn) Button cancelButton;
private BaseActivity activity;
public NotesDialog(BaseActivity activity) { super(activity); this.activity = activity; }
@OverRide protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = LayoutInflater.from(getContext()); final View dialogView = inflater.inflate(R.layout.notes_dialog, null); setContentView(dialogView); ButterKnife.bind(this, dialogView); ((TestActivityComponent) Injector.getActivitySpecificComponent(activity)).inject(this);
setupCancelButton(); initNotesEdit(); setCanceledOnTouchOutside(false); Instabug.addPrivateViews(notesInputEdt); }
private void initNotesEdit() { this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); notesInputEdt.requestFocus(); } }
@OnClick(R.id.save_btn) public void onSaveClicked() { // some save logic is here this.dismiss(); }
private void setupCancelButton() { cancelButton.setText("CANCEL"); cancelButton.setOnClickListener(view -> { this.dismiss(); }); }
public EditText getNotesInputEdt() { return notesInputEdt; } }
this is the xml file for Dialog <EditText android:id="@+id/notes_edt" android:layout_width="match_parent" android:layout_height="150dp" android:background="@color/grey" android:gravity="top|left" android:imeActionLabel="Next" android:imeOptions="actionNext" android:inputType="textMultiLine|text|textCapSentences" />
<TextView android:id="@+id/text_lines" android:layout_alignEnd="@id/notes_edt" android:layout_below="@id/notes_edt" android:text="0/15 Lines" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<Button android:id="@+id/save_btn" style="@style/AlertDialog.Button" android:layout_below="@id/notes_edt" android:layout_marginTop="38dp" android:layout_toLeftOf="@+id/cancel_btn" android:text="Save />
<Button android:id="@+id/cancel_btn" style="@style/AlertDialog.Button" android:layout_below="@id/notes_edt" android:layout_alignEnd="@+id/notes_edt" android:layout_marginTop="38dp" android:text="Cancel" />
<TextView android:id="@+id/text_note" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/cancel_btn" android:layout_alignStart="@id/notes_edt" android:layout_marginTop="38dp" android:text="Notes Dialog Hint /> part of code when click notes button in the MainActivity @OnClick(R.id.btn_note) void onNoteClicked() { synchronized (MainActivity.this) {
NotesDialog notesDialog = new NotesDialog(this); notesDialog.show(); Instabug.addPrivateViews(notesDialog.getNotesInputEdt()); } }
there is a note button in an Activity, and when click it, the NotesDialog will be shown. we call the addPrivateViews(notesInputEdt) in the onCreate method of the Dialog.
@nicolesbn Thank you! It’s plenty. We’ll investigate and get back to you here when we have any updates.
Hi, @nicolesbn!, We identified the issue and we're working on a fix. Will update the issue once the fix is released.
Hi, @nicolesbn!, We identified the issue and we're working on a fix. Will update the issue once the fix is released.
Hi @mhashim6 Thanks for your help. If any questions, feel free to let me know. And just wondering, how long will it take to fix?
Hi, @nicolesbn!, We identified the issue and we're working on a fix. Will update the issue once the fix is released.
Hi @mhashim6 Thanks for your help. If any questions, feel free to let me know. And just wondering, how long will it take to fix?
Thank you! TBH I don't have a release date on me. But I'll make sure to update you when it's scheduled to be released.
Ps: If it's a serious blocker for you, feel free to open an internal support ticket and that might move things more quickly.
Hi, @nicolesbn!
We fixed the issue and we'll include the fix in the upcoming release. Will update you when the release is out!
Hi @nicolesbn,
I'm glad to tell you our latest release 11.7.0
is out. It includes the fix for this issue amongst other changes.
I'll close the ticket for now. Don't hesitate to re-open it if you need any help.
Hi @mhashim6 thanks the fix for this issue. It works now, but one issue is that I also set private views to the imageview and textView on the background(activity), so should hide it, but it doesn't work when the notesDialog appears. Could you have a look? Thanks. If you can reopen the ticket that would be great!
Thanks @nicolesbn for reaching out again, can you please tell us if you are using activity as a dialog in your app or depending on the android DialogFragment
class for the UI provided in the screenshot?
Hi @MohamedHefny Thanks for reply. We are using the dialog (extends AlertDialog, can view code on previous comment(https://github.com/Instabug/Instabug-Android/issues/439#issuecomment-1324522020), not having any DialogFragment. The background is an activity, When click the button(notes) on this activity, the dialog pop up.
Hi @nicolesbn, Thanks for your reply. Would you please tell us when you add the activity's textview to Instabug private views? Also, if you could send a code snippet for this it would be great 🙏🏻
Hi @MohamedHefny I've add it when activity onCreate.
public class TestActivity extends TestBaseActivity implements ClientPopup { @BindView(R.id.img_client_gender) ImageView titleClientGenderImage; @BindView(R.id.title) TextView titleClientNameText;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.btn_note) ImageButton noteButton;
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { initToolbar(); Instabug.addPrivateViews(titleClientGenderImage, titleClientNameText); } private void initToolbar() { toolbar.setTitle("");
renderTitleClient(client);
hideClientNameFromInstabug();
setSupportActionBar(toolbar);
setIconForNoteButton(sessionRepository.getSessionById(currentSessionId), noteButton);
}
private void hideClientNameFromInstabug() { for (int i = 0; i < toolbar.getChildCount(); i++) { View child = toolbar.getChildAt(i); if (child instanceof TextView && !(child instanceof Button)) { Instabug.addPrivateViews(child); } } }
@OnClick(R.id.btn_note) void onNoteClicked() { synchronized (TestActivity.this) { if (isOpeningNote.get()) return; isOpeningNote.set(true); NotesDialog notesDialog = new NotesDialog(this, currentSessionId, () -> { isOpeningNote.set(false); }); notesDialog.show(); } }
default void renderTitleClient(Client client) { getTitleClientGenderImage().setImageDrawable(getGenderDrawable(client)); getTitleClientNameText().setText(client.firstName()); } }
This is the xml file for activity
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" style="@style/ToolBar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:titleMarginStart="@dimen/size_large">
<TextView
android:id="@+id/btn_exit"
style="@style/ToolBar.GoHomeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn_text_end_session" />
<ImageButton
android:id="@+id/btn_report"
style="@style/ToolBar.GoHomeButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/btn_report"
android:textColor="@color/white" />
<ImageButton
android:id="@+id/btn_note"
style="@style/ToolBar.GoHomeButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/btn_note"
android:textColor="@color/white" />
<View
android:layout_width="@dimen/size_medium"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/btn_client_popup"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/size_medium"
android:layout_marginEnd="@dimen/size_medium"
android:layout_marginBottom="@dimen/size_medium"
android:background="@null"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:gravity="center_vertical">
<ImageView
android:id="@+id/img_client_gender"
android:layout_width="@dimen/toolbar_icon_size"
android:layout_height="@dimen/toolbar_icon_size"
android:layout_marginStart="@dimen/size_medium"
android:src="@drawable/gender_unspecified"
android:tint="@color/colorPrimaryDark" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/size_medium"
android:layout_marginEnd="@dimen/size_medium"
android:gravity="center_vertical"
android:text="CLIENT NAME"
android:textColor="@color/colorPrimaryDark"
android:textSize="19sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
<RelativeLayout android:id="@+id/test_relative_layout" android:layout_width="match_parent" android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_constraint_test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
///...
</androidx.constraintlayout.widget.ConstraintLayout>
Hi @nicolesbn This was reproducible with me when I tried to add a null
view to Instabug private views.
So, can you please make sure that you're not adding a null
view right before the NotesDialog
is shown or before adding it's views to Instabug's private views.
Also, I'm wondering if the notesDialog.getNotesInputEdt()
is returning null
when you're trying to call it directly after showing the dialog? refer to this line Instabug.addPrivateViews(notesDialog.getNotesInputEdt());
in this code snippet above. Can you please check this and try again?
@nicolesbn We will close this one, but if you still have any issues, please don't hesitate to reopen it anytime. Thank you.
Steps to Reproduce the Problem
Expected Behavior
The EditText should be black out entirely.
Actual Behavior
The EditText can not be black out entirely. The position of the cover displayed incorrectly.
Instabug integration code
Instabug.addPrivateViews(notesEditText);
SDK Version
11.5.1
Android Version
10
Device Model
Samsung SM-T590
[Optional] Project That Reproduces the Issue