Dodano mozliwosc logowania, zmiana sposobu przechowywania danych, poprawki bledow
This commit is contained in:
parent
0df52ec13f
commit
5d61850457
@ -23,6 +23,7 @@ dependencies {
|
||||
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'
|
||||
|
@ -3,25 +3,33 @@
|
||||
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:fullBackupContent="true">
|
||||
<activity android:name=".MainActivity">
|
||||
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=".FloatingAction"/>
|
||||
|
||||
<activity android:name=".RegisterActivity"/>
|
||||
<activity android:name=".UserAreaActivity"/>
|
||||
<receiver android:name=".ReminderReciver"/>
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
</manifest>
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -1,27 +1,32 @@
|
||||
package michalpawlaczyk.shoplist;
|
||||
|
||||
import android.database.Cursor;
|
||||
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.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
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;
|
||||
DatabaseHelper myDb;
|
||||
String chosenListID;
|
||||
ArrayList<String> productItem;
|
||||
ArrayAdapter<String> adapter2;
|
||||
ListView listProductView;
|
||||
|
||||
MainActivity mainActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@ -29,9 +34,10 @@ public class FloatingAction extends AppCompatActivity {
|
||||
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<>();
|
||||
mainActivity = new MainActivity();
|
||||
listNameText.setHint("Podaj nazwę produktu");
|
||||
AddData();
|
||||
}
|
||||
public void AddData(){
|
||||
@ -41,32 +47,30 @@ public class FloatingAction extends AppCompatActivity {
|
||||
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();
|
||||
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);
|
||||
}
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
127
app/src/main/java/michalpawlaczyk/shoplist/LoginActivity.java
Normal file
127
app/src/main/java/michalpawlaczyk/shoplist/LoginActivity.java
Normal 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);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,13 +1,16 @@
|
||||
package michalpawlaczyk.shoplist;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
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.*;
|
||||
@ -15,20 +18,39 @@ 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;
|
||||
DatabaseHelper myDb;
|
||||
ArrayList<String> listItem;
|
||||
ArrayList<String> productItem;
|
||||
ArrayAdapter<String> adapter;
|
||||
ArrayAdapter adapter;
|
||||
ArrayAdapter<String> adapter2;
|
||||
ListView listNameView;
|
||||
ListView listProductView;
|
||||
@ -37,8 +59,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
FloatingActionButton fab;
|
||||
String listProductID;
|
||||
String chosenListID;
|
||||
|
||||
|
||||
String chosenTableID;
|
||||
ImageView accountImage;
|
||||
TextView accountHeader;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -51,15 +74,28 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
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);
|
||||
accountImage = findViewById(R.id.accountImage);
|
||||
productItem = new ArrayList<>();
|
||||
viewTableName();
|
||||
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
|
||||
@ -70,88 +106,177 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
}
|
||||
});
|
||||
|
||||
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();
|
||||
/*
|
||||
if(listProductView.isItemChecked(position)) {
|
||||
ctvProduct.setPaintFlags(ctvProduct.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
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) {
|
||||
|
||||
}
|
||||
else {
|
||||
ctvProduct.setPaintFlags(ctvProduct.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
}*/
|
||||
},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();
|
||||
viewCheckData(chosenListID);
|
||||
//((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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
registerForContextMenu(listProductView);
|
||||
//registerForContextMenu(listNameView);
|
||||
|
||||
/*
|
||||
ctvProduct.setOnClickListener(new View.OnClickListener() {
|
||||
listNameView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(ctvProduct.isChecked()){
|
||||
ctvProduct.setChecked(false);
|
||||
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) {
|
||||
}
|
||||
else
|
||||
ctvProduct.setChecked(true);
|
||||
}, 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);
|
||||
//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 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();
|
||||
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
|
||||
);
|
||||
|
||||
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();
|
||||
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
|
||||
queue.add(jsonObjectRequest);
|
||||
productItem.clear();
|
||||
viewTableData(chosenListID);
|
||||
return false;
|
||||
}
|
||||
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);
|
||||
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
|
||||
@ -171,64 +296,131 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
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 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();
|
||||
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);
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
} 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package michalpawlaczyk.shoplist;
|
||||
|
||||
//import android.content.Context;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -10,14 +11,23 @@ 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;
|
||||
DatabaseHelper myDb;
|
||||
|
||||
|
||||
@Override
|
||||
@ -25,7 +35,7 @@ public class MenuFragment extends Fragment{
|
||||
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());
|
||||
listNameText.setHint("Podaj nazwę listy");
|
||||
AddTable();
|
||||
return view;
|
||||
|
||||
@ -34,8 +44,25 @@ public class MenuFragment extends Fragment{
|
||||
addListBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
myDb.userCreateTable(listNameText.getText().toString());
|
||||
((MainActivity)Objects.requireNonNull(getActivity())).reloadTableName();
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
109
app/src/main/java/michalpawlaczyk/shoplist/RegisterActivity.java
Normal file
109
app/src/main/java/michalpawlaczyk/shoplist/RegisterActivity.java
Normal 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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -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());
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
42
app/src/main/res/layout/account_activity.xml
Normal file
42
app/src/main/res/layout/account_activity.xml
Normal 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>
|
@ -21,7 +21,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:src="@drawable/ic_baseline_add_24px"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_margin="30dp"
|
||||
app:backgroundTint="@color/colorPrimary" />
|
||||
|
||||
<ListView
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
<include layout="@layout/header"/>
|
||||
<ListView
|
||||
android:layout_marginTop="300dp"
|
||||
android:layout_marginTop="280dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/listView"
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?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"
|
||||
@ -21,7 +20,7 @@
|
||||
android:inputType="textPersonName"
|
||||
android:text=""
|
||||
android:gravity=""
|
||||
tools:ignore="Autofill" />
|
||||
tools:ignore="Autofill,LabelFor" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/editBtn"
|
||||
|
@ -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"
|
||||
<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="153dp"
|
||||
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:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/AccountText"
|
||||
android:textStyle="bold"
|
||||
|
||||
android:id="@+id/accountHeader"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="32dp"
|
||||
android:text=""
|
||||
android:textSize="15sp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/EmailText"
|
||||
/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
@ -2,9 +2,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:weightSum="100"
|
||||
android:id="@+id/textView1"
|
||||
android:id="@+id/list_view"
|
||||
android:baselineAligned="false"
|
||||
android:textSize="17sp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="35dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="@string/Product_name"
|
||||
android:textColor="#000" />
|
87
app/src/main/res/layout/login_activity.xml
Normal file
87
app/src/main/res/layout/login_activity.xml
Normal 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>
|
@ -13,16 +13,19 @@
|
||||
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:layout_below="@id/listNameText"
|
||||
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:layout_marginStart="240dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
@ -4,7 +4,7 @@
|
||||
android:layout_height="45dp"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/productCheck"
|
||||
android:text="test"
|
||||
android:text=""
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:textSize="20sp"
|
||||
|
111
app/src/main/res/layout/register_activity.xml
Normal file
111
app/src/main/res/layout/register_activity.xml
Normal 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>
|
38
app/src/main/res/layout/reminder_fragment.xml
Normal file
38
app/src/main/res/layout/reminder_fragment.xml
Normal 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>
|
5
app/src/main/res/menu/table_menu.xml
Normal file
5
app/src/main/res/menu/table_menu.xml
Normal 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>
|
@ -15,4 +15,15 @@
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user