Added move dialog shown on activity resume.
This commit is contained in:
parent
9cbfa8bf86
commit
b575d442cf
3 changed files with 35 additions and 11 deletions
|
@ -30,17 +30,12 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public void testOrientation() {
|
public void testOrientation() {
|
||||||
try {
|
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
getInstrumentation().waitForIdleSync();
|
||||||
Thread.sleep(50);
|
assertTrue(true);
|
||||||
assertTrue(true);
|
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
getInstrumentation().waitForIdleSync();
|
||||||
Thread.sleep(50);
|
assertTrue(true);
|
||||||
assertTrue(true);
|
|
||||||
}
|
|
||||||
catch (InterruptedException e) {
|
|
||||||
Log.w(TAG, "Sleep failed", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package com.nutomic.zertman;
|
package com.nutomic.zertman;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class MainActivity extends ListActivity {
|
public class MainActivity extends ListActivity {
|
||||||
|
|
||||||
|
@ -32,4 +36,25 @@ public class MainActivity extends ListActivity {
|
||||||
mListView.setAdapter(mCertificateAdapter);
|
mListView.setAdapter(mCertificateAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
final List<Certificate> list = mCertificateManager.getCertificates(false);
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.dialog_move_certs_title)
|
||||||
|
.setMessage(R.string.dialog_move_certs_message)
|
||||||
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
for (Certificate c : list) {
|
||||||
|
mCertificateManager.moveCertificateToSystem(c);
|
||||||
|
mMovedCertificatesStorage.insert(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, null)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,8 @@
|
||||||
|
|
||||||
<string name="app_name">Zert Man</string>
|
<string name="app_name">Zert Man</string>
|
||||||
|
|
||||||
|
<string name="dialog_move_certs_title">User Certificates Found</string>
|
||||||
|
|
||||||
|
<string name="dialog_move_certs_message">Should they be moved to system storage?</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Reference in a new issue