Scroll fixes for certify activity

This commit is contained in:
Dominik Schürmann 2014-08-19 16:31:51 +02:00
parent 8d668d170c
commit 5f8bbab569
3 changed files with 21 additions and 8 deletions

View File

@ -930,7 +930,7 @@ public class PgpKeyOperation {
hashedPacketsGen.setPreferredCompressionAlgorithms(false, PREFERRED_COMPRESSION_ALGORITHMS);
hashedPacketsGen.setPrimaryUserID(false, primary);
/* critical subpackets: */
/* critical subpackets: we consider those important for a modern pgp implementation */
hashedPacketsGen.setSignatureCreationTime(true, new Date());
// Request that senders add the MDC to the message (authenticate unsigned messages)
hashedPacketsGen.setFeature(true, Features.FEATURE_MODIFICATION_DETECTION);

View File

@ -40,6 +40,7 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
@ -71,6 +72,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
private ImageView mActionCertifyImage;
private CheckBox mUploadKeyCheckbox;
private Spinner mSelectKeyserverSpinner;
private ScrollView mScrollView;
private CertifyKeySpinner mCertifyKeySpinner;
@ -96,6 +98,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
mCertifyButton = findViewById(R.id.certify_key_certify_button);
mActionCertifyImage = (ImageView) findViewById(R.id.certify_key_action_certify_image);
mUserIds = (ListView) findViewById(R.id.view_key_user_ids);
mScrollView = (ScrollView) findViewById(R.id.certify_scroll_view);
// make certify image gray, like action icons
mActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light),
@ -141,6 +144,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
if (mMasterKeyId == 0) {
Notify.showNotify(CertifyKeyActivity.this, getString(R.string.select_key_to_certify),
Notify.Style.ERROR);
scrollUp();
} else {
initiateCertifying();
}
@ -165,6 +169,14 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
getSupportLoaderManager().initLoader(LOADER_ID_USER_IDS, null, this);
}
private void scrollUp() {
mScrollView.post(new Runnable() {
public void run() {
mScrollView.fullScroll(ScrollView.FOCUS_UP);
}
});
}
static final String USER_IDS_SELECTION = UserIds.IS_REVOKED + " = 0";
static final String[] KEYRING_PROJECTION =
@ -217,6 +229,9 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
break;
case LOADER_ID_USER_IDS:
mUserIdsAdapter.swapCursor(data);
// when some user ids are pre-checked, the focus is requested and the scroll view goes
// down. This fixes it.
scrollUp();
break;
}
}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -8,6 +7,7 @@
<include layout="@layout/notify_area" />
<ScrollView
android:id="@+id/certify_scroll_view"
android:layout_width="wrap_content"
android:layout_height="match_parent">
@ -115,8 +115,7 @@
<org.sufficientlysecure.keychain.ui.widget.FixedListView
android:id="@+id/view_key_user_ids"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants" />
android:layout_height="wrap_content" />
<TextView
style="@style/SectionHeader"
@ -180,7 +179,6 @@
</LinearLayout>
</LinearLayout>
</ScrollView>