Skip to content

Commit

Permalink
Добавлены выподающие списки
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Safonenko authored and Daniil Safonenko committed Jul 1, 2017
1 parent ab502f3 commit cdc6e32
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 70 deletions.
35 changes: 24 additions & 11 deletions app/src/main/java/com/a1101studio/mobile_helper/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;

import com.a1101studio.mobile_helper.models.DocumentModel;
import com.a1101studio.mobile_helper.models.TopListModel;
Expand All @@ -32,8 +33,8 @@

public class MainActivity extends AppCompatActivity {
EditText ETCompanyName;
EditText ETArea;
EditText ETElectricLine;
Spinner ETArea;
Spinner ETElectricLine;
EditText ETNomination;
EditText ETTypeOfInspection;
EditText ETNumberStartInspectionSeat;
Expand Down Expand Up @@ -71,8 +72,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
protected void onStop() {
super.onStop();
documentModel.setCompanyName(ETCompanyName.getText().toString());
documentModel.setArea(ETArea.getText().toString());
documentModel.setElectricLine(ETElectricLine.getText().toString());
documentModel.setArea(ETArea.getSelectedItem().toString());
documentModel.setElectricLine(ETElectricLine.getSelectedItem().toString());
documentModel.setNomination(ETNomination.getText().toString());
documentModel.setTypeOfInspection(ETTypeOfInspection.getText().toString());
documentModel.setNumberStartInspectionSeat(ETNumberStartInspectionSeat.getText().toString());
Expand All @@ -85,11 +86,13 @@ protected void onStop() {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

documentModel=WorkData.getInstance().getDocumentModel();

ETCompanyName = (EditText) findViewById(R.id.Predpriytie);
ETArea = (EditText) findViewById(R.id.Sector);
ETElectricLine = (EditText) findViewById(R.id.Unom);
ETArea = (Spinner) findViewById(R.id.Sector);

ETElectricLine = (Spinner) findViewById(R.id.Unom);
ETNomination = (EditText) findViewById(R.id.Nazvanie);
ETTypeOfInspection = (EditText) findViewById(R.id.VID);
ETNumberStartInspectionSeat = (EditText) findViewById(R.id.OT);
Expand All @@ -100,8 +103,8 @@ protected void onCreate(Bundle savedInstanceState) {


ETCompanyName.setText(documentModel.getCompanyName());
ETArea.setText(documentModel.getArea());
ETElectricLine.setText(documentModel.getElectricLine());
setSpinText(ETArea,documentModel.getArea());
setSpinText(ETArea,documentModel.getElectricLine());
ETNomination.setText(documentModel.getNomination());
ETTypeOfInspection.setText(documentModel.getTypeOfInspection());
ETNumberStartInspectionSeat.setText(documentModel.getNumberStartInspectionSeat());
Expand All @@ -119,7 +122,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

void createPDF() {
if (ETCompanyName.getText().toString().trim().length() > 0 && ETArea.getText().toString().trim().length() > 0 && ETElectricLine.getText().toString().trim().length() > 0 && ETNomination.getText().toString().trim().length() > 0 &&
if (ETCompanyName.getText().toString().trim().length() > 0 && ETArea.getSelectedItem().toString().trim().length() > 0 && ETElectricLine.getSelectedItem().toString().trim().length() > 0 && ETNomination.getText().toString().trim().length() > 0 &&
ETTypeOfInspection.getText().toString().trim().length() > 0 && ETNumberStartInspectionSeat.getText().toString().trim().length() > 0 && ETNumberEndInspectioSeat.getText().toString().trim().length() > 0 && ETInspectorName.getText().toString().trim().length() > 0 && Prinal.getText().toString().trim().length() > 0) {
File htmlFolder = FileHelper.createOrGetFileDir(this);
if (!htmlFolder.exists()) {
Expand Down Expand Up @@ -169,8 +172,8 @@ void createPDF() {
);*/
documentModel.setCompanyName(ETCompanyName.getText().toString());
documentModel.setArea(ETArea.getText().toString());
documentModel.setElectricLine(ETElectricLine.getText().toString());
documentModel.setArea(ETArea.getSelectedItem().toString());
documentModel.setElectricLine(ETElectricLine.getSelectedItem().toString());
documentModel.setNomination(ETNomination.getText().toString());
documentModel.setTypeOfInspection(ETTypeOfInspection.getText().toString());
documentModel.setNumberStartInspectionSeat(ETNumberStartInspectionSeat.getText().toString());
Expand Down Expand Up @@ -209,7 +212,17 @@ void createPDF() {
}
}

public void setSpinText(Spinner spin, String text)
{
for(int i= 0; i < spin.getAdapter().getCount(); i++)
{
if(spin.getAdapter().getItem(i).toString().contains(text))
{
spin.setSelection(i);
}
}

}

/*void SendMail(String mailText) throws MessagingException {
final String username = "";
Expand Down
115 changes: 57 additions & 58 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
tools:context="com.a1101studio.mobile_helper.MainActivity"
android:orientation="vertical">


<ScrollView

android:layout_width="match_parent"
Expand All @@ -21,186 +22,184 @@

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:orientation="vertical">

<TextView
android:id="@+id/textView2"
style="@style/Font"
android:text="Предприятие"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView2" />
android:text="Предприятие" />

<EditText
android:id="@+id/Predpriytie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/Predpriytie" />
android:inputType="textPersonName" />

<TextView
android:id="@+id/textView3"
style="@style/Font"
android:text="Район(Участок)"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView3" />
android:text="Район(Участок)"
tools:text="Плановый" />

<EditText
style="@style/Font"
<Spinner
android:id="@+id/Sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:ems="10"
android:id="@+id/Sector" />
android:entries="@array/district"/>

<TextView
android:id="@+id/textView4"
style="@style/Font"
android:text="Воздушная линия Uном"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView4" />
android:text="Воздушная линия Uном" />

<EditText
style="@style/Font"
<Spinner
android:id="@+id/Unom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/Unom" />
android:entries="@array/unom"/>

<TextView
android:id="@+id/textView5"
style="@style/Font"
android:text="Наименование"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView5" />
android:text="Наименование" />

<EditText
android:id="@+id/Nazvanie"
style="@style/Font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/Nazvanie" />
android:inputType="textPersonName" />

<TextView
android:id="@+id/textView6"
style="@style/Font"
android:text="Вид осмотра:"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView6" />
android:text="Вид осмотра:" />

<EditText
android:id="@+id/VID"
style="@style/Font"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="text"
android:ems="10"
android:id="@+id/VID" />
android:inputType="text" />

<Button
style="@style/Font"
android:id="@+id/btnShowList"
android:text="@string/show_list"
style="@style/Font"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:text="@string/show_list" />

<LinearLayout
style="@style/Font"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_weight="1"
android:orientation="horizontal">

<TextView
android:id="@+id/textView7"
style="@style/Font"
android:text="Осмотр проведен от опоры №"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView7" />
android:text="Осмотр проведен от опоры №" />

<EditText
android:id="@+id/OT"
style="@style/Font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/OT" />
android:inputType="textPersonName" />

</LinearLayout>

<LinearLayout
style="@style/Font"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/textView8"
style="@style/Font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView8"
android:text="До опоры №" />

<EditText
android:id="@+id/DO"
style="@style/Font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:layout_weight="1"
android:ems="10"
android:id="@+id/DO"
android:layout_weight="1" />
android:inputType="textPersonName" />
</LinearLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/textView9"
style="@style/Font"
android:text="Осмотр выполнил"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView9" />
android:text="Осмотр выполнил" />

<EditText
android:id="@+id/Nameosmotr"
style="@style/Font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:layout_weight="1.74"
android:ems="10"
android:id="@+id/Nameosmotr"
android:layout_weight="1.74" />
android:inputType="textPersonName" />

</LinearLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/textView10"
style="@style/Font"
android:text="Листок осмотра принял"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView10" />
android:text="Листок осмотра принял" />

<EditText
android:id="@+id/Prinal"
style="@style/Font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:layout_weight="1"
android:ems="10"
android:id="@+id/Prinal"
android:layout_weight="1" />
android:inputType="textPersonName" />
</LinearLayout>

<Button
android:id="@+id/btnSend"
style="@style/Font"
android:text="@string/send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btnSend" />
android:text="@string/send" />
</LinearLayout>
</ScrollView>

Expand Down
13 changes: 12 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@
<string name="cancel">Закрыть</string>
<string name="fill">Заполните поле</string>
<string name="show_list">Показать список</string>

<string-array name="district">
<item>Чагинская РМС</item>
<item>Южная РМС</item>
<item>Филевская РМС</item>
<item>Бутырская РМС</item>
<item>Восточная РМС</item>
</string-array>
<string-array name="unom">
<item>35 кВ</item>
<item>110 кВ</item>
<item>220 кВ</item>
</string-array>
<array name="bold_text_array1">
<item>Опоры</item>
<item>Фундамент</item>
Expand Down

0 comments on commit cdc6e32

Please sign in to comment.