diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index 76fc21a..32de3b8 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/app/build.gradle b/app/build.gradle index 09d64c8..86579c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,15 +5,15 @@ android { compileSdkVersion 28 defaultConfig { applicationId "at.smartshopper.smartshopperapp" - minSdkVersion 23 + minSdkVersion 21 targetSdkVersion 28 - versionCode 14 - versionName "4.4" + versionCode 19 + versionName "5.0.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/app/debug/output.json b/app/debug/output.json index 1a1b359..997bfb3 100644 --- a/app/debug/output.json +++ b/app/debug/output.json @@ -1 +1,19 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":4,"versionName":"3.1","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}] \ No newline at end of file +[ + { + "outputType": { + "type": "APK" + }, + "apkInfo": { + "type": "MAIN", + "splits": [], + "versionCode": 4, + "versionName": "3.1", + "enabled": true, + "outputFile": "app-debug.apk", + "fullName": "debug", + "baseName": "debug" + }, + "path": "app-debug.apk", + "properties": {} + } +] \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f1b4245..6edb20b 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -19,3 +19,4 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile +-dontwarn org.postgresql.** \ No newline at end of file diff --git a/app/release/app.aab b/app/release/app.aab index b82237c..d13d5ee 100644 Binary files a/app/release/app.aab and b/app/release/app.aab differ diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/Dash.java b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/Dash.java index f90b714..c35077f 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/Dash.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/Dash.java @@ -12,7 +12,7 @@ import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; -import android.support.v4.content.ContextCompat; +import android.support.v4.graphics.ColorUtils; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; @@ -98,7 +98,13 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte if (resultCode == RESULT_OK) { int color = Integer.parseInt(data.getData().toString()); this.color = colorToHexString(color); - colorBtn.setBackgroundTintList(ColorStateList.valueOf(color)); + int colorint = Color.parseColor(this.color); + colorBtn.setBackgroundTintList(ColorStateList.valueOf(colorint)); + if(ColorUtils.calculateLuminance(colorint)>0.5){ + colorBtn.setTextColor(Color.parseColor("#000000")); // It's a light color + }else{ + colorBtn.setTextColor(Color.parseColor("#FFFFFF")); // It's a dark color + } } } } @@ -122,17 +128,9 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte Log.w("SmartShopper", "getInstanceId failed", task.getException()); return; } - // Get new Instance ID token String token = task.getResult().getToken(); Log.d("SmartShopper MSG", token); - - /* Log and toast - String msg = getString(R.string.msg_token_fmt, token); - Log.d(TAG, msg); - Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show(); - - */ } }); } @@ -162,19 +160,6 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte e.printStackTrace(); } // Damit werden die Shared Shoppinglists angezeigt - - -// try { -// TabHost tabhost = (TabHost) findViewById(R.id.tabHost1); -// tabhost.setCurrentTab(1); -// sharedswiperefresh.setRefreshing(true); -// showSharedShoppingList(FirebaseAuth.getInstance().getCurrentUser().getUid()); -// sharedswiperefresh.setRefreshing(false); -// } catch (JSONException e) { -// e.printStackTrace(); -// } catch (SQLException e) { -// e.printStackTrace(); -// } //Damit wird die hinzugefügte shoppinglist angezeigt onShoppinglistClickContainer(sl_idToGo); } @@ -210,7 +195,6 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte host.setCurrentTab(1); } } - try { try { showOwnShoppingList(uid); @@ -221,7 +205,6 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte } catch (JSONException e) { e.printStackTrace(); } - sharedswiperefresh = (SwipeRefreshLayout) findViewById(R.id.sharedSwipe); sharedswiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @@ -338,7 +321,13 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte colorstring = "#" + dbShoppinglist.getcolor(); } this.color = colorstring; - colorBtn.setBackgroundColor(Color.parseColor(colorstring)); + int colorint = Color.parseColor(colorstring); + colorBtn.setBackgroundTintList(ColorStateList.valueOf(colorint)); + if(ColorUtils.calculateLuminance(colorint)>0.5){ + colorBtn.setTextColor(Color.parseColor("#000000")); // It's a light color + }else{ + colorBtn.setTextColor(Color.parseColor("#FFFFFF")); // It's a dark color + } name.setText(dbShoppinglist.getname()); description.setText(dbShoppinglist.getdescription()); } else { @@ -930,16 +919,6 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte startActivity(Intent.createChooser(sharingIntent, "Teile mit")); } }); - -// final Button copyButton = (Button) popupContentView.findViewById(R.id.shareCopy); -// copyButton.setOnClickListener(new View.OnClickListener() { -// @Override -// public void onClick(View v) { -// copyText(linkausgabe.getText().toString()); -// popupShare.dismiss(); -// } -// }); - Button delShare = (Button) popupContentView.findViewById(R.id.delShare); final String finalLink = link; @@ -1191,13 +1170,6 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte popupEditShare.dismiss(); } }); -// copyBtn.setOnClickListener(new View.OnClickListener() { -// @Override -// public void onClick(View v) { -// copyText(linkAusgabe.getText().toString()); -// popupEditShare.dismiss(); -// } -// }); ImageButton shareIntentBtn = popupContentView.findViewById(R.id.shareIntentBtn); Picasso.get().load(R.drawable.share).into(shareIntentBtn); shareIntentBtn.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/DoneItemActivity.java b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/DoneItemActivity.java index bc6e6b8..c7a2d93 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/DoneItemActivity.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/DoneItemActivity.java @@ -6,7 +6,6 @@ import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/EditUser.java b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/EditUser.java index c335a5e..c9d450f 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/EditUser.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/EditUser.java @@ -279,132 +279,6 @@ public class EditUser extends Activity { break; } } - - -// // code for device below 5 -// private boolean performCropImage(Uri mFinalImageUri) { -// Uri mCropImagedUri; -// try { -// if (mFinalImageUri != null) { -// //call the standard crop action intent (the user device may not support it) -// Intent cropIntent = new Intent("com.android.camera.action.CROP"); -// //indicate image type and Uri -// cropIntent.setDataAndType(mFinalImageUri, "image/*"); -// //set crop properties -// cropIntent.putExtra("crop", "true"); -// //indicate aspect of desired crop -// cropIntent.putExtra("aspectX", 1); -// cropIntent.putExtra("aspectY", 1); -// cropIntent.putExtra("scale", true); -// // cropIntent.p -// //indicate output X and Y -// cropIntent.putExtra("outputX", 200); -// cropIntent.putExtra("outputY", 200); -// //retrieve data on return -// cropIntent.putExtra("return-data", false); -// -// File f = new File("CROP_"); -// try { -// f.createNewFile(); -// } catch (IOException ex) { -// Log.e("io", ex.getMessage()); -// } -// -// mCropImagedUri = Uri.fromFile(f); -// cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCropImagedUri); -// //start the activity - we handle returning in onActivityResult -// startActivityForResult(cropIntent, 2); -// return true; -// } -// } catch (ActivityNotFoundException anfe) { -// //display an error message -// String errorMessage = getString('2'); -// Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT); -// toast.show(); -// return false; -// } -// return false; -// } -// -// // code for 5 or 6 -// private void performCrop(Uri picUri) { -// try { -// -// Intent cropIntent = new Intent("com.android.camera.action.CROP"); -// // indicate image type and Uri -// cropIntent.setDataAndType(picUri, "image/*"); -// // set crop properties -// cropIntent.putExtra("crop", "true"); -// // indicate aspect of desired crop -// cropIntent.putExtra("aspectX", 1); -// cropIntent.putExtra("aspectY", 1); -// // indicate output X and Y -// cropIntent.putExtra("outputX", 200); -// cropIntent.putExtra("outputY", 200); -// // retrieve data on return -// cropIntent.putExtra("return-data", true); -// // start the activity - we handle returning in onActivityResult -// startActivityForResult(cropIntent, 2); -// } -// // respond to users whose devices do not support the crop action -// catch (ActivityNotFoundException anfe) { -// // display an error message -// String errorMessage = getString('2'); -// Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT); -// toast.show(); -// } -// } -// -// @Override -// public void onActivityResult(int requestCode, int resultCode, Intent data) { -// -// final InputStream imageStream; -// -// -// if (requestCode == 1) { -// imageUri = data.getData(); -// try { -// imageStream = getContentResolver().openInputStream(imageUri); -// BitmapFactory.Options options = new BitmapFactory.Options(); -// options.inJustDecodeBounds = true; -// selectedImage = BitmapFactory.decodeFile(imageUri.toString(), options); -// -// } catch (FileNotFoundException e) { -// e.printStackTrace(); -// } -// if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) { -// performCrop(imageUri); -// } else { -// performCropImage(imageUri); -// } -// -// } else if (requestCode == 2) { -// try { -// if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) { -// Bundle extras = data.getExtras(); -// selectedImage = extras.getParcelable("data"); -// } else { -// selectedImage = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri); -// -// } -// userBitmap = selectedImage; -// userbild.setImageBitmap(selectedImage); -// } catch (FileNotFoundException e) { -// e.printStackTrace(); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// } -// -// private Uri getImageUri(Context context, Bitmap inImage) { -// ByteArrayOutputStream bytes = new ByteArrayOutputStream(); -// inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); -// String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), inImage, "Title", null); -// return Uri.parse(path); -// } - - private Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ItemListActivity.java b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ItemListActivity.java index 2b31c98..6f38086 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ItemListActivity.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ItemListActivity.java @@ -2,9 +2,12 @@ package at.smartshopper.smartshopperapp.activitys; import android.content.Intent; import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; +import android.support.v4.graphics.ColorUtils; +import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; @@ -83,7 +86,25 @@ public class ItemListActivity extends AppCompatActivity implements ItemAdapter.O } else { colorstring = "#" + colorToolbar; } - toolbar.setBackgroundColor(Color.parseColor(colorstring)); + int backgroundcolor = Color.parseColor(colorstring); + toolbar.setBackgroundColor(backgroundcolor); + if(ColorUtils.calculateLuminance(backgroundcolor)>0.5){ + toolbar.setTitleTextColor(Color.parseColor("#000000")); // It's a light color + Drawable drawable = toolbar.getOverflowIcon(); + if(drawable != null) { + drawable = DrawableCompat.wrap(drawable); + DrawableCompat.setTint(drawable.mutate(), Color.parseColor("#000000")); + toolbar.setOverflowIcon(drawable); + } + }else{ + toolbar.setTitleTextColor(Color.parseColor("#FFFFFF")); // It's a dark color + Drawable drawable = toolbar.getOverflowIcon(); + if(drawable != null) { + drawable = DrawableCompat.wrap(drawable); + DrawableCompat.setTint(drawable.mutate(), Color.parseColor("#FFFFFF")); + toolbar.setOverflowIcon(drawable); + } + } setSupportActionBar(toolbar); this.groupName = (TextView) findViewById(R.id.groupViewName); diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/LoginActivity.java b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/LoginActivity.java index 1bc400e..bfa181c 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/LoginActivity.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/LoginActivity.java @@ -54,7 +54,7 @@ public class LoginActivity extends AppCompatActivity { //Für Double Back press to exit private boolean doubleBackToExitPressedOnce = false; - public void getDynamicLink(){ + public void getDynamicLink() { FirebaseDynamicLinks.getInstance() .getDynamicLink(getIntent()) .addOnSuccessListener(this, new OnSuccessListener() { @@ -76,7 +76,6 @@ public class LoginActivity extends AppCompatActivity { } - // Handle the deep link. For example, open the linked // content, or apply promotional credit to the user's // account. @@ -93,6 +92,7 @@ public class LoginActivity extends AppCompatActivity { }); } + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); @@ -170,7 +170,7 @@ public class LoginActivity extends AppCompatActivity { Intent intent = new Intent(this, Dash.class); - if(sl_idToGo != null){ + if (sl_idToGo != null) { intent.putExtra("sl_idToGo", sl_idToGo); intent.putExtra("inviteToAdd", inviteToAdd); } @@ -243,7 +243,7 @@ public class LoginActivity extends AppCompatActivity { mAuth = FirebaseAuth.getInstance(); db = new Database(); - Button register = (Button)findViewById(R.id.registrierenBtn); + Button register = (Button) findViewById(R.id.registrierenBtn); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -268,9 +268,9 @@ public class LoginActivity extends AppCompatActivity { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { - if(!email.getText().toString().isEmpty() && !passwort.getText().toString().isEmpty()){ + if (!email.getText().toString().isEmpty() && !passwort.getText().toString().isEmpty()) { loginEmailBtn.setEnabled(true); - }else{ + } else { loginEmailBtn.setEnabled(false); } } @@ -288,9 +288,9 @@ public class LoginActivity extends AppCompatActivity { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { - if(!email.getText().toString().isEmpty() && !passwort.getText().toString().isEmpty()){ + if (!email.getText().toString().isEmpty() && !passwort.getText().toString().isEmpty()) { loginEmailBtn.setEnabled(true); - }else{ + } else { loginEmailBtn.setEnabled(false); } } diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ShoppinglistDetails.java b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ShoppinglistDetails.java index b08be24..f194e69 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ShoppinglistDetails.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ShoppinglistDetails.java @@ -3,9 +3,12 @@ package at.smartshopper.smartshopperapp.activitys; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; +import android.support.v4.graphics.ColorUtils; +import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; @@ -13,6 +16,7 @@ import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; +import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; @@ -129,7 +133,7 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda Shoppinglist shoppinglist = null; try { - shoppinglist = db.getShoppinglist(sl_id); + shoppinglist = db.getShoppinglist(sl_id); } catch (SQLException e) { e.printStackTrace(); } catch (JSONException e) { @@ -143,7 +147,25 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda } else { colorstring = "#" + shoppinglist.getcolor(); } - toolbar.setBackgroundColor(Color.parseColor(colorstring)); + int backgroundcolor = Color.parseColor(colorstring); + toolbar.setBackgroundColor(backgroundcolor); + if(ColorUtils.calculateLuminance(backgroundcolor)>0.5){ + toolbar.setTitleTextColor(Color.parseColor("#000000")); // It's a light color + Drawable drawable = toolbar.getOverflowIcon(); + if(drawable != null) { + drawable = DrawableCompat.wrap(drawable); + DrawableCompat.setTint(drawable.mutate(), Color.parseColor("#000000")); + toolbar.setOverflowIcon(drawable); + } + }else{ + toolbar.setTitleTextColor(Color.parseColor("#FFFFFF")); // It's a dark color + Drawable drawable = toolbar.getOverflowIcon(); + if(drawable != null) { + drawable = DrawableCompat.wrap(drawable); + DrawableCompat.setTint(drawable.mutate(), Color.parseColor("#FFFFFF")); + toolbar.setOverflowIcon(drawable); + } + } setSupportActionBar(toolbar); final String finalSl_id = sl_id; @@ -222,7 +244,13 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda } else { colorstring = "#" + dbgroup.getColor(); } - color.setBackgroundColor(Color.parseColor(colorstring)); + int colorint = Color.parseColor(colorstring); + colorBtn.setBackgroundTintList(ColorStateList.valueOf(colorint)); + if(ColorUtils.calculateLuminance(colorint)>0.5){ + colorBtn.setTextColor(Color.parseColor("#000000")); // It's a light color + }else{ + colorBtn.setTextColor(Color.parseColor("#FFFFFF")); // It's a dark color + } name.setText(dbgroup.getGroupName()); } else { colorString = "ffffff"; @@ -351,6 +379,11 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda } int colorint = Color.parseColor(colorstring); colorBtn.setBackgroundTintList(ColorStateList.valueOf(colorint)); + if(ColorUtils.calculateLuminance(colorint)>0.5){ + colorBtn.setTextColor(Color.parseColor("#000000")); // It's a light color + }else{ + colorBtn.setTextColor(Color.parseColor("#FFFFFF")); // It's a dark color + } } } } diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/customViews/AnimatedTabHostListener.java b/app/src/main/java/at/smartshopper/smartshopperapp/customViews/AnimatedTabHostListener.java index 2f28cc2..68275c5 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/customViews/AnimatedTabHostListener.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/customViews/AnimatedTabHostListener.java @@ -9,8 +9,7 @@ import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.TabHost; -public class AnimatedTabHostListener implements TabHost.OnTabChangeListener -{ +public class AnimatedTabHostListener implements TabHost.OnTabChangeListener { private static final int ANIMATION_TIME = 240; private TabHost tabHost; @@ -25,21 +24,15 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * @param context * @param tabHost */ - public AnimatedTabHostListener(Context context, TabHost tabHost) - { + public AnimatedTabHostListener(Context context, TabHost tabHost) { this.tabHost = tabHost; this.previousView = tabHost.getCurrentView(); gestureDetector = new GestureDetector(context, new MyGestureDetector()); - tabHost.setOnTouchListener(new View.OnTouchListener() - { - public boolean onTouch(View v, MotionEvent event) - { - if (gestureDetector.onTouchEvent(event)) - { + tabHost.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + if (gestureDetector.onTouchEvent(event)) { return false; - } - else - { + } else { return true; } } @@ -51,17 +44,13 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * appropriate directions. */ @Override - public void onTabChanged(String tabId) - { + public void onTabChanged(String tabId) { currentView = tabHost.getCurrentView(); - if (tabHost.getCurrentTab() > currentTab) - { + if (tabHost.getCurrentTab() > currentTab) { previousView.setAnimation(outToLeftAnimation()); currentView.setAnimation(inFromRightAnimation()); - } - else - { + } else { previousView.setAnimation(outToRightAnimation()); currentView.setAnimation(inFromLeftAnimation()); } @@ -75,8 +64,7 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * * @return Animation the Animation object */ - private Animation inFromRightAnimation() - { + private Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); @@ -88,8 +76,7 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * * @return Animation the Animation object */ - private Animation outToRightAnimation() - { + private Animation outToRightAnimation() { Animation outToRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); return setProperties(outToRight); @@ -100,8 +87,7 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * * @return Animation the Animation object */ - private Animation inFromLeftAnimation() - { + private Animation inFromLeftAnimation() { Animation inFromLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); @@ -113,8 +99,7 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * * @return Animation the Animation object */ - private Animation outToLeftAnimation() - { + private Animation outToLeftAnimation() { Animation outtoLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); return setProperties(outtoLeft); @@ -123,12 +108,10 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener /** * Helper method that sets some common properties * - * @param animation - * the animation to give common properties + * @param animation the animation to give common properties * @return the animation with common properties */ - private Animation setProperties(Animation animation) - { + private Animation setProperties(Animation animation) { animation.setDuration(ANIMATION_TIME); animation.setInterpolator(new AccelerateInterpolator()); return animation; @@ -139,10 +122,8 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * uses an AnimatedTabHost listener. * * @author Daniel Kvist - * */ - class MyGestureDetector extends GestureDetector.SimpleOnGestureListener - { + class MyGestureDetector extends GestureDetector.SimpleOnGestureListener { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 250; private static final int SWIPE_THRESHOLD_VELOCITY = 200; @@ -151,8 +132,7 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener /** * An empty constructor that uses the tabhosts content view to decide how many tabs there are. */ - public MyGestureDetector() - { + public MyGestureDetector() { maxTabs = tabHost.getTabContentView().getChildCount(); } @@ -162,26 +142,20 @@ public class AnimatedTabHostListener implements TabHost.OnTabChangeListener * velocity to decide if it was a "true" swipe or just some random touching. */ @Override - public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) - { + public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) { int newTab = 0; - if (Math.abs(event1.getY() - event2.getY()) > SWIPE_MAX_OFF_PATH) - { + if (Math.abs(event1.getY() - event2.getY()) > SWIPE_MAX_OFF_PATH) { return false; } - if (event1.getX() - event2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) - { + if (event1.getX() - event2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { // Swipe right to left newTab = currentTab + 1; - } - else if (event2.getX() - event1.getX() > SWIPE_MIN_DISTANCE - && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) - { + } else if (event2.getX() - event1.getX() > SWIPE_MIN_DISTANCE + && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { // Swipe left to right newTab = currentTab - 1; } - if (newTab < 0 || newTab > (maxTabs - 1)) - { + if (newTab < 0 || newTab > (maxTabs - 1)) { return false; } tabHost.setCurrentTab(newTab); diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/db/Database.java b/app/src/main/java/at/smartshopper/smartshopperapp/db/Database.java index 32c5ae1..d4075c8 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/db/Database.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/db/Database.java @@ -1,16 +1,9 @@ package at.smartshopper.smartshopperapp.db; -import android.net.Uri; import android.os.StrictMode; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; -import com.google.firebase.dynamiclinks.DynamicLink; -import com.google.firebase.dynamiclinks.FirebaseDynamicLinks; -import com.google.firebase.dynamiclinks.ShortDynamicLink; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/db/SerializableDatabase.java b/app/src/main/java/at/smartshopper/smartshopperapp/db/SerializableDatabase.java deleted file mode 100644 index bca6faa..0000000 --- a/app/src/main/java/at/smartshopper/smartshopperapp/db/SerializableDatabase.java +++ /dev/null @@ -1,17 +0,0 @@ -package at.smartshopper.smartshopperapp.db; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; - -public class SerializableDatabase implements JsonSerializer { - - @Override - public JsonElement serialize(Database src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject object = new JsonObject(); - return null; - } -} diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseMessagingService.java b/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseMessagingService.java index 072a502..1701dfe 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseMessagingService.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseMessagingService.java @@ -84,14 +84,6 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService { NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - // Since android Oreo notification channel is needed. - //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - // NotificationChannel channel = new NotificationChannel(channelId, - // "Channel human readable title", - // NotificationManager.IMPORTANCE_DEFAULT); - // notificationManager.createNotificationChannel(channel); - //} - notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); } } \ No newline at end of file diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseSender.java b/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseSender.java index 064d8d2..82f22f1 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseSender.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/messaging/MyFirebaseSender.java @@ -43,13 +43,6 @@ public class MyFirebaseSender { for (int i = 0; messageIds.size() > i; i++) { try { - /* - firebaseMessaging.send(new RemoteMessage.Builder(R.string.firebase_sender_id + "@fcm.googleapis.com/fcm/") - .setMessageId(messageIds.get(i)) - .addData("my_message", message) - .addData("LoginActivity", action) - .build()); - */ // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/shoppinglist/ShoppinglistAdapter.java b/app/src/main/java/at/smartshopper/smartshopperapp/shoppinglist/ShoppinglistAdapter.java index cdfaaf5..1c12a16 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/shoppinglist/ShoppinglistAdapter.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/shoppinglist/ShoppinglistAdapter.java @@ -134,7 +134,6 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter @@ -126,8 +125,9 @@ android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:clickable="true" - app:backgroundTint="@color/fui_linkColor" + app:backgroundTint="@color/colorAccent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/tabHost1" + app:rippleColor="@color/colorPrimaryDark" app:srcCompat="@drawable/addoutline" /> diff --git a/app/src/main/res/layout/activity_item_list.xml b/app/src/main/res/layout/activity_item_list.xml index 8789443..3b62ca4 100644 --- a/app/src/main/res/layout/activity_item_list.xml +++ b/app/src/main/res/layout/activity_item_list.xml @@ -21,10 +21,10 @@ app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + app:rippleColor="@color/colorPrimaryDark" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index bd876bc..00bfda4 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -35,9 +35,12 @@ android:id="@+id/email" android:layout_width="match_parent" android:layout_height="wrap_content" + android:backgroundTint="@color/browser_actions_title_color" android:ems="10" android:hint="Email" android:inputType="textEmailAddress" + android:textColor="@color/common_google_signin_btn_text_dark_focused" + android:textColorHint="@color/texthintcolor" tools:layout_editor_absoluteX="33dp" tools:layout_editor_absoluteY="33dp" /> @@ -51,11 +54,12 @@ android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" + android:backgroundTint="@color/browser_actions_title_color" android:ems="10" android:hint="Passwort" android:inputType="textPassword" + android:textColor="@color/common_google_signin_btn_text_dark_focused" + android:textColorHint="@color/texthintcolor" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" tools:layout_editor_absoluteY="232dp" /> @@ -69,11 +73,11 @@