diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-07-22 19:18:40 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-07-22 19:18:40 +0300 |
commit | e2a3418acb88d1ad6858ee026f8fe58c2d84563a (patch) | |
tree | 28824e92f5b2cbaf4075bef0689abdc3aba09939 /app/src | |
parent | 282496bbb0da7cb6425cc56eb8c9f2f7aa31ad06 (diff) |
Enhance "Move card" dialog
Diffstat (limited to 'app/src')
6 files changed, 38 insertions, 11 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java index 7bb852f2a..39dbbbdc6 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java @@ -214,7 +214,7 @@ public class CardAdapter extends RecyclerView.Adapter<AbstractCardViewHolder> im } case R.id.action_card_move: { DeckLog.verbose("[Move card] Launch move dialog for " + Card.class.getSimpleName() + " \"" + fullCard.getCard().getTitle() + "\" (#" + fullCard.getLocalId() + ") from " + Stack.class.getSimpleName() + " #" + +stackId); - MoveCardDialogFragment.newInstance(fullCard.getAccountId(), boardLocalId, fullCard.getLocalId()).show(fragmentManager, MoveCardDialogFragment.class.getSimpleName()); + MoveCardDialogFragment.newInstance(fullCard.getAccountId(), boardLocalId, fullCard.getCard().getTitle(), fullCard.getLocalId()).show(fragmentManager, MoveCardDialogFragment.class.getSimpleName()); return true; } case R.id.action_card_archive: { diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/movecard/MoveCardDialogFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/movecard/MoveCardDialogFragment.java index c8cfadca3..b14b60a7a 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/movecard/MoveCardDialogFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/movecard/MoveCardDialogFragment.java @@ -29,9 +29,11 @@ public class MoveCardDialogFragment extends BrandedDialogFragment implements Pic private static final String KEY_ORIGIN_ACCOUNT_ID = "account_id"; private static final String KEY_ORIGIN_BOARD_LOCAL_ID = "board_local_id"; + private static final String KEY_ORIGIN_CARD_TITLE = "card_title"; private static final String KEY_ORIGIN_CARD_LOCAL_ID = "card_local_id"; private Long originAccountId; private Long originBoardLocalId; + private String originCardTitle; private Long originCardLocalId; private DialogMoveCardBinding binding; @@ -65,12 +67,14 @@ public class MoveCardDialogFragment extends BrandedDialogFragment implements Pic if (originBoardLocalId < 0) { throw new IllegalArgumentException("Missing " + KEY_ORIGIN_BOARD_LOCAL_ID); } + originCardTitle = args.getString(KEY_ORIGIN_CARD_TITLE); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { binding = DialogMoveCardBinding.inflate(inflater); + binding.title.setText(getString(R.string.action_card_move_title, originCardTitle)); binding.submit.setOnClickListener((v) -> { DeckLog.verbose("[Move card] Attempt to move to " + Stack.class.getSimpleName() + " #" + selectedStack.getLocalId()); this.moveCardListener.move(originAccountId, originCardLocalId, selectedAccount.getId(), selectedBoard.getLocalId(), selectedStack.getLocalId()); @@ -109,11 +113,12 @@ public class MoveCardDialogFragment extends BrandedDialogFragment implements Pic binding.submit.setTextColor(mainColorStateList); } - public static DialogFragment newInstance(long originAccountId, long originBoardLocalId, Long originCardLocalId) { + public static DialogFragment newInstance(long originAccountId, long originBoardLocalId, String originCardTitle, Long originCardLocalId) { final DialogFragment dialogFragment = new MoveCardDialogFragment(); final Bundle args = new Bundle(); args.putLong(KEY_ORIGIN_ACCOUNT_ID, originAccountId); args.putLong(KEY_ORIGIN_BOARD_LOCAL_ID, originBoardLocalId); + args.putString(KEY_ORIGIN_CARD_TITLE, originCardTitle); args.putLong(KEY_ORIGIN_CARD_LOCAL_ID, originCardLocalId); dialogFragment.setArguments(args); return dialogFragment; diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/preparecreate/AccountAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/preparecreate/AccountAdapter.java index 29c2d9565..b0d330329 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/preparecreate/AccountAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/preparecreate/AccountAdapter.java @@ -9,6 +9,8 @@ import androidx.annotation.NonNull; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; +import java.net.URL; + import it.niedermann.android.glidesso.SingleSignOnUrl; import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.R; @@ -42,7 +44,11 @@ public class AccountAdapter extends AbstractAdapter<Account> { final Account item = getItem(position); if (item != null) { binding.username.setText(item.getUserName()); - binding.instance.setText(item.getUrl()); + try { + binding.instance.setText(new URL(item.getUrl()).getHost()); + } catch (Throwable t) { + binding.instance.setText(item.getUrl()); + } Glide.with(getContext()) .load(new SingleSignOnUrl(item.getName(), item.getAvatarUrl(dpToPx(binding.avatar.getContext(), R.dimen.icon_size_details)))) diff --git a/app/src/main/res/layout/dialog_move_card.xml b/app/src/main/res/layout/dialog_move_card.xml index daa82a6e7..221ea2f57 100644 --- a/app/src/main/res/layout/dialog_move_card.xml +++ b/app/src/main/res/layout/dialog_move_card.xml @@ -5,12 +5,26 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical" - android:padding="@dimen/spacer_1hx"> + android:paddingStart="@dimen/spacer_2x" + android:paddingTop="@dimen/spacer_2x" + android:paddingEnd="@dimen/spacer_2x" + android:paddingBottom="@dimen/spacer_1x"> + + <TextView + android:id="@+id/title" + style="@style/TextAppearance.AppCompat.Title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/spacer_1x" + android:layout_marginEnd="@dimen/spacer_1x" + tools:text="@string/action_card_move_title" /> <ScrollView android:id="@+id/scrollView" android:layout_width="wrap_content" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:layout_below="@id/title" + android:layout_marginTop="@dimen/spacer_2x"> <FrameLayout android:id="@+id/fragment_container" @@ -44,7 +58,7 @@ <Button android:id="@+id/cancel" - style="@style/Widget.MaterialComponents.Button.TextButton" + style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start" @@ -54,7 +68,7 @@ <Button android:id="@+id/submit" - style="@style/Widget.MaterialComponents.Button.TextButton" + style="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" diff --git a/app/src/main/res/layout/item_prepare_create_account.xml b/app/src/main/res/layout/item_prepare_create_account.xml index f21c71326..9a76b898e 100644 --- a/app/src/main/res/layout/item_prepare_create_account.xml +++ b/app/src/main/res/layout/item_prepare_create_account.xml @@ -14,7 +14,7 @@ android:layout_marginEnd="@dimen/spacer_2x" android:contentDescription="@null" app:srcCompat="@drawable/ic_person_grey600_24dp" - tools:srcCompat="@tools:sample/avatars" /> + tools:src="@tools:sample/avatars" /> <LinearLayout @@ -37,8 +37,10 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="1" + android:ellipsize="middle" + android:singleLine="true" android:textAppearance="?attr/textAppearanceListItemSecondary" - tools:text="https://example.com/" /> + tools:text="example.com" /> </LinearLayout> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_prepare_create_stack.xml b/app/src/main/res/layout/item_prepare_create_stack.xml index f5a1f97b1..516941997 100644 --- a/app/src/main/res/layout/item_prepare_create_stack.xml +++ b/app/src/main/res/layout/item_prepare_create_stack.xml @@ -6,9 +6,9 @@ android:layout_height="wrap_content" android:ellipsize="middle" android:paddingStart="72dp" - android:paddingTop="@dimen/spacer_2x" + android:paddingTop="20dp" android:paddingEnd="@dimen/spacer_2x" - android:paddingBottom="@dimen/spacer_2x" + android:paddingBottom="20dp" android:singleLine="true" android:textAppearance="?attr/textAppearanceListItem" tools:text="@tools:sample/full_names" /> |