Commit a3caf676 authored by Martin's avatar Martin

Replace snackbar with Toast

parent 9bb85d12
......@@ -15,6 +15,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONArray;
......@@ -26,7 +27,6 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
View view = getWindow().getDecorView().getRootView();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
......@@ -45,13 +45,13 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View view) {
updateCounter();
updateLog(view, -1);
updateLog(-1);
}
});
updateCounter();
updateLog(view, -1);
updateLog(-1);
}
@Override
......@@ -89,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
}
}
public void updateLog(View view, Integer num_lines) {
public void updateLog(Integer num_lines) {
GetLog log = new GetLog();
AsyncTask result = null;
try {
......@@ -110,9 +110,7 @@ public class MainActivity extends AppCompatActivity {
}
if (lines == null) {
if (view != null)
Snackbar.make(view, "Unable to get art info from server", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
Toast.makeText(getApplicationContext(), "Unable to get art info from server", Toast.LENGTH_SHORT).show();
return;
}
......
......@@ -14,6 +14,7 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
......@@ -153,8 +154,7 @@ public class NewArtActivity extends AppCompatActivity {
}
if (types == null) {
Snackbar.make(view, "Failed to get art types", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
Toast.makeText(getApplicationContext(), "Failed to get art types", Toast.LENGTH_SHORT).show();
return;
}
......@@ -192,10 +192,8 @@ public class NewArtActivity extends AppCompatActivity {
e.printStackTrace();
}
if (response.equals(""))
Snackbar.make(view, "Successfully added art!", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
Toast.makeText(getApplicationContext(), "Successfully added art!", Toast.LENGTH_SHORT).show();
else
Snackbar.make(view, "Failed to add art. (" + response + ")", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
Toast.makeText(getApplicationContext(), "Failed to add art. (" + response + ")", Toast.LENGTH_SHORT).show();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment