Dodano mozliwosc logowania, zmiana sposobu przechowywania danych, poprawki bledow
This commit is contained in:
parent
0df52ec13f
commit
5d61850457
2
app/.gitignore
vendored
2
app/.gitignore
vendored
@ -1 +1 @@
|
|||||||
/build
|
/build
|
||||||
|
@ -1,29 +1,30 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "michalpawlaczyk.shoplist"
|
applicationId "michalpawlaczyk.shoplist"
|
||||||
minSdkVersion 22
|
minSdkVersion 22
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||||
implementation 'com.android.support:design:28.0.0'
|
implementation 'com.android.support:design:28.0.0'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
testImplementation 'junit:junit:4.12'
|
implementation 'com.android.volley:volley:1.1.1'
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
}
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
}
|
||||||
|
42
app/proguard-rules.pro
vendored
42
app/proguard-rules.pro
vendored
@ -1,21 +1,21 @@
|
|||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# You can control the set of applied configuration files using the
|
# You can control the set of applied configuration files using the
|
||||||
# proguardFiles setting in build.gradle.
|
# proguardFiles setting in build.gradle.
|
||||||
#
|
#
|
||||||
# For more details, see
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# If your project uses WebView with JS, uncomment the following
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
# class:
|
# class:
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
# public *;
|
# public *;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
# Uncomment this to preserve the line number information for
|
||||||
# debugging stack traces.
|
# debugging stack traces.
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
package michalpawlaczyk.shoplist;
|
package michalpawlaczyk.shoplist;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.test.InstrumentationRegistry;
|
import android.support.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumented test, which will execute on an Android device.
|
* Instrumented test, which will execute on an Android device.
|
||||||
*
|
*
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class ExampleInstrumentedTest {
|
public class ExampleInstrumentedTest {
|
||||||
@Test
|
@Test
|
||||||
public void useAppContext() {
|
public void useAppContext() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||||
|
|
||||||
assertEquals("michalpawlaczyk.shoplist", appContext.getPackageName());
|
assertEquals("michalpawlaczyk.shoplist", appContext.getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="michalpawlaczyk.shoplist">
|
package="michalpawlaczyk.shoplist">
|
||||||
|
|
||||||
<application
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
<application
|
||||||
android:label="@string/app_name"
|
android:allowBackup="true"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:fullBackupContent="true"
|
||||||
android:supportsRtl="true"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:theme="@style/AppTheme"
|
android:label="@string/app_name"
|
||||||
tools:ignore="GoogleAppIndexingWarning"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:fullBackupContent="true">
|
android:supportsRtl="true"
|
||||||
<activity android:name=".MainActivity">
|
android:theme="@style/AppTheme"
|
||||||
<intent-filter>
|
tools:ignore="GoogleAppIndexingWarning"
|
||||||
<action android:name="android.intent.action.MAIN" />
|
android:usesCleartextTraffic="true"
|
||||||
|
tools:targetApi="m">
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<activity android:name=".MainActivity"/>
|
||||||
</intent-filter>
|
<activity android:name=".FloatingAction" />
|
||||||
</activity>
|
<activity android:name=".LoginActivity">
|
||||||
<activity android:name=".FloatingAction"/>
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
</application>
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".RegisterActivity"/>
|
||||||
|
<activity android:name=".UserAreaActivity"/>
|
||||||
|
<receiver android:name=".ReminderReciver"/>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
</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,39 +1,39 @@
|
|||||||
package michalpawlaczyk.shoplist;
|
package michalpawlaczyk.shoplist;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
public class EditFragment extends Fragment {
|
public class EditFragment extends Fragment {
|
||||||
private Button addListBtn;
|
private Button addListBtn;
|
||||||
EditText listNameText;
|
EditText listNameText;
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.popup_dialog, container, false);
|
View view = inflater.inflate(R.layout.popup_dialog, container, false);
|
||||||
addListBtn = view.findViewById(R.id.addListBtn);
|
addListBtn = view.findViewById(R.id.addListBtn);
|
||||||
listNameText = view.findViewById(R.id.listNameText);
|
listNameText = view.findViewById(R.id.listNameText);
|
||||||
btnClick();
|
btnClick();
|
||||||
return view;
|
return view;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void btnClick(){
|
public void btnClick(){
|
||||||
addListBtn.setOnClickListener(new View.OnClickListener() {
|
addListBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
text = listNameText.getText().toString();
|
text = listNameText.getText().toString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public String getText(){
|
public String getText(){
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,72 +1,76 @@
|
|||||||
package michalpawlaczyk.shoplist;
|
package michalpawlaczyk.shoplist;
|
||||||
|
|
||||||
import android.database.Cursor;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.content.SharedPreferences;
|
||||||
import android.support.annotation.Nullable;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.View;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.widget.ArrayAdapter;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Toast;
|
import com.android.volley.Request;
|
||||||
|
import com.android.volley.RequestQueue;
|
||||||
import java.util.ArrayList;
|
import com.android.volley.Response;
|
||||||
|
import com.android.volley.toolbox.JsonObjectRequest;
|
||||||
public class FloatingAction extends AppCompatActivity {
|
import com.android.volley.toolbox.Volley;
|
||||||
private Button addListBtn;
|
import org.json.JSONObject;
|
||||||
EditText listNameText;
|
import java.util.ArrayList;
|
||||||
DatabaseHelper myDb;
|
import java.util.HashMap;
|
||||||
String chosenListID;
|
import java.util.Map;
|
||||||
ArrayList<String> productItem;
|
import java.util.Objects;
|
||||||
ArrayAdapter<String> adapter2;
|
|
||||||
ListView listProductView;
|
public class FloatingAction extends AppCompatActivity {
|
||||||
|
private Button addListBtn;
|
||||||
|
EditText listNameText;
|
||||||
@Override
|
String chosenListID;
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
ArrayList<String> productItem;
|
||||||
super.onCreate(savedInstanceState);
|
ListView listProductView;
|
||||||
setContentView(R.layout.popup_dialog);
|
MainActivity mainActivity;
|
||||||
addListBtn = findViewById(R.id.addListBtn);
|
|
||||||
listNameText = findViewById(R.id.listNameText);
|
@Override
|
||||||
myDb = new DatabaseHelper(this);
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
listProductView = findViewById(R.id.productsListView);
|
super.onCreate(savedInstanceState);
|
||||||
productItem = new ArrayList<>();
|
setContentView(R.layout.popup_dialog);
|
||||||
AddData();
|
addListBtn = findViewById(R.id.addListBtn);
|
||||||
}
|
listNameText = findViewById(R.id.listNameText);
|
||||||
public void AddData(){
|
listProductView = findViewById(R.id.productsListView);
|
||||||
addListBtn.setOnClickListener(new View.OnClickListener() {
|
productItem = new ArrayList<>();
|
||||||
@Override
|
mainActivity = new MainActivity();
|
||||||
public void onClick(View v) {
|
listNameText.setHint("Podaj nazwę produktu");
|
||||||
Bundle extras = getIntent().getExtras();
|
AddData();
|
||||||
if(extras != null) {
|
}
|
||||||
chosenListID = extras.getString("chosenListID");
|
public void AddData(){
|
||||||
boolean isInserted = myDb.insertData(chosenListID, listNameText.getText().toString());
|
addListBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
if (isInserted) {
|
@Override
|
||||||
Toast.makeText(FloatingAction.this, "Done", Toast.LENGTH_LONG).show();
|
public void onClick(View v) {
|
||||||
|
Bundle extras = getIntent().getExtras();
|
||||||
} else {
|
if(extras != null) {
|
||||||
Toast.makeText(FloatingAction.this, "Something goes wrong!", Toast.LENGTH_LONG).show();
|
chosenListID = extras.getString("chosenListID");
|
||||||
}
|
String text = listNameText.getText().toString();
|
||||||
//reloadData();
|
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",""),
|
||||||
public void reloadData(){
|
new JSONObject(postParam),
|
||||||
Cursor res = myDb.getChecekData(chosenListID);
|
new Response.Listener<JSONObject>() {
|
||||||
if(res.getCount() == 0){
|
@Override
|
||||||
Toast.makeText(this, "No data to show", Toast.LENGTH_SHORT).show();
|
public void onResponse(JSONObject response) {
|
||||||
}
|
}
|
||||||
else {
|
}, null
|
||||||
while (res.moveToNext()) {
|
|
||||||
productItem.add(res.getString(1));
|
);
|
||||||
|
|
||||||
}
|
RequestQueue queue = Volley.newRequestQueue(Objects.requireNonNull(getApplicationContext()));
|
||||||
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
|
queue.add(jsonObjectRequest);
|
||||||
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,234 +1,426 @@
|
|||||||
package michalpawlaczyk.shoplist;
|
package michalpawlaczyk.shoplist;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.annotation.SuppressLint;
|
||||||
import android.database.Cursor;
|
import android.content.DialogInterface;
|
||||||
import android.support.annotation.NonNull;
|
import android.content.Intent;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.content.SharedPreferences;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.os.Bundle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.view.*;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.widget.AdapterView;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.widget.ArrayAdapter;
|
import android.os.Bundle;
|
||||||
import android.widget.Button;
|
import android.view.*;
|
||||||
import android.widget.CheckedTextView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.Button;
|
||||||
import android.widget.Toast;
|
import android.widget.CheckedTextView;
|
||||||
import java.util.ArrayList;
|
import android.widget.EditText;
|
||||||
import java.util.Objects;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ListView;
|
||||||
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
import android.widget.TextView;
|
||||||
private DrawerLayout mDraverLayout;
|
import android.widget.Toast;
|
||||||
private ActionBarDrawerToggle mToggle;
|
import com.android.volley.AuthFailureError;
|
||||||
DatabaseHelper myDb;
|
import com.android.volley.NetworkError;
|
||||||
ArrayList<String> listItem;
|
import com.android.volley.ParseError;
|
||||||
ArrayList<String> productItem;
|
import com.android.volley.Request;
|
||||||
ArrayAdapter<String> adapter;
|
import com.android.volley.RequestQueue;
|
||||||
ArrayAdapter<String> adapter2;
|
import com.android.volley.Response;
|
||||||
ListView listNameView;
|
import com.android.volley.ServerError;
|
||||||
ListView listProductView;
|
import com.android.volley.VolleyError;
|
||||||
CheckedTextView ctvProduct;
|
import com.android.volley.toolbox.JsonArrayRequest;
|
||||||
Button editItem;
|
import com.android.volley.toolbox.JsonObjectRequest;
|
||||||
FloatingActionButton fab;
|
import com.android.volley.toolbox.Volley;
|
||||||
String listProductID;
|
import org.json.JSONArray;
|
||||||
String chosenListID;
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
@Override
|
import java.util.Map;
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
import java.util.Objects;
|
||||||
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);
|
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
mDraverLayout.addDrawerListener(mToggle);
|
private DrawerLayout mDraverLayout;
|
||||||
mToggle.syncState();
|
private ActionBarDrawerToggle mToggle;
|
||||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
ArrayList<String> listItem;
|
||||||
NavigationView mNavigationView = findViewById(R.id.navView);
|
ArrayList<String> productItem;
|
||||||
mNavigationView.setNavigationItemSelectedListener(this);
|
ArrayAdapter adapter;
|
||||||
myDb = new DatabaseHelper(this);
|
ArrayAdapter<String> adapter2;
|
||||||
listItem = new ArrayList<>();
|
ListView listNameView;
|
||||||
listNameView = findViewById(R.id.listView);
|
ListView listProductView;
|
||||||
listProductView = findViewById(R.id.productsListView);
|
CheckedTextView ctvProduct;
|
||||||
ctvProduct = findViewById(R.id.productCheck);
|
Button editItem;
|
||||||
productItem = new ArrayList<>();
|
FloatingActionButton fab;
|
||||||
viewTableName();
|
String listProductID;
|
||||||
fab = findViewById(R.id.fab);
|
String chosenListID;
|
||||||
listProductView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
String chosenTableID;
|
||||||
|
ImageView accountImage;
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
TextView accountHeader;
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
@Override
|
||||||
Intent intent = new Intent(MainActivity.this, FloatingAction.class);
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
intent.putExtra("chosenListID", chosenListID);
|
super.onCreate(savedInstanceState);
|
||||||
startActivity(intent);
|
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);
|
||||||
listProductView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
mToggle.syncState();
|
||||||
@Override
|
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
NavigationView mNavigationView = findViewById(R.id.navView);
|
||||||
listProductID = parent.getItemAtPosition(position).toString();
|
mNavigationView.setNavigationItemSelectedListener(this);
|
||||||
/*
|
listNameView = findViewById(R.id.listView);
|
||||||
if(listProductView.isItemChecked(position)) {
|
listProductView = findViewById(R.id.productsListView);
|
||||||
ctvProduct.setPaintFlags(ctvProduct.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
ctvProduct = findViewById(R.id.productCheck);
|
||||||
}
|
accountImage = findViewById(R.id.accountImage);
|
||||||
else {
|
productItem = new ArrayList<>();
|
||||||
ctvProduct.setPaintFlags(ctvProduct.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
fab = findViewById(R.id.fab);
|
||||||
}*/
|
listProductView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||||
}
|
getTableName();
|
||||||
});
|
|
||||||
listNameView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
accountHeader = findViewById(R.id.accountHeader);
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
|
||||||
chosenListID = parent.getItemAtPosition(position).toString();
|
final SharedPreferences lastTable = getApplicationContext().getSharedPreferences("userData", MODE_PRIVATE);
|
||||||
viewCheckData(chosenListID);
|
|
||||||
}
|
chosenTableID = lastTable.getString("lastTable","");
|
||||||
});
|
Toast.makeText(getBaseContext(), chosenListID, Toast.LENGTH_LONG).show();
|
||||||
|
if(chosenTableID != null)
|
||||||
registerForContextMenu(listProductView);
|
viewTableData(chosenTableID);
|
||||||
//registerForContextMenu(listNameView);
|
if(settings.getString("username","") != null){
|
||||||
|
accountHeader.setText(settings.getString("username",""));
|
||||||
/*
|
accountHeader.setText(settings.getString("username",""));
|
||||||
ctvProduct.setOnClickListener(new View.OnClickListener() {
|
}
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
if(ctvProduct.isChecked()){
|
@Override
|
||||||
ctvProduct.setChecked(false);
|
public void onClick(View v) {
|
||||||
}
|
Intent intent = new Intent(MainActivity.this, FloatingAction.class);
|
||||||
else
|
intent.putExtra("chosenListID", chosenListID);
|
||||||
ctvProduct.setChecked(true);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);*/
|
|
||||||
}
|
accountImage.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
public void onClick(View v) {
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
|
||||||
getMenuInflater().inflate(R.menu.context_menu, menu);
|
if(settings.getString("username","") == null) {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
|
||||||
|
getApplicationContext().startActivity(intent);
|
||||||
}
|
} else {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), UserAreaActivity.class);
|
||||||
@Override
|
getApplicationContext().startActivity(intent);
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
}
|
||||||
switch(item.getItemId()) {
|
}
|
||||||
case R.id.deleteItem:
|
});
|
||||||
Integer result = myDb.deleteData(chosenListID, listProductID);
|
|
||||||
System.out.println(listProductID);
|
listProductView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
if(result > 0){
|
@Override
|
||||||
reloadData();
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
}
|
listProductID = parent.getItemAtPosition(position).toString();
|
||||||
else {
|
Boolean isCheck = listProductView.isItemChecked(position);
|
||||||
reloadData();
|
Map<String, String> postParam= new HashMap<>();
|
||||||
Toast.makeText(MainActivity.this, "Fail", Toast.LENGTH_SHORT).show();
|
postParam.put("tableName", chosenListID);
|
||||||
|
postParam.put("productName", listProductID);
|
||||||
}
|
postParam.put("isCheck", isCheck.toString());
|
||||||
|
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
|
||||||
return true;
|
Request.Method.POST,
|
||||||
case R.id.editItem:
|
"http://192.168.0.115:8080/setItemCheck?" + settings.getString("token", ""),
|
||||||
/*
|
new JSONObject(postParam),
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,
|
new Response.Listener<JSONObject>() {
|
||||||
new EditFragment()).commit();
|
@Override
|
||||||
EditFragment editFragment = new EditFragment();
|
public void onResponse(JSONObject response) {
|
||||||
String tmp = editFragment.getText();
|
|
||||||
boolean result2 = myDb.updateData(chosenListID, tmp);
|
}
|
||||||
if(result2){
|
},null
|
||||||
reloadData();
|
);
|
||||||
}
|
|
||||||
else {
|
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
|
||||||
reloadData();
|
queue.add(jsonObjectRequest);
|
||||||
Toast.makeText(MainActivity.this, "Fail", Toast.LENGTH_SHORT).show();
|
}
|
||||||
|
});
|
||||||
}*/
|
|
||||||
Toast.makeText(MainActivity.this, "Not supported yet", Toast.LENGTH_SHORT).show();
|
listProductView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
return true;
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
default:
|
listProductID = parent.getItemAtPosition(position).toString();
|
||||||
return super.onContextItemSelected(item);
|
registerForContextMenu(listProductView);
|
||||||
}
|
openContextMenu(listProductView);
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
@Override
|
});
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (mToggle.onOptionsItemSelected(item)) {
|
|
||||||
return true;
|
|
||||||
}
|
listNameView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
return super.onOptionsItemSelected(item);
|
@Override
|
||||||
}
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
chosenListID = parent.getItemAtPosition(position).toString();
|
||||||
//Navigation items
|
//((FrameLayout)findViewById(R.id.content_frame)).removeAllViews();
|
||||||
@Override
|
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userData", MODE_PRIVATE);
|
||||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
@SuppressLint("CommitPrefEdits") SharedPreferences.Editor editor = settings.edit();
|
||||||
switch (menuItem.getItemId()){
|
editor.putString("lastTable", chosenListID);
|
||||||
case R.id.AddList:
|
viewTableData(chosenListID);
|
||||||
((FrameLayout)findViewById(R.id.content_frame)).removeAllViews();
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,
|
|
||||||
new MenuFragment()).commit();
|
|
||||||
break;
|
}
|
||||||
}
|
});
|
||||||
mDraverLayout.closeDrawer(GravityCompat.START);
|
listNameView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
return true;
|
@Override
|
||||||
}
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
final String deleteTableID = parent.getItemAtPosition(position).toString();
|
||||||
public void viewCheckData(String tableName){
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
Cursor res = myDb.getChecekData(tableName);
|
builder.setMessage("Czy na pewno chcesz usunać listę "+deleteTableID+" ?")
|
||||||
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
|
.setPositiveButton("Tak", new DialogInterface.OnClickListener() {
|
||||||
listProductView.setAdapter(adapter2);
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
if(adapter2.getCount() > 0){
|
Map<String, String> postParam= new HashMap<>();
|
||||||
adapter2.clear();
|
postParam.put("tableName", deleteTableID);
|
||||||
}
|
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST,
|
||||||
while (res.moveToNext()) {
|
"http://192.168.0.115:8080/deleteTable?" + settings.getString("token", ""),
|
||||||
productItem.add(res.getString(1));
|
new JSONObject(postParam),
|
||||||
|
new Response.Listener<JSONObject>() {
|
||||||
}
|
@Override
|
||||||
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
|
public void onResponse(JSONObject response) {
|
||||||
listProductView.setAdapter(adapter2);
|
}
|
||||||
}
|
}, null);
|
||||||
public void reloadData(){
|
|
||||||
Cursor res = myDb.getChecekData(chosenListID);
|
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
|
||||||
adapter2.clear();
|
queue.add(jsonObjectRequest);
|
||||||
if(res.getCount() == 0){
|
listItem.clear();
|
||||||
Toast.makeText(this, "No data to show", Toast.LENGTH_SHORT).show();
|
getTableName();
|
||||||
}
|
}
|
||||||
else {
|
})
|
||||||
while (res.moveToNext()) {
|
.setNegativeButton("Nie", null)
|
||||||
productItem.add(res.getString(1));
|
.create()
|
||||||
|
.show();
|
||||||
}
|
|
||||||
adapter2 = new ArrayAdapter<>(this, R.layout.product_view, productItem);
|
return true;
|
||||||
listProductView.setAdapter(adapter2);
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewTableName(){
|
@Override
|
||||||
Cursor res = myDb.getAllTableName();
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||||
if (res.moveToFirst()) {
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
while ( !res.isAfterLast() ) {
|
//getMenuInflater().inflate(R.menu.context_menu, menu);
|
||||||
listItem.add(res.getString(res.getColumnIndex("name")));
|
final SharedPreferences settings = getApplicationContext().getSharedPreferences("userInfo", MODE_PRIVATE);
|
||||||
System.out.println(res.getString( res.getColumnIndex("name")));
|
|
||||||
res.moveToNext();
|
MenuItem delete = menu.add("Usuń");
|
||||||
}
|
MenuItem edit = menu.add("Edytuj");
|
||||||
}
|
|
||||||
adapter = new ArrayAdapter<>(this, R.layout.list_view, listItem);
|
delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
listNameView.setAdapter(adapter);
|
@Override
|
||||||
}
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
public void reloadTableName(){
|
Map<String, String> postParam= new HashMap<>();
|
||||||
Cursor res = myDb.getAllTableName();
|
postParam.put("tableName", chosenListID);
|
||||||
adapter.clear();
|
postParam.put("rowData", listProductID);
|
||||||
if (res.moveToFirst()) {
|
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
|
||||||
while ( !res.isAfterLast() ) {
|
Request.Method.POST,
|
||||||
listItem.add( res.getString( res.getColumnIndex("name")) );
|
"http://192.168.0.115:8080/deleteData?" + settings.getString("token", ""),
|
||||||
res.moveToNext();
|
new JSONObject(postParam),
|
||||||
}
|
new Response.Listener<JSONObject>() {
|
||||||
}
|
@Override
|
||||||
adapter = new ArrayAdapter<>(this, R.layout.list_view, listItem);
|
public void onResponse(JSONObject response) {
|
||||||
listNameView.setAdapter(adapter);
|
|
||||||
}
|
}
|
||||||
|
},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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,42 +1,69 @@
|
|||||||
package michalpawlaczyk.shoplist;
|
package michalpawlaczyk.shoplist;
|
||||||
|
|
||||||
//import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.content.SharedPreferences;
|
||||||
import android.support.annotation.NonNull;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.LayoutInflater;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.View;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import java.util.Objects;
|
import com.android.volley.Request;
|
||||||
|
import com.android.volley.RequestQueue;
|
||||||
public class MenuFragment extends Fragment{
|
import com.android.volley.Response;
|
||||||
|
import com.android.volley.toolbox.JsonObjectRequest;
|
||||||
private Button addListBtn;
|
import com.android.volley.toolbox.Volley;
|
||||||
EditText listNameText;
|
|
||||||
DatabaseHelper myDb;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
@Override
|
import java.util.Map;
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
import java.util.Objects;
|
||||||
View view = inflater.inflate(R.layout.popup_dialog, container, false);
|
|
||||||
addListBtn = view.findViewById(R.id.addListBtn);
|
|
||||||
listNameText = view.findViewById(R.id.listNameText);
|
public class MenuFragment extends Fragment{
|
||||||
myDb = new DatabaseHelper(getActivity());
|
|
||||||
AddTable();
|
private Button addListBtn;
|
||||||
return view;
|
EditText listNameText;
|
||||||
|
|
||||||
}
|
|
||||||
public void AddTable(){
|
@Override
|
||||||
addListBtn.setOnClickListener(new View.OnClickListener() {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
@Override
|
View view = inflater.inflate(R.layout.popup_dialog, container, false);
|
||||||
public void onClick(View v) {
|
addListBtn = view.findViewById(R.id.addListBtn);
|
||||||
myDb.userCreateTable(listNameText.getText().toString());
|
listNameText = view.findViewById(R.id.listNameText);
|
||||||
((MainActivity)Objects.requireNonNull(getActivity())).reloadTableName();
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,34 +1,34 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
android:width="108dp"
|
android:width="108dp"
|
||||||
android:height="108dp"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="108">
|
android:viewportHeight="108">
|
||||||
<path
|
<path
|
||||||
android:fillType="evenOdd"
|
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: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:strokeWidth="1"
|
||||||
android:strokeColor="#00000000">
|
android:strokeColor="#00000000">
|
||||||
<aapt:attr name="android:fillColor">
|
<aapt:attr name="android:fillColor">
|
||||||
<gradient
|
<gradient
|
||||||
android:endX="78.5885"
|
android:endX="78.5885"
|
||||||
android:endY="90.9159"
|
android:endY="90.9159"
|
||||||
android:startX="48.7653"
|
android:startX="48.7653"
|
||||||
android:startY="61.0927"
|
android:startY="61.0927"
|
||||||
android:type="linear">
|
android:type="linear">
|
||||||
<item
|
<item
|
||||||
android:color="#44000000"
|
android:color="#44000000"
|
||||||
android:offset="0.0" />
|
android:offset="0.0" />
|
||||||
<item
|
<item
|
||||||
android:color="#00000000"
|
android:color="#00000000"
|
||||||
android:offset="1.0" />
|
android:offset="1.0" />
|
||||||
</gradient>
|
</gradient>
|
||||||
</aapt:attr>
|
</aapt:attr>
|
||||||
</path>
|
</path>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="#FFFFFF"
|
||||||
android:fillType="nonZero"
|
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: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:strokeWidth="1"
|
||||||
android:strokeColor="#00000000" />
|
android:strokeColor="#00000000" />
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
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"/>
|
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>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FF000000"
|
||||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -1,170 +1,170 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="108dp"
|
android:width="108dp"
|
||||||
android:height="108dp"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="108">
|
android:viewportHeight="108">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#008577"
|
android:fillColor="#008577"
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M9,0L9,108"
|
android:pathData="M9,0L9,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,0L19,108"
|
android:pathData="M19,0L19,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M29,0L29,108"
|
android:pathData="M29,0L29,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M39,0L39,108"
|
android:pathData="M39,0L39,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M49,0L49,108"
|
android:pathData="M49,0L49,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M59,0L59,108"
|
android:pathData="M59,0L59,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M69,0L69,108"
|
android:pathData="M69,0L69,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M79,0L79,108"
|
android:pathData="M79,0L79,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M89,0L89,108"
|
android:pathData="M89,0L89,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M99,0L99,108"
|
android:pathData="M99,0L99,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,9L108,9"
|
android:pathData="M0,9L108,9"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,19L108,19"
|
android:pathData="M0,19L108,19"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,29L108,29"
|
android:pathData="M0,29L108,29"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,39L108,39"
|
android:pathData="M0,39L108,39"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,49L108,49"
|
android:pathData="M0,49L108,49"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,59L108,59"
|
android:pathData="M0,59L108,59"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,69L108,69"
|
android:pathData="M0,69L108,69"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,79L108,79"
|
android:pathData="M0,79L108,79"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,89L108,89"
|
android:pathData="M0,89L108,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,99L108,99"
|
android:pathData="M0,99L108,99"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,29L89,29"
|
android:pathData="M19,29L89,29"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,39L89,39"
|
android:pathData="M19,39L89,39"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,49L89,49"
|
android:pathData="M19,49L89,49"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,59L89,59"
|
android:pathData="M19,59L89,59"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,69L89,69"
|
android:pathData="M19,69L89,69"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,79L89,79"
|
android:pathData="M19,79L89,79"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M29,19L29,89"
|
android:pathData="M29,19L29,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M39,19L39,89"
|
android:pathData="M39,19L39,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M49,19L49,89"
|
android:pathData="M49,19L49,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M59,19L59,89"
|
android:pathData="M59,19L59,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M69,19L69,89"
|
android:pathData="M69,19L69,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M79,19L79,89"
|
android:pathData="M79,19L79,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
</vector>
|
</vector>
|
||||||
|
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>
|
@ -1,61 +1,61 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/content_frame"
|
android:id="@+id/content_frame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/fab"
|
android:id="@+id/fab"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end|bottom"
|
android:layout_gravity="end|bottom"
|
||||||
android:src="@drawable/ic_baseline_add_24px"
|
android:src="@drawable/ic_baseline_add_24px"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="30dp"
|
||||||
app:backgroundTint="@color/colorPrimary" />
|
app:backgroundTint="@color/colorPrimary" />
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/productsListView"
|
android:id="@+id/productsListView"
|
||||||
android:choiceMode="singleChoice" />
|
android:choiceMode="singleChoice" />
|
||||||
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.NavigationView
|
<android.support.design.widget.NavigationView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
app:headerLayout="@layout/header"
|
app:headerLayout="@layout/header"
|
||||||
app:menu="@menu/list_menu"
|
app:menu="@menu/list_menu"
|
||||||
android:fitsSystemWindows="false"
|
android:fitsSystemWindows="false"
|
||||||
android:id="@+id/navView">
|
android:id="@+id/navView">
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<include layout="@layout/header"/>
|
<include layout="@layout/header"/>
|
||||||
<ListView
|
<ListView
|
||||||
android:layout_marginTop="300dp"
|
android:layout_marginTop="280dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/listView"
|
android:id="@+id/listView"
|
||||||
android:choiceMode="singleChoice"
|
android:choiceMode="singleChoice"
|
||||||
android:dividerHeight="1dp" />
|
android:dividerHeight="1dp" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</android.support.design.widget.NavigationView>
|
</android.support.design.widget.NavigationView>
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
</android.support.v4.widget.DrawerLayout>
|
@ -1,36 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical">
|
||||||
android:orientation="vertical">
|
|
||||||
|
<EditText
|
||||||
<EditText
|
android:id="@+id/editRow"
|
||||||
android:id="@+id/editRow"
|
android:layout_width="306dp"
|
||||||
android:layout_width="306dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_marginStart="28dp"
|
||||||
android:layout_marginStart="28dp"
|
android:layout_marginTop="12dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginEnd="26dp"
|
||||||
android:layout_marginEnd="26dp"
|
android:ems="10"
|
||||||
android:ems="10"
|
android:inputType="textPersonName"
|
||||||
android:inputType="textPersonName"
|
android:text=""
|
||||||
android:text=""
|
android:gravity=""
|
||||||
android:gravity=""
|
tools:ignore="Autofill,LabelFor" />
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
<Button
|
||||||
<Button
|
android:id="@+id/editBtn"
|
||||||
android:id="@+id/editBtn"
|
android:layout_below="@id/editRow"
|
||||||
android:layout_below="@id/editRow"
|
android:layout_marginTop="60dp"
|
||||||
android:layout_marginTop="60dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_alignEnd="@+id/editRow"
|
||||||
android:layout_alignEnd="@+id/editRow"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentTop="true"
|
android:gravity="center"
|
||||||
android:gravity="center"
|
android:text="@string/AddButton" />
|
||||||
android:text="@string/AddButton" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -1,26 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_height="153dp"
|
android:layout_width="match_parent"
|
||||||
android:background="@color/NavBackground"
|
android:orientation="vertical"
|
||||||
android:padding="20dp"
|
android:layout_height="135dp"
|
||||||
>
|
android:background="@color/NavBackground"
|
||||||
<ImageView
|
android:padding="20dp"
|
||||||
android:layout_width="75dp"
|
>
|
||||||
android:layout_height="75dp"
|
<ImageView
|
||||||
android:src="@drawable/ic_baseline_account_circle_24px"
|
android:id="@+id/accountImage"
|
||||||
/>
|
android:layout_width="75dp"
|
||||||
<TextView
|
android:layout_height="75dp"
|
||||||
android:layout_width="wrap_content"
|
android:src="@drawable/ic_baseline_account_circle_24px"
|
||||||
android:layout_height="wrap_content"
|
tools:ignore="ContentDescription" />
|
||||||
android:text="@string/AccountText"
|
|
||||||
android:textStyle="bold"
|
<TextView
|
||||||
android:textSize="15sp"
|
|
||||||
/>
|
android:id="@+id/accountHeader"
|
||||||
<TextView
|
android:layout_width="75dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="32dp"
|
||||||
android:layout_height="wrap_content"
|
android:text=""
|
||||||
android:text="@string/EmailText"
|
android:textSize="15sp"
|
||||||
/>
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -1,10 +1,13 @@
|
|||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:weightSum="100"
|
android:weightSum="100"
|
||||||
android:id="@+id/textView1"
|
android:id="@+id/list_view"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:gravity="center_vertical"
|
android:paddingStart="35dp"
|
||||||
android:text="@string/Product_name"
|
android:paddingEnd="0dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/Product_name"
|
||||||
android:textColor="#000" />
|
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>
|
@ -1,28 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:id="@+id/popup_dailog">
|
android:id="@+id/popup_dailog">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/listNameText"
|
android:id="@+id/listNameText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:inputType="textAutoComplete"
|
android:hint=""
|
||||||
tools:ignore="Autofill,LabelFor" />
|
android:inputType="textAutoComplete"
|
||||||
|
android:paddingTop="20dp"
|
||||||
<Button
|
tools:ignore="Autofill,LabelFor" />
|
||||||
android:layout_below="@id/listNameText"
|
|
||||||
android:id="@+id/addListBtn"
|
<Button
|
||||||
android:layout_width="95dp"
|
android:id="@+id/addListBtn"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="95dp"
|
||||||
android:text="@string/Popup_btn"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="240dp"
|
android:layout_below="@id/listNameText"
|
||||||
android:textSize="12sp"/>
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginEnd="40dp"
|
||||||
|
android:text="@string/Popup_btn"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -1,32 +1,32 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/addProductText"
|
android:id="@+id/addProductText"
|
||||||
android:layout_width="306dp"
|
android:layout_width="306dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginStart="28dp"
|
android:layout_marginStart="28dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:layout_marginEnd="26dp"
|
android:layout_marginEnd="26dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
android:text=""
|
android:text=""
|
||||||
tools:layout_editor_absoluteX="72dp"
|
tools:layout_editor_absoluteX="72dp"
|
||||||
tools:layout_editor_absoluteY="16dp" />
|
tools:layout_editor_absoluteY="16dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/addProductBtn"
|
android:id="@+id/addProductBtn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignEnd="@+id/addProductText"
|
android:layout_alignEnd="@+id/addProductText"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginTop="66dp"
|
android:layout_marginTop="66dp"
|
||||||
android:text="@string/AddButton" />
|
android:text="@string/AddButton" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:id="@+id/productCheck"
|
android:id="@+id/productCheck"
|
||||||
android:text="test"
|
android:text=""
|
||||||
android:paddingStart="15dp"
|
android:paddingStart="15dp"
|
||||||
android:paddingEnd="2dp"
|
android:paddingEnd="2dp"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
|
||||||
android:checked="false"
|
android:checked="false"
|
||||||
android:gravity="center" />
|
android:gravity="center" />
|
||||||
|
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>
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item android:id="@+id/deleteItem"
|
<item android:id="@+id/deleteItem"
|
||||||
android:title="@string/Delete"/>
|
android:title="@string/Delete"/>
|
||||||
<item android:id="@+id/editItem"
|
<item android:id="@+id/editItem"
|
||||||
android:title="@string/Edit"/>
|
android:title="@string/Edit"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item android:id="@+id/AddList"
|
<item android:id="@+id/AddList"
|
||||||
android:title="@string/AddListButton" />
|
android:title="@string/AddListButton" />
|
||||||
<item android:id="@+id/Reminder"
|
<item android:id="@+id/Reminder"
|
||||||
android:title="@string/Reminder"/>
|
android:title="@string/Reminder"/>
|
||||||
<item android:id="@+id/ProductList"
|
<item android:id="@+id/ProductList"
|
||||||
android:title="@string/ProductList" />
|
android:title="@string/ProductList" />
|
||||||
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
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>
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#795548</color>
|
<color name="colorPrimary">#795548</color>
|
||||||
<color name="colorPrimaryDark">#5D4037</color>
|
<color name="colorPrimaryDark">#5D4037</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#FF4081</color>
|
||||||
<color name="NavBackground">#ffffff</color>
|
<color name="NavBackground">#ffffff</color>
|
||||||
<color name="Grey">#808080</color>
|
<color name="Grey">#808080</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,18 +1,29 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">ShopList</string>
|
<string name="app_name">ShopList</string>
|
||||||
<string name="AccountText">Użytkownik</string>
|
<string name="AccountText">Użytkownik</string>
|
||||||
<string name="EmailText">example@example.com</string>
|
<string name="EmailText">example@example.com</string>
|
||||||
<string name="ProductList">Twoje Listy</string>
|
<string name="ProductList">Twoje Listy</string>
|
||||||
<string name="AddButton">Dodaj</string>
|
<string name="AddButton">Dodaj</string>
|
||||||
<string name="AddListButton">Nowa lista</string>
|
<string name="AddListButton">Nowa lista</string>
|
||||||
<string name="Open">Open</string>
|
<string name="Open">Open</string>
|
||||||
<string name="Close">Close</string>
|
<string name="Close">Close</string>
|
||||||
<string name="Settings">Ustawienia</string>
|
<string name="Settings">Ustawienia</string>
|
||||||
<string name="Reminder">Ustaw przypomnienie</string>
|
<string name="Reminder">Ustaw przypomnienie</string>
|
||||||
<string name="Product_name">Brak</string>
|
<string name="Product_name">Brak</string>
|
||||||
<string name="Popup_info">Wprowadź nazwę listy</string>
|
<string name="Popup_info">Wprowadź nazwę listy</string>
|
||||||
<string name="Popup_btn">Potwierdź</string>
|
<string name="Popup_btn">Potwierdź</string>
|
||||||
<string name="Delete">Usuń</string>
|
<string name="Delete">Usuń</string>
|
||||||
<string name="Edit">Edytuj</string>
|
<string name="Edit">Edytuj</string>
|
||||||
<string name="AddProduct">Wprowadź nazwę produktu</string>
|
<string name="AddProduct">Wprowadź nazwę produktu</string>
|
||||||
</resources>
|
<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>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package michalpawlaczyk.shoplist;
|
package michalpawlaczyk.shoplist;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
*
|
*
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
*/
|
*/
|
||||||
public class ExampleUnitTest {
|
public class ExampleUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void addition_isCorrect() {
|
public void addition_isCorrect() {
|
||||||
assertEquals(4, 2 + 2);
|
assertEquals(4, 2 + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
54
build.gradle
54
build.gradle
@ -1,27 +1,27 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
# Project-wide Gradle settings.
|
# Project-wide Gradle settings.
|
||||||
# IDE (e.g. Android Studio) users:
|
# IDE (e.g. Android Studio) users:
|
||||||
# Gradle settings configured through the IDE *will override*
|
# Gradle settings configured through the IDE *will override*
|
||||||
# any settings specified in this file.
|
# any settings specified in this file.
|
||||||
# For more details on how to configure your build environment visit
|
# For more details on how to configure your build environment visit
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx1536m
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# 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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
|
|
||||||
|
168
gradlew.bat
vendored
168
gradlew.bat
vendored
@ -1,84 +1,84 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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=
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
:init
|
||||||
@rem Get command-line arguments, handling Windows variants
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
:win9xME_args
|
:win9xME_args
|
||||||
@rem Slurp the command line arguments.
|
@rem Slurp the command line arguments.
|
||||||
set CMD_LINE_ARGS=
|
set CMD_LINE_ARGS=
|
||||||
set _SKIP=2
|
set _SKIP=2
|
||||||
|
|
||||||
:win9xME_args_slurp
|
:win9xME_args_slurp
|
||||||
if "x%~1" == "x" goto execute
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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%
|
"%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
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
:omega
|
:omega
|
||||||
|
@ -1 +1 @@
|
|||||||
include ':app'
|
include ':app'
|
||||||
|
Loading…
Reference in New Issue
Block a user