mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 03:25:05 -05:00
parent
596478a212
commit
185c4eed43
@ -23,7 +23,6 @@ import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
@ -46,7 +45,7 @@ import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
|
||||
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
|
||||
|
||||
|
||||
public class ViewKeyCertsFragment extends Fragment
|
||||
public class ViewKeyCertsFragment extends LoaderFragment
|
||||
implements LoaderManager.LoaderCallbacks<Cursor>, AdapterView.OnItemClickListener {
|
||||
|
||||
// These are the rows that we will retrieve.
|
||||
@ -79,18 +78,19 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
private static final int LOADER_ID = 4;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.view_key_certs_fragment, container, false);
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.view_key_certs_fragment, getContainer());
|
||||
|
||||
return view;
|
||||
mStickyList = (StickyListHeadersListView) view.findViewById(R.id.list);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
mStickyList = (StickyListHeadersListView) getActivity().findViewById(R.id.list);
|
||||
|
||||
if (!getArguments().containsKey(ARG_DATA_URI)) {
|
||||
Log.e(Constants.TAG, "Data missing. Should be Uri of key!");
|
||||
getActivity().finish();
|
||||
@ -120,6 +120,7 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
setContentShown(false);
|
||||
// Now create and return a CursorLoader that will take care of
|
||||
// creating a Cursor for the data being displayed.
|
||||
return new CursorLoader(getActivity(), mDataUri, PROJECTION, null, null, SORT_ORDER);
|
||||
@ -132,6 +133,8 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
mAdapter.swapCursor(data);
|
||||
|
||||
mStickyList.setAdapter(mAdapter);
|
||||
|
||||
setContentShown(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,12 +44,11 @@ import org.sufficientlysecure.keychain.util.Log;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class ViewKeyKeysFragment extends Fragment implements
|
||||
public class ViewKeyKeysFragment extends LoaderFragment implements
|
||||
LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
public static final String ARG_DATA_URI = "uri";
|
||||
|
||||
private LinearLayout mContainer;
|
||||
private ListView mKeys;
|
||||
|
||||
private ViewKeyKeysAdapter mKeysAdapter;
|
||||
@ -57,13 +56,13 @@ public class ViewKeyKeysFragment extends Fragment implements
|
||||
private Uri mDataUri;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.view_key_keys_fragment, container, false);
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.view_key_keys_fragment, getContainer());
|
||||
|
||||
mContainer = (LinearLayout) view.findViewById(R.id.container);
|
||||
mKeys = (ListView) view.findViewById(R.id.keys);
|
||||
|
||||
return view;
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,9 +80,6 @@ public class ViewKeyKeysFragment extends Fragment implements
|
||||
}
|
||||
|
||||
private void loadData(Uri dataUri) {
|
||||
getActivity().setProgressBarIndeterminateVisibility(true);
|
||||
mContainer.setVisibility(View.GONE);
|
||||
|
||||
mDataUri = dataUri;
|
||||
|
||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||
@ -104,6 +100,7 @@ public class ViewKeyKeysFragment extends Fragment implements
|
||||
};
|
||||
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
setContentShown(false);
|
||||
Uri baseUri = Keys.buildKeysUri(mDataUri);
|
||||
return new CursorLoader(getActivity(), baseUri, KEYS_PROJECTION, null, null, null);
|
||||
}
|
||||
@ -117,8 +114,7 @@ public class ViewKeyKeysFragment extends Fragment implements
|
||||
// old cursor once we return.)
|
||||
mKeysAdapter.swapCursor(data);
|
||||
|
||||
getActivity().setProgressBarIndeterminateVisibility(false);
|
||||
mContainer.setVisibility(View.VISIBLE);
|
||||
setContentShown(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,15 +21,12 @@ import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.devspark.appmsg.AppMsg;
|
||||
@ -37,7 +34,6 @@ import com.devspark.appmsg.AppMsg;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.ViewKeyUserIdsAdapter;
|
||||
@ -45,12 +41,11 @@ import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ViewKeyMainFragment extends Fragment implements
|
||||
public class ViewKeyMainFragment extends LoaderFragment implements
|
||||
LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
public static final String ARG_DATA_URI = "uri";
|
||||
|
||||
private LinearLayout mContainer;
|
||||
private View mActionEdit;
|
||||
private View mActionEditDivider;
|
||||
private View mActionEncrypt;
|
||||
@ -70,10 +65,10 @@ public class ViewKeyMainFragment extends Fragment implements
|
||||
private Uri mDataUri;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.view_key_main_fragment, container, false);
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.view_key_main_fragment, getContainer());
|
||||
|
||||
mContainer = (LinearLayout) view.findViewById(R.id.container);
|
||||
mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids);
|
||||
mActionEdit = view.findViewById(R.id.view_key_action_edit);
|
||||
mActionEditDivider = view.findViewById(R.id.view_key_action_edit_divider);
|
||||
@ -81,7 +76,7 @@ public class ViewKeyMainFragment extends Fragment implements
|
||||
mActionCertify = view.findViewById(R.id.view_key_action_certify);
|
||||
mActionCertifyDivider = view.findViewById(R.id.view_key_action_certify_divider);
|
||||
|
||||
return view;
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,9 +94,6 @@ public class ViewKeyMainFragment extends Fragment implements
|
||||
}
|
||||
|
||||
private void loadData(Uri dataUri) {
|
||||
getActivity().setProgressBarIndeterminateVisibility(true);
|
||||
mContainer.setVisibility(View.GONE);
|
||||
|
||||
mDataUri = dataUri;
|
||||
|
||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||
@ -143,6 +135,8 @@ public class ViewKeyMainFragment extends Fragment implements
|
||||
static final int INDEX_UNIFIED_HAS_ENCRYPT = 5;
|
||||
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
setContentShown(false);
|
||||
|
||||
switch (id) {
|
||||
case LOADER_ID_UNIFIED: {
|
||||
Uri baseUri = KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||
@ -219,8 +213,7 @@ public class ViewKeyMainFragment extends Fragment implements
|
||||
break;
|
||||
|
||||
}
|
||||
getActivity().setProgressBarIndeterminateVisibility(false);
|
||||
mContainer.setVisibility(View.VISIBLE);
|
||||
setContentShown(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,12 +53,11 @@ import org.sufficientlysecure.keychain.util.QrCodeUtils;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class ViewKeyShareFragment extends Fragment implements
|
||||
public class ViewKeyShareFragment extends LoaderFragment implements
|
||||
LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
public static final String ARG_DATA_URI = "uri";
|
||||
|
||||
private LinearLayout mContainer;
|
||||
private TextView mFingerprint;
|
||||
private ImageView mFingerprintQrCode;
|
||||
private View mFingerprintShareButton;
|
||||
@ -77,12 +76,12 @@ public class ViewKeyShareFragment extends Fragment implements
|
||||
private Uri mDataUri;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.view_key_share_fragment, container, false);
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.view_key_share_fragment, getContainer());
|
||||
|
||||
mProviderHelper = new ProviderHelper(ViewKeyShareFragment.this.getActivity());
|
||||
|
||||
mContainer = (LinearLayout) view.findViewById(R.id.container);
|
||||
mFingerprint = (TextView) view.findViewById(R.id.view_key_fingerprint);
|
||||
mFingerprintQrCode = (ImageView) view.findViewById(R.id.view_key_fingerprint_qr_code_image);
|
||||
mFingerprintShareButton = view.findViewById(R.id.view_key_action_fingerprint_share);
|
||||
@ -142,7 +141,7 @@ public class ViewKeyShareFragment extends Fragment implements
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
return root;
|
||||
}
|
||||
|
||||
private void share(Uri dataUri, ProviderHelper providerHelper, boolean fingerprintOnly,
|
||||
@ -232,9 +231,6 @@ public class ViewKeyShareFragment extends Fragment implements
|
||||
}
|
||||
|
||||
private void loadData(Uri dataUri) {
|
||||
getActivity().setProgressBarIndeterminateVisibility(true);
|
||||
mContainer.setVisibility(View.GONE);
|
||||
|
||||
mDataUri = dataUri;
|
||||
|
||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||
@ -260,6 +256,7 @@ public class ViewKeyShareFragment extends Fragment implements
|
||||
static final int INDEX_UNIFIED_EXPIRY = 8;
|
||||
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
setContentShown(false);
|
||||
switch (id) {
|
||||
case LOADER_ID_UNIFIED: {
|
||||
Uri baseUri = KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||
@ -299,8 +296,7 @@ public class ViewKeyShareFragment extends Fragment implements
|
||||
}
|
||||
|
||||
}
|
||||
getActivity().setProgressBarIndeterminateVisibility(false);
|
||||
mContainer.setVisibility(View.VISIBLE);
|
||||
setContentShown(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,7 @@
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:id="@+id/container">
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
|
@ -1,5 +1,4 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@ -12,9 +11,7 @@
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:id="@+id/container"
|
||||
android:visibility="visible">
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
|
@ -1,5 +1,4 @@
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@ -12,8 +11,7 @@
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:id="@+id/container">
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
|
Loading…
Reference in New Issue
Block a user