Shoppinglisten, Gruppen, Items Anzeigen
							
								
								
									
										77
									
								
								.idea/assetWizardSettings.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<project version="4">
 | 
				
			||||||
 | 
					  <component name="WizardSettings">
 | 
				
			||||||
 | 
					    <option name="children">
 | 
				
			||||||
 | 
					      <map>
 | 
				
			||||||
 | 
					        <entry key="imageWizard">
 | 
				
			||||||
 | 
					          <value>
 | 
				
			||||||
 | 
					            <PersistentState>
 | 
				
			||||||
 | 
					              <option name="children">
 | 
				
			||||||
 | 
					                <map>
 | 
				
			||||||
 | 
					                  <entry key="imageAssetPanel">
 | 
				
			||||||
 | 
					                    <value>
 | 
				
			||||||
 | 
					                      <PersistentState>
 | 
				
			||||||
 | 
					                        <option name="children">
 | 
				
			||||||
 | 
					                          <map>
 | 
				
			||||||
 | 
					                            <entry key="actionbar">
 | 
				
			||||||
 | 
					                              <value>
 | 
				
			||||||
 | 
					                                <PersistentState>
 | 
				
			||||||
 | 
					                                  <option name="values">
 | 
				
			||||||
 | 
					                                    <map>
 | 
				
			||||||
 | 
					                                      <entry key="assetType" value="IMAGE" />
 | 
				
			||||||
 | 
					                                      <entry key="imageAsset" value="C:\Users\georg\Downloads\2x\baseline_add_circle_outline_black_18dp.png" />
 | 
				
			||||||
 | 
					                                      <entry key="outputName" value="logo" />
 | 
				
			||||||
 | 
					                                      <entry key="theme" value="CUSTOM" />
 | 
				
			||||||
 | 
					                                      <entry key="themeColor" value="000000" />
 | 
				
			||||||
 | 
					                                    </map>
 | 
				
			||||||
 | 
					                                  </option>
 | 
				
			||||||
 | 
					                                </PersistentState>
 | 
				
			||||||
 | 
					                              </value>
 | 
				
			||||||
 | 
					                            </entry>
 | 
				
			||||||
 | 
					                            <entry key="launcher">
 | 
				
			||||||
 | 
					                              <value>
 | 
				
			||||||
 | 
					                                <PersistentState>
 | 
				
			||||||
 | 
					                                  <option name="children">
 | 
				
			||||||
 | 
					                                    <map>
 | 
				
			||||||
 | 
					                                      <entry key="foregroundImage">
 | 
				
			||||||
 | 
					                                        <value>
 | 
				
			||||||
 | 
					                                          <PersistentState>
 | 
				
			||||||
 | 
					                                            <option name="values">
 | 
				
			||||||
 | 
					                                              <map>
 | 
				
			||||||
 | 
					                                                <entry key="scalingPercent" value="66" />
 | 
				
			||||||
 | 
					                                              </map>
 | 
				
			||||||
 | 
					                                            </option>
 | 
				
			||||||
 | 
					                                          </PersistentState>
 | 
				
			||||||
 | 
					                                        </value>
 | 
				
			||||||
 | 
					                                      </entry>
 | 
				
			||||||
 | 
					                                    </map>
 | 
				
			||||||
 | 
					                                  </option>
 | 
				
			||||||
 | 
					                                  <option name="values">
 | 
				
			||||||
 | 
					                                    <map>
 | 
				
			||||||
 | 
					                                      <entry key="backgroundAssetType" value="COLOR" />
 | 
				
			||||||
 | 
					                                      <entry key="backgroundColor" value="353535" />
 | 
				
			||||||
 | 
					                                      <entry key="foregroundImage" value="G:\Teamablagen\SmartShopper\Design\Logo\logo.png" />
 | 
				
			||||||
 | 
					                                    </map>
 | 
				
			||||||
 | 
					                                  </option>
 | 
				
			||||||
 | 
					                                </PersistentState>
 | 
				
			||||||
 | 
					                              </value>
 | 
				
			||||||
 | 
					                            </entry>
 | 
				
			||||||
 | 
					                          </map>
 | 
				
			||||||
 | 
					                        </option>
 | 
				
			||||||
 | 
					                      </PersistentState>
 | 
				
			||||||
 | 
					                    </value>
 | 
				
			||||||
 | 
					                  </entry>
 | 
				
			||||||
 | 
					                </map>
 | 
				
			||||||
 | 
					              </option>
 | 
				
			||||||
 | 
					            </PersistentState>
 | 
				
			||||||
 | 
					          </value>
 | 
				
			||||||
 | 
					        </entry>
 | 
				
			||||||
 | 
					        <entry key="vectorWizard">
 | 
				
			||||||
 | 
					          <value>
 | 
				
			||||||
 | 
					            <PersistentState />
 | 
				
			||||||
 | 
					          </value>
 | 
				
			||||||
 | 
					        </entry>
 | 
				
			||||||
 | 
					      </map>
 | 
				
			||||||
 | 
					    </option>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					</project>
 | 
				
			||||||
@@ -28,6 +28,8 @@ dependencies {
 | 
				
			|||||||
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
 | 
					    androidTestImplementation 'com.android.support.test:runner:1.0.2'
 | 
				
			||||||
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.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-auth:16.1.0'
 | 
				
			||||||
 | 
					    implementation 'com.google.firebase:firebase-messaging:17.3.4'
 | 
				
			||||||
 | 
					    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
 | 
				
			||||||
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
 | 
					    implementation 'com.google.android.gms:play-services-auth:16.0.1'
 | 
				
			||||||
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
 | 
					    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
 | 
				
			||||||
    // http://mvnrepository.com/artifact/postgresql/postgresql
 | 
					    // http://mvnrepository.com/artifact/postgresql/postgresql
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,9 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 | 
					<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
    package="at.smartshopper.smartshopper">
 | 
					    package="at.smartshopper.smartshopper">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <uses-permission android:name="android.permission.INTERNET" />
 | 
					    <uses-permission android:name="android.permission.INTERNET" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <application
 | 
					    <application
 | 
				
			||||||
        android:allowBackup="true"
 | 
					        android:allowBackup="true"
 | 
				
			||||||
        android:icon="@mipmap/ic_launcher"
 | 
					        android:icon="@mipmap/ic_launcher"
 | 
				
			||||||
@@ -10,7 +12,7 @@
 | 
				
			|||||||
        android:supportsRtl="true"
 | 
					        android:supportsRtl="true"
 | 
				
			||||||
        android:theme="@style/AppTheme"
 | 
					        android:theme="@style/AppTheme"
 | 
				
			||||||
        android:usesCleartextTraffic="true">
 | 
					        android:usesCleartextTraffic="true">
 | 
				
			||||||
        <activity android:name=".LoginActivity">
 | 
					        <activity android:name=".activitys.LoginActivity">
 | 
				
			||||||
            <intent-filter>
 | 
					            <intent-filter>
 | 
				
			||||||
                <action android:name="android.intent.action.MAIN" />
 | 
					                <action android:name="android.intent.action.MAIN" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,9 +20,33 @@
 | 
				
			|||||||
            </intent-filter>
 | 
					            </intent-filter>
 | 
				
			||||||
        </activity>
 | 
					        </activity>
 | 
				
			||||||
        <activity
 | 
					        <activity
 | 
				
			||||||
            android:name=".Dash"
 | 
					            android:name=".activitys.Dash"
 | 
				
			||||||
            android:label="SmartShopper"
 | 
					            android:label="SmartShopper"
 | 
				
			||||||
            android:theme="@style/AppTheme"></activity>
 | 
					            android:theme="@style/AppTheme" />
 | 
				
			||||||
 | 
					        <!--
 | 
				
			||||||
 | 
					     Set custom default icon. This is used when no icon is set for incoming notification messages.
 | 
				
			||||||
 | 
					     See README(https://goo.gl/l4GJaQ) for more.
 | 
				
			||||||
 | 
					        -->
 | 
				
			||||||
 | 
					        <meta-data
 | 
				
			||||||
 | 
					            android:name="com.google.firebase.messaging.default_notification_icon"
 | 
				
			||||||
 | 
					            android:resource="@drawable/ic_launcher_foreground" />
 | 
				
			||||||
 | 
					        <!--
 | 
				
			||||||
 | 
					             Set color used with incoming notification messages. This is used when no color is set for the incoming
 | 
				
			||||||
 | 
					             notification message. See README(https://goo.gl/6BKBk7) for more.
 | 
				
			||||||
 | 
					        -->
 | 
				
			||||||
 | 
					        <meta-data
 | 
				
			||||||
 | 
					            android:name="com.google.firebase.messaging.default_notification_color"
 | 
				
			||||||
 | 
					            android:resource="@color/colorAccent" />
 | 
				
			||||||
 | 
					        <!-- [START firebase_service] -->
 | 
				
			||||||
 | 
					        <service android:name=".messaging.MyFirebaseMessagingService">
 | 
				
			||||||
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					                <action android:name="com.google.firebase.MESSAGING_EVENT" />
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					        </service>
 | 
				
			||||||
 | 
					        <!-- [END firebase_service] -->
 | 
				
			||||||
 | 
					        <activity
 | 
				
			||||||
 | 
					            android:name=".activitys.ShoppinglistDetails"
 | 
				
			||||||
 | 
					            android:label="@string/title_activity_shoppinglist_details"></activity>
 | 
				
			||||||
    </application>
 | 
					    </application>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</manifest>
 | 
					</manifest>
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								app/src/main/ic_launcher-web.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 13 KiB  | 
@@ -1,67 +0,0 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import android.os.StrictMode;
 | 
					 | 
				
			||||||
import android.util.Log;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.json.JSONException;
 | 
					 | 
				
			||||||
import org.json.JSONObject;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.sql.Connection;
 | 
					 | 
				
			||||||
import java.sql.DriverManager;
 | 
					 | 
				
			||||||
import java.sql.PreparedStatement;
 | 
					 | 
				
			||||||
import java.sql.ResultSet;
 | 
					 | 
				
			||||||
import java.sql.SQLException;
 | 
					 | 
				
			||||||
import java.sql.Statement;
 | 
					 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Database {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private Connection conect;
 | 
					 | 
				
			||||||
    final String HOST = "188.166.124.80";
 | 
					 | 
				
			||||||
    final String DB_NAME = "smartshopperdb";
 | 
					 | 
				
			||||||
    final String USERNAME = "smartshopper-user";
 | 
					 | 
				
			||||||
    final String PASSWORD = "jW^v#&LjNY_b3-k*jYj!U4Xz?T??m_D6249XAeWZ#7C^FRbKm!c_Dt+qj@4&a-Hs";
 | 
					 | 
				
			||||||
    final int PORT = 5432;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public  Database(){};
 | 
					 | 
				
			||||||
    public void  connectDatabase() throws SQLException {
 | 
					 | 
				
			||||||
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
 | 
					 | 
				
			||||||
        StrictMode.setThreadPolicy(policy);
 | 
					 | 
				
			||||||
        DriverManager.registerDriver(new org.postgresql.Driver());
 | 
					 | 
				
			||||||
        conect = DriverManager.getConnection("jdbc:postgresql://" + HOST + ":" + PORT + "/" + DB_NAME, USERNAME, PASSWORD);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        System.out.println("Database connected!");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public List<Shoppinglist> getMyShoppinglists(String uid) throws JSONException {
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            connectDatabase();
 | 
					 | 
				
			||||||
        } catch (SQLException e) {
 | 
					 | 
				
			||||||
            e.printStackTrace();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        String SQL = "SELECT row_to_json(\"Shoppinglist\") AS obj FROM \"Shoppinglist\" JOIN \"Shoppinglist_admin\" USING (sl_id) WHERE username = ?";
 | 
					 | 
				
			||||||
        ArrayList<Shoppinglist> shoppinglistsList = null;
 | 
					 | 
				
			||||||
        try (
 | 
					 | 
				
			||||||
                Statement stmt = conect.createStatement();
 | 
					 | 
				
			||||||
                PreparedStatement pstmt = conect.prepareStatement(SQL)) {
 | 
					 | 
				
			||||||
            pstmt.setString(1, uid);
 | 
					 | 
				
			||||||
            ResultSet rs = pstmt.executeQuery();
 | 
					 | 
				
			||||||
            System.out.println(uid);
 | 
					 | 
				
			||||||
                shoppinglistsList = new ArrayList<Shoppinglist>();
 | 
					 | 
				
			||||||
                while (rs.next()) {
 | 
					 | 
				
			||||||
                    String shoppinglist = rs.getString(1);
 | 
					 | 
				
			||||||
                    JSONObject jsonObject = new JSONObject(shoppinglist);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    shoppinglistsList.add(new Shoppinglist(jsonObject.getString("sl_id"), jsonObject.getString("name"), jsonObject.getString("description"), jsonObject.getString("invitelink"), jsonObject.getString("color")));
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                Log.d("DATABASE SHOPPINGLISTS", shoppinglistsList.toString());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        } catch (SQLException ex) {
 | 
					 | 
				
			||||||
            System.out.println(ex.getMessage());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return (List<Shoppinglist>) shoppinglistsList;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import at.smartshopper.smartshopper.Shoppinglist;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Shoppinglists {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Shoppinglists(){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,34 +1,30 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					package at.smartshopper.smartshopper.activitys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.app.ActionBar;
 | 
					 | 
				
			||||||
import android.content.Intent;
 | 
					import android.content.Intent;
 | 
				
			||||||
import android.graphics.Color;
 | 
					 | 
				
			||||||
import android.graphics.drawable.ColorDrawable;
 | 
					 | 
				
			||||||
import android.net.Uri;
 | 
					import android.net.Uri;
 | 
				
			||||||
import android.os.Bundle;
 | 
					import android.os.Bundle;
 | 
				
			||||||
import android.support.annotation.ColorInt;
 | 
					import android.os.Handler;
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					 | 
				
			||||||
import android.support.v4.widget.SwipeRefreshLayout;
 | 
					import android.support.v4.widget.SwipeRefreshLayout;
 | 
				
			||||||
import android.support.v7.app.AppCompatActivity;
 | 
					import android.support.v7.app.AppCompatActivity;
 | 
				
			||||||
import android.support.v7.widget.LinearLayoutManager;
 | 
					import android.support.v7.widget.LinearLayoutManager;
 | 
				
			||||||
import android.support.v7.widget.RecyclerView;
 | 
					import android.support.v7.widget.RecyclerView;
 | 
				
			||||||
import android.support.v7.widget.Toolbar;
 | 
					 | 
				
			||||||
import android.view.Menu;
 | 
					import android.view.Menu;
 | 
				
			||||||
import android.view.MenuItem;
 | 
					import android.view.MenuItem;
 | 
				
			||||||
import android.view.View;
 | 
					 | 
				
			||||||
import android.widget.Button;
 | 
					 | 
				
			||||||
import android.widget.TabHost;
 | 
					import android.widget.TabHost;
 | 
				
			||||||
 | 
					import android.widget.Toast;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.android.gms.tasks.OnCompleteListener;
 | 
					 | 
				
			||||||
import com.google.android.gms.tasks.Task;
 | 
					 | 
				
			||||||
import com.google.firebase.auth.FirebaseAuth;
 | 
					import com.google.firebase.auth.FirebaseAuth;
 | 
				
			||||||
import com.google.firebase.auth.FirebaseUser;
 | 
					import com.google.firebase.auth.FirebaseUser;
 | 
				
			||||||
import com.google.firebase.auth.GetTokenResult;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.json.JSONException;
 | 
					import org.json.JSONException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.sql.SQLException;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.jar.JarInputStream;
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.db.Database;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.Shoppinglist;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.ShoppinglistAdapter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Dash extends AppCompatActivity {
 | 
					public class Dash extends AppCompatActivity {
 | 
				
			||||||
@@ -69,8 +65,12 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
            final String uid = user.getUid();
 | 
					            final String uid = user.getUid();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    showOwnShoppingList(uid);
 | 
					                    showOwnShoppingList(uid);
 | 
				
			||||||
 | 
					                } catch (SQLException e) {
 | 
				
			||||||
 | 
					                    e.printStackTrace();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            } catch (JSONException e) {
 | 
					            } catch (JSONException e) {
 | 
				
			||||||
                e.printStackTrace();
 | 
					                e.printStackTrace();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -79,7 +79,11 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
            ownswiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
 | 
					            ownswiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
 | 
				
			||||||
                @Override
 | 
					                @Override
 | 
				
			||||||
                public void onRefresh() {
 | 
					                public void onRefresh() {
 | 
				
			||||||
 | 
					                    try {
 | 
				
			||||||
                        refreshOwnShoppinglist(uid);
 | 
					                        refreshOwnShoppinglist(uid);
 | 
				
			||||||
 | 
					                    } catch (SQLException e) {
 | 
				
			||||||
 | 
					                        e.printStackTrace();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -92,6 +96,7 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
     * Logt den User aus und geht zur Login Activity
 | 
					     * Logt den User aus und geht zur Login Activity
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void logout(){
 | 
					    private void logout(){
 | 
				
			||||||
 | 
					        finish();
 | 
				
			||||||
        FirebaseAuth.getInstance().signOut();
 | 
					        FirebaseAuth.getInstance().signOut();
 | 
				
			||||||
        Intent intent = new Intent(this, LoginActivity.class);
 | 
					        Intent intent = new Intent(this, LoginActivity.class);
 | 
				
			||||||
        startActivity(intent);
 | 
					        startActivity(intent);
 | 
				
			||||||
@@ -102,7 +107,7 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param uid Von dem benutzer von welchem die Shoppinglists angezeigt werden sollen
 | 
					     * @param uid Von dem benutzer von welchem die Shoppinglists angezeigt werden sollen
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void refreshOwnShoppinglist(String uid) {
 | 
					    private void refreshOwnShoppinglist(String uid) throws SQLException {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            showOwnShoppingList(uid);
 | 
					            showOwnShoppingList(uid);
 | 
				
			||||||
        } catch (JSONException e) {
 | 
					        } catch (JSONException e) {
 | 
				
			||||||
@@ -128,7 +133,7 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param uid Die UserId damit von diesem user die shoppinglisten angezeigt werden
 | 
					     * @param uid Die UserId damit von diesem user die shoppinglisten angezeigt werden
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void showOwnShoppingList(String uid) throws JSONException {
 | 
					    private void showOwnShoppingList(String uid) throws JSONException, SQLException {
 | 
				
			||||||
        RecyclerView ownRecycleView = (RecyclerView) findViewById(R.id.ownrecycler);
 | 
					        RecyclerView ownRecycleView = (RecyclerView) findViewById(R.id.ownrecycler);
 | 
				
			||||||
        ownRecycleView.setHasFixedSize(true);
 | 
					        ownRecycleView.setHasFixedSize(true);
 | 
				
			||||||
        ownRecycleView.setLayoutManager(new LinearLayoutManager(this));
 | 
					        ownRecycleView.setLayoutManager(new LinearLayoutManager(this));
 | 
				
			||||||
@@ -158,6 +163,16 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
        host.addTab(spec);
 | 
					        host.addTab(spec);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Schickt an die Login Activity einen intend mit dem extra EXIT. Um die app zu schließen
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void exit(){
 | 
				
			||||||
 | 
					        Intent intent = new Intent(Dash.this, LoginActivity.class);
 | 
				
			||||||
 | 
					        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 | 
				
			||||||
 | 
					        intent.putExtra("EXIT", true);
 | 
				
			||||||
 | 
					        startActivity(intent);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCreateOptionsMenu(Menu menu) {
 | 
					    public boolean onCreateOptionsMenu(Menu menu) {
 | 
				
			||||||
@@ -167,6 +182,11 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Menu item Action listener
 | 
				
			||||||
 | 
					     * @param item Action Item
 | 
				
			||||||
 | 
					     * @return True wenn erfolgreich
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onOptionsItemSelected(MenuItem item) {
 | 
					    public boolean onOptionsItemSelected(MenuItem item) {
 | 
				
			||||||
        switch (item.getItemId()) {
 | 
					        switch (item.getItemId()) {
 | 
				
			||||||
@@ -174,7 +194,6 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
                logout();
 | 
					                logout();
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                // If we got here, the user's action was not recognized.
 | 
					                // If we got here, the user's action was not recognized.
 | 
				
			||||||
                // Invoke the superclass to handle it.
 | 
					                // Invoke the superclass to handle it.
 | 
				
			||||||
@@ -184,4 +203,31 @@ public class Dash extends AppCompatActivity {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Für Double Back press to exit
 | 
				
			||||||
 | 
					    private boolean doubleBackToExitPressedOnce = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 2 Mal Zurück Drücken um die App zu schließen
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onBackPressed() {
 | 
				
			||||||
 | 
					        if (doubleBackToExitPressedOnce) {
 | 
				
			||||||
 | 
					            super.onBackPressed();
 | 
				
			||||||
 | 
					            exit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.doubleBackToExitPressedOnce = true;
 | 
				
			||||||
 | 
					        Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        new Handler().postDelayed(new Runnable() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            @Override
 | 
				
			||||||
 | 
					            public void run() {
 | 
				
			||||||
 | 
					                doubleBackToExitPressedOnce=false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 2000);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					package at.smartshopper.smartshopper.activitys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.content.Intent;
 | 
					import android.content.Intent;
 | 
				
			||||||
 | 
					import android.os.Handler;
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.design.widget.Snackbar;
 | 
					import android.support.design.widget.Snackbar;
 | 
				
			||||||
import android.support.v7.app.AppCompatActivity;
 | 
					import android.support.v7.app.AppCompatActivity;
 | 
				
			||||||
@@ -25,6 +26,8 @@ import com.google.firebase.auth.FirebaseAuth;
 | 
				
			|||||||
import com.google.firebase.auth.FirebaseUser;
 | 
					import com.google.firebase.auth.FirebaseUser;
 | 
				
			||||||
import com.google.firebase.auth.GoogleAuthProvider;
 | 
					import com.google.firebase.auth.GoogleAuthProvider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LoginActivity extends AppCompatActivity {
 | 
					public class LoginActivity extends AppCompatActivity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final String TAG = "SMASH";
 | 
					    private static final String TAG = "SMASH";
 | 
				
			||||||
@@ -58,11 +61,20 @@ public class LoginActivity extends AppCompatActivity {
 | 
				
			|||||||
        startActivityForResult(signInIntent, RC_SIGN_IN);
 | 
					        startActivityForResult(signInIntent, RC_SIGN_IN);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Wechselt zu der Dash Activity
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private void goDash() {
 | 
					    private void goDash() {
 | 
				
			||||||
        Intent intent = new Intent(this, Dash.class);
 | 
					        Intent intent = new Intent(this, Dash.class);
 | 
				
			||||||
 | 
					        finish();
 | 
				
			||||||
        startActivity(intent);
 | 
					        startActivity(intent);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Loggt den User per Email ein
 | 
				
			||||||
 | 
					     * @param email Email des Users
 | 
				
			||||||
 | 
					     * @param password Passwort des Users
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private void signInEmail(String email, String password) {
 | 
					    private void signInEmail(String email, String password) {
 | 
				
			||||||
        mAuth.signInWithEmailAndPassword(email, password)
 | 
					        mAuth.signInWithEmailAndPassword(email, password)
 | 
				
			||||||
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
 | 
					                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
 | 
				
			||||||
@@ -85,6 +97,12 @@ public class LoginActivity extends AppCompatActivity {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Erstellt einen Account mit Email und Passwort
 | 
				
			||||||
 | 
					     * @param email Email des neuen Users
 | 
				
			||||||
 | 
					     * @param password Passwort des neuen Users
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private void createAccount(String email, String password) {
 | 
					    private void createAccount(String email, String password) {
 | 
				
			||||||
        mAuth.createUserWithEmailAndPassword(email, password)
 | 
					        mAuth.createUserWithEmailAndPassword(email, password)
 | 
				
			||||||
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
 | 
					                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
 | 
				
			||||||
@@ -106,10 +124,15 @@ public class LoginActivity extends AppCompatActivity {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void onCreate(Bundle savedInstanceState) {
 | 
					    protected void onCreate(Bundle savedInstanceState) {
 | 
				
			||||||
        super.onCreate(savedInstanceState);
 | 
					        super.onCreate(savedInstanceState);
 | 
				
			||||||
        setContentView(R.layout.activity_login);
 | 
					        setContentView(R.layout.activity_login);
 | 
				
			||||||
 | 
					        if (getIntent().getBooleanExtra("EXIT", false))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            finish();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        mAuth = FirebaseAuth.getInstance();
 | 
					        mAuth = FirebaseAuth.getInstance();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Button loginEmailBtn = (Button) findViewById(R.id.loginEmailBtn);
 | 
					        Button loginEmailBtn = (Button) findViewById(R.id.loginEmailBtn);
 | 
				
			||||||
@@ -146,6 +169,10 @@ public class LoginActivity extends AppCompatActivity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Loggt den User ein. Bei erfolg wird der Aufruf zur Dash Activity getätigt
 | 
				
			||||||
 | 
					     * @param acct Der Google Account, welcher eingelogt werden soll
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
 | 
					    private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
 | 
				
			||||||
        Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
 | 
					        Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,6 +198,10 @@ public class LoginActivity extends AppCompatActivity {
 | 
				
			|||||||
                });
 | 
					                });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Prüft ob der User bereits eingelogt ist. Wenn ja, wird er auf die Dash Activity weitergeleitet
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onStart() {
 | 
					    public void onStart() {
 | 
				
			||||||
        super.onStart();
 | 
					        super.onStart();
 | 
				
			||||||
@@ -181,4 +212,31 @@ public class LoginActivity extends AppCompatActivity {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Für Double Back press to exit
 | 
				
			||||||
 | 
					    private boolean doubleBackToExitPressedOnce = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 2 Mal Zurück Drücken um die App zu schließen
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onBackPressed() {
 | 
				
			||||||
 | 
					        if (doubleBackToExitPressedOnce) {
 | 
				
			||||||
 | 
					            super.onBackPressed();
 | 
				
			||||||
 | 
					            finish();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.doubleBackToExitPressedOnce = true;
 | 
				
			||||||
 | 
					        Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        new Handler().postDelayed(new Runnable() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            @Override
 | 
				
			||||||
 | 
					            public void run() {
 | 
				
			||||||
 | 
					                doubleBackToExitPressedOnce=false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 2000);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.activitys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.os.Bundle;
 | 
				
			||||||
 | 
					import android.app.Activity;
 | 
				
			||||||
 | 
					import android.support.design.widget.Snackbar;
 | 
				
			||||||
 | 
					import android.support.v7.widget.LinearLayoutManager;
 | 
				
			||||||
 | 
					import android.support.v7.widget.RecyclerView;
 | 
				
			||||||
 | 
					import android.widget.Toast;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.google.firebase.auth.FirebaseAuth;
 | 
				
			||||||
 | 
					import com.google.firebase.auth.FirebaseUser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.json.JSONException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.sql.SQLException;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.db.Database;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.Shoppinglist;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.ShoppinglistAdapter;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.Details;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.DetailsAdapter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ShoppinglistDetails extends Activity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Database db = new Database();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    protected void onCreate(Bundle savedInstanceState) {
 | 
				
			||||||
 | 
					        super.onCreate(savedInstanceState);
 | 
				
			||||||
 | 
					        setContentView(R.layout.activity_shoppinglist_details);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Bundle bundle = getIntent().getExtras();
 | 
				
			||||||
 | 
					        int position = -1; // or other values
 | 
				
			||||||
 | 
					        if (bundle != null)
 | 
				
			||||||
 | 
					            position = bundle.getInt("pos");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Toast.makeText(this, "Click detected on item " + position, Toast.LENGTH_LONG).show();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<Shoppinglist> shoppinglists = null;
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            shoppinglists = db.getMyShoppinglists(FirebaseAuth.getInstance().getCurrentUser().getUid());
 | 
				
			||||||
 | 
					        } catch (JSONException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        } catch (SQLException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Shoppinglist aktuelleShopinglist = shoppinglists.get(position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            showDetails(aktuelleShopinglist.getSlId());
 | 
				
			||||||
 | 
					        } catch (SQLException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        } catch (JSONException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Zeigt das Card View der Shoppinglist Details an
 | 
				
			||||||
 | 
					     * @param sl_id Shoppinglist welche angezeigt werden soll
 | 
				
			||||||
 | 
					     * @throws SQLException
 | 
				
			||||||
 | 
					     * @throws JSONException
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void showDetails(String sl_id) throws SQLException, JSONException {
 | 
				
			||||||
 | 
					        RecyclerView detailsRecycleView = (RecyclerView) findViewById(R.id.groupRecycle);
 | 
				
			||||||
 | 
					        detailsRecycleView.setHasFixedSize(true);
 | 
				
			||||||
 | 
					        detailsRecycleView.setLayoutManager(new LinearLayoutManager(this));
 | 
				
			||||||
 | 
					        List<Details> detailsList = db.getListDetails(sl_id);
 | 
				
			||||||
 | 
					        DetailsAdapter detailsAdapter = new DetailsAdapter(detailsList);
 | 
				
			||||||
 | 
					        detailsRecycleView.setAdapter(detailsAdapter);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					package at.smartshopper.smartshopper.customViews;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.graphics.Bitmap;
 | 
					import android.graphics.Bitmap;
 | 
				
			||||||
import android.graphics.Bitmap.Config;
 | 
					import android.graphics.Bitmap.Config;
 | 
				
			||||||
							
								
								
									
										224
									
								
								app/src/main/java/at/smartshopper/smartshopper/db/Database.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,224 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.db;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.os.StrictMode;
 | 
				
			||||||
 | 
					import android.util.Log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.json.JSONException;
 | 
				
			||||||
 | 
					import org.json.JSONObject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.sql.Connection;
 | 
				
			||||||
 | 
					import java.sql.DriverManager;
 | 
				
			||||||
 | 
					import java.sql.PreparedStatement;
 | 
				
			||||||
 | 
					import java.sql.ResultSet;
 | 
				
			||||||
 | 
					import java.sql.SQLException;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.Shoppinglist;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.Details;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.group.Group;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.item.Item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Database {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Connection conect;
 | 
				
			||||||
 | 
					    final String HOST = "188.166.124.80";
 | 
				
			||||||
 | 
					    final String DB_NAME = "smartshopperdb";
 | 
				
			||||||
 | 
					    final String USERNAME = "smartshopper-user";
 | 
				
			||||||
 | 
					    final String PASSWORD = "jW^v#&LjNY_b3-k*jYj!U4Xz?T??m_D6249XAeWZ#7C^FRbKm!c_Dt+qj@4&a-Hs";
 | 
				
			||||||
 | 
					    final int PORT = 5432;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Macht nix
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public Database() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Verbindet Sich mit der Datenbank. Auf der Konsole wird "Database connected!" angezeigt, bei erfolgreicher verbindung
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @throws SQLException Bei einem error bei der Verbindung, können details über diese Exception abgerufen werden
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void connectDatabase() throws SQLException {
 | 
				
			||||||
 | 
					        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
 | 
				
			||||||
 | 
					        StrictMode.setThreadPolicy(policy);
 | 
				
			||||||
 | 
					        DriverManager.registerDriver(new org.postgresql.Driver());
 | 
				
			||||||
 | 
					        conect = DriverManager.getConnection("jdbc:postgresql://" + HOST + ":" + PORT + "/" + DB_NAME, USERNAME, PASSWORD);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        System.out.println("Database connected!");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Verbindet sich mit dem Server
 | 
				
			||||||
 | 
					     * Holt die eigenen Shoppinglisten vom Server. Und speichert diese in eine List mit Shoppinglist Objekten
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param uid Die UID auf welche die Abfrage ausgeführt werden soll
 | 
				
			||||||
 | 
					     * @return Das Ergebnis der eigenen Shoppinglisten in einer List gefüllt mit Shoppinglist Objekten
 | 
				
			||||||
 | 
					     * @throws JSONException Ein JSON Umwandlungsfehler
 | 
				
			||||||
 | 
					     * @throws SQLException  Ein PostgreSQL Fehler
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<Shoppinglist> getMyShoppinglists(String uid) throws JSONException, SQLException {
 | 
				
			||||||
 | 
					        String SQL = "SELECT row_to_json(\"Shoppinglist\") AS obj FROM \"Shoppinglist\" JOIN \"Shoppinglist_admin\" USING (sl_id) WHERE username = ?";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        connectDatabase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<Shoppinglist> shoppinglistsList = new ArrayList<Shoppinglist>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ResultSet rs = null;
 | 
				
			||||||
 | 
					        try (PreparedStatement pstmt = conect.prepareStatement(SQL)) {
 | 
				
			||||||
 | 
					            pstmt.setString(1, uid);
 | 
				
			||||||
 | 
					            rs = pstmt.executeQuery();
 | 
				
			||||||
 | 
					            System.out.println(uid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            while (rs.next()) {
 | 
				
			||||||
 | 
					                String shoppinglist = rs.getString(1);
 | 
				
			||||||
 | 
					                JSONObject jsonObject = new JSONObject(shoppinglist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                shoppinglistsList.add(new Shoppinglist(jsonObject.getString("sl_id"), jsonObject.getString("name"), jsonObject.getString("description"), jsonObject.getString("invitelink"), jsonObject.getString("color")));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (SQLException ex) {
 | 
				
			||||||
 | 
					            System.out.println(ex.getMessage());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Log.d("DATABASE SHOPPINGLISTS", shoppinglistsList.toString());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return (List<Shoppinglist>) shoppinglistsList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Hoolt alle groups und items der list und erstelt ein Detail objekt von jeder group. Die detail objekte kommen in eine List
 | 
				
			||||||
 | 
					     * @param sl_id Shoppinglist Id mit der gearbeitet wird
 | 
				
			||||||
 | 
					     * @return Eine List mit Details über jede Shoppinglist
 | 
				
			||||||
 | 
					     * @throws SQLException
 | 
				
			||||||
 | 
					     * @throws JSONException
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<Details> getListDetails(String sl_id) throws SQLException, JSONException {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<Group> groups = getGroups(sl_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<Item> items = getItems(sl_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<Details> detailsArrayList = new ArrayList<Details>();
 | 
				
			||||||
 | 
					        for (Group group : groups) {
 | 
				
			||||||
 | 
					            Details detailsTmp = new Details(group);
 | 
				
			||||||
 | 
					            for (Item item : items) {
 | 
				
			||||||
 | 
					                if (group.getGroup_id().equals(item.getGroup_id())) {
 | 
				
			||||||
 | 
					                    detailsTmp.addItem(item);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            detailsArrayList.add(detailsTmp);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return (List<Details>) detailsArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Holt alle Items einer bestimmten shoppingliste, angegeben durch die shoppinglist id
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param sl_id
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     * @throws SQLException
 | 
				
			||||||
 | 
					     * @throws JSONException
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private List<Item> getItems(String sl_id) throws SQLException, JSONException {
 | 
				
			||||||
 | 
					        String SQL = "SELECT row_to_json(\"Item\") AS obj FROM \"Item\" JOIN \"Group\" USING (group_id) WHERE \"Group\".sl_id = ?";
 | 
				
			||||||
 | 
					        connectDatabase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<Item> listItems = new ArrayList<Item>();
 | 
				
			||||||
 | 
					        ResultSet rsitems = null;
 | 
				
			||||||
 | 
					        try (PreparedStatement pstmt = conect.prepareStatement(SQL)) {
 | 
				
			||||||
 | 
					            pstmt.setString(1, sl_id);
 | 
				
			||||||
 | 
					            rsitems = pstmt.executeQuery();
 | 
				
			||||||
 | 
					            System.out.println(sl_id);
 | 
				
			||||||
 | 
					            while (rsitems.next()) {
 | 
				
			||||||
 | 
					                String itemsString = rsitems.getString(1);
 | 
				
			||||||
 | 
					                JSONObject jsonObject = new JSONObject(itemsString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                listItems.add(new Item(jsonObject.getString("item_id"), jsonObject.getString("group_id"), jsonObject.getString("sl_id"), jsonObject.getString("name"), jsonObject.getString("count")));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (SQLException ex) {
 | 
				
			||||||
 | 
					            System.out.println(ex.getMessage());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return (List<Item>) listItems;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Holt alle gruppen einer bestimmten Shoppinglist id
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param sl_id Holt alle goups dieser Shoppinglist id
 | 
				
			||||||
 | 
					     * @return Gibt alle groups der Abgefragten Shoppinglist id zurück
 | 
				
			||||||
 | 
					     * @throws SQLException
 | 
				
			||||||
 | 
					     * @throws JSONException
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private List<Group> getGroups(String sl_id) throws SQLException, JSONException {
 | 
				
			||||||
 | 
					        String SQLGroups = "SELECT row_to_json(\"Group\") AS obj FROM \"Group\" JOIN \"Shoppinglist\" USING (sl_id) WHERE sl_id = ?";
 | 
				
			||||||
 | 
					        connectDatabase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ResultSet rsgroups = null;
 | 
				
			||||||
 | 
					        ArrayList<Group> listGroup = new ArrayList<Group>();
 | 
				
			||||||
 | 
					        try (PreparedStatement pstmt = conect.prepareStatement(SQLGroups)) {
 | 
				
			||||||
 | 
					            pstmt.setString(1, sl_id);
 | 
				
			||||||
 | 
					            rsgroups = pstmt.executeQuery();
 | 
				
			||||||
 | 
					            System.out.println(sl_id);
 | 
				
			||||||
 | 
					            while (rsgroups.next()) {
 | 
				
			||||||
 | 
					                String groupString = rsgroups.getString(1);
 | 
				
			||||||
 | 
					                JSONObject jsonObject = new JSONObject(groupString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                listGroup.add(new Group(jsonObject.getString("group_id"), jsonObject.getString("sl_id"), jsonObject.getString("name"), jsonObject.getString("color"), jsonObject.getString("hidden")));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (SQLException ex) {
 | 
				
			||||||
 | 
					            System.out.println(ex.getMessage());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return (List<Group>) listGroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * NICHT VERWENDEN FUNKTIONIERT NICHT!!
 | 
				
			||||||
 | 
					     * <p>
 | 
				
			||||||
 | 
					     * <p>
 | 
				
			||||||
 | 
					     * NUR EIN KOPIE SAMPLE
 | 
				
			||||||
 | 
					     * <p>
 | 
				
			||||||
 | 
					     * Beim Start wird die Verbindung zum Server hergesetellt. Dann wird das resultSet von dem SQL reqest zurückgegeben
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param SQL Der zumachende SQL Request
 | 
				
			||||||
 | 
					     * @param uid Die UID des Benutzers, für den die Abfrage gemacht wird
 | 
				
			||||||
 | 
					     * @return Das entstandene Result set, mit der Antwort des Servers
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private ResultSet databaseRequest(String SQL, String uid) throws SQLException {
 | 
				
			||||||
 | 
					        connectDatabase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ResultSet rs = null;
 | 
				
			||||||
 | 
					        try (PreparedStatement pstmt = conect.prepareStatement(SQL)) {
 | 
				
			||||||
 | 
					            pstmt.setString(1, uid);
 | 
				
			||||||
 | 
					            rs = pstmt.executeQuery();
 | 
				
			||||||
 | 
					            System.out.println(uid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            //HIER
 | 
				
			||||||
 | 
					            //WEITER
 | 
				
			||||||
 | 
					            //PROGRAMMIEREN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (SQLException ex) {
 | 
				
			||||||
 | 
					            System.out.println(ex.getMessage());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return rs;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,136 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.messaging;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.app.NotificationManager;
 | 
				
			||||||
 | 
					import android.app.PendingIntent;
 | 
				
			||||||
 | 
					import android.content.Context;
 | 
				
			||||||
 | 
					import android.content.Intent;
 | 
				
			||||||
 | 
					import android.media.RingtoneManager;
 | 
				
			||||||
 | 
					import android.net.Uri;
 | 
				
			||||||
 | 
					import android.support.v4.app.NotificationCompat;
 | 
				
			||||||
 | 
					import android.util.Log;
 | 
				
			||||||
 | 
					import com.google.firebase.messaging.FirebaseMessagingService;
 | 
				
			||||||
 | 
					import com.google.firebase.messaging.RemoteMessage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.activitys.Dash;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class MyFirebaseMessagingService extends FirebaseMessagingService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final String TAG = "MyFirebaseMsgService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Called when message is received.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param remoteMessage Object representing the message received from Firebase Cloud Messaging.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    // [START receive_message]
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onMessageReceived(RemoteMessage remoteMessage) {
 | 
				
			||||||
 | 
					        // [START_EXCLUDE]
 | 
				
			||||||
 | 
					        // There are two types of messages data messages and notification messages. Data messages
 | 
				
			||||||
 | 
					        // are handled
 | 
				
			||||||
 | 
					        // here in onMessageReceived whether the app is in the foreground or background. Data
 | 
				
			||||||
 | 
					        // messages are the type
 | 
				
			||||||
 | 
					        // traditionally used with GCM. Notification messages are only received here in
 | 
				
			||||||
 | 
					        // onMessageReceived when the app
 | 
				
			||||||
 | 
					        // is in the foreground. When the app is in the background an automatically generated
 | 
				
			||||||
 | 
					        // notification is displayed.
 | 
				
			||||||
 | 
					        // When the user taps on the notification they are returned to the app. Messages
 | 
				
			||||||
 | 
					        // containing both notification
 | 
				
			||||||
 | 
					        // and data payloads are treated as notification messages. The Firebase console always
 | 
				
			||||||
 | 
					        // sends notification
 | 
				
			||||||
 | 
					        // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options
 | 
				
			||||||
 | 
					        // [END_EXCLUDE]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // TODO(developer): Handle FCM messages here.
 | 
				
			||||||
 | 
					        // Not getting messages here? See why this may be: https://goo.gl/39bRNJ
 | 
				
			||||||
 | 
					        Log.d(TAG, "From: " + remoteMessage.getFrom());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check if message contains a data payload.
 | 
				
			||||||
 | 
					        if (remoteMessage.getData().size() > 0) {
 | 
				
			||||||
 | 
					            Log.d(TAG, "Message data payload: " + remoteMessage.getData());
 | 
				
			||||||
 | 
					            sendNotification(remoteMessage.getData() + "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check if message contains a notification payload.
 | 
				
			||||||
 | 
					        if (remoteMessage.getNotification() != null) {
 | 
				
			||||||
 | 
					            Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
 | 
				
			||||||
 | 
					            sendNotification(remoteMessage.getNotification().getBody());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Also if you intend on generating your own notifications as a result of a received FCM
 | 
				
			||||||
 | 
					        // message, here is where that should be initiated. See sendNotification method below.
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // [END receive_message]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // [START on_new_token]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Called if InstanceID token is updated. This may occur if the security of
 | 
				
			||||||
 | 
					     * the previous token had been compromised. Note that this is called when the InstanceID token
 | 
				
			||||||
 | 
					     * is initially generated so this is where you would retrieve the token.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onNewToken(String token) {
 | 
				
			||||||
 | 
					        Log.d(TAG, "Refreshed token: " + token);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // If you want to send messages to this application instance or
 | 
				
			||||||
 | 
					        // manage this apps subscriptions on the server side, send the
 | 
				
			||||||
 | 
					        // Instance ID token to your app server.
 | 
				
			||||||
 | 
					        sendRegistrationToServer(token);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // [END on_new_token]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Persist token to third-party servers.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Modify this method to associate the user's FCM InstanceID token with any server-side account
 | 
				
			||||||
 | 
					     * maintained by your application.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param token The new token.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void sendRegistrationToServer(String token) {
 | 
				
			||||||
 | 
					        // TODO: Implement this method to send token to your app server.
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create and show a simple notification containing the received FCM message.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param messageBody FCM message body received.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void sendNotification(String messageBody) {
 | 
				
			||||||
 | 
					        Intent intent = new Intent(this, Dash.class);
 | 
				
			||||||
 | 
					        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 | 
				
			||||||
 | 
					        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
 | 
				
			||||||
 | 
					                PendingIntent.FLAG_ONE_SHOT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // String channelId = getString(R.string.default_notification_channel_id);
 | 
				
			||||||
 | 
					        Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
 | 
				
			||||||
 | 
					        NotificationCompat.Builder notificationBuilder =
 | 
				
			||||||
 | 
					                //new NotificationCompat.Builder(this, channelId)
 | 
				
			||||||
 | 
					                new NotificationCompat.Builder(this)
 | 
				
			||||||
 | 
					                        .setSmallIcon(R.drawable.ic_launcher_foreground)
 | 
				
			||||||
 | 
					                        .setContentTitle("SmartShopper")
 | 
				
			||||||
 | 
					                        .setContentText(messageBody)
 | 
				
			||||||
 | 
					                        .setAutoCancel(true)
 | 
				
			||||||
 | 
					                        .setSound(defaultSoundUri)
 | 
				
			||||||
 | 
					                        .setContentIntent(pendingIntent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        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());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					package at.smartshopper.smartshopper.shoppinglist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Shoppinglist {
 | 
					public class Shoppinglist {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,4 +36,9 @@ public class Shoppinglist {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public String getcolor(){ return this.color;}
 | 
					    public String getcolor(){ return this.color;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public String toString(){
 | 
				
			||||||
 | 
					        return "SL_ID: " + sl_id + " name: " + name + " description: " + description + " invitelink: " + invitelink + " color: "+ color;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,8 +1,9 @@
 | 
				
			|||||||
package at.smartshopper.smartshopper;
 | 
					package at.smartshopper.smartshopper.shoppinglist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.content.Context;
 | 
					import android.content.Context;
 | 
				
			||||||
import android.graphics.drawable.Drawable;
 | 
					import android.content.Intent;
 | 
				
			||||||
import android.net.Uri;
 | 
					import android.net.Uri;
 | 
				
			||||||
 | 
					import android.os.Bundle;
 | 
				
			||||||
import android.support.v7.widget.RecyclerView;
 | 
					import android.support.v7.widget.RecyclerView;
 | 
				
			||||||
import android.view.LayoutInflater;
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
@@ -16,6 +17,10 @@ import com.squareup.picasso.Picasso;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.activitys.ShoppinglistDetails;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.customViews.RoundCornersTransformation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapter.ShoppinglistViewHolder> {
 | 
					public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapter.ShoppinglistViewHolder> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,14 +36,25 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
 | 
				
			|||||||
        this.shoppinglist = shoppinglist;
 | 
					        this.shoppinglist = shoppinglist;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Erstellt einen Neuen view holder mit aktueller view
 | 
				
			||||||
 | 
					     * @param parent
 | 
				
			||||||
 | 
					     * @param viewType
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public ShoppinglistViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
 | 
					    public ShoppinglistViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
 | 
				
			||||||
        //inflating and returning our view holder
 | 
					        //inflating and returning our view holder
 | 
				
			||||||
        LayoutInflater inflater = LayoutInflater.from(mCtx);
 | 
					        LayoutInflater inflater = LayoutInflater.from(mCtx);
 | 
				
			||||||
        View view = inflater.inflate(R.layout.cardview, parent, false);
 | 
					        View view = inflater.inflate(R.layout.cardviewshoppinglist, parent, false);
 | 
				
			||||||
        return new ShoppinglistViewHolder(view);
 | 
					        return new ShoppinglistViewHolder(view);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Setzt alle Daten in die View elemente
 | 
				
			||||||
 | 
					     * @param holder Das View Holder Objekt mit allen elementen
 | 
				
			||||||
 | 
					     * @param position Der Index welcher aus der data list genommen werden soll
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onBindViewHolder(ShoppinglistViewHolder holder, int position) {
 | 
					    public void onBindViewHolder(ShoppinglistViewHolder holder, int position) {
 | 
				
			||||||
        //getting the product of the specified position,
 | 
					        //getting the product of the specified position,
 | 
				
			||||||
@@ -69,12 +85,17 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public int getItemCount() {
 | 
					    public int getItemCount() {
 | 
				
			||||||
        return shoppinglist.size();
 | 
					        return shoppinglist.size();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Haltet alle elemente. Durch ein Objekt von dem kann jedes Element welches hier drinnen angeführt ist verwendet werden
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    class ShoppinglistViewHolder extends RecyclerView.ViewHolder {
 | 
					    class ShoppinglistViewHolder extends RecyclerView.ViewHolder {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        TextView textViewTitle, textViewBeschreibung, ownerName;
 | 
					        TextView textViewTitle, textViewBeschreibung, ownerName;
 | 
				
			||||||
@@ -87,6 +108,25 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
 | 
				
			|||||||
            textViewBeschreibung = itemView.findViewById(R.id.shoppinglistBeschreibung);
 | 
					            textViewBeschreibung = itemView.findViewById(R.id.shoppinglistBeschreibung);
 | 
				
			||||||
            imageView = itemView.findViewById(R.id.shoppinglistOwner);
 | 
					            imageView = itemView.findViewById(R.id.shoppinglistOwner);
 | 
				
			||||||
            ownerName = itemView.findViewById(R.id.ownerName);
 | 
					            ownerName = itemView.findViewById(R.id.ownerName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            itemView.setOnClickListener(new View.OnClickListener() {
 | 
				
			||||||
 | 
					                @Override
 | 
				
			||||||
 | 
					                public void onClick(View v) {
 | 
				
			||||||
 | 
					                    int position = getAdapterPosition();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    Intent intent = new Intent(v.getContext(), ShoppinglistDetails.class);
 | 
				
			||||||
 | 
					                    Bundle bundle = new Bundle();
 | 
				
			||||||
 | 
					                    bundle.putInt("pos", position);
 | 
				
			||||||
 | 
					                    intent.putExtras(bundle);
 | 
				
			||||||
 | 
					                    v.getContext().startActivity(intent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.shoppinglist.details;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.group.Group;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.item.Item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Details {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Group group;
 | 
				
			||||||
 | 
					    private ArrayList<Item> items;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Details(Group group) {
 | 
				
			||||||
 | 
					        this.group = group;
 | 
				
			||||||
 | 
					        this.items = new ArrayList<Item>();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Group getGroup() {
 | 
				
			||||||
 | 
					        return group;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ArrayList<Item> getItems() {
 | 
				
			||||||
 | 
					        return items;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void addItem(Item item){
 | 
				
			||||||
 | 
					        this.items.add(item);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public String toString() {
 | 
				
			||||||
 | 
					        return "Details{" +
 | 
				
			||||||
 | 
					                "group=" + group.toString() +
 | 
				
			||||||
 | 
					                ", items=" + items.toString() +
 | 
				
			||||||
 | 
					                '}';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,104 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.shoppinglist.details;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.app.Activity;
 | 
				
			||||||
 | 
					import android.graphics.Color;
 | 
				
			||||||
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					import android.support.v7.widget.CardView;
 | 
				
			||||||
 | 
					import android.support.v7.widget.LinearLayoutManager;
 | 
				
			||||||
 | 
					import android.support.v7.widget.RecyclerView;
 | 
				
			||||||
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
 | 
					import android.view.View;
 | 
				
			||||||
 | 
					import android.view.ViewGroup;
 | 
				
			||||||
 | 
					import android.widget.ImageButton;
 | 
				
			||||||
 | 
					import android.widget.ImageView;
 | 
				
			||||||
 | 
					import android.widget.TextView;
 | 
				
			||||||
 | 
					import com.squareup.picasso.Picasso;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.customViews.RoundCornersTransformation;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.db.Database;
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.shoppinglist.details.item.ItemAdapter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class DetailsAdapter extends RecyclerView.Adapter<DetailsAdapter.MyViewHolder> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private List<Details> details;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public DetailsAdapter(List<Details> details) {
 | 
				
			||||||
 | 
					        this.details = details;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Erstellt einen Neuen view holder mit aktueller view
 | 
				
			||||||
 | 
					     * @param viewGroup
 | 
				
			||||||
 | 
					     * @param i
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @NonNull
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
 | 
				
			||||||
 | 
					        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cardviewgroup, viewGroup, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        MyViewHolder myViewHolder = new MyViewHolder(view);
 | 
				
			||||||
 | 
					        return myViewHolder;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Setzt alle Daten in die View elemente
 | 
				
			||||||
 | 
					     * @param viewHolder Das View Holder Objekt mit allen elementen
 | 
				
			||||||
 | 
					     * @param i Der Index welcher aus der data list genommen werden soll
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onBindViewHolder(@NonNull MyViewHolder viewHolder, int i) {
 | 
				
			||||||
 | 
					        TextView groupName = viewHolder.groupName;
 | 
				
			||||||
 | 
					        ImageButton deleteGroup = viewHolder.deleteGroup;
 | 
				
			||||||
 | 
					        RecyclerView itemsrecycle = viewHolder.itemsrecycle;
 | 
				
			||||||
 | 
					        TextView ownerName = viewHolder.ownerName;
 | 
				
			||||||
 | 
					        ImageView ownerImage = viewHolder.ownerImage;
 | 
				
			||||||
 | 
					        CardView cardViewGroup = viewHolder.cardViewGroups;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Database db = new Database();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        groupName.setText(details.get(i).getGroup().getName());
 | 
				
			||||||
 | 
					        ownerName.setText("Kein SQL");
 | 
				
			||||||
 | 
					        cardViewGroup.setCardBackgroundColor(Color.parseColor("#" + details.get(i).getGroup().getColor()));
 | 
				
			||||||
 | 
					        Picasso.get().load(R.drawable.delete).into(deleteGroup);
 | 
				
			||||||
 | 
					        Picasso.get().load(R.drawable.user).resize(250,250).transform(new RoundCornersTransformation(30, 30, true, true)).into(ownerImage);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        itemsrecycle.setHasFixedSize(true);
 | 
				
			||||||
 | 
					        itemsrecycle.setLayoutManager(new LinearLayoutManager(new Activity()));
 | 
				
			||||||
 | 
					        List<at.smartshopper.smartshopper.shoppinglist.details.item.Item> itemsList = details.get(i).getItems();
 | 
				
			||||||
 | 
					        ItemAdapter itemAdapter = new ItemAdapter(itemsList);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        itemsrecycle.setAdapter(itemAdapter);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int getItemCount() {
 | 
				
			||||||
 | 
					        return details.size();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Haltet alle elemente. Durch ein Objekt von dem kann jedes Element welches hier drinnen angeführt ist verwendet werden
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static class MyViewHolder extends RecyclerView.ViewHolder {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        TextView groupName, ownerName;
 | 
				
			||||||
 | 
					        ImageButton deleteGroup;
 | 
				
			||||||
 | 
					        RecyclerView itemsrecycle;
 | 
				
			||||||
 | 
					        ImageView ownerImage;
 | 
				
			||||||
 | 
					        CardView cardViewGroups;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public MyViewHolder(@NonNull View itemView) {
 | 
				
			||||||
 | 
					            super(itemView);
 | 
				
			||||||
 | 
					            this.groupName = (TextView) itemView.findViewById(R.id.groupName);
 | 
				
			||||||
 | 
					            this.deleteGroup = (ImageButton) itemView.findViewById(R.id.deleteGroup);
 | 
				
			||||||
 | 
					            this.itemsrecycle = (RecyclerView) itemView.findViewById(R.id.itemsRecycle);
 | 
				
			||||||
 | 
					            this.ownerName = (TextView)itemView.findViewById(R.id.ownerName);
 | 
				
			||||||
 | 
					            this.ownerImage = (ImageView)itemView.findViewById(R.id.ownerImage);
 | 
				
			||||||
 | 
					            this.cardViewGroups = (CardView)itemView.findViewById(R.id.cardViewGroup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,50 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.shoppinglist.details.group;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Group {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String group_id;
 | 
				
			||||||
 | 
					    private String sl_id;
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					    private String color;
 | 
				
			||||||
 | 
					    private String hidden;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Group(String group_id, String sl_id, String name, String color, String hidden) {
 | 
				
			||||||
 | 
					        this.group_id = group_id;
 | 
				
			||||||
 | 
					        this.sl_id = sl_id;
 | 
				
			||||||
 | 
					        this.name = name;
 | 
				
			||||||
 | 
					        this.color = color;
 | 
				
			||||||
 | 
					        this.hidden = hidden;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getGroup_id() {
 | 
				
			||||||
 | 
					        return this.group_id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getSl_idd() {
 | 
				
			||||||
 | 
					        return this.sl_id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getName() {
 | 
				
			||||||
 | 
					        return this.name;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getColor() {
 | 
				
			||||||
 | 
					        return this.color;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getHidden() {
 | 
				
			||||||
 | 
					        return this.hidden;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public String toString() {
 | 
				
			||||||
 | 
					        return "Group{" +
 | 
				
			||||||
 | 
					                "group_id='" + group_id + '\'' +
 | 
				
			||||||
 | 
					                ", sl_id='" + sl_id + '\'' +
 | 
				
			||||||
 | 
					                ", name='" + name + '\'' +
 | 
				
			||||||
 | 
					                ", color='" + color + '\'' +
 | 
				
			||||||
 | 
					                ", hidden='" + hidden + '\'' +
 | 
				
			||||||
 | 
					                '}';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.shoppinglist.details.item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Item {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String item_id;
 | 
				
			||||||
 | 
					    private String group_id;
 | 
				
			||||||
 | 
					    private String sl_id;
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					    private String count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Item(String item_id, String group_id, String sl_id, String name, String count){
 | 
				
			||||||
 | 
					        this.item_id = item_id;
 | 
				
			||||||
 | 
					        this.group_id = group_id;
 | 
				
			||||||
 | 
					        this.sl_id = sl_id;
 | 
				
			||||||
 | 
					        this.name = name;
 | 
				
			||||||
 | 
					        this.count = count;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getItem_id() {
 | 
				
			||||||
 | 
					        return item_id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getGroup_id() {
 | 
				
			||||||
 | 
					        return group_id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getSl_id() {
 | 
				
			||||||
 | 
					        return sl_id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getName() {
 | 
				
			||||||
 | 
					        return name;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getCount() {
 | 
				
			||||||
 | 
					        return count;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public String toString() {
 | 
				
			||||||
 | 
					        return "Item{" +
 | 
				
			||||||
 | 
					                "item_id='" + item_id + '\'' +
 | 
				
			||||||
 | 
					                ", group_id='" + group_id + '\'' +
 | 
				
			||||||
 | 
					                ", sl_id='" + sl_id + '\'' +
 | 
				
			||||||
 | 
					                ", name='" + name + '\'' +
 | 
				
			||||||
 | 
					                ", count='" + count + '\'' +
 | 
				
			||||||
 | 
					                '}';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,81 @@
 | 
				
			|||||||
 | 
					package at.smartshopper.smartshopper.shoppinglist.details.item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					import android.support.v7.widget.RecyclerView;
 | 
				
			||||||
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
 | 
					import android.view.View;
 | 
				
			||||||
 | 
					import android.view.ViewGroup;
 | 
				
			||||||
 | 
					import android.widget.ImageView;
 | 
				
			||||||
 | 
					import android.widget.TextView;
 | 
				
			||||||
 | 
					import com.squareup.picasso.Picasso;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import at.smartshopper.smartshopper.R;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.MyViewHolder> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private List<at.smartshopper.smartshopper.shoppinglist.details.item.Item> data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ItemAdapter(List<at.smartshopper.smartshopper.shoppinglist.details.item.Item> data){
 | 
				
			||||||
 | 
					        this.data = data;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Erstellt einen Neuen view holder mit aktueller view
 | 
				
			||||||
 | 
					     * @param viewGroup
 | 
				
			||||||
 | 
					     * @param i
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @NonNull
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
 | 
				
			||||||
 | 
					        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cardviewitem, viewGroup, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        MyViewHolder myViewHolder = new MyViewHolder(view);
 | 
				
			||||||
 | 
					        return myViewHolder;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Setzt alle Daten in die View elemente
 | 
				
			||||||
 | 
					     * @param myViewHolder Das View Holder Objekt mit allen elementen
 | 
				
			||||||
 | 
					     * @param i Der Index welcher aus der data list genommen werden soll
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
 | 
				
			||||||
 | 
					        TextView itemName = myViewHolder.itemName;
 | 
				
			||||||
 | 
					        TextView itemAnzahl = myViewHolder.itemAnzahl;
 | 
				
			||||||
 | 
					        ImageView itemBearbeiten = myViewHolder.itemBearbeiten;
 | 
				
			||||||
 | 
					        ImageView itemDel = myViewHolder.itemDel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        itemName.setText(data.get(i).getName());
 | 
				
			||||||
 | 
					        itemAnzahl.setText(data.get(i).getCount());
 | 
				
			||||||
 | 
					        Picasso.get().load(R.drawable.bearbeiten).into(itemBearbeiten);
 | 
				
			||||||
 | 
					        Picasso.get().load(R.drawable.delete).into(itemDel);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int getItemCount() {
 | 
				
			||||||
 | 
					        return data.size();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Haltet alle elemente. Durch ein Objekt von dem kann jedes Element welches hier drinnen angeführt ist verwendet werden
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static class MyViewHolder extends RecyclerView.ViewHolder{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        TextView itemName, itemAnzahl;
 | 
				
			||||||
 | 
					        ImageView itemBearbeiten, itemDel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public MyViewHolder(View itemView){
 | 
				
			||||||
 | 
					            super(itemView);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this.itemName = (TextView)itemView.findViewById(R.id.nameItem);
 | 
				
			||||||
 | 
					            this.itemAnzahl = (TextView)itemView.findViewById(R.id.anzahlItem);
 | 
				
			||||||
 | 
					            this.itemBearbeiten = (ImageView)itemView.findViewById(R.id.itemBearbeiten);
 | 
				
			||||||
 | 
					            this.itemDel = (ImageView)itemView.findViewById(R.id.itemDel);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/add.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 358 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/addoutline.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 528 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 269 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 274 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 340 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/add.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 306 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/addoutline.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 401 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 149 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 165 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 220 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/add.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 639 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/addoutline.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 995 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 216 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 266 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 384 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/add.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 486 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/addoutline.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 708 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 386 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 458 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 679 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/add.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/addoutline.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.7 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 373 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 505 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 795 B  | 
@@ -1,15 +1,19 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
					<android.support.constraint.ConstraintLayout
 | 
				
			||||||
 | 
					    xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
					    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
				
			||||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
					    xmlns:tools="http://schemas.android.com/tools"
 | 
				
			||||||
    android:layout_width="match_parent"
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
    android:layout_height="match_parent"
 | 
					    android:layout_height="match_parent">
 | 
				
			||||||
    tools:context=".Dash">
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <TabHost
 | 
					    <TabHost
 | 
				
			||||||
        android:id="@+id/tabHost1"
 | 
					        android:id="@+id/tabHost1"
 | 
				
			||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="wrap_content">
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        app:layout_constraintBottom_toBottomOf="parent"
 | 
				
			||||||
 | 
					        app:layout_constraintEnd_toEndOf="parent"
 | 
				
			||||||
 | 
					        app:layout_constraintStart_toStartOf="parent"
 | 
				
			||||||
 | 
					        app:layout_constraintTop_toTopOf="parent">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <LinearLayout
 | 
					        <LinearLayout
 | 
				
			||||||
            android:layout_width="match_parent"
 | 
					            android:layout_width="match_parent"
 | 
				
			||||||
@@ -40,6 +44,7 @@
 | 
				
			|||||||
                        android:layout_height="match_parent"
 | 
					                        android:layout_height="match_parent"
 | 
				
			||||||
                        android:orientation="vertical">
 | 
					                        android:orientation="vertical">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
					                        <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
                            android:id="@+id/ownSwipe"
 | 
					                            android:id="@+id/ownSwipe"
 | 
				
			||||||
                            android:layout_width="match_parent"
 | 
					                            android:layout_width="match_parent"
 | 
				
			||||||
@@ -48,7 +53,9 @@
 | 
				
			|||||||
                            <android.support.v7.widget.RecyclerView
 | 
					                            <android.support.v7.widget.RecyclerView
 | 
				
			||||||
                                android:id="@+id/ownrecycler"
 | 
					                                android:id="@+id/ownrecycler"
 | 
				
			||||||
                                android:layout_width="match_parent"
 | 
					                                android:layout_width="match_parent"
 | 
				
			||||||
                                android:layout_height="match_parent" />
 | 
					                                android:layout_height="match_parent">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            </android.support.v7.widget.RecyclerView>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        </android.support.v4.widget.SwipeRefreshLayout>
 | 
					                        </android.support.v4.widget.SwipeRefreshLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -82,4 +89,15 @@
 | 
				
			|||||||
        </LinearLayout>
 | 
					        </LinearLayout>
 | 
				
			||||||
    </TabHost>
 | 
					    </TabHost>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</LinearLayout>
 | 
					    <android.support.design.widget.FloatingActionButton
 | 
				
			||||||
 | 
					        android:id="@+id/floatingActionButton4"
 | 
				
			||||||
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_marginEnd="8dp"
 | 
				
			||||||
 | 
					        android:layout_marginBottom="8dp"
 | 
				
			||||||
 | 
					        android:clickable="true"
 | 
				
			||||||
 | 
					        app:backgroundTint="@color/fui_linkColor"
 | 
				
			||||||
 | 
					        app:layout_constraintBottom_toBottomOf="parent"
 | 
				
			||||||
 | 
					        app:layout_constraintEnd_toEndOf="@+id/tabHost1"
 | 
				
			||||||
 | 
					        app:srcCompat="@drawable/addoutline" />
 | 
				
			||||||
 | 
					</android.support.constraint.ConstraintLayout>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
					    xmlns:tools="http://schemas.android.com/tools"
 | 
				
			||||||
    android:layout_width="match_parent"
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
    android:layout_height="match_parent"
 | 
					    android:layout_height="match_parent"
 | 
				
			||||||
    tools:context=".LoginActivity">
 | 
					    tools:context=".activitys.LoginActivity">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <TableLayout
 | 
					    <TableLayout
 | 
				
			||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										28
									
								
								app/src/main/res/layout/activity_shoppinglist_details.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
					    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
				
			||||||
 | 
					    xmlns:tools="http://schemas.android.com/tools"
 | 
				
			||||||
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
 | 
					    android:layout_height="match_parent"
 | 
				
			||||||
 | 
					    tools:context=".activitys.ShoppinglistDetails">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <android.support.v7.widget.RecyclerView
 | 
				
			||||||
 | 
					        android:id="@+id/groupRecycle"
 | 
				
			||||||
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
 | 
					        android:layout_height="match_parent" >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </android.support.v7.widget.RecyclerView>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <android.support.design.widget.FloatingActionButton
 | 
				
			||||||
 | 
					        android:id="@+id/floatingActionButton"
 | 
				
			||||||
 | 
					        style="@style/Widget.MaterialComponents.FloatingActionButton"
 | 
				
			||||||
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:layout_marginEnd="8dp"
 | 
				
			||||||
 | 
					        android:layout_marginBottom="8dp"
 | 
				
			||||||
 | 
					        android:clickable="true"
 | 
				
			||||||
 | 
					        android:src="@drawable/addoutline"
 | 
				
			||||||
 | 
					        app:backgroundTint="@color/fui_linkColor"
 | 
				
			||||||
 | 
					        app:layout_constraintBottom_toBottomOf="@+id/groupRecycle"
 | 
				
			||||||
 | 
					        app:layout_constraintEnd_toEndOf="parent" />
 | 
				
			||||||
 | 
					</android.support.constraint.ConstraintLayout>
 | 
				
			||||||
							
								
								
									
										77
									
								
								app/src/main/res/layout/cardviewgroup.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
					    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
				
			||||||
 | 
					    android:id="@+id/cardViewGroup"
 | 
				
			||||||
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
 | 
					    android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					    app:cardCornerRadius="8dp"
 | 
				
			||||||
 | 
					    app:cardPreventCornerOverlap="true"
 | 
				
			||||||
 | 
					    app:cardUseCompatPadding="true">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <LinearLayout
 | 
				
			||||||
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					        android:orientation="vertical">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <android.support.constraint.ConstraintLayout
 | 
				
			||||||
 | 
					            android:layout_width="match_parent"
 | 
				
			||||||
 | 
					            android:layout_height="wrap_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <TextView
 | 
				
			||||||
 | 
					                android:id="@+id/groupName"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_marginStart="8dp"
 | 
				
			||||||
 | 
					                android:layout_marginTop="12dp"
 | 
				
			||||||
 | 
					                android:layout_marginEnd="8dp"
 | 
				
			||||||
 | 
					                android:text="Name"
 | 
				
			||||||
 | 
					                android:textSize="18sp"
 | 
				
			||||||
 | 
					                app:layout_constraintEnd_toStartOf="@+id/deleteGroup"
 | 
				
			||||||
 | 
					                app:layout_constraintStart_toEndOf="@+id/ownerImage"
 | 
				
			||||||
 | 
					                app:layout_constraintTop_toTopOf="parent" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <ImageButton
 | 
				
			||||||
 | 
					                android:id="@+id/deleteGroup"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_marginTop="8dp"
 | 
				
			||||||
 | 
					                android:layout_marginEnd="8dp"
 | 
				
			||||||
 | 
					                android:background="@android:color/transparent"
 | 
				
			||||||
 | 
					                app:layout_constraintEnd_toEndOf="parent"
 | 
				
			||||||
 | 
					                app:layout_constraintTop_toTopOf="parent"
 | 
				
			||||||
 | 
					                app:srcCompat="@drawable/delete" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <ImageView
 | 
				
			||||||
 | 
					                android:id="@+id/ownerImage"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_marginStart="8dp"
 | 
				
			||||||
 | 
					                android:layout_marginTop="8dp"
 | 
				
			||||||
 | 
					                app:layout_constraintStart_toStartOf="parent"
 | 
				
			||||||
 | 
					                app:layout_constraintTop_toTopOf="parent"
 | 
				
			||||||
 | 
					                app:srcCompat="@color/colorAccent" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <TextView
 | 
				
			||||||
 | 
					                android:id="@+id/ownerName"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_marginStart="15dp"
 | 
				
			||||||
 | 
					                android:layout_marginTop="8dp"
 | 
				
			||||||
 | 
					                android:layout_marginBottom="8dp"
 | 
				
			||||||
 | 
					                android:text="OwnerName"
 | 
				
			||||||
 | 
					                app:layout_constraintBottom_toBottomOf="parent"
 | 
				
			||||||
 | 
					                app:layout_constraintStart_toStartOf="parent"
 | 
				
			||||||
 | 
					                app:layout_constraintTop_toBottomOf="@+id/ownerImage" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        </android.support.constraint.ConstraintLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <android.support.v7.widget.RecyclerView
 | 
				
			||||||
 | 
					            android:id="@+id/itemsRecycle"
 | 
				
			||||||
 | 
					            android:layout_width="match_parent"
 | 
				
			||||||
 | 
					            android:layout_height="wrap_content" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</android.support.v7.widget.CardView>
 | 
				
			||||||
							
								
								
									
										59
									
								
								app/src/main/res/layout/cardviewitem.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,59 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
					    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
				
			||||||
 | 
					    android:id="@+id/itemCardView"
 | 
				
			||||||
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
 | 
					    android:layout_height="wrap_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <LinearLayout
 | 
				
			||||||
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
 | 
					        android:layout_height="match_parent"
 | 
				
			||||||
 | 
					        android:background="@android:color/darker_gray"
 | 
				
			||||||
 | 
					        android:orientation="horizontal"
 | 
				
			||||||
 | 
					        android:padding="8dp">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <LinearLayout
 | 
				
			||||||
 | 
					            android:layout_width="match_parent"
 | 
				
			||||||
 | 
					            android:layout_height="match_parent"
 | 
				
			||||||
 | 
					            android:layout_weight="1"
 | 
				
			||||||
 | 
					            android:orientation="horizontal">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <TextView
 | 
				
			||||||
 | 
					                android:id="@+id/nameItem"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_weight="1"
 | 
				
			||||||
 | 
					                android:text="ItemName" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <TextView
 | 
				
			||||||
 | 
					                android:id="@+id/anzahlItem"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_weight="1"
 | 
				
			||||||
 | 
					                android:text="Anzahl" />
 | 
				
			||||||
 | 
					        </LinearLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <LinearLayout
 | 
				
			||||||
 | 
					            android:layout_width="match_parent"
 | 
				
			||||||
 | 
					            android:layout_height="match_parent"
 | 
				
			||||||
 | 
					            android:layout_weight="1"
 | 
				
			||||||
 | 
					            android:orientation="horizontal">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <ImageView
 | 
				
			||||||
 | 
					                android:id="@+id/itemBearbeiten"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_weight="1"
 | 
				
			||||||
 | 
					                app:srcCompat="@drawable/bearbeiten" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <ImageView
 | 
				
			||||||
 | 
					                android:id="@+id/itemDel"
 | 
				
			||||||
 | 
					                android:layout_width="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_height="wrap_content"
 | 
				
			||||||
 | 
					                android:layout_weight="1"
 | 
				
			||||||
 | 
					                app:srcCompat="@drawable/delete" />
 | 
				
			||||||
 | 
					        </LinearLayout>
 | 
				
			||||||
 | 
					    </LinearLayout>
 | 
				
			||||||
 | 
					</android.support.v7.widget.CardView>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -61,6 +61,7 @@
 | 
				
			|||||||
            card_view:layout_constraintBottom_toBottomOf="parent"
 | 
					            card_view:layout_constraintBottom_toBottomOf="parent"
 | 
				
			||||||
            card_view:layout_constraintStart_toStartOf="parent"
 | 
					            card_view:layout_constraintStart_toStartOf="parent"
 | 
				
			||||||
            card_view:layout_constraintTop_toBottomOf="@+id/shoppinglistOwner" />
 | 
					            card_view:layout_constraintTop_toBottomOf="@+id/shoppinglistOwner" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </android.support.constraint.ConstraintLayout>
 | 
					    </android.support.constraint.ConstraintLayout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</android.support.v7.widget.CardView>
 | 
					</android.support.v7.widget.CardView>
 | 
				
			||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
 | 
					<menu xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
				
			||||||
 | 
					    xmlns:android="http://schemas.android.com/apk/res/android">
 | 
				
			||||||
    <item
 | 
					    <item
 | 
				
			||||||
        android:id="@+id/logoutBtn"
 | 
					        android:id="@+id/logoutBtn"
 | 
				
			||||||
        android:title="Logout"
 | 
					        android:title="Logout"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
 | 
					<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
 | 
				
			||||||
    <background android:drawable="@drawable/ic_launcher_background" />
 | 
					    <background android:drawable="@color/ic_launcher_background"/>
 | 
				
			||||||
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
 | 
					    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
 | 
				
			||||||
</adaptive-icon>
 | 
					</adaptive-icon>
 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
 | 
					<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
 | 
				
			||||||
    <background android:drawable="@drawable/ic_launcher_background" />
 | 
					    <background android:drawable="@color/ic_launcher_background"/>
 | 
				
			||||||
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
 | 
					    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
 | 
				
			||||||
</adaptive-icon>
 | 
					</adaptive-icon>
 | 
				
			||||||
| 
		 Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.2 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.8 KiB  | 
| 
		 Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 2.8 KiB  | 
| 
		 Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 931 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.8 KiB  | 
| 
		 Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 1.7 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 2.5 KiB  | 
| 
		 Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 4.0 KiB  | 
| 
		 Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 2.7 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 4.2 KiB  | 
| 
		 Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.3 KiB  | 
| 
		 Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 3.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 5.9 KiB  | 
| 
		 Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 9.2 KiB  | 
							
								
								
									
										4
									
								
								app/src/main/res/values/ic_launcher_background.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<resources>
 | 
				
			||||||
 | 
					    <color name="ic_launcher_background">#353535</color>
 | 
				
			||||||
 | 
					</resources>
 | 
				
			||||||
@@ -1,4 +1,6 @@
 | 
				
			|||||||
<resources>
 | 
					<resources>
 | 
				
			||||||
    <string name="app_name">SmartShopper</string>
 | 
					    <string name="app_name">SmartShopper</string>
 | 
				
			||||||
    <string name="title_activity_dash">Dash</string>
 | 
					    <string name="title_activity_dash">Dash</string>
 | 
				
			||||||
 | 
					    <string name="title_activity_shoppinglist_detail">ShoppinglistDetail</string>
 | 
				
			||||||
 | 
					    <string name="title_activity_shoppinglist_details">ShoppinglistDetails</string>
 | 
				
			||||||
</resources>
 | 
					</resources>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-hdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 269 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-hdpi/ic_action_name.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 274 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-hdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 340 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-mdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 149 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-mdpi/ic_action_name.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 165 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-mdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 220 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xhdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 216 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xhdpi/ic_action_name.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 266 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xhdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 384 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xxhdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 386 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xxhdpi/ic_action_name.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 458 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xxhdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 679 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xxxhdpi/bearbeiten.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 373 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xxxhdpi/ic_action_name.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 505 B  | 
							
								
								
									
										
											BIN
										
									
								
								app/src/release/res/drawable-xxxhdpi/user.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 795 B  |