diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-04-08 20:14:27 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-04-08 20:14:27 +0300 |
commit | 837f212e2a06fbe083be5a692cc6455eafd92c57 (patch) | |
tree | 45b5bec2250ad17b29293e2aa15d879effdf4f64 /app/src/main | |
parent | 153ced811039cf9ff1efebc80eed0e2bfe051a3f (diff) |
#358 Create PickStackActivity
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main')
16 files changed, 567 insertions, 27 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0d1424515..18976f838 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -79,6 +79,11 @@ android:theme="@style/AppTheme" /> <activity + android:name=".ui.pickstack.PickStackActivity" + android:label="@string/simple_select" + android:theme="@style/AppTheme" /> + + <activity android:name=".ui.about.AboutActivity" android:label="@string/about" android:parentActivityName="it.niedermann.nextcloud.deck.ui.MainActivity" diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/AccountAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/AccountAdapter.java new file mode 100644 index 000000000..742ade26d --- /dev/null +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/AccountAdapter.java @@ -0,0 +1,71 @@ +package it.niedermann.nextcloud.deck.ui.pickstack; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +import it.niedermann.nextcloud.deck.DeckLog; +import it.niedermann.nextcloud.deck.R; +import it.niedermann.nextcloud.deck.databinding.ItemPickStackAccountBinding; +import it.niedermann.nextcloud.deck.model.Account; +import it.niedermann.nextcloud.deck.util.ViewUtil; + +import static it.niedermann.nextcloud.deck.util.DimensionUtil.getAvatarDimension; + +public class AccountAdapter extends ArrayAdapter<Account> { + + @NonNull + private final LayoutInflater inflater; + + @SuppressWarnings("WeakerAccess") + public AccountAdapter(@NonNull Context context) { + super(context, R.layout.item_pick_stack_account); + setDropDownViewResource(R.layout.item_pick_stack_account); + inflater = LayoutInflater.from(context); + } + + @Override + public boolean hasStableIds() { + return true; + } + + @Override + public long getItemId(int position) { + return Objects.requireNonNull(getItem(position)).getId(); + } + + @NotNull + @Override + public View getView(int position, View convertView, @NotNull ViewGroup parent) { + final ItemPickStackAccountBinding binding; + if (convertView == null) { + binding = ItemPickStackAccountBinding.inflate(inflater, parent, false); + } else { + binding = ItemPickStackAccountBinding.bind(convertView); + } + + final Account item = getItem(position); + if (item != null) { + binding.username.setText(item.getUserName()); + binding.instance.setText(item.getUrl()); + ViewUtil.addAvatar(binding.avatar.getContext(), binding.avatar, item.getUrl(), item.getUserName(), getAvatarDimension(binding.avatar.getContext(), R.dimen.icon_size_details), R.drawable.ic_person_grey600_24dp); + } else { + DeckLog.logError(new IllegalArgumentException("No item for position " + position)); + } + return binding.getRoot(); + } + + @Override + public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + return getView(position, convertView, parent); + } +} diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/BoardAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/BoardAdapter.java new file mode 100644 index 000000000..990b7c7d5 --- /dev/null +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/BoardAdapter.java @@ -0,0 +1,68 @@ +package it.niedermann.nextcloud.deck.ui.pickstack; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +import it.niedermann.nextcloud.deck.DeckLog; +import it.niedermann.nextcloud.deck.R; +import it.niedermann.nextcloud.deck.databinding.ItemPickStackBoardBinding; +import it.niedermann.nextcloud.deck.model.Board; +import it.niedermann.nextcloud.deck.util.ViewUtil; + +public class BoardAdapter extends ArrayAdapter<Board> { + + @NonNull + private final LayoutInflater inflater; + + @SuppressWarnings("WeakerAccess") + public BoardAdapter(@NonNull Context context) { + super(context, R.layout.item_pick_stack_account); + setDropDownViewResource(R.layout.item_pick_stack_account); + inflater = LayoutInflater.from(context); + } + + @Override + public boolean hasStableIds() { + return true; + } + + @Override + public long getItemId(int position) { + return Objects.requireNonNull(getItem(position)).getLocalId(); + } + + @NotNull + @Override + public View getView(int position, View convertView, @NotNull ViewGroup parent) { + final ItemPickStackBoardBinding binding; + if (convertView == null) { + binding = ItemPickStackBoardBinding.inflate(inflater, parent, false); + } else { + binding = ItemPickStackBoardBinding.bind(convertView); + } + + final Board item = getItem(position); + if (item != null) { + binding.boardTitle.setText(item.getTitle()); + binding.avatar.setImageDrawable(ViewUtil.getTintedImageView(binding.avatar.getContext(), R.drawable.circle_grey600_36dp, "#" + item.getColor())); + } else { + DeckLog.logError(new IllegalArgumentException("No item for position " + position)); + } + return binding.getRoot(); + } + + @Override + public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + return getView(position, convertView, parent); + } +} diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/PickStackActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/PickStackActivity.java new file mode 100644 index 000000000..5d1997de7 --- /dev/null +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/PickStackActivity.java @@ -0,0 +1,150 @@ +package it.niedermann.nextcloud.deck.ui.pickstack; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.Observer; + +import java.util.List; + +import it.niedermann.nextcloud.deck.Application; +import it.niedermann.nextcloud.deck.DeckLog; +import it.niedermann.nextcloud.deck.R; +import it.niedermann.nextcloud.deck.databinding.ActivityPickStackBinding; +import it.niedermann.nextcloud.deck.model.Account; +import it.niedermann.nextcloud.deck.model.Board; +import it.niedermann.nextcloud.deck.model.full.FullStack; +import it.niedermann.nextcloud.deck.persistence.sync.SyncManager; +import it.niedermann.nextcloud.deck.ui.ImportAccountActivity; +import it.niedermann.nextcloud.deck.ui.exception.ExceptionHandler; + +import static androidx.lifecycle.Transformations.switchMap; + +public class PickStackActivity extends AppCompatActivity { + + private ActivityPickStackBinding binding; + + private SyncManager syncManager; + + private ArrayAdapter<Account> accountAdapter; + private ArrayAdapter<Board> boardAdapter; + private ArrayAdapter<FullStack> stackAdapter; + + @Nullable + private LiveData<List<Board>> boardsLiveData; + @NonNull + private Observer<List<Board>> boardsObserver = (boards) -> { + boardAdapter.clear(); + boardAdapter.addAll(boards); + }; + + @Nullable + private LiveData<List<FullStack>> stacksLiveData; + @NonNull + private Observer<List<FullStack>> stacksObserver = (stacks) -> { + stackAdapter.clear(); + stackAdapter.addAll(stacks); + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this)); + setTheme(Application.getAppTheme(this) ? R.style.DarkAppTheme : R.style.AppTheme); + + binding = ActivityPickStackBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + setSupportActionBar(binding.toolbar); + + accountAdapter = new AccountAdapter(this); + binding.accountSelect.setAdapter(accountAdapter); + boardAdapter = new BoardAdapter(this); + binding.boardSelect.setAdapter(boardAdapter); + stackAdapter = new StackAdapter(this); + binding.stackSelect.setAdapter(stackAdapter); + + syncManager = new SyncManager(this); + + switchMap(syncManager.hasAccounts(), hasAccounts -> { + if (hasAccounts) { + return syncManager.readAccounts(); + } else { + startActivityForResult(new Intent(this, ImportAccountActivity.class), ImportAccountActivity.REQUEST_CODE_IMPORT_ACCOUNT); + return null; + } + }).observe(this, (List<Account> accounts) -> { + if (accounts == null) { + throw new IllegalStateException("hasAccounts() returns true, but readAccounts() returns null"); + } + accountAdapter.clear(); + accountAdapter.addAll(accounts); + // TODO preselect current account + long lastAccountId = Application.readCurrentAccountId(this); + }); + + binding.accountSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + updateBoardsSource(parent.getSelectedItemId()); + } + + @Override + public void onNothingSelected(AdapterView<?> parent) { + // Nothing to do here + } + }); + + binding.boardSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + Object selectedItem = parent.getSelectedItem(); + if (selectedItem instanceof Board) { + Board board = (Board) selectedItem; + updateStacksSource(board.getAccountId(), board.getLocalId()); + } else { + DeckLog.logError(new IllegalArgumentException("parent.getSelectedItem() did not return an instance of " + FullStack.class.getCanonicalName() + " but " + selectedItem.getClass().getCanonicalName())); + } + } + + @Override + public void onNothingSelected(AdapterView<?> parent) { + // Nothing to do here + } + }); + binding.cancel.setOnClickListener((v) -> finish()); + binding.submit.setOnClickListener((v) -> onSubmit()); + } + + private void updateBoardsSource(long accountId) { + if (boardsLiveData != null) { + boardsLiveData.removeObserver(boardsObserver); + } + boardsLiveData = syncManager.getBoards(accountId); + boardsLiveData.observe(this, boardsObserver); + } + + private void updateStacksSource(long accountId, long boardId) { + if (stacksLiveData != null) { + stacksLiveData.removeObserver(stacksObserver); + } + stacksLiveData = syncManager.getStacksForBoard(accountId, boardId); + stacksLiveData.observe(this, stacksObserver); + } + + private void onSubmit() { + // Start EditActivity and pass parameters + long accountId = binding.accountSelect.getSelectedItemId(); + long boardId = binding.boardSelect.getSelectedItemId(); + long stackId = binding.stackSelect.getSelectedItemId(); + + + } +}
\ No newline at end of file diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/StackAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/StackAdapter.java new file mode 100644 index 000000000..24a9d844e --- /dev/null +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/pickstack/StackAdapter.java @@ -0,0 +1,66 @@ +package it.niedermann.nextcloud.deck.ui.pickstack; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +import it.niedermann.nextcloud.deck.DeckLog; +import it.niedermann.nextcloud.deck.R; +import it.niedermann.nextcloud.deck.databinding.ItemPickStackStackBinding; +import it.niedermann.nextcloud.deck.model.full.FullStack; + +public class StackAdapter extends ArrayAdapter<FullStack> { + + @NonNull + private final LayoutInflater inflater; + + @SuppressWarnings("WeakerAccess") + public StackAdapter(@NonNull Context context) { + super(context, R.layout.item_pick_stack_account); + setDropDownViewResource(R.layout.item_pick_stack_account); + inflater = LayoutInflater.from(context); + } + + @Override + public boolean hasStableIds() { + return true; + } + + @Override + public long getItemId(int position) { + return Objects.requireNonNull(getItem(position)).getLocalId(); + } + + @NotNull + @Override + public View getView(int position, View convertView, @NotNull ViewGroup parent) { + final ItemPickStackStackBinding binding; + if (convertView == null) { + binding = ItemPickStackStackBinding.inflate(inflater, parent, false); + } else { + binding = ItemPickStackStackBinding.bind(convertView); + } + + final FullStack item = getItem(position); + if (item != null) { + binding.stackTitle.setText(item.getStack().getTitle()); + } else { + DeckLog.logError(new IllegalArgumentException("No item for position " + position)); + } + return binding.getRoot(); + } + + @Override + public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + return getView(position, convertView, parent); + } +} diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/tiles/EditCardTileService.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/tiles/EditCardTileService.java index f434a25dd..47a2c3528 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/tiles/EditCardTileService.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/tiles/EditCardTileService.java @@ -6,11 +6,7 @@ import android.os.Build; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; -import it.niedermann.nextcloud.deck.ui.card.EditActivity; - -import static it.niedermann.nextcloud.deck.ui.card.CardAdapter.BUNDLE_KEY_ACCOUNT_ID; -import static it.niedermann.nextcloud.deck.ui.card.CardAdapter.BUNDLE_KEY_BOARD_ID; -import static it.niedermann.nextcloud.deck.ui.card.CardAdapter.BUNDLE_KEY_LOCAL_ID; +import it.niedermann.nextcloud.deck.ui.pickstack.PickStackActivity; @TargetApi(Build.VERSION_CODES.N) public class EditCardTileService extends TileService { @@ -24,11 +20,7 @@ public class EditCardTileService extends TileService { @Override public void onClick() { - Intent intent = new Intent(getApplicationContext(), EditActivity.class); - // create new note intent - intent.putExtra(BUNDLE_KEY_ACCOUNT_ID, -1); - intent.putExtra(BUNDLE_KEY_BOARD_ID, -1); - intent.putExtra(BUNDLE_KEY_LOCAL_ID, -1); + Intent intent = new Intent(getApplicationContext(), PickStackActivity.class); // ensure it won't open twice if already running intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); // ask to unlock the screen if locked, then start new note intent diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java index 784244283..3b290edae 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/ViewUtil.java @@ -23,10 +23,12 @@ public final class ViewUtil { } public static void addAvatar(Context context, ImageView avatar, String baseUrl, String userId, @DrawableRes int errorResource) { + // TODO get context from ImageView? addAvatar(context, avatar, baseUrl, userId, DimensionUtil.getAvatarDimension(context), errorResource); } public static void addAvatar(Context context, ImageView avatar, String baseUrl, String userId, int avatarSize, @DrawableRes int errorResource) { + // TODO get context from ImageView? String uri = baseUrl + "/index.php/avatar/" + Uri.encode(userId) + "/" + avatarSize; Glide.with(context) .load(uri) diff --git a/app/src/main/res/layout/activity_exception.xml b/app/src/main/res/layout/activity_exception.xml index 36f438f8f..92b0b35ff 100644 --- a/app/src/main/res/layout/activity_exception.xml +++ b/app/src/main/res/layout/activity_exception.xml @@ -16,7 +16,7 @@ android:layout_height="?android:actionBarSize" app:titleTextColor="@android:color/white" tools:title="@string/simple_exception" /> - + </com.google.android.material.appbar.AppBarLayout> <LinearLayout @@ -41,10 +41,10 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:fontFamily="monospace" android:padding="@dimen/standard_margin" android:scrollbars="horizontal|vertical" - android:textIsSelectable="true" /> + android:textIsSelectable="true" + app:fontFamily="monospace" /> <LinearLayout android:layout_width="match_parent" diff --git a/app/src/main/res/layout/activity_pick_stack.xml b/app/src/main/res/layout/activity_pick_stack.xml new file mode 100644 index 000000000..2330a6c6e --- /dev/null +++ b/app/src/main/res/layout/activity_pick_stack.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:showIn="@layout/activity_pick_stack"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appBarLayout" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?android:actionBarSize" + app:navigationIcon="@drawable/ic_arrow_back_white_24dp" + app:title="@string/simple_select" + app:titleTextColor="@android:color/white" /> + </com.google.android.material.appbar.AppBarLayout> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_above="@+id/buttonBar" + android:layout_below="@id/appBarLayout" + android:padding="@dimen/standard_padding"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <androidx.appcompat.widget.AppCompatSpinner + android:id="@+id/account_select" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:prompt="@string/choose_account" + android:spinnerMode="dialog" + tools:listitem="@layout/item_pick_stack_account" /> + + <androidx.appcompat.widget.AppCompatSpinner + android:id="@+id/board_select" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:prompt="@string/choose_board" + android:spinnerMode="dialog" + tools:listitem="@layout/item_board" /> + + <androidx.appcompat.widget.AppCompatSpinner + android:id="@+id/stack_select" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:prompt="@string/choose_list" + android:spinnerMode="dialog" + tools:listitem="@layout/item_board" /> + </LinearLayout> + </ScrollView> + + <LinearLayout + android:id="@+id/buttonBar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:orientation="horizontal" + android:padding="@dimen/standard_padding" + android:weightSum="1.0"> + + <com.google.android.material.button.MaterialButton + android:id="@+id/cancel" + style="@android:style/Widget.DeviceDefault.Button.Borderless" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/standard_half_margin" + android:layout_marginRight="@dimen/standard_half_margin" + android:layout_weight=".5" + android:text="@string/simple_select" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/submit" + style="@style/Widget.AppCompat.Button.Colored" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/standard_half_margin" + android:layout_marginLeft="@dimen/standard_half_margin" + android:layout_weight=".5" + android:text="@string/simple_select" /> + </LinearLayout> +</RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_access_control.xml b/app/src/main/res/layout/item_access_control.xml index 0589b5d9e..9c920b4c3 100644 --- a/app/src/main/res/layout/item_access_control.xml +++ b/app/src/main/res/layout/item_access_control.xml @@ -14,7 +14,8 @@ android:layout_marginEnd="@dimen/standard_margin" android:layout_marginRight="@dimen/standard_margin" android:contentDescription="@null" - app:srcCompat="@drawable/ic_person_grey600_24dp" /> + app:srcCompat="@drawable/ic_person_grey600_24dp" + tools:srcCompat="@tools:sample/avatars" /> <LinearLayout android:layout_width="match_parent" @@ -31,21 +32,22 @@ android:id="@+id/username" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_weight="1" android:layout_gravity="center" + android:layout_weight="1" android:textSize="16sp" tools:drawableEnd="@drawable/ic_sync_blue_24dp" - tools:text="Username" /> + tools:text="@tools:sample/full_names" /> <androidx.appcompat.widget.AppCompatImageButton android:id="@+id/delete" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="0dp" android:layout_gravity="center" android:background="?android:selectableItemBackground" + android:padding="0dp" app:srcCompat="@drawable/ic_delete_black_24dp" /> </LinearLayout> + <com.google.android.flexbox.FlexboxLayout android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/item_access_control_owner.xml b/app/src/main/res/layout/item_access_control_owner.xml index 368f52480..5edcb6065 100644 --- a/app/src/main/res/layout/item_access_control_owner.xml +++ b/app/src/main/res/layout/item_access_control_owner.xml @@ -14,7 +14,8 @@ android:layout_marginEnd="@dimen/standard_margin" android:layout_marginRight="@dimen/standard_margin" android:contentDescription="@null" - app:srcCompat="@drawable/ic_person_grey600_24dp" /> + app:srcCompat="@drawable/ic_person_grey600_24dp" + tools:srcCompat="@tools:sample/avatars" /> <LinearLayout android:layout_width="match_parent" @@ -25,19 +26,18 @@ android:id="@+id/owner" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" android:layout_gravity="center" + android:layout_weight="1" android:textSize="16sp" - tools:text="Username" /> + tools:text="@tools:sample/full_names" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" android:layout_gravity="center" - android:textColor="@color/fg_secondary" + android:layout_weight="1" android:text="@string/owner" - tools:text="Username" /> + android:textColor="@color/fg_secondary" /> </LinearLayout> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_pick_stack_account.xml b/app/src/main/res/layout/item_pick_stack_account.xml new file mode 100644 index 000000000..3aeafb80c --- /dev/null +++ b/app/src/main/res/layout/item_pick_stack_account.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="@dimen/standard_padding"> + + <ImageView + android:id="@+id/avatar" + android:layout_width="@dimen/avatar_size" + android:layout_height="@dimen/avatar_size" + android:layout_marginEnd="@dimen/standard_margin" + android:layout_marginRight="@dimen/standard_margin" + android:contentDescription="@null" + app:srcCompat="@drawable/ic_person_grey600_24dp" + tools:srcCompat="@tools:sample/avatars" /> + + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/username" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="1" + android:textSize="16sp" + tools:text="@tools:sample/full_names" /> + + <TextView + android:id="@+id/instance" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="1" + android:text="@string/owner" + android:textColor="@color/fg_secondary" /> + </LinearLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_pick_stack_board.xml b/app/src/main/res/layout/item_pick_stack_board.xml new file mode 100644 index 000000000..e0ab41b55 --- /dev/null +++ b/app/src/main/res/layout/item_pick_stack_board.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="@dimen/standard_padding" + tools:ignore="UseCompoundDrawables"> + + <ImageView + android:id="@+id/avatar" + android:layout_width="@dimen/avatar_size" + android:layout_height="@dimen/avatar_size" + android:layout_marginEnd="@dimen/standard_margin" + android:layout_marginRight="@dimen/standard_margin" + android:contentDescription="@null" + android:padding="@dimen/standard_half_padding" + app:srcCompat="@drawable/circle_grey600_36dp" + tools:tint="@color/board_default_color" /> + + <TextView + android:id="@+id/board_title" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="1" + android:ellipsize="middle" + android:singleLine="true" + android:textSize="16sp" + tools:text="@tools:sample/lorem/random" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_pick_stack_stack.xml b/app/src/main/res/layout/item_pick_stack_stack.xml new file mode 100644 index 000000000..29ba63ca4 --- /dev/null +++ b/app/src/main/res/layout/item_pick_stack_stack.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/stackTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ellipsize="middle" + android:paddingStart="70dp" + android:paddingLeft="70dp" + android:paddingTop="@dimen/standard_padding" + android:paddingEnd="@dimen/standard_padding" + android:paddingRight="@dimen/standard_padding" + android:paddingBottom="@dimen/standard_padding" + android:singleLine="true" + android:textSize="16sp" + tools:text="@tools:sample/full_names" /> + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 640bcc610..4ffb15509 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -172,4 +172,6 @@ <string name="no_comments_yet">No comments yet</string> <string name="no_boards">No boards yet</string> <string name="add_a_new_board_using_the_button">Add a new board using the + button</string> + <string name="choose_board">Choose board</string> + <string name="choose_list">Choose list</string> </resources> diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml index ab23766db..c37b1d3cd 100644 --- a/app/src/main/res/xml/shortcuts.xml +++ b/app/src/main/res/xml/shortcuts.xml @@ -9,10 +9,7 @@ <intent android:action="android.intent.action.VIEW" android:targetPackage="it.niedermann.nextcloud.deck" - android:targetClass="it.niedermann.nextcloud.deck.ui.card.EditActivity"> - <extra android:name="localId" android:value="-1" /> - <extra android:name="boardId" android:value="-1" /> - <extra android:name="stackId" android:value="-1" /> + android:targetClass="it.niedermann.nextcloud.deck.ui.pickstack.PickStackActivity"> </intent> <categories android:name="android.shortcut.conversation" /> </shortcut> |