6 Commits
Author SHA1 Message Date
stan220 4aec36f2d1 Update main.yml 2020-12-24 12:58:12 +03:00
stan220 b9d4d4224a Update main.yml 2020-12-24 12:48:51 +03:00
stan220 f0f43f3cab Update main.yml 2020-12-24 12:31:14 +03:00
stan220 eec4ad4d1c Added gradle wrapper. 2020-12-24 11:02:58 +03:00
stan220 e2cb51b382 Create main.yml 2020-12-24 11:00:08 +03:00
stan220 f17c873e8a Added sources. 2020-12-24 10:48:18 +03:00
3 changed files with 10 additions and 50 deletions
@@ -1,4 +1,4 @@
name: Android CI - Publish Apk
name: Android CI
on:
push:
@@ -10,19 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Make Gradle executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Debug APK Publisher
@@ -6,6 +6,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@@ -50,36 +51,20 @@ public class MainActivity extends AppCompatActivity {
}));
System.out.println("App started!!!");
}
@Override
protected void onResume() {
super.onResume();
System.out.println("App resumed!!!");
new DownloadFilesTask(this).execute();
}
public void onSwitchClick(View view) {
System.out.println("### switch clicked: " + view);
System.out.println("### click: " + view);
new DownloadFilesTask(this).execute((SwitchMaterial) view);
}
public void onRefreshButtonClick(View view) {
System.out.println("### refresh clicked: " + view);
new DownloadFilesTask(this).execute();
}
private static class DownloadFilesTask extends AsyncTask<SwitchMaterial, Void, List<String>> {
private MainActivity context;
public DownloadFilesTask(MainActivity context) {
context.findViewById(R.id.switchTab).setEnabled(false);
context.findViewById(R.id.switchTv).setEnabled(false);
context.findViewById(R.id.switchAlisa).setEnabled(false);
context.findViewById(R.id.button_refresh).setEnabled(false);
this.context = context;
}
@@ -87,7 +72,7 @@ public class MainActivity extends AppCompatActivity {
protected List<String> doInBackground(SwitchMaterial... switches) {
List<String> result = new ArrayList<>();
Socket s;
Socket s = null;
try {
s = new Socket(InetAddress.getByName("192.168.100.1"), 23);
@@ -185,12 +170,7 @@ public class MainActivity extends AppCompatActivity {
switchAlisa.setChecked(false);
}
context.findViewById(R.id.switchTab).setEnabled(true);
context.findViewById(R.id.switchTv).setEnabled(true);
context.findViewById(R.id.switchAlisa).setEnabled(true);
context.findViewById(R.id.button_refresh).setEnabled(true);
Toast.makeText(context, "Статус обновлён!", Toast.LENGTH_LONG).show();
Toast.makeText(context, "Состояние обновлено!", Toast.LENGTH_LONG).show();
}
}
+2 -16
View File
@@ -5,23 +5,12 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:foregroundGravity="fill"
android:orientation="vertical"
android:padding="20dp">
<Button
android:id="@+id/button_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:onClick="onRefreshButtonClick"
android:text="Обновить" />
android:orientation="vertical">
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchTab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:onClick="onSwitchClick"
android:text="Tab"
app:useMaterialThemeColors="true" />
@@ -30,7 +19,6 @@
android:id="@+id/switchTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:onClick="onSwitchClick"
android:text="TV"
app:useMaterialThemeColors="true" />
@@ -39,7 +27,6 @@
android:id="@+id/switchAlisa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:onClick="onSwitchClick"
android:text="Alisa"
app:useMaterialThemeColors="true" />
@@ -47,8 +34,7 @@
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="538dp"
android:layout_gravity="fill"
android:layout_height="586dp"
android:fadeScrollbars="false"
android:gravity="bottom"
android:isScrollContainer="true"