Code clean up

This commit is contained in:
Caesar2011
2019-02-03 19:56:51 +01:00
parent 593fb78ef2
commit 79f76ccefa
12 changed files with 9 additions and 35 deletions

View File

@@ -94,8 +94,6 @@ public class ModulesEvents extends PartModules<EventList> {
return; return;
} }
this.mList.find(ID, module -> { this.mList.find(ID, module -> {
log.d(module.lvNumber.size(), module.lvNumber);
log.d(module.lvNumber.iterator().next());
super.head(String.format("https://www.fu-berlin.de/vv/de/search?utf8=✓&query=%s", module.lvNumber.iterator().next()), null, response -> { super.head(String.format("https://www.fu-berlin.de/vv/de/search?utf8=✓&query=%s", module.lvNumber.iterator().next()), null, response -> {
String location = response.getHeaders().get("Location"); String location = response.getHeaders().get("Location");
if (location == null) { if (location == null) {
@@ -114,7 +112,6 @@ public class ModulesEvents extends PartModules<EventList> {
} }
super.get(String.format("https://www.fu-berlin.de/vv/de/lv/%s", group), null, response1 -> { super.get(String.format("https://www.fu-berlin.de/vv/de/lv/%s", group), null, response1 -> {
String body = response1.getParsed(); String body = response1.getParsed();
log.d(response1.getHeaders().get("Location"));
if (body == null) { if (body == null) {
errorCallback.onError(new NetworkError(101411, 400, "Cannot get events!")); errorCallback.onError(new NetworkError(101411, 400, "Cannot get events!"));
return; return;

View File

@@ -14,7 +14,6 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import de.sebse.fuplanner.services.kvv.types.Modules; import de.sebse.fuplanner.services.kvv.types.Modules;
import de.sebse.fuplanner.services.kvv.types.Resource; import de.sebse.fuplanner.services.kvv.types.Resource;
@@ -312,7 +311,6 @@ public class ModulesResources extends PartModules<ArrayList<Resource>> {
if (redirectUrl == null){ if (redirectUrl == null){
redirectUrl = ""; redirectUrl = "";
} }
log.d("redirectUrl", redirectUrl);
get(redirectUrl, mLogin.getLoginTokenBB().getCookies(), response1 -> { get(redirectUrl, mLogin.getLoginTokenBB().getCookies(), response1 -> {
if (response1.getHeaders().containsKey("Location")) { if (response1.getHeaders().containsKey("Location")) {
// Return redirected URL // Return redirected URL
@@ -322,7 +320,6 @@ public class ModulesResources extends PartModules<ArrayList<Resource>> {
} else { } else {
redirectUrl2 = "https://lms.fu-berlin.de" + redirectUrl2; redirectUrl2 = "https://lms.fu-berlin.de" + redirectUrl2;
} }
log.d("redirectUrl2", redirectUrl2);
get(redirectUrl2, mLogin.getLoginTokenBB().getCookies(), response2 -> { get(redirectUrl2, mLogin.getLoginTokenBB().getCookies(), response2 -> {
if (response2.getBytes() == null) { if (response2.getBytes() == null) {
errorCallback.onError(new NetworkError(101714, 400, "Cannot get file!")); errorCallback.onError(new NetworkError(101714, 400, "Cannot get file!"));

View File

@@ -134,7 +134,6 @@ public class BBLogin extends HTTPService {
private void step6(String shibsessionKey, String shibsessionName, final NetworkCallback<HashMap<String, String>> callback, final NetworkErrorCallback errorCallback) { private void step6(String shibsessionKey, String shibsessionName, final NetworkCallback<HashMap<String, String>> callback, final NetworkErrorCallback errorCallback) {
HashMap<String, String> cookies = new HashMap<>(); HashMap<String, String> cookies = new HashMap<>();
cookies.put(shibsessionKey, shibsessionName); cookies.put(shibsessionKey, shibsessionName);
log.d(shibsessionKey, shibsessionName);
get("https://lms.fu-berlin.de/webapps/bb-auth-provider-shibboleth-bb_bb60/execute/shibbolethLogin?returnUrl=https://lms.fu-berlin.de/webapps/portal/execute/defaultTab&authProviderId=_3_1", cookies, response -> { get("https://lms.fu-berlin.de/webapps/bb-auth-provider-shibboleth-bb_bb60/execute/shibbolethLogin?returnUrl=https://lms.fu-berlin.de/webapps/portal/execute/defaultTab&authProviderId=_3_1", cookies, response -> {
String cookies1 = response.getHeaders().get("Set-Cookie"); String cookies1 = response.getHeaders().get("Set-Cookie");
if (cookies1 ==null) { if (cookies1 ==null) {

View File

@@ -123,19 +123,6 @@ public class KVVSyncAdapter extends AbstractThreadedSyncAdapter {
if (oldList == null || newList == null) { if (oldList == null || newList == null) {
return; return;
} }
if (oldList instanceof ArrayList && ((ArrayList<T>) oldList).size() > 0 && ((ArrayList<T>) oldList).get(0) instanceof Resource) {
log.d("-- all --");
log.d(oldList.hashCode(), newList.hashCode());
log.d("-- old --");
for (T x: oldList) {
log.d(titleInterface.get(x), idInterface.get(x), x.hashCode(), x);
}
log.d("-- new --");
for (T x: newList) {
log.d(titleInterface.get(x), idInterface.get(x), x.hashCode(), x);
}
log.d("-- --- --");
}
ArrayList<T> obsoletes = new ArrayList<>(); ArrayList<T> obsoletes = new ArrayList<>();
for (T old: oldList) { for (T old: oldList) {
obsoletes.add(old); obsoletes.add(old);

View File

@@ -1,7 +1,5 @@
package de.sebse.fuplanner.services.kvv.types; package de.sebse.fuplanner.services.kvv.types;
import android.util.Pair;
import com.google.android.gms.common.internal.Objects; import com.google.android.gms.common.internal.Objects;
import java.io.Serializable; import java.io.Serializable;

View File

@@ -187,8 +187,6 @@ public class Download {
private void fileOpen(File url){ private void fileOpen(File url){
Context context = contextInterface.get(); Context context = contextInterface.get();
log.d("fileOpen", context);
log.d("url", url.toString());
if (context == null) if (context == null)
return; return;
Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".my.provider", url); Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".my.provider", url);

View File

@@ -8,7 +8,6 @@ import com.cunoraz.tagview.TagView;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import de.sebse.fuplanner.R; import de.sebse.fuplanner.R;
import de.sebse.fuplanner.fragments.moddetails.ModDetailAnnounceFragment;
import de.sebse.fuplanner.services.kvv.types.Resource; import de.sebse.fuplanner.services.kvv.types.Resource;
import de.sebse.fuplanner.services.kvv.ui.Download; import de.sebse.fuplanner.services.kvv.ui.Download;
import de.sebse.fuplanner.tools.UtilsDate; import de.sebse.fuplanner.tools.UtilsDate;
@@ -53,8 +52,6 @@ public class DocumentNodeBinder extends TreeViewBinder<DocumentNodeBinder.ViewHo
if (s != null) { if (s != null) {
String name = fileNode.getUrl(i).name; String name = fileNode.getUrl(i).name;
Logger log = new Logger(this); Logger log = new Logger(this);
//log.d(name);
//log.d(s);
this.requestInterface.request(name, s); this.requestInterface.request(name, s);
} }
}); });

View File

@@ -140,7 +140,7 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
} }
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException", "MethodDoesntCallSuperMethod"})
@Override @Override
protected TreeNode<T> clone() { protected TreeNode<T> clone() {
TreeNode<T> clone = new TreeNode<>(this.content); TreeNode<T> clone = new TreeNode<>(this.content);

View File

@@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import de.sebse.fuplanner.tools.logging.Logger;
/** /**
* Created by tlh on 2016/10/1 :) * Created by tlh on 2016/10/1 :)

View File

@@ -365,7 +365,7 @@ public class WeekView extends View {
} }
int nonRoundedMinutes = selectedTime.get(Calendar.MINUTE); int nonRoundedMinutes = selectedTime.get(Calendar.MINUTE);
int mod = nonRoundedMinutes % mNewEventTimeResolutionInMinutes; int mod = nonRoundedMinutes % mNewEventTimeResolutionInMinutes;
selectedTime.add(Calendar.MINUTE, mod < Math.ceil(mNewEventTimeResolutionInMinutes / 2) ? -mod : (mNewEventTimeResolutionInMinutes - mod)); selectedTime.add(Calendar.MINUTE, mod < Math.ceil(mNewEventTimeResolutionInMinutes / 2.0) ? -mod : (mNewEventTimeResolutionInMinutes - mod));
Calendar endTime = (Calendar) selectedTime.clone(); Calendar endTime = (Calendar) selectedTime.clone();
@@ -379,8 +379,8 @@ public class WeekView extends View {
WeekViewEvent newEvent = new WeekViewEvent(mNewEventIdentifier, "", null, selectedTime, endTime); WeekViewEvent newEvent = new WeekViewEvent(mNewEventIdentifier, "", null, selectedTime, endTime);
float top = mHourHeight * getPassedMinutesInDay(selectedTime) / 60 + getEventsTop(); float top = mHourHeight * getPassedMinutesInDay(selectedTime) / 60f + getEventsTop();
float bottom = mHourHeight * getPassedMinutesInDay(endTime) / 60 + getEventsTop(); float bottom = mHourHeight * getPassedMinutesInDay(endTime) / 60f + getEventsTop();
// Calculate left and right. // Calculate left and right.
float left = mWidthPerDay * daysBetween(getFirstVisibleDay(), selectedTime); float left = mWidthPerDay * daysBetween(getFirstVisibleDay(), selectedTime);
@@ -1117,7 +1117,7 @@ public class WeekView extends View {
canvas.drawRoundRect(eventRect.rectF, mEventCornerRadius, mEventCornerRadius, mEventBackgroundPaint); canvas.drawRoundRect(eventRect.rectF, mEventCornerRadius, mEventCornerRadius, mEventBackgroundPaint);
float topToUse = top; float topToUse = top;
if (eventRect.event.getStartTime().get(Calendar.HOUR_OF_DAY) < mMinTime) if (eventRect.event.getStartTime().get(Calendar.HOUR_OF_DAY) < mMinTime)
topToUse = mHourHeight * getPassedMinutesInDay(mMinTime, 0) / 60 + getEventsTop(); topToUse = mHourHeight * getPassedMinutesInDay(mMinTime, 0) / 60f + getEventsTop();
if (!mNewEventIdentifier.equals(eventRect.event.getIdentifier())) if (!mNewEventIdentifier.equals(eventRect.event.getIdentifier()))
drawEventTitle(eventRect.event, eventRect.rectF, canvas, topToUse, left); drawEventTitle(eventRect.event, eventRect.rectF, canvas, topToUse, left);

View File

@@ -21,6 +21,7 @@
android:typeface="sans" android:typeface="sans"
android:gravity="center" android:gravity="center"
android:textColor="@color/colorFUBlue" android:textColor="@color/colorFUBlue"
app:layout_constraintTop_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/guideline" app:layout_constraintRight_toLeftOf="@id/guideline"
/> />
@@ -34,6 +35,7 @@
android:typeface="sans" android:typeface="sans"
android:gravity="center" android:gravity="center"
android:textColor="@color/colorFUBlue" android:textColor="@color/colorFUBlue"
app:layout_constraintTop_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@id/guideline" app:layout_constraintLeft_toRightOf="@id/guideline"
/> />

View File

@@ -120,6 +120,6 @@
<string name="resource_updated">Resource updated: %1$s</string> <string name="resource_updated">Resource updated: %1$s</string>
<string name="resource_added">New resource: %1$s</string> <string name="resource_added">New resource: %1$s</string>
<string name="resource_removed">Resource removed: %1$s</string> <string name="resource_removed">Resource removed: %1$s</string>
<string name="network_error">A network error occured!</string> <string name="network_error">A network error occurred!</string>
<string name="network_error_parameter">A network error occured: %s!</string> <string name="network_error_parameter">A network error occurred: %s!</string>
</resources> </resources>