mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-25 16:01:52 -05:00
db-overhaul: fix loading indicators in KeyListActivity and ViewKeyActivity
This commit is contained in:
parent
d921cca913
commit
2227705d65
@ -260,7 +260,6 @@ public class PgpImportExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (save) {
|
if (save) {
|
||||||
ProviderHelper.saveKeyRing(mContext, secretKeyRing);
|
|
||||||
// TODO: preserve certifications
|
// TODO: preserve certifications
|
||||||
// (http://osdir.com/ml/encryption.bouncy-castle.devel/2007-01/msg00054.html ?)
|
// (http://osdir.com/ml/encryption.bouncy-castle.devel/2007-01/msg00054.html ?)
|
||||||
PGPPublicKeyRing newPubRing = null;
|
PGPPublicKeyRing newPubRing = null;
|
||||||
@ -275,6 +274,7 @@ public class PgpImportExport {
|
|||||||
if (newPubRing != null) {
|
if (newPubRing != null) {
|
||||||
ProviderHelper.saveKeyRing(mContext, newPubRing);
|
ProviderHelper.saveKeyRing(mContext, newPubRing);
|
||||||
}
|
}
|
||||||
|
ProviderHelper.saveKeyRing(mContext, secretKeyRing);
|
||||||
// TODO: remove status returns, use exceptions!
|
// TODO: remove status returns, use exceptions!
|
||||||
status = Id.return_value.ok;
|
status = Id.return_value.ok;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,6 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
|||||||
KeychainDatabase(Context context) {
|
KeychainDatabase(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
|
|
||||||
|
|
||||||
// make sure this is only done once, on the first instance!
|
// make sure this is only done once, on the first instance!
|
||||||
boolean iAmIt = false;
|
boolean iAmIt = false;
|
||||||
synchronized(apg_hack) {
|
synchronized(apg_hack) {
|
||||||
|
@ -168,10 +168,15 @@ public class KeychainProvider extends ContentProvider {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreate() {
|
public boolean onCreate() {
|
||||||
mUriMatcher = buildUriMatcher();
|
mUriMatcher = buildUriMatcher();
|
||||||
mKeychainDatabase = new KeychainDatabase(getContext());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KeychainDatabase getDb() {
|
||||||
|
if(mKeychainDatabase == null)
|
||||||
|
mKeychainDatabase = new KeychainDatabase(getContext());
|
||||||
|
return mKeychainDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@ -441,7 +446,7 @@ public class KeychainProvider extends ContentProvider {
|
|||||||
orderBy = sortOrder;
|
orderBy = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = mKeychainDatabase.getReadableDatabase();
|
SQLiteDatabase db = getDb().getReadableDatabase();
|
||||||
Cursor c = qb.query(db, projection, selection, selectionArgs, groupBy, having, orderBy);
|
Cursor c = qb.query(db, projection, selection, selectionArgs, groupBy, having, orderBy);
|
||||||
|
|
||||||
// Tell the cursor what uri to watch, so it knows when its source data changes
|
// Tell the cursor what uri to watch, so it knows when its source data changes
|
||||||
@ -465,7 +470,7 @@ public class KeychainProvider extends ContentProvider {
|
|||||||
public Uri insert(Uri uri, ContentValues values) {
|
public Uri insert(Uri uri, ContentValues values) {
|
||||||
Log.d(Constants.TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");
|
Log.d(Constants.TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");
|
||||||
|
|
||||||
final SQLiteDatabase db = mKeychainDatabase.getWritableDatabase();
|
final SQLiteDatabase db = getDb().getWritableDatabase();
|
||||||
|
|
||||||
Uri rowUri = null;
|
Uri rowUri = null;
|
||||||
Long keyId = null;
|
Long keyId = null;
|
||||||
@ -538,7 +543,7 @@ public class KeychainProvider extends ContentProvider {
|
|||||||
public int delete(Uri uri, String additionalSelection, String[] selectionArgs) {
|
public int delete(Uri uri, String additionalSelection, String[] selectionArgs) {
|
||||||
Log.v(Constants.TAG, "delete(uri=" + uri + ")");
|
Log.v(Constants.TAG, "delete(uri=" + uri + ")");
|
||||||
|
|
||||||
final SQLiteDatabase db = mKeychainDatabase.getWritableDatabase();
|
final SQLiteDatabase db = getDb().getWritableDatabase();
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
final int match = mUriMatcher.match(uri);
|
final int match = mUriMatcher.match(uri);
|
||||||
|
@ -154,9 +154,6 @@ public class KeyListFragment extends Fragment
|
|||||||
} catch (ApiLevelTooLowException e) {
|
} catch (ApiLevelTooLowException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this view is made visible if no data is available
|
|
||||||
mStickyList.setEmptyView(getActivity().findViewById(R.id.key_list_empty));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ActionBarSherlock does not support MultiChoiceModeListener. Thus multi-selection is only
|
* ActionBarSherlock does not support MultiChoiceModeListener. Thus multi-selection is only
|
||||||
* available for Android >= 3.0
|
* available for Android >= 3.0
|
||||||
@ -291,6 +288,9 @@ public class KeyListFragment extends Fragment
|
|||||||
|
|
||||||
mStickyList.setAdapter(mAdapter);
|
mStickyList.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
// this view is made visible if no data is available
|
||||||
|
mStickyList.setEmptyView(getActivity().findViewById(R.id.key_list_empty));
|
||||||
|
|
||||||
// NOTE: Not supported by StickyListHeader, but reimplemented here
|
// NOTE: Not supported by StickyListHeader, but reimplemented here
|
||||||
// The list should now be shown.
|
// The list should now be shown.
|
||||||
if (isResumed()) {
|
if (isResumed()) {
|
||||||
|
@ -28,6 +28,7 @@ import android.support.v7.app.ActionBar;
|
|||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.Window;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.Id;
|
import org.sufficientlysecure.keychain.Id;
|
||||||
@ -59,6 +60,7 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mExportHelper = new ExportHelper(this);
|
mExportHelper = new ExportHelper(this);
|
||||||
|
@ -30,6 +30,7 @@ import android.text.format.DateFormat;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
|
|
||||||
public static final String ARG_DATA_URI = "uri";
|
public static final String ARG_DATA_URI = "uri";
|
||||||
|
|
||||||
|
private LinearLayout mContainer;
|
||||||
private TextView mName;
|
private TextView mName;
|
||||||
private TextView mEmail;
|
private TextView mEmail;
|
||||||
private TextView mComment;
|
private TextView mComment;
|
||||||
@ -83,6 +85,7 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.view_key_main_fragment, container, false);
|
View view = inflater.inflate(R.layout.view_key_main_fragment, container, false);
|
||||||
|
|
||||||
|
mContainer = (LinearLayout) view.findViewById(R.id.container);
|
||||||
mName = (TextView) view.findViewById(R.id.name);
|
mName = (TextView) view.findViewById(R.id.name);
|
||||||
mEmail = (TextView) view.findViewById(R.id.email);
|
mEmail = (TextView) view.findViewById(R.id.email);
|
||||||
mComment = (TextView) view.findViewById(R.id.comment);
|
mComment = (TextView) view.findViewById(R.id.comment);
|
||||||
@ -121,6 +124,9 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getActivity().setProgressBarIndeterminateVisibility(Boolean.TRUE);
|
||||||
|
mContainer.setVisibility(View.GONE);
|
||||||
|
|
||||||
mDataUri = dataUri;
|
mDataUri = dataUri;
|
||||||
|
|
||||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||||
@ -319,6 +325,8 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
getActivity().setProgressBarIndeterminateVisibility(Boolean.FALSE);
|
||||||
|
mContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
android:descendantFocusability="beforeDescendants"
|
android:descendantFocusability="beforeDescendants"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp">
|
android:paddingRight="16dp"
|
||||||
|
android:id="@+id/container">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/SectionHeader"
|
style="@style/SectionHeader"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user