move keyserver status into key status card
This commit is contained in:
parent
00e411b1e3
commit
25e58943c9
|
@ -35,13 +35,13 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
|||
import org.sufficientlysecure.keychain.ui.base.LoaderFragment;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.IdentitiesPresenter;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.KeyHealthPresenter;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.KeyserverStatusPresenter;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.SystemContactPresenter;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.ViewKeyMvpView;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.view.IdentitiesCardView;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.view.KeyHealthView;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.view.KeyserverStatusView;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.view.SystemContactCardView;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.view.KeyserverStatusCardView;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.KeyserverStatusPresenter;
|
||||
|
||||
|
||||
public class ViewKeyFragment extends LoaderFragment implements ViewKeyMvpView {
|
||||
|
@ -62,10 +62,9 @@ public class ViewKeyFragment extends LoaderFragment implements ViewKeyMvpView {
|
|||
SystemContactPresenter mSystemContactPresenter;
|
||||
|
||||
KeyHealthView mKeyStatusHealth;
|
||||
KeyserverStatusView mKeyStatusKeyserver;
|
||||
|
||||
KeyHealthPresenter mKeyHealthPresenter;
|
||||
|
||||
KeyserverStatusCardView mKeyserverStatusCard;
|
||||
KeyserverStatusPresenter mKeyserverStatusPresenter;
|
||||
|
||||
/**
|
||||
|
@ -91,7 +90,7 @@ public class ViewKeyFragment extends LoaderFragment implements ViewKeyMvpView {
|
|||
|
||||
mSystemContactCard = (SystemContactCardView) view.findViewById(R.id.linked_system_contact_card);
|
||||
mKeyStatusHealth = (KeyHealthView) view.findViewById(R.id.key_status_health);
|
||||
mKeyserverStatusCard = (KeyserverStatusCardView) view.findViewById(R.id.keyserver_status_card);
|
||||
mKeyStatusKeyserver = (KeyserverStatusView) view.findViewById(R.id.key_status_keyserver);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
@ -116,7 +115,7 @@ public class ViewKeyFragment extends LoaderFragment implements ViewKeyMvpView {
|
|||
mKeyHealthPresenter.startLoader(getLoaderManager());
|
||||
|
||||
mKeyserverStatusPresenter = new KeyserverStatusPresenter(
|
||||
getContext(), mKeyserverStatusCard, LOADER_ID_KEYSERVER_STATUS, masterKeyId, mIsSecret);
|
||||
getContext(), mKeyStatusKeyserver, LOADER_ID_KEYSERVER_STATUS, masterKeyId, mIsSecret);
|
||||
mKeyserverStatusPresenter.startLoader(getLoaderManager());
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,6 @@ public class KeyserverStatusPresenter implements LoaderCallbacks<KeyserverStatus
|
|||
|
||||
this.masterKeyId = masterKeyId;
|
||||
this.isSecret = isSecret;
|
||||
|
||||
view.setOnKeyserverClickListener(new KeyserverStatusClickListener() {
|
||||
@Override
|
||||
public void onKeyRefreshClick() {
|
||||
KeyserverStatusPresenter.this.onKeyRefreshClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startLoader(LoaderManager loaderManager) {
|
||||
|
@ -84,20 +77,10 @@ public class KeyserverStatusPresenter implements LoaderCallbacks<KeyserverStatus
|
|||
|
||||
}
|
||||
|
||||
private void onKeyRefreshClick() {
|
||||
|
||||
}
|
||||
|
||||
public interface KeyserverStatusMvpView {
|
||||
void setOnKeyserverClickListener(KeyserverStatusClickListener keyserverStatusClickListener);
|
||||
|
||||
void setDisplayStatusPublished();
|
||||
void setDisplayStatusNotPublished();
|
||||
void setLastUpdated(Date lastUpdated);
|
||||
void setDisplayStatusUnknown();
|
||||
}
|
||||
|
||||
public interface KeyserverStatusClickListener {
|
||||
void onKeyRefreshClick();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,34 +25,30 @@ import android.support.annotation.ColorRes;
|
|||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.KeyserverStatusPresenter.KeyserverStatusClickListener;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.presenter.KeyserverStatusPresenter.KeyserverStatusMvpView;
|
||||
|
||||
|
||||
public class KeyserverStatusCardView extends CardView implements KeyserverStatusMvpView, OnClickListener {
|
||||
public class KeyserverStatusView extends FrameLayout implements KeyserverStatusMvpView {
|
||||
private final View vLayout;
|
||||
private final TextView vTitle;
|
||||
private final TextView vSubtitle;
|
||||
private final ImageView vIcon;
|
||||
|
||||
private KeyserverStatusClickListener keyHealthClickListener;
|
||||
|
||||
public KeyserverStatusCardView(Context context, AttributeSet attrs) {
|
||||
public KeyserverStatusView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.key_keyserver_card_content, this, true);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.key_keyserver_status_layout, this, true);
|
||||
|
||||
vLayout = view.findViewById(R.id.key_health_layout);
|
||||
vLayout = view.findViewById(R.id.keyserver_status_layout);
|
||||
|
||||
vTitle = (TextView) view.findViewById(R.id.keyserver_status_title);
|
||||
vSubtitle = (TextView) view.findViewById(R.id.keyserver_status_subtitle);
|
||||
|
@ -79,19 +75,6 @@ public class KeyserverStatusCardView extends CardView implements KeyserverStatus
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (keyHealthClickListener != null) {
|
||||
keyHealthClickListener.onKeyRefreshClick();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnKeyserverClickListener(KeyserverStatusClickListener keyHealthClickListener) {
|
||||
this.keyHealthClickListener = keyHealthClickListener;
|
||||
vLayout.setClickable(keyHealthClickListener != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayStatusPublished() {
|
||||
setDisplayStatus(KeyserverDisplayStatus.PUBLISHED);
|
|
@ -82,7 +82,7 @@
|
|||
android:paddingRight="8dp"
|
||||
android:id="@+id/key_insecure_layout"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
tools:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/CardViewHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Keyserver Status" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/key_health_layout"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:background="?selectableItemBackground"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/keyserver_icon"
|
||||
tools:src="@drawable/ic_cloud_black_24dp"
|
||||
tools:tint="@color/android_green_light"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/keyserver_status_title"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
tools:text="@string/keyserver_title_published" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/keyserver_status_subtitle"
|
||||
tools:text="Last updated: 2017-05-20" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/key_health_expander"
|
||||
android:src="@drawable/ic_expand_more_black_24dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
|
@ -0,0 +1,65 @@
|
|||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/keyserver_status_layout"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:background="?selectableItemBackground"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/keyserver_icon"
|
||||
tools:src="@drawable/ic_cloud_black_24dp"
|
||||
tools:tint="@color/android_green_light"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/keyserver_status_title"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
tools:text="@string/keyserver_title_published" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/keyserver_status_subtitle"
|
||||
tools:text="Last updated: 2017-05-20" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/key_health_expander"
|
||||
android:src="@drawable/ic_expand_more_black_24dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
|
@ -36,6 +36,17 @@
|
|||
android:id="@+id/key_status_health"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.keyview.view.KeyserverStatusView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/key_status_keyserver"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
|
Loading…
Reference in a new issue