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);
|
||||
String bID = bike.getString("bike");
|
||||
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);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ReturnActivity extends AppCompatActivity implements AsyncTaskCallbacks<String> {
|
||||
|
|
@ -20,13 +21,24 @@ public class ReturnActivity extends AppCompatActivity implements AsyncTaskCallba
|
|||
Intent intent = getIntent();
|
||||
bikeArray = intent.getStringArrayExtra("bike");
|
||||
|
||||
Button mReturnSubmitButton = findViewById(R.id.return_submit_button);
|
||||
mReturnSubmitButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
returnRequest();
|
||||
}
|
||||
});
|
||||
//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);
|
||||
mReturnSubmitButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
returnRequest();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
void returnRequest() {
|
||||
TextView mStationInput;
|
||||
|
|
|
|||
|
|
@ -16,35 +16,46 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rent_form"
|
||||
android:id="@+id/return_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
<TextView
|
||||
android:id="@+id/gps_info"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/return_station_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_return_station_id"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/return_submit_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
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_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_return_submit"
|
||||
android:textStyle="bold" />
|
||||
android:orientation="vertical">
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/return_station_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/prompt_return_station_id"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/return_submit_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_return_submit"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue