Code cleanup, spelling correction
@@ -1,12 +1,13 @@
|
||||
package de.sebse.fuplanner;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
|
||||
@@ -276,16 +276,16 @@ public class MainActivity extends AppCompatActivity
|
||||
if (loginToken == null) {
|
||||
toLogoutState();
|
||||
} 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);
|
||||
changeFragment(newFragment, newData);
|
||||
|
||||
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);
|
||||
setOfflineBanner(onlineMode);
|
||||
}
|
||||
@@ -475,7 +475,7 @@ public class MainActivity extends AppCompatActivity
|
||||
public void onLoginFragmentInteraction(LoginToken loginToken, boolean onlineMode) {
|
||||
String[] id = {""};
|
||||
int fragment = getDefaultFragmentAfterLogin(id);
|
||||
toLoginState(loginToken.getFullname(), loginToken.getEmail(), fragment, id[0], onlineMode);
|
||||
toLoginState(loginToken.getFullName(), loginToken.getEmail(), fragment, id[0], onlineMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -499,10 +499,19 @@ public class MainActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginTokenInvalid(boolean doPrecheck) {
|
||||
public void loginTokenInvalid(boolean doLoginCheck) {
|
||||
if (doLoginCheck) {
|
||||
getKVV().testLogin(isSuccess -> {
|
||||
if (!isSuccess) {
|
||||
getKVV().invalidate();
|
||||
checkAndDoLogin();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getKVV().invalidate();
|
||||
checkAndDoLogin();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshCompleted(boolean isFailed) {
|
||||
|
||||
@@ -157,9 +157,11 @@ public class ScheduleFragment extends Fragment implements MonthLoader.MonthChang
|
||||
Calendar firstVisibleDay = mWeekView.getFirstVisibleDay();
|
||||
Calendar c = Calendar.getInstance();
|
||||
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);
|
||||
while (firstVisibleDay.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
|
||||
firstVisibleDay.add(Calendar.DATE, -1);
|
||||
|
||||
@@ -34,7 +34,6 @@ public class DaySwitcherFragment extends Fragment implements DaySwitcherListener
|
||||
|
||||
private MainActivityListener mListener;
|
||||
private final Logger log = new Logger(this);
|
||||
private ViewPager mViewPager;
|
||||
private DaySwitcherAdapter adapterViewPager;
|
||||
|
||||
public DaySwitcherFragment() {
|
||||
@@ -78,11 +77,11 @@ public class DaySwitcherFragment extends Fragment implements DaySwitcherListener
|
||||
// Inflate the layout for this fragment
|
||||
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());
|
||||
mViewPager.setAdapter(adapterViewPager);
|
||||
|
||||
refresh(false);
|
||||
refresh();
|
||||
|
||||
return v;
|
||||
}
|
||||
@@ -104,8 +103,8 @@ public class DaySwitcherFragment extends Fragment implements DaySwitcherListener
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
private void refresh(boolean forceRefresh) {
|
||||
refresh(forceRefresh, null, null);
|
||||
private void refresh() {
|
||||
refresh(false, null, null);
|
||||
}
|
||||
|
||||
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};
|
||||
@StringRes
|
||||
private int CATEGORY_OTHER = R.string.others;
|
||||
private ArrayList<Object> matchings = new ArrayList<>();
|
||||
private ArrayList<Object> matches = new ArrayList<>();
|
||||
|
||||
private Day mDay = null;
|
||||
private final Context mContext;
|
||||
@@ -105,7 +105,7 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
viewHolder.mNotes.setText(string.toString());
|
||||
viewHolder.mCategory.setText(meal.getCategory());
|
||||
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.mIconMsc.setVisibility((meal.getCertificates() & Meal.CERT_MSC) != 0 ? View.VISIBLE : View.GONE);
|
||||
} else {
|
||||
@@ -116,23 +116,23 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return matchings.size();
|
||||
return matches.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
return this.mDay.get((Integer) matchings.get(position));
|
||||
return this.mDay.get((Integer) matches.get(position));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getHeading(int position) {
|
||||
return (String) matchings.get(position);
|
||||
private String getHeading(int position) {
|
||||
return (String) matches.get(position);
|
||||
}
|
||||
|
||||
public void setDay(Day day) {
|
||||
@@ -159,18 +159,18 @@ class MealAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
}
|
||||
list.add(i);
|
||||
}
|
||||
matchings.clear();
|
||||
matches.clear();
|
||||
for (int i = 0; i < CATEGORY_KEYS.length; i++) {
|
||||
ArrayList<Integer> list = map.get(CATEGORY_KEYS[i]);
|
||||
if (list != null) {
|
||||
matchings.add(mContext.getString(CATEGORY_VALS[i]));
|
||||
matchings.addAll(list);
|
||||
matches.add(mContext.getString(CATEGORY_VALS[i]));
|
||||
matches.addAll(list);
|
||||
}
|
||||
}
|
||||
ArrayList<Integer> list = map.get("---");
|
||||
if (list != null) {
|
||||
matchings.add(mContext.getString(CATEGORY_OTHER));
|
||||
matchings.addAll(list);
|
||||
matches.add(mContext.getString(CATEGORY_OTHER));
|
||||
matches.addAll(list);
|
||||
}
|
||||
this.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ public class MealFragment extends Fragment {
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param canteenId ID der Kantine.
|
||||
* @param dayPosition anzuzeigender Tag.
|
||||
* @param canteenId ID od current canteen.
|
||||
* @param dayPosition day to show.
|
||||
* @return A new instance of fragment MealFragment.
|
||||
*/
|
||||
public static MealFragment newInstance(int canteenId, int dayPosition) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class ModDetailAnnounceAdapter extends BaseExpandableListAdapter {
|
||||
private Modules.Module mModule = null;
|
||||
|
||||
@Override
|
||||
public String getChild(int groupPosition, int childPosititon) {
|
||||
public String getChild(int groupPosition, int childPosition) {
|
||||
StringBuilder s = new StringBuilder(this.getGroup(groupPosition).getBody());
|
||||
ArrayList<String> urls = this.getGroup(groupPosition).getUrls();
|
||||
for (int j =0; j<urls.size(); j++){
|
||||
|
||||
@@ -17,7 +17,7 @@ class ModDetailAssignmentAdapter extends BaseExpandableListAdapter {
|
||||
private Modules.Module mModule = null;
|
||||
|
||||
@Override
|
||||
public String getChild(int groupPosition, int childPosititon) {
|
||||
public String getChild(int groupPosition, int childPosition) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.getGroup(groupPosition).getInstructions());
|
||||
sb.append("\n\n");
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ModDetailResourceFragment extends Fragment {
|
||||
.setCancelable(true)
|
||||
.setNeutralButton(R.string.close, (dialog, id) -> dialog.cancel())
|
||||
.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()) {
|
||||
alertDialogBuilder
|
||||
.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 */
|
||||
public boolean isExternalStorageWritable() {
|
||||
private boolean isExternalStorageWritable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
if (Environment.MEDIA_MOUNTED.equals(state)) {
|
||||
return true;
|
||||
|
||||
@@ -232,9 +232,6 @@ public class CanteenBrowser extends HTTPService {
|
||||
|
||||
private NetworkErrorCallback errorOnCallback(NetworkErrorCallback errorCallback){
|
||||
return (error -> {
|
||||
if (error.getHttpStatus() == 401 || error.getHttpStatus() == 403)
|
||||
mListener.loginTokenInvalid(false);
|
||||
else
|
||||
mListener.onRefreshCompleted(true);
|
||||
errorCallback.onError(error);
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Canteens implements Serializable, Iterable<Canteen> {
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
public class Meal implements Serializable {
|
||||
public static final int LIGHT_NONE = 0;
|
||||
public static final int LIGHT_GREEN = 1;
|
||||
public static final int LIGHT_YELLOW = 2;
|
||||
public static final int LIGHT_RED = 3;
|
||||
public static final int VEGAN_NONE = 0;
|
||||
public static final int VEGAN_VEGETERIAN = 1;
|
||||
private static final int LIGHT_NONE = 0;
|
||||
private static final int LIGHT_GREEN = 1;
|
||||
private static final int LIGHT_YELLOW = 2;
|
||||
private static final int LIGHT_RED = 3;
|
||||
private static final int VEGAN_NONE = 0;
|
||||
public static final int VEGAN_VEGETARIAN = 1;
|
||||
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_MSC = 0b0010;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Meal implements Serializable {
|
||||
for (String note : notes) {
|
||||
switch (note.toLowerCase()) {
|
||||
case "vegetarisch":
|
||||
vegan = VEGAN_VEGETERIAN;
|
||||
vegan = VEGAN_VEGETARIAN;
|
||||
break;
|
||||
case "vegan":
|
||||
vegan = VEGAN_VEGAN;
|
||||
|
||||
@@ -148,6 +148,14 @@ public class KVV {
|
||||
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) {
|
||||
@@ -177,7 +185,7 @@ public class KVV {
|
||||
private NetworkErrorCallback errorOnCallback(NetworkErrorCallback errorCallback){
|
||||
return (error -> {
|
||||
if (error.getHttpStatus() == 401 || error.getHttpStatus() == 403)
|
||||
mListener.loginTokenInvalid(false);
|
||||
mListener.loginTokenInvalid(true);
|
||||
else
|
||||
mListener.onRefreshCompleted(true);
|
||||
errorCallback.onError(error);
|
||||
@@ -189,6 +197,11 @@ public class KVV {
|
||||
void apply(KVVModuleList mod);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface BooleanFunction {
|
||||
void apply(boolean isSuccess);
|
||||
}
|
||||
|
||||
private void getLastToken(LastTokenCallback lastTokenCallback) {
|
||||
if (this.isLoginPending) {
|
||||
this.updatingList.add(lastTokenCallback);
|
||||
|
||||
@@ -2,9 +2,6 @@ package de.sebse.fuplanner.services.KVV;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -26,7 +23,7 @@ class KVVLogin extends HTTPService {
|
||||
private LoginToken loginToken;
|
||||
|
||||
KVVLogin(Context context) {
|
||||
super(context, false);
|
||||
super(context);
|
||||
try {
|
||||
this.loginToken = LoginToken.load(context);
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -237,7 +237,7 @@ class KVVModuleList extends HTTPService {
|
||||
|
||||
|
||||
|
||||
//PDFs links rausziehen
|
||||
// Extract attachment links
|
||||
JSONArray attachments = site.getJSONArray("attachments");
|
||||
ArrayList<String> urls = new ArrayList<>();
|
||||
for (int j =0; j<attachments.length(); j++){
|
||||
@@ -497,15 +497,18 @@ class KVVModuleList extends HTTPService {
|
||||
}
|
||||
|
||||
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/"+ID+"/")){//ist File im Hauptordner
|
||||
if (res.getContainer().equals("/content/group/"+ID+"/")){
|
||||
// if file in root folder
|
||||
root.add(res);
|
||||
}
|
||||
else{
|
||||
for (Resource res2: resources) { // im Unterordner
|
||||
if (res2.getUrl().endsWith(res.getContainer()) && res2 instanceof Resource.Folder){
|
||||
((Resource.Folder) res2).add(res);//File bzw. Ordner anfügen
|
||||
} else {
|
||||
// in sub folder
|
||||
for (Resource res2: resources) {
|
||||
if (res2.getUrl().endsWith(res.getContainer()) && res2 instanceof Resource.Folder) {
|
||||
// Append File/Folder to list
|
||||
((Resource.Folder) res2).add(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -526,7 +529,8 @@ class KVVModuleList extends HTTPService {
|
||||
if (isExternalStorageReadable()){
|
||||
File f = new File(Environment.getExternalStoragePublicDirectory(
|
||||
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());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Announcement implements Serializable {
|
||||
return urls;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
private String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ public class Assignment implements Serializable {
|
||||
private final String id;
|
||||
private final String title;
|
||||
private final long dueTime;
|
||||
private final String gradebookItemName;
|
||||
private final String gradeScale;
|
||||
private final ArrayList<String> urls;
|
||||
private final String instructions;
|
||||
|
||||
@@ -16,14 +14,12 @@ public class Assignment implements Serializable {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.dueTime = dueTime;
|
||||
this.gradebookItemName = gradebookItemName;
|
||||
this.gradeScale = gradeScale;
|
||||
this.urls = urls;
|
||||
//this.grade = grade;
|
||||
this.instructions = instructions;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
private String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -52,6 +48,6 @@ public class Assignment implements Serializable {
|
||||
return "ID: "+getId()+
|
||||
"\nTitle: "+getTitle()+
|
||||
"\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;
|
||||
|
||||
public class Lecturer implements Serializable {
|
||||
private final String firstname;
|
||||
private final String firstName;
|
||||
private final String surname;
|
||||
private final String mail;
|
||||
|
||||
@@ -15,26 +15,26 @@ public class Lecturer implements Serializable {
|
||||
if (!matcher.find()) {
|
||||
throw new NoSuchFieldException();
|
||||
}
|
||||
this.firstname = matcher.group(1);
|
||||
this.firstName = matcher.group(1);
|
||||
this.surname = matcher.group(2);
|
||||
this.mail = matcher.group(3);
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
private String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
private String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
public String getMail() {
|
||||
private String getMail() {
|
||||
return mail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "First name: "+getFirstname()+
|
||||
return "First name: "+ getFirstName()+
|
||||
"\nSurname: "+getSurname()+
|
||||
"\nMail: "+getMail();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class LoginToken implements Serializable {
|
||||
private final String shibsessionKey;
|
||||
private final String shibsessionName;
|
||||
private final String JSESSIONID;
|
||||
private String fullname;
|
||||
private String fullName;
|
||||
private String email;
|
||||
private long saveDate = 0;
|
||||
|
||||
@@ -59,8 +59,8 @@ public class LoginToken implements Serializable {
|
||||
context.deleteFile(FILE_NAME);
|
||||
}
|
||||
|
||||
public void setAdditionals(String fullname, String email) {
|
||||
this.fullname = fullname;
|
||||
public void setAdditionals(String fullName, String email) {
|
||||
this.fullName = fullName;
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ public class LoginToken implements Serializable {
|
||||
return JSESSIONID;
|
||||
}
|
||||
|
||||
public String getFullname() {
|
||||
return fullname;
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
|
||||
@@ -104,9 +104,9 @@ public class Modules implements Iterable<Modules.Module>, Serializable {
|
||||
|
||||
public class Module implements Serializable {
|
||||
public final String semester;
|
||||
public final HashSet<String> lvNumber;
|
||||
final HashSet<String> lvNumber;
|
||||
public final String title;
|
||||
public final HashSet<Lecturer> lecturer;
|
||||
final HashSet<Lecturer> lecturer;
|
||||
public final String type;
|
||||
public final String description;
|
||||
private final String ID;
|
||||
|
||||
@@ -11,15 +11,15 @@ import de.sebse.fuplanner.tools.ui.treeview.TreeNode;
|
||||
|
||||
public abstract class Resource implements Serializable {
|
||||
|
||||
protected final String author;
|
||||
protected final long modifiedDate;
|
||||
protected final String title;
|
||||
protected final String url;
|
||||
protected final boolean visible;
|
||||
protected final String container;
|
||||
final String author;
|
||||
final long modifiedDate;
|
||||
final String title;
|
||||
final String url;
|
||||
private final boolean visible;
|
||||
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.title = title;
|
||||
this.modifiedDate = modifiedDate;
|
||||
@@ -86,22 +86,22 @@ public abstract class Resource implements Serializable {
|
||||
|
||||
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) {
|
||||
super(author, title, modifiedDate, url, visible, container);
|
||||
childs = new ArrayList<>();
|
||||
children = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void add(Resource res){
|
||||
childs.add(res);
|
||||
children.add(res);
|
||||
}
|
||||
|
||||
public Resource get(int id){
|
||||
return childs.get(id);
|
||||
return children.get(id);
|
||||
}
|
||||
|
||||
public int size(){
|
||||
return childs.size();
|
||||
return children.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,14 +111,14 @@ public abstract class Resource implements Serializable {
|
||||
", modifiedDate=" + modifiedDate +
|
||||
", title='" + title + '\'' +
|
||||
", url='" + url + '\'' +
|
||||
", childs='" + childs + '\'' +
|
||||
", children='" + children + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeNode getTreeNode() {
|
||||
TreeNode dir = new TreeNode<>(this);
|
||||
for (Resource res: childs) {
|
||||
for (Resource res: children) {
|
||||
dir.addChild(res.getTreeNode());
|
||||
}
|
||||
return dir;
|
||||
|
||||
@@ -8,7 +8,7 @@ import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
||||
|
||||
public class AsyncQueue {
|
||||
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) {
|
||||
if (isRunning(hash))
|
||||
@@ -46,11 +46,11 @@ public class AsyncQueue {
|
||||
}
|
||||
|
||||
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) {
|
||||
mRunnings.put(hash, value);
|
||||
mIsRunning.put(hash, value);
|
||||
}
|
||||
|
||||
private LinkedList<AsyncQueueCallback> getQueue(String hash) {
|
||||
|
||||
@@ -7,7 +7,7 @@ public class ColorRGB implements Color {
|
||||
private final int mGreen;
|
||||
private final int mBlue;
|
||||
|
||||
public ColorRGB(int red, int green, int blue) {
|
||||
private ColorRGB(int red, int green, int blue) {
|
||||
this.mRed = red;
|
||||
this.mGreen = green;
|
||||
this.mBlue = blue;
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface MainActivityListener {
|
||||
|
||||
GoogleAuth getGoogleAuth();
|
||||
|
||||
void loginTokenInvalid(boolean doPrecheck);
|
||||
void loginTokenInvalid(boolean doLoginCheck);
|
||||
|
||||
void onRefreshCompleted(boolean isFailed);
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import java.util.regex.MatchResult;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.sebse.fuplanner.tools.logging.Logger;
|
||||
|
||||
public class Regex {
|
||||
public static boolean has(@Language("Regexp") String regex, String match) {
|
||||
try {
|
||||
|
||||
@@ -25,6 +25,7 @@ public abstract class SortedList<T, I, F> implements Iterable<T>, Serializable {
|
||||
|
||||
protected abstract boolean hasIdentifier(T o1, I id);
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
protected abstract boolean hasFilter(T o1, F filter);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -7,8 +7,6 @@ import android.os.Build;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.format.DateFormat;
|
||||
|
||||
import com.google.android.gms.common.logging.Logger;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -8,8 +8,7 @@ public class UtilsUi {
|
||||
public static float convertPixelsToDp(float px, Context context) {
|
||||
Resources resources = context.getResources();
|
||||
DisplayMetrics metrics = resources.getDisplayMetrics();
|
||||
float dp = px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
|
||||
return dp;
|
||||
return px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
|
||||
}
|
||||
|
||||
public static float convertDpToPixels(Context context, float dp) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Logger {
|
||||
this.tag = getClassName(object);
|
||||
}
|
||||
|
||||
public static String getClassName(Object object) {
|
||||
private static String getClassName(Object object) {
|
||||
if (object instanceof String)
|
||||
return (String) object;
|
||||
else
|
||||
|
||||
@@ -47,14 +47,14 @@ public class BetterHurlStack extends HurlStack {
|
||||
/**
|
||||
* @param urlRewriter Rewriter to use for request URLs
|
||||
*/
|
||||
BetterHurlStack(boolean followRedirects, UrlRewriter urlRewriter) {
|
||||
private BetterHurlStack(boolean followRedirects, UrlRewriter urlRewriter) {
|
||||
this(followRedirects, urlRewriter, null);
|
||||
}
|
||||
/**
|
||||
* @param urlRewriter Rewriter to use for request URLs
|
||||
* @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);
|
||||
mUrlRewriter = urlRewriter;
|
||||
mSslSocketFactory = sslSocketFactory;
|
||||
@@ -123,7 +123,7 @@ public class BetterHurlStack extends HurlStack {
|
||||
}
|
||||
|
||||
@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());
|
||||
for (Map.Entry<String, List<String>> entry : responseHeaders.entrySet()) {
|
||||
// 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
|
||||
// checked against the existing properties in the connection and not overridden if already set.
|
||||
@SuppressWarnings("deprecation")
|
||||
/* package */ static void setConnectionParametersForRequest(
|
||||
/* package */ private static void setConnectionParametersForRequest(
|
||||
HttpURLConnection connection, Request<?> request) throws IOException, AuthFailureError {
|
||||
switch (request.getMethod()) {
|
||||
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}.
|
||||
*
|
||||
* @param connection
|
||||
* @param connection A http url connection
|
||||
* @return an HttpEntity populated with data from <code>connection</code>.
|
||||
*/
|
||||
private static InputStream inputStreamFromConnection(HttpURLConnection connection) {
|
||||
|
||||
@@ -29,12 +29,8 @@ public class HTTPService {
|
||||
protected Logger log = new Logger(this);
|
||||
|
||||
protected HTTPService(Context context) {
|
||||
this(context, false);
|
||||
}
|
||||
|
||||
protected HTTPService(Context context, boolean followRedirects) {
|
||||
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) {
|
||||
@@ -42,14 +38,14 @@ public class HTTPService {
|
||||
@Override
|
||||
public void deliverError(VolleyError error) {
|
||||
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) {
|
||||
int statusCode;
|
||||
if (error instanceof TimeoutError)
|
||||
statusCode = 408;
|
||||
else
|
||||
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 {
|
||||
final int status = error.networkResponse.statusCode;
|
||||
if (status == 302) {
|
||||
@@ -98,7 +94,6 @@ public class HTTPService {
|
||||
sb.append('&');
|
||||
}
|
||||
try {
|
||||
//Log.e("Superissimo", e.getKey()+"|||"+e.getValue());
|
||||
sb.append(URLEncoder.encode(e.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(e.getValue(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
}
|
||||
@@ -114,14 +109,14 @@ public class HTTPService {
|
||||
@Override
|
||||
public void deliverError(VolleyError error) {
|
||||
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) {
|
||||
int statusCode;
|
||||
if (error instanceof TimeoutError)
|
||||
statusCode = 408;
|
||||
else
|
||||
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 {
|
||||
final int status = error.networkResponse.statusCode;
|
||||
if (status == 302) {
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.toolbox.HttpHeaderParser;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 24.10.17.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ public class NetworkError {
|
||||
return httpStatus;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
private String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ import com.android.volley.toolbox.HttpHeaderParser;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
|
||||
import de.sebse.fuplanner.tools.logging.Logger;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 24.10.17.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ExpandableCardViewHolder extends CustomViewHolder {
|
||||
getView().reset();
|
||||
}
|
||||
|
||||
ExpandableCardView getView() {
|
||||
private ExpandableCardView getView() {
|
||||
return (ExpandableCardView) mView;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ItemViewHolder extends CustomViewHolder {
|
||||
public final TextView mTitle;
|
||||
public final TextView mSubLeft;
|
||||
public final TextView mSubRight;
|
||||
public final TextView mTopRight;
|
||||
private final TextView mTopRight;
|
||||
|
||||
public ItemViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package de.sebse.fuplanner.tools.ui;
|
||||
|
||||
import android.media.Image;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
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 final TextView mTitle;
|
||||
@@ -33,7 +28,7 @@ public class MealViewHolder extends ExpandableCardViewHolder {
|
||||
mCategory = innerView.findViewById(R.id.category);
|
||||
mIconVegan = innerView.findViewById(R.id.icon_vegan);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ExpandableCardView extends CardView {
|
||||
private View outerView;
|
||||
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 final static int COLLAPSING = 0;
|
||||
@@ -187,7 +187,7 @@ public class ExpandableCardView extends CardView {
|
||||
setMeasuredDimension(reconcileSize(desiredWidth, widthMeasureSpec), reconcileSize(isExpanded ? expandedHeight : collapsedHeight, heightMeasureSpec));
|
||||
}
|
||||
|
||||
public void expand() {
|
||||
private void expand() {
|
||||
final int initialHeight = this.getHeight();
|
||||
int targetHeight = expandedHeight;
|
||||
|
||||
@@ -196,7 +196,7 @@ public class ExpandableCardView extends CardView {
|
||||
}
|
||||
}
|
||||
|
||||
public void collapse() {
|
||||
private void collapse() {
|
||||
final int initialHeight = this.getHeight();
|
||||
int targetHeight = collapsedHeight;
|
||||
|
||||
@@ -206,7 +206,7 @@ public class ExpandableCardView extends CardView {
|
||||
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
private boolean isExpanded() {
|
||||
return isExpanded;
|
||||
}
|
||||
|
||||
@@ -300,11 +300,11 @@ public class ExpandableCardView extends CardView {
|
||||
super.setOnClickListener(l);
|
||||
}
|
||||
|
||||
public long getAnimDuration() {
|
||||
private long getAnimDuration() {
|
||||
return animDuration;
|
||||
}
|
||||
|
||||
public void setAnimDuration(long animDuration) {
|
||||
private void setAnimDuration(long animDuration) {
|
||||
this.animDuration = animDuration;
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ public class ExpandableCardView extends CardView {
|
||||
* Interfaces
|
||||
*/
|
||||
|
||||
public interface OnExpandedListener {
|
||||
interface OnExpandedListener {
|
||||
|
||||
void onExpandChanged(View v, boolean isExpanded);
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ public class DirectoryNodeBinder extends TreeViewBinder<DirectoryNodeBinder.View
|
||||
private ImageView ivArrow;
|
||||
private TextView tvName;
|
||||
|
||||
public ViewHolder(View rootView) {
|
||||
ViewHolder(View rootView) {
|
||||
super(rootView);
|
||||
this.ivArrow = (ImageView) rootView.findViewById(R.id.iv_arrow);
|
||||
this.tvName = (TextView) rootView.findViewById(R.id.tv_name);
|
||||
this.ivArrow = rootView.findViewById(R.id.iv_arrow);
|
||||
this.tvName = rootView.findViewById(R.id.tv_name);
|
||||
}
|
||||
|
||||
public ImageView getIvArrow() {
|
||||
|
||||
@@ -28,11 +28,11 @@ public class FileNodeBinder extends TreeViewBinder<FileNodeBinder.ViewHolder> {
|
||||
}
|
||||
|
||||
public class ViewHolder extends TreeViewBinder.ViewHolder {
|
||||
public TextView tvName;
|
||||
TextView tvName;
|
||||
|
||||
public ViewHolder(View rootView) {
|
||||
ViewHolder(View 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)
|
||||
childList = new ArrayList<>();
|
||||
childList.add(node);
|
||||
node.parent = this;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean toggle() {
|
||||
public void toggle() {
|
||||
isExpand = !isExpand;
|
||||
return isExpand;
|
||||
}
|
||||
|
||||
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()) {
|
||||
return;
|
||||
}
|
||||
@@ -88,13 +86,13 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public void expand() {
|
||||
private void expand() {
|
||||
if (!isExpand) {
|
||||
isExpand = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void expandAll() {
|
||||
private void expandAll() {
|
||||
expand();
|
||||
if (childList == null || childList.isEmpty()) {
|
||||
return;
|
||||
@@ -141,7 +139,7 @@ public class TreeNode<T extends LayoutItemType> implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TreeNode<T> clone() throws CloneNotSupportedException {
|
||||
protected TreeNode<T> clone() {
|
||||
TreeNode<T> clone = new TreeNode<>(this.content);
|
||||
clone.isExpand = this.isExpand;
|
||||
return clone;
|
||||
|
||||
@@ -25,11 +25,11 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
private OnTreeNodeListener onTreeNodeListener;
|
||||
private boolean toCollapseChild;
|
||||
|
||||
public TreeViewAdapter(List<? extends TreeViewBinder> viewBinders) {
|
||||
protected TreeViewAdapter(List<? extends TreeViewBinder> 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<>();
|
||||
if (nodes != null)
|
||||
findDisplayNodes(nodes);
|
||||
@@ -188,7 +188,7 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
void onToggle(boolean isExpand, RecyclerView.ViewHolder holder);
|
||||
}
|
||||
|
||||
public void refresh(List<TreeNode> treeNodes) {
|
||||
protected void refresh(List<TreeNode> treeNodes) {
|
||||
displayNodes.clear();
|
||||
findDisplayNodes(treeNodes);
|
||||
notifyDataSetChanged();
|
||||
@@ -276,11 +276,7 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
private List<TreeNode> backupDisplayNodes() {
|
||||
List<TreeNode> temp = new ArrayList<>();
|
||||
for (TreeNode displayNode : displayNodes) {
|
||||
try {
|
||||
temp.add(displayNode.clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
temp.add(displayNode);
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public abstract class TreeViewBinder<VH extends RecyclerView.ViewHolder> impleme
|
||||
}
|
||||
|
||||
protected <T extends View> T findViewById(@IdRes int id) {
|
||||
//noinspection unchecked
|
||||
return (T) itemView.findViewById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ import static de.sebse.fuplanner.tools.ui.weekview.WeekViewUtil.today;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class WeekView extends View {
|
||||
///////////////////////////////////////////Änderung in zeile 991 überprüfen!!!!!!!!!!!!!!!!!!!!!
|
||||
private enum Direction {
|
||||
NONE, LEFT, RIGHT, VERTICAL
|
||||
}
|
||||
@@ -361,8 +360,8 @@ public class WeekView extends View {
|
||||
selectedTime.set(Calendar.HOUR_OF_DAY, mMinTime);
|
||||
selectedTime.set(Calendar.MINUTE, 0);
|
||||
}
|
||||
int unroundedMinutes = selectedTime.get(Calendar.MINUTE);
|
||||
int mod = unroundedMinutes % mNewEventTimeResolutionInMinutes;
|
||||
int nonRoundedMinutes = selectedTime.get(Calendar.MINUTE);
|
||||
int mod = nonRoundedMinutes % mNewEventTimeResolutionInMinutes;
|
||||
selectedTime.add(Calendar.MINUTE, mod < Math.ceil(mNewEventTimeResolutionInMinutes / 2) ? -mod : (mNewEventTimeResolutionInMinutes - mod));
|
||||
|
||||
Calendar endTime = (Calendar) selectedTime.clone();
|
||||
@@ -1261,8 +1260,8 @@ public class WeekView extends View {
|
||||
*/
|
||||
private class EventRect {
|
||||
public WeekViewEvent event;
|
||||
public WeekViewEvent originalEvent;
|
||||
public RectF rectF;
|
||||
WeekViewEvent originalEvent;
|
||||
RectF rectF;
|
||||
public float left;
|
||||
public float width;
|
||||
public float top;
|
||||
@@ -2422,7 +2421,7 @@ public class WeekView extends View {
|
||||
/**
|
||||
* Set the scroll duration
|
||||
*
|
||||
* @param scrollDuration the new scrollDuraction
|
||||
* @param scrollDuration the new scrollDuration
|
||||
*/
|
||||
public void setScrollDuration(int scrollDuration) {
|
||||
mScrollDuration = scrollDuration;
|
||||
@@ -2526,7 +2525,7 @@ public class WeekView extends View {
|
||||
// Check after call of mGestureDetector, so mCurrentFlingDirection and mCurrentScrollDirection are set.
|
||||
if (event.getAction() == MotionEvent.ACTION_UP && !mIsZooming && mCurrentFlingDirection == Direction.NONE) {
|
||||
if (mCurrentScrollDirection == Direction.RIGHT || mCurrentScrollDirection == Direction.LEFT) {
|
||||
goToNearestOrigin();
|
||||
performClick();
|
||||
}
|
||||
mCurrentScrollDirection = Direction.NONE;
|
||||
}
|
||||
@@ -2534,6 +2533,13 @@ public class WeekView extends View {
|
||||
return val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performClick() {
|
||||
super.performClick();
|
||||
goToNearestOrigin();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void goToNearestOrigin() {
|
||||
double leftDays = mCurrentOrigin.x / (mWidthPerDay + mColumnGap);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class WeekViewEvent {
|
||||
* @param allDay Is the event an all day event.
|
||||
* @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.mName = name;
|
||||
this.mLocation = location;
|
||||
@@ -96,7 +96,7 @@ public class WeekViewEvent {
|
||||
* @param endTime The time when the event ends.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Calendar;
|
||||
/**
|
||||
* Created by jesse on 6/02/2016.
|
||||
*/
|
||||
public class WeekViewUtil {
|
||||
class WeekViewUtil {
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
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
|
||||
android:id="@+id/tv_name"
|
||||
|
||||
@@ -46,6 +46,6 @@
|
||||
android:textSize="12sp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
tools:text="Raum 105"
|
||||
tools:text="Room 105"
|
||||
tools:ignore="RelativeOverlap" />
|
||||
</RelativeLayout>
|
||||
@@ -26,27 +26,27 @@
|
||||
android:src="@mipmap/ic_vegan"
|
||||
android:id="@+id/icon_vegan"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
android:contentDescription="@string/vegan" />
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@mipmap/ic_vegetarian"
|
||||
android:id="@+id/icon_vegetarian"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
android:contentDescription="@string/vegetarian" />
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@mipmap/ic_msc"
|
||||
android:id="@+id/icon_msc"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
android:contentDescription="@string/msc" />
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@mipmap/ic_bio"
|
||||
android:id="@+id/icon_bio"
|
||||
android:src="@mipmap/ic_organic"
|
||||
android:id="@+id/icon_organic"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
android:contentDescription="@string/bio" />
|
||||
</LinearLayout>
|
||||
</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="error_occurred_code">Fehler %1$d aufgetreten!</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>
|
||||
@@ -70,4 +70,9 @@
|
||||
<string name="invalid_credentials">Invalid username or password!</string>
|
||||
<string name="error_occurred_code">Error occurred: %1$d</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>
|
||||
|
||||