Skip to content

Commit

Permalink
ArenaControl
Browse files Browse the repository at this point in the history
  • Loading branch information
sashaqwert committed Mar 12, 2018
1 parent 6bdeb1c commit b4dcf04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "ru.sccraft.arenacontrol"
minSdkVersion 17
targetSdkVersion 27
versionCode 38
versionName "0.21"
versionCode 39
versionName "0.22"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
14 changes: 10 additions & 4 deletions app/src/main/java/ru/sccraft/arenacontrol/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ protected Boolean doInBackground(Void... voids) {
try {
API_ответ ответ = gson.fromJson(JSON, API_ответ.class);
return ответ.успех();
} catch (JsonSyntaxException e) {
} catch (NullPointerException e) {
e.printStackTrace();
return false;
}
Expand All @@ -334,6 +334,8 @@ protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
if (aBoolean) {
операция_завершена.успешно();
} else {
операция_завершена.ошибка();
}
}
}
Expand All @@ -358,7 +360,7 @@ protected Boolean doInBackground(Void... voids) {
try {
API_ответ ответ = gson.fromJson(JSON, API_ответ.class);
return ответ.успех();
} catch (JsonSyntaxException e) {
} catch (NullPointerException e) {
e.printStackTrace();
return false;
}
Expand All @@ -369,6 +371,8 @@ protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
if (aBoolean) {
операция_завершена.успешно();
} else {
операция_завершена.ошибка();
}
}
}
Expand All @@ -393,7 +397,7 @@ protected Boolean doInBackground(Void... voids) {
try {
API_ответ ответ = gson.fromJson(JSON, API_ответ.class);
return ответ.успех();
} catch (JsonSyntaxException e) {
} catch (NullPointerException e) {
e.printStackTrace();
return false;
}
Expand All @@ -404,14 +408,16 @@ protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
if (aBoolean) {
операция_завершена.успешно();
} else {
операция_завершена.ошибка();
}
}
}
Поток поток = new Поток();
поток.execute();
}

public static interface Операция_завершена {
public interface Операция_завершена {
public void успешно();
public void ошибка();
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/ru/sccraft/arenacontrol/ServerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ protected void onCreate(Bundle savedInstanceState) {
} else {
adView.setVisibility(View.GONE);
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
Expand Down Expand Up @@ -338,6 +337,7 @@ public void onClick(View v) {

@Override
public void ошибка() {
Toast.makeText(rootView.getContext().getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show();
}
});
s.обновить();
Expand All @@ -360,6 +360,7 @@ public void onClick(View v) {

@Override
public void ошибка() {
Toast.makeText(rootView.getContext().getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show();
}
});
}
Expand All @@ -381,7 +382,7 @@ public void onClick(View v) {

@Override
public void ошибка() {

Toast.makeText(rootView.getContext().getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show();
}
});
}
Expand Down

0 comments on commit b4dcf04

Please sign in to comment.