Dodano mozliwosc logowania, zmiana sposobu przechowywania danych, poprawki bledow

This commit is contained in:
s439459 2019-01-06 23:31:35 +01:00
parent 0df52ec13f
commit 5d61850457
44 changed files with 2032 additions and 1206 deletions

2
app/.gitignore vendored
View File

@ -1 +1 @@
/build
/build

View File

@ -1,29 +1,30 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "michalpawlaczyk.shoplist"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "michalpawlaczyk.shoplist"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.volley:volley:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

View File

@ -1,21 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,26 +1,26 @@
package michalpawlaczyk.shoplist;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("michalpawlaczyk.shoplist", appContext.getPackageName());
}
}
package michalpawlaczyk.shoplist;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("michalpawlaczyk.shoplist", appContext.getPackageName());
}
}

View File

@ -1,27 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="michalpawlaczyk.shoplist">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
android:fullBackupContent="true">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FloatingAction"/>
</application>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="michalpawlaczyk.shoplist">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
android:usesCleartextTraffic="true"
tools:targetApi="m">
<activity android:name=".MainActivity"/>
<activity android:name=".FloatingAction" />
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegisterActivity"/>
<activity android:name=".UserAreaActivity"/>
<receiver android:name=".ReminderReciver"/>
</application>
</manifest>

View File

@ -1,17 +0,0 @@
package michalpawlaczyk.shoplist;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class AddProductFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.product_add, container, false);
}
}

View File

@ -1,70 +0,0 @@
package michalpawlaczyk.shoplist;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DatabaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "Products.db";
private static final String TABLE_NAME = "products_list";
private static final String COL_1 = "ID";
private static final String COL_2 = "NAME";
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table " + TABLE_NAME + "(ID INTEGER, NAME TEXT) ");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);
}
boolean insertData(String tableName, String name){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL_2, name);
long result = db.insert(tableName, null, contentValues);
return result != -1;
}
Cursor getChecekData(String tableName){
SQLiteDatabase db = this.getWritableDatabase();
return db.rawQuery("select * from " + tableName, null);
}
Cursor getAllTableName(){
SQLiteDatabase db = this.getWritableDatabase();
return db.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null);
}
boolean updateData (String name, String newName){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL_2, newName);
db.update(TABLE_NAME, contentValues, "NAME = ?", new String[]{ name });
return true;
}
Integer deleteData (String tableName, String name) {
SQLiteDatabase db = this.getWritableDatabase();
return db.delete(tableName, "NAME = ?", new String[] { name });
}
void userCreateTable(String tableName){
SQLiteDatabase db = this.getWritableDatabase();/*
db.rawQuery("CREATE TABLE IF NOT EXISTS " + tableName +
" ( ID INTEGER, " +
"NAME TEXT )", null);*/
String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + tableName +
" ( ID INTEGER, " +
"NAME TEXT )";
db.execSQL(CREATE_TABLE);
db.close();
}
}

View File

@ -1,39 +1,39 @@
package michalpawlaczyk.shoplist;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
public class EditFragment extends Fragment {
private Button addListBtn;
EditText listNameText;
String text;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.popup_dialog, container, false);
addListBtn = view.findViewById(R.id.addListBtn);
listNameText = view.findViewById(R.id.listNameText);
btnClick();
return view;
}
public void btnClick(){
addListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
text = listNameText.getText().toString();
}
});
}
public String getText(){
return text;
}
package michalpawlaczyk.shoplist;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
public class EditFragment extends Fragment {
private Button addListBtn;
EditText listNameText;
String text;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.popup_dialog, container, false);
addListBtn = view.findViewById(R.id.addListBtn);
listNameText = view.findViewById(R.id.listNameText);
btnClick();
return view;
}
public void btnClick(){
addListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
text = listNameText.getText().toString();
}
});
}
public String getText(){
return text;
}
}

View File

@ -1,72 +1,76 @@
package michalpawlaczyk.shoplist;
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class FloatingAction extends AppCompatActivity {
private Button addListBtn;
EditText listNameText;
DatabaseHelper myDb;
String chosenListID;
ArrayList<String> productItem;
ArrayAdapter<String> adapter2;
ListView listProductView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popup_dialog);
addListBtn = findViewById(R.id.addListBtn);
listNameText = findViewById(R.id.listNameText);
myDb = new DatabaseHelper(this);
listProductView = findViewById(R.id.productsListView);
productItem = new ArrayList<>();
AddData();
}
public void AddData(){
addListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle extras = getIntent().getExtras();
if(extras != null) {
chosenListID = extras.getString("chosenListID");
boolean isInserted = myDb.insertData(chosenListID, listNameText.getText().toString());
if (isInserted) {
Toast.makeText(FloatingAction.this, "Done", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(FloatingAction.this, "Something goes wrong!", Toast.LENGTH_LONG).show();
}
//reloadData();
}
}
});
}
public void reloadData(){
Cursor res = myDb.getChecekData(chosenListID);
if(res.getCount() == 0){
Toast.makeText(this, "No data to show", Toast.LENGTH_SHORT).show();
}
else {
while (res.moveToNext()) {
productItem.add(res.getString(1));
}
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
listProductView.setAdapter(adapter2);
}
}
}
package michalpawlaczyk.shoplist;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class FloatingAction extends AppCompatActivity {
private Button addListBtn;
EditText listNameText;
String chosenListID;
ArrayList<String> productItem;
ListView listProductView;
MainActivity mainActivity;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popup_dialog);
addListBtn = findViewById(R.id.addListBtn);
listNameText = findViewById(R.id.listNameText);
listProductView = findViewById(R.id.productsListView);
productItem = new ArrayList<>();
mainActivity = new MainActivity();
listNameText.setHint("Podaj nazwę produktu");
AddData();
}
public void AddData(){
addListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle extras = getIntent().getExtras();
if(extras != null) {
chosenListID = extras.getString("chosenListID");
String text = listNameText.getText().toString();
final SharedPreferences settings = Objects.requireNonNull(getApplicationContext()).getSharedPreferences("userInfo", Context.MODE_PRIVATE);
Map<String, String> postParam= new HashMap<>();
postParam.put("tableName", chosenListID);
postParam.put("rowData", text);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
"http://192.168.0.115:8080/addData?"+settings.getString("token",""),
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, null
);
RequestQueue queue = Volley.newRequestQueue(Objects.requireNonNull(getApplicationContext()));
queue.add(jsonObjectRequest);
}
}
});
}
}

View File

@ -0,0 +1,127 @@
package michalpawlaczyk.shoplist;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class LoginActivity extends AppCompatActivity {
private static final String LOGIN_REQUEST_URL = "http://192.168.0.115:8080/login";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
if(settings.contains("username")){
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
startActivity(intent);
finish();
}
final EditText usernameET = findViewById(R.id.usernameLogin);
final EditText passwordET = findViewById(R.id.passwordLogin);
final Button signinBtn = findViewById(R.id.signinBtn);
final TextView signupTV = findViewById(R.id.signupText);
signupTV.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent registerIntent = new Intent(LoginActivity.this, RegisterActivity.class);
LoginActivity.this.startActivity(registerIntent);
}
});
signinBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = usernameET.getText().toString();
final String password = passwordET.getText().toString();
Map<String, String> postParam= new HashMap<>();
postParam.put("login", username);
postParam.put("password", password);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
LOGIN_REQUEST_URL,
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
LoginActivity.this.startActivity(intent);
SharedPreferences.Editor editor = settings.edit();
String token = username+":"+password;
token = android.util.Base64.encodeToString(token.getBytes(),0);
editor.putString("username", username);
editor.putString("password", password);
editor.putString("token", token);
editor.apply();
}
},
new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error) {
if (error instanceof ServerError) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if(error instanceof AuthFailureError){
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
builder.setMessage("Login Failed. Username or password incorrect")
.setNegativeButton("Retry", null)
.create()
.show();
} else if(error instanceof NetworkError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
}else if(error instanceof ParseError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
LoginActivity.this.startActivity(intent);
SharedPreferences.Editor editor = settings.edit();
String token = username+":"+password;
token = android.util.Base64.encodeToString(token.getBytes(),0);
editor.putString("username", username);
editor.putString("password", password);
editor.putString("token", token);
editor.apply();
}
}
}
);
RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
queue.add(jsonObjectRequest);
}
});
}
}

View File

@ -1,234 +1,426 @@
package michalpawlaczyk.shoplist;
import android.content.Intent;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Objects;
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DrawerLayout mDraverLayout;
private ActionBarDrawerToggle mToggle;
DatabaseHelper myDb;
ArrayList<String> listItem;
ArrayList<String> productItem;
ArrayAdapter<String> adapter;
ArrayAdapter<String> adapter2;
ListView listNameView;
ListView listProductView;
CheckedTextView ctvProduct;
Button editItem;
FloatingActionButton fab;
String listProductID;
String chosenListID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDraverLayout = findViewById(R.id.drawer_layout);
mToggle = new ActionBarDrawerToggle(this, mDraverLayout, R.string.Open, R.string.Close);
mDraverLayout.addDrawerListener(mToggle);
mToggle.syncState();
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
NavigationView mNavigationView = findViewById(R.id.navView);
mNavigationView.setNavigationItemSelectedListener(this);
myDb = new DatabaseHelper(this);
listItem = new ArrayList<>();
listNameView = findViewById(R.id.listView);
listProductView = findViewById(R.id.productsListView);
ctvProduct = findViewById(R.id.productCheck);
productItem = new ArrayList<>();
viewTableName();
fab = findViewById(R.id.fab);
listProductView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, FloatingAction.class);
intent.putExtra("chosenListID", chosenListID);
startActivity(intent);
}
});
listProductView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
listProductID = parent.getItemAtPosition(position).toString();
/*
if(listProductView.isItemChecked(position)) {
ctvProduct.setPaintFlags(ctvProduct.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}
else {
ctvProduct.setPaintFlags(ctvProduct.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}*/
}
});
listNameView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
chosenListID = parent.getItemAtPosition(position).toString();
viewCheckData(chosenListID);
}
});
registerForContextMenu(listProductView);
//registerForContextMenu(listNameView);
/*
ctvProduct.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(ctvProduct.isChecked()){
ctvProduct.setChecked(false);
}
else
ctvProduct.setChecked(true);
}
}
);*/
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
getMenuInflater().inflate(R.menu.context_menu, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.deleteItem:
Integer result = myDb.deleteData(chosenListID, listProductID);
System.out.println(listProductID);
if(result > 0){
reloadData();
}
else {
reloadData();
Toast.makeText(MainActivity.this, "Fail", Toast.LENGTH_SHORT).show();
}
return true;
case R.id.editItem:
/*
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,
new EditFragment()).commit();
EditFragment editFragment = new EditFragment();
String tmp = editFragment.getText();
boolean result2 = myDb.updateData(chosenListID, tmp);
if(result2){
reloadData();
}
else {
reloadData();
Toast.makeText(MainActivity.this, "Fail", Toast.LENGTH_SHORT).show();
}*/
Toast.makeText(MainActivity.this, "Not supported yet", Toast.LENGTH_SHORT).show();
return true;
default:
return super.onContextItemSelected(item);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
//Navigation items
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()){
case R.id.AddList:
((FrameLayout)findViewById(R.id.content_frame)).removeAllViews();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,
new MenuFragment()).commit();
break;
}
mDraverLayout.closeDrawer(GravityCompat.START);
return true;
}
public void viewCheckData(String tableName){
Cursor res = myDb.getChecekData(tableName);
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
listProductView.setAdapter(adapter2);
if(adapter2.getCount() > 0){
adapter2.clear();
}
while (res.moveToNext()) {
productItem.add(res.getString(1));
}
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
listProductView.setAdapter(adapter2);
}
public void reloadData(){
Cursor res = myDb.getChecekData(chosenListID);
adapter2.clear();
if(res.getCount() == 0){
Toast.makeText(this, "No data to show", Toast.LENGTH_SHORT).show();
}
else {
while (res.moveToNext()) {
productItem.add(res.getString(1));
}
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
listProductView.setAdapter(adapter2);
}
}
public void viewTableName(){
Cursor res = myDb.getAllTableName();
if (res.moveToFirst()) {
while ( !res.isAfterLast() ) {
listItem.add(res.getString(res.getColumnIndex("name")));
System.out.println(res.getString( res.getColumnIndex("name")));
res.moveToNext();
}
}
adapter = new ArrayAdapter<>(this, R.layout.list_view, listItem);
listNameView.setAdapter(adapter);
}
public void reloadTableName(){
Cursor res = myDb.getAllTableName();
adapter.clear();
if (res.moveToFirst()) {
while ( !res.isAfterLast() ) {
listItem.add( res.getString( res.getColumnIndex("name")) );
res.moveToNext();
}
}
adapter = new ArrayAdapter<>(this, R.layout.list_view, listItem);
listNameView.setAdapter(adapter);
}
}
package michalpawlaczyk.shoplist;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DrawerLayout mDraverLayout;
private ActionBarDrawerToggle mToggle;
ArrayList<String> listItem;
ArrayList<String> productItem;
ArrayAdapter adapter;
ArrayAdapter<String> adapter2;
ListView listNameView;
ListView listProductView;
CheckedTextView ctvProduct;
Button editItem;
FloatingActionButton fab;
String listProductID;
String chosenListID;
String chosenTableID;
ImageView accountImage;
TextView accountHeader;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDraverLayout = findViewById(R.id.drawer_layout);
mToggle = new ActionBarDrawerToggle(this, mDraverLayout, R.string.Open, R.string.Close);
mDraverLayout.addDrawerListener(mToggle);
mToggle.syncState();
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
NavigationView mNavigationView = findViewById(R.id.navView);
mNavigationView.setNavigationItemSelectedListener(this);
listNameView = findViewById(R.id.listView);
listProductView = findViewById(R.id.productsListView);
ctvProduct = findViewById(R.id.productCheck);
accountImage = findViewById(R.id.accountImage);
productItem = new ArrayList<>();
fab = findViewById(R.id.fab);
listProductView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
getTableName();
accountHeader = findViewById(R.id.accountHeader);
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
final SharedPreferences lastTable = getApplicationContext().getSharedPreferences("userData", MODE_PRIVATE);
chosenTableID = lastTable.getString("lastTable","");
Toast.makeText(getBaseContext(), chosenListID, Toast.LENGTH_LONG).show();
if(chosenTableID != null)
viewTableData(chosenTableID);
if(settings.getString("username","") != null){
accountHeader.setText(settings.getString("username",""));
accountHeader.setText(settings.getString("username",""));
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, FloatingAction.class);
intent.putExtra("chosenListID", chosenListID);
startActivity(intent);
}
});
accountImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
if(settings.getString("username","") == null) {
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
getApplicationContext().startActivity(intent);
} else {
Intent intent = new Intent(getApplicationContext(), UserAreaActivity.class);
getApplicationContext().startActivity(intent);
}
}
});
listProductView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
listProductID = parent.getItemAtPosition(position).toString();
Boolean isCheck = listProductView.isItemChecked(position);
Map<String, String> postParam= new HashMap<>();
postParam.put("tableName", chosenListID);
postParam.put("productName", listProductID);
postParam.put("isCheck", isCheck.toString());
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
"http://192.168.0.115:8080/setItemCheck?" + settings.getString("token", ""),
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
},null
);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(jsonObjectRequest);
}
});
listProductView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
listProductID = parent.getItemAtPosition(position).toString();
registerForContextMenu(listProductView);
openContextMenu(listProductView);
return true;
}
});
listNameView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
chosenListID = parent.getItemAtPosition(position).toString();
//((FrameLayout)findViewById(R.id.content_frame)).removeAllViews();
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userData", MODE_PRIVATE);
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor editor = settings.edit();
editor.putString("lastTable", chosenListID);
viewTableData(chosenListID);
}
});
listNameView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
final String deleteTableID = parent.getItemAtPosition(position).toString();
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("Czy na pewno chcesz usunać listę "+deleteTableID+" ?")
.setPositiveButton("Tak", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Map<String, String> postParam= new HashMap<>();
postParam.put("tableName", deleteTableID);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST,
"http://192.168.0.115:8080/deleteTable?" + settings.getString("token", ""),
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, null);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(jsonObjectRequest);
listItem.clear();
getTableName();
}
})
.setNegativeButton("Nie", null)
.create()
.show();
return true;
}
});
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
//getMenuInflater().inflate(R.menu.context_menu, menu);
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
MenuItem delete = menu.add("Usuń");
MenuItem edit = menu.add("Edytuj");
delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Map<String, String> postParam= new HashMap<>();
postParam.put("tableName", chosenListID);
postParam.put("rowData", listProductID);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
"http://192.168.0.115:8080/deleteData?" + settings.getString("token", ""),
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
},null
);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(jsonObjectRequest);
productItem.clear();
viewTableData(chosenListID);
return false;
}
});
edit.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
final EditText editText = new EditText(MainActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("Podaj nową nazwę produktu")
.setView(editText)
.setPositiveButton("Zmień", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Map<String, String> postParam= new HashMap<>();
postParam.put("tableName", chosenListID);
postParam.put("rowData", listProductID);
postParam.put("newRow", editText.getText().toString());
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST,
"http://192.168.0.115:8080/editData?" + settings.getString("token", ""),
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, null);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(jsonObjectRequest);
productItem.clear();
viewTableData(chosenListID);
}
})
.create()
.show();
return false;
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
//Navigation items
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()){
case R.id.AddList:
((FrameLayout)findViewById(R.id.content_frame)).removeAllViews();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,
new MenuFragment()).commit();
break;
case R.id.ProductList:
listItem.clear();
getTableName();
break;
case R.id.Reminder:
((FrameLayout)findViewById(R.id.content_frame)).removeAllViews();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,
new ReminderFragment()).commit();
break;
}
mDraverLayout.closeDrawer(GravityCompat.START);
return true;
}
public void viewTableData(String tableName) {
productItem = new ArrayList<>();
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
JsonArrayRequest jsonObjectRequest = new JsonArrayRequest(
Request.Method.POST,
"http://192.168.0.115:8080/getTableRows?" + settings.getString("token", "")+":"+tableName, null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
for (int i = 0; i < response.length(); i++) {
JSONObject object = response.getJSONObject(i);
productItem.add(object.getString("product"));
String isCheck = object.getString("ischeck");
if(isCheck.equals("true")){
listProductView.setItemChecked(i, true);
} else if(isCheck.equals("false")){
listProductView.setItemChecked(i, false);
}
}
adapter2 = new ArrayAdapter<>(MainActivity.this, R.layout.product_view, productItem);
listProductView.setAdapter(adapter2);
for(int i = 0; i < response.length(); i++){
JSONObject object = response.getJSONObject(i);
String isCheck = object.getString("ischeck");
if(isCheck.equals("true")){
listProductView.setItemChecked(i, true);
} else if(isCheck.equals("false")){
listProductView.setItemChecked(i, false);
}
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (error instanceof ServerError) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if (error instanceof AuthFailureError) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if (error instanceof NetworkError) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if (error instanceof ParseError) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
}
}
}
);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(jsonObjectRequest);
}
private void getTableName() {
listItem = new ArrayList<>();
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
JsonArrayRequest jsonObjectRequest = new JsonArrayRequest(
Request.Method.POST,
"http://192.168.0.115:8080/getTableName?"+settings.getString("token",""), null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
for (int i = 0; i < response.length(); i++) {
JSONObject object = response.getJSONObject(i);
listItem.add(object.getString("name"));
}
adapter = new ArrayAdapter<>(MainActivity.this, R.layout.list_view, listItem);
listNameView.setAdapter(adapter);
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
},
new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error) {
if (error instanceof ServerError) {
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if(error instanceof AuthFailureError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if(error instanceof NetworkError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
}else if(error instanceof ParseError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
}
}
}
);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(jsonObjectRequest);
}
}

View File

@ -1,42 +1,69 @@
package michalpawlaczyk.shoplist;
//import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import java.util.Objects;
public class MenuFragment extends Fragment{
private Button addListBtn;
EditText listNameText;
DatabaseHelper myDb;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.popup_dialog, container, false);
addListBtn = view.findViewById(R.id.addListBtn);
listNameText = view.findViewById(R.id.listNameText);
myDb = new DatabaseHelper(getActivity());
AddTable();
return view;
}
public void AddTable(){
addListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myDb.userCreateTable(listNameText.getText().toString());
((MainActivity)Objects.requireNonNull(getActivity())).reloadTableName();
}
});
}
}
package michalpawlaczyk.shoplist;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class MenuFragment extends Fragment{
private Button addListBtn;
EditText listNameText;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.popup_dialog, container, false);
addListBtn = view.findViewById(R.id.addListBtn);
listNameText = view.findViewById(R.id.listNameText);
listNameText.setHint("Podaj nazwę listy");
AddTable();
return view;
}
public void AddTable(){
addListBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final SharedPreferences settings = Objects.requireNonNull(getContext()).getSharedPreferences("userInfo", Context.MODE_PRIVATE);
Map<String, String> postParam= new HashMap<>();
String tableName = listNameText.getText().toString();
postParam.put("tableName", tableName);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
"http://192.168.0.115:8080/addTable?"+settings.getString("token",""),
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, null
);
RequestQueue queue = Volley.newRequestQueue(Objects.requireNonNull(getContext()));
queue.add(jsonObjectRequest);
}
});
}
}

View File

@ -0,0 +1,109 @@
package michalpawlaczyk.shoplist;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class RegisterActivity extends AppCompatActivity {
private static final String REGISTER_REQUEST_URL = "http://192.168.0.115:8080/register";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.register_activity);
final EditText usernameET = findViewById(R.id.usernameRegister);
final EditText emailET = findViewById(R.id.emailRegister);
final EditText passwordET = findViewById(R.id.passwordRegister);
final Button signupBtn = findViewById(R.id.registerBtn);
final TextView signinTV = findViewById(R.id.signinText);
signinTV.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent loginIntent = new Intent(RegisterActivity.this, LoginActivity.class);
RegisterActivity.this.startActivity(loginIntent);
}
});
signupBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = usernameET.getText().toString();
final String email = emailET.getText().toString();
final String password = passwordET.getText().toString();
Map<String, String> postParam= new HashMap<>();
postParam.put("login", username);
postParam.put("email", email);
postParam.put("password", password);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
REGISTER_REQUEST_URL,
new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Intent loginIntent = new Intent(RegisterActivity.this, LoginActivity.class);
RegisterActivity.this.startActivity(loginIntent);
}
},
new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error) {
if (error instanceof ServerError) {
AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
builder.setMessage("Enter other username")
.setNegativeButton("Retry", null)
.create()
.show();
} else if(error instanceof AuthFailureError){
AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
builder.setMessage("Enter other username")
.setNegativeButton("Retry", null)
.create()
.show();
} else if(error instanceof NetworkError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
} else if(error instanceof ParseError){
Toast.makeText(getBaseContext(), error.toString(), Toast.LENGTH_LONG).show();
Intent loginIntent = new Intent(RegisterActivity.this, LoginActivity.class);
RegisterActivity.this.startActivity(loginIntent);
}
}
}
);
RequestQueue queue = Volley.newRequestQueue(RegisterActivity.this);
queue.add(jsonObjectRequest);
}
});
}
}

View File

@ -0,0 +1,69 @@
package michalpawlaczyk.shoplist;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TimePicker;
import android.widget.Toast;
import java.util.Calendar;
import java.util.Objects;
public class ReminderFragment extends Fragment implements View.OnClickListener{
Button setBtn;
Button cancelBtn;
TimePicker timePicker;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.reminder_fragment, container, false);
view.findViewById(R.id.setBtnReminder).setOnClickListener(this);
view.findViewById(R.id.cancelBtnReminder).setOnClickListener(this);
timePicker = view.findViewById(R.id.timeReminder);
return view;
}
@Override
public void onClick(View v) {
Intent intent = new Intent(getContext(), ReminderReciver.class);
intent.putExtra("notificationText", "Nie zapomnij o zakupach!");
PendingIntent alarmIntent = PendingIntent.getBroadcast(getContext(),0,
intent,PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager) Objects.requireNonNull(getActivity()).getSystemService(Context.ALARM_SERVICE);
switch (Objects.requireNonNull(getView()).getId()){
case R.id.setBtnReminder:
int hour = timePicker.getCurrentHour();
int minute = timePicker.getCurrentMinute();
Calendar time = Calendar.getInstance();
time.set(Calendar.HOUR_OF_DAY, hour);
time.set(Calendar.MINUTE,minute);
time.set(Calendar.SECOND, 0);
long alarmStartTime = time.getTimeInMillis();
alarmManager.set(AlarmManager.RTC_WAKEUP,alarmStartTime,alarmIntent);
Toast.makeText(getContext(),"Done", Toast.LENGTH_SHORT).show();
break;
case R.id.cancelBtnReminder:
alarmManager.cancel(alarmIntent);
break;
}
}
}

View File

@ -0,0 +1,31 @@
package michalpawlaczyk.shoplist;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class ReminderReciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String notificationText = intent.getStringExtra("notificationText");
Intent mainIntent = new Intent(context, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, mainIntent,0);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(context);
builder.setSmallIcon(android.R.drawable.stat_notify_sync)
.setContentTitle(notificationText)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentIntent(contentIntent);
notificationManager.notify(1,builder.build());
}
}

View File

@ -0,0 +1,46 @@
package michalpawlaczyk.shoplist;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class UserAreaActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.account_activity);
final Button logoutBtn = findViewById(R.id.logoutBtn);
final TextView userTV = findViewById(R.id.usernameAccount);
SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
userTV.setText(settings.getString("username", ""));
logoutBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.remove("username");
editor.remove("password");
editor.remove("token");
editor.apply();
AlertDialog.Builder builder = new AlertDialog.Builder(UserAreaActivity.this);
builder.setMessage("Aby korzystać z aplikacji należy należy być zalogowanym")
.setNegativeButton("Ok", null)
.create()
.show();
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
getApplicationContext().startActivity(intent);
}
});
}
}

View File

@ -1,34 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
</vector>

View File

@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

View File

@ -1,170 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@ -0,0 +1,42 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/LoginAs"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/usernameAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<Button
android:id="@+id/logoutBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="8dp"
android:text="@string/Logout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/usernameAccount" />
</android.support.constraint.ConstraintLayout>

View File

@ -1,61 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:src="@drawable/ic_baseline_add_24px"
android:layout_margin="16dp"
app:backgroundTint="@color/colorPrimary" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/productsListView"
android:choiceMode="singleChoice" />
</FrameLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header"
app:menu="@menu/list_menu"
android:fitsSystemWindows="false"
android:id="@+id/navView">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header"/>
<ListView
android:layout_marginTop="300dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView"
android:choiceMode="singleChoice"
android:dividerHeight="1dp" />
</FrameLayout>
</android.support.design.widget.NavigationView>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:src="@drawable/ic_baseline_add_24px"
android:layout_margin="30dp"
app:backgroundTint="@color/colorPrimary" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/productsListView"
android:choiceMode="singleChoice" />
</FrameLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header"
app:menu="@menu/list_menu"
android:fitsSystemWindows="false"
android:id="@+id/navView">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header"/>
<ListView
android:layout_marginTop="280dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView"
android:choiceMode="singleChoice"
android:dividerHeight="1dp" />
</FrameLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

View File

@ -1,36 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/editRow"
android:layout_width="306dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="28dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="26dp"
android:ems="10"
android:inputType="textPersonName"
android:text=""
android:gravity=""
tools:ignore="Autofill" />
<Button
android:id="@+id/editBtn"
android:layout_below="@id/editRow"
android:layout_marginTop="60dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/editRow"
android:layout_alignParentTop="true"
android:gravity="center"
android:text="@string/AddButton" />
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/editRow"
android:layout_width="306dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="28dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="26dp"
android:ems="10"
android:inputType="textPersonName"
android:text=""
android:gravity=""
tools:ignore="Autofill,LabelFor" />
<Button
android:id="@+id/editBtn"
android:layout_below="@id/editRow"
android:layout_marginTop="60dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/editRow"
android:layout_alignParentTop="true"
android:gravity="center"
android:text="@string/AddButton" />
</RelativeLayout>

View File

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="153dp"
android:background="@color/NavBackground"
android:padding="20dp"
>
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:src="@drawable/ic_baseline_account_circle_24px"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/AccountText"
android:textStyle="bold"
android:textSize="15sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/EmailText"
/>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="135dp"
android:background="@color/NavBackground"
android:padding="20dp"
>
<ImageView
android:id="@+id/accountImage"
android:layout_width="75dp"
android:layout_height="75dp"
android:src="@drawable/ic_baseline_account_circle_24px"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/accountHeader"
android:layout_width="75dp"
android:layout_height="32dp"
android:text=""
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>

View File

@ -1,10 +1,13 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="100"
android:id="@+id/textView1"
android:baselineAligned="false"
android:textSize="17sp"
android:gravity="center_vertical"
android:text="@string/Product_name"
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="100"
android:id="@+id/list_view"
android:baselineAligned="false"
android:textSize="17sp"
android:paddingStart="35dp"
android:paddingEnd="0dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="@string/Product_name"
android:textColor="#000" />

View File

@ -0,0 +1,87 @@
<?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">
<EditText
android:id="@+id/usernameLogin"
android:layout_width="313dp"
android:layout_height="51dp"
android:layout_marginStart="8dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.516"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="Autofill,LabelFor"/>
<EditText
android:id="@+id/passwordLogin"
android:layout_width="309dp"
android:layout_height="47dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.514"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/usernameLogin"
tools:ignore="Autofill,LabelFor" />
<Button
android:id="@+id/signinBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Signin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passwordLogin" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Username"
app:layout_constraintBottom_toTopOf="@+id/usernameLogin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.075"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Password"
app:layout_constraintBottom_toTopOf="@+id/passwordLogin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.062"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/signupText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="@string/Signup_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/signinBtn" />
</android.support.constraint.ConstraintLayout>

View File

@ -1,28 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/popup_dailog">
<EditText
android:id="@+id/listNameText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:ems="10"
android:inputType="textAutoComplete"
tools:ignore="Autofill,LabelFor" />
<Button
android:layout_below="@id/listNameText"
android:id="@+id/addListBtn"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:text="@string/Popup_btn"
android:layout_marginStart="240dp"
android:textSize="12sp"/>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/popup_dailog">
<EditText
android:id="@+id/listNameText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:ems="10"
android:hint=""
android:inputType="textAutoComplete"
android:paddingTop="20dp"
tools:ignore="Autofill,LabelFor" />
<Button
android:id="@+id/addListBtn"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_below="@id/listNameText"
android:layout_alignParentEnd="true"
android:layout_marginEnd="40dp"
android:text="@string/Popup_btn"
android:textSize="12sp" />
</RelativeLayout>

View File

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/addProductText"
android:layout_width="306dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="28dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="26dp"
android:ems="10"
android:inputType="textPersonName"
android:text=""
tools:layout_editor_absoluteX="72dp"
tools:layout_editor_absoluteY="16dp" />
<Button
android:id="@+id/addProductBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/addProductText"
android:layout_alignParentTop="true"
android:layout_marginTop="66dp"
android:text="@string/AddButton" />
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/addProductText"
android:layout_width="306dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="28dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="26dp"
android:ems="10"
android:inputType="textPersonName"
android:text=""
tools:layout_editor_absoluteX="72dp"
tools:layout_editor_absoluteY="16dp" />
<Button
android:id="@+id/addProductBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/addProductText"
android:layout_alignParentTop="true"
android:layout_marginTop="66dp"
android:text="@string/AddButton" />
</RelativeLayout>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="vertical"
android:id="@+id/productCheck"
android:text="test"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:textSize="20sp"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:checked="false"
android:gravity="center" />
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="vertical"
android:id="@+id/productCheck"
android:text=""
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:textSize="20sp"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:checked="false"
android:gravity="center" />

View File

@ -0,0 +1,111 @@
<?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">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Username"
app:layout_constraintBottom_toTopOf="@+id/usernameRegister"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.113"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/usernameTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Email"
app:layout_constraintBottom_toTopOf="@+id/emailRegister"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.076"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/passwordTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Password"
app:layout_constraintBottom_toTopOf="@+id/passwordRegister"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.076"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/registerBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="@string/Signup"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passwordRegister" />
<TextView
android:id="@+id/signinText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/Signin_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/registerBtn" />
<EditText
android:id="@+id/usernameRegister"
android:layout_width="297dp"
android:layout_height="46dp"
android:layout_marginStart="8dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.51"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="Autofill,LabelFor" />
<EditText
android:id="@+id/emailRegister"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:inputType="textEmailAddress"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/usernameRegister"
tools:ignore="Autofill,LabelFor"/>
<EditText
android:id="@+id/passwordRegister"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:ems="10"
android:inputType="textPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/emailRegister"
tools:ignore="Autofill,LabelFor"/>
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TimePicker
android:id="@+id/timeReminder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numbersSelectorColor="@color/colorPrimary"
android:headerBackground="@color/colorPrimary"
/>
<Button
android:id="@+id/cancelBtnReminder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="89dp"
android:layout_marginBottom="69dp"
android:text="@string/Cancel"
tools:ignore="RelativeOverlap" />
<Button
android:id="@+id/setBtnReminder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="89dp"
android:layout_marginBottom="69dp"
android:text="@string/Set"/>
</RelativeLayout>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/deleteItem"
android:title="@string/Delete"/>
<item android:id="@+id/editItem"
android:title="@string/Edit"/>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/deleteItem"
android:title="@string/Delete"/>
<item android:id="@+id/editItem"
android:title="@string/Edit"/>
</menu>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/AddList"
android:title="@string/AddListButton" />
<item android:id="@+id/Reminder"
android:title="@string/Reminder"/>
<item android:id="@+id/ProductList"
android:title="@string/ProductList" />
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/AddList"
android:title="@string/AddListButton" />
<item android:id="@+id/Reminder"
android:title="@string/Reminder"/>
<item android:id="@+id/ProductList"
android:title="@string/ProductList" />
</menu>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/deleteTable"
android:title="@string/Delete"/>
</menu>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#795548</color>
<color name="colorPrimaryDark">#5D4037</color>
<color name="colorAccent">#FF4081</color>
<color name="NavBackground">#ffffff</color>
<color name="Grey">#808080</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#795548</color>
<color name="colorPrimaryDark">#5D4037</color>
<color name="colorAccent">#FF4081</color>
<color name="NavBackground">#ffffff</color>
<color name="Grey">#808080</color>
</resources>

View File

@ -1,18 +1,29 @@
<resources>
<string name="app_name">ShopList</string>
<string name="AccountText">Użytkownik</string>
<string name="EmailText">example@example.com</string>
<string name="ProductList">Twoje Listy</string>
<string name="AddButton">Dodaj</string>
<string name="AddListButton">Nowa lista</string>
<string name="Open">Open</string>
<string name="Close">Close</string>
<string name="Settings">Ustawienia</string>
<string name="Reminder">Ustaw przypomnienie</string>
<string name="Product_name">Brak</string>
<string name="Popup_info">Wprowadź nazwę listy</string>
<string name="Popup_btn">Potwierdź</string>
<string name="Delete">Usuń</string>
<string name="Edit">Edytuj</string>
<string name="AddProduct">Wprowadź nazwę produktu</string>
</resources>
<resources>
<string name="app_name">ShopList</string>
<string name="AccountText">Użytkownik</string>
<string name="EmailText">example@example.com</string>
<string name="ProductList">Twoje Listy</string>
<string name="AddButton">Dodaj</string>
<string name="AddListButton">Nowa lista</string>
<string name="Open">Open</string>
<string name="Close">Close</string>
<string name="Settings">Ustawienia</string>
<string name="Reminder">Ustaw przypomnienie</string>
<string name="Product_name">Brak</string>
<string name="Popup_info">Wprowadź nazwę listy</string>
<string name="Popup_btn">Potwierdź</string>
<string name="Delete">Usuń</string>
<string name="Edit">Edytuj</string>
<string name="AddProduct">Wprowadź nazwę produktu</string>
<string name="Signin">Zaloguj</string>
<string name="Username">Nazwa użytkowanika</string>
<string name="Password">Hasło</string>
<string name="Signup_text">Nie masz konta? Zarejestruj się</string>
<string name="Signup">Zarejestruj</string>
<string name="Signin_text">Masz już konto ? Zaloguj się </string>
<string name="Email">E-mail</string>
<string name="LoginAs">Jesteś zalogowany jako</string>
<string name="Logout">Wyloguj</string>
<string name="Set">Ustaw</string>
<string name="Cancel">Anuluj</string>
</resources>

View File

@ -1,11 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@ -1,17 +1,17 @@
package michalpawlaczyk.shoplist;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
package michalpawlaczyk.shoplist;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -1,27 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -1,15 +1,15 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

168
gradlew.bat vendored
View File

@ -1,84 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1 +1 @@
include ':app'
include ':app'