Share, Toolbar, Fixes

User create hat einen leeren user erstellt, jetzt nichtmehr
Share Button wurde hinzugefügt
In zwischenablage kopieren wurde entfernt
Eine toolbar mit der farbe der Gruppe/Shoppingliste wurde hinzugefügt
Toolbar hat den namen der Shoppingliste/Gruppe
This commit is contained in:
Georg Reisinger 2019-03-26 19:42:58 +01:00
parent 2439505b33
commit 9fc3c9d70c
26 changed files with 477 additions and 83 deletions

Binary file not shown.

View File

@ -5,10 +5,10 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "at.smartshopper.smartshopperapp"
minSdkVersion 26
minSdkVersion 19
targetSdkVersion 28
versionCode 5
versionName "3.2"
versionCode 10
versionName "4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -28,7 +28,7 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'

View File

@ -30,6 +30,14 @@
"certificate_hash": "4f9180e4472117e0f2b5a891778d247c99b1ea16"
}
},
{
"client_id": "221332577314-e0fidj0e30k4f7bffbpn263o6q41klah.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "at.smartshopper.smartshopperapp",
"certificate_hash": "3f5e1db662961243853557e59547222f4980eeb2"
}
},
{
"client_id": "221332577314-oo8b4uqtlgj75e7u7o3qt1vc96prfv52.apps.googleusercontent.com",
"client_type": 3

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":5,"versionName":"3.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":10,"versionName":"4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

View File

@ -15,6 +15,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
@ -138,6 +139,10 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dash);
Toolbar myToolbar = (Toolbar) findViewById(R.id.dashToolbar);
setSupportActionBar(myToolbar);
color = "ffffff";
setMsgId();
@ -289,7 +294,9 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
colorBtn = (Button) customView.findViewById(R.id.addColor);
final Button addFertig = (Button) customView.findViewById(R.id.addFertig);
final EditText name = (EditText) customView.findViewById(R.id.addName);
name.setTextIsSelectable(true);
final EditText description = (EditText) customView.findViewById(R.id.addDescription);
description.setTextIsSelectable(true);
Picasso.get().load(R.drawable.close).into(addClose);
@ -298,6 +305,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
} else {
addFertig.setEnabled(false);
}
name.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -478,7 +486,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
sharedListsListTmp = sharedListsArrayListTmp;
} else {
sharedListsListTmp = sharedListsList;
findViewById(R.id.pfeilnachunten3).setVisibility(View.GONE);
// findViewById(R.id.pfeilnachunten3).setVisibility(View.GONE);
}
ShoppinglistSharedAdapter shpAdapter = new ShoppinglistSharedAdapter(Dash.this, sharedListsListTmp, db);
if (sharedListsList.isEmpty()) {
@ -599,23 +607,37 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
spec.setIndicator("Geteilte Einkaufslisten");
host.addTab(spec);
host.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
int i = host.getCurrentTab();
View pfeil = findViewById(R.id.pfeilnachunten3);
FloatingActionButton fab = findViewById(R.id.addShoppinglistFab);
if (i == 0) {
try {
refreshOwnShoppinglist(uid);
fab.show();
if (db.getMyShoppinglists(uid).isEmpty()) {
pfeil.setVisibility(View.VISIBLE);
} else {
pfeil.setVisibility(View.GONE);
}
//TODO
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
} else if (i == 1) {
try {
showSharedShoppingList(uid);
pfeil.setVisibility(View.GONE);
fab.hide();
} catch (JSONException e) {
e.printStackTrace();
} catch (SQLException e) {
@ -863,7 +885,6 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
//
// return link;
// }
@Override
public void onShareClick(final String sl_id, final View v) {
String link = null;
@ -874,6 +895,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
View popupContentView = inflater.inflate(R.layout.add_share, null);
final TextView linkausgabe = (TextView) popupContentView.findViewById(R.id.shareLink);
linkausgabe.setTextIsSelectable(true);
linkausgabe.setText("invite.dergeorg.at/invite/" + link);
ImageButton exitButton = (ImageButton) popupContentView.findViewById(R.id.shareExit);
@ -885,15 +907,37 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
}
});
final Button copyButton = (Button) popupContentView.findViewById(R.id.shareCopy);
copyButton.setOnClickListener(new View.OnClickListener() {
ImageButton shareIntentBtn = (ImageButton) popupContentView.findViewById(R.id.shareIntentBtn);
Picasso.get().load(R.drawable.share).into(shareIntentBtn);
shareIntentBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
copyText(linkausgabe.getText().toString());
String shoppinglistname = "";
try {
shoppinglistname = db.getShoppinglist(sl_id).getname();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Einladung zum bearbeiten der Shoppingliste " + shoppinglistname + " von: " + FirebaseAuth.getInstance().getCurrentUser().getDisplayName());
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, linkausgabe.getText().toString());
popupShare.dismiss();
startActivity(Intent.createChooser(sharingIntent, "Teile mit"));
}
});
// final Button copyButton = (Button) popupContentView.findViewById(R.id.shareCopy);
// copyButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// copyText(linkausgabe.getText().toString());
// popupShare.dismiss();
// }
// });
Button delShare = (Button) popupContentView.findViewById(R.id.delShare);
final String finalLink = link;
@ -979,6 +1023,7 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
View popupContentView = inflater.inflate(R.layout.add_share, null);
final TextView linkausgabe = (TextView) popupContentView.findViewById(R.id.shareLink);
linkausgabe.setTextIsSelectable(true);
try {
linkausgabe.setText("invite.dergeorg.at/invite/" + db.getInviteLink(sl_id));
} catch (SQLException e) {
@ -996,15 +1041,37 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
}
});
final Button copyButton = (Button) popupContentView.findViewById(R.id.shareCopy);
copyButton.setOnClickListener(new View.OnClickListener() {
ImageButton shareIntentBtn = (ImageButton) popupContentView.findViewById(R.id.shareIntentBtn);
Picasso.get().load(R.drawable.share).into(shareIntentBtn);
shareIntentBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
copyText(linkausgabe.getText().toString());
String shoppinglistname = "";
try {
shoppinglistname = db.getShoppinglist(sl_id).getname();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Einladung zum bearbeiten der Shoppingliste " + shoppinglistname + " von: " + FirebaseAuth.getInstance().getCurrentUser().getDisplayName());
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, linkausgabe.getText().toString());
popupShare.dismiss();
startActivity(Intent.createChooser(sharingIntent, "Teile mit"));
}
});
// final Button copyButton = (Button) popupContentView.findViewById(R.id.shareCopy);
// copyButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// copyText(linkausgabe.getText().toString());
// popupShare.dismiss();
// }
// });
Button delShare = (Button) popupContentView.findViewById(R.id.delShare);
delShare.setOnClickListener(new View.OnClickListener() {
@ -1104,17 +1171,17 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
}
@Override
public void sharedOnShareClick(String sl_id, View v) throws SQLException, JSONException {
public void sharedOnShareClick(final String sl_id, View v) throws SQLException, JSONException {
final LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View popupContentView = inflater.inflate(R.layout.edit_share_member, null);
ImageButton exitBtn = popupContentView.findViewById(R.id.exitButton);
Picasso.get().load(R.drawable.close).into(exitBtn);
final TextView linkAusgabe = popupContentView.findViewById(R.id.linkausgabe);
Button copyBtn = popupContentView.findViewById(R.id.copyButton);
// Button copyBtn = popupContentView.findViewById(R.id.copyButton);
Button stopShareBtn = popupContentView.findViewById(R.id.delShare);
linkAusgabe.setTextIsSelectable(true);
linkAusgabe.setText("invite.dergeorg.at/invite/" + db.getInviteLink(sl_id));
exitBtn.setOnClickListener(new View.OnClickListener() {
@Override
@ -1122,11 +1189,31 @@ public class Dash extends AppCompatActivity implements ShoppinglistAdapter.OnIte
popupEditShare.dismiss();
}
});
copyBtn.setOnClickListener(new View.OnClickListener() {
// copyBtn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// copyText(linkAusgabe.getText().toString());
// popupEditShare.dismiss();
// }
// });
ImageButton shareIntentBtn = popupContentView.findViewById(R.id.shareIntentBtn);
Picasso.get().load(R.drawable.share).into(shareIntentBtn);
shareIntentBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
copyText(linkAusgabe.getText().toString());
popupEditShare.dismiss();
String shoppinglistname = "";
try {
shoppinglistname = db.getShoppinglist(sl_id).getname();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Einladung zum bearbeiten der Shoppingliste " + shoppinglistname + " von: " + FirebaseAuth.getInstance().getCurrentUser().getDisplayName());
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, linkAusgabe.getText().toString());
startActivity(Intent.createChooser(sharingIntent, "Teilen mit"));
}
});
stopShareBtn.setOnClickListener(new View.OnClickListener() {

View File

@ -6,6 +6,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

View File

@ -9,6 +9,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Gravity;
@ -59,24 +60,39 @@ public class ItemListActivity extends AppCompatActivity implements ItemAdapter.O
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_list);
Intent myIntent = getIntent(); // gets the previously created intent
this.group_id = myIntent.getStringExtra("group_id"); // will return "FirstKeyValue"
this.sl_id = myIntent.getStringExtra("sl_id"); // will return "SecondKeyValue"
this.groupNameString = myIntent.getStringExtra("groupNameString"); // will return "SecondKeyValue"
this.db = new Database();
String colorToolbar = null;
try {
colorToolbar = db.getGroup(group_id, sl_id).getColor();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
Toolbar toolbar = findViewById(R.id.itemToolbar);
toolbar.setTitle("Gruppe: " + this.groupNameString);
String colorstring;
if (colorToolbar.contains("#")) {
colorstring = colorToolbar;
} else {
colorstring = "#" + colorToolbar;
}
toolbar.setBackgroundColor(Color.parseColor(colorstring));
setSupportActionBar(toolbar);
this.groupName = (TextView) findViewById(R.id.groupViewName);
this.groupName.setText(groupNameString);
this.colorView = (View) findViewById(R.id.itemListColorView);
try {
this.colorView.setBackgroundColor(Color.parseColor(db.getGroup(group_id, sl_id).getColor()));
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
this.colorView.setBackgroundColor(Color.parseColor(colorstring));
this.swipeRefreshLayoutItem = (SwipeRefreshLayout) findViewById(R.id.itemListRefresh);
this.swipeRefreshLayoutItem.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@ -182,7 +198,7 @@ public class ItemListActivity extends AppCompatActivity implements ItemAdapter.O
List itemListTmp;
View pfeil = findViewById(R.id.pfeilnachunten2);
if (itemList.isEmpty()) {
itemArrayListTmp.add(new Item("empty", "empty", "empty", "Bitte ein Item Hinzufügen!", ""));
itemArrayListTmp.add(new Item("empty", "empty", "empty", "Bitte ein Item Hinzufügen!", "1"));
itemListTmp = itemArrayListTmp;
pfeil.setVisibility(View.VISIBLE);
} else {

View File

@ -129,21 +129,11 @@ public class LoginActivity extends AppCompatActivity {
return;
}
String uid = FirebaseAuth.getInstance().getUid();
FirebaseUser userFirebase = FirebaseAuth.getInstance().getCurrentUser();
Member user;
String name = null;
String picture = null;
String email = null;
try {
user = db.getUser(uid);
name = user.getName();
picture = user.getPic();
email = user.getEmail();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
// Get new Instance ID token
String token = task.getResult().getToken();
@ -151,10 +141,23 @@ public class LoginActivity extends AppCompatActivity {
try {
if (!db.checkIfUserExists(FirebaseAuth.getInstance().getCurrentUser().getUid())) {
db.createUser(uid, token, name, picture, email);
name = userFirebase.getDisplayName();
picture = userFirebase.getPhotoUrl().toString();
email = userFirebase.getEmail();
db.createUser(userFirebase.getUid(), token, name, picture, email);
} else {
db.updateUser(uid, token, name, picture, email);
try {
user = db.getUser(userFirebase.getUid());
name = user.getName();
picture = user.getPic();
email = user.getEmail();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
db.updateUser(userFirebase.getUid(), token, name, picture, email);
}
} catch (SQLException e) {
e.printStackTrace();

View File

@ -9,6 +9,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Gravity;
@ -125,14 +126,25 @@ public class ShoppinglistDetails extends AppCompatActivity implements DetailsAda
Intent intent = getIntent();
sl_id = intent.getStringExtra("sl_id");
Shoppinglist shoppinglist = null;
try {
Shoppinglist shoppinglist = db.getShoppinglist(sl_id);
shoppinglist = db.getShoppinglist(sl_id);
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
Toolbar toolbar = findViewById(R.id.shoppinglistDetailsToolbar);
toolbar.setTitle("Shoppingliste: " + shoppinglist.getname());
String colorstring;
if (shoppinglist.getcolor().contains("#")) {
colorstring = shoppinglist.getcolor();
} else {
colorstring = "#" + shoppinglist.getcolor();
}
toolbar.setBackgroundColor(Color.parseColor(colorstring));
setSupportActionBar(toolbar);
final String finalSl_id = sl_id;
fab.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -0,0 +1,191 @@
package at.smartshopper.smartshopperapp.customViews;
import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.TabHost;
public class AnimatedTabHostListener implements TabHost.OnTabChangeListener
{
private static final int ANIMATION_TIME = 240;
private TabHost tabHost;
private View previousView;
private View currentView;
private GestureDetector gestureDetector;
private int currentTab;
/**
* Constructor that takes the TabHost as a parameter and sets previousView to the currentView at instantiation
*
* @param context
* @param tabHost
*/
public AnimatedTabHostListener(Context context, TabHost tabHost)
{
this.tabHost = tabHost;
this.previousView = tabHost.getCurrentView();
gestureDetector = new GestureDetector(context, new MyGestureDetector());
tabHost.setOnTouchListener(new View.OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
if (gestureDetector.onTouchEvent(event))
{
return false;
}
else
{
return true;
}
}
});
}
/**
* When tabs change we fetch the current view that we are animating to and animate it and the previous view in the
* appropriate directions.
*/
@Override
public void onTabChanged(String tabId)
{
currentView = tabHost.getCurrentView();
if (tabHost.getCurrentTab() > currentTab)
{
previousView.setAnimation(outToLeftAnimation());
currentView.setAnimation(inFromRightAnimation());
}
else
{
previousView.setAnimation(outToRightAnimation());
currentView.setAnimation(inFromLeftAnimation());
}
previousView = currentView;
currentTab = tabHost.getCurrentTab();
}
/**
* Custom animation that animates in from right
*
* @return Animation the Animation object
*/
private Animation inFromRightAnimation()
{
Animation inFromRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.0f);
return setProperties(inFromRight);
}
/**
* Custom animation that animates out to the right
*
* @return Animation the Animation object
*/
private Animation outToRightAnimation()
{
Animation outToRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);
return setProperties(outToRight);
}
/**
* Custom animation that animates in from left
*
* @return Animation the Animation object
*/
private Animation inFromLeftAnimation()
{
Animation inFromLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.0f);
return setProperties(inFromLeft);
}
/**
* Custom animation that animates out to the left
*
* @return Animation the Animation object
*/
private Animation outToLeftAnimation()
{
Animation outtoLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
-1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);
return setProperties(outtoLeft);
}
/**
* Helper method that sets some common properties
*
* @param animation
* the animation to give common properties
* @return the animation with common properties
*/
private Animation setProperties(Animation animation)
{
animation.setDuration(ANIMATION_TIME);
animation.setInterpolator(new AccelerateInterpolator());
return animation;
}
/**
* A gesture listener that listens for a left or right swipe and uses the swip gesture to navigate a TabHost that
* uses an AnimatedTabHost listener.
*
* @author Daniel Kvist
*
*/
class MyGestureDetector extends GestureDetector.SimpleOnGestureListener
{
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private int maxTabs;
/**
* An empty constructor that uses the tabhosts content view to decide how many tabs there are.
*/
public MyGestureDetector()
{
maxTabs = tabHost.getTabContentView().getChildCount();
}
/**
* Listens for the onFling event and performs some calculations between the touch down point and the touch up
* point. It then uses that information to calculate if the swipe was long enough. It also uses the swiping
* velocity to decide if it was a "true" swipe or just some random touching.
*/
@Override
public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY)
{
int newTab = 0;
if (Math.abs(event1.getY() - event2.getY()) > SWIPE_MAX_OFF_PATH)
{
return false;
}
if (event1.getX() - event2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY)
{
// Swipe right to left
newTab = currentTab + 1;
}
else if (event2.getX() - event1.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY)
{
// Swipe left to right
newTab = currentTab - 1;
}
if (newTab < 0 || newTab > (maxTabs - 1))
{
return false;
}
tabHost.setCurrentTab(newTab);
return super.onFling(event1, event2, velocityX, velocityY);
}
}
}

View File

@ -132,7 +132,7 @@ public class Database extends AppCompatActivity {
} else {
newpicture = picture;
}
if (email.isEmpty()) {
if (email == null) {
newemail = "EMPTY";
} else {
newemail = email;
@ -532,7 +532,7 @@ public class Database extends AppCompatActivity {
*/
public void createUser(String username, String message_id, String name, String picture, String email) throws SQLException {
String SQL = "INSERT INTO \"User\" (username, message_id, name, picture, email) VALUES (?, ?, ?, ?, ?)";
if (picture.isEmpty()) {
if (picture == null) {
picture = "https://st2.depositphotos.com/1537427/5927/v/950/depositphotos_59279377-stock-illustration-user-icon.jpg";
}
sqlUpdate5Param(SQL, username, message_id, name, picture, email);

View File

@ -118,22 +118,17 @@ public class ShoppinglistSharedAdapter extends RecyclerView.Adapter<Shoppinglist
holder.shoppinglistColor.setBackgroundColor(cardcolor);
if (shoppinglist.getSlId().equals("empty")) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// Name, email address, and profile photo Url
String name = user.getDisplayName();
Uri photoUrl = user.getPhotoUrl();
holder.ownerName.setText(name);
Picasso.get().load(photoUrl).resize(250, 250).transform(new RoundCornersTransformation(15, 15, true, true)).into(holder.imageView);
// holder.imageView.setImageDrawable(Drawable.createFromPath("@drawable/common_google_signin_btn_icon_dark"));
String uid = FirebaseAuth.getInstance().getUid();
// Check if user's email is verified
// The user's ID, unique to the Firebase project. Do NOT use this value to
// authenticate with your backend server, if you have one. Use
// FirebaseUser.getIdToken() instead.
}
try {
Member user = db.getUser(uid);
holder.ownerName.setText(user.getName());
Picasso.get().load(user.getPic()).resize(250, 250).transform(new RoundCornersTransformation(15, 15, true, true)).into(holder.imageView);
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
try {
if (!shoppinglist.getSlId().equals("empty")) {

View File

@ -1,27 +1,40 @@
<?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">
<android.support.v7.widget.Toolbar
android:id="@+id/dashToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/pfeilnachunten3"
android:layout_width="84dp"
android:layout_height="331dp"
android:layout_width="60dp"
android:layout_height="190dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/pfeil"
app:layout_constraintBottom_toTopOf="@+id/addShoppinglistFab"
app:layout_constraintEnd_toEndOf="parent" />
<TabHost
android:id="@+id/tabHost1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@+id/dashToolbar">
<LinearLayout
android:layout_width="match_parent"
@ -113,7 +126,7 @@
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:clickable="true"
app:backgroundTint="@color/fui_linkColor"
app:backgroundTint="@color/colorButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tabHost1"
app:srcCompat="@drawable/addoutline" />

View File

@ -4,10 +4,24 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
tools:context=".activitys.ItemListActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/itemToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
android:theme="?attr/actionBarTheme"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.SwipeRefreshLayout
android:layout_margin="8dp"
android:id="@+id/itemListRefresh"
android:layout_width="0dp"
android:layout_height="0dp"
@ -19,8 +33,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
app:layout_constraintTop_toBottomOf="@+id/itemToolbar">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
@ -112,8 +125,8 @@
<View
android:id="@+id/pfeilnachunten2"
android:layout_width="84dp"
android:layout_height="331dp"
android:layout_width="60dp"
android:layout_height="190dp"
android:layout_marginBottom="60dp"
android:background="@drawable/pfeil"
app:layout_constraintBottom_toBottomOf="parent"
@ -131,7 +144,7 @@
android:layout_marginBottom="8dp"
android:clickable="true"
android:src="@drawable/addoutline"
app:backgroundTint="@color/fui_linkColor"
app:backgroundTint="@color/colorButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

View File

@ -71,6 +71,7 @@
android:id="@+id/loginEmailBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text="Login Email" />
</TableRow>

View File

@ -6,10 +6,21 @@
android:layout_height="match_parent"
tools:context=".activitys.ShoppinglistDetails">
<android.support.v7.widget.Toolbar
android:id="@+id/shoppinglistDetailsToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/pfeilnachunten"
android:layout_width="66dp"
android:layout_height="299dp"
android:layout_width="60dp"
android:layout_height="190dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/pfeil"
@ -28,8 +39,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
app:layout_constraintTop_toBottomOf="@+id/shoppinglistDetailsToolbar">
<android.support.v7.widget.RecyclerView
android:id="@+id/groupRecycle"
@ -48,7 +58,7 @@
android:layout_marginBottom="8dp"
android:clickable="true"
android:src="@drawable/addoutline"
app:backgroundTint="@color/fui_linkColor"
app:backgroundTint="@color/colorButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

View File

@ -94,6 +94,7 @@
android:id="@+id/groupColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text="Farbe Auswählen" />
</LinearLayout>
</TableRow>
@ -113,6 +114,7 @@
android:id="@+id/groupFinish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text="Fertig" />
</LinearLayout>
</TableRow>

View File

@ -121,6 +121,7 @@
android:id="@+id/itemFinish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text="Fertig" />
</LinearLayout>
</TableRow>

View File

@ -62,6 +62,7 @@
android:ems="10"
android:inputType="textPersonName"
android:text="Shared Link"
android:textIsSelectable="true"
tools:layout_editor_absoluteY="731dp" />
</TableRow>
@ -71,13 +72,26 @@
android:layout_height="match_parent"
android:gravity="center">
<Button
android:id="@+id/shareCopy"
<ImageButton
android:id="@+id/shareIntentBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="in die zwischenablage kopieren" />
android:background="@color/fui_transparent"
app:srcCompat="@drawable/share" />
</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"
@ -87,9 +101,11 @@
android:id="@+id/delShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text=" Share Aufheben" />
</TableRow>
</TableLayout>
</android.support.v7.widget.CardView>

View File

@ -58,6 +58,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:textIsSelectable="true"
android:inputType="textPersonName" />
</TableRow>
@ -70,6 +71,7 @@
android:id="@+id/shareAddFinish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text="Fertig" />
</TableRow>

View File

@ -80,6 +80,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:editable="true"
android:textIsSelectable="true"
android:inputType="textPersonName" />
</LinearLayout>
</TableRow>
@ -108,6 +110,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:editable="true"
android:textIsSelectable="true"
android:inputType="textPersonName" />
</LinearLayout>
</TableRow>
@ -147,7 +151,8 @@
android:id="@+id/addFertig"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Fertig" />
android:text="Fertig"
app:backgroundTint="@color/colorButton" />
</LinearLayout>
</TableRow>
</TableLayout>

View File

@ -41,7 +41,8 @@
android:layout_height="wrap_content"
android:editable="false"
android:ems="10"
android:inputType="textPersonName" />
android:inputType="textPersonName"
android:textIsSelectable="true" />
</TableRow>
<TableRow
@ -49,13 +50,26 @@
android:layout_height="match_parent"
android:gravity="center">
<Button
android:id="@+id/copyButton"
<ImageButton
android:id="@+id/shareIntentBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="in die zwischenablage kopieren" />
android:background="@color/fui_transparent"
app:srcCompat="@drawable/share" />
</TableRow>
<!--<TableRow-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:gravity="center">-->
<!--<Button-->
<!--android:id="@+id/copyButton"-->
<!--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"
@ -65,6 +79,7 @@
android:id="@+id/delShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:text="Listen Sharing beenden!" />
</TableRow>

View File

@ -3,4 +3,5 @@
<color name="colorPrimary">#FFFFFF</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#880e4f</color>
<color name="colorButton">@color/fui_linkColor</color>
</resources>

View File

@ -6,6 +6,8 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="popup_window_animation_phone">