mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
notify of changes
This commit is contained in:
parent
262425c6ad
commit
83514b82c0
@ -39,6 +39,7 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TableLayout;
|
||||
@ -68,6 +69,19 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
||||
int mOriginalUsage;
|
||||
boolean mIsNewKey;
|
||||
|
||||
private CheckBox.OnCheckedChangeListener mCheckChanged = new CheckBox.OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
if (mEditorListener != null) {
|
||||
mEditorListener.onEdited();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private int mDatePickerResultCount = 0;
|
||||
private DatePickerDialog.OnDateSetListener mExpiryDateSetListener = new DatePickerDialog.OnDateSetListener() {
|
||||
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
|
||||
@ -76,6 +90,9 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
||||
GregorianCalendar date = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
|
||||
date.set(year, monthOfYear, dayOfMonth);
|
||||
setExpiryDate(date);
|
||||
if (mEditorListener != null) {
|
||||
mEditorListener.onEdited();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -101,9 +118,13 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
||||
mDeleteButton = (BootstrapButton) findViewById(R.id.delete);
|
||||
mDeleteButton.setOnClickListener(this);
|
||||
mChkCertify = (CheckBox) findViewById(R.id.chkCertify);
|
||||
mChkCertify.setOnCheckedChangeListener(mCheckChanged);
|
||||
mChkSign = (CheckBox) findViewById(R.id.chkSign);
|
||||
mChkSign.setOnCheckedChangeListener(mCheckChanged);
|
||||
mChkEncrypt = (CheckBox) findViewById(R.id.chkEncrypt);
|
||||
mChkEncrypt.setOnCheckedChangeListener(mCheckChanged);
|
||||
mChkAuthenticate = (CheckBox) findViewById(R.id.chkAuthenticate);
|
||||
mChkAuthenticate.setOnCheckedChangeListener(mCheckChanged);
|
||||
|
||||
setExpiryDate(null);
|
||||
|
||||
@ -126,6 +147,9 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
||||
// Note: Ignore results after the first one - android sends multiples.
|
||||
if (mDatePickerResultCount++ == 0) {
|
||||
setExpiryDate(null);
|
||||
if (mEditorListener != null) {
|
||||
mEditorListener.onEdited();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -22,6 +22,8 @@ import java.util.regex.Pattern;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -106,6 +108,23 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
mIsMainUserId.setOnClickListener(this);
|
||||
|
||||
mName = (EditText) findViewById(R.id.name);
|
||||
mName.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s)
|
||||
{
|
||||
if (mEditorListener != null) {
|
||||
mEditorListener.onEdited();
|
||||
}
|
||||
}
|
||||
});
|
||||
mEmail = (EditText) findViewById(R.id.email);
|
||||
mComment = (EditText) findViewById(R.id.comment);
|
||||
|
||||
@ -189,7 +208,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
boolean wasMainUserId = mIsMainUserId.isChecked();
|
||||
parent.removeView(this);
|
||||
if (mEditorListener != null) {
|
||||
mEditorListener.onDeleted(this, false);
|
||||
mEditorListener.onDeleted(this, false); //TODO: WAS THIS A NEW ITEM
|
||||
}
|
||||
if (wasMainUserId && parent.getChildCount() > 0) {
|
||||
UserIdEditor editor = (UserIdEditor) parent.getChildAt(0);
|
||||
@ -204,6 +223,9 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
editor.setIsMainUserId(false);
|
||||
}
|
||||
}
|
||||
if (mEditorListener != null) {
|
||||
mEditorListener.onEdited();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user