diff --git a/app/build.gradle b/app/build.gradle index 6915964..2b8c9e1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,7 +25,10 @@ android { spotless { java { googleJavaFormat() + indentWithTabs(2) + indentWithSpaces(4) target '**/*.java' + trimTrailingWhitespace() removeUnusedImports() } } diff --git a/app/src/androidTest/java/org/amfoss/templeapp/ApplicationTest.java b/app/src/androidTest/java/org/amfoss/templeapp/ApplicationTest.java index 9d60524..8b2b11b 100644 --- a/app/src/androidTest/java/org/amfoss/templeapp/ApplicationTest.java +++ b/app/src/androidTest/java/org/amfoss/templeapp/ApplicationTest.java @@ -5,7 +5,7 @@ /** Testing Fundamentals */ public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } + public ApplicationTest() { + super(Application.class); + } } diff --git a/app/src/main/java/org/amfoss/templeapp/activities/DeleteData.java b/app/src/main/java/org/amfoss/templeapp/activities/DeleteData.java index 40f71c3..840d6a4 100644 --- a/app/src/main/java/org/amfoss/templeapp/activities/DeleteData.java +++ b/app/src/main/java/org/amfoss/templeapp/activities/DeleteData.java @@ -19,100 +19,96 @@ public class DeleteData extends AppCompatActivity { - String id; - String name; - RadioGroup radioGroup; - RelativeLayout totalLayout; - int flag; - private Button delete; - private EditText uid1ET; + String id; + RadioGroup radioGroup; + RelativeLayout totalLayout; + int flag; + private Button delete; + private EditText uid1ET; + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.delete_data); + delete = findViewById(R.id.delete_btn); + uid1ET = findViewById(R.id.uid); + + radioGroup = findViewById(R.id.radiogroup); + totalLayout = findViewById(R.id.total_View); + + radioGroup.setOnCheckedChangeListener( + new RadioGroup.OnCheckedChangeListener() { + public void onCheckedChanged(RadioGroup group, int checkedId) { + switch (checkedId) { + case R.id.radio_donate: + totalLayout.setVisibility(View.VISIBLE); + flag = 0; + Toast.makeText( + getBaseContext(), getString(R.string.delete_donated), Toast.LENGTH_LONG) + .show(); + break; + case R.id.radio_pooja: + totalLayout.setVisibility(View.VISIBLE); + flag = 1; + Toast.makeText( + getBaseContext(), getString(R.string.delete_pooja), Toast.LENGTH_LONG) + .show(); + break; + } + } + }); + + delete.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (flag == 1) { + id = getString(R.string.REG) + uid1ET.getText().toString(); + } else { + id = getString(R.string.DON) + uid1ET.getText().toString(); + } + new DeleteDataActivity().execute(); + } + }); + } - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.delete_data); - delete = (Button) findViewById(R.id.delete_btn); - uid1ET = (EditText) findViewById(R.id.uid); + class DeleteDataActivity extends AsyncTask { - radioGroup = (RadioGroup) findViewById(R.id.radiogroup); - totalLayout = (RelativeLayout) findViewById(R.id.total_View); + ProgressDialog dialog; + String result = null; - radioGroup.setOnCheckedChangeListener( - new RadioGroup.OnCheckedChangeListener() { - public void onCheckedChanged(RadioGroup group, int checkedId) { - switch (checkedId) { - case R.id.radio_donate: - totalLayout.setVisibility(View.VISIBLE); - flag = 0; - Toast.makeText( - getBaseContext(), getString(R.string.delete_donated), Toast.LENGTH_LONG) - .show(); - break; - case R.id.radio_pooja: - totalLayout.setVisibility(View.VISIBLE); - flag = 1; - Toast.makeText( - getBaseContext(), getString(R.string.delete_pooja), Toast.LENGTH_LONG) - .show(); - break; - } - } - }); + @Override + protected void onPreExecute() { + super.onPreExecute(); - delete.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { + dialog = new ProgressDialog(DeleteData.this); + dialog.setTitle(getString(R.string.wait)); + dialog.setMessage(getString(R.string.deleting)); + dialog.show(); + } - if (flag == 1) { - id = getString(R.string.REG) + uid1ET.getText().toString(); - } else { - id = getString(R.string.DON) + uid1ET.getText().toString(); + @Nullable + @Override + protected Void doInBackground(Void... params) { + Log.i(Controller.TAG, getString(R.string.id_value) + id); + JSONObject jsonObject = Controller.deleteData(id); + Log.i(Controller.TAG, getString(R.string.json_obj) + jsonObject); + + try { + /* Check Whether Its NULL??? */ + if (jsonObject != null) { + result = jsonObject.getString(getString(R.string.result)); + } + } catch (JSONException je) { + Log.i(Controller.TAG, "" + je.getLocalizedMessage()); } - - new DeleteDataActivity().execute(); - } - }); - } - - class DeleteDataActivity extends AsyncTask { - - ProgressDialog dialog; - String result = null; - - @Override - protected void onPreExecute() { - super.onPreExecute(); - - dialog = new ProgressDialog(DeleteData.this); - dialog.setTitle(getString(R.string.wait)); - dialog.setMessage(getString(R.string.deleting)); - dialog.show(); - } - - @Nullable - @Override - protected Void doInBackground(Void... params) { - Log.i(Controller.TAG, getString(R.string.id_value) + id); - JSONObject jsonObject = Controller.deleteData(id); - Log.i(Controller.TAG, getString(R.string.json_obj) + jsonObject); - - try { - /** Check Whether Its NULL??? */ - if (jsonObject != null) { - - result = jsonObject.getString(getString(R.string.result)); + return null; } - } catch (JSONException je) { - Log.i(Controller.TAG, "" + je.getLocalizedMessage()); - } - return null; - } - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - dialog.dismiss(); - Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + dialog.dismiss(); + Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); + } } - } } diff --git a/app/src/main/java/org/amfoss/templeapp/activities/InsertData.java b/app/src/main/java/org/amfoss/templeapp/activities/InsertData.java index c610fe8..1e535e5 100644 --- a/app/src/main/java/org/amfoss/templeapp/activities/InsertData.java +++ b/app/src/main/java/org/amfoss/templeapp/activities/InsertData.java @@ -21,147 +21,141 @@ public class InsertData extends AppCompatActivity { - String id, name, poojaTyp, overall, money, paidCheck = "NOT PAID"; - Spinner poojaType; - RadioGroup radioGroup; - LinearLayout totalLayout; - EditText moneyDonated; - int flag; - private Button insert; - private EditText uid1ET, nameET; - private CheckBox paid; - - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.insert_data); - insert = (Button) findViewById(R.id.insert_btn); - uid1ET = (EditText) findViewById(R.id.uid); - nameET = (EditText) findViewById(R.id.name); - paid = (CheckBox) findViewById(R.id.paid_check); - poojaType = (Spinner) findViewById(R.id.spinner1); - totalLayout = (LinearLayout) findViewById(R.id.total_View); - moneyDonated = (EditText) findViewById(R.id.money_donated); - - radioGroup = (RadioGroup) findViewById(R.id.radiogroup); - - radioGroup.setOnCheckedChangeListener( - new RadioGroup.OnCheckedChangeListener() { - public void onCheckedChanged(RadioGroup group, int checkedId) { - switch (checkedId) { - case R.id.radio_donate: - totalLayout.setVisibility(View.VISIBLE); - poojaType.setVisibility(View.GONE); - moneyDonated.setVisibility(View.VISIBLE); - id = getResources().getString(R.string.DON); - flag = 0; - Toast.makeText( - getBaseContext(), getString(R.string.selected_donate), Toast.LENGTH_LONG) - .show(); - break; - case R.id.radio_pooja: - totalLayout.setVisibility(View.VISIBLE); - moneyDonated.setVisibility(View.GONE); - poojaType.setVisibility(View.VISIBLE); - id = getString(R.string.REG); - flag = 1; - Toast.makeText( - getBaseContext(), getString(R.string.selected_register), Toast.LENGTH_LONG) - .show(); - break; - } - } - }); - - paid.setOnClickListener( - new View.OnClickListener() { - - @Override - public void onClick(View v) { - // is chkIos checked? - if (((CheckBox) v).isChecked()) { - paidCheck = getString(R.string.PAID); - - } else { - paidCheck = getString(R.string.NOT_PAID); - } - } - }); - - insert.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - id = id + uid1ET.getText().toString(); - name = nameET.getText().toString(); - if (id.length() == 3) { - uid1ET.setError(getString(R.string.valid_ID)); - } else { - if (flag == 1) { - poojaTyp = String.valueOf(poojaType.getSelectedItem()); - - overall = - poojaTyp - + getResources().getString(R.string.empty) - + name - + getResources().getString(R.string.empty) - + paidCheck; - new InsertDataActivity().execute(); - } else { - money = moneyDonated.getText().toString(); - overall = - money - + getResources().getString(R.string.empty) - + name - + getResources().getString(R.string.empty) - + paidCheck; - new InsertDataActivity().execute(); - } - } - } - }); - } - - class InsertDataActivity extends AsyncTask { - - ProgressDialog dialog; - int jIndex; - int x; + String id, name, poojaTyp, overall, money, paidCheck = "NOT PAID"; + Spinner poojaType; + RadioGroup radioGroup; + LinearLayout totalLayout; + EditText moneyDonated; + int flag; + private Button insert; + private EditText uid1ET, nameET; + private CheckBox paid; + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.insert_data); + insert = findViewById(R.id.insert_btn); + uid1ET = findViewById(R.id.uid); + nameET = findViewById(R.id.name); + paid = findViewById(R.id.paid_check); + poojaType = findViewById(R.id.spinner1); + totalLayout = findViewById(R.id.total_View); + moneyDonated = findViewById(R.id.money_donated); + radioGroup = findViewById(R.id.radiogroup); + + radioGroup.setOnCheckedChangeListener( + new RadioGroup.OnCheckedChangeListener() { + public void onCheckedChanged(RadioGroup group, int checkedId) { + switch (checkedId) { + case R.id.radio_donate: + totalLayout.setVisibility(View.VISIBLE); + poojaType.setVisibility(View.GONE); + moneyDonated.setVisibility(View.VISIBLE); + id = getResources().getString(R.string.DON); + flag = 0; + Toast.makeText( + getBaseContext(), getString(R.string.selected_donate), Toast.LENGTH_LONG) + .show(); + break; + case R.id.radio_pooja: + totalLayout.setVisibility(View.VISIBLE); + moneyDonated.setVisibility(View.GONE); + poojaType.setVisibility(View.VISIBLE); + id = getString(R.string.REG); + flag = 1; + Toast.makeText( + getBaseContext(), getString(R.string.selected_register), Toast.LENGTH_LONG) + .show(); + break; + } + } + }); + + paid.setOnClickListener( + new View.OnClickListener() { + + @Override + public void onClick(View v) { + // is chkIos checked? + if (((CheckBox) v).isChecked()) { + paidCheck = getString(R.string.PAID); + } else { + paidCheck = getString(R.string.NOT_PAID); + } + } + }); + + insert.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + id = id + uid1ET.getText().toString(); + name = nameET.getText().toString(); + if (id.length() == 3) { + uid1ET.setError(getString(R.string.valid_ID)); + } else { + if (flag == 1) { + poojaTyp = String.valueOf(poojaType.getSelectedItem()); + overall = + poojaTyp + + getResources().getString(R.string.empty) + + name + + getResources().getString(R.string.empty) + + paidCheck; + new InsertDataActivity().execute(); + } else { + money = moneyDonated.getText().toString(); + overall = + money + + getResources().getString(R.string.empty) + + name + + getResources().getString(R.string.empty) + + paidCheck; + new InsertDataActivity().execute(); + } + } + } + }); + } - String result = null; + class InsertDataActivity extends AsyncTask { - @Override - protected void onPreExecute() { - super.onPreExecute(); + ProgressDialog dialog; - dialog = new ProgressDialog(InsertData.this); - dialog.setTitle(getString(R.string.wait)); - dialog.setMessage(getString(R.string.insert)); - dialog.show(); - } + String result = null; - @Nullable - @Override - protected Void doInBackground(Void... params) { - JSONObject jsonObject = Controller.insertData(id, overall); - Log.i(Controller.TAG, getString(R.string.json_obj)); + @Override + protected void onPreExecute() { + super.onPreExecute(); - try { - /** Check Whether Its NULL??? */ - if (jsonObject != null) { + dialog = new ProgressDialog(InsertData.this); + dialog.setTitle(getString(R.string.wait)); + dialog.setMessage(getString(R.string.insert)); + dialog.show(); + } - result = jsonObject.getString(getString(R.string.result)); + @Nullable + @Override + protected Void doInBackground(Void... params) { + JSONObject jsonObject = Controller.insertData(id, overall); + Log.i(Controller.TAG, getString(R.string.json_obj)); + + try { + /* Check Whether Its NULL??? */ + if (jsonObject != null) { + result = jsonObject.getString(getString(R.string.result)); + } + } catch (JSONException je) { + Log.i(Controller.TAG, getString(R.string.exception) + je.getLocalizedMessage()); + } + return null; } - } catch (JSONException je) { - Log.i(Controller.TAG, getString(R.string.exception) + je.getLocalizedMessage()); - } - return null; - } - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - dialog.dismiss(); - Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + dialog.dismiss(); + Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); + } } - } } diff --git a/app/src/main/java/org/amfoss/templeapp/activities/MainActivity.java b/app/src/main/java/org/amfoss/templeapp/activities/MainActivity.java index 1926921..a4709cc 100644 --- a/app/src/main/java/org/amfoss/templeapp/activities/MainActivity.java +++ b/app/src/main/java/org/amfoss/templeapp/activities/MainActivity.java @@ -1,7 +1,5 @@ package org.amfoss.templeapp.activities; -// MainActivity.java - import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; @@ -15,129 +13,118 @@ public class MainActivity extends AppCompatActivity { - private Button read, readAll, insert, delete, update; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - read = (Button) findViewById(R.id.read_btn); - readAll = (Button) findViewById(R.id.read_all_btn); - insert = (Button) findViewById(R.id.insert_btn); - update = (Button) findViewById(R.id.update_btn); - delete = (Button) findViewById(R.id.delete_btn); - - readAll.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - if (InternetConnection.checkConnection(getApplicationContext())) { - Intent intent = new Intent(getApplicationContext(), ReadAllData.class); - startActivity(intent); - - } else { - createNetErrorDialog(); - // Toast.makeText(getApplicationContext(), "Check your internet connection", - // Toast.LENGTH_LONG).show(); - } - } - }); - - insert.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - if (InternetConnection.checkConnection(getApplicationContext())) { - Intent intent = new Intent(getApplicationContext(), InsertData.class); - startActivity(intent); - - } else { - createNetErrorDialog(); - // Toast.makeText(getApplicationContext(), "Check your internet connection", - // Toast.LENGTH_LONG).show(); - } - } - }); - - update.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - if (InternetConnection.checkConnection(getApplicationContext())) { - Intent intent = new Intent(getApplicationContext(), UpdateData.class); - startActivity(intent); - - } else { - createNetErrorDialog(); - // Toast.makeText(getApplicationContext(), "Check your internet connection", - // Toast.LENGTH_LONG).show(); - } - } - }); - - read.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - if (InternetConnection.checkConnection(getApplicationContext())) { - Intent intent = new Intent(getApplicationContext(), ReadSingleData.class); - startActivity(intent); - - } else { - - createNetErrorDialog(); - // Toast.makeText(getApplicationContext(), "Check your internet connection", - // Toast.LENGTH_LONG).show(); - } - } - }); - - delete.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - if (InternetConnection.checkConnection(getApplicationContext())) { - Intent intent = new Intent(getApplicationContext(), DeleteData.class); - startActivity(intent); - - } else { - createNetErrorDialog(); - // Toast.makeText(getApplicationContext(), "Check your internet connection", - // Toast.LENGTH_LONG).show(); - } - } - }); - } - - protected void createNetErrorDialog() { - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder - .setMessage(getString(R.string.internet_warn)) - .setTitle(getString(R.string.unable_to_connect)) - .setCancelable(false) - .setPositiveButton( - getString(R.string.settings), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - Intent i = new Intent(Settings.ACTION_WIRELESS_SETTINGS); - startActivity(i); - } - }) - .setNegativeButton( - getString(R.string.Cancel), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - finish(); - } - }); - AlertDialog alert = builder.create(); - alert.show(); - } + private Button read, readAll, insert, delete, update; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + read = findViewById(R.id.read_btn); + readAll = findViewById(R.id.read_all_btn); + insert = findViewById(R.id.insert_btn); + update = findViewById(R.id.update_btn); + delete = findViewById(R.id.delete_btn); + + readAll.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (InternetConnection.checkConnection(getApplicationContext())) { + Intent intent = new Intent(getApplicationContext(), ReadAllData.class); + startActivity(intent); + } else { + createNetErrorDialog(); + // Toast.makeText(getApplicationContext(), "Check your internet connection", + // Toast.LENGTH_LONG).show(); + } + } + }); + + insert.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (InternetConnection.checkConnection(getApplicationContext())) { + Intent intent = new Intent(getApplicationContext(), InsertData.class); + startActivity(intent); + } else { + createNetErrorDialog(); + // Toast.makeText(getApplicationContext(), "Check your internet connection", + // Toast.LENGTH_LONG).show(); + } + } + }); + + update.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (InternetConnection.checkConnection(getApplicationContext())) { + Intent intent = new Intent(getApplicationContext(), UpdateData.class); + startActivity(intent); + } else { + createNetErrorDialog(); + // Toast.makeText(getApplicationContext(), "Check your internet connection", + // Toast.LENGTH_LONG).show(); + } + } + }); + + read.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (InternetConnection.checkConnection(getApplicationContext())) { + Intent intent = new Intent(getApplicationContext(), ReadSingleData.class); + startActivity(intent); + } else { + createNetErrorDialog(); + // Toast.makeText(getApplicationContext(), "Check your internet connection", + // Toast.LENGTH_LONG).show(); + } + } + }); + + delete.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (InternetConnection.checkConnection(getApplicationContext())) { + Intent intent = new Intent(getApplicationContext(), DeleteData.class); + startActivity(intent); + } else { + createNetErrorDialog(); + // Toast.makeText(getApplicationContext(), "Check your internet connection", + // Toast.LENGTH_LONG).show(); + } + } + }); + } + + protected void createNetErrorDialog() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder + .setMessage(getString(R.string.internet_warn)) + .setTitle(getString(R.string.unable_to_connect)) + .setCancelable(false) + .setPositiveButton( + getString(R.string.settings), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + Intent i = new Intent(Settings.ACTION_WIRELESS_SETTINGS); + startActivity(i); + } + }) + .setNegativeButton( + getString(R.string.Cancel), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + finish(); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } } diff --git a/app/src/main/java/org/amfoss/templeapp/activities/ReadAllData.java b/app/src/main/java/org/amfoss/templeapp/activities/ReadAllData.java index a2de362..6b6ea43 100644 --- a/app/src/main/java/org/amfoss/templeapp/activities/ReadAllData.java +++ b/app/src/main/java/org/amfoss/templeapp/activities/ReadAllData.java @@ -25,236 +25,231 @@ public class ReadAllData extends AppCompatActivity { - LinearLayout totalLayout; - LinearLayout radioButtonView; - private int flag; - private ListView listView; - private ArrayList list; - private MyArrayAdapter adapter; - private Button readAll; - private TextView heading; - private CheckBox donatePaid; - private CheckBox donateNotPaid; - private CheckBox poojaPaid; - private CheckBox poojaNotPaid; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.read_all); - - readAll = findViewById(R.id.readAll_btn1); - list = new ArrayList<>(); - adapter = new MyArrayAdapter(this, list); - listView = findViewById(R.id.listView); - listView.setAdapter(adapter); - heading = findViewById(R.id.heading); - radioButtonView = findViewById(R.id.radiogroup_view); - - totalLayout = findViewById(R.id.total_View); - donatePaid = findViewById(R.id.donate_paid); - donateNotPaid = findViewById(R.id.donate_not_paid); - poojaPaid = findViewById(R.id.pooja_paid); - poojaNotPaid = findViewById(R.id.pooja_not_paid); - - readAll.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - if (donatePaid.isChecked() && donateNotPaid.isChecked()) { - flag = 5; - } - - if (poojaPaid.isChecked() && poojaNotPaid.isChecked()) { - flag = 6; - } - - if (!(poojaPaid.isChecked() - || poojaNotPaid.isChecked() - || donatePaid.isChecked() - || donateNotPaid.isChecked())) { - - Toast.makeText( - getApplicationContext(), - getString(R.string.error_notSelected), - Toast.LENGTH_LONG) - .show(); - - } else { - new ReadData1().execute(); - radioButtonView.setVisibility(View.GONE); - readAll.setVisibility(View.GONE); - } - } - }); - - donatePaid.setOnCheckedChangeListener( - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - - totalLayout.setVisibility(View.VISIBLE); - flag = 1; - heading.setText(getString(R.string.list_of_donated_people_who_paid_only)); - poojaPaid.setChecked(false); - poojaNotPaid.setChecked(false); - } - }); - - donateNotPaid.setOnCheckedChangeListener( - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - totalLayout.setVisibility(View.VISIBLE); - flag = 2; - heading.setText(getString(R.string.list_of_donated_people_who_not_paid_only)); - poojaPaid.setChecked(false); - poojaNotPaid.setChecked(false); - } - }); - - poojaPaid.setOnCheckedChangeListener( - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - totalLayout.setVisibility(View.VISIBLE); - flag = 3; - heading.setText(getString(R.string.list_of_registered_poojas_people_who_paid_only)); - donatePaid.setChecked(false); - donateNotPaid.setChecked(false); - } - }); - - poojaNotPaid.setOnCheckedChangeListener( - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - totalLayout.setVisibility(View.VISIBLE); - flag = 4; - heading.setText(getString(R.string.list_of_registered_poojas_who_not_paid_only)); - donatePaid.setChecked(false); - donateNotPaid.setChecked(false); - } - }); - } - - class ReadData1 extends AsyncTask { - - ProgressDialog dialog; - int jIndex; - int x; + LinearLayout totalLayout; + LinearLayout radioButtonView; + private int flag; + private ListView listView; + private ArrayList list; + private MyArrayAdapter adapter; + private Button readAll; + private TextView heading; + private CheckBox donatePaid; + private CheckBox donateNotPaid; + private CheckBox poojaPaid; + private CheckBox poojaNotPaid; @Override - protected void onPreExecute() { - super.onPreExecute(); - /** Progress Dialog for User Interaction */ - x = list.size(); - - if (x == 0) jIndex = 0; - else jIndex = x; - - dialog = new ProgressDialog(ReadAllData.this); - dialog.setTitle(getString(R.string.wait)); - dialog.setMessage(getString(R.string.fetch)); - dialog.show(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.read_all); + + readAll = findViewById(R.id.readAll_btn1); + list = new ArrayList<>(); + adapter = new MyArrayAdapter(this, list); + listView = findViewById(R.id.listView); + listView.setAdapter(adapter); + heading = findViewById(R.id.heading); + radioButtonView = findViewById(R.id.radiogroup_view); + + totalLayout = findViewById(R.id.total_View); + donatePaid = findViewById(R.id.donate_paid); + donateNotPaid = findViewById(R.id.donate_not_paid); + poojaPaid = findViewById(R.id.pooja_paid); + poojaNotPaid = findViewById(R.id.pooja_not_paid); + + readAll.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (donatePaid.isChecked() && donateNotPaid.isChecked()) { + flag = 5; + } + + if (poojaPaid.isChecked() && poojaNotPaid.isChecked()) { + flag = 6; + } + + if (!(poojaPaid.isChecked() + || poojaNotPaid.isChecked() + || donatePaid.isChecked() + || donateNotPaid.isChecked())) { + Toast.makeText( + getApplicationContext(), + getString(R.string.error_notSelected), + Toast.LENGTH_LONG) + .show(); + } else { + new ReadData1().execute(); + radioButtonView.setVisibility(View.GONE); + readAll.setVisibility(View.GONE); + } + } + }); + + donatePaid.setOnCheckedChangeListener( + new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + totalLayout.setVisibility(View.VISIBLE); + flag = 1; + heading.setText(getString(R.string.list_of_donated_people_who_paid_only)); + poojaPaid.setChecked(false); + poojaNotPaid.setChecked(false); + } + }); + + donateNotPaid.setOnCheckedChangeListener( + new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + totalLayout.setVisibility(View.VISIBLE); + flag = 2; + heading.setText(getString(R.string.list_of_donated_people_who_not_paid_only)); + poojaPaid.setChecked(false); + poojaNotPaid.setChecked(false); + } + }); + + poojaPaid.setOnCheckedChangeListener( + new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + totalLayout.setVisibility(View.VISIBLE); + flag = 3; + heading.setText(getString(R.string.list_of_registered_poojas_people_who_paid_only)); + donatePaid.setChecked(false); + donateNotPaid.setChecked(false); + } + }); + + poojaNotPaid.setOnCheckedChangeListener( + new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + totalLayout.setVisibility(View.VISIBLE); + flag = 4; + heading.setText(getString(R.string.list_of_registered_poojas_who_not_paid_only)); + donatePaid.setChecked(false); + donateNotPaid.setChecked(false); + } + }); } - @Nullable - @Override - protected Void doInBackground(Void... params) { - JSONObject jsonObject = Controller.readAllData(); - try { - /* Check Whether Its NULL??? */ - if (jsonObject != null) { - /* Check Length... */ - if (jsonObject.length() > 0) { - /* Getting Array named "contacts" From MAIN Json Object */ - JSONArray array = jsonObject.getJSONArray(getString(R.string.records)); - - /* Check Length of Array... */ - int lenArray = array.length(); - if (lenArray > 0) { - for (; jIndex < lenArray; jIndex++) { - - /* Creating Every time New Object and Adding into List */ - MyDataModel model = new MyDataModel(); + class ReadData1 extends AsyncTask { - JSONObject innerObject = array.getJSONObject(jIndex); + ProgressDialog dialog; + int jIndex; + int x; - String id = innerObject.getString(getString(R.string.ID_)); - String name = innerObject.getString(getString(R.string.name_)); + @Override + protected void onPreExecute() { + super.onPreExecute(); + /** Progress Dialog for User Interaction */ + x = list.size(); - String[] str = name.split(getResources().getString(R.string.empty)); + if (x == 0) jIndex = 0; + else jIndex = x; - if (flag == 1) { - if (id.substring(0, 3).equals(getString(R.string.DON)) - && str[2].equals(getString(R.string.PAID))) { - model.setName(name); - - model.setCountry(id.substring(3, id.length())); - list.add(model); - } - } else if (flag == 2) { - if (id.substring(0, 3).equals(getString(R.string.DON)) - && str[2].equals(getString(R.string.NOT_PAID))) { - model.setName(name); - model.setCountry(id.substring(3, id.length())); - list.add(model); - } - } else if (flag == 3) { - if (id.substring(0, 3).equals(getString(R.string.REG)) - && str[2].equals(getString(R.string.PAID))) { - model.setName(name); - model.setCountry(id.substring(3, id.length())); - list.add(model); - } - } else if (flag == 4) { - if (id.substring(0, 3).equals(getString(R.string.REG)) - && str[2].equals(getString(R.string.NOT_PAID))) { - model.setName(name); - model.setCountry(id.substring(3, id.length())); - list.add(model); - } - } else if (flag == 5) { - if (id.substring(0, 3).equals(getString(R.string.DON))) { - model.setName(name); - model.setCountry(id.substring(3, id.length())); - list.add(model); - } + dialog = new ProgressDialog(ReadAllData.this); + dialog.setTitle(getString(R.string.wait)); + dialog.setMessage(getString(R.string.fetch)); + dialog.show(); + } - } else if (flag == 6) { - if (id.substring(0, 3).equals(getString(R.string.REG))) { - model.setName(name); - model.setCountry(id.substring(3, id.length())); - list.add(model); - } + @Nullable + @Override + protected Void doInBackground(Void... params) { + JSONObject jsonObject = Controller.readAllData(); + try { + /* Check Whether Its NULL??? */ + if (jsonObject != null) { + /* Check Length... */ + if (jsonObject.length() > 0) { + /* Getting Array named "contacts" From MAIN Json Object */ + JSONArray array = jsonObject.getJSONArray(getString(R.string.records)); + + /* Check Length of Array... */ + int lenArray = array.length(); + if (lenArray > 0) { + for (; jIndex < lenArray; jIndex++) { + + /* Creating Every time New Object and Adding into List */ + MyDataModel model = new MyDataModel(); + + JSONObject innerObject = array.getJSONObject(jIndex); + + String id = innerObject.getString(getString(R.string.ID_)); + String name = innerObject.getString(getString(R.string.name_)); + + String[] str = name.split(getResources().getString(R.string.empty)); + + if (flag == 1) { + if (id.substring(0, 3).equals(getString(R.string.DON)) + && str[2].equals(getString(R.string.PAID))) { + model.setName(name); + + model.setCountry(id.substring(3, id.length())); + list.add(model); + } + } else if (flag == 2) { + if (id.substring(0, 3).equals(getString(R.string.DON)) + && str[2].equals(getString(R.string.NOT_PAID))) { + model.setName(name); + model.setCountry(id.substring(3, id.length())); + list.add(model); + } + } else if (flag == 3) { + if (id.substring(0, 3).equals(getString(R.string.REG)) + && str[2].equals(getString(R.string.PAID))) { + model.setName(name); + model.setCountry(id.substring(3, id.length())); + list.add(model); + } + } else if (flag == 4) { + if (id.substring(0, 3).equals(getString(R.string.REG)) + && str[2].equals(getString(R.string.NOT_PAID))) { + model.setName(name); + model.setCountry(id.substring(3, id.length())); + list.add(model); + } + } else if (flag == 5) { + if (id.substring(0, 3).equals(getString(R.string.DON))) { + model.setName(name); + model.setCountry(id.substring(3, id.length())); + list.add(model); + } + + } else if (flag == 6) { + if (id.substring(0, 3).equals(getString(R.string.REG))) { + model.setName(name); + model.setCountry(id.substring(3, id.length())); + list.add(model); + } + } + } + } + } } - } + } catch (JSONException je) { + Log.i(Controller.TAG, "" + je.getLocalizedMessage()); } - } - } else { - + return null; } - } catch (JSONException je) { - Log.i(Controller.TAG, "" + je.getLocalizedMessage()); - } - return null; - } - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - dialog.dismiss(); - /* Checking if List size if more than zero then Update ListView */ - if (list.size() > 0) { - adapter.notifyDataSetChanged(); - heading.setVisibility(TextView.VISIBLE); + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + dialog.dismiss(); + /* Checking if List size if more than zero then Update ListView */ + if (list.size() > 0) { + adapter.notifyDataSetChanged(); + heading.setVisibility(TextView.VISIBLE); - } else { - Toast.makeText(getApplicationContext(), getString(R.string.no_data), Toast.LENGTH_LONG) - .show(); - heading.setVisibility(TextView.INVISIBLE); - } + } else { + Toast.makeText(getApplicationContext(), getString(R.string.no_data), Toast.LENGTH_LONG) + .show(); + heading.setVisibility(TextView.INVISIBLE); + } + } } - } } diff --git a/app/src/main/java/org/amfoss/templeapp/activities/ReadSingleData.java b/app/src/main/java/org/amfoss/templeapp/activities/ReadSingleData.java index d53f180..9f1f816 100644 --- a/app/src/main/java/org/amfoss/templeapp/activities/ReadSingleData.java +++ b/app/src/main/java/org/amfoss/templeapp/activities/ReadSingleData.java @@ -22,147 +22,144 @@ public class ReadSingleData extends AppCompatActivity { - String id; - String name; - View view; - RadioGroup radioGroup; - int flag; - RelativeLayout totalLayout; - private Button read; - private EditText uid1ET; - private TextView id_l, name_l, id_v, name_v, paid_l, paid_v, pooja_l, pooja_v; - - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.read_data); - read = (Button) findViewById(R.id.insert_btn); - uid1ET = (EditText) findViewById(R.id.uid); - - id_l = (TextView) findViewById(R.id.id_l); - name_l = (TextView) findViewById(R.id.name_l); - id_v = (TextView) findViewById(R.id.id_v); - name_v = (TextView) findViewById(R.id.name_v); - pooja_l = (TextView) findViewById(R.id.pooja_l); - pooja_v = (TextView) findViewById(R.id.pooja_v); - paid_l = (TextView) findViewById(R.id.paid_l); - paid_v = (TextView) findViewById(R.id.paid_v); - - view = this.getCurrentFocus(); - - radioGroup = (RadioGroup) findViewById(R.id.radiogroup); - totalLayout = (RelativeLayout) findViewById(R.id.total_View); - - radioGroup.setOnCheckedChangeListener( - new RadioGroup.OnCheckedChangeListener() { - public void onCheckedChanged(RadioGroup group, int checkedId) { - switch (checkedId) { - case R.id.radio_donate: - totalLayout.setVisibility(View.VISIBLE); - flag = 0; - Toast.makeText( - getBaseContext(), getString(R.string.selected_donate), Toast.LENGTH_LONG) - .show(); - break; - case R.id.radio_pooja: - totalLayout.setVisibility(View.VISIBLE); - flag = 1; - Toast.makeText( - getBaseContext(), getString(R.string.selected_register), Toast.LENGTH_LONG) - .show(); - break; - } - } - }); - - read.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - if (flag == 1) { - id = getString(R.string.REG) + uid1ET.getText().toString(); - } else { - id = getString(R.string.DON) + uid1ET.getText().toString(); - } - - new ReadDataActivity().execute(); - } - }); - } - - class ReadDataActivity extends AsyncTask { + String id; + String name; + View view; + RadioGroup radioGroup; + int flag; + RelativeLayout totalLayout; + private Button read; + private EditText uid1ET; + private TextView id_l, name_l, id_v, name_v, paid_l, paid_v, pooja_l, pooja_v; + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.read_data); + read = findViewById(R.id.insert_btn); + uid1ET = findViewById(R.id.uid); + + id_l = findViewById(R.id.id_l); + name_l = findViewById(R.id.name_l); + id_v = findViewById(R.id.id_v); + name_v = findViewById(R.id.name_v); + pooja_l = findViewById(R.id.pooja_l); + pooja_v = findViewById(R.id.pooja_v); + paid_l = findViewById(R.id.paid_l); + paid_v = findViewById(R.id.paid_v); + + view = this.getCurrentFocus(); + + radioGroup = findViewById(R.id.radiogroup); + totalLayout = findViewById(R.id.total_View); + + radioGroup.setOnCheckedChangeListener( + new RadioGroup.OnCheckedChangeListener() { + public void onCheckedChanged(RadioGroup group, int checkedId) { + switch (checkedId) { + case R.id.radio_donate: + totalLayout.setVisibility(View.VISIBLE); + flag = 0; + Toast.makeText( + getBaseContext(), getString(R.string.selected_donate), Toast.LENGTH_LONG) + .show(); + break; + case R.id.radio_pooja: + totalLayout.setVisibility(View.VISIBLE); + flag = 1; + Toast.makeText( + getBaseContext(), getString(R.string.selected_register), Toast.LENGTH_LONG) + .show(); + break; + } + } + }); + + read.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + if (flag == 1) { + id = getString(R.string.REG) + uid1ET.getText().toString(); + } else { + id = getString(R.string.DON) + uid1ET.getText().toString(); + } + new ReadDataActivity().execute(); + } + }); + } - ProgressDialog dialog; + class ReadDataActivity extends AsyncTask { - @Override - protected void onPreExecute() { - super.onPreExecute(); + ProgressDialog dialog; - dialog = new ProgressDialog(ReadSingleData.this); - dialog.setTitle(getString(R.string.wait)); - dialog.setMessage(getString(R.string.fetch)); - dialog.show(); - } + @Override + protected void onPreExecute() { + super.onPreExecute(); - @Nullable - @Override - protected Void doInBackground(Void... params) { - Log.i(Controller.TAG, getString(R.string.ID_value) + id); - JSONObject jsonObject = Controller.readData(id); - Log.i(Controller.TAG, getString(R.string.json_obj) + jsonObject); - - try { - /* - Check Whether Its NULL??? - */ - if (jsonObject != null) { - - JSONObject user = jsonObject.getJSONObject(getString(R.string.user)); - name = user.getString(getString(R.string.name_)); + dialog = new ProgressDialog(ReadSingleData.this); + dialog.setTitle(getString(R.string.wait)); + dialog.setMessage(getString(R.string.fetch)); + dialog.show(); } - } catch (JSONException je) { - Log.i(Controller.TAG, "" + je.getLocalizedMessage()); - } - return null; - } - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - dialog.dismiss(); - - if (view != null) { - InputMethodManager imm = - (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(view.getWindowToken(), 0); - } - - if (name != null) { - id_l.setText(getString(R.string.ID)); - name_l.setText(getString(R.string.name)); - int flag = 0; - if (id.substring(0, 3).equals(getString(R.string.DON))) { - id_v.setText(id.substring(3, id.length())); - flag = 1; - } else if (id.substring(0, 3).equals(getString(R.string.REG))) { - id_v.setText(id.substring(3, id.length())); - flag = 0; + @Nullable + @Override + protected Void doInBackground(Void... params) { + Log.i(Controller.TAG, getString(R.string.ID_value) + id); + JSONObject jsonObject = Controller.readData(id); + Log.i(Controller.TAG, getString(R.string.json_obj) + jsonObject); + + try { + /* + Check Whether Its NULL??? + */ + if (jsonObject != null) { + JSONObject user = jsonObject.getJSONObject(getString(R.string.user)); + name = user.getString(getString(R.string.name_)); + } + } catch (JSONException je) { + Log.i(Controller.TAG, "" + je.getLocalizedMessage()); + } + return null; } - String[] str = name.split(getString(R.string.empty)); - name_v.setText(str[1]); - pooja_l.setText(str[0]); - paid_v.setText(str[2]); - if (flag == 0) { - pooja_v.setText(getString(R.string.type_of_pooja)); - } else { - pooja_v.setText(getString(R.string.money_donated)); - } - paid_l.setText(getString(R.string.paid_status)); + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + dialog.dismiss(); - } else - Toast.makeText(getApplicationContext(), getString(R.string.id_not_found), Toast.LENGTH_LONG) - .show(); + if (view != null) { + InputMethodManager imm = + (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + + if (name != null) { + id_l.setText(getString(R.string.ID)); + name_l.setText(getString(R.string.name)); + int flag = 0; + if (id.substring(0, 3).equals(getString(R.string.DON))) { + id_v.setText(id.substring(3, id.length())); + flag = 1; + } else if (id.substring(0, 3).equals(getString(R.string.REG))) { + id_v.setText(id.substring(3, id.length())); + flag = 0; + } + + String[] str = name.split(getString(R.string.empty)); + name_v.setText(str[1]); + pooja_l.setText(str[0]); + paid_v.setText(str[2]); + if (flag == 0) { + pooja_v.setText(getString(R.string.type_of_pooja)); + } else { + pooja_v.setText(getString(R.string.money_donated)); + } + paid_l.setText(getString(R.string.paid_status)); + + } else + Toast.makeText(getApplicationContext(), getString(R.string.id_not_found), Toast.LENGTH_LONG) + .show(); + } } - } } diff --git a/app/src/main/java/org/amfoss/templeapp/activities/UpdateData.java b/app/src/main/java/org/amfoss/templeapp/activities/UpdateData.java index c1cdd7a..5330500 100644 --- a/app/src/main/java/org/amfoss/templeapp/activities/UpdateData.java +++ b/app/src/main/java/org/amfoss/templeapp/activities/UpdateData.java @@ -21,145 +21,140 @@ public class UpdateData extends AppCompatActivity { - String id; - String name; - RadioGroup radioGroup; - LinearLayout totalLayout; - int flag; - Spinner poojaType; - CheckBox paid; - EditText moneyDonated; - String paidCheck, poojaTyp, overall, money; - private Button update; - private EditText uid1ET, uid2, nameET; - - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.update_data); - update = (Button) findViewById(R.id.update_btn1); - uid1ET = (EditText) findViewById(R.id.uid); - nameET = (EditText) findViewById(R.id.name); - - paid = (CheckBox) findViewById(R.id.paid_check); - poojaType = (Spinner) findViewById(R.id.spinner1); - totalLayout = (LinearLayout) findViewById(R.id.total_View); - moneyDonated = (EditText) findViewById(R.id.money_donated); - - radioGroup = (RadioGroup) findViewById(R.id.radiogroup); - totalLayout = (LinearLayout) findViewById(R.id.total_View); - - radioGroup.setOnCheckedChangeListener( - new RadioGroup.OnCheckedChangeListener() { - public void onCheckedChanged(RadioGroup group, int checkedId) { - switch (checkedId) { - case R.id.radio_donate: - totalLayout.setVisibility(View.VISIBLE); - poojaType.setVisibility(View.GONE); - moneyDonated.setVisibility(View.VISIBLE); - id = getString(R.string.DON); - flag = 0; - Toast.makeText(getBaseContext(), getString(R.string.UPDATE), Toast.LENGTH_LONG) - .show(); - break; - case R.id.radio_pooja: - totalLayout.setVisibility(View.VISIBLE); - moneyDonated.setVisibility(View.GONE); - poojaType.setVisibility(View.VISIBLE); - id = getString(R.string.REG); - flag = 1; - Toast.makeText( - getBaseContext(), getString(R.string.update_pooja), Toast.LENGTH_LONG) - .show(); - break; - } - } - }); - - paid.setOnClickListener( - new View.OnClickListener() { - - @Override - public void onClick(View v) { - // is chkIos checked? - if (((CheckBox) v).isChecked()) { - paidCheck = getString(R.string.PAID); - - } else { - paidCheck = getString(R.string.NOT_PAID); - } - } - }); - - update.setOnClickListener( - new View.OnClickListener() { - @Override - public void onClick(View view) { - - id = id + uid1ET.getText().toString(); - name = nameET.getText().toString(); - - if (flag == 1) { - poojaTyp = String.valueOf(poojaType.getSelectedItem()); - - overall = - poojaTyp - + getResources().getString(R.string.empty) - + name - + getResources().getString(R.string.empty) - + paidCheck; - } else { - money = moneyDonated.getText().toString(); - overall = - money - + getResources().getString(R.string.empty) - + name - + getResources().getString(R.string.empty) - + paidCheck; - } - new UpdateDataActivity().execute(); - } - }); - } - - class UpdateDataActivity extends AsyncTask { - - ProgressDialog dialog; + String id; + String name; + RadioGroup radioGroup; + LinearLayout totalLayout; + int flag; + Spinner poojaType; + CheckBox paid; + EditText moneyDonated; + String paidCheck, poojaTyp, overall, money; + private Button update; + private EditText uid1ET, nameET; + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.update_data); + update = findViewById(R.id.update_btn1); + uid1ET = findViewById(R.id.uid); + nameET = findViewById(R.id.name); + paid = findViewById(R.id.paid_check); + poojaType = findViewById(R.id.spinner1); + totalLayout = findViewById(R.id.total_View); + moneyDonated = findViewById(R.id.money_donated); + + radioGroup = findViewById(R.id.radiogroup); + totalLayout = findViewById(R.id.total_View); + + radioGroup.setOnCheckedChangeListener( + new RadioGroup.OnCheckedChangeListener() { + public void onCheckedChanged(RadioGroup group, int checkedId) { + switch (checkedId) { + case R.id.radio_donate: + totalLayout.setVisibility(View.VISIBLE); + poojaType.setVisibility(View.GONE); + moneyDonated.setVisibility(View.VISIBLE); + id = getString(R.string.DON); + flag = 0; + Toast.makeText(getBaseContext(), getString(R.string.UPDATE), Toast.LENGTH_LONG) + .show(); + break; + case R.id.radio_pooja: + totalLayout.setVisibility(View.VISIBLE); + moneyDonated.setVisibility(View.GONE); + poojaType.setVisibility(View.VISIBLE); + id = getString(R.string.REG); + flag = 1; + Toast.makeText( + getBaseContext(), getString(R.string.update_pooja), Toast.LENGTH_LONG) + .show(); + break; + } + } + }); + + paid.setOnClickListener( + new View.OnClickListener() { + + @Override + public void onClick(View v) { + // is chkIos checked? + if (((CheckBox) v).isChecked()) { + paidCheck = getString(R.string.PAID); + } else { + paidCheck = getString(R.string.NOT_PAID); + } + } + }); + + update.setOnClickListener( + new View.OnClickListener() { + @Override + public void onClick(View view) { + id = id + uid1ET.getText().toString(); + name = nameET.getText().toString(); + if (flag == 1) { + poojaTyp = String.valueOf(poojaType.getSelectedItem()); + + overall = + poojaTyp + + getResources().getString(R.string.empty) + + name + + getResources().getString(R.string.empty) + + paidCheck; + } else { + money = moneyDonated.getText().toString(); + overall = + money + + getResources().getString(R.string.empty) + + name + + getResources().getString(R.string.empty) + + paidCheck; + } + new UpdateDataActivity().execute(); + } + }); + } - String result = null; + class UpdateDataActivity extends AsyncTask { - @Override - protected void onPreExecute() { - super.onPreExecute(); + ProgressDialog dialog; - dialog = new ProgressDialog(UpdateData.this); - dialog.setTitle(getString(R.string.wait)); - dialog.setMessage(getString(R.string.JSON)); - dialog.show(); - } + String result = null; - @Nullable - @Override - protected Void doInBackground(Void... params) { - JSONObject jsonObject = Controller.updateData(id, overall); - Log.i(Controller.TAG, getString(R.string.json_obj)); + @Override + protected void onPreExecute() { + super.onPreExecute(); - try { - /** Check Whether Its NULL??? */ - if (jsonObject != null) { + dialog = new ProgressDialog(UpdateData.this); + dialog.setTitle(getString(R.string.wait)); + dialog.setMessage(getString(R.string.JSON)); + dialog.show(); + } - result = jsonObject.getString(getString(R.string.result)); + @Nullable + @Override + protected Void doInBackground(Void... params) { + JSONObject jsonObject = Controller.updateData(id, overall); + Log.i(Controller.TAG, getString(R.string.json_obj)); + + try { + /* Check Whether Its NULL??? */ + if (jsonObject != null) { + result = jsonObject.getString(getString(R.string.result)); + } + } catch (JSONException je) { + Log.i(Controller.TAG, "" + je.getLocalizedMessage()); + } + return null; } - } catch (JSONException je) { - Log.i(Controller.TAG, "" + je.getLocalizedMessage()); - } - return null; - } - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - dialog.dismiss(); - Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + dialog.dismiss(); + Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); + } } - } } diff --git a/app/src/main/java/org/amfoss/templeapp/adapter/MyArrayAdapter.java b/app/src/main/java/org/amfoss/templeapp/adapter/MyArrayAdapter.java index ea25789..f00c3f0 100644 --- a/app/src/main/java/org/amfoss/templeapp/adapter/MyArrayAdapter.java +++ b/app/src/main/java/org/amfoss/templeapp/adapter/MyArrayAdapter.java @@ -14,75 +14,73 @@ public class MyArrayAdapter extends ArrayAdapter { - List modelList; - Context context; - private LayoutInflater mInflater; + List modelList; + Context context; + private LayoutInflater mInflater; - // Constructors - public MyArrayAdapter(Context context, List objects) { - super(context, 0, objects); - this.context = context; - this.mInflater = LayoutInflater.from(context); - modelList = objects; - } - - @Override - public MyDataModel getItem(int position) { - return modelList.get(position); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - final ViewHolder vh; - if (convertView == null) { - View view = mInflater.inflate(R.layout.layout_row_view, parent, false); - vh = ViewHolder.create((RelativeLayout) view); - view.setTag(vh); - } else { - vh = (ViewHolder) convertView.getTag(); + public MyArrayAdapter(Context context, List objects) { + super(context, 0, objects); + this.context = context; + this.mInflater = LayoutInflater.from(context); + modelList = objects; } - MyDataModel item = getItem(position); - String[] str = item.getName().split(" "); - String lastWord = str[0].substring(str[0].lastIndexOf(" ") + 1); + @Override + public MyDataModel getItem(int position) { + return modelList.get(position); + } - vh.textViewName.setText(str[1] + " " + str[2]); - vh.type.setText(lastWord); - vh.textViewId.setText(item.getId()); + @Override + public View getView(int position, View convertView, ViewGroup parent) { + final ViewHolder vh; + if (convertView == null) { + View view = mInflater.inflate(R.layout.layout_row_view, parent, false); + vh = ViewHolder.create((RelativeLayout) view); + view.setTag(vh); + } else { + vh = (ViewHolder) convertView.getTag(); + } + MyDataModel item = getItem(position); - Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.listview_animator); - vh.rootView.startAnimation(animation); + String[] str = item.getName().split(" "); + String lastWord = str[0].substring(str[0].lastIndexOf(" ") + 1); - return vh.rootView; - } + vh.textViewName.setText(str[1] + " " + str[2]); + vh.type.setText(lastWord); + vh.textViewId.setText(item.getId()); - private static class ViewHolder { - public final RelativeLayout rootView; - public final TextView textViewId; - public final TextView textViewName; - public final TextView type; - public final RelativeLayout relativeLayout; + Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.listview_animator); + vh.rootView.startAnimation(animation); - private ViewHolder( - RelativeLayout rootView, - TextView textViewName, - TextView textViewId, - TextView type, - RelativeLayout relativeLayout) { - this.rootView = rootView; - this.textViewId = textViewId; - this.textViewName = textViewName; - this.type = type; - this.relativeLayout = relativeLayout; + return vh.rootView; } - public static ViewHolder create(RelativeLayout rootView) { - TextView textViewId = rootView.findViewById(R.id.textViewId); - TextView textViewName = rootView.findViewById(R.id.textViewName); - TextView type = rootView.findViewById(R.id.imageText); - RelativeLayout relativeLayout = rootView.findViewById(R.id.relativelayout); + private static class ViewHolder { + public final RelativeLayout rootView; + public final TextView textViewId; + public final TextView textViewName; + public final TextView type; + public final RelativeLayout relativeLayout; + + private ViewHolder( + RelativeLayout rootView, + TextView textViewName, + TextView textViewId, + TextView type, + RelativeLayout relativeLayout) { + this.rootView = rootView; + this.textViewId = textViewId; + this.textViewName = textViewName; + this.type = type; + this.relativeLayout = relativeLayout; + } - return new ViewHolder(rootView, textViewName, textViewId, type, relativeLayout); + public static ViewHolder create(RelativeLayout rootView) { + TextView textViewId = rootView.findViewById(R.id.textViewId); + TextView textViewName = rootView.findViewById(R.id.textViewName); + TextView type = rootView.findViewById(R.id.imageText); + RelativeLayout relativeLayout = rootView.findViewById(R.id.relativelayout); + return new ViewHolder(rootView, textViewName, textViewId, type, relativeLayout); + } } - } } diff --git a/app/src/main/java/org/amfoss/templeapp/adapter/MyDataModel.java b/app/src/main/java/org/amfoss/templeapp/adapter/MyDataModel.java index 7fd0c09..ac3be9a 100644 --- a/app/src/main/java/org/amfoss/templeapp/adapter/MyDataModel.java +++ b/app/src/main/java/org/amfoss/templeapp/adapter/MyDataModel.java @@ -2,23 +2,23 @@ public class MyDataModel { - private String name; + private String name; - private String id; + private String id; - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setCountry(String id) { - this.id = id; - } + public void setCountry(String id) { + this.id = id; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/Result.java b/app/src/main/java/org/amfoss/templeapp/classes/Result.java index eef0298..4264c6d 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/Result.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/Result.java @@ -5,24 +5,24 @@ public class Result { - @SerializedName("result") - @Expose - private String result; + @SerializedName("result") + @Expose + private String result; - /** No args constructor for use in serialization */ - public Result() {} + /** No args constructor for use in serialization */ + public Result() {} - /** @param result */ - public Result(String result) { - super(); - this.result = result; - } + /** @param result */ + public Result(String result) { + super(); + this.result = result; + } - public String getResult() { - return result; - } + public String getResult() { + return result; + } - public void setResult(String result) { - this.result = result; - } + public void setResult(String result) { + this.result = result; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/assets/AllAssetsResult.java b/app/src/main/java/org/amfoss/templeapp/classes/assets/AllAssetsResult.java index b5ef763..8bff72b 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/assets/AllAssetsResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/assets/AllAssetsResult.java @@ -6,24 +6,24 @@ public class AllAssetsResult { - @SerializedName("assets") - @Expose - private List assets = null; + @SerializedName("assets") + @Expose + private List assets = null; - /** No args constructor for use in serialization */ - public AllAssetsResult() {} + /** No args constructor for use in serialization */ + public AllAssetsResult() {} - /** @param assets */ - public AllAssetsResult(List assets) { - super(); - this.assets = assets; - } + /** @param assets */ + public AllAssetsResult(List assets) { + super(); + this.assets = assets; + } - public List getAssets() { - return assets; - } + public List getAssets() { + return assets; + } - public void setAssets(List assets) { - this.assets = assets; - } + public void setAssets(List assets) { + this.assets = assets; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/assets/Asset.java b/app/src/main/java/org/amfoss/templeapp/classes/assets/Asset.java index 75c04c5..3127a7d 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/assets/Asset.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/assets/Asset.java @@ -5,68 +5,68 @@ public class Asset { - @SerializedName("type") - @Expose - private String type; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("remarks") - @Expose - private String remarks; - - @SerializedName("id") - @Expose - private Integer id; - - /** No args constructor for use in serialization */ - public Asset() {} - - /** - * @param id - * @param amount - * @param remarks - * @param type - */ - public Asset(String type, Integer amount, String remarks, Integer id) { - super(); - this.type = type; - this.amount = amount; - this.remarks = remarks; - this.id = id; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } + @SerializedName("type") + @Expose + private String type; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("remarks") + @Expose + private String remarks; + + @SerializedName("id") + @Expose + private Integer id; + + /** No args constructor for use in serialization */ + public Asset() {} + + /** + * @param id + * @param amount + * @param remarks + * @param type + */ + public Asset(String type, Integer amount, String remarks, Integer id) { + super(); + this.type = type; + this.amount = amount; + this.remarks = remarks; + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/assets/AssetsResult.java b/app/src/main/java/org/amfoss/templeapp/classes/assets/AssetsResult.java index 4322f64..2b26516 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/assets/AssetsResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/assets/AssetsResult.java @@ -5,24 +5,24 @@ public class AssetsResult { - @SerializedName("asset") - @Expose - private Asset asset; + @SerializedName("asset") + @Expose + private Asset asset; - /** No args constructor for use in serialization */ - public AssetsResult() {} + /** No args constructor for use in serialization */ + public AssetsResult() {} - /** @param asset */ - public AssetsResult(Asset asset) { - super(); - this.asset = asset; - } + /** @param asset */ + public AssetsResult(Asset asset) { + super(); + this.asset = asset; + } - public Asset getAsset() { - return asset; - } + public Asset getAsset() { + return asset; + } - public void setAsset(Asset asset) { - this.asset = asset; - } + public void setAsset(Asset asset) { + this.asset = asset; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/dmy/AllDMYResult.java b/app/src/main/java/org/amfoss/templeapp/classes/dmy/AllDMYResult.java index fe43bd5..63b0c16 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/dmy/AllDMYResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/dmy/AllDMYResult.java @@ -6,24 +6,24 @@ public class AllDMYResult { - @SerializedName("dmypoojas") - @Expose - private List dmypoojas = null; + @SerializedName("dmypoojas") + @Expose + private List dmypoojas = null; - /** No args constructor for use in serialization */ - public AllDMYResult() {} + /** No args constructor for use in serialization */ + public AllDMYResult() {} - /** @param dmypoojas */ - public AllDMYResult(List dmypoojas) { - super(); - this.dmypoojas = dmypoojas; - } + /** @param dmypoojas */ + public AllDMYResult(List dmypoojas) { + super(); + this.dmypoojas = dmypoojas; + } - public List getDMYPoojas() { - return dmypoojas; - } + public List getDMYPoojas() { + return dmypoojas; + } - public void setDMYPoojas(List dmypoojas) { - this.dmypoojas = dmypoojas; - } + public void setDMYPoojas(List dmypoojas) { + this.dmypoojas = dmypoojas; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYPooja.java b/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYPooja.java index af2b0c3..85f8bda 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYPooja.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYPooja.java @@ -5,132 +5,132 @@ public class DMYPooja { - @SerializedName("type") - @Expose - private String type; - - @SerializedName("date") - @Expose - private Integer date; - - @SerializedName("poojatype") - @Expose - private String poojatype; - - @SerializedName("billno") - @Expose - private Integer billno; - - @SerializedName("name") - @Expose - private String name; - - @SerializedName("address") - @Expose - private String address; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("remarks") - @Expose - private String remarks; - - /** No args constructor for use in serialization */ - public DMYPooja() {} - - /** - * @param amount - * @param poojatype - * @param address - * @param name - * @param remarks - * @param billno - * @param date - * @param type - */ - public DMYPooja( - String type, - Integer date, - String poojatype, - Integer billno, - String name, - String address, - Integer amount, - String remarks) { - super(); - this.type = type; - this.date = date; - this.poojatype = poojatype; - this.billno = billno; - this.name = name; - this.address = address; - this.amount = amount; - this.remarks = remarks; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Integer getDate() { - return date; - } - - public void setDate(Integer date) { - this.date = date; - } - - public String getPoojatype() { - return poojatype; - } - - public void setPoojatype(String poojatype) { - this.poojatype = poojatype; - } - - public Integer getBillno() { - return billno; - } - - public void setBillno(Integer billno) { - this.billno = billno; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } + @SerializedName("type") + @Expose + private String type; + + @SerializedName("date") + @Expose + private Integer date; + + @SerializedName("poojatype") + @Expose + private String poojatype; + + @SerializedName("billno") + @Expose + private Integer billno; + + @SerializedName("name") + @Expose + private String name; + + @SerializedName("address") + @Expose + private String address; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("remarks") + @Expose + private String remarks; + + /** No args constructor for use in serialization */ + public DMYPooja() {} + + /** + * @param amount + * @param poojatype + * @param address + * @param name + * @param remarks + * @param billno + * @param date + * @param type + */ + public DMYPooja( + String type, + Integer date, + String poojatype, + Integer billno, + String name, + String address, + Integer amount, + String remarks) { + super(); + this.type = type; + this.date = date; + this.poojatype = poojatype; + this.billno = billno; + this.name = name; + this.address = address; + this.amount = amount; + this.remarks = remarks; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + public String getPoojatype() { + return poojatype; + } + + public void setPoojatype(String poojatype) { + this.poojatype = poojatype; + } + + public Integer getBillno() { + return billno; + } + + public void setBillno(Integer billno) { + this.billno = billno; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYResult.java b/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYResult.java index 588abed..edcc85f 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/dmy/DMYResult.java @@ -5,24 +5,24 @@ public class DMYResult { - @SerializedName("dmypooja") - @Expose - private DMYPooja dmypooja; + @SerializedName("dmypooja") + @Expose + private DMYPooja dmypooja; - /** No args constructor for use in serialization */ - public DMYResult() {} + /** No args constructor for use in serialization */ + public DMYResult() {} - /** @param dmypooja */ - public DMYResult(DMYPooja dmypooja) { - super(); - this.dmypooja = dmypooja; - } + /** @param dmypooja */ + public DMYResult(DMYPooja dmypooja) { + super(); + this.dmypooja = dmypooja; + } - public DMYPooja getDMYPooja() { - return dmypooja; - } + public DMYPooja getDMYPooja() { + return dmypooja; + } - public void setDMYPooja(DMYPooja dmypooja) { - this.dmypooja = dmypooja; - } + public void setDMYPooja(DMYPooja dmypooja) { + this.dmypooja = dmypooja; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/donation/AllDonationResult.java b/app/src/main/java/org/amfoss/templeapp/classes/donation/AllDonationResult.java index def73e0..c9076d6 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/donation/AllDonationResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/donation/AllDonationResult.java @@ -6,24 +6,24 @@ public class AllDonationResult { - @SerializedName("donations") - @Expose - private List donations = null; + @SerializedName("donations") + @Expose + private List donations = null; - /** No args constructor for use in serialization */ - public AllDonationResult() {} + /** No args constructor for use in serialization */ + public AllDonationResult() {} - /** @param donations */ - public AllDonationResult(List donations) { - super(); - this.donations = donations; - } + /** @param donations */ + public AllDonationResult(List donations) { + super(); + this.donations = donations; + } - public List getDonations() { - return donations; - } + public List getDonations() { + return donations; + } - public void setDonations(List donations) { - this.donations = donations; - } + public void setDonations(List donations) { + this.donations = donations; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/donation/Donation.java b/app/src/main/java/org/amfoss/templeapp/classes/donation/Donation.java index 2b5a0db..4e99d5f 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/donation/Donation.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/donation/Donation.java @@ -5,117 +5,117 @@ public class Donation { - @SerializedName("date") - @Expose - private Integer date; - - @SerializedName("type") - @Expose - private String type; - - @SerializedName("billno") - @Expose - private Integer billno; - - @SerializedName("name") - @Expose - private String name; - - @SerializedName("address") - @Expose - private String address; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("remarks") - @Expose - private String remarks; - - /** No args constructor for use in serialization */ - public Donation() {} - - /** - * @param amount - * @param address - * @param name - * @param remarks - * @param billno - * @param type - * @param date - */ - public Donation( - Integer date, - String type, - Integer billno, - String name, - String address, - Integer amount, - String remarks) { - super(); - this.date = date; - this.type = type; - this.billno = billno; - this.name = name; - this.address = address; - this.amount = amount; - this.remarks = remarks; - } - - public Integer getDate() { - return date; - } - - public void setDate(Integer date) { - this.date = date; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Integer getBillno() { - return billno; - } - - public void setBillno(Integer billno) { - this.billno = billno; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } + @SerializedName("date") + @Expose + private Integer date; + + @SerializedName("type") + @Expose + private String type; + + @SerializedName("billno") + @Expose + private Integer billno; + + @SerializedName("name") + @Expose + private String name; + + @SerializedName("address") + @Expose + private String address; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("remarks") + @Expose + private String remarks; + + /** No args constructor for use in serialization */ + public Donation() {} + + /** + * @param amount + * @param address + * @param name + * @param remarks + * @param billno + * @param type + * @param date + */ + public Donation( + Integer date, + String type, + Integer billno, + String name, + String address, + Integer amount, + String remarks) { + super(); + this.date = date; + this.type = type; + this.billno = billno; + this.name = name; + this.address = address; + this.amount = amount; + this.remarks = remarks; + } + + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getBillno() { + return billno; + } + + public void setBillno(Integer billno) { + this.billno = billno; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/donation/DonationResult.java b/app/src/main/java/org/amfoss/templeapp/classes/donation/DonationResult.java index f317c2f..4626984 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/donation/DonationResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/donation/DonationResult.java @@ -5,24 +5,24 @@ public class DonationResult { - @SerializedName("donation") - @Expose - private Donation donation; + @SerializedName("donation") + @Expose + private Donation donation; - /** No args constructor for use in serialization */ - public DonationResult() {} + /** No args constructor for use in serialization */ + public DonationResult() {} - /** @param donation */ - public DonationResult(Donation donation) { - super(); - this.donation = donation; - } + /** @param donation */ + public DonationResult(Donation donation) { + super(); + this.donation = donation; + } - public Donation getDonation() { - return donation; - } + public Donation getDonation() { + return donation; + } - public void setDonation(Donation donation) { - this.donation = donation; - } + public void setDonation(Donation donation) { + this.donation = donation; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/fd/AllFDResult.java b/app/src/main/java/org/amfoss/templeapp/classes/fd/AllFDResult.java index 7fb953a..653b710 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/fd/AllFDResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/fd/AllFDResult.java @@ -6,24 +6,24 @@ public class AllFDResult { - @SerializedName("fds") - @Expose - private List fds = null; + @SerializedName("fds") + @Expose + private List fds = null; - /** No args constructor for use in serialization */ - public AllFDResult() {} + /** No args constructor for use in serialization */ + public AllFDResult() {} - /** @param fds */ - public AllFDResult(List fds) { - super(); - this.fds = fds; - } + /** @param fds */ + public AllFDResult(List fds) { + super(); + this.fds = fds; + } - public List getFDs() { - return fds; - } + public List getFDs() { + return fds; + } - public void setFDs(List fds) { - this.fds = fds; - } + public void setFDs(List fds) { + this.fds = fds; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/fd/FD.java b/app/src/main/java/org/amfoss/templeapp/classes/fd/FD.java index a370aa1..63b852f 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/fd/FD.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/fd/FD.java @@ -5,117 +5,117 @@ public class FD { - @SerializedName("date") - @Expose - private Integer date; - - @SerializedName("bank") - @Expose - private String bank; - - @SerializedName("fdno") - @Expose - private String fdno; - - @SerializedName("maturitydate") - @Expose - private Integer maturitydate; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("value") - @Expose - private Integer value; - - @SerializedName("name") - @Expose - private String name; - - /** No args constructor for use in serialization */ - public FD() {} - - /** - * @param amount - * @param maturitydate - * @param fdno - * @param name - * @param value - * @param bank - * @param date - */ - public FD( - Integer date, - String bank, - String fdno, - Integer maturitydate, - Integer amount, - Integer value, - String name) { - super(); - this.date = date; - this.bank = bank; - this.fdno = fdno; - this.maturitydate = maturitydate; - this.amount = amount; - this.value = value; - this.name = name; - } - - public Integer getDate() { - return date; - } - - public void setDate(Integer date) { - this.date = date; - } - - public String getBank() { - return bank; - } - - public void setBank(String bank) { - this.bank = bank; - } - - public String getFdno() { - return fdno; - } - - public void setFdno(String fdno) { - this.fdno = fdno; - } - - public Integer getMaturitydate() { - return maturitydate; - } - - public void setMaturitydate(Integer maturitydate) { - this.maturitydate = maturitydate; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public Integer getValue() { - return value; - } - - public void setValue(Integer value) { - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } + @SerializedName("date") + @Expose + private Integer date; + + @SerializedName("bank") + @Expose + private String bank; + + @SerializedName("fdno") + @Expose + private String fdno; + + @SerializedName("maturitydate") + @Expose + private Integer maturitydate; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("value") + @Expose + private Integer value; + + @SerializedName("name") + @Expose + private String name; + + /** No args constructor for use in serialization */ + public FD() {} + + /** + * @param amount + * @param maturitydate + * @param fdno + * @param name + * @param value + * @param bank + * @param date + */ + public FD( + Integer date, + String bank, + String fdno, + Integer maturitydate, + Integer amount, + Integer value, + String name) { + super(); + this.date = date; + this.bank = bank; + this.fdno = fdno; + this.maturitydate = maturitydate; + this.amount = amount; + this.value = value; + this.name = name; + } + + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + public String getBank() { + return bank; + } + + public void setBank(String bank) { + this.bank = bank; + } + + public String getFdno() { + return fdno; + } + + public void setFdno(String fdno) { + this.fdno = fdno; + } + + public Integer getMaturitydate() { + return maturitydate; + } + + public void setMaturitydate(Integer maturitydate) { + this.maturitydate = maturitydate; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/fd/FDResult.java b/app/src/main/java/org/amfoss/templeapp/classes/fd/FDResult.java index 5c41766..d201eae 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/fd/FDResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/fd/FDResult.java @@ -5,24 +5,24 @@ public class FDResult { - @SerializedName("fd") - @Expose - private FD fd; + @SerializedName("fd") + @Expose + private FD fd; - /** No args constructor for use in serialization */ - public FDResult() {} + /** No args constructor for use in serialization */ + public FDResult() {} - /** @param fd */ - public FDResult(FD fd) { - super(); - this.fd = fd; - } + /** @param fd */ + public FDResult(FD fd) { + super(); + this.fd = fd; + } - public FD getFD() { - return fd; - } + public FD getFD() { + return fd; + } - public void setFD(FD fd) { - this.fd = fd; - } + public void setFD(FD fd) { + this.fd = fd; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/ie/AllIEResult.java b/app/src/main/java/org/amfoss/templeapp/classes/ie/AllIEResult.java index dc39be5..8282c84 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/ie/AllIEResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/ie/AllIEResult.java @@ -6,24 +6,24 @@ public class AllIEResult { - @SerializedName("ies") - @Expose - private List ies = null; + @SerializedName("ies") + @Expose + private List ies = null; - /** No args constructor for use in serialization */ - public AllIEResult() {} + /** No args constructor for use in serialization */ + public AllIEResult() {} - /** @param ies */ - public AllIEResult(List ies) { - super(); - this.ies = ies; - } + /** @param ies */ + public AllIEResult(List ies) { + super(); + this.ies = ies; + } - public List getIEs() { - return ies; - } + public List getIEs() { + return ies; + } - public void setIEs(List ies) { - this.ies = ies; - } + public void setIEs(List ies) { + this.ies = ies; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/ie/IE.java b/app/src/main/java/org/amfoss/templeapp/classes/ie/IE.java index 402db8f..6bba9fd 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/ie/IE.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/ie/IE.java @@ -5,82 +5,82 @@ public class IE { - @SerializedName("date") - @Expose - private Integer date; - - @SerializedName("type") - @Expose - private String type; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("remarks") - @Expose - private String remarks; - - @SerializedName("id") - @Expose - private Integer id; - - /** No args constructor for use in serialization */ - public IE() {} - - /** - * @param id - * @param amount - * @param remarks - * @param type - * @param date - */ - public IE(Integer date, String type, Integer amount, String remarks, Integer id) { - super(); - this.date = date; - this.type = type; - this.amount = amount; - this.remarks = remarks; - this.id = id; - } - - public Integer getDate() { - return date; - } - - public void setDate(Integer date) { - this.date = date; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } + @SerializedName("date") + @Expose + private Integer date; + + @SerializedName("type") + @Expose + private String type; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("remarks") + @Expose + private String remarks; + + @SerializedName("id") + @Expose + private Integer id; + + /** No args constructor for use in serialization */ + public IE() {} + + /** + * @param id + * @param amount + * @param remarks + * @param type + * @param date + */ + public IE(Integer date, String type, Integer amount, String remarks, Integer id) { + super(); + this.date = date; + this.type = type; + this.amount = amount; + this.remarks = remarks; + this.id = id; + } + + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/ie/IEResult.java b/app/src/main/java/org/amfoss/templeapp/classes/ie/IEResult.java index 5a9bc04..1a7fa64 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/ie/IEResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/ie/IEResult.java @@ -5,24 +5,24 @@ public class IEResult { - @SerializedName("ie") - @Expose - private IE ie; + @SerializedName("ie") + @Expose + private IE ie; - /** No args constructor for use in serialization */ - public IEResult() {} + /** No args constructor for use in serialization */ + public IEResult() {} - /** @param ie */ - public IEResult(IE ie) { - super(); - this.ie = ie; - } + /** @param ie */ + public IEResult(IE ie) { + super(); + this.ie = ie; + } - public IE getIE() { - return ie; - } + public IE getIE() { + return ie; + } - public void setIE(IE ie) { - this.ie = ie; - } + public void setIE(IE ie) { + this.ie = ie; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/mwb/AllMWBResult.java b/app/src/main/java/org/amfoss/templeapp/classes/mwb/AllMWBResult.java index ea07f6b..a06fde0 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/mwb/AllMWBResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/mwb/AllMWBResult.java @@ -6,24 +6,24 @@ public class AllMWBResult { - @SerializedName("mwbs") - @Expose - private List mwbs = null; + @SerializedName("mwbs") + @Expose + private List mwbs = null; - /** No args constructor for use in serialization */ - public AllMWBResult() {} + /** No args constructor for use in serialization */ + public AllMWBResult() {} - /** @param mwbs */ - public AllMWBResult(List mwbs) { - super(); - this.mwbs = mwbs; - } + /** @param mwbs */ + public AllMWBResult(List mwbs) { + super(); + this.mwbs = mwbs; + } - public List getMWBs() { - return mwbs; - } + public List getMWBs() { + return mwbs; + } - public void setMWBs(List mwbs) { - this.mwbs = mwbs; - } + public void setMWBs(List mwbs) { + this.mwbs = mwbs; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWB.java b/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWB.java index 791a808..3814975 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWB.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWB.java @@ -5,97 +5,97 @@ public class MWB { - @SerializedName("type") - @Expose - private String type; - - @SerializedName("innertype") - @Expose - private String innertype; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("remarks") - @Expose - private String remarks; - - @SerializedName("id") - @Expose - private Integer id; - - @SerializedName("date") - @Expose - private Integer date; - - /** No args constructor for use in serialization */ - public MWB() {} - - /** - * @param id - * @param amount - * @param innertype - * @param remarks - * @param date - * @param type - */ - public MWB( - String type, String innertype, Integer amount, String remarks, Integer id, Integer date) { - super(); - this.type = type; - this.innertype = innertype; - this.amount = amount; - this.remarks = remarks; - this.id = id; - this.date = date; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getInnertype() { - return innertype; - } - - public void setInnertype(String innertype) { - this.innertype = innertype; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getDate() { - return date; - } - - public void setDate(Integer date) { - this.date = date; - } + @SerializedName("type") + @Expose + private String type; + + @SerializedName("innertype") + @Expose + private String innertype; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("remarks") + @Expose + private String remarks; + + @SerializedName("id") + @Expose + private Integer id; + + @SerializedName("date") + @Expose + private Integer date; + + /** No args constructor for use in serialization */ + public MWB() {} + + /** + * @param id + * @param amount + * @param innertype + * @param remarks + * @param date + * @param type + */ + public MWB( + String type, String innertype, Integer amount, String remarks, Integer id, Integer date) { + super(); + this.type = type; + this.innertype = innertype; + this.amount = amount; + this.remarks = remarks; + this.id = id; + this.date = date; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getInnertype() { + return innertype; + } + + public void setInnertype(String innertype) { + this.innertype = innertype; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWBResult.java b/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWBResult.java index 27242f9..5cef97c 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWBResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/mwb/MWBResult.java @@ -5,24 +5,24 @@ public class MWBResult { - @SerializedName("mwb") - @Expose - private MWB mwb; + @SerializedName("mwb") + @Expose + private MWB mwb; - /** No args constructor for use in serialization */ - public MWBResult() {} + /** No args constructor for use in serialization */ + public MWBResult() {} - /** @param mwb */ - public MWBResult(MWB mwb) { - super(); - this.mwb = mwb; - } + /** @param mwb */ + public MWBResult(MWB mwb) { + super(); + this.mwb = mwb; + } - public MWB getMWB() { - return mwb; - } + public MWB getMWB() { + return mwb; + } - public void setMWB(MWB mwb) { - this.mwb = mwb; - } + public void setMWB(MWB mwb) { + this.mwb = mwb; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/pooja/AllPoojaResult.java b/app/src/main/java/org/amfoss/templeapp/classes/pooja/AllPoojaResult.java index 264be39..29b8445 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/pooja/AllPoojaResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/pooja/AllPoojaResult.java @@ -6,24 +6,24 @@ public class AllPoojaResult { - @SerializedName("poojas") - @Expose - private List poojas = null; + @SerializedName("poojas") + @Expose + private List poojas = null; - /** No args constructor for use in serialization */ - public AllPoojaResult() {} + /** No args constructor for use in serialization */ + public AllPoojaResult() {} - /** @param poojas */ - public AllPoojaResult(List poojas) { - super(); - this.poojas = poojas; - } + /** @param poojas */ + public AllPoojaResult(List poojas) { + super(); + this.poojas = poojas; + } - public List getPoojas() { - return poojas; - } + public List getPoojas() { + return poojas; + } - public void setPoojas(List poojas) { - this.poojas = poojas; - } + public void setPoojas(List poojas) { + this.poojas = poojas; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/pooja/Pooja.java b/app/src/main/java/org/amfoss/templeapp/classes/pooja/Pooja.java index 4aa963b..75abee8 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/pooja/Pooja.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/pooja/Pooja.java @@ -5,117 +5,117 @@ public class Pooja { - @SerializedName("date") - @Expose - private Integer date; - - @SerializedName("type") - @Expose - private String type; - - @SerializedName("billno") - @Expose - private Integer billno; - - @SerializedName("name") - @Expose - private String name; - - @SerializedName("address") - @Expose - private String address; - - @SerializedName("amount") - @Expose - private Integer amount; - - @SerializedName("remarks") - @Expose - private String remarks; - - /** No args constructor for use in serialization */ - public Pooja() {} - - /** - * @param amount - * @param address - * @param name - * @param remarks - * @param billno - * @param type - * @param date - */ - public Pooja( - Integer date, - String type, - Integer billno, - String name, - String address, - Integer amount, - String remarks) { - super(); - this.date = date; - this.type = type; - this.billno = billno; - this.name = name; - this.address = address; - this.amount = amount; - this.remarks = remarks; - } - - public Integer getDate() { - return date; - } - - public void setDate(Integer date) { - this.date = date; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Integer getBillno() { - return billno; - } - - public void setBillno(Integer billno) { - this.billno = billno; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public String getRemarks() { - return remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } + @SerializedName("date") + @Expose + private Integer date; + + @SerializedName("type") + @Expose + private String type; + + @SerializedName("billno") + @Expose + private Integer billno; + + @SerializedName("name") + @Expose + private String name; + + @SerializedName("address") + @Expose + private String address; + + @SerializedName("amount") + @Expose + private Integer amount; + + @SerializedName("remarks") + @Expose + private String remarks; + + /** No args constructor for use in serialization */ + public Pooja() {} + + /** + * @param amount + * @param address + * @param name + * @param remarks + * @param billno + * @param type + * @param date + */ + public Pooja( + Integer date, + String type, + Integer billno, + String name, + String address, + Integer amount, + String remarks) { + super(); + this.date = date; + this.type = type; + this.billno = billno; + this.name = name; + this.address = address; + this.amount = amount; + this.remarks = remarks; + } + + public Integer getDate() { + return date; + } + + public void setDate(Integer date) { + this.date = date; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getBillno() { + return billno; + } + + public void setBillno(Integer billno) { + this.billno = billno; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/classes/pooja/PoojaResult.java b/app/src/main/java/org/amfoss/templeapp/classes/pooja/PoojaResult.java index f37ed7b..f0dedc7 100644 --- a/app/src/main/java/org/amfoss/templeapp/classes/pooja/PoojaResult.java +++ b/app/src/main/java/org/amfoss/templeapp/classes/pooja/PoojaResult.java @@ -5,24 +5,24 @@ public class PoojaResult { - @SerializedName("pooja") - @Expose - private Pooja pooja; + @SerializedName("pooja") + @Expose + private Pooja pooja; - /** No args constructor for use in serialization */ - public PoojaResult() {} + /** No args constructor for use in serialization */ + public PoojaResult() {} - /** @param pooja */ - public PoojaResult(Pooja pooja) { - super(); - this.pooja = pooja; - } + /** @param pooja */ + public PoojaResult(Pooja pooja) { + super(); + this.pooja = pooja; + } - public Pooja getPooja() { - return pooja; - } + public Pooja getPooja() { + return pooja; + } - public void setPooja(Pooja pooja) { - this.pooja = pooja; - } + public void setPooja(Pooja pooja) { + this.pooja = pooja; + } } diff --git a/app/src/main/java/org/amfoss/templeapp/json_api/Api.java b/app/src/main/java/org/amfoss/templeapp/json_api/Api.java index 3a8ca35..210ffc8 100644 --- a/app/src/main/java/org/amfoss/templeapp/json_api/Api.java +++ b/app/src/main/java/org/amfoss/templeapp/json_api/Api.java @@ -20,567 +20,567 @@ import retrofit2.http.Query; public interface Api { - String BASE_URL = - "https://script.google.com/macros/s/AKfycbxu17kBRMvZrTVq_eMbyrkprR1CyixdglcnnTO7nkSS/"; - - /** - * @param sheet - * @param action - * @param date - * @param type - * @param billno - * @param name - * @param address - * @param amount - * @param remarks - * @return - */ - @GET("dev") - Call insertPooja( - @Query("sheet") String sheet, // sheet = "pooja" - @Query("action") String action, // action = "insert" - @Query("date") Integer date, - @Query("type") String type, - @Query("billno") Integer billno, - @Query("name") String name, - @Query("address") String address, - @Query("amount") Integer amount, - @Query("remarks") String remarks); - - /** - * @param sheet - * @param action - * @param date - * @param type - * @param billno - * @param name - * @param address - * @param amount - * @param remarks - * @return - */ - @GET("dev") - Call updatePooja( - @Query("sheet") String sheet, // sheet = "pooja" - @Query("action") String action, // action = "update" - @Query("date") Integer date, - @Query("type") String type, - @Query("billno") Integer billno, - @Query("name") String name, - @Query("address") String address, - @Query("amount") Integer amount, - @Query("remarks") String remarks); - - /** - * @param sheet - * @param action - * @param billno - * @return - */ - @GET("dev") - Call deletePooja( - @Query("sheet") String sheet, // sheet = "pooja" - @Query("action") String action, // action = "delete" - @Query("billno") Integer billno); - - /** - * @param sheet - * @param action - * @param billno - * @return - */ - @GET("dev") - Call getPooja( - @Query("sheet") String sheet, // sheet = "pooja" - @Query("action") String action, // action = "billno" - @Query("billno") Integer billno); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllPooja( - @Query("sheet") String sheet, // sheet = "pooja" - @Query("action") String action // action = "readall" - ); - - /** - * @param sheet - * @param action - * @param date - * @param type - * @param billno - * @param name - * @param address - * @param amount - * @param remarks - * @return - */ - @GET("dev") - Call insertDonation( - @Query("sheet") String sheet, // sheet = "donation" - @Query("action") String action, // action = "insert" - @Query("date") Integer date, - @Query("type") String type, - @Query("billno") Integer billno, - @Query("name") String name, - @Query("address") String address, - @Query("amount") Integer amount, - @Query("remarks") String remarks); - - /** - * @param sheet - * @param action - * @param date - * @param type - * @param billno - * @param name - * @param address - * @param amount - * @param remarks - * @return - */ - @GET("dev") - Call updateDonation( - @Query("sheet") String sheet, // sheet = "donation" - @Query("action") String action, // action = "update" - @Query("date") Integer date, - @Query("type") String type, - @Query("billno") Integer billno, - @Query("name") String name, - @Query("address") String address, - @Query("amount") Integer amount, - @Query("remarks") String remarks); - - /** - * @param sheet - * @param action - * @param billno - * @return - */ - @GET("dev") - Call deleteDonation( - @Query("sheet") String sheet, // sheet = "donation" - @Query("action") String action, // action = "delete" - @Query("billno") Integer billno); - - /** - * @param sheet - * @param action - * @param Integer - * @return - */ - @GET("dev") - Call getDonation( - @Query("sheet") String sheet, // sheet = "donation" - @Query("action") String action, // action = "billno" - @Query("billno") String Integer); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllDonation( - @Query("sheet") String sheet, // sheet = "donation" - @Query("action") String action // action = "readall" - ); - - /** - * @param sheet - * @param action - * @param type - * @param date - * @param poojatype - * @param billno - * @param name - * @param address - * @param amount - * @param remarks - * @return - */ - @GET("dev") - Call insertDMY( - @Query("sheet") String sheet, // sheet = "dmy" - @Query("action") String action, // action = "insert" - @Query("type") String type, - @Query("date") Integer date, - @Query("poojatype") String poojatype, - @Query("billno") Integer billno, - @Query("name") String name, - @Query("address") String address, - @Query("amount") Integer amount, - @Query("remarks") String remarks); - - /** - * @param sheet - * @param action - * @param type - * @param date - * @param poojatype - * @param billno - * @param name - * @param address - * @param amount - * @param remarks - * @return - */ - @GET("dev") - Call updateDMY( - @Query("sheet") String sheet, // sheet = "dmy" - @Query("action") String action, // action = "update" - @Query("type") String type, - @Query("date") Integer date, - @Query("poojatype") String poojatype, - @Query("billno") Integer billno, - @Query("name") String name, - @Query("address") String address, - @Query("amount") Integer amount, - @Query("remarks") String remarks); - - /** - * @param sheet - * @param action - * @param billno - * @return - */ - @GET("dev") - Call deleteDMY( - @Query("sheet") String sheet, // sheet = "dmy" - @Query("action") String action, // action = "delete" - @Query("billno") Integer billno); - - /** - * @param sheet - * @param action - * @param billno - * @return - */ - @GET("dev") - Call getDMY( - @Query("sheet") String sheet, // sheet = "dmy" - @Query("action") String action, // action = "billno" - @Query("billno") Integer billno); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllDMY( - @Query("sheet") String sheet, // sheet = "dmy" - @Query("action") String action // action = "readall" - ); - - /** - * @param sheet - * @param action - * @param date - * @param type - * @param amount - * @param remarks - * @param id - * @return - */ - @GET("dev") - Call insertIE( - @Query("sheet") String sheet, // sheet = "ie" - @Query("action") String action, // action = "insert" - @Query("date") Integer date, - @Query("type") String type, - @Query("amount") Integer amount, - @Query("remarks") String remarks, - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param date - * @param type - * @param amount - * @param remarks - * @param id - * @return - */ - @GET("dev") - Call updateIE( - @Query("sheet") String sheet, // sheet = "ie" - @Query("action") String action, // action = "update" - @Query("date") Integer date, - @Query("type") String type, - @Query("amount") Integer amount, - @Query("remarks") String remarks, - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param id - * @return - */ - @GET("dev") - Call deleteIE( - @Query("sheet") String sheet, // sheet = "ie" - @Query("action") String action, // action = "delete" - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param id - * @return - */ - @GET("dev") - Call getIE( - @Query("sheet") String sheet, // sheet = "ie" - @Query("action") String action, // action = "id" - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllIE( - @Query("sheet") String sheet, // sheet = "ie" - @Query("action") String action // action = "readall" - ); - - /** - * @param sheet - * @param action - * @param type - * @param innertype - * @param amount - * @param remarks - * @param id - * @param date - * @return - */ - @GET("dev") - Call insertMWB( - @Query("sheet") String sheet, // sheet = "mwb" - @Query("action") String action, // action = "insert" - @Query("type") String type, - @Query("innertype") String innertype, - @Query("amount") Integer amount, - @Query("remarks") String remarks, - @Query("id") Integer id, - @Query("date") Integer date); - - /** - * @param sheet - * @param action - * @param type - * @param innertype - * @param amount - * @param remarks - * @param id - * @param date - * @return - */ - @GET("dev") - Call updateMWB( - @Query("sheet") String sheet, // sheet = "mwb" - @Query("action") String action, // action = "update" - @Query("type") String type, - @Query("innertype") String innertype, - @Query("amount") Integer amount, - @Query("remarks") String remarks, - @Query("id") Integer id, - @Query("date") Integer date); - - /** - * @param sheet - * @param action - * @param id - * @return - */ - @GET("dev") - Call deleteMWB( - @Query("sheet") String sheet, // sheet = "mwb" - @Query("action") String action, // action = "delete" - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param id - * @return - */ - @GET("dev") - Call getMWB( - @Query("sheet") String sheet, // sheet = "mwb" - @Query("action") String action, // action = "id" - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllMWB( - @Query("sheet") String sheet, // sheet = "mwb" - @Query("action") String action // action = "readall" - ); - - /** - * @param sheet - * @param action - * @param type - * @param amount - * @param remarks - * @param id - * @return - */ - @GET("dev") - Call insertAsset( - @Query("sheet") String sheet, // sheet = "assets" - @Query("action") String action, // action = "insert" - @Query("type") String type, - @Query("amount") Integer amount, - @Query("remarks") String remarks, - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param type - * @param amount - * @param remarks - * @param id - * @return - */ - @GET("dev") - Call updateAsset( - @Query("sheet") String sheet, // sheet = "assets" - @Query("action") String action, // action = "update" - @Query("type") String type, - @Query("amount") Integer amount, - @Query("remarks") String remarks, - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param id - * @return - */ - @GET("dev") - Call deleteAsset( - @Query("sheet") String sheet, // sheet = "assets" - @Query("action") String action, // action = "delete" - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @param id - * @return - */ - @GET("dev") - Call getAsset( - @Query("sheet") String sheet, // sheet = "assets" - @Query("action") String action, // action = "id" - @Query("id") Integer id); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllAssets( - @Query("sheet") String sheet, // sheet = "assets" - @Query("action") String action // action = "readall" - ); - - /** - * @param sheet - * @param action - * @param date - * @param bank - * @param fdno - * @param maturitydate - * @param amount - * @param value - * @param name - * @return - */ - @GET("dev") - Call insertFD( - @Query("sheet") String sheet, // sheet = "fd" - @Query("action") String action, // action = "insert" - @Query("date") Integer date, - @Query("bank") String bank, - @Query("fdno") String fdno, - @Query("maturitydate") Integer maturitydate, - @Query("amount") Integer amount, - @Query("value") Integer value, - @Query("name") String name); - - /** - * @param sheet - * @param action - * @param date - * @param bank - * @param fdno - * @param maturitydate - * @param amount - * @param value - * @param name - * @return - */ - @GET("dev") - Call updateFD( - @Query("sheet") String sheet, // sheet = "fd" - @Query("action") String action, // action = "update" - @Query("date") Integer date, - @Query("bank") String bank, - @Query("fdno") String fdno, - @Query("maturitydate") Integer maturitydate, - @Query("amount") Integer amount, - @Query("value") Integer value, - @Query("name") String name); - - /** - * @param sheet - * @param action - * @param fdno - * @return - */ - @GET("dev") - Call deleteFD( - @Query("sheet") String sheet, // sheet = "fd" - @Query("action") String action, // action = "delete" - @Query("fdno") String fdno); - - /** - * @param sheet - * @param action - * @param fdno - * @return - */ - @GET("dev") - Call getFD( - @Query("sheet") String sheet, // sheet = "fd" - @Query("action") String action, // action = "fdno" - @Query("fdno") String fdno); - - /** - * @param sheet - * @param action - * @return - */ - @GET("dev") - Call getAllFD( - @Query("sheet") String sheet, // sheet = "fd" - @Query("action") String action // action = "readall" - ); + String BASE_URL = + "https://script.google.com/macros/s/AKfycbxu17kBRMvZrTVq_eMbyrkprR1CyixdglcnnTO7nkSS/"; + + /** + * @param sheet + * @param action + * @param date + * @param type + * @param billno + * @param name + * @param address + * @param amount + * @param remarks + * @return + */ + @GET("dev") + Call insertPooja( + @Query("sheet") String sheet, // sheet = "pooja" + @Query("action") String action, // action = "insert" + @Query("date") Integer date, + @Query("type") String type, + @Query("billno") Integer billno, + @Query("name") String name, + @Query("address") String address, + @Query("amount") Integer amount, + @Query("remarks") String remarks); + + /** + * @param sheet + * @param action + * @param date + * @param type + * @param billno + * @param name + * @param address + * @param amount + * @param remarks + * @return + */ + @GET("dev") + Call updatePooja( + @Query("sheet") String sheet, // sheet = "pooja" + @Query("action") String action, // action = "update" + @Query("date") Integer date, + @Query("type") String type, + @Query("billno") Integer billno, + @Query("name") String name, + @Query("address") String address, + @Query("amount") Integer amount, + @Query("remarks") String remarks); + + /** + * @param sheet + * @param action + * @param billno + * @return + */ + @GET("dev") + Call deletePooja( + @Query("sheet") String sheet, // sheet = "pooja" + @Query("action") String action, // action = "delete" + @Query("billno") Integer billno); + + /** + * @param sheet + * @param action + * @param billno + * @return + */ + @GET("dev") + Call getPooja( + @Query("sheet") String sheet, // sheet = "pooja" + @Query("action") String action, // action = "billno" + @Query("billno") Integer billno); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllPooja( + @Query("sheet") String sheet, // sheet = "pooja" + @Query("action") String action // action = "readall" + ); + + /** + * @param sheet + * @param action + * @param date + * @param type + * @param billno + * @param name + * @param address + * @param amount + * @param remarks + * @return + */ + @GET("dev") + Call insertDonation( + @Query("sheet") String sheet, // sheet = "donation" + @Query("action") String action, // action = "insert" + @Query("date") Integer date, + @Query("type") String type, + @Query("billno") Integer billno, + @Query("name") String name, + @Query("address") String address, + @Query("amount") Integer amount, + @Query("remarks") String remarks); + + /** + * @param sheet + * @param action + * @param date + * @param type + * @param billno + * @param name + * @param address + * @param amount + * @param remarks + * @return + */ + @GET("dev") + Call updateDonation( + @Query("sheet") String sheet, // sheet = "donation" + @Query("action") String action, // action = "update" + @Query("date") Integer date, + @Query("type") String type, + @Query("billno") Integer billno, + @Query("name") String name, + @Query("address") String address, + @Query("amount") Integer amount, + @Query("remarks") String remarks); + + /** + * @param sheet + * @param action + * @param billno + * @return + */ + @GET("dev") + Call deleteDonation( + @Query("sheet") String sheet, // sheet = "donation" + @Query("action") String action, // action = "delete" + @Query("billno") Integer billno); + + /** + * @param sheet + * @param action + * @param Integer + * @return + */ + @GET("dev") + Call getDonation( + @Query("sheet") String sheet, // sheet = "donation" + @Query("action") String action, // action = "billno" + @Query("billno") String Integer); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllDonation( + @Query("sheet") String sheet, // sheet = "donation" + @Query("action") String action // action = "readall" + ); + + /** + * @param sheet + * @param action + * @param type + * @param date + * @param poojatype + * @param billno + * @param name + * @param address + * @param amount + * @param remarks + * @return + */ + @GET("dev") + Call insertDMY( + @Query("sheet") String sheet, // sheet = "dmy" + @Query("action") String action, // action = "insert" + @Query("type") String type, + @Query("date") Integer date, + @Query("poojatype") String poojatype, + @Query("billno") Integer billno, + @Query("name") String name, + @Query("address") String address, + @Query("amount") Integer amount, + @Query("remarks") String remarks); + + /** + * @param sheet + * @param action + * @param type + * @param date + * @param poojatype + * @param billno + * @param name + * @param address + * @param amount + * @param remarks + * @return + */ + @GET("dev") + Call updateDMY( + @Query("sheet") String sheet, // sheet = "dmy" + @Query("action") String action, // action = "update" + @Query("type") String type, + @Query("date") Integer date, + @Query("poojatype") String poojatype, + @Query("billno") Integer billno, + @Query("name") String name, + @Query("address") String address, + @Query("amount") Integer amount, + @Query("remarks") String remarks); + + /** + * @param sheet + * @param action + * @param billno + * @return + */ + @GET("dev") + Call deleteDMY( + @Query("sheet") String sheet, // sheet = "dmy" + @Query("action") String action, // action = "delete" + @Query("billno") Integer billno); + + /** + * @param sheet + * @param action + * @param billno + * @return + */ + @GET("dev") + Call getDMY( + @Query("sheet") String sheet, // sheet = "dmy" + @Query("action") String action, // action = "billno" + @Query("billno") Integer billno); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllDMY( + @Query("sheet") String sheet, // sheet = "dmy" + @Query("action") String action // action = "readall" + ); + + /** + * @param sheet + * @param action + * @param date + * @param type + * @param amount + * @param remarks + * @param id + * @return + */ + @GET("dev") + Call insertIE( + @Query("sheet") String sheet, // sheet = "ie" + @Query("action") String action, // action = "insert" + @Query("date") Integer date, + @Query("type") String type, + @Query("amount") Integer amount, + @Query("remarks") String remarks, + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param date + * @param type + * @param amount + * @param remarks + * @param id + * @return + */ + @GET("dev") + Call updateIE( + @Query("sheet") String sheet, // sheet = "ie" + @Query("action") String action, // action = "update" + @Query("date") Integer date, + @Query("type") String type, + @Query("amount") Integer amount, + @Query("remarks") String remarks, + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param id + * @return + */ + @GET("dev") + Call deleteIE( + @Query("sheet") String sheet, // sheet = "ie" + @Query("action") String action, // action = "delete" + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param id + * @return + */ + @GET("dev") + Call getIE( + @Query("sheet") String sheet, // sheet = "ie" + @Query("action") String action, // action = "id" + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllIE( + @Query("sheet") String sheet, // sheet = "ie" + @Query("action") String action // action = "readall" + ); + + /** + * @param sheet + * @param action + * @param type + * @param innertype + * @param amount + * @param remarks + * @param id + * @param date + * @return + */ + @GET("dev") + Call insertMWB( + @Query("sheet") String sheet, // sheet = "mwb" + @Query("action") String action, // action = "insert" + @Query("type") String type, + @Query("innertype") String innertype, + @Query("amount") Integer amount, + @Query("remarks") String remarks, + @Query("id") Integer id, + @Query("date") Integer date); + + /** + * @param sheet + * @param action + * @param type + * @param innertype + * @param amount + * @param remarks + * @param id + * @param date + * @return + */ + @GET("dev") + Call updateMWB( + @Query("sheet") String sheet, // sheet = "mwb" + @Query("action") String action, // action = "update" + @Query("type") String type, + @Query("innertype") String innertype, + @Query("amount") Integer amount, + @Query("remarks") String remarks, + @Query("id") Integer id, + @Query("date") Integer date); + + /** + * @param sheet + * @param action + * @param id + * @return + */ + @GET("dev") + Call deleteMWB( + @Query("sheet") String sheet, // sheet = "mwb" + @Query("action") String action, // action = "delete" + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param id + * @return + */ + @GET("dev") + Call getMWB( + @Query("sheet") String sheet, // sheet = "mwb" + @Query("action") String action, // action = "id" + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllMWB( + @Query("sheet") String sheet, // sheet = "mwb" + @Query("action") String action // action = "readall" + ); + + /** + * @param sheet + * @param action + * @param type + * @param amount + * @param remarks + * @param id + * @return + */ + @GET("dev") + Call insertAsset( + @Query("sheet") String sheet, // sheet = "assets" + @Query("action") String action, // action = "insert" + @Query("type") String type, + @Query("amount") Integer amount, + @Query("remarks") String remarks, + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param type + * @param amount + * @param remarks + * @param id + * @return + */ + @GET("dev") + Call updateAsset( + @Query("sheet") String sheet, // sheet = "assets" + @Query("action") String action, // action = "update" + @Query("type") String type, + @Query("amount") Integer amount, + @Query("remarks") String remarks, + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param id + * @return + */ + @GET("dev") + Call deleteAsset( + @Query("sheet") String sheet, // sheet = "assets" + @Query("action") String action, // action = "delete" + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @param id + * @return + */ + @GET("dev") + Call getAsset( + @Query("sheet") String sheet, // sheet = "assets" + @Query("action") String action, // action = "id" + @Query("id") Integer id); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllAssets( + @Query("sheet") String sheet, // sheet = "assets" + @Query("action") String action // action = "readall" + ); + + /** + * @param sheet + * @param action + * @param date + * @param bank + * @param fdno + * @param maturitydate + * @param amount + * @param value + * @param name + * @return + */ + @GET("dev") + Call insertFD( + @Query("sheet") String sheet, // sheet = "fd" + @Query("action") String action, // action = "insert" + @Query("date") Integer date, + @Query("bank") String bank, + @Query("fdno") String fdno, + @Query("maturitydate") Integer maturitydate, + @Query("amount") Integer amount, + @Query("value") Integer value, + @Query("name") String name); + + /** + * @param sheet + * @param action + * @param date + * @param bank + * @param fdno + * @param maturitydate + * @param amount + * @param value + * @param name + * @return + */ + @GET("dev") + Call updateFD( + @Query("sheet") String sheet, // sheet = "fd" + @Query("action") String action, // action = "update" + @Query("date") Integer date, + @Query("bank") String bank, + @Query("fdno") String fdno, + @Query("maturitydate") Integer maturitydate, + @Query("amount") Integer amount, + @Query("value") Integer value, + @Query("name") String name); + + /** + * @param sheet + * @param action + * @param fdno + * @return + */ + @GET("dev") + Call deleteFD( + @Query("sheet") String sheet, // sheet = "fd" + @Query("action") String action, // action = "delete" + @Query("fdno") String fdno); + + /** + * @param sheet + * @param action + * @param fdno + * @return + */ + @GET("dev") + Call getFD( + @Query("sheet") String sheet, // sheet = "fd" + @Query("action") String action, // action = "fdno" + @Query("fdno") String fdno); + + /** + * @param sheet + * @param action + * @return + */ + @GET("dev") + Call getAllFD( + @Query("sheet") String sheet, // sheet = "fd" + @Query("action") String action // action = "readall" + ); } diff --git a/app/src/main/java/org/amfoss/templeapp/json_api/Controller.java b/app/src/main/java/org/amfoss/templeapp/json_api/Controller.java index d26d661..9cb9a7d 100644 --- a/app/src/main/java/org/amfoss/templeapp/json_api/Controller.java +++ b/app/src/main/java/org/amfoss/templeapp/json_api/Controller.java @@ -11,80 +11,80 @@ public class Controller { - public static final String TAG = "TAG"; + public static final String TAG = "TAG"; - public static final String WAURL = - "https://script.google.com/macros/s/AKfycbyPjM-IwzRxTgMDIw05BsmUpAjolx86BvuKIY9iVbvk/dev?"; + public static final String WAURL = + "https://script.google.com/macros/s/AKfycbyPjM-IwzRxTgMDIw05BsmUpAjolx86BvuKIY9iVbvk/dev?"; - private static Response response; + private static Response response; - public static JSONObject readAllData() { - try { - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(WAURL + "action=readAll").build(); - response = client.newCall(request).execute(); - return new JSONObject(response.body().string()); - } catch (@NonNull IOException | JSONException e) { - Log.e(TAG, "" + e.getLocalizedMessage()); + public static JSONObject readAllData() { + try { + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url(WAURL + "action=readAll").build(); + response = client.newCall(request).execute(); + return new JSONObject(response.body().string()); + } catch (@NonNull IOException | JSONException e) { + Log.e(TAG, "" + e.getLocalizedMessage()); + } + return null; } - return null; - } - public static JSONObject insertData(String id, String name) { - try { - OkHttpClient client = new OkHttpClient(); - Request request = - new Request.Builder().url(WAURL + "action=insert&id=" + id + "&name=" + name).build(); - response = client.newCall(request).execute(); - // Log.e(TAG,"response from gs"+response.body().string()); - return new JSONObject(response.body().string()); + public static JSONObject insertData(String id, String name) { + try { + OkHttpClient client = new OkHttpClient(); + Request request = + new Request.Builder().url(WAURL + "action=insert&id=" + id + "&name=" + name).build(); + response = client.newCall(request).execute(); + // Log.e(TAG,"response from gs"+response.body().string()); + return new JSONObject(response.body().string()); - } catch (@NonNull IOException | JSONException e) { - Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } catch (@NonNull IOException | JSONException e) { + Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } + return null; } - return null; - } - public static JSONObject updateData(String id, String name) { - try { - OkHttpClient client = new OkHttpClient(); - Request request = - new Request.Builder().url(WAURL + "action=update&id=" + id + "&name=" + name).build(); - response = client.newCall(request).execute(); - // Log.e(TAG,"response from gs"+response.body().string()); - return new JSONObject(response.body().string()); + public static JSONObject updateData(String id, String name) { + try { + OkHttpClient client = new OkHttpClient(); + Request request = + new Request.Builder().url(WAURL + "action=update&id=" + id + "&name=" + name).build(); + response = client.newCall(request).execute(); + // Log.e(TAG,"response from gs"+response.body().string()); + return new JSONObject(response.body().string()); - } catch (@NonNull IOException | JSONException e) { - Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } catch (@NonNull IOException | JSONException e) { + Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } + return null; } - return null; - } - public static JSONObject readData(String id) { - try { - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(WAURL + "action=read&id=" + id).build(); - response = client.newCall(request).execute(); - // Log.e(TAG,"response from gs"+response.body().string()); - return new JSONObject(response.body().string()); + public static JSONObject readData(String id) { + try { + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url(WAURL + "action=read&id=" + id).build(); + response = client.newCall(request).execute(); + // Log.e(TAG,"response from gs"+response.body().string()); + return new JSONObject(response.body().string()); - } catch (@NonNull IOException | JSONException e) { - Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } catch (@NonNull IOException | JSONException e) { + Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } + return null; } - return null; - } - public static JSONObject deleteData(String id) { - try { - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(WAURL + "action=delete&id=" + id).build(); - response = client.newCall(request).execute(); - // Log.e(TAG,"response from gs"+response.body().string()); - return new JSONObject(response.body().string()); + public static JSONObject deleteData(String id) { + try { + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url(WAURL + "action=delete&id=" + id).build(); + response = client.newCall(request).execute(); + // Log.e(TAG,"response from gs"+response.body().string()); + return new JSONObject(response.body().string()); - } catch (@NonNull IOException | JSONException e) { - Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } catch (@NonNull IOException | JSONException e) { + Log.e(TAG, "recieving null " + e.getLocalizedMessage()); + } + return null; } - return null; - } } diff --git a/app/src/main/java/org/amfoss/templeapp/json_api/InternetConnection.java b/app/src/main/java/org/amfoss/templeapp/json_api/InternetConnection.java index 1140cab..14afa92 100644 --- a/app/src/main/java/org/amfoss/templeapp/json_api/InternetConnection.java +++ b/app/src/main/java/org/amfoss/templeapp/json_api/InternetConnection.java @@ -6,10 +6,10 @@ public class InternetConnection { - /** CHECK WHETHER INTERNET CONNECTION IS AVAILABLE OR NOT */ - public static boolean checkConnection(@NonNull Context context) { - return ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)) - .getActiveNetworkInfo() - != null; - } + /** CHECK WHETHER INTERNET CONNECTION IS AVAILABLE OR NOT */ + public static boolean checkConnection(@NonNull Context context) { + return ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)) + .getActiveNetworkInfo() + != null; + } } diff --git a/app/src/main/res/drawable/ic_circle.xml b/app/src/main/res/drawable/ic_circle.xml index 16b24e6..6b6d63c 100644 --- a/app/src/main/res/drawable/ic_circle.xml +++ b/app/src/main/res/drawable/ic_circle.xml @@ -1,12 +1,10 @@ - - + + android:height="120dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 9edf24a..eaa3a3a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -140,5 +140,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_row_view.xml b/app/src/main/res/layout/layout_row_view.xml index a6493b5..53e6511 100644 --- a/app/src/main/res/layout/layout_row_view.xml +++ b/app/src/main/res/layout/layout_row_view.xml @@ -73,5 +73,4 @@ - - + \ No newline at end of file diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml index 63fc816..9309de9 100644 --- a/app/src/main/res/values-w820dp/dimens.xml +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -3,4 +3,4 @@ (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> 64dp - + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index adacef2..7561fcb 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -6,4 +6,4 @@ #E65100 #c51162 #050505 - + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 47c8224..e00c2dd 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -2,4 +2,4 @@ 16dp 16dp - + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 715633e..219e3ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -65,4 +65,4 @@ Type 3 Type 4 - + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 1b62a7f..e643837 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -16,4 +16,4 @@ @style/TextAppearance.AppCompat - + \ No newline at end of file diff --git a/app/src/test/java/org/amfoss/templeapp/ExampleUnitTest.java b/app/src/test/java/org/amfoss/templeapp/ExampleUnitTest.java index ecf48a4..d184458 100644 --- a/app/src/test/java/org/amfoss/templeapp/ExampleUnitTest.java +++ b/app/src/test/java/org/amfoss/templeapp/ExampleUnitTest.java @@ -6,8 +6,8 @@ /** To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } }