Code cleanup
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@
|
|||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
|
app/release/*
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ public class MainActivity extends AppCompatActivity
|
|||||||
private int fragmentPage = FRAGMENT_NONE;
|
private int fragmentPage = FRAGMENT_NONE;
|
||||||
private String fragmentData = "";
|
private String fragmentData = "";
|
||||||
private CanteenBrowser mCanteenBrowser;
|
private CanteenBrowser mCanteenBrowser;
|
||||||
private HashMap<String, RequestPermissionsResultListener> permissionListeners = new HashMap<>();
|
private final HashMap<String, RequestPermissionsResultListener> permissionListeners = new HashMap<>();
|
||||||
private boolean mOfflineBanner;
|
private boolean mOfflineBanner;
|
||||||
private NewAsyncQueue mQueue = new NewAsyncQueue();
|
private final NewAsyncQueue mQueue = new NewAsyncQueue();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import de.sebse.fuplanner.services.Canteen.types.Canteens;
|
|||||||
import de.sebse.fuplanner.tools.ui.ItemViewHolder;
|
import de.sebse.fuplanner.tools.ui.ItemViewHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link RecyclerView.Adapter} that can display a {@link Modules.Module} and makes a call to the
|
* {@link RecyclerView.Adapter} that can display a {@link Canteen} and makes a call to the
|
||||||
* specified {@link OnCanteensFragmentInteractionListener}.
|
* specified {@link OnCanteensFragmentInteractionListener}.
|
||||||
*/
|
*/
|
||||||
class CanteensAdapter extends RecyclerView.Adapter<ItemViewHolder> {
|
class CanteensAdapter extends RecyclerView.Adapter<ItemViewHolder> {
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import de.sebse.fuplanner.tools.ui.MealViewHolder;
|
|||||||
import de.sebse.fuplanner.tools.ui.StringViewHolder;
|
import de.sebse.fuplanner.tools.ui.StringViewHolder;
|
||||||
|
|
||||||
class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private String[] CATEGORY_KEYS = new String[]{"Essen", "Aktionen", "Beilagen", "Desserts", "Salate", "Suppen", "Vorspeisen"};
|
private final String[] CATEGORY_KEYS = new String[]{"Essen", "Aktionen", "Beilagen", "Desserts", "Salate", "Suppen", "Vorspeisen"};
|
||||||
@StringRes
|
@StringRes
|
||||||
private int[] CATEGORY_VALS = new int[]{R.string.meals, R.string.special_meals, R.string.side_dishes, R.string.desserts, R.string.salads, R.string.soups, R.string.starters};
|
private final int[] CATEGORY_VALS = new int[]{R.string.meals, R.string.special_meals, R.string.side_dishes, R.string.desserts, R.string.salads, R.string.soups, R.string.starters};
|
||||||
@StringRes
|
@StringRes
|
||||||
private int CATEGORY_OTHER = R.string.others;
|
private final int CATEGORY_OTHER = R.string.others;
|
||||||
private ArrayList<Object> matches = new ArrayList<>();
|
private final ArrayList<Object> matches = new ArrayList<>();
|
||||||
|
|
||||||
private Day mDay = null;
|
private Day mDay = null;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ModDetailAnnounceAdapter extends RecyclerView.Adapter<CustomViewHolder> {
|
|||||||
|
|
||||||
@Nullable private Modules.Module mModule = null;
|
@Nullable private Modules.Module mModule = null;
|
||||||
private Logger log = new Logger(this);
|
private Logger log = new Logger(this);
|
||||||
@NonNull private Download.OnDownloadRequestInterface requestInterface;
|
@NonNull private final Download.OnDownloadRequestInterface requestInterface;
|
||||||
|
|
||||||
ModDetailAnnounceAdapter(@NonNull Download.OnDownloadRequestInterface requestInterface) {
|
ModDetailAnnounceAdapter(@NonNull Download.OnDownloadRequestInterface requestInterface) {
|
||||||
this.requestInterface = requestInterface;
|
this.requestInterface = requestInterface;
|
||||||
@@ -40,7 +40,7 @@ class ModDetailAnnounceAdapter extends RecyclerView.Adapter<CustomViewHolder> {
|
|||||||
this.setModule();
|
this.setModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModule() {
|
private void setModule() {
|
||||||
this.notifyDataSetChanged();
|
this.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class ModDetailAnnounceFragment extends Fragment implements Download.OnDo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Download getDownload() {
|
private Download getDownload() {
|
||||||
if (download == null)
|
if (download == null)
|
||||||
download = new Download(this::getContext, () -> (MainActivity) getActivity());
|
download = new Download(this::getContext, () -> (MainActivity) getActivity());
|
||||||
return download;
|
return download;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ModDetailAssignmentAdapter extends RecyclerView.Adapter<CustomViewHolder>
|
|||||||
|
|
||||||
@Nullable private Modules.Module mModule = null;
|
@Nullable private Modules.Module mModule = null;
|
||||||
private Logger log = new Logger(this);
|
private Logger log = new Logger(this);
|
||||||
@NonNull private Download.OnDownloadRequestInterface requestInterface;
|
@NonNull private final Download.OnDownloadRequestInterface requestInterface;
|
||||||
|
|
||||||
ModDetailAssignmentAdapter(@NonNull Download.OnDownloadRequestInterface requestInterface) {
|
ModDetailAssignmentAdapter(@NonNull Download.OnDownloadRequestInterface requestInterface) {
|
||||||
this.requestInterface = requestInterface;
|
this.requestInterface = requestInterface;
|
||||||
@@ -40,7 +40,7 @@ class ModDetailAssignmentAdapter extends RecyclerView.Adapter<CustomViewHolder>
|
|||||||
this.setModule();
|
this.setModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModule() {
|
private void setModule() {
|
||||||
this.notifyDataSetChanged();
|
this.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class ModDetailAssignmentFragment extends Fragment implements Download.On
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Download getDownload() {
|
private Download getDownload() {
|
||||||
if (download == null)
|
if (download == null)
|
||||||
download = new Download(this::getContext, () -> (MainActivity) getActivity());
|
download = new Download(this::getContext, () -> (MainActivity) getActivity());
|
||||||
return download;
|
return download;
|
||||||
|
|||||||
@@ -18,12 +18,10 @@ import de.sebse.fuplanner.services.KVV.types.Event;
|
|||||||
import de.sebse.fuplanner.services.KVV.types.EventList;
|
import de.sebse.fuplanner.services.KVV.types.EventList;
|
||||||
import de.sebse.fuplanner.services.KVV.types.GroupedEvents;
|
import de.sebse.fuplanner.services.KVV.types.GroupedEvents;
|
||||||
import de.sebse.fuplanner.services.KVV.types.Modules;
|
import de.sebse.fuplanner.services.KVV.types.Modules;
|
||||||
import de.sebse.fuplanner.tools.Triplet;
|
|
||||||
import de.sebse.fuplanner.tools.UtilsDate;
|
import de.sebse.fuplanner.tools.UtilsDate;
|
||||||
import de.sebse.fuplanner.tools.logging.Logger;
|
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.ListViewHolder;
|
|
||||||
import de.sebse.fuplanner.tools.ui.StringViewHolder;
|
import de.sebse.fuplanner.tools.ui.StringViewHolder;
|
||||||
|
|
||||||
class ModDetailEventAdapter extends RecyclerView.Adapter<CustomViewHolder> {
|
class ModDetailEventAdapter extends RecyclerView.Adapter<CustomViewHolder> {
|
||||||
@@ -56,7 +54,7 @@ class ModDetailEventAdapter extends RecyclerView.Adapter<CustomViewHolder> {
|
|||||||
this.setModule();
|
this.setModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModule() {
|
private void setModule() {
|
||||||
LinkedHashMap<String, GroupedEvents> listsGrouped = new LinkedHashMap<>();
|
LinkedHashMap<String, GroupedEvents> listsGrouped = new LinkedHashMap<>();
|
||||||
LinkedHashMap<String, EventList> listsUngrouped = new LinkedHashMap<>();
|
LinkedHashMap<String, EventList> listsUngrouped = new LinkedHashMap<>();
|
||||||
for (String value : VALUES_GROUPED) listsGrouped.put(value, new GroupedEvents());
|
for (String value : VALUES_GROUPED) listsGrouped.put(value, new GroupedEvents());
|
||||||
|
|||||||
@@ -36,20 +36,16 @@ class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
this.setModule();
|
this.setModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModule() {
|
private void setModule() {
|
||||||
mPositionalData.clear();
|
mPositionalData.clear();
|
||||||
mPositionalData.add(new Pair<>(TYPE_TOTAL, SECTION_GRADE));
|
mPositionalData.add(new Pair<>(TYPE_TOTAL, SECTION_GRADE));
|
||||||
addPositionalListData(getGradesCount(), SECTION_GRADE);
|
for (int i = 0; i < getGradesCount(); i++) {
|
||||||
|
mPositionalData.add(new Pair<>(TYPE_GRADE, SECTION_GRADE +1024*i));
|
||||||
|
}
|
||||||
|
|
||||||
this.notifyDataSetChanged();
|
this.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPositionalListData(int count, int category) {
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
mPositionalData.add(new Pair<>(TYPE_GRADE, category+1024*i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
@@ -131,6 +127,7 @@ class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
|||||||
mGradeMax = view.findViewById(R.id.grade_max);
|
mGradeMax = view.findViewById(R.id.grade_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " '" + mTitle.getText() + " '" + mGrade.getText() + " '" + mGradeMax.getText() + "'";
|
return super.toString() + " '" + mTitle.getText() + " '" + mGrade.getText() + " '" + mGradeMax.getText() + "'";
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class ModDetailOverviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||||||
this.setModule();
|
this.setModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModule() {
|
private void setModule() {
|
||||||
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));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ModDetailResourceAdapter extends TreeViewAdapter {
|
|||||||
this.setModule();
|
this.setModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModule() {
|
private void setModule() {
|
||||||
if (mValue == null || mValue.resources == null) {
|
if (mValue == null || mValue.resources == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class ModDetailResourceFragment extends Fragment {
|
|||||||
}, forceRefresh);
|
}, forceRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Download getDownload() {
|
private Download getDownload() {
|
||||||
if (download == null)
|
if (download == null)
|
||||||
download = new Download(this::getContext, () -> (MainActivity) getActivity());
|
download = new Download(this::getContext, () -> (MainActivity) getActivity());
|
||||||
return download;
|
return download;
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ public class Canteen implements Serializable, Iterable<Day> {
|
|||||||
return lng;
|
return lng;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id+": "+name+"\n"+list.toString()+"\n";
|
return id+": "+name+"\n"+list.toString()+"\n";
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class Canteens implements Serializable, Iterable<Canteen> {
|
|||||||
context.deleteFile(FILE_NAME);
|
context.deleteFile(FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.list.toString();
|
return this.list.toString();
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class Day implements Serializable, Iterable<Meal> {
|
|||||||
return canteenId;
|
return canteenId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Canteen.calendarToKey(getCalendar())+"\n"+this.list+"\n";
|
return Canteen.calendarToKey(getCalendar())+"\n"+this.list+"\n";
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class Meal implements Serializable {
|
public class Meal implements Serializable {
|
||||||
private static final int LIGHT_NONE = 0;
|
private static final int LIGHT_NONE = 0;
|
||||||
private static final int LIGHT_GREEN = 1;
|
private static final int LIGHT_GREEN = 1;
|
||||||
@@ -112,6 +114,7 @@ public class Meal implements Serializable {
|
|||||||
return certificates;
|
return certificates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name + " (" + category + ")";
|
return name + " (" + category + ")";
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package de.sebse.fuplanner.services.KVV;
|
package de.sebse.fuplanner.services.KVV;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Pair;
|
|
||||||
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -11,9 +10,6 @@ import org.json.JSONObject;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -26,11 +22,11 @@ import de.sebse.fuplanner.tools.network.NetworkError;
|
|||||||
import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
||||||
|
|
||||||
public class Login extends HTTPService {
|
public class Login extends HTTPService {
|
||||||
private KVVListener mListener;
|
private final KVVListener mListener;
|
||||||
@Nullable private LoginToken mToken;
|
@Nullable private LoginToken mToken;
|
||||||
private boolean mLoginPending = false;
|
private boolean mLoginPending = false;
|
||||||
private boolean mOnlineMode = false;
|
private boolean mOnlineMode = false;
|
||||||
private NetworkCallbackCollector<LoginToken> mRefreshCallbacks = new NetworkCallbackCollector<>();
|
private final NetworkCallbackCollector<LoginToken> mRefreshCallbacks = new NetworkCallbackCollector<>();
|
||||||
|
|
||||||
Login(KVVListener listener, Context context) {
|
Login(KVVListener listener, Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -156,14 +152,13 @@ public class Login extends HTTPService {
|
|||||||
|
|
||||||
void refreshLogin(NetworkCallback<LoginToken> success, NetworkErrorCallback error) {
|
void refreshLogin(NetworkCallback<LoginToken> success, NetworkErrorCallback error) {
|
||||||
boolean isFirst = mRefreshCallbacks.isEmpty();
|
boolean isFirst = mRefreshCallbacks.isEmpty();
|
||||||
log.d("refresh", mRefreshCallbacks.size(), isFirst);
|
|
||||||
mRefreshCallbacks.add(success, error);
|
mRefreshCallbacks.add(success, error);
|
||||||
if (!isFirst)
|
if (!isFirst)
|
||||||
return;
|
return;
|
||||||
mListener.getCredentials(credentials -> {
|
mListener.getCredentials(credentials -> {
|
||||||
doOnlineLogin(credentials.getUsername(), credentials.getPassword(),
|
doOnlineLogin(credentials.getUsername(), credentials.getPassword(),
|
||||||
success1 -> mRefreshCallbacks.responseResponse(success1),
|
mRefreshCallbacks::responseResponse,
|
||||||
error1 -> mRefreshCallbacks.responseError(error1));
|
mRefreshCallbacks::responseError);
|
||||||
}, e -> {
|
}, e -> {
|
||||||
logout(false);
|
logout(false);
|
||||||
mRefreshCallbacks.responseError(e);
|
mRefreshCallbacks.responseError(e);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class Modules {
|
|||||||
private final HashMap<String, Part> mAddons = new HashMap<>();
|
private final HashMap<String, Part> mAddons = new HashMap<>();
|
||||||
private ModulesList mList = null;
|
private ModulesList mList = null;
|
||||||
private final Login mLogin;
|
private final Login mLogin;
|
||||||
private KVVListener mListener;
|
private final KVVListener mListener;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
|
||||||
Modules(Login login, KVVListener listener, Context context) {
|
Modules(Login login, KVVListener listener, Context context) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ModulesList extends HTTPService {
|
|||||||
private final Login mLogin;
|
private final Login mLogin;
|
||||||
private final KVVListener mListener;
|
private final KVVListener mListener;
|
||||||
@Nullable private Modules mModules;
|
@Nullable private Modules mModules;
|
||||||
private NewAsyncQueue mQueue = new NewAsyncQueue();
|
private final NewAsyncQueue mQueue = new NewAsyncQueue();
|
||||||
|
|
||||||
ModulesList(Login login, KVVListener listener, Context context) {
|
ModulesList(Login login, KVVListener listener, Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -51,7 +51,7 @@ public class ModulesList extends HTTPService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void find(String moduleID, NetworkCallback<Modules.Module> moduleNetworkCallback, NetworkErrorCallback errorCallback, int retries) {
|
private void find(String moduleID, NetworkCallback<Modules.Module> moduleNetworkCallback, NetworkErrorCallback errorCallback, int retries) {
|
||||||
if (mModules != null && mLogin.getLoginToken() != null && !mLogin.getLoginToken().isSameUser(mModules.getUsername()))
|
if (mModules != null && mLogin.getLoginToken() != null && mLogin.getLoginToken().isOtherUser(mModules.getUsername()))
|
||||||
delete();
|
delete();
|
||||||
if (retries < 0) {
|
if (retries < 0) {
|
||||||
errorCallback.onError(new NetworkError(101107, -1, "Too many retries!"));
|
errorCallback.onError(new NetworkError(101107, -1, "Too many retries!"));
|
||||||
@@ -104,7 +104,7 @@ public class ModulesList extends HTTPService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void recv(final NetworkCallback<Modules> callback, final NetworkErrorCallback errorCallback, boolean forceRefresh, final int retries) {
|
private void recv(final NetworkCallback<Modules> callback, final NetworkErrorCallback errorCallback, boolean forceRefresh, final int retries) {
|
||||||
if (mModules != null && mLogin.getLoginToken() != null && !mLogin.getLoginToken().isSameUser(mModules.getUsername()))
|
if (mModules != null && mLogin.getLoginToken() != null && mLogin.getLoginToken().isOtherUser(mModules.getUsername()))
|
||||||
delete();
|
delete();
|
||||||
mQueue.add(() -> {
|
mQueue.add(() -> {
|
||||||
if (this.mModules != null && !forceRefresh) {
|
if (this.mModules != null && !forceRefresh) {
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class ModulesResources extends PartModules<ArrayList<Resource>> {
|
|||||||
file(filename, url, modulename, callback, errorCallback, forceRefresh, RETRY_COUNT);
|
file(filename, url, modulename, callback, errorCallback, forceRefresh, RETRY_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void file(final String filename, final String url, final String modulename, final NetworkCallback<String> callback, final NetworkErrorCallback errorCallback, boolean forceRefresh, int retries) {
|
private void file(final String filename, final String url, final String modulename, final NetworkCallback<String> callback, final NetworkErrorCallback errorCallback, boolean forceRefresh, int retries) {
|
||||||
if (isExternalStorageReadable()){
|
if (isExternalStorageReadable()){
|
||||||
File f = new File(Environment.getExternalStoragePublicDirectory(
|
File f = new File(Environment.getExternalStoragePublicDirectory(
|
||||||
Environment.DIRECTORY_DOWNLOADS)+"/"+modulename+"/"+filename);
|
Environment.DIRECTORY_DOWNLOADS)+"/"+modulename+"/"+filename);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
|||||||
|
|
||||||
public abstract class Part<T> extends HTTPService {
|
public abstract class Part<T> extends HTTPService {
|
||||||
static final int RETRY_COUNT = 1;
|
static final int RETRY_COUNT = 1;
|
||||||
protected final Login mLogin;
|
final Login mLogin;
|
||||||
protected final ModulesList mList;
|
final ModulesList mList;
|
||||||
|
|
||||||
Part(Login login, ModulesList list, Context context) {
|
Part(Login login, ModulesList list, Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import de.sebse.fuplanner.tools.network.NetworkCallback;
|
|||||||
import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
||||||
|
|
||||||
abstract class PartModules<T> extends Part<Modules.Module> {
|
abstract class PartModules<T> extends Part<Modules.Module> {
|
||||||
private NewAsyncQueue mQueue = new NewAsyncQueue();
|
private final NewAsyncQueue mQueue = new NewAsyncQueue();
|
||||||
|
|
||||||
PartModules(Login login, ModulesList list, Context context) {
|
PartModules(Login login, ModulesList list, Context context) {
|
||||||
super(login, list, context);
|
super(login, list, context);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.google.android.gms.common.internal.Objects;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class Announcement implements Serializable {
|
public class Announcement implements Serializable {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String title;
|
private final String title;
|
||||||
@@ -47,6 +49,7 @@ public class Announcement implements Serializable {
|
|||||||
return createdOn;
|
return createdOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ID: "+getId()+
|
return "ID: "+getId()+
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.google.android.gms.common.internal.Objects;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class Assignment implements Serializable {
|
public class Assignment implements Serializable {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String title;
|
private final String title;
|
||||||
@@ -44,6 +46,7 @@ public class Assignment implements Serializable {
|
|||||||
return instructions;
|
return instructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ID: "+getId()+
|
return "ID: "+getId()+
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.tools.ColorRGB;
|
import de.sebse.fuplanner.tools.ColorRGB;
|
||||||
|
|
||||||
public class Event implements Serializable {
|
public class Event implements Serializable {
|
||||||
@@ -106,6 +107,7 @@ public class Event implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ID: "+getId()+
|
return "ID: "+getId()+
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.google.android.gms.common.internal.Objects;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class Grade implements Serializable {
|
public class Grade implements Serializable {
|
||||||
private final String itemName;
|
private final String itemName;
|
||||||
private final double grade;
|
private final double grade;
|
||||||
@@ -27,6 +29,7 @@ public class Grade implements Serializable {
|
|||||||
return itemName;
|
return itemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Name: "+getItemName()+
|
return "Name: "+getItemName()+
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.tools.logging.Logger;
|
|
||||||
|
|
||||||
public class GroupedEvents extends EventList {
|
public class GroupedEvents extends EventList {
|
||||||
private ArrayList<Group> arrayList = new ArrayList<>();
|
private final ArrayList<Group> arrayList = new ArrayList<>();
|
||||||
private int skippedDayCount = 0;
|
private int skippedDayCount = 0;
|
||||||
|
|
||||||
public boolean add(Event event) {
|
public boolean add(Event event) {
|
||||||
@@ -40,11 +39,11 @@ public class GroupedEvents extends EventList {
|
|||||||
public class Group {
|
public class Group {
|
||||||
private long firstDate;
|
private long firstDate;
|
||||||
private long lastDate;
|
private long lastDate;
|
||||||
private ArrayList<Long> skippedDates;
|
private final ArrayList<Long> skippedDates;
|
||||||
|
|
||||||
private int dayOfWeek;
|
private final int dayOfWeek;
|
||||||
private long startTime;
|
private final long startTime;
|
||||||
private long duration;
|
private final long duration;
|
||||||
|
|
||||||
private Group(Event event) {
|
private Group(Event event) {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import java.io.Serializable;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
public class Lecturer implements Serializable {
|
public class Lecturer implements Serializable {
|
||||||
private final String firstName;
|
private final String firstName;
|
||||||
private final String surname;
|
private final String surname;
|
||||||
@@ -46,6 +48,7 @@ public class Lecturer implements Serializable {
|
|||||||
return getFirstName().substring(0, 1) + ". " + getSurname();
|
return getFirstName().substring(0, 1) + ". " + getSurname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "First name: "+ getFirstName()+
|
return "First name: "+ getFirstName()+
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.io.ObjectOutputStream;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,10 +86,12 @@ public class LoginToken implements Serializable {
|
|||||||
return JSESSIONID;
|
return JSESSIONID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String getFullName() {
|
public String getFullName() {
|
||||||
return fullName;
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
@@ -101,10 +104,11 @@ public class LoginToken implements Serializable {
|
|||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSameUser(String username) {
|
public boolean isOtherUser(String username) {
|
||||||
return this.getUsername().equals(username);
|
return !this.getUsername().equals(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import androidx.annotation.LayoutRes;
|
import androidx.annotation.LayoutRes;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
import de.sebse.fuplanner.tools.ui.treeview.LayoutItemType;
|
import de.sebse.fuplanner.tools.ui.treeview.LayoutItemType;
|
||||||
import de.sebse.fuplanner.tools.ui.treeview.TreeNode;
|
import de.sebse.fuplanner.tools.ui.treeview.TreeNode;
|
||||||
@@ -69,6 +70,7 @@ public abstract class Resource implements Serializable {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Resource{" +
|
return "Resource{" +
|
||||||
@@ -111,6 +113,7 @@ public abstract class Resource implements Serializable {
|
|||||||
return children.size();
|
return children.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Resource{" +
|
return "Resource{" +
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class Download {
|
|||||||
private final ContextInterface contextInterface;
|
private final ContextInterface contextInterface;
|
||||||
private final ActivityInterface activityInterface;
|
private final ActivityInterface activityInterface;
|
||||||
private RequestedDownload requestedDownload;
|
private RequestedDownload requestedDownload;
|
||||||
private Logger log = new Logger(this);
|
private final Logger log = new Logger(this);
|
||||||
|
|
||||||
|
|
||||||
public Download(ContextInterface contextInterface, ActivityInterface activityInterface) {
|
public Download(ContextInterface contextInterface, ActivityInterface activityInterface) {
|
||||||
@@ -106,7 +106,7 @@ public class Download {
|
|||||||
}
|
}
|
||||||
activity.getKVV().modules().resources().file(file.getTitle(), file.getUrl(), folderName, success -> {
|
activity.getKVV().modules().resources().file(file.getTitle(), file.getUrl(), folderName, success -> {
|
||||||
Context context = contextInterface.get();
|
Context context = contextInterface.get();
|
||||||
if (success.equals("")) {
|
if (success.equals("") || context== null) {
|
||||||
showDownloadError();
|
showDownloadError();
|
||||||
} else {
|
} else {
|
||||||
if (Regex.has("^http", success)){
|
if (Regex.has("^http", success)){
|
||||||
@@ -116,7 +116,6 @@ public class Download {
|
|||||||
else {
|
else {
|
||||||
fileOpen(new File(success));
|
fileOpen(new File(success));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}, log::e, downloadNew);
|
}, log::e, downloadNew);
|
||||||
}
|
}
|
||||||
@@ -165,9 +164,9 @@ public class Download {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class RequestedDownload {
|
private class RequestedDownload {
|
||||||
Resource.File file;
|
final Resource.File file;
|
||||||
String folderName;
|
final String folderName;
|
||||||
boolean downloadNew;
|
final boolean downloadNew;
|
||||||
|
|
||||||
RequestedDownload(Resource.File file, String folderName, boolean downloadNew) {
|
RequestedDownload(Resource.File file, String folderName, boolean downloadNew) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
@@ -187,7 +186,10 @@ public class Download {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fileOpen(File url){
|
private void fileOpen(File url){
|
||||||
Uri uri = FileProvider.getUriForFile(contextInterface.get(), contextInterface.get().getApplicationContext().getPackageName() + ".my.provider", url);
|
Context context = contextInterface.get();
|
||||||
|
if (context == null)
|
||||||
|
return;
|
||||||
|
Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".my.provider", url);
|
||||||
|
|
||||||
Intent intent;
|
Intent intent;
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||||
@@ -242,7 +244,7 @@ public class Download {
|
|||||||
intent.setDataAndType(uri, "*/*");
|
intent.setDataAndType(uri, "*/*");
|
||||||
}
|
}
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
contextInterface.get().startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package de.sebse.fuplanner.tools;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class EventListener<T> {
|
public class EventListener<T> {
|
||||||
private HashMap<String, EventFunction<T>> list = new HashMap<>();
|
private final HashMap<String, EventFunction<T>> list = new HashMap<>();
|
||||||
|
|
||||||
public void add(String id,EventFunction<T> listener) {
|
public void add(String id,EventFunction<T> listener) {
|
||||||
list.put(id, listener);
|
list.put(id, listener);
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public abstract class SortedList<T, I, F> implements Iterable<T>, Serializable {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.internalList.toString();
|
return this.internalList.toString();
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package de.sebse.fuplanner.tools;
|
|
||||||
|
|
||||||
public class Triplet<T, U, V> {
|
|
||||||
|
|
||||||
public final T first;
|
|
||||||
public final U second;
|
|
||||||
public final V third;
|
|
||||||
|
|
||||||
public Triplet(T first, U second, V third) {
|
|
||||||
this.first = first;
|
|
||||||
this.second = second;
|
|
||||||
this.third = third;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,9 +27,9 @@ import de.sebse.fuplanner.tools.logging.Logger;
|
|||||||
public class HTTPService {
|
public class HTTPService {
|
||||||
private final RequestQueue requestQueue;
|
private final RequestQueue requestQueue;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
protected Logger log = new Logger(this);
|
protected final Logger log = new Logger(this);
|
||||||
private EventListener<VolleyError> errorResponseListener = new EventListener<>();
|
private final EventListener<VolleyError> errorResponseListener = new EventListener<>();
|
||||||
private EventListener<Result> successResponseListener = new EventListener<>();
|
private final EventListener<Result> successResponseListener = new EventListener<>();
|
||||||
|
|
||||||
protected HTTPService(Context context) {
|
protected HTTPService(Context context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package de.sebse.fuplanner.tools.network;
|
package de.sebse.fuplanner.tools.network;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by sebastian on 24.10.17.
|
* Created by sebastian on 24.10.17.
|
||||||
*/
|
*/
|
||||||
@@ -27,6 +29,7 @@ public class NetworkError {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.valueOf(getCode()) + " - " + getHttpStatus() + " - " + getMessage();
|
return String.valueOf(getCode()) + " - " + getHttpStatus() + " - " + getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.cunoraz.tagview.TagView;
|
import com.cunoraz.tagview.TagView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
|
|
||||||
public class AnnouncementViewHolder extends ExpandableCardViewHolder {
|
public class AnnouncementViewHolder extends ExpandableCardViewHolder {
|
||||||
@@ -25,6 +26,7 @@ public class AnnouncementViewHolder extends ExpandableCardViewHolder {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " '" + mTitle.getText() + "' '" + mSubTitle.getText() + "'";
|
return super.toString() + " '" + mTitle.getText() + "' '" + mSubTitle.getText() + "'";
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package de.sebse.fuplanner.tools.ui;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
|
|
||||||
public class ItemViewHolder extends CustomViewHolder {
|
public class ItemViewHolder extends CustomViewHolder {
|
||||||
@@ -19,6 +20,7 @@ public class ItemViewHolder extends CustomViewHolder {
|
|||||||
mTopRight = view.findViewById(R.id.top_right);
|
mTopRight = view.findViewById(R.id.top_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " '" + mTitle.getText() + "' '" + mSubLeft.getText() + "' '" + mSubRight.getText() + "' '" + mTopRight.getText() + "'";
|
return super.toString() + " '" + mTitle.getText() + "' '" + mSubLeft.getText() + "' '" + mSubRight.getText() + "' '" + mTopRight.getText() + "'";
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package de.sebse.fuplanner.tools.ui;
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import de.sebse.fuplanner.R;
|
|
||||||
|
|
||||||
public class ListViewHolder extends StringViewHolder {
|
|
||||||
public final RecyclerView mList;
|
|
||||||
|
|
||||||
public ListViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
mList = view.findViewById(R.id.list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return super.toString() + " '" + mString.getText() + "'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ import android.view.View;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
|
|
||||||
public class MailViewHolder extends StringViewHolder {
|
public class MailViewHolder extends StringViewHolder {
|
||||||
@@ -19,6 +19,7 @@ public class MailViewHolder extends StringViewHolder {
|
|||||||
mIcon = view.findViewById(R.id.icon);
|
mIcon = view.findViewById(R.id.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " '" + mTitle.getText() + "' '" + mSubLeft.getText() + "'";
|
return super.toString() + " '" + mTitle.getText() + "' '" + mSubLeft.getText() + "'";
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.view.View;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
|
|
||||||
public class MealViewHolder extends ExpandableCardViewHolder {
|
public class MealViewHolder extends ExpandableCardViewHolder {
|
||||||
@@ -30,6 +31,7 @@ public class MealViewHolder extends ExpandableCardViewHolder {
|
|||||||
mIconMsc = innerView.findViewById(R.id.icon_msc);
|
mIconMsc = innerView.findViewById(R.id.icon_msc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " '" + mTitle.getText() + "' '" + mSubTitle.getText() + "'";
|
return super.toString() + " '" + mTitle.getText() + "' '" + mSubTitle.getText() + "'";
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package de.sebse.fuplanner.tools.ui;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
|
|
||||||
public class StringViewHolder extends CustomViewHolder {
|
public class StringViewHolder extends CustomViewHolder {
|
||||||
@@ -13,6 +14,7 @@ public class StringViewHolder extends CustomViewHolder {
|
|||||||
mString = view.findViewById(R.id.string);
|
mString = view.findViewById(R.id.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " '" + mString.getText() + "'";
|
return super.toString() + " '" + mString.getText() + "'";
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ public class ExpandableCardView extends CardView {
|
|||||||
|
|
||||||
private OnExpandedListener listener;
|
private OnExpandedListener listener;
|
||||||
|
|
||||||
private OnClickListener defaultClickListener = v -> {
|
private final OnClickListener defaultClickListener = v -> {
|
||||||
if(isExpanded()) collapse();
|
if(isExpanded()) collapse();
|
||||||
else expand();
|
else expand();
|
||||||
};
|
};
|
||||||
private Logger log = new Logger(this);
|
private final Logger log = new Logger(this);
|
||||||
|
|
||||||
public ExpandableCardView(Context context) {
|
public ExpandableCardView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public class DirectoryNodeBinder extends TreeViewBinder<DirectoryNodeBinder.View
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class ViewHolder extends TreeViewBinder.ViewHolder {
|
public static class ViewHolder extends TreeViewBinder.ViewHolder {
|
||||||
private ImageView ivArrow;
|
private final ImageView ivArrow;
|
||||||
private TextView tvName;
|
private final TextView tvName;
|
||||||
|
|
||||||
ViewHolder(View rootView) {
|
ViewHolder(View rootView) {
|
||||||
super(rootView);
|
super(rootView);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class FileNodeBinder extends TreeViewBinder<FileNodeBinder.ViewHolder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ViewHolder extends TreeViewBinder.ViewHolder {
|
public class ViewHolder extends TreeViewBinder.ViewHolder {
|
||||||
TextView tvName;
|
final TextView tvName;
|
||||||
|
|
||||||
ViewHolder(View rootView) {
|
ViewHolder(View rootView) {
|
||||||
super(rootView);
|
super(rootView);
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
|||||||
return isLocked;
|
return isLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TreeNode{" +
|
return "TreeNode{" +
|
||||||
@@ -138,6 +139,8 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
|||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
|
||||||
@Override
|
@Override
|
||||||
protected TreeNode<T> clone() {
|
protected TreeNode<T> clone() {
|
||||||
TreeNode<T> clone = new TreeNode<>(this.content);
|
TreeNode<T> clone = new TreeNode<>(this.content);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private static final String KEY_IS_EXPAND = "IS_EXPAND";
|
private static final String KEY_IS_EXPAND = "IS_EXPAND";
|
||||||
private final List<? extends TreeViewBinder> viewBinders;
|
private final List<? extends TreeViewBinder> viewBinders;
|
||||||
private List<TreeNode> displayNodes;
|
private final List<TreeNode> displayNodes;
|
||||||
private int padding = 30;
|
private int padding = 30;
|
||||||
private OnTreeNodeListener onTreeNodeListener;
|
private OnTreeNodeListener onTreeNodeListener;
|
||||||
private boolean toCollapseChild;
|
private boolean toCollapseChild;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class WeekView extends View {
|
|||||||
private float mHeaderHeight;
|
private float mHeaderHeight;
|
||||||
private GestureDetectorCompat mGestureDetector;
|
private GestureDetectorCompat mGestureDetector;
|
||||||
private OverScroller mScroller;
|
private OverScroller mScroller;
|
||||||
private PointF mCurrentOrigin = new PointF(0f, 0f);
|
private final PointF mCurrentOrigin = new PointF(0f, 0f);
|
||||||
private Direction mCurrentScrollDirection = Direction.NONE;
|
private Direction mCurrentScrollDirection = Direction.NONE;
|
||||||
private Paint mHeaderBackgroundPaint;
|
private Paint mHeaderBackgroundPaint;
|
||||||
private float mWidthPerDay;
|
private float mWidthPerDay;
|
||||||
@@ -1259,8 +1259,8 @@ public class WeekView extends View {
|
|||||||
* instance will be stored in "event".
|
* instance will be stored in "event".
|
||||||
*/
|
*/
|
||||||
private class EventRect {
|
private class EventRect {
|
||||||
public WeekViewEvent event;
|
public final WeekViewEvent event;
|
||||||
WeekViewEvent originalEvent;
|
final WeekViewEvent originalEvent;
|
||||||
RectF rectF;
|
RectF rectF;
|
||||||
public float left;
|
public float left;
|
||||||
public float width;
|
public float width;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/app_bar_layout"
|
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/swipe_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
<ExpandableListView
|
|
||||||
android:id="@+id/list"
|
|
||||||
android:name=".fragments.moddetails.ModDetailAnnounceFragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
tools:context=".fragments.moddetails.ModDetailAnnounceFragment"
|
|
||||||
tools:listitem="@layout/list_all_caption" />
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/colorFUGreen"
|
android:background="@color/colorFUGreen"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context="de.sebse.fuplanner.fragments.StartupFragment">
|
tools:context="de.sebse.fuplanner.fragments.StartupFragment"
|
||||||
|
tools:ignore="Overdraw">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="@android:dimen/thumbnail_width"
|
android:layout_width="@android:dimen/thumbnail_width"
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:ignore="UseCompoundDrawables">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_arrow"
|
android:id="@+id/iv_arrow"
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_margin="4dp">
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/string"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="@dimen/text_margin"
|
|
||||||
tools:text="Caption"
|
|
||||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Headline" />
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
|
||||||
android:id="@+id/list"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/caption"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/text_margin"
|
android:layout_margin="@dimen/text_margin"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/caption"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/text_margin"
|
android:layout_margin="@dimen/text_margin"
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="5dip" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/string"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:typeface="sans"
|
|
||||||
tools:text="Test this new stuff!" />
|
|
||||||
</RelativeLayout>
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<de.sebse.fuplanner.tools.ui.cardview.ExpandableCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<de.sebse.fuplanner.tools.ui.cardview.ExpandableCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/profile"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="4dp"
|
android:layout_margin="4dp"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<de.sebse.fuplanner.tools.ui.cardview.ExpandableCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<de.sebse.fuplanner.tools.ui.cardview.ExpandableCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/profile"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="4dp"
|
android:layout_margin="4dp"
|
||||||
|
|||||||
@@ -21,13 +21,11 @@
|
|||||||
<string name="assignments_count">Aufgaben (%1$d)</string>
|
<string name="assignments_count">Aufgaben (%1$d)</string>
|
||||||
<string name="assignments">Aufgaben</string>
|
<string name="assignments">Aufgaben</string>
|
||||||
<string name="upcoming_events_count">Nächste Veranstaltungen (%1$d)</string>
|
<string name="upcoming_events_count">Nächste Veranstaltungen (%1$d)</string>
|
||||||
<string name="upcoming_events">Nächste Veranstaltungen</string>
|
|
||||||
<string name="date_scale">%1$s - %2$s</string>
|
<string name="date_scale">%1$s - %2$s</string>
|
||||||
<string name="open">Offen</string>
|
<string name="open">Offen</string>
|
||||||
<string name="closed">Geschlossen</string>
|
<string name="closed">Geschlossen</string>
|
||||||
<string name="enter_offline_mode">Starte Offline-Modus (%1$s)</string>
|
<string name="enter_offline_mode">Starte Offline-Modus (%1$s)</string>
|
||||||
<string name="no_items_available">Keine Einträge vorhanden!</string>
|
<string name="no_items_available">Keine Einträge vorhanden!</string>
|
||||||
<string name="past_events">Vergangene Veranstaltungen</string>
|
|
||||||
<string name="events">Veranstaltungen</string>
|
<string name="events">Veranstaltungen</string>
|
||||||
<string name="gradebook">Noten</string>
|
<string name="gradebook">Noten</string>
|
||||||
<string name="current_percentage">Aktuelle Prozentzahl: %1$.2f \%%</string>
|
<string name="current_percentage">Aktuelle Prozentzahl: %1$.2f \%%</string>
|
||||||
@@ -74,7 +72,6 @@
|
|||||||
<string name="lecture">Vorlesung</string>
|
<string name="lecture">Vorlesung</string>
|
||||||
<string name="tutorial">Tutorium</string>
|
<string name="tutorial">Tutorium</string>
|
||||||
<string name="exam">Klausur</string>
|
<string name="exam">Klausur</string>
|
||||||
<string name="other">Andere</string>
|
|
||||||
<string name="deadline">Abgabe</string>
|
<string name="deadline">Abgabe</string>
|
||||||
<string name="winter_semester">Wintersemester %1$d/%2$d</string>
|
<string name="winter_semester">Wintersemester %1$d/%2$d</string>
|
||||||
<string name="summer_semester">Sommersemester %1$d</string>
|
<string name="summer_semester">Sommersemester %1$d</string>
|
||||||
|
|||||||
@@ -7,6 +7,4 @@
|
|||||||
<dimen name="text_margin">16dp</dimen>
|
<dimen name="text_margin">16dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
<dimen name="default_card_height">50dp</dimen>
|
|
||||||
<dimen name="default_vertical_padding">10dp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -22,14 +22,12 @@
|
|||||||
<string name="assignments_count">Assignments (%1$d)</string>
|
<string name="assignments_count">Assignments (%1$d)</string>
|
||||||
<string name="assignments">Assignments</string>
|
<string name="assignments">Assignments</string>
|
||||||
<string name="upcoming_events_count">Upcoming Events (%1$d)</string>
|
<string name="upcoming_events_count">Upcoming Events (%1$d)</string>
|
||||||
<string name="upcoming_events">Upcoming Events</string>
|
|
||||||
<string name="date_scale">%1$s - %2$s</string>
|
<string name="date_scale">%1$s - %2$s</string>
|
||||||
<string name="open">Open</string>
|
<string name="open">Open</string>
|
||||||
<string name="closed">Closed</string>
|
<string name="closed">Closed</string>
|
||||||
<string name="hello_blank_fragment" translatable="false" tools:keep="@string/hello_blank_fragment">Hello blank fragment</string>
|
<string name="hello_blank_fragment" translatable="false" tools:keep="@string/hello_blank_fragment">Hello blank fragment</string>
|
||||||
<string name="enter_offline_mode">Enter Offline Mode (%1$s)</string>
|
<string name="enter_offline_mode">Enter Offline Mode (%1$s)</string>
|
||||||
<string name="no_items_available">No items available!</string>
|
<string name="no_items_available">No items available!</string>
|
||||||
<string name="past_events">Past Events</string>
|
|
||||||
<string name="events">Events</string>
|
<string name="events">Events</string>
|
||||||
<string name="gradebook">Gradebook</string>
|
<string name="gradebook">Gradebook</string>
|
||||||
<string name="current_percentage">Current Percentage: %1$.2f \%%</string>
|
<string name="current_percentage">Current Percentage: %1$.2f \%%</string>
|
||||||
@@ -82,7 +80,6 @@
|
|||||||
<string name="lecture">Lecture</string>
|
<string name="lecture">Lecture</string>
|
||||||
<string name="tutorial">Tutorial</string>
|
<string name="tutorial">Tutorial</string>
|
||||||
<string name="exam">Exam</string>
|
<string name="exam">Exam</string>
|
||||||
<string name="other">Other</string>
|
|
||||||
<string name="deadline">Deadline</string>
|
<string name="deadline">Deadline</string>
|
||||||
<string name="winter_semester">Winter Semester %1$d/%2$d</string>
|
<string name="winter_semester">Winter Semester %1$d/%2$d</string>
|
||||||
<string name="summer_semester">Summer Semester %1$d</string>
|
<string name="summer_semester">Summer Semester %1$d</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user