Implemented Shortcuts
This commit is contained in:
@@ -270,7 +270,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getDefaultFragmentAfterLogin() {
|
private int getDefaultFragmentAfterLogin() {
|
||||||
return FRAGMENT_NEWS;
|
return FRAGMENT_MODULES;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toLogoutState() {
|
private void toLogoutState() {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import de.sebse.fuplanner.tools.logging.Logger;
|
|||||||
import de.sebse.fuplanner.tools.ui.CustomViewHolder;
|
import de.sebse.fuplanner.tools.ui.CustomViewHolder;
|
||||||
import de.sebse.fuplanner.tools.ui.ItemViewHolder;
|
import de.sebse.fuplanner.tools.ui.ItemViewHolder;
|
||||||
import de.sebse.fuplanner.tools.ui.MailViewHolder;
|
import de.sebse.fuplanner.tools.ui.MailViewHolder;
|
||||||
|
import de.sebse.fuplanner.tools.ui.ShortcutViewHolder;
|
||||||
import de.sebse.fuplanner.tools.ui.StringViewHolder;
|
import de.sebse.fuplanner.tools.ui.StringViewHolder;
|
||||||
|
|
||||||
class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
@@ -35,6 +36,7 @@ class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||||||
private static final int TYPE_ITEM = 2;
|
private static final int TYPE_ITEM = 2;
|
||||||
private static final int TYPE_SHOW_MORE = 3;
|
private static final int TYPE_SHOW_MORE = 3;
|
||||||
private static final int TYPE_MAIL = 4;
|
private static final int TYPE_MAIL = 4;
|
||||||
|
private static final int TYPE_SHORTCUTS = 5;
|
||||||
|
|
||||||
@Nullable private final ModDetailListener mListener;
|
@Nullable private final ModDetailListener mListener;
|
||||||
|
|
||||||
@@ -57,6 +59,7 @@ class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||||||
mPositionalData.clear();
|
mPositionalData.clear();
|
||||||
mPositionalData.add(new Pair<>(TYPE_HEADER, ModulePart.DESCRIPTION));
|
mPositionalData.add(new Pair<>(TYPE_HEADER, ModulePart.DESCRIPTION));
|
||||||
mPositionalData.add(new Pair<>(TYPE_DESCRIPTION, null));
|
mPositionalData.add(new Pair<>(TYPE_DESCRIPTION, null));
|
||||||
|
mPositionalData.add(new Pair<>(TYPE_SHORTCUTS, null));
|
||||||
mPositionalData.add(new Pair<>(TYPE_HEADER, ModulePart.LECTURERS));
|
mPositionalData.add(new Pair<>(TYPE_HEADER, ModulePart.LECTURERS));
|
||||||
for (int i = 0; i < mValue.lecturer.size(); i++) {
|
for (int i = 0; i < mValue.lecturer.size(); i++) {
|
||||||
mPositionalData.add(new Pair<>(TYPE_MAIL, ModulePart.LECTURERS+1024*i));
|
mPositionalData.add(new Pair<>(TYPE_MAIL, ModulePart.LECTURERS+1024*i));
|
||||||
@@ -103,6 +106,10 @@ class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||||||
view = LayoutInflater.from(parent.getContext())
|
view = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.list_all_mails, parent, false);
|
.inflate(R.layout.list_all_mails, parent, false);
|
||||||
return new MailViewHolder(view);
|
return new MailViewHolder(view);
|
||||||
|
case TYPE_SHORTCUTS:
|
||||||
|
view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.list_moddetails_shortcuts, parent, false);
|
||||||
|
return new ShortcutViewHolder(view);
|
||||||
default:
|
default:
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
return null;
|
return null;
|
||||||
@@ -218,6 +225,16 @@ class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case TYPE_SHORTCUTS:
|
||||||
|
ShortcutViewHolder s = (ShortcutViewHolder) holder;
|
||||||
|
s.mLeft.setOnClickListener(view -> {
|
||||||
|
if (mListener != null) mListener.gotoFragmentPart(ModulePart.RESOURCES, -1);
|
||||||
|
});
|
||||||
|
s.mRight.setOnClickListener(view -> {
|
||||||
|
if (mListener != null) mListener.gotoFragmentPart(ModulePart.GRADEBOOK, -1);
|
||||||
|
});
|
||||||
|
break;
|
||||||
case TYPE_SHOW_MORE:
|
case TYPE_SHOW_MORE:
|
||||||
CustomViewHolder c = (CustomViewHolder) holder;
|
CustomViewHolder c = (CustomViewHolder) holder;
|
||||||
c.mView.setOnClickListener(view -> {
|
c.mView.setOnClickListener(view -> {
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package de.sebse.fuplanner.tools.ui;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import de.sebse.fuplanner.R;
|
||||||
|
|
||||||
|
public class ShortcutViewHolder extends CustomViewHolder {
|
||||||
|
public final TextView mLeft;
|
||||||
|
public final TextView mRight;
|
||||||
|
|
||||||
|
public ShortcutViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
mLeft = view.findViewById(R.id.left);
|
||||||
|
mRight = view.findViewById(R.id.right);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ public class DirectoryNodeBinder extends TreeViewBinder<DirectoryNodeBinder.View
|
|||||||
@Override
|
@Override
|
||||||
public void bindView(ViewHolder holder, int position, TreeNode node) {
|
public void bindView(ViewHolder holder, int position, TreeNode node) {
|
||||||
holder.ivArrow.setRotation(0);
|
holder.ivArrow.setRotation(0);
|
||||||
holder.ivArrow.setImageResource(R.drawable.ic_keyboard_arrow_right_black_18dp);
|
holder.ivArrow.setImageResource(R.drawable.ic_keyboard_arrow_right);
|
||||||
int rotateDegree = node.isExpand() ? 90 : 0;
|
int rotateDegree = node.isExpand() ? 90 : 0;
|
||||||
holder.ivArrow.setRotation(rotateDegree);
|
holder.ivArrow.setRotation(rotateDegree);
|
||||||
Resource.Folder dirNode = (Resource.Folder) node.getContent();
|
Resource.Folder dirNode = (Resource.Folder) node.getContent();
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 156 B |
Binary file not shown.
|
Before Width: | Height: | Size: 128 B |
Binary file not shown.
|
Before Width: | Height: | Size: 168 B |
Binary file not shown.
|
Before Width: | Height: | Size: 199 B |
Binary file not shown.
|
Before Width: | Height: | Size: 258 B |
4
app/src/main/res/drawable/ic_keyboard_arrow_right.xml
Normal file
4
app/src/main/res/drawable/ic_keyboard_arrow_right.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<vector android:height="18dp" android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0" android:width="18dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M8.59,16.34l4.58,-4.59 -4.58,-4.59L10,5.75l6,6 -6,6z"/>
|
||||||
|
</vector>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
android:layout_width="18dp"
|
android:layout_width="18dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="18dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:src="@drawable/ic_keyboard_arrow_right_black_18dp"
|
android:src="@drawable/ic_keyboard_arrow_right"
|
||||||
android:contentDescription="@string/arrow" />
|
android:contentDescription="@string/arrow" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
40
app/src/main/res/layout/list_moddetails_shortcuts.xml
Normal file
40
app/src/main/res/layout/list_moddetails_shortcuts.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="@dimen/text_margin">
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/guideline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.5"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/left"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/resources"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:typeface="sans"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/colorFUBlue"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/guideline"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/right"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/gradebook"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:typeface="sans"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/colorFUBlue"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/guideline"
|
||||||
|
/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user