mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-23 06:12:20 -05:00
improve error handling in LinkedIdViewFragment, disable unknown identity types (for now?)
This commit is contained in:
parent
4c122dfb60
commit
9e379fd19c
@ -61,14 +61,16 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
|
|||||||
mShowCertification = showCertification;
|
mShowCertification = showCertification;
|
||||||
|
|
||||||
if (expander != null) {
|
if (expander != null) {
|
||||||
|
expander.setVisibility(View.GONE);
|
||||||
|
/* don't show an expander (maybe in some sort of advanced view?)
|
||||||
mExpander = expander;
|
mExpander = expander;
|
||||||
mExpander.setVisibility(View.GONE);
|
|
||||||
mExpander.setOnClickListener(new OnClickListener() {
|
mExpander.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showUnfiltered();
|
showUnfiltered();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
|||||||
import org.sufficientlysecure.keychain.ui.linked.LinkedIdViewFragment.ViewHolder.VerifyState;
|
import org.sufficientlysecure.keychain.ui.linked.LinkedIdViewFragment.ViewHolder.VerifyState;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.CertListWidget;
|
import org.sufficientlysecure.keychain.ui.widget.CertListWidget;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
|
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
@ -127,10 +129,10 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
switch (loader.getId()) {
|
switch (loader.getId()) {
|
||||||
case LOADER_ID_LINKED_ID:
|
case LOADER_ID_LINKED_ID:
|
||||||
|
|
||||||
// TODO proper error reporting and null checks here!
|
|
||||||
|
|
||||||
if (!cursor.moveToFirst()) {
|
if (!cursor.moveToFirst()) {
|
||||||
Log.e(Constants.TAG, "error");
|
Notify.createNotify(getActivity(), "Error loading identity!",
|
||||||
|
Notify.LENGTH_LONG, Style.ERROR).show();
|
||||||
|
finishFragment();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,14 +150,22 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
Log.e(Constants.TAG, "error parsing identity", e);
|
||||||
throw new AssertionError("reconstruction of user attribute must succeed!");
|
Notify.createNotify(getActivity(), "Error parsing identity!",
|
||||||
|
Notify.LENGTH_LONG, Style.ERROR).show();
|
||||||
|
finishFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void finishFragment() {
|
||||||
|
FragmentManager manager = getFragmentManager();
|
||||||
|
manager.removeOnBackStackChangedListener(this);
|
||||||
|
manager.popBackStack("linked_id", FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||||
|
}
|
||||||
|
|
||||||
public interface OnIdentityLoadedListener {
|
public interface OnIdentityLoadedListener {
|
||||||
public void onIdentityLoaded();
|
public void onIdentityLoaded();
|
||||||
}
|
}
|
||||||
@ -296,6 +306,13 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showVerifyingContainer(boolean show) {
|
||||||
|
if (vVerifyingContainer.getDisplayedChild() == (show ? 1 : 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vVerifyingContainer.setDisplayedChild(show ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
void showButton(int which) {
|
void showButton(int which) {
|
||||||
if (vButtonSwitcher.getDisplayedChild() == which) {
|
if (vButtonSwitcher.getDisplayedChild() == which) {
|
||||||
return;
|
return;
|
||||||
@ -335,7 +352,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
|
|
||||||
mViewHolder.showButton(0);
|
mViewHolder.showButton(0);
|
||||||
mViewHolder.vKeySpinner.setVisibility(View.GONE);
|
mViewHolder.vKeySpinner.setVisibility(View.GONE);
|
||||||
mViewHolder.vVerifyingContainer.setDisplayedChild(0);
|
mViewHolder.showVerifyingContainer(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +365,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
manager.beginTransaction().addToBackStack("verification").commit();
|
manager.beginTransaction().addToBackStack("verification").commit();
|
||||||
manager.executePendingTransactions();
|
manager.executePendingTransactions();
|
||||||
manager.addOnBackStackChangedListener(this);
|
manager.addOnBackStackChangedListener(this);
|
||||||
mViewHolder.vVerifyingContainer.setDisplayedChild(1);
|
mViewHolder.showVerifyingContainer(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user