-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDE-271 Typographic hierarchy should be visible #5047
Open
Frajhamster
wants to merge
2
commits into
Catrobat:develop
Choose a base branch
from
Frajhamster:IDE-271
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,12 +27,15 @@ | |
import android.os.Bundle; | ||
import android.preference.PreferenceManager; | ||
import android.util.Log; | ||
import android.util.Pair; | ||
import android.view.ActionMode; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ListAdapter; | ||
import android.widget.ListView; | ||
import android.widget.TextView; | ||
|
||
import org.catrobat.catroid.R; | ||
|
@@ -55,6 +58,7 @@ | |
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import androidx.annotation.IntDef; | ||
import androidx.annotation.NonNull; | ||
|
@@ -66,6 +70,7 @@ | |
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import static org.catrobat.catroid.common.SharedPreferenceKeys.SORT_PROJECTS_PREFERENCE_KEY; | ||
import static org.catrobat.catroid.ui.UiUtils.getAlertDialogAdapterForTextWithIcons; | ||
|
||
public abstract class RecyclerViewFragment<T extends Nameable> extends Fragment implements | ||
ActionMode.Callback, | ||
|
@@ -477,19 +482,37 @@ public void notifyDataSetChanged() { | |
} | ||
|
||
protected void showBackpackModeChooser() { | ||
CharSequence[] items = new CharSequence[] {getString(R.string.pack), getString(R.string.unpack)}; | ||
new AlertDialog.Builder(requireContext()) | ||
.setTitle(R.string.backpack_title) | ||
.setItems(items, (dialog, which) -> { | ||
switch (which) { | ||
case 0: | ||
startActionMode(BACKPACK); | ||
break; | ||
case 1: | ||
switchToBackpack(); | ||
} | ||
}) | ||
.show(); | ||
Pair[] items = new Pair[] { | ||
new Pair<String, Integer>(getString(R.string.pack), R.drawable.ic_login), | ||
new Pair<String, Integer>(getString(R.string.unpack), R.drawable.ic_logout)}; | ||
Comment on lines
+485
to
+487
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here the same as in |
||
|
||
LayoutInflater inflater = LayoutInflater.from(requireContext()); | ||
View customDialogView = inflater.inflate(R.layout.dialog_backpack_custom_alert, null); | ||
ListAdapter listAdapter = getAlertDialogAdapterForTextWithIcons(requireActivity(), | ||
requireContext(), items); | ||
|
||
AlertDialog dialog = new AlertDialog.Builder(requireContext()) | ||
.setView(customDialogView) | ||
.create(); | ||
Objects.requireNonNull(dialog.getWindow()) | ||
.setBackgroundDrawableResource(R.drawable.backpack_background_round); | ||
|
||
ListView listView = customDialogView.findViewById(R.id.backpack_item_list); | ||
listView.setAdapter(listAdapter); | ||
listView.setOnItemClickListener((parent, view, position, id) -> { | ||
switch (position) { | ||
case 0: | ||
startActionMode(BACKPACK); | ||
break; | ||
case 1: | ||
switchToBackpack(); | ||
break; | ||
} | ||
|
||
dialog.dismiss(); | ||
}); | ||
|
||
dialog.show(); | ||
} | ||
|
||
protected abstract void packItems(List<T> selectedItems); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
import android.os.Bundle; | ||
import android.os.Parcelable; | ||
import android.util.Log; | ||
import android.util.Pair; | ||
import android.view.ActionMode; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
|
@@ -37,7 +38,10 @@ | |
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.view.inputmethod.InputMethodManager; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.ListAdapter; | ||
import android.widget.ListView; | ||
import android.widget.TextView; | ||
|
||
import org.catrobat.catroid.BuildConfig; | ||
import org.catrobat.catroid.ProjectManager; | ||
|
@@ -93,6 +97,7 @@ | |
import java.lang.annotation.RetentionPolicy; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
import androidx.annotation.IntDef; | ||
|
@@ -107,6 +112,7 @@ | |
|
||
import static org.catrobat.catroid.common.Constants.CODE_XML_FILE_NAME; | ||
import static org.catrobat.catroid.common.Constants.UNDO_CODE_XML_FILE_NAME; | ||
import static org.catrobat.catroid.ui.UiUtils.getAlertDialogAdapterForTextWithIcons; | ||
|
||
public class ScriptFragment extends ListFragment implements | ||
ActionMode.Callback, | ||
|
@@ -847,19 +853,37 @@ public boolean onBrickLongClick(Brick brick, int position) { | |
} | ||
|
||
private void showBackpackModeChooser() { | ||
CharSequence[] items = new CharSequence[] {getString(R.string.pack), getString(R.string.unpack)}; | ||
new AlertDialog.Builder(getContext()) | ||
.setTitle(R.string.backpack_title) | ||
.setItems(items, (dialog, which) -> { | ||
switch (which) { | ||
case 0: | ||
startActionMode(BACKPACK); | ||
break; | ||
case 1: | ||
switchToBackpack(); | ||
} | ||
}) | ||
.show(); | ||
Pair[] items = new Pair[] { | ||
new Pair<String, Integer>(getString(R.string.pack), R.drawable.ic_login), | ||
new Pair<String, Integer>(getString(R.string.unpack), R.drawable.ic_logout)}; | ||
Comment on lines
+856
to
+858
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here the same as in the other files. |
||
|
||
LayoutInflater inflater = LayoutInflater.from(requireContext()); | ||
View customDialogView = inflater.inflate(R.layout.dialog_backpack_custom_alert, null); | ||
ListAdapter listAdapter = getAlertDialogAdapterForTextWithIcons(requireActivity(), | ||
requireContext(), items); | ||
|
||
AlertDialog dialog = new AlertDialog.Builder(requireContext()) | ||
.setView(customDialogView) | ||
.create(); | ||
Objects.requireNonNull(dialog.getWindow()) | ||
.setBackgroundDrawableResource(R.drawable.backpack_background_round); | ||
|
||
ListView listView = customDialogView.findViewById(R.id.backpack_item_list); | ||
listView.setAdapter(listAdapter); | ||
listView.setOnItemClickListener((parent, view, position, id) -> { | ||
switch (position) { | ||
case 0: | ||
startActionMode(BACKPACK); | ||
break; | ||
case 1: | ||
switchToBackpack(); | ||
break; | ||
} | ||
|
||
dialog.dismiss(); | ||
}); | ||
|
||
dialog.show(); | ||
} | ||
|
||
public void showNewScriptGroupAlert(List<Brick> selectedBricks) { | ||
|
27 changes: 27 additions & 0 deletions
27
catroid/src/main/res/drawable/backpack_background_round.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ Catroid: An on-device visual programming system for Android devices | ||
~ Copyright (C) 2010-2024 The Catrobat Team | ||
~ (<http://developer.catrobat.org/credits>) | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU Affero General Public License as | ||
~ published by the Free Software Foundation, either version 3 of the | ||
~ License, or (at your option) any later version. | ||
~ | ||
~ An additional term exception under section 7 of the GNU Affero | ||
~ General Public License, version 3, is available at | ||
~ http://developer.catrobat.org/license_additional_term | ||
~ | ||
~ This program is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU Affero General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Affero General Public License | ||
~ along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="30dp" /> | ||
<solid android:color="@color/backpack_background" /> | ||
</shape> |
52 changes: 52 additions & 0 deletions
52
catroid/src/main/res/layout/dialog_backpack_custom_alert.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ Catroid: An on-device visual programming system for Android devices | ||
~ Copyright (C) 2010-2024 The Catrobat Team | ||
~ (<http://developer.catrobat.org/credits>) | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU Affero General Public License as | ||
~ published by the Free Software Foundation, either version 3 of the | ||
~ License, or (at your option) any later version. | ||
~ | ||
~ An additional term exception under section 7 of the GNU Affero | ||
~ General Public License, version 3, is available at | ||
~ http://developer.catrobat.org/license_additional_term | ||
~ | ||
~ This program is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU Affero General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Affero General Public License | ||
~ along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:paddingStart="5dp" | ||
android:paddingEnd="5dp"> | ||
|
||
<TextView | ||
android:id="@+id/backpack_dialog_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/backpack_title" | ||
android:textAppearance="?android:textAppearanceLarge" | ||
android:textSize="20sp" | ||
android:padding="16dp"/> | ||
|
||
<View | ||
android:id="@+id/backpack_title_divider" | ||
android:layout_width="match_parent" | ||
android:layout_height="2dp" | ||
android:background="@color/accent"/> | ||
|
||
<ListView | ||
android:id="@+id/backpack_item_list" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:divider="@null" | ||
android:padding="16dp"/> | ||
</LinearLayout> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to get rid of the warning
Raw use of parameterized class 'Pair'
by using Lists as bellow: