Code cleanup, spelling correction
@@ -1,12 +1,13 @@
|
|||||||
package de.sebse.fuplanner;
|
package de.sebse.fuplanner;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -276,16 +276,16 @@ public class MainActivity extends AppCompatActivity
|
|||||||
if (loginToken == null) {
|
if (loginToken == null) {
|
||||||
toLogoutState();
|
toLogoutState();
|
||||||
} else {
|
} else {
|
||||||
toLoginState(loginToken.getFullname(), loginToken.getEmail(), newFragment, newData, true);
|
toLoginState(loginToken.getFullName(), loginToken.getEmail(), newFragment, newData, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toLoginState(String fullname, String email, int newFragment, String newData, boolean onlineMode) {
|
private void toLoginState(String fullName, String email, int newFragment, String newData, boolean onlineMode) {
|
||||||
log.d(currentPage, newFragment);
|
log.d(currentPage, newFragment);
|
||||||
changeFragment(newFragment, newData);
|
changeFragment(newFragment, newData);
|
||||||
|
|
||||||
View header = mNavigationView.getHeaderView(0);
|
View header = mNavigationView.getHeaderView(0);
|
||||||
((TextView) header.findViewById(R.id.login_name)).setText(fullname);
|
((TextView) header.findViewById(R.id.login_name)).setText(fullName);
|
||||||
((TextView) header.findViewById(R.id.login_mail)).setText(email);
|
((TextView) header.findViewById(R.id.login_mail)).setText(email);
|
||||||
setOfflineBanner(onlineMode);
|
setOfflineBanner(onlineMode);
|
||||||
}
|
}
|
||||||
@@ -475,7 +475,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
public void onLoginFragmentInteraction(LoginToken loginToken, boolean onlineMode) {
|
public void onLoginFragmentInteraction(LoginToken loginToken, boolean onlineMode) {
|
||||||
String[] id = {""};
|
String[] id = {""};
|
||||||
int fragment = getDefaultFragmentAfterLogin(id);
|
int fragment = getDefaultFragmentAfterLogin(id);
|
||||||
toLoginState(loginToken.getFullname(), loginToken.getEmail(), fragment, id[0], onlineMode);
|
toLoginState(loginToken.getFullName(), loginToken.getEmail(), fragment, id[0], onlineMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -499,10 +499,19 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loginTokenInvalid(boolean doPrecheck) {
|
public void loginTokenInvalid(boolean doLoginCheck) {
|
||||||
|
if (doLoginCheck) {
|
||||||
|
getKVV().testLogin(isSuccess -> {
|
||||||
|
if (!isSuccess) {
|
||||||
getKVV().invalidate();
|
getKVV().invalidate();
|
||||||
checkAndDoLogin();
|
checkAndDoLogin();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
getKVV().invalidate();
|
||||||
|
checkAndDoLogin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshCompleted(boolean isFailed) {
|
public void onRefreshCompleted(boolean isFailed) {
|
||||||
|
|||||||
@@ -157,9 +157,11 @@ public class ScheduleFragment extends Fragment implements MonthLoader.MonthChang
|
|||||||
Calendar firstVisibleDay = mWeekView.getFirstVisibleDay();
|
Calendar firstVisibleDay = mWeekView.getFirstVisibleDay();
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
c.set(firstVisibleDay.get(Calendar.YEAR), firstVisibleDay.get(Calendar.MONTH), firstVisibleDay.get(Calendar.DAY_OF_MONTH), 0,0 );
|
c.set(firstVisibleDay.get(Calendar.YEAR), firstVisibleDay.get(Calendar.MONTH), firstVisibleDay.get(Calendar.DAY_OF_MONTH), 0,0 );
|
||||||
c.add(Calendar.DATE, 2); // die Grenze beim tippen, wann ver nach vorne und wann nach hinten springt
|
// Limit when to go a week backwards and when to the next week
|
||||||
|
c.add(Calendar.DATE, 2);
|
||||||
|
|
||||||
if (c.getTimeInMillis() > time.getTimeInMillis()){//nach links blättern
|
// skip to next week
|
||||||
|
if (c.getTimeInMillis() > time.getTimeInMillis()){
|
||||||
firstVisibleDay.add(Calendar.DATE, -1);
|
firstVisibleDay.add(Calendar.DATE, -1);
|
||||||
while (firstVisibleDay.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
while (firstVisibleDay.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
||||||
firstVisibleDay.add(Calendar.DATE, -1);
|
firstVisibleDay.add(Calendar.DATE, -1);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class DaySwitcherFragment extends Fragment implements DaySwitcherListener
|
|||||||
|
|
||||||
private MainActivityListener mListener;
|
private MainActivityListener mListener;
|
||||||
private final Logger log = new Logger(this);
|
private final Logger log = new Logger(this);
|
||||||
private ViewPager mViewPager;
|
|
||||||
private DaySwitcherAdapter adapterViewPager;
|
private DaySwitcherAdapter adapterViewPager;
|
||||||
|
|
||||||
public DaySwitcherFragment() {
|
public DaySwitcherFragment() {
|
||||||
@@ -78,11 +77,11 @@ public class DaySwitcherFragment extends Fragment implements DaySwitcherListener
|
|||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View v = inflater.inflate(R.layout.fragment_mod_detail, container, false);
|
View v = inflater.inflate(R.layout.fragment_mod_detail, container, false);
|
||||||
|
|
||||||
mViewPager = v.findViewById(R.id.vpPager);
|
ViewPager mViewPager = v.findViewById(R.id.vpPager);
|
||||||
adapterViewPager = new DaySwitcherAdapter(getChildFragmentManager());
|
adapterViewPager = new DaySwitcherAdapter(getChildFragmentManager());
|
||||||
mViewPager.setAdapter(adapterViewPager);
|
mViewPager.setAdapter(adapterViewPager);
|
||||||
|
|
||||||
refresh(false);
|
refresh();
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -104,8 +103,8 @@ public class DaySwitcherFragment extends Fragment implements DaySwitcherListener
|
|||||||
mListener = null;
|
mListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refresh(boolean forceRefresh) {
|
private void refresh() {
|
||||||
refresh(forceRefresh, null, null);
|
refresh(false, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refresh(boolean forceRefresh, NetworkCallback<Canteen> callback, NetworkErrorCallback errorCallback) {
|
private void refresh(boolean forceRefresh, NetworkCallback<Canteen> callback, NetworkErrorCallback errorCallback) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|||||||
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 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 int CATEGORY_OTHER = R.string.others;
|
||||||
private ArrayList<Object> matchings = new ArrayList<>();
|
private ArrayList<Object> matches = new ArrayList<>();
|
||||||
|
|
||||||
private Day mDay = null;
|
private Day mDay = null;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -105,7 +105,7 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|||||||
viewHolder.mNotes.setText(string.toString());
|
viewHolder.mNotes.setText(string.toString());
|
||||||
viewHolder.mCategory.setText(meal.getCategory());
|
viewHolder.mCategory.setText(meal.getCategory());
|
||||||
viewHolder.mIconVegan.setVisibility(meal.getVegan() == Meal.VEGAN_VEGAN ? View.VISIBLE : View.GONE);
|
viewHolder.mIconVegan.setVisibility(meal.getVegan() == Meal.VEGAN_VEGAN ? View.VISIBLE : View.GONE);
|
||||||
viewHolder.mIconVegetarian.setVisibility(meal.getVegan() == Meal.VEGAN_VEGETERIAN ? View.VISIBLE : View.GONE);
|
viewHolder.mIconVegetarian.setVisibility(meal.getVegan() == Meal.VEGAN_VEGETARIAN ? View.VISIBLE : View.GONE);
|
||||||
viewHolder.mIconBio.setVisibility((meal.getCertificates() & Meal.CERT_BIO) != 0 ? View.VISIBLE : View.GONE);
|
viewHolder.mIconBio.setVisibility((meal.getCertificates() & Meal.CERT_BIO) != 0 ? View.VISIBLE : View.GONE);
|
||||||
viewHolder.mIconMsc.setVisibility((meal.getCertificates() & Meal.CERT_MSC) != 0 ? View.VISIBLE : View.GONE);
|
viewHolder.mIconMsc.setVisibility((meal.getCertificates() & Meal.CERT_MSC) != 0 ? View.VISIBLE : View.GONE);
|
||||||
} else {
|
} else {
|
||||||
@@ -116,23 +116,23 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return matchings.size();
|
return matches.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
return matchings.get(position) instanceof String ? 1 : 0;
|
return matches.get(position) instanceof String ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Meal getMeal(int position) {
|
private Meal getMeal(int position) {
|
||||||
if (this.mDay != null)
|
if (this.mDay != null)
|
||||||
return this.mDay.get((Integer) matchings.get(position));
|
return this.mDay.get((Integer) matches.get(position));
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHeading(int position) {
|
private String getHeading(int position) {
|
||||||
return (String) matchings.get(position);
|
return (String) matches.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDay(Day day) {
|
public void setDay(Day day) {
|
||||||
@@ -159,18 +159,18 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|||||||
}
|
}
|
||||||
list.add(i);
|
list.add(i);
|
||||||
}
|
}
|
||||||
matchings.clear();
|
matches.clear();
|
||||||
for (int i = 0; i < CATEGORY_KEYS.length; i++) {
|
for (int i = 0; i < CATEGORY_KEYS.length; i++) {
|
||||||
ArrayList<Integer> list = map.get(CATEGORY_KEYS[i]);
|
ArrayList<Integer> list = map.get(CATEGORY_KEYS[i]);
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
matchings.add(mContext.getString(CATEGORY_VALS[i]));
|
matches.add(mContext.getString(CATEGORY_VALS[i]));
|
||||||
matchings.addAll(list);
|
matches.addAll(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArrayList<Integer> list = map.get("---");
|
ArrayList<Integer> list = map.get("---");
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
matchings.add(mContext.getString(CATEGORY_OTHER));
|
matches.add(mContext.getString(CATEGORY_OTHER));
|
||||||
matchings.addAll(list);
|
matches.addAll(list);
|
||||||
}
|
}
|
||||||
this.notifyDataSetChanged();
|
this.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class MealFragment extends Fragment {
|
|||||||
* Use this factory method to create a new instance of
|
* Use this factory method to create a new instance of
|
||||||
* this fragment using the provided parameters.
|
* this fragment using the provided parameters.
|
||||||
*
|
*
|
||||||
* @param canteenId ID der Kantine.
|
* @param canteenId ID od current canteen.
|
||||||
* @param dayPosition anzuzeigender Tag.
|
* @param dayPosition day to show.
|
||||||
* @return A new instance of fragment MealFragment.
|
* @return A new instance of fragment MealFragment.
|
||||||
*/
|
*/
|
||||||
public static MealFragment newInstance(int canteenId, int dayPosition) {
|
public static MealFragment newInstance(int canteenId, int dayPosition) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ModDetailAnnounceAdapter extends BaseExpandableListAdapter {
|
|||||||
private Modules.Module mModule = null;
|
private Modules.Module mModule = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChild(int groupPosition, int childPosititon) {
|
public String getChild(int groupPosition, int childPosition) {
|
||||||
StringBuilder s = new StringBuilder(this.getGroup(groupPosition).getBody());
|
StringBuilder s = new StringBuilder(this.getGroup(groupPosition).getBody());
|
||||||
ArrayList<String> urls = this.getGroup(groupPosition).getUrls();
|
ArrayList<String> urls = this.getGroup(groupPosition).getUrls();
|
||||||
for (int j =0; j<urls.size(); j++){
|
for (int j =0; j<urls.size(); j++){
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class ModDetailAssignmentAdapter extends BaseExpandableListAdapter {
|
|||||||
private Modules.Module mModule = null;
|
private Modules.Module mModule = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChild(int groupPosition, int childPosititon) {
|
public String getChild(int groupPosition, int childPosition) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(this.getGroup(groupPosition).getInstructions());
|
sb.append(this.getGroup(groupPosition).getInstructions());
|
||||||
sb.append("\n\n");
|
sb.append("\n\n");
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class ModDetailResourceFragment extends Fragment {
|
|||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setNeutralButton(R.string.close, (dialog, id) -> dialog.cancel())
|
.setNeutralButton(R.string.close, (dialog, id) -> dialog.cancel())
|
||||||
.setPositiveButton(R.string.download, (dialog, id) -> download(file, folderName, true));
|
.setPositiveButton(R.string.download, (dialog, id) -> download(file, folderName, true));
|
||||||
// if already doownloaded, show open button
|
// if already downloaded, show open button
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
alertDialogBuilder
|
alertDialogBuilder
|
||||||
.setNegativeButton(R.string.openFile, (dialog, id) -> download(file, folderName, false));
|
.setNegativeButton(R.string.openFile, (dialog, id) -> download(file, folderName, false));
|
||||||
@@ -242,7 +242,7 @@ public class ModDetailResourceFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Checks if external storage is available for read and write */
|
/* Checks if external storage is available for read and write */
|
||||||
public boolean isExternalStorageWritable() {
|
private boolean isExternalStorageWritable() {
|
||||||
String state = Environment.getExternalStorageState();
|
String state = Environment.getExternalStorageState();
|
||||||
if (Environment.MEDIA_MOUNTED.equals(state)) {
|
if (Environment.MEDIA_MOUNTED.equals(state)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -232,9 +232,6 @@ public class CanteenBrowser extends HTTPService {
|
|||||||
|
|
||||||
private NetworkErrorCallback errorOnCallback(NetworkErrorCallback errorCallback){
|
private NetworkErrorCallback errorOnCallback(NetworkErrorCallback errorCallback){
|
||||||
return (error -> {
|
return (error -> {
|
||||||
if (error.getHttpStatus() == 401 || error.getHttpStatus() == 403)
|
|
||||||
mListener.loginTokenInvalid(false);
|
|
||||||
else
|
|
||||||
mListener.onRefreshCompleted(true);
|
mListener.onRefreshCompleted(true);
|
||||||
errorCallback.onError(error);
|
errorCallback.onError(error);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class Canteens implements Serializable, Iterable<Canteen> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
throw new UnsupportedOperationException("You are not alloed to remove an entry!");
|
throw new UnsupportedOperationException("You are not allowed to remove an entry!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Meal implements Serializable {
|
public class Meal implements Serializable {
|
||||||
public static final int LIGHT_NONE = 0;
|
private static final int LIGHT_NONE = 0;
|
||||||
public static final int LIGHT_GREEN = 1;
|
private static final int LIGHT_GREEN = 1;
|
||||||
public static final int LIGHT_YELLOW = 2;
|
private static final int LIGHT_YELLOW = 2;
|
||||||
public static final int LIGHT_RED = 3;
|
private static final int LIGHT_RED = 3;
|
||||||
public static final int VEGAN_NONE = 0;
|
private static final int VEGAN_NONE = 0;
|
||||||
public static final int VEGAN_VEGETERIAN = 1;
|
public static final int VEGAN_VEGETARIAN = 1;
|
||||||
public static final int VEGAN_VEGAN = 2;
|
public static final int VEGAN_VEGAN = 2;
|
||||||
public static final int CERT_NONE = 0b0000;
|
private static final int CERT_NONE = 0b0000;
|
||||||
public static final int CERT_BIO = 0b0001;
|
public static final int CERT_BIO = 0b0001;
|
||||||
public static final int CERT_MSC = 0b0010;
|
public static final int CERT_MSC = 0b0010;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public class Meal implements Serializable {
|
|||||||
for (String note : notes) {
|
for (String note : notes) {
|
||||||
switch (note.toLowerCase()) {
|
switch (note.toLowerCase()) {
|
||||||
case "vegetarisch":
|
case "vegetarisch":
|
||||||
vegan = VEGAN_VEGETERIAN;
|
vegan = VEGAN_VEGETARIAN;
|
||||||
break;
|
break;
|
||||||
case "vegan":
|
case "vegan":
|
||||||
vegan = VEGAN_VEGAN;
|
vegan = VEGAN_VEGAN;
|
||||||
|
|||||||
@@ -148,6 +148,14 @@ public class KVV {
|
|||||||
getModulePart(modules -> modules.getResourceFile(callback, errorOnCallback(error),filename, url, moduleName, downloadNew));
|
getModulePart(modules -> modules.getResourceFile(callback, errorOnCallback(error),filename, url, moduleName, downloadNew));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLogin(BooleanFunction callback) {
|
||||||
|
getLastToken(lastToken -> {
|
||||||
|
TestLogin.testLogin(context, lastToken, success -> callback.apply(true), error -> callback.apply(false));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void getModulePart(ModListFunction func) {
|
private void getModulePart(ModListFunction func) {
|
||||||
@@ -177,7 +185,7 @@ public class KVV {
|
|||||||
private NetworkErrorCallback errorOnCallback(NetworkErrorCallback errorCallback){
|
private NetworkErrorCallback errorOnCallback(NetworkErrorCallback errorCallback){
|
||||||
return (error -> {
|
return (error -> {
|
||||||
if (error.getHttpStatus() == 401 || error.getHttpStatus() == 403)
|
if (error.getHttpStatus() == 401 || error.getHttpStatus() == 403)
|
||||||
mListener.loginTokenInvalid(false);
|
mListener.loginTokenInvalid(true);
|
||||||
else
|
else
|
||||||
mListener.onRefreshCompleted(true);
|
mListener.onRefreshCompleted(true);
|
||||||
errorCallback.onError(error);
|
errorCallback.onError(error);
|
||||||
@@ -189,6 +197,11 @@ public class KVV {
|
|||||||
void apply(KVVModuleList mod);
|
void apply(KVVModuleList mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface BooleanFunction {
|
||||||
|
void apply(boolean isSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
private void getLastToken(LastTokenCallback lastTokenCallback) {
|
private void getLastToken(LastTokenCallback lastTokenCallback) {
|
||||||
if (this.isLoginPending) {
|
if (this.isLoginPending) {
|
||||||
this.updatingList.add(lastTokenCallback);
|
this.updatingList.add(lastTokenCallback);
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package de.sebse.fuplanner.services.KVV;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@@ -26,7 +23,7 @@ class KVVLogin extends HTTPService {
|
|||||||
private LoginToken loginToken;
|
private LoginToken loginToken;
|
||||||
|
|
||||||
KVVLogin(Context context) {
|
KVVLogin(Context context) {
|
||||||
super(context, false);
|
super(context);
|
||||||
try {
|
try {
|
||||||
this.loginToken = LoginToken.load(context);
|
this.loginToken = LoginToken.load(context);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ class KVVModuleList extends HTTPService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//PDFs links rausziehen
|
// Extract attachment links
|
||||||
JSONArray attachments = site.getJSONArray("attachments");
|
JSONArray attachments = site.getJSONArray("attachments");
|
||||||
ArrayList<String> urls = new ArrayList<>();
|
ArrayList<String> urls = new ArrayList<>();
|
||||||
for (int j =0; j<attachments.length(); j++){
|
for (int j =0; j<attachments.length(); j++){
|
||||||
@@ -497,15 +497,18 @@ class KVVModuleList extends HTTPService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Resource> root = new ArrayList<>();
|
ArrayList<Resource> root = new ArrayList<>();
|
||||||
for (Resource res: resources) {//Verzeichnisstrucktur anlegen
|
// Generate folder structure
|
||||||
|
for (Resource res: resources) {
|
||||||
if (!res.getContainer().equals("/content/group/")) {
|
if (!res.getContainer().equals("/content/group/")) {
|
||||||
if (res.getContainer().equals("/content/group/"+ID+"/")){//ist File im Hauptordner
|
if (res.getContainer().equals("/content/group/"+ID+"/")){
|
||||||
|
// if file in root folder
|
||||||
root.add(res);
|
root.add(res);
|
||||||
}
|
} else {
|
||||||
else{
|
// in sub folder
|
||||||
for (Resource res2: resources) { // im Unterordner
|
for (Resource res2: resources) {
|
||||||
if (res2.getUrl().endsWith(res.getContainer()) && res2 instanceof Resource.Folder){
|
if (res2.getUrl().endsWith(res.getContainer()) && res2 instanceof Resource.Folder) {
|
||||||
((Resource.Folder) res2).add(res);//File bzw. Ordner anfügen
|
// Append File/Folder to list
|
||||||
|
((Resource.Folder) res2).add(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,7 +529,8 @@ class KVVModuleList extends HTTPService {
|
|||||||
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);
|
||||||
if (f.exists() && !downloadNew) {//prüffen ob bereits herunter gelagen und nicht erneut heruntergeladen werden...
|
// check if file already downloaded -> do not download again
|
||||||
|
if (f.exists() && !downloadNew) {
|
||||||
callback.onResponse(f.getPath());
|
callback.onResponse(f.getPath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Announcement implements Serializable {
|
|||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
private String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ public class Assignment implements Serializable {
|
|||||||
private final String id;
|
private final String id;
|
||||||
private final String title;
|
private final String title;
|
||||||
private final long dueTime;
|
private final long dueTime;
|
||||||
private final String gradebookItemName;
|
|
||||||
private final String gradeScale;
|
|
||||||
private final ArrayList<String> urls;
|
private final ArrayList<String> urls;
|
||||||
private final String instructions;
|
private final String instructions;
|
||||||
|
|
||||||
@@ -16,14 +14,12 @@ public class Assignment implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.dueTime = dueTime;
|
this.dueTime = dueTime;
|
||||||
this.gradebookItemName = gradebookItemName;
|
|
||||||
this.gradeScale = gradeScale;
|
|
||||||
this.urls = urls;
|
this.urls = urls;
|
||||||
//this.grade = grade;
|
//this.grade = grade;
|
||||||
this.instructions = instructions;
|
this.instructions = instructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
private String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +48,6 @@ public class Assignment implements Serializable {
|
|||||||
return "ID: "+getId()+
|
return "ID: "+getId()+
|
||||||
"\nTitle: "+getTitle()+
|
"\nTitle: "+getTitle()+
|
||||||
"\nDue date: "+getDueDate()+
|
"\nDue date: "+getDueDate()+
|
||||||
"\nInstuctions: "+getInstructions().substring(0, Math.min(getInstructions().length(), 100));
|
"\nInstructions: "+getInstructions().substring(0, Math.min(getInstructions().length(), 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
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;
|
||||||
private final String mail;
|
private final String mail;
|
||||||
|
|
||||||
@@ -15,26 +15,26 @@ public class Lecturer implements Serializable {
|
|||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
throw new NoSuchFieldException();
|
throw new NoSuchFieldException();
|
||||||
}
|
}
|
||||||
this.firstname = matcher.group(1);
|
this.firstName = matcher.group(1);
|
||||||
this.surname = matcher.group(2);
|
this.surname = matcher.group(2);
|
||||||
this.mail = matcher.group(3);
|
this.mail = matcher.group(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFirstname() {
|
private String getFirstName() {
|
||||||
return firstname;
|
return firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSurname() {
|
private String getSurname() {
|
||||||
return surname;
|
return surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMail() {
|
private String getMail() {
|
||||||
return mail;
|
return mail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "First name: "+getFirstname()+
|
return "First name: "+ getFirstName()+
|
||||||
"\nSurname: "+getSurname()+
|
"\nSurname: "+getSurname()+
|
||||||
"\nMail: "+getMail();
|
"\nMail: "+getMail();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class LoginToken implements Serializable {
|
|||||||
private final String shibsessionKey;
|
private final String shibsessionKey;
|
||||||
private final String shibsessionName;
|
private final String shibsessionName;
|
||||||
private final String JSESSIONID;
|
private final String JSESSIONID;
|
||||||
private String fullname;
|
private String fullName;
|
||||||
private String email;
|
private String email;
|
||||||
private long saveDate = 0;
|
private long saveDate = 0;
|
||||||
|
|
||||||
@@ -59,8 +59,8 @@ public class LoginToken implements Serializable {
|
|||||||
context.deleteFile(FILE_NAME);
|
context.deleteFile(FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdditionals(String fullname, String email) {
|
public void setAdditionals(String fullName, String email) {
|
||||||
this.fullname = fullname;
|
this.fullName = fullName;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +80,8 @@ public class LoginToken implements Serializable {
|
|||||||
return JSESSIONID;
|
return JSESSIONID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFullname() {
|
public String getFullName() {
|
||||||
return fullname;
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
|
|||||||
@@ -104,9 +104,9 @@ public class Modules implements Iterable<Modules.Module>, Serializable {
|
|||||||
|
|
||||||
public class Module implements Serializable {
|
public class Module implements Serializable {
|
||||||
public final String semester;
|
public final String semester;
|
||||||
public final HashSet<String> lvNumber;
|
final HashSet<String> lvNumber;
|
||||||
public final String title;
|
public final String title;
|
||||||
public final HashSet<Lecturer> lecturer;
|
final HashSet<Lecturer> lecturer;
|
||||||
public final String type;
|
public final String type;
|
||||||
public final String description;
|
public final String description;
|
||||||
private final String ID;
|
private final String ID;
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ import de.sebse.fuplanner.tools.ui.treeview.TreeNode;
|
|||||||
|
|
||||||
public abstract class Resource implements Serializable {
|
public abstract class Resource implements Serializable {
|
||||||
|
|
||||||
protected final String author;
|
final String author;
|
||||||
protected final long modifiedDate;
|
final long modifiedDate;
|
||||||
protected final String title;
|
final String title;
|
||||||
protected final String url;
|
final String url;
|
||||||
protected final boolean visible;
|
private final boolean visible;
|
||||||
protected final String container;
|
private final String container;
|
||||||
|
|
||||||
|
|
||||||
public Resource(String author, String title, long modifiedDate, String url, boolean visible, String container) {
|
Resource(String author, String title, long modifiedDate, String url, boolean visible, String container) {
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.modifiedDate = modifiedDate;
|
this.modifiedDate = modifiedDate;
|
||||||
@@ -86,22 +86,22 @@ public abstract class Resource implements Serializable {
|
|||||||
|
|
||||||
public static class Folder extends Resource implements LayoutItemType {
|
public static class Folder extends Resource implements LayoutItemType {
|
||||||
|
|
||||||
private final ArrayList<Resource> childs;
|
private final ArrayList<Resource> children;
|
||||||
public Folder(String author, String title, long modifiedDate, String url, boolean visible, String container) {
|
public Folder(String author, String title, long modifiedDate, String url, boolean visible, String container) {
|
||||||
super(author, title, modifiedDate, url, visible, container);
|
super(author, title, modifiedDate, url, visible, container);
|
||||||
childs = new ArrayList<>();
|
children = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Resource res){
|
public void add(Resource res){
|
||||||
childs.add(res);
|
children.add(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource get(int id){
|
public Resource get(int id){
|
||||||
return childs.get(id);
|
return children.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size(){
|
public int size(){
|
||||||
return childs.size();
|
return children.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -111,14 +111,14 @@ public abstract class Resource implements Serializable {
|
|||||||
", modifiedDate=" + modifiedDate +
|
", modifiedDate=" + modifiedDate +
|
||||||
", title='" + title + '\'' +
|
", title='" + title + '\'' +
|
||||||
", url='" + url + '\'' +
|
", url='" + url + '\'' +
|
||||||
", childs='" + childs + '\'' +
|
", children='" + children + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TreeNode getTreeNode() {
|
public TreeNode getTreeNode() {
|
||||||
TreeNode dir = new TreeNode<>(this);
|
TreeNode dir = new TreeNode<>(this);
|
||||||
for (Resource res: childs) {
|
for (Resource res: children) {
|
||||||
dir.addChild(res.getTreeNode());
|
dir.addChild(res.getTreeNode());
|
||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
|||||||
|
|
||||||
public class AsyncQueue {
|
public class AsyncQueue {
|
||||||
private final HashMap<String, LinkedList<AsyncQueueCallback>> mQueues = new HashMap<>();
|
private final HashMap<String, LinkedList<AsyncQueueCallback>> mQueues = new HashMap<>();
|
||||||
private final HashMap<String, Boolean> mRunnings = new HashMap<>();
|
private final HashMap<String, Boolean> mIsRunning = new HashMap<>();
|
||||||
|
|
||||||
public void add(String hash, AsyncQueueCallback callback) {
|
public void add(String hash, AsyncQueueCallback callback) {
|
||||||
if (isRunning(hash))
|
if (isRunning(hash))
|
||||||
@@ -46,11 +46,11 @@ public class AsyncQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRunning(String hash) {
|
private boolean isRunning(String hash) {
|
||||||
return mRunnings.containsKey(hash) && mRunnings.get(hash);
|
return mIsRunning.containsKey(hash) && mIsRunning.get(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRunning(String hash, boolean value) {
|
private void setRunning(String hash, boolean value) {
|
||||||
mRunnings.put(hash, value);
|
mIsRunning.put(hash, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinkedList<AsyncQueueCallback> getQueue(String hash) {
|
private LinkedList<AsyncQueueCallback> getQueue(String hash) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class ColorRGB implements Color {
|
|||||||
private final int mGreen;
|
private final int mGreen;
|
||||||
private final int mBlue;
|
private final int mBlue;
|
||||||
|
|
||||||
public ColorRGB(int red, int green, int blue) {
|
private ColorRGB(int red, int green, int blue) {
|
||||||
this.mRed = red;
|
this.mRed = red;
|
||||||
this.mGreen = green;
|
this.mGreen = green;
|
||||||
this.mBlue = blue;
|
this.mBlue = blue;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public interface MainActivityListener {
|
|||||||
|
|
||||||
GoogleAuth getGoogleAuth();
|
GoogleAuth getGoogleAuth();
|
||||||
|
|
||||||
void loginTokenInvalid(boolean doPrecheck);
|
void loginTokenInvalid(boolean doLoginCheck);
|
||||||
|
|
||||||
void onRefreshCompleted(boolean isFailed);
|
void onRefreshCompleted(boolean isFailed);
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import java.util.regex.MatchResult;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import de.sebse.fuplanner.tools.logging.Logger;
|
|
||||||
|
|
||||||
public class Regex {
|
public class Regex {
|
||||||
public static boolean has(@Language("Regexp") String regex, String match) {
|
public static boolean has(@Language("Regexp") String regex, String match) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public abstract class SortedList<T, I, F> implements Iterable<T>, Serializable {
|
|||||||
|
|
||||||
protected abstract boolean hasIdentifier(T o1, I id);
|
protected abstract boolean hasIdentifier(T o1, I id);
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
protected abstract boolean hasFilter(T o1, F filter);
|
protected abstract boolean hasFilter(T o1, F filter);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import android.os.Build;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
|
||||||
import com.google.android.gms.common.logging.Logger;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ public class UtilsUi {
|
|||||||
public static float convertPixelsToDp(float px, Context context) {
|
public static float convertPixelsToDp(float px, Context context) {
|
||||||
Resources resources = context.getResources();
|
Resources resources = context.getResources();
|
||||||
DisplayMetrics metrics = resources.getDisplayMetrics();
|
DisplayMetrics metrics = resources.getDisplayMetrics();
|
||||||
float dp = px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
|
return px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
|
||||||
return dp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float convertDpToPixels(Context context, float dp) {
|
public static float convertDpToPixels(Context context, float dp) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class Logger {
|
|||||||
this.tag = getClassName(object);
|
this.tag = getClassName(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getClassName(Object object) {
|
private static String getClassName(Object object) {
|
||||||
if (object instanceof String)
|
if (object instanceof String)
|
||||||
return (String) object;
|
return (String) object;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ public class BetterHurlStack extends HurlStack {
|
|||||||
/**
|
/**
|
||||||
* @param urlRewriter Rewriter to use for request URLs
|
* @param urlRewriter Rewriter to use for request URLs
|
||||||
*/
|
*/
|
||||||
BetterHurlStack(boolean followRedirects, UrlRewriter urlRewriter) {
|
private BetterHurlStack(boolean followRedirects, UrlRewriter urlRewriter) {
|
||||||
this(followRedirects, urlRewriter, null);
|
this(followRedirects, urlRewriter, null);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param urlRewriter Rewriter to use for request URLs
|
* @param urlRewriter Rewriter to use for request URLs
|
||||||
* @param sslSocketFactory SSL factory to use for HTTPS connections
|
* @param sslSocketFactory SSL factory to use for HTTPS connections
|
||||||
*/
|
*/
|
||||||
BetterHurlStack(boolean followRedirects, UrlRewriter urlRewriter, SSLSocketFactory sslSocketFactory) {
|
private BetterHurlStack(boolean followRedirects, UrlRewriter urlRewriter, SSLSocketFactory sslSocketFactory) {
|
||||||
super(urlRewriter, sslSocketFactory);
|
super(urlRewriter, sslSocketFactory);
|
||||||
mUrlRewriter = urlRewriter;
|
mUrlRewriter = urlRewriter;
|
||||||
mSslSocketFactory = sslSocketFactory;
|
mSslSocketFactory = sslSocketFactory;
|
||||||
@@ -123,7 +123,7 @@ public class BetterHurlStack extends HurlStack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static List<Header> convertHeaders(Map<String, List<String>> responseHeaders) {
|
private static List<Header> convertHeaders(Map<String, List<String>> responseHeaders) {
|
||||||
List<Header> headerList = new ArrayList<>(responseHeaders.size());
|
List<Header> headerList = new ArrayList<>(responseHeaders.size());
|
||||||
for (Map.Entry<String, List<String>> entry : responseHeaders.entrySet()) {
|
for (Map.Entry<String, List<String>> entry : responseHeaders.entrySet()) {
|
||||||
// HttpUrlConnection includes the status line as a header with a null key; omit it here
|
// HttpUrlConnection includes the status line as a header with a null key; omit it here
|
||||||
@@ -165,7 +165,7 @@ public class BetterHurlStack extends HurlStack {
|
|||||||
// NOTE: Any request headers added here (via setRequestProperty or addRequestProperty) should be
|
// NOTE: Any request headers added here (via setRequestProperty or addRequestProperty) should be
|
||||||
// checked against the existing properties in the connection and not overridden if already set.
|
// checked against the existing properties in the connection and not overridden if already set.
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
/* package */ static void setConnectionParametersForRequest(
|
/* package */ private static void setConnectionParametersForRequest(
|
||||||
HttpURLConnection connection, Request<?> request) throws IOException, AuthFailureError {
|
HttpURLConnection connection, Request<?> request) throws IOException, AuthFailureError {
|
||||||
switch (request.getMethod()) {
|
switch (request.getMethod()) {
|
||||||
case Request.Method.DEPRECATED_GET_OR_POST:
|
case Request.Method.DEPRECATED_GET_OR_POST:
|
||||||
@@ -273,7 +273,7 @@ public class BetterHurlStack extends HurlStack {
|
|||||||
/**
|
/**
|
||||||
* Initializes an {@link InputStream} from the given {@link HttpURLConnection}.
|
* Initializes an {@link InputStream} from the given {@link HttpURLConnection}.
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection A http url connection
|
||||||
* @return an HttpEntity populated with data from <code>connection</code>.
|
* @return an HttpEntity populated with data from <code>connection</code>.
|
||||||
*/
|
*/
|
||||||
private static InputStream inputStreamFromConnection(HttpURLConnection connection) {
|
private static InputStream inputStreamFromConnection(HttpURLConnection connection) {
|
||||||
|
|||||||
@@ -29,12 +29,8 @@ public class HTTPService {
|
|||||||
protected Logger log = new Logger(this);
|
protected Logger log = new Logger(this);
|
||||||
|
|
||||||
protected HTTPService(Context context) {
|
protected HTTPService(Context context) {
|
||||||
this(context, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected HTTPService(Context context, boolean followRedirects) {
|
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
requestQueue = Volley.newRequestQueue(context, new BetterHurlStack(followRedirects));
|
requestQueue = Volley.newRequestQueue(context, new BetterHurlStack(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void get(String url, @Nullable final HashMap<String, String> cookies, Response.Listener<Result> response, Response.ErrorListener error) {
|
protected void get(String url, @Nullable final HashMap<String, String> cookies, Response.Listener<Result> response, Response.ErrorListener error) {
|
||||||
@@ -42,14 +38,14 @@ public class HTTPService {
|
|||||||
@Override
|
@Override
|
||||||
public void deliverError(VolleyError error) {
|
public void deliverError(VolleyError error) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
super.deliverError(new VolleyError(new NetworkResponse(500, null, null, true, 0)));
|
super.deliverError(new VolleyError(new NetworkResponse(500, null, true, 0, null)));
|
||||||
} else if (error.networkResponse == null) {
|
} else if (error.networkResponse == null) {
|
||||||
int statusCode;
|
int statusCode;
|
||||||
if (error instanceof TimeoutError)
|
if (error instanceof TimeoutError)
|
||||||
statusCode = 408;
|
statusCode = 408;
|
||||||
else
|
else
|
||||||
statusCode = 500;
|
statusCode = 500;
|
||||||
super.deliverError(new VolleyError(new NetworkResponse(statusCode, null, null, true, error.getNetworkTimeMs())));
|
super.deliverError(new VolleyError(new NetworkResponse(statusCode, null, true, error.getNetworkTimeMs(), null)));
|
||||||
} else {
|
} else {
|
||||||
final int status = error.networkResponse.statusCode;
|
final int status = error.networkResponse.statusCode;
|
||||||
if (status == 302) {
|
if (status == 302) {
|
||||||
@@ -98,7 +94,6 @@ public class HTTPService {
|
|||||||
sb.append('&');
|
sb.append('&');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
//Log.e("Superissimo", e.getKey()+"|||"+e.getValue());
|
|
||||||
sb.append(URLEncoder.encode(e.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(e.getValue(), "UTF-8"));
|
sb.append(URLEncoder.encode(e.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(e.getValue(), "UTF-8"));
|
||||||
} catch (UnsupportedEncodingException ignored) {
|
} catch (UnsupportedEncodingException ignored) {
|
||||||
}
|
}
|
||||||
@@ -114,14 +109,14 @@ public class HTTPService {
|
|||||||
@Override
|
@Override
|
||||||
public void deliverError(VolleyError error) {
|
public void deliverError(VolleyError error) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
super.deliverError(new VolleyError(new NetworkResponse(500, null, null, true, 0)));
|
super.deliverError(new VolleyError(new NetworkResponse(500, null, true, 0, null)));
|
||||||
} else if (error.networkResponse == null) {
|
} else if (error.networkResponse == null) {
|
||||||
int statusCode;
|
int statusCode;
|
||||||
if (error instanceof TimeoutError)
|
if (error instanceof TimeoutError)
|
||||||
statusCode = 408;
|
statusCode = 408;
|
||||||
else
|
else
|
||||||
statusCode = 500;
|
statusCode = 500;
|
||||||
super.deliverError(new VolleyError(new NetworkResponse(statusCode, null, null, true, error.getNetworkTimeMs())));
|
super.deliverError(new VolleyError(new NetworkResponse(statusCode, null, true, error.getNetworkTimeMs(), null)));
|
||||||
} else {
|
} else {
|
||||||
final int status = error.networkResponse.statusCode;
|
final int status = error.networkResponse.statusCode;
|
||||||
if (status == 302) {
|
if (status == 302) {
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import com.android.volley.Request;
|
|||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
import com.android.volley.toolbox.HttpHeaderParser;
|
import com.android.volley.toolbox.HttpHeaderParser;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by sebastian on 24.10.17.
|
* Created by sebastian on 24.10.17.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class NetworkError {
|
|||||||
return httpStatus;
|
return httpStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
private String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.android.volley.toolbox.HttpHeaderParser;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import de.sebse.fuplanner.tools.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by sebastian on 24.10.17.
|
* Created by sebastian on 24.10.17.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class ExpandableCardViewHolder extends CustomViewHolder {
|
|||||||
getView().reset();
|
getView().reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpandableCardView getView() {
|
private ExpandableCardView getView() {
|
||||||
return (ExpandableCardView) mView;
|
return (ExpandableCardView) mView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class ItemViewHolder extends CustomViewHolder {
|
|||||||
public final TextView mTitle;
|
public final TextView mTitle;
|
||||||
public final TextView mSubLeft;
|
public final TextView mSubLeft;
|
||||||
public final TextView mSubRight;
|
public final TextView mSubRight;
|
||||||
public final TextView mTopRight;
|
private final TextView mTopRight;
|
||||||
|
|
||||||
public ItemViewHolder(View view) {
|
public ItemViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
package de.sebse.fuplanner.tools.ui;
|
package de.sebse.fuplanner.tools.ui;
|
||||||
|
|
||||||
import android.media.Image;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.w3c.dom.Text;
|
|
||||||
|
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
import de.sebse.fuplanner.tools.logging.Logger;
|
|
||||||
import de.sebse.fuplanner.tools.ui.cardview.ExpandableCardView;
|
|
||||||
|
|
||||||
public class MealViewHolder extends ExpandableCardViewHolder {
|
public class MealViewHolder extends ExpandableCardViewHolder {
|
||||||
public final TextView mTitle;
|
public final TextView mTitle;
|
||||||
@@ -33,7 +28,7 @@ public class MealViewHolder extends ExpandableCardViewHolder {
|
|||||||
mCategory = innerView.findViewById(R.id.category);
|
mCategory = innerView.findViewById(R.id.category);
|
||||||
mIconVegan = innerView.findViewById(R.id.icon_vegan);
|
mIconVegan = innerView.findViewById(R.id.icon_vegan);
|
||||||
mIconVegetarian = innerView.findViewById(R.id.icon_vegetarian);
|
mIconVegetarian = innerView.findViewById(R.id.icon_vegetarian);
|
||||||
mIconBio = innerView.findViewById(R.id.icon_bio);
|
mIconBio = innerView.findViewById(R.id.icon_organic);
|
||||||
mIconMsc = innerView.findViewById(R.id.icon_msc);
|
mIconMsc = innerView.findViewById(R.id.icon_msc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class ExpandableCardView extends CardView {
|
|||||||
private View outerView;
|
private View outerView;
|
||||||
private ImageButton imageButton;
|
private ImageButton imageButton;
|
||||||
|
|
||||||
public static final int DEFAULT_ANIM_DURATION = 350;
|
private static final int DEFAULT_ANIM_DURATION = 350;
|
||||||
private long animDuration = DEFAULT_ANIM_DURATION;
|
private long animDuration = DEFAULT_ANIM_DURATION;
|
||||||
|
|
||||||
private final static int COLLAPSING = 0;
|
private final static int COLLAPSING = 0;
|
||||||
@@ -187,7 +187,7 @@ public class ExpandableCardView extends CardView {
|
|||||||
setMeasuredDimension(reconcileSize(desiredWidth, widthMeasureSpec), reconcileSize(isExpanded ? expandedHeight : collapsedHeight, heightMeasureSpec));
|
setMeasuredDimension(reconcileSize(desiredWidth, widthMeasureSpec), reconcileSize(isExpanded ? expandedHeight : collapsedHeight, heightMeasureSpec));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void expand() {
|
private void expand() {
|
||||||
final int initialHeight = this.getHeight();
|
final int initialHeight = this.getHeight();
|
||||||
int targetHeight = expandedHeight;
|
int targetHeight = expandedHeight;
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ public class ExpandableCardView extends CardView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void collapse() {
|
private void collapse() {
|
||||||
final int initialHeight = this.getHeight();
|
final int initialHeight = this.getHeight();
|
||||||
int targetHeight = collapsedHeight;
|
int targetHeight = collapsedHeight;
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ public class ExpandableCardView extends CardView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExpanded() {
|
private boolean isExpanded() {
|
||||||
return isExpanded;
|
return isExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,11 +300,11 @@ public class ExpandableCardView extends CardView {
|
|||||||
super.setOnClickListener(l);
|
super.setOnClickListener(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAnimDuration() {
|
private long getAnimDuration() {
|
||||||
return animDuration;
|
return animDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnimDuration(long animDuration) {
|
private void setAnimDuration(long animDuration) {
|
||||||
this.animDuration = animDuration;
|
this.animDuration = animDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ public class ExpandableCardView extends CardView {
|
|||||||
* Interfaces
|
* Interfaces
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface OnExpandedListener {
|
interface OnExpandedListener {
|
||||||
|
|
||||||
void onExpandChanged(View v, boolean isExpanded);
|
void onExpandChanged(View v, boolean isExpanded);
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ public class DirectoryNodeBinder extends TreeViewBinder<DirectoryNodeBinder.View
|
|||||||
private ImageView ivArrow;
|
private ImageView ivArrow;
|
||||||
private TextView tvName;
|
private TextView tvName;
|
||||||
|
|
||||||
public ViewHolder(View rootView) {
|
ViewHolder(View rootView) {
|
||||||
super(rootView);
|
super(rootView);
|
||||||
this.ivArrow = (ImageView) rootView.findViewById(R.id.iv_arrow);
|
this.ivArrow = rootView.findViewById(R.id.iv_arrow);
|
||||||
this.tvName = (TextView) rootView.findViewById(R.id.tv_name);
|
this.tvName = rootView.findViewById(R.id.tv_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageView getIvArrow() {
|
public ImageView getIvArrow() {
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ public class FileNodeBinder extends TreeViewBinder<FileNodeBinder.ViewHolder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ViewHolder extends TreeViewBinder.ViewHolder {
|
public class ViewHolder extends TreeViewBinder.ViewHolder {
|
||||||
public TextView tvName;
|
TextView tvName;
|
||||||
|
|
||||||
public ViewHolder(View rootView) {
|
ViewHolder(View rootView) {
|
||||||
super(rootView);
|
super(rootView);
|
||||||
this.tvName = (TextView) rootView.findViewById(R.id.tv_name);
|
this.tvName = rootView.findViewById(R.id.tv_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,17 +60,15 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeNode addChild(TreeNode node) {
|
public void addChild(TreeNode node) {
|
||||||
if (childList == null)
|
if (childList == null)
|
||||||
childList = new ArrayList<>();
|
childList = new ArrayList<>();
|
||||||
childList.add(node);
|
childList.add(node);
|
||||||
node.parent = this;
|
node.parent = this;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean toggle() {
|
public void toggle() {
|
||||||
isExpand = !isExpand;
|
isExpand = !isExpand;
|
||||||
return isExpand;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void collapse() {
|
public void collapse() {
|
||||||
@@ -79,7 +77,7 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void collapseAll() {
|
private void collapseAll() {
|
||||||
if (childList == null || childList.isEmpty()) {
|
if (childList == null || childList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -88,13 +86,13 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void expand() {
|
private void expand() {
|
||||||
if (!isExpand) {
|
if (!isExpand) {
|
||||||
isExpand = true;
|
isExpand = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void expandAll() {
|
private void expandAll() {
|
||||||
expand();
|
expand();
|
||||||
if (childList == null || childList.isEmpty()) {
|
if (childList == null || childList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -141,7 +139,7 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TreeNode<T> clone() throws CloneNotSupportedException {
|
protected TreeNode<T> clone() {
|
||||||
TreeNode<T> clone = new TreeNode<>(this.content);
|
TreeNode<T> clone = new TreeNode<>(this.content);
|
||||||
clone.isExpand = this.isExpand;
|
clone.isExpand = this.isExpand;
|
||||||
return clone;
|
return clone;
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
private OnTreeNodeListener onTreeNodeListener;
|
private OnTreeNodeListener onTreeNodeListener;
|
||||||
private boolean toCollapseChild;
|
private boolean toCollapseChild;
|
||||||
|
|
||||||
public TreeViewAdapter(List<? extends TreeViewBinder> viewBinders) {
|
protected TreeViewAdapter(List<? extends TreeViewBinder> viewBinders) {
|
||||||
this(null, viewBinders);
|
this(null, viewBinders);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeViewAdapter(List<TreeNode> nodes, List<? extends TreeViewBinder> viewBinders) {
|
private TreeViewAdapter(List<TreeNode> nodes, List<? extends TreeViewBinder> viewBinders) {
|
||||||
displayNodes = new ArrayList<>();
|
displayNodes = new ArrayList<>();
|
||||||
if (nodes != null)
|
if (nodes != null)
|
||||||
findDisplayNodes(nodes);
|
findDisplayNodes(nodes);
|
||||||
@@ -188,7 +188,7 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
void onToggle(boolean isExpand, RecyclerView.ViewHolder holder);
|
void onToggle(boolean isExpand, RecyclerView.ViewHolder holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh(List<TreeNode> treeNodes) {
|
protected void refresh(List<TreeNode> treeNodes) {
|
||||||
displayNodes.clear();
|
displayNodes.clear();
|
||||||
findDisplayNodes(treeNodes);
|
findDisplayNodes(treeNodes);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
@@ -276,11 +276,7 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
private List<TreeNode> backupDisplayNodes() {
|
private List<TreeNode> backupDisplayNodes() {
|
||||||
List<TreeNode> temp = new ArrayList<>();
|
List<TreeNode> temp = new ArrayList<>();
|
||||||
for (TreeNode displayNode : displayNodes) {
|
for (TreeNode displayNode : displayNodes) {
|
||||||
try {
|
|
||||||
temp.add(displayNode.clone());
|
temp.add(displayNode.clone());
|
||||||
} catch (CloneNotSupportedException e) {
|
|
||||||
temp.add(displayNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public abstract class TreeViewBinder<VH extends RecyclerView.ViewHolder> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected <T extends View> T findViewById(@IdRes int id) {
|
protected <T extends View> T findViewById(@IdRes int id) {
|
||||||
|
//noinspection unchecked
|
||||||
return (T) itemView.findViewById(id);
|
return (T) itemView.findViewById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ import static de.sebse.fuplanner.tools.ui.weekview.WeekViewUtil.today;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class WeekView extends View {
|
public class WeekView extends View {
|
||||||
///////////////////////////////////////////Änderung in zeile 991 überprüfen!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
private enum Direction {
|
private enum Direction {
|
||||||
NONE, LEFT, RIGHT, VERTICAL
|
NONE, LEFT, RIGHT, VERTICAL
|
||||||
}
|
}
|
||||||
@@ -361,8 +360,8 @@ public class WeekView extends View {
|
|||||||
selectedTime.set(Calendar.HOUR_OF_DAY, mMinTime);
|
selectedTime.set(Calendar.HOUR_OF_DAY, mMinTime);
|
||||||
selectedTime.set(Calendar.MINUTE, 0);
|
selectedTime.set(Calendar.MINUTE, 0);
|
||||||
}
|
}
|
||||||
int unroundedMinutes = selectedTime.get(Calendar.MINUTE);
|
int nonRoundedMinutes = selectedTime.get(Calendar.MINUTE);
|
||||||
int mod = unroundedMinutes % 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) ? -mod : (mNewEventTimeResolutionInMinutes - mod));
|
||||||
|
|
||||||
Calendar endTime = (Calendar) selectedTime.clone();
|
Calendar endTime = (Calendar) selectedTime.clone();
|
||||||
@@ -1261,8 +1260,8 @@ public class WeekView extends View {
|
|||||||
*/
|
*/
|
||||||
private class EventRect {
|
private class EventRect {
|
||||||
public WeekViewEvent event;
|
public WeekViewEvent event;
|
||||||
public WeekViewEvent originalEvent;
|
WeekViewEvent originalEvent;
|
||||||
public RectF rectF;
|
RectF rectF;
|
||||||
public float left;
|
public float left;
|
||||||
public float width;
|
public float width;
|
||||||
public float top;
|
public float top;
|
||||||
@@ -2422,7 +2421,7 @@ public class WeekView extends View {
|
|||||||
/**
|
/**
|
||||||
* Set the scroll duration
|
* Set the scroll duration
|
||||||
*
|
*
|
||||||
* @param scrollDuration the new scrollDuraction
|
* @param scrollDuration the new scrollDuration
|
||||||
*/
|
*/
|
||||||
public void setScrollDuration(int scrollDuration) {
|
public void setScrollDuration(int scrollDuration) {
|
||||||
mScrollDuration = scrollDuration;
|
mScrollDuration = scrollDuration;
|
||||||
@@ -2526,7 +2525,7 @@ public class WeekView extends View {
|
|||||||
// Check after call of mGestureDetector, so mCurrentFlingDirection and mCurrentScrollDirection are set.
|
// Check after call of mGestureDetector, so mCurrentFlingDirection and mCurrentScrollDirection are set.
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP && !mIsZooming && mCurrentFlingDirection == Direction.NONE) {
|
if (event.getAction() == MotionEvent.ACTION_UP && !mIsZooming && mCurrentFlingDirection == Direction.NONE) {
|
||||||
if (mCurrentScrollDirection == Direction.RIGHT || mCurrentScrollDirection == Direction.LEFT) {
|
if (mCurrentScrollDirection == Direction.RIGHT || mCurrentScrollDirection == Direction.LEFT) {
|
||||||
goToNearestOrigin();
|
performClick();
|
||||||
}
|
}
|
||||||
mCurrentScrollDirection = Direction.NONE;
|
mCurrentScrollDirection = Direction.NONE;
|
||||||
}
|
}
|
||||||
@@ -2534,6 +2533,13 @@ public class WeekView extends View {
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean performClick() {
|
||||||
|
super.performClick();
|
||||||
|
goToNearestOrigin();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void goToNearestOrigin() {
|
private void goToNearestOrigin() {
|
||||||
double leftDays = mCurrentOrigin.x / (mWidthPerDay + mColumnGap);
|
double leftDays = mCurrentOrigin.x / (mWidthPerDay + mColumnGap);
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class WeekViewEvent {
|
|||||||
* @param allDay Is the event an all day event.
|
* @param allDay Is the event an all day event.
|
||||||
* @param shader the Shader of the event rectangle
|
* @param shader the Shader of the event rectangle
|
||||||
*/
|
*/
|
||||||
public WeekViewEvent(String id, String name, String location, Calendar startTime, Calendar endTime, boolean allDay, Shader shader) {
|
private WeekViewEvent(String id, String name, String location, Calendar startTime, Calendar endTime, boolean allDay, Shader shader) {
|
||||||
this.mId = id;
|
this.mId = id;
|
||||||
this.mName = name;
|
this.mName = name;
|
||||||
this.mLocation = location;
|
this.mLocation = location;
|
||||||
@@ -96,7 +96,7 @@ public class WeekViewEvent {
|
|||||||
* @param endTime The time when the event ends.
|
* @param endTime The time when the event ends.
|
||||||
* @param allDay Is the event an all day event
|
* @param allDay Is the event an all day event
|
||||||
*/
|
*/
|
||||||
public WeekViewEvent(String id, String name, String location, Calendar startTime, Calendar endTime, boolean allDay) {
|
private WeekViewEvent(String id, String name, String location, Calendar startTime, Calendar endTime, boolean allDay) {
|
||||||
this(id, name, location, startTime, endTime, allDay, null);
|
this(id, name, location, startTime, endTime, allDay, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.Calendar;
|
|||||||
/**
|
/**
|
||||||
* Created by jesse on 6/02/2016.
|
* Created by jesse on 6/02/2016.
|
||||||
*/
|
*/
|
||||||
public class WeekViewUtil {
|
class WeekViewUtil {
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
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_black_18dp"
|
||||||
|
android:contentDescription="@string/arrow" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
|
|||||||
@@ -46,6 +46,6 @@
|
|||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
tools:text="Raum 105"
|
tools:text="Room 105"
|
||||||
tools:ignore="RelativeOverlap" />
|
tools:ignore="RelativeOverlap" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -26,27 +26,27 @@
|
|||||||
android:src="@mipmap/ic_vegan"
|
android:src="@mipmap/ic_vegan"
|
||||||
android:id="@+id/icon_vegan"
|
android:id="@+id/icon_vegan"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
android:contentDescription="@string/vegan" />
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/ic_vegetarian"
|
android:src="@mipmap/ic_vegetarian"
|
||||||
android:id="@+id/icon_vegetarian"
|
android:id="@+id/icon_vegetarian"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
android:contentDescription="@string/vegetarian" />
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/ic_msc"
|
android:src="@mipmap/ic_msc"
|
||||||
android:id="@+id/icon_msc"
|
android:id="@+id/icon_msc"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
android:contentDescription="@string/msc" />
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/ic_bio"
|
android:src="@mipmap/ic_organic"
|
||||||
android:id="@+id/icon_bio"
|
android:id="@+id/icon_organic"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
android:contentDescription="@string/bio" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
@@ -63,4 +63,8 @@
|
|||||||
<string name="invalid_credentials">Ungültiger Benutzername oder Password!</string>
|
<string name="invalid_credentials">Ungültiger Benutzername oder Password!</string>
|
||||||
<string name="error_occurred_code">Fehler %1$d aufgetreten!</string>
|
<string name="error_occurred_code">Fehler %1$d aufgetreten!</string>
|
||||||
<string name="no_price_available">Kein Preis verfügbar!</string>
|
<string name="no_price_available">Kein Preis verfügbar!</string>
|
||||||
|
<string name="arrow">Pfeil</string>
|
||||||
|
<string name="vegan">Vegan</string>
|
||||||
|
<string name="vegetarian">Vegetarisch</string>
|
||||||
|
<string name="bio">Aus biologischem Anbau</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -70,4 +70,9 @@
|
|||||||
<string name="invalid_credentials">Invalid username or password!</string>
|
<string name="invalid_credentials">Invalid username or password!</string>
|
||||||
<string name="error_occurred_code">Error occurred: %1$d</string>
|
<string name="error_occurred_code">Error occurred: %1$d</string>
|
||||||
<string name="no_price_available">No price available!</string>
|
<string name="no_price_available">No price available!</string>
|
||||||
|
<string name="arrow">Arrow</string>
|
||||||
|
<string name="vegan">Vegan</string>
|
||||||
|
<string name="vegetarian">Vegetarian</string>
|
||||||
|
<string name="bio">Organic Food</string>
|
||||||
|
<string name="msc" translatable="false">MSC</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||