Skip to content

Commit

Permalink
Updates in Coin
Browse files Browse the repository at this point in the history
  • Loading branch information
ARUNJOSE144 committed Jun 27, 2021
1 parent 52739af commit 705867e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public CoinTO getRequest() {

public void Create() {
DB = new DBHelper(this);

boolean stat = DB.inserCoinData(getRequest());
if (stat) {
/*Intent intent = new Intent(this, MainActivity.class);
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/example/myapplication/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Handler handler = new Handler();
LoadProps();
setMonitoringCoinDetails();

//Created Thread for Calling the API in multiple times
final Runnable r = new Runnable() {
Expand Down Expand Up @@ -113,7 +111,8 @@ public void openPropsPage() {
}

void getDataFromApi() {
//alert();
LoadProps();
setMonitoringCoinDetails();
RequestQueue requestQueue = Volley.newRequestQueue(this);
JsonObjectRequest objectRequest = new JsonObjectRequest(
Request.Method.GET,
Expand Down
23 changes: 15 additions & 8 deletions app/src/main/java/com/example/myapplication/PropertyActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

public class PropertyActivity extends AppCompatActivity {
DBHelper DB;
EditText DollerInINR, refreshInSeconds, debugMode;
EditText DollerInINR, refreshInSeconds;
Switch debugSwitch;
Button cancelButton, updateAllButton;

@Override
Expand Down Expand Up @@ -50,7 +52,7 @@ void getSetData() {
DB = new DBHelper(this);
DollerInINR = (EditText) findViewById(R.id.DollerInINR);
refreshInSeconds = (EditText) findViewById(R.id.refreshInSeconds);
debugMode = (EditText) findViewById(R.id.debugMode);
debugSwitch = (Switch) findViewById(R.id.debugModeSwitch);

List<Property> properties = DB.getAllProperty();
for (Property property : properties) {
Expand All @@ -59,7 +61,10 @@ void getSetData() {
} else if (property.getName().equalsIgnoreCase("refreshInSeconds")) {
refreshInSeconds.setText(property.getValue());
} else if (property.getName().equalsIgnoreCase("debugMode")) {
debugMode.setText(property.getValue());
if (property.getValue().equalsIgnoreCase("true"))
debugSwitch.setChecked(true);
else
debugSwitch.setChecked(false);
}
}

Expand All @@ -70,7 +75,7 @@ void saveData() {
DB = new DBHelper(this);
DollerInINR = (EditText) findViewById(R.id.DollerInINR);
refreshInSeconds = (EditText) findViewById(R.id.refreshInSeconds);
debugMode = (EditText) findViewById(R.id.debugMode);
debugSwitch = (Switch) findViewById(R.id.debugModeSwitch);

List<Property> properties = new ArrayList<>();

Expand All @@ -84,10 +89,12 @@ void saveData() {
refreshInSecondsProperty.setValue(refreshInSeconds.getText().toString());
properties.add(refreshInSecondsProperty);

Property debugModeProperty = new Property();
debugModeProperty.setName("debugMode");
debugModeProperty.setValue(debugMode.getText().toString());
properties.add(debugModeProperty);
Property debugSwitchModeProperty = new Property();
debugSwitchModeProperty.setName("debugMode");
debugSwitchModeProperty.setValue(debugSwitch.isChecked() ? "true" : "false");
properties.add(debugSwitchModeProperty);


DB.deleteAllProperty();
boolean stat = DB.inserAllProps(properties);
if (stat) {
Expand Down
66 changes: 25 additions & 41 deletions app/src/main/res/layout/activity_property.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,41 @@

<TextView
android:id="@+id/textView"
android:layout_width="134dp"
android:layout_height="15dp"
android:layout_width="100dp"
android:layout_height="90dp"
android:layout_above="@+id/refreshInSeconds1"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="38dp"
android:layout_marginTop="159dp"
android:layout_marginEnd="31dp"
android:layout_marginBottom="45dp"
android:layout_marginStart="50dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="80dp"
android:layout_toStartOf="@+id/DollerInINR"
android:text="Doller In INR"
android:textAlignment="center" />

<EditText
android:id="@+id/DollerInINR"
android:layout_width="178dp"
android:layout_height="43dp"
android:layout_width="101dp"
android:layout_height="52dp"
android:layout_above="@+id/refreshInSeconds"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="125dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="35dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="40dp"
android:layout_marginBottom="48dp"
android:hint="Id"
android:inputType="textPersonName" />


<TextView
android:id="@+id/refreshInSeconds1"
android:layout_width="145dp"
android:layout_height="16dp"
android:layout_above="@+id/debugMode1"
android:layout_above="@+id/debugModeSwitch"
android:layout_alignParentStart="true"
android:layout_marginStart="29dp"
android:layout_marginEnd="29dp"
android:layout_marginBottom="89dp"
android:layout_marginStart="33dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="14dp"
android:layout_toStartOf="@+id/refreshInSeconds"
android:text="Refresh In Seconds"
android:textAlignment="center" />
Expand All @@ -53,38 +52,23 @@
android:id="@+id/refreshInSeconds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/debugMode"
android:layout_above="@+id/debugModeSwitch"
android:layout_alignParentEnd="true"
android:layout_marginEnd="42dp"
android:layout_marginBottom="45dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="13dp"
android:hint="Refresh In Seconds"
android:inputType="textPersonName"
android:text="" />

<TextView
android:id="@+id/debugMode1"
android:layout_width="145dp"
android:layout_height="16dp"
<Switch
android:id="@+id/debugModeSwitch"
android:layout_width="263dp"
android:layout_height="46dp"
android:layout_above="@+id/cancelPropsButton"
android:layout_alignParentStart="true"
android:layout_marginStart="26dp"
android:layout_marginEnd="37dp"
android:layout_marginBottom="142dp"
android:layout_toStartOf="@+id/debugMode"
android:text="Debug Mode"
android:textAlignment="center" />

<EditText
android:id="@+id/debugMode"
android:layout_width="166dp"
android:layout_height="wrap_content"
android:layout_above="@+id/updateAllPropsButton"
android:layout_alignParentEnd="true"
android:layout_marginEnd="37dp"
android:layout_marginBottom="130dp"
android:hint="Debug Mode"
android:inputType="textPersonName"
android:text="" />
android:layout_marginEnd="67dp"
android:layout_marginBottom="203dp"
android:text="Debug" />

<Button
android:id="@+id/cancelPropsButton"
Expand Down

0 comments on commit 705867e

Please sign in to comment.