Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
style: change and apply spotless with indentation 4 spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
immadisairaj committed Jun 25, 2019
1 parent 05a89c4 commit f054de6
Show file tree
Hide file tree
Showing 44 changed files with 2,456 additions and 2,494 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ android {
spotless {
java {
googleJavaFormat()
indentWithTabs(2)
indentWithSpaces(4)
target '**/*.java'
trimTrailingWhitespace()
removeUnusedImports()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/** <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
public ApplicationTest() {
super(Application.class);
}
}
170 changes: 83 additions & 87 deletions app/src/main/java/org/amfoss/templeapp/activities/DeleteData.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Void, Void, Void> {

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<Void, Void, Void> {

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();
}
}
}
}
Loading

0 comments on commit f054de6

Please sign in to comment.