diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index 2c4486f..f2babb8 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 5f7e0c5..301831e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,16 +27,16 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - implementation 'com.google.firebase:firebase-auth:16.1.0' - implementation 'com.google.firebase:firebase-messaging:17.3.4' - implementation 'com.google.firebase:firebase-core:16.0.6' - implementation 'com.google.firebase:firebase-storage:16.0.5' + implementation 'com.google.firebase:firebase-auth:16.2.0' + implementation 'com.google.firebase:firebase-messaging:17.4.0' + implementation 'com.google.firebase:firebase-core:16.0.8' + implementation 'com.google.firebase:firebase-storage:16.1.0' implementation 'com.firebase:firebase-jobdispatcher:0.8.5' implementation 'com.google.android.gms:play-services-auth:16.0.1' implementation 'com.firebaseui:firebase-ui-auth:4.1.0' implementation group: 'postgresql', name: 'postgresql', version: '9.1-901.jdbc4' implementation 'com.squareup.picasso:picasso:2.71828' - implementation 'com.android.support:swiperefreshlayout:28.0.0-alpha1' + implementation 'com.android.support:swiperefreshlayout:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.github.danielnilsson9:color-picker-view:1.4.0@aar' implementation 'com.android.support:recyclerview-v7:28.0.0' diff --git a/app/release/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..2426f8d Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/output.json b/app/release/output.json new file mode 100644 index 0000000..73c4abf --- /dev/null +++ b/app/release/output.json @@ -0,0 +1,19 @@ +[ + { + "outputType": { + "type": "APK" + }, + "apkInfo": { + "type": "MAIN", + "splits": [], + "versionCode": 1, + "versionName": "1.0", + "enabled": true, + "outputFile": "app-release.apk", + "fullName": "release", + "baseName": "release" + }, + "path": "app-release.apk", + "properties": {} + } +] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eacc196..1f0d386 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -37,14 +37,14 @@ --> + android:resource="@mipmap/ic_launcher_round" /> + android:resource="@color/colorPrimaryDark" /> 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 394550a..4c337cc 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/Dash.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/Dash.java @@ -164,8 +164,8 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte Intent intent = getIntent(); String message = intent.getStringExtra("tab2"); String wahr = "true"; - if(message != null){ - if(message.equals(wahr)) { + if (message != null) { + if (message.equals(wahr)) { host.setCurrentTab(1); } } @@ -426,15 +426,15 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte ArrayList sharedListsArrayListTmp = new ArrayList<>(); List sharedListsListTmp; - if(sharedListsList.isEmpty()){ - sharedListsArrayListTmp.add(new Shoppinglist("empty","Keine Shoppingliste geteilt!","Um einen Invite Link hinzuzufügen, fügen Sie diesen im Menü ein.","empty","#8B0000")); + if (sharedListsList.isEmpty()) { + sharedListsArrayListTmp.add(new Shoppinglist("empty", "Keine Shoppingliste geteilt!", "Um einen Invite Link hinzuzufügen, fügen Sie diesen im Menü ein.", "empty", "#8B0000")); sharedListsListTmp = sharedListsArrayListTmp; - }else{ + } else { sharedListsListTmp = sharedListsList; findViewById(R.id.pfeilnachunten3).setVisibility(View.GONE); } ShoppinglistSharedAdapter shpAdapter = new ShoppinglistSharedAdapter(Dash.this, sharedListsListTmp, db); - if(sharedListsList.isEmpty()){ + if (sharedListsList.isEmpty()) { shpAdapter.setOnDelClick(new ShoppinglistSharedAdapter.SharedOnItemClicked() { @Override public void sharedOnItemClick(String sl_id) { @@ -459,7 +459,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte } }); - }else { + } else { shpAdapter.setOnDelClick(Dash.this); shpAdapter.setOnChangeClick(Dash.this); shpAdapter.setOnShareClick(Dash.this); @@ -469,7 +469,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte } - private void onEmptyClick(){ + private void onEmptyClick() { } @@ -487,22 +487,22 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte List ownListsListTmp; View pfeil = findViewById(R.id.pfeilnachunten3); - if(ownListsList.isEmpty()){ - ownListsArrayListTmp.add(new Shoppinglist("empty","Keine Shoppingliste vorhanden!","Bitte eine Shoppingliste hinzufügen!","empty","#8B0000")); + if (ownListsList.isEmpty()) { + ownListsArrayListTmp.add(new Shoppinglist("empty", "Keine Shoppingliste vorhanden!", "Bitte eine Shoppingliste hinzufügen!", "empty", "#8B0000")); pfeil.setVisibility(View.VISIBLE); ownListsListTmp = ownListsArrayListTmp; - }else{ + } else { ownListsListTmp = ownListsList; pfeil.setVisibility(View.GONE); } ShoppinglistAdapter shpAdapter = new ShoppinglistAdapter(Dash.this, ownListsListTmp, db); - if(!ownListsList.isEmpty()) { + if (!ownListsList.isEmpty()) { shpAdapter.setOnDelClick(Dash.this); shpAdapter.setOnChangeClick(Dash.this); shpAdapter.setOnShareClick(Dash.this); shpAdapter.setOnShoppinglistClick(Dash.this); - }else{ + } else { shpAdapter.setOnDelClick(new ShoppinglistAdapter.OnItemClicked() { @Override public void onItemClick(String sl_id) { @@ -566,8 +566,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte e.printStackTrace(); } - } - else if (i ==1) { + } else if (i == 1) { try { showSharedShoppingList(uid); } catch (JSONException e) { 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 865ee89..b591e99 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/EditUser.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/EditUser.java @@ -50,15 +50,54 @@ import at.smartshopper.smartshopperapp.shoppinglist.Member; public class EditUser extends Activity { + public static final int RequestPermissionCode = 1; + private final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); private EditText editname; private ImageView userbild; private Button finish, chooseImg; private Database db; - private final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); private Uri uri; private Intent CamIntent, GalIntent, CropIntent; private File file; - public static final int RequestPermissionCode = 1; + + public static void doRestart(Context c) { + try { + //check if the context is given + if (c != null) { + //fetch the packagemanager so we can get the default launch activity + // (you can replace this intent with any other activity if you want + PackageManager pm = c.getPackageManager(); + //check if we got the PackageManager + if (pm != null) { + //create the intent with the default start activity for your application + Intent mStartActivity = pm.getLaunchIntentForPackage( + c.getPackageName() + ); + if (mStartActivity != null) { + mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + //create a pending intent so the application is restarted after System.exit(0) was called. + // We use an AlarmManager to call this intent in 100ms + int mPendingIntentId = 223344; + PendingIntent mPendingIntent = PendingIntent + .getActivity(c, mPendingIntentId, mStartActivity, + PendingIntent.FLAG_CANCEL_CURRENT); + AlarmManager mgr = (AlarmManager) c.getSystemService(Context.ALARM_SERVICE); + mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent); + //kill the application + System.exit(0); + } else { + Log.e("SmartShopper", "Was not able to restart application, mStartActivity null"); + } + } else { + Log.e("SmartShopper", "Was not able to restart application, PM null"); + } + } else { + Log.e("SmartShopper", "Was not able to restart application, Context null"); + } + } catch (Exception ex) { + Log.e("SmartShopper", "Was not able to restart application"); + } + } @Override protected void onCreate(Bundle savedInstanceState) { @@ -128,45 +167,6 @@ public class EditUser extends Activity { }); } - public static void doRestart(Context c) { - try { - //check if the context is given - if (c != null) { - //fetch the packagemanager so we can get the default launch activity - // (you can replace this intent with any other activity if you want - PackageManager pm = c.getPackageManager(); - //check if we got the PackageManager - if (pm != null) { - //create the intent with the default start activity for your application - Intent mStartActivity = pm.getLaunchIntentForPackage( - c.getPackageName() - ); - if (mStartActivity != null) { - mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - //create a pending intent so the application is restarted after System.exit(0) was called. - // We use an AlarmManager to call this intent in 100ms - int mPendingIntentId = 223344; - PendingIntent mPendingIntent = PendingIntent - .getActivity(c, mPendingIntentId, mStartActivity, - PendingIntent.FLAG_CANCEL_CURRENT); - AlarmManager mgr = (AlarmManager) c.getSystemService(Context.ALARM_SERVICE); - mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent); - //kill the application - System.exit(0); - } else { - Log.e("SmartShopper", "Was not able to restart application, mStartActivity null"); - } - } else { - Log.e("SmartShopper", "Was not able to restart application, PM null"); - } - } else { - Log.e("SmartShopper", "Was not able to restart application, Context null"); - } - } catch (Exception ex) { - Log.e("SmartShopper", "Was not able to restart application"); - } - } - public void ClickImageFromCamera() { CamIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 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 fd6a75d..f9f8cdb 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ItemListActivity.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ItemListActivity.java @@ -128,7 +128,7 @@ public class ItemListActivity extends AppCompatActivity implements ItemAdapter.O */ @Override public boolean onOptionsItemSelected(MenuItem item) { - ToolbarHelper th = new ToolbarHelper(getApplicationContext(),getWindow().getDecorView()); + ToolbarHelper th = new ToolbarHelper(getApplicationContext(), getWindow().getDecorView()); switch (item.getItemId()) { case R.id.logoutBtn: th.logout(); @@ -181,17 +181,17 @@ public class ItemListActivity extends AppCompatActivity implements ItemAdapter.O ArrayList itemArrayListTmp = new ArrayList<>(); List itemListTmp; View pfeil = findViewById(R.id.pfeilnachunten2); - if(itemList.isEmpty()){ + if (itemList.isEmpty()) { itemArrayListTmp.add(new Item("empty", "empty", "empty", "Bitte ein Item Hinzufügen!", "")); itemListTmp = itemArrayListTmp; pfeil.setVisibility(View.VISIBLE); - }else{ + } else { itemListTmp = itemList; pfeil.setVisibility(View.GONE); } ItemAdapter itemAdapter = new ItemAdapter(itemListTmp); - if(itemList.isEmpty()){ + if (itemList.isEmpty()) { itemAdapter.setOnItemEditClick(new ItemAdapter.OnItemEditClicked() { @Override public void onItemEditClicked(String item_id, String group_id, String sl_id, View v) { @@ -210,7 +210,7 @@ public class ItemListActivity extends AppCompatActivity implements ItemAdapter.O } }); - }else { + } else { itemAdapter.setOnItemEditClick(this); itemAdapter.setItemDelClick(this); itemAdapter.setOnItemCheckClick(this); 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 7c08f2d..1b9f9cc 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ShoppinglistDetails.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/activitys/ShoppinglistDetails.java @@ -6,8 +6,8 @@ import android.os.Build; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.widget.LinearLayoutManager; import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; @@ -53,6 +53,15 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda private Button colorBtn; private SwipeRefreshLayout detailsSwiperefresh; + /** + * Convertiert eine int farbe in eine hexa dezimale Farbe + * + * @param color Farbe zum umwandeln in int + * @return farbe als hex im string + */ + private static String colorToHexString(int color) { + return String.format("#%06X", 0xFFFFFFFF & color); + } /** * Menu item Action listener @@ -62,7 +71,7 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda */ @Override public boolean onOptionsItemSelected(MenuItem item) { - ToolbarHelper th = new ToolbarHelper(getApplicationContext(),getWindow().getDecorView()); + ToolbarHelper th = new ToolbarHelper(getApplicationContext(), getWindow().getDecorView()); switch (item.getItemId()) { case R.id.logoutBtn: th.logout(); @@ -105,16 +114,6 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda startActivity(intent); } - /** - * Convertiert eine int farbe in eine hexa dezimale Farbe - * - * @param color Farbe zum umwandeln in int - * @return farbe als hex im string - */ - private static String colorToHexString(int color) { - return String.format("#%06X", 0xFFFFFFFF & color); - } - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -367,19 +366,19 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda ArrayList
detailsArrayListTmp = new ArrayList<>(); List
detailsListTmp; View pfeil = findViewById(R.id.pfeilnachunten); - if(detailsList.isEmpty()){ - Group group = new Group("empty","empty","Keine Gruppe vorhanden!","#8B0000","empty"); + if (detailsList.isEmpty()) { + Group group = new Group("empty", "empty", "Keine Gruppe vorhanden!", "#8B0000", "empty"); Details details = new Details(group); - details.addItem(new Item("empty","empty","empty","Bitte eine Gruppe Hinzufügen!","")); + details.addItem(new Item("empty", "empty", "empty", "Bitte eine Gruppe Hinzufügen!", "")); detailsArrayListTmp.add(details); pfeil.setVisibility(View.VISIBLE); detailsListTmp = detailsArrayListTmp; - }else{ + } else { pfeil.setVisibility(View.INVISIBLE); detailsListTmp = detailsList; } DetailsAdapter detailsAdapter = new DetailsAdapter(detailsListTmp, db); - if(detailsList.isEmpty()){ + if (detailsList.isEmpty()) { detailsAdapter.setGroupEditClick(new DetailsAdapter.OnGroupEditClicked() { @Override public void onGroupEditClick(String sl_id, String group_id, View v) { @@ -398,7 +397,7 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda } }); - }else { + } else { detailsAdapter.setGroupEditClick(this); detailsAdapter.setGroupDeleteClick(this); diff --git a/app/src/main/java/at/smartshopper/smartshopperapp/customViews/ToolbarHelper.java b/app/src/main/java/at/smartshopper/smartshopperapp/customViews/ToolbarHelper.java index 06f6b09..ae0e2c9 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/customViews/ToolbarHelper.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/customViews/ToolbarHelper.java @@ -51,7 +51,7 @@ public class ToolbarHelper extends Activity { context.startActivity(intent); } - public void doneEinkauf(String from, String sl_id,String group_id, String groupname) { + public void doneEinkauf(String from, String sl_id, String group_id, String groupname) { finish(); Intent intent = new Intent(context, DoneItemActivity.class); intent.putExtra("from", from); 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 fc8e654..242bf52 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/db/Database.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/db/Database.java @@ -485,7 +485,7 @@ public class Database { */ public void createUser(String username, String message_id, String name, String picture, String email) throws SQLException { String SQL = "INSERT INTO \"User\" (username, message_id, name, picture, email) VALUES (?, ?, ?, ?, ?)"; - if(picture.isEmpty()){ + if (picture.isEmpty()) { picture = "https://st2.depositphotos.com/1537427/5927/v/950/depositphotos_59279377-stock-illustration-user-icon.jpg"; } sqlUpdate5Param(SQL, username, message_id, name, picture, email); 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 8f8e6a8..cdfaaf5 100644 --- a/app/src/main/java/at/smartshopper/smartshopperapp/shoppinglist/ShoppinglistAdapter.java +++ b/app/src/main/java/at/smartshopper/smartshopperapp/shoppinglist/ShoppinglistAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.graphics.Color; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -72,11 +73,14 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter - + @@ -7,17 +7,16 @@ android:width="100dp" android:height="40dp" /> - + - + android:right="-30dp" + android:top="-40dp"> + @@ -26,11 +25,10 @@ - + android:right="-30dp" + android:top="65dp"> + diff --git a/app/src/main/res/drawable/pfeil.xml b/app/src/main/res/drawable/pfeil.xml index e8421d1..c6bef85 100644 --- a/app/src/main/res/drawable/pfeil.xml +++ b/app/src/main/res/drawable/pfeil.xml @@ -3,13 +3,13 @@ android:height="400dp" android:viewportWidth="100" android:viewportHeight="400"> - - - + + + diff --git a/app/src/main/res/layout/activity_dash.xml b/app/src/main/res/layout/activity_dash.xml index 3bbbfeb..db5ce5e 100644 --- a/app/src/main/res/layout/activity_dash.xml +++ b/app/src/main/res/layout/activity_dash.xml @@ -1,7 +1,6 @@ diff --git a/app/src/main/res/layout/cardviewshoppinglist.xml b/app/src/main/res/layout/cardviewshoppinglist.xml index 1d91a83..9681548 100644 --- a/app/src/main/res/layout/cardviewshoppinglist.xml +++ b/app/src/main/res/layout/cardviewshoppinglist.xml @@ -9,31 +9,50 @@ card_view:cardElevation="4dp" card_view:cardUseCompatPadding="true"> - + android:layout_height="wrap_content"> + + + + + + - - + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginEnd="8dp" + card_view:layout_constraintBottom_toBottomOf="parent" + card_view:layout_constraintEnd_toStartOf="@+id/guideline6" + card_view:layout_constraintStart_toStartOf="@+id/guideline4" + card_view:layout_constraintTop_toTopOf="parent"> + card_view:layout_constraintStart_toStartOf="parent" + card_view:layout_constraintTop_toTopOf="parent"> + card_view:layout_constraintTop_toTopOf="parent" /> - + + + + + android:gravity="right"> - + - + - + + + + + + + + + + + + - + card_view:layout_constraintStart_toStartOf="parent" + card_view:layout_constraintTop_toTopOf="parent"> - + - + + - + - - - - - - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/cardviewshoppinglistshared.xml b/app/src/main/res/layout/cardviewshoppinglistshared.xml index 3577bd5..090ef23 100644 --- a/app/src/main/res/layout/cardviewshoppinglistshared.xml +++ b/app/src/main/res/layout/cardviewshoppinglistshared.xml @@ -9,31 +9,50 @@ card_view:cardElevation="4dp" card_view:cardUseCompatPadding="true"> - + android:layout_height="wrap_content"> + + + + + + - - + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + card_view:layout_constraintBottom_toBottomOf="parent" + card_view:layout_constraintEnd_toStartOf="@+id/guideline6" + card_view:layout_constraintStart_toStartOf="@+id/guideline4" + card_view:layout_constraintTop_toTopOf="parent"> + card_view:layout_constraintStart_toStartOf="parent" + card_view:layout_constraintTop_toTopOf="parent"> + card_view:layout_constraintTop_toTopOf="parent" /> - + + + + + android:gravity="right"> - - - + android:layout_height="wrap_content"> - + + + + + + + + + + + + + - + card_view:layout_constraintStart_toStartOf="parent" + card_view:layout_constraintTop_toTopOf="parent"> - + - + + - + - - - - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d76bc7c..085c866 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,4 +1,5 @@ 16dp 8dp + 40dp