Shared Shoppingliste show, add, del, insert link
Alle funktionen von shared sind verfügbar
This commit is contained in:
parent
6eb0e704d1
commit
24f55b60c8
153
.idea/assetWizardSettings.xml
generated
Normal file
153
.idea/assetWizardSettings.xml
generated
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<?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="children">
|
||||||
|
<map>
|
||||||
|
<entry key="clipArt">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="color" value="000000" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="image">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="color" value="000000" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="assetType" value="IMAGE" />
|
||||||
|
<entry key="imageAsset" value="C:\Users\georg\Downloads\baseline-share-black-18\2x\baseline_share_black_18dp.png" />
|
||||||
|
<entry key="outputName" value="share" />
|
||||||
|
<entry key="themeColor" value="ffffff" />
|
||||||
|
</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="color" value="000000" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="launcherLegacy">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="children">
|
||||||
|
<map>
|
||||||
|
<entry key="clipArt">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="color" value="000000" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="notification">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="children">
|
||||||
|
<map>
|
||||||
|
<entry key="clipArt">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="color" value="000000" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="image">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="color" value="000000" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="assetType" value="IMAGE" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="outputIconType" value="ACTIONBAR" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
BIN
.idea/caches/gradle_models.ser
generated
BIN
.idea/caches/gradle_models.ser
generated
Binary file not shown.
@ -40,4 +40,5 @@ dependencies {
|
|||||||
implementation 'com.android.support:cardview-v7:28.0.0'
|
implementation 'com.android.support:cardview-v7:28.0.0'
|
||||||
implementation 'com.github.danielnilsson9:color-picker-view:1.4.0@aar'
|
implementation 'com.github.danielnilsson9:color-picker-view:1.4.0@aar'
|
||||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||||
|
implementation 'com.android.support:support-v4:28.0.0'
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package at.smartshopper.smartshopper.activitys;
|
package at.smartshopper.smartshopper.activitys;
|
||||||
|
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -7,10 +10,13 @@ import android.os.Build;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.design.widget.TabLayout;
|
||||||
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.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -44,12 +50,12 @@ import at.smartshopper.smartshopper.shoppinglist.Shoppinglist;
|
|||||||
import at.smartshopper.smartshopper.shoppinglist.ShoppinglistAdapter;
|
import at.smartshopper.smartshopper.shoppinglist.ShoppinglistAdapter;
|
||||||
|
|
||||||
|
|
||||||
public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnItemClicked, ShoppinglistAdapter.OnChangeItemClick {
|
public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnItemClicked, ShoppinglistAdapter.OnChangeItemClick, ShoppinglistAdapter.OnShareClick {
|
||||||
|
|
||||||
private Database db = new Database();
|
private Database db = new Database();
|
||||||
private SwipeRefreshLayout ownswiperefresh;
|
private SwipeRefreshLayout ownswiperefresh, sharedswiperefresh;
|
||||||
private FloatingActionButton addShoppinglistFab;
|
private FloatingActionButton addShoppinglistFab;
|
||||||
private PopupWindow popupWindowAdd;
|
private PopupWindow popupWindowAdd, popupShare, popupAddShare;
|
||||||
private String color;
|
private String color;
|
||||||
private Button colorBtn;
|
private Button colorBtn;
|
||||||
|
|
||||||
@ -116,12 +122,30 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
showOwnShoppingList(uid);
|
showOwnShoppingList(uid);
|
||||||
|
showSharedShoppingList(uid);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sharedswiperefresh = (SwipeRefreshLayout) findViewById(R.id.sharedSwipe);
|
||||||
|
|
||||||
|
sharedswiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
try {
|
||||||
|
showSharedShoppingList(uid);
|
||||||
|
sharedswiperefresh.setRefreshing(false);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
ownswiperefresh = (SwipeRefreshLayout) findViewById(R.id.ownSwipe);
|
ownswiperefresh = (SwipeRefreshLayout) findViewById(R.id.ownSwipe);
|
||||||
|
|
||||||
ownswiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
ownswiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@ -187,9 +211,9 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
if (fromDB) {
|
if (fromDB) {
|
||||||
Shoppinglist dbShoppinglist = db.getShoppinglist(sl_id);
|
Shoppinglist dbShoppinglist = db.getShoppinglist(sl_id);
|
||||||
String colorstring;
|
String colorstring;
|
||||||
if(dbShoppinglist.getcolor().contains("#")){
|
if (dbShoppinglist.getcolor().contains("#")) {
|
||||||
colorstring = dbShoppinglist.getcolor();
|
colorstring = dbShoppinglist.getcolor();
|
||||||
}else{
|
} else {
|
||||||
colorstring = "#" + dbShoppinglist.getcolor();
|
colorstring = "#" + dbShoppinglist.getcolor();
|
||||||
}
|
}
|
||||||
this.color = colorstring;
|
this.color = colorstring;
|
||||||
@ -205,7 +229,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
if(fromDB){
|
if (fromDB) {
|
||||||
try {
|
try {
|
||||||
db.editShoppinglist(sl_idString, name.getText().toString(), description.getText().toString(), color);
|
db.editShoppinglist(sl_idString, name.getText().toString(), description.getText().toString(), color);
|
||||||
color = "ffffff";
|
color = "ffffff";
|
||||||
@ -216,7 +240,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
try {
|
try {
|
||||||
db.addShoppinglist(name.getText().toString(), description.getText().toString(), username, color);
|
db.addShoppinglist(name.getText().toString(), description.getText().toString(), username, color);
|
||||||
color = "ffffff";
|
color = "ffffff";
|
||||||
@ -259,6 +283,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
|
|
||||||
popupWindowAdd.setOutsideTouchable(false);
|
popupWindowAdd.setOutsideTouchable(false);
|
||||||
popupWindowAdd.setFocusable(true);
|
popupWindowAdd.setFocusable(true);
|
||||||
|
popupWindowAdd.setAnimationStyle(R.style.popup_window_animation_phone);
|
||||||
|
|
||||||
|
|
||||||
popupWindowAdd.showAtLocation(v, Gravity.CENTER, 0, 0);
|
popupWindowAdd.showAtLocation(v, Gravity.CENTER, 0, 0);
|
||||||
@ -301,6 +326,24 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macht eine Datenbankverbindung und holt alle Shoppinglists die mit dem User geteilt werden, diese werden auf dem recycled view angezeigt
|
||||||
|
*
|
||||||
|
* @param uid Die UserId damit von diesem user die shoppinglisten angezeigt werden
|
||||||
|
*/
|
||||||
|
private void showSharedShoppingList(String uid) throws JSONException, SQLException {
|
||||||
|
RecyclerView sharedRecycler = (RecyclerView) findViewById(R.id.sharedrecycler);
|
||||||
|
sharedRecycler.setHasFixedSize(true);
|
||||||
|
sharedRecycler.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
List<Shoppinglist> ownListsList = db.getSharedShoppinglists(uid);
|
||||||
|
ShoppinglistAdapter shpAdapter = new ShoppinglistAdapter(Dash.this, ownListsList);
|
||||||
|
shpAdapter.setOnDelClick(Dash.this);
|
||||||
|
shpAdapter.setOnChangeClick(Dash.this);
|
||||||
|
shpAdapter.setOnShareClick(Dash.this);
|
||||||
|
sharedRecycler.setAdapter(shpAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macht eine Datenbankverbindung und holt alle Shoppinglists die dem User gehören, diese werden auf dem recycled view angezeigt
|
* Macht eine Datenbankverbindung und holt alle Shoppinglists die dem User gehören, diese werden auf dem recycled view angezeigt
|
||||||
*
|
*
|
||||||
@ -314,6 +357,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
ShoppinglistAdapter shpAdapter = new ShoppinglistAdapter(Dash.this, ownListsList);
|
ShoppinglistAdapter shpAdapter = new ShoppinglistAdapter(Dash.this, ownListsList);
|
||||||
shpAdapter.setOnDelClick(Dash.this);
|
shpAdapter.setOnDelClick(Dash.this);
|
||||||
shpAdapter.setOnChangeClick(Dash.this);
|
shpAdapter.setOnChangeClick(Dash.this);
|
||||||
|
shpAdapter.setOnShareClick(Dash.this);
|
||||||
ownRecycleView.setAdapter(shpAdapter);
|
ownRecycleView.setAdapter(shpAdapter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -371,6 +415,9 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
logout();
|
logout();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.addInvite:
|
||||||
|
popupaddInvite();
|
||||||
|
|
||||||
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.
|
||||||
@ -379,6 +426,82 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Öffnet ein popup in dem ein invite link eingegeben werden kann. Diese Shoppingliste wird dann hinzugefügt
|
||||||
|
*/
|
||||||
|
private void popupaddInvite() {
|
||||||
|
final LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
View popupContentView = inflater.inflate(R.layout.add_share_link, null);
|
||||||
|
|
||||||
|
final TextView linkEingabe = (TextView) popupContentView.findViewById(R.id.addShareLinkInput);
|
||||||
|
|
||||||
|
ImageButton exitButton = (ImageButton) popupContentView.findViewById(R.id.addShareExit);
|
||||||
|
Picasso.get().load(R.drawable.close).into(exitButton);
|
||||||
|
exitButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
popupAddShare.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button finish = (Button) popupContentView.findViewById(R.id.shareAddFinish);
|
||||||
|
finish.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String eingabeLink = linkEingabe.getText().toString();
|
||||||
|
|
||||||
|
String delString = null;
|
||||||
|
if (eingabeLink.contains("https://")) {
|
||||||
|
delString = "https://www.smartshopper.cf/invite/";
|
||||||
|
} else if (eingabeLink.contains("http://")) {
|
||||||
|
delString = "http://www.smartshopper.cf/invite/";
|
||||||
|
} else if (eingabeLink.contains("www.smartshopper.cf/invite/")) {
|
||||||
|
delString = "www.smartshopper.cf/invite/";
|
||||||
|
} else if (!eingabeLink.contains("www.smartshopper.cf/invite/")) {
|
||||||
|
delString = "";
|
||||||
|
}
|
||||||
|
String invite = eingabeLink.replace(delString, "");
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.addInviteLink(invite, FirebaseAuth.getInstance().getCurrentUser().getUid());
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
popupAddShare.dismiss();
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
TabHost tabhost = (TabHost) findViewById(R.id.tabHost1);
|
||||||
|
tabhost.setCurrentTab(1);
|
||||||
|
sharedswiperefresh.setRefreshing(true);
|
||||||
|
showSharedShoppingList(FirebaseAuth.getInstance().getCurrentUser().getUid());
|
||||||
|
sharedswiperefresh.setRefreshing(false);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
popupAddShare = new PopupWindow(popupContentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
popupAddShare.setOutsideTouchable(false);
|
||||||
|
popupAddShare.setFocusable(true);
|
||||||
|
// Set an elevation value for popup window
|
||||||
|
// Call requires API level 21
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
popupAddShare.setElevation(5.0f);
|
||||||
|
}
|
||||||
|
popupAddShare.setAnimationStyle(R.style.popup_window_animation_phone);
|
||||||
|
|
||||||
|
|
||||||
|
popupAddShare.showAtLocation(getWindow().getDecorView().findViewById(android.R.id.content), Gravity.CENTER, 0, 0);
|
||||||
|
popupAddShare.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Für Double Back press to exit
|
//Für Double Back press to exit
|
||||||
private boolean doubleBackToExitPressedOnce = false;
|
private boolean doubleBackToExitPressedOnce = false;
|
||||||
@ -437,4 +560,90 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShareClick(String sl_id, View v) {
|
||||||
|
Log.d("ShareClick test", "Workt sl_id: " + sl_id);
|
||||||
|
String link = null;
|
||||||
|
try {
|
||||||
|
if (db.isShared(sl_id)) {
|
||||||
|
link = db.getInviteLink(sl_id);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
link = db.createInviteLink(sl_id);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
final LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
View popupContentView = inflater.inflate(R.layout.add_share, null);
|
||||||
|
|
||||||
|
final TextView linkausgabe = (TextView) popupContentView.findViewById(R.id.shareLink);
|
||||||
|
linkausgabe.setText("www.smartshopper.cf/invite/" + link);
|
||||||
|
|
||||||
|
ImageButton exitButton = (ImageButton) popupContentView.findViewById(R.id.shareExit);
|
||||||
|
Picasso.get().load(R.drawable.close).into(exitButton);
|
||||||
|
exitButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
popupShare.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button copyButton = (Button) popupContentView.findViewById(R.id.shareCopy);
|
||||||
|
copyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("SmartShopper", linkausgabe.getText().toString());
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
popupShare.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button delShare = (Button) popupContentView.findViewById(R.id.delShare);
|
||||||
|
|
||||||
|
final String finalLink = link;
|
||||||
|
delShare.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.deleteInvite(finalLink);
|
||||||
|
|
||||||
|
|
||||||
|
TabHost tabhost = (TabHost) findViewById(R.id.tabHost1);
|
||||||
|
tabhost.setCurrentTab(1);
|
||||||
|
sharedswiperefresh.setRefreshing(true);
|
||||||
|
|
||||||
|
showSharedShoppingList(FirebaseAuth.getInstance().getCurrentUser().getUid());
|
||||||
|
sharedswiperefresh.setRefreshing(false);
|
||||||
|
popupShare.dismiss();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
popupShare = new PopupWindow(popupContentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
popupShare.setOutsideTouchable(false);
|
||||||
|
popupShare.setFocusable(true);
|
||||||
|
// Set an elevation value for popup window
|
||||||
|
// Call requires API level 21
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
popupShare.setElevation(5.0f);
|
||||||
|
}
|
||||||
|
popupShare.setAnimationStyle(R.style.popup_window_animation_phone);
|
||||||
|
|
||||||
|
|
||||||
|
popupShare.showAtLocation(v, Gravity.CENTER, 0, 0);
|
||||||
|
popupShare.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ public class Database {
|
|||||||
public Database() {
|
public Database() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verbindet Sich mit der Datenbank. Auf der Konsole wird "Database connected!" angezeigt, bei erfolgreicher verbindung
|
* Verbindet Sich mit der Datenbank. Auf der Konsole wird "Database connected!" angezeigt, bei erfolgreicher verbindung
|
||||||
*
|
*
|
||||||
@ -50,10 +49,125 @@ public class Database {
|
|||||||
System.out.println("Database connected!");
|
System.out.println("Database connected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entfernt einen invitelink anhand des invitelinks
|
||||||
|
* @param invitelink Löscht den invitelink aus der ganzen db
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws JSONException
|
||||||
|
*/
|
||||||
|
public void deleteInvite(String invitelink) throws SQLException, JSONException {
|
||||||
|
String sl_id = getSlIdFromInvite(invitelink);
|
||||||
|
sqlUpdate("DELETE FROM \"Shoppinglist_member\" WHERE sl_id = ?", sl_id);
|
||||||
|
sqlUpdate("Update \"Shoppinglist\" set invitelink=null where sl_id=?", sl_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt den Invite link einer Shoppingliste zurück, wenn keiner vorhanden ist --> null
|
||||||
|
* @param sl_id Die shoppinglist von der der invitelimnk gefragt ist
|
||||||
|
* @return Der invite link
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws JSONException
|
||||||
|
*/
|
||||||
|
public String getInviteLink(String sl_id) throws SQLException, JSONException{
|
||||||
|
connectDatabase();
|
||||||
|
String SQL = "Select invitelink from \"Shoppinglist\" WHERE sl_id = ?";
|
||||||
|
|
||||||
|
PreparedStatement pstmt = conect.prepareStatement(SQL);
|
||||||
|
pstmt.setString(1, sl_id);
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
|
||||||
|
rs.next();
|
||||||
|
String returnLink = rs.getString(1);
|
||||||
|
|
||||||
|
|
||||||
|
return returnLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht anhand des invitelinks eine Shoppingliste und gibt dessen sl_id zurück
|
||||||
|
* @param invitelink Der invitelink nach dem gesucht werden soll
|
||||||
|
* @return Die sl_id die dem invitelink zugeordnet ist
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws JSONException
|
||||||
|
*/
|
||||||
|
private String getSlIdFromInvite(String invitelink) throws SQLException, JSONException{
|
||||||
|
connectDatabase();
|
||||||
|
String SQL = "Select sl_id from \"Shoppinglist\" WHERE invitelink = ?";
|
||||||
|
|
||||||
|
PreparedStatement pstmt = conect.prepareStatement(SQL);
|
||||||
|
pstmt.setString(1, invitelink);
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
|
||||||
|
rs.next();
|
||||||
|
String returnSl_id = rs.getString(1);
|
||||||
|
|
||||||
|
|
||||||
|
return returnSl_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt einen invite link zu den shoppinglisten hinzu
|
||||||
|
* @param invitelink Der invite link der hinzugefügt werden soll
|
||||||
|
* @param uid Der user zu dem der invitelink hinzugefügt werden soll
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws JSONException
|
||||||
|
*/
|
||||||
|
public void addInviteLink(String invitelink, String uid) throws SQLException, JSONException {
|
||||||
|
String sl_id = getSlIdFromInvite(invitelink);
|
||||||
|
if(!sl_id.equals("null")){
|
||||||
|
sqlUpdate2Param("INSERT INTO \"Shoppinglist_member\" (username, sl_id) VALUES (?, ?)", uid, sl_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen InviteLink
|
||||||
|
* @param sl_id
|
||||||
|
* @return Der neue InviteLink
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
public String createInviteLink(String sl_id) throws SQLException{
|
||||||
|
String invitelink = generateInviteLink();
|
||||||
|
sqlUpdate2Param("UPDATE \"Shoppinglist\" SET invitelink = ? WHERE sl_id = ?", invitelink, sl_id);
|
||||||
|
return invitelink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wenn die Shoppingliste bereits geshared ist wird true zurückgegeben
|
||||||
|
* @param sl_id Die Liste die geprüft werden soll
|
||||||
|
* @return True wenn die liste bereits geshared ist
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws JSONException
|
||||||
|
*/
|
||||||
|
public boolean isShared(String sl_id) throws SQLException, JSONException {
|
||||||
|
connectDatabase();
|
||||||
|
|
||||||
|
String SQL = "SELECT row_to_json(\"Shoppinglist\") AS obj FROM \"Shoppinglist\" WHERE sl_id = ?";
|
||||||
|
|
||||||
|
PreparedStatement pstmt = conect.prepareStatement(SQL);
|
||||||
|
pstmt.setString(1, sl_id);
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
boolean returnBoolean = false;
|
||||||
|
while(rs.next()){
|
||||||
|
JSONObject jsonObject = new JSONObject(rs.getString(1));
|
||||||
|
|
||||||
|
Log.d("isShared LOG ", jsonObject.getString("invitelink"));
|
||||||
|
|
||||||
|
if(jsonObject.getString("invitelink").equals("null")){
|
||||||
|
returnBoolean = false;
|
||||||
|
}else{
|
||||||
|
returnBoolean = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Löscht eine Gruppe von der Tabelle Group und alle items dieser group, desswegen wird aucj die tabelle item geleert
|
* Löscht eine Gruppe von der Tabelle Group und alle items dieser group, desswegen wird aucj die tabelle item geleert
|
||||||
|
*
|
||||||
* @param group_id Die group id welche gelöscht werden soll
|
* @param group_id Die group id welche gelöscht werden soll
|
||||||
* @param sl_id Die Shoppingliste auf der sich die group befindet
|
* @param sl_id Die Shoppingliste auf der sich die group befindet
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public void deleteGroup(String group_id, String sl_id) throws SQLException {
|
public void deleteGroup(String group_id, String sl_id) throws SQLException {
|
||||||
@ -61,12 +175,31 @@ public class Database {
|
|||||||
sqlUpdate2Param("DELETE FROM \"Group\" WHERE group_id = ? AND sl_id = ?", group_id, sl_id);
|
sqlUpdate2Param("DELETE FROM \"Group\" WHERE group_id = ? AND sl_id = ?", group_id, sl_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt den Besitzer einer Shoppingliste zurück
|
||||||
|
* @param sl_id Shoppingliste von der der Besitzer gefunden werden soll
|
||||||
|
* @return Die uid des Besitzers
|
||||||
|
*/
|
||||||
|
public String getShoppinglistOwner(String sl_id) throws SQLException {
|
||||||
|
connectDatabase();
|
||||||
|
|
||||||
|
String SQL = "Select username from \"Shoppinglist_admin\" WHERE sl_id = ?";
|
||||||
|
PreparedStatement pstmt = conect.prepareStatement(SQL);
|
||||||
|
pstmt.setString(1, sl_id);
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
|
||||||
|
String owner = rs.getString(1);
|
||||||
|
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bearbeitet ein Item in der Datenbank
|
* Bearbeitet ein Item in der Datenbank
|
||||||
* @param item_id Daqs zu bearbeitende item
|
*
|
||||||
|
* @param item_id Daqs zu bearbeitende item
|
||||||
* @param group_id Die gruppe in dem da sitem ist
|
* @param group_id Die gruppe in dem da sitem ist
|
||||||
* @param sl_id die shoppinglist in dem das item ist
|
* @param sl_id die shoppinglist in dem das item ist
|
||||||
* @param newname der neue name
|
* @param newname der neue name
|
||||||
* @param newcount die neue anzahl
|
* @param newcount die neue anzahl
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
@ -91,9 +224,10 @@ public class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Löscht ein item
|
* Löscht ein item
|
||||||
* @param item_id Item id
|
*
|
||||||
|
* @param item_id Item id
|
||||||
* @param group_id group id
|
* @param group_id group id
|
||||||
* @param sl_id shoppoinglist id
|
* @param sl_id shoppoinglist id
|
||||||
*/
|
*/
|
||||||
public void deleteItem(String item_id, String group_id, String sl_id) throws SQLException {
|
public void deleteItem(String item_id, String group_id, String sl_id) throws SQLException {
|
||||||
sqlUpdate3Param("DELETE FROM \"Item\" WHERE item_id = ? AND group_id = ? AND sl_id = ?", item_id, group_id, sl_id);
|
sqlUpdate3Param("DELETE FROM \"Item\" WHERE item_id = ? AND group_id = ? AND sl_id = ?", item_id, group_id, sl_id);
|
||||||
@ -101,10 +235,11 @@ public class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fügt ein neues Item der Datenbank hinzu
|
* Fügt ein neues Item der Datenbank hinzu
|
||||||
|
*
|
||||||
* @param group_id Die group id in der das neue item angezeigt werden soll
|
* @param group_id Die group id in der das neue item angezeigt werden soll
|
||||||
* @param sl_id Die Shoppingliste in der das neue item nagezeigt werden soll
|
* @param sl_id Die Shoppingliste in der das neue item nagezeigt werden soll
|
||||||
* @param name Der name des Items
|
* @param name Der name des Items
|
||||||
* @param count Die anzahl des Items
|
* @param count Die anzahl des Items
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public void addItem(String group_id, String sl_id, String name, int count) throws SQLException {
|
public void addItem(String group_id, String sl_id, String name, int count) throws SQLException {
|
||||||
@ -154,6 +289,7 @@ public class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hollt ein bestimtes item
|
* Hollt ein bestimtes item
|
||||||
|
*
|
||||||
* @param item_id Die sl_id in der das item ist
|
* @param item_id Die sl_id in der das item ist
|
||||||
* @return
|
* @return
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
@ -349,6 +485,35 @@ public class Database {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verbindet sich mit dem server
|
||||||
|
* Holt alle shared shoppinglists des users
|
||||||
|
* @param uid User von dem die Shared Shoppinglists geholt werden sollen
|
||||||
|
* @return Die Shared Shoppinglisten des Users
|
||||||
|
* @throws SQLException
|
||||||
|
* @throws JSONException
|
||||||
|
*/
|
||||||
|
public List<Shoppinglist> getSharedShoppinglists(String uid) throws SQLException, JSONException {
|
||||||
|
connectDatabase();
|
||||||
|
String SQL = "SELECT row_to_json(\"Shoppinglist\") AS obj FROM \"Shoppinglist\" JOIN \"Shoppinglist_member\" USING (sl_id) WHERE username = ?";
|
||||||
|
PreparedStatement pstmt = conect.prepareStatement(SQL);
|
||||||
|
pstmt.setString(1, uid);
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
System.out.println(uid);
|
||||||
|
|
||||||
|
ArrayList<Shoppinglist> shoppinglistArrayList = new ArrayList<Shoppinglist>();
|
||||||
|
|
||||||
|
while(rs.next()){
|
||||||
|
String shoppinglist = rs.getString(1);
|
||||||
|
JSONObject jsonObject = new JSONObject(shoppinglist);
|
||||||
|
|
||||||
|
shoppinglistArrayList.add(new Shoppinglist(jsonObject.getString("sl_id"), jsonObject.getString("name"), jsonObject.getString("description"), jsonObject.getString("invitelink"), jsonObject.getString("color")));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (List<Shoppinglist>) shoppinglistArrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hoolt alle groups und items der list und erstelt ein Detail objekt von jeder group. Die detail objekte kommen in eine List
|
* Hoolt alle groups und items der list und erstelt ein Detail objekt von jeder group. Die detail objekte kommen in eine List
|
||||||
@ -382,8 +547,9 @@ public class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt alle Items einer bestimmten gruppe
|
* Holt alle Items einer bestimmten gruppe
|
||||||
|
*
|
||||||
* @param group_id Gruppe welche geholt werden soll
|
* @param group_id Gruppe welche geholt werden soll
|
||||||
* @param sl_id Die Shoppinglist in der sich die gruppe befindet
|
* @param sl_id Die Shoppinglist in der sich die gruppe befindet
|
||||||
* @return
|
* @return
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
@ -392,9 +558,9 @@ public class Database {
|
|||||||
List<Details> details = getListDetails(sl_id);
|
List<Details> details = getListDetails(sl_id);
|
||||||
ArrayList<Item> result = new ArrayList<Item>();
|
ArrayList<Item> result = new ArrayList<Item>();
|
||||||
|
|
||||||
for(Details d : details){
|
for (Details d : details) {
|
||||||
String group_idtmp = d.getGroup().getGroup_id();
|
String group_idtmp = d.getGroup().getGroup_id();
|
||||||
if(group_idtmp.equals(group_id)){
|
if (group_idtmp.equals(group_id)) {
|
||||||
result = d.getItems();
|
result = d.getItems();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,6 +594,7 @@ public class Database {
|
|||||||
private String generateGroupId() {
|
private String generateGroupId() {
|
||||||
return generateSL_Id();
|
return generateSL_Id();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generiert eine neue 8 stellige item_id
|
* Generiert eine neue 8 stellige item_id
|
||||||
*
|
*
|
||||||
@ -437,6 +604,15 @@ public class Database {
|
|||||||
return generateSL_Id();
|
return generateSL_Id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generiert eine neue 8 stellige inviteLink
|
||||||
|
*
|
||||||
|
* @return Neue intielink
|
||||||
|
*/
|
||||||
|
public String generateInviteLink() {
|
||||||
|
return generateSL_Id();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt alle Items einer bestimmten shoppingliste, angegeben durch die shoppinglist id
|
* Holt alle Items einer bestimmten shoppingliste, angegeben durch die shoppinglist id
|
||||||
|
@ -14,6 +14,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.firebase.auth.FirebaseAuth;
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
import com.google.firebase.auth.FirebaseUser;
|
import com.google.firebase.auth.FirebaseUser;
|
||||||
@ -31,6 +32,7 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
|||||||
|
|
||||||
private OnChangeItemClick onChangeClick;
|
private OnChangeItemClick onChangeClick;
|
||||||
private OnItemClicked onClick;
|
private OnItemClicked onClick;
|
||||||
|
private OnShareClick onShareClick;
|
||||||
private at.smartshopper.smartshopper.db.Database db;
|
private at.smartshopper.smartshopper.db.Database db;
|
||||||
|
|
||||||
//this context we will use to inflate the layout
|
//this context we will use to inflate the layout
|
||||||
@ -70,6 +72,11 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
|||||||
public void onBindViewHolder(ShoppinglistViewHolder holder, final int position) {
|
public void onBindViewHolder(ShoppinglistViewHolder holder, final int position) {
|
||||||
//getting the product of the specified position,
|
//getting the product of the specified position,
|
||||||
final Shoppinglist shoppinglist = this.shoppinglist.get(position);
|
final Shoppinglist shoppinglist = this.shoppinglist.get(position);
|
||||||
|
ImageButton shareButton = holder.share;
|
||||||
|
|
||||||
|
Picasso.get().load(R.drawable.share).into(shareButton);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
db = new Database();
|
db = new Database();
|
||||||
|
|
||||||
@ -107,6 +114,15 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
shareButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String sl_id = shoppinglist.getSlId();
|
||||||
|
Toast.makeText(v.getContext(), "LISTENER im ADAPTER geht: " + sl_id, Toast.LENGTH_LONG);
|
||||||
|
onShareClick.onShareClick(sl_id, v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
int cardcolor;
|
int cardcolor;
|
||||||
try {
|
try {
|
||||||
cardcolor = Color.parseColor(shoppinglist.getcolor());
|
cardcolor = Color.parseColor(shoppinglist.getcolor());
|
||||||
@ -176,6 +192,25 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
|||||||
this.onClick=onClick;
|
this.onClick=onClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface damit onoclick in der dash activity ausgeführt werden kann
|
||||||
|
*/
|
||||||
|
public interface OnShareClick{
|
||||||
|
void onShareClick(String sl_id, View v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das OnChangeItemClick event
|
||||||
|
* @param onShareClick Der Click event Listener
|
||||||
|
*/
|
||||||
|
public void setOnShareClick(OnShareClick onShareClick){
|
||||||
|
this.onShareClick = onShareClick;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Haltet alle elemente. Durch ein Objekt von dem kann jedes Element welches hier drinnen angeführt ist verwendet werden
|
* Haltet alle elemente. Durch ein Objekt von dem kann jedes Element welches hier drinnen angeführt ist verwendet werden
|
||||||
@ -185,7 +220,7 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
|||||||
TextView textViewTitle, textViewBeschreibung, ownerName;
|
TextView textViewTitle, textViewBeschreibung, ownerName;
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
CardView ownList;
|
CardView ownList;
|
||||||
ImageButton bearbeiten, del;
|
ImageButton bearbeiten, del, share;
|
||||||
View shoppinglistColor;
|
View shoppinglistColor;
|
||||||
|
|
||||||
public ShoppinglistViewHolder(View itemView) {
|
public ShoppinglistViewHolder(View itemView) {
|
||||||
@ -199,7 +234,7 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
|||||||
bearbeiten = itemView.findViewById(R.id.bearbeiteShoppinglist);
|
bearbeiten = itemView.findViewById(R.id.bearbeiteShoppinglist);
|
||||||
del = itemView.findViewById(R.id.deleteShoppinglist);
|
del = itemView.findViewById(R.id.deleteShoppinglist);
|
||||||
shoppinglistColor = itemView.findViewById(R.id.shoppinglistColor);
|
shoppinglistColor = itemView.findViewById(R.id.shoppinglistColor);
|
||||||
|
share = itemView.findViewById(R.id.shareButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
app/src/main/res/animator/fade_out.xml
Normal file
8
app/src/main/res/animator/fade_out.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<alpha
|
||||||
|
android:duration="1500"
|
||||||
|
android:fromAlpha="0.1"
|
||||||
|
android:toAlpha="1" />
|
||||||
|
</set>
|
BIN
app/src/main/res/drawable-hdpi/share.png
Normal file
BIN
app/src/main/res/drawable-hdpi/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 547 B |
BIN
app/src/main/res/drawable-mdpi/share.png
Normal file
BIN
app/src/main/res/drawable-mdpi/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 461 B |
BIN
app/src/main/res/drawable-xhdpi/share.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1011 B |
BIN
app/src/main/res/drawable-xxhdpi/share.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 755 B |
BIN
app/src/main/res/drawable-xxxhdpi/share.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -75,10 +75,19 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/sharedrecycler"
|
android:id="@+id/sharedSwipe"
|
||||||
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:id="@+id/sharedrecycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</android.support.v7.widget.RecyclerView>
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
94
app/src/main/res/layout/add_share.xml
Normal file
94
app/src/main/res/layout/add_share.xml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="right"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/shareExit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/fui_transparent"
|
||||||
|
app:srcCompat="@drawable/close"
|
||||||
|
tools:layout_editor_absoluteY="731dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Shared Link"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/shareLink"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:editable="false"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:text="Shared Link"
|
||||||
|
tools:layout_editor_absoluteY="731dp" />
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center" >
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/shareCopy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="in die zwischenablage kopieren" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/delShare"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=" Share Aufheben" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
</android.support.v7.widget.CardView>
|
77
app/src/main/res/layout/add_share_link.xml
Normal file
77
app/src/main/res/layout/add_share_link.xml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<android.support.v7.widget.CardView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="right"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/addShareExit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/fui_transparent"
|
||||||
|
app:srcCompat="@drawable/close" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Hier den Invite Link eingeben:"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/addShareLinkInput"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPersonName" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/shareAddFinish"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Fertig" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
</android.support.v7.widget.CardView>
|
@ -76,7 +76,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linearLayout"
|
android:id="@+id/linearLayout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
card_view:layout_constraintBottom_toBottomOf="parent"
|
card_view:layout_constraintBottom_toBottomOf="parent"
|
||||||
@ -118,7 +118,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
card_view:layout_constraintGuide_begin="343dp" />
|
card_view:layout_constraintGuide_begin="319dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linearLayout3"
|
android:id="@+id/linearLayout3"
|
||||||
@ -133,6 +133,13 @@
|
|||||||
card_view:layout_constraintStart_toStartOf="@+id/guideline2"
|
card_view:layout_constraintStart_toStartOf="@+id/guideline2"
|
||||||
card_view:layout_constraintTop_toTopOf="parent">
|
card_view:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/shareButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/fui_transparent"
|
||||||
|
card_view:srcCompat="@drawable/share" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/bearbeiteShoppinglist"
|
android:id="@+id/bearbeiteShoppinglist"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/ocrBtn"
|
android:id="@+id/addInvite"
|
||||||
android:title="Rechnung Scanen" />
|
android:title="Insert Invite" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/logoutBtn"
|
android:id="@+id/logoutBtn"
|
||||||
android:title="Logout"
|
android:title="Logout"
|
||||||
|
@ -7,4 +7,8 @@
|
|||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="popup_window_animation_phone">
|
||||||
|
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
|
||||||
|
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user