add support for electric lock && gps tracked
This commit is contained in:
parent
a70c909090
commit
090e9aa8cb
3 changed files with 55 additions and 30 deletions
|
|
@ -153,7 +153,9 @@ public class MainActivity extends AppCompatActivity implements AsyncTaskCallback
|
||||||
JSONObject bike = bikesArray.getJSONObject(position);
|
JSONObject bike = bikesArray.getJSONObject(position);
|
||||||
String bID = bike.getString("bike");
|
String bID = bike.getString("bike");
|
||||||
String stID = bike.getString("start_place");
|
String stID = bike.getString("start_place");
|
||||||
String[] bikeArray = {bID, stID};
|
String lockE = bike.getString("electric_lock");
|
||||||
|
String gps = bike.getString("gps_tracking");
|
||||||
|
String[] bikeArray = {bID, stID, lockE, gps};
|
||||||
intent.putExtra("bike", bikeArray);
|
intent.putExtra("bike", bikeArray);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class ReturnActivity extends AppCompatActivity implements AsyncTaskCallbacks<String> {
|
public class ReturnActivity extends AppCompatActivity implements AsyncTaskCallbacks<String> {
|
||||||
|
|
@ -20,6 +21,16 @@ public class ReturnActivity extends AppCompatActivity implements AsyncTaskCallba
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
bikeArray = intent.getStringArrayExtra("bike");
|
bikeArray = intent.getStringArrayExtra("bike");
|
||||||
|
|
||||||
|
//if GPS and electric lock, show the instruction
|
||||||
|
TextView tv = findViewById(R.id.gps_info);
|
||||||
|
LinearLayout la = findViewById(R.id.return_form_container);
|
||||||
|
if(bikeArray[2].equals("true") && bikeArray[3].equals("true")) {
|
||||||
|
tv.setVisibility(View.VISIBLE);
|
||||||
|
la.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
la.setVisibility(View.VISIBLE);
|
||||||
|
tv.setVisibility(View.INVISIBLE);
|
||||||
Button mReturnSubmitButton = findViewById(R.id.return_submit_button);
|
Button mReturnSubmitButton = findViewById(R.id.return_submit_button);
|
||||||
mReturnSubmitButton.setOnClickListener(new View.OnClickListener() {
|
mReturnSubmitButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -28,6 +39,7 @@ public class ReturnActivity extends AppCompatActivity implements AsyncTaskCallba
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void returnRequest() {
|
void returnRequest() {
|
||||||
TextView mStationInput;
|
TextView mStationInput;
|
||||||
mStationInput = findViewById(R.id.return_station_id);
|
mStationInput = findViewById(R.id.return_station_id);
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,22 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/rent_form"
|
android:id="@+id/return_form"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/gps_info"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/indicator_electronic_gps_lock" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/return_form_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
@ -44,7 +55,7 @@
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/action_return_submit"
|
android:text="@string/action_return_submit"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue