Added incidents and made some strings translatable
This commit is contained in:
parent
1e91699909
commit
bf12408e3c
Binary file not shown.
|
@ -59,6 +59,10 @@
|
|||
<activity
|
||||
android:name=".ui.StateActivity"
|
||||
android:label="@string/title_activity_state"
|
||||
android:theme="@style/DisTheme" />
|
||||
<activity
|
||||
android:name=".ui.Tabbed_state"
|
||||
android:label="@string/title_activity_tabbed_state"
|
||||
android:theme="@style/DisTheme"></activity>
|
||||
</application>
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public class StateActivity extends AppCompatActivity {
|
|||
// URL to get data JSON
|
||||
static String url = "https://state.disroot.org/api/v1/components";
|
||||
static String url1 = "https://state.disroot.org/api/v1/components?page=2";
|
||||
static String incidenturl0 ="https://state.disroot.org/api/v1/incidents?sort=id&order=desc";
|
||||
|
||||
ArrayList<HashMap<String, String>> stateList;
|
||||
|
||||
|
@ -71,7 +72,7 @@ public class StateActivity extends AppCompatActivity {
|
|||
super.onPreExecute();
|
||||
// Showing progress dialog
|
||||
pDialog = new ProgressDialog(StateActivity.this);
|
||||
pDialog.setMessage("Please wait...");
|
||||
pDialog.setMessage("Loading…");
|
||||
pDialog.setCancelable(false);
|
||||
pDialog.show();
|
||||
}
|
||||
|
@ -83,6 +84,7 @@ public class StateActivity extends AppCompatActivity {
|
|||
// Making a request to url and getting response
|
||||
String jsonStr0 = sh.makeServiceCall(url);
|
||||
String jsonStr1 = sh.makeServiceCall(url1);
|
||||
String jsonStrincidents0 = sh.makeServiceCall(incidenturl0);
|
||||
|
||||
Log.e(TAG, "Response from url: " + jsonStr0);
|
||||
|
||||
|
@ -101,7 +103,7 @@ public class StateActivity extends AppCompatActivity {
|
|||
String name = c.getString("name");
|
||||
String description = c.getString("description");
|
||||
String updated_at = c.getString("updated_at");
|
||||
String lastUpdated = "Last updated: " + updated_at;
|
||||
String lastUpdated = "Last Updated: " + updated_at;
|
||||
String status_name = c.getString("status_name");
|
||||
|
||||
// tmp hash map for single service
|
||||
|
@ -144,6 +146,7 @@ public class StateActivity extends AppCompatActivity {
|
|||
String name = c.getString("name");
|
||||
String description = c.getString("description");
|
||||
String updated_at = c.getString("updated_at");
|
||||
String lastUpdated = "Last updated: " + updated_at;
|
||||
String status_name = c.getString("status_name");
|
||||
|
||||
// tmp hash map for single service
|
||||
|
@ -153,7 +156,7 @@ public class StateActivity extends AppCompatActivity {
|
|||
service.put("id", id);
|
||||
service.put("name", name);
|
||||
service.put("description", description);
|
||||
service.put("updated_at", updated_at);
|
||||
service.put("updated_at", lastUpdated);
|
||||
service.put("status_name", status_name);
|
||||
|
||||
// adding service to service list
|
||||
|
@ -171,7 +174,52 @@ public class StateActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
} if (jsonStrincidents0 != null) {//Incidaetnts page
|
||||
try {
|
||||
JSONObject jsonObj = new JSONObject(jsonStrincidents0);
|
||||
|
||||
// Getting JSON Array node
|
||||
JSONArray data = jsonObj.getJSONArray("data");
|
||||
|
||||
// looping through All data
|
||||
for (int i = 0; i < data.length(); i++) {
|
||||
JSONObject c = data.getJSONObject(i);
|
||||
|
||||
String id = c.getString("id");
|
||||
String name = c.getString("name");
|
||||
String message = c.getString("message");
|
||||
String scheduled_at = c.getString("scheduled_at");
|
||||
String updated_at = c.getString("updated_at");
|
||||
String lastUpdated = "Last Updated: " + updated_at;
|
||||
String human_status = c.getString("human_status");
|
||||
|
||||
// tmp hash map for single service
|
||||
HashMap<String, String> service = new HashMap<>();
|
||||
|
||||
// adding each child node to HashMap key => value
|
||||
service.put("id", id);
|
||||
service.put("name", name);
|
||||
service.put("message", message);
|
||||
service.put("scheduled_at", scheduled_at);
|
||||
service.put("updated_at", lastUpdated);
|
||||
service.put("human_status", human_status);
|
||||
|
||||
// adding service to service list
|
||||
stateList.add(service);
|
||||
}
|
||||
} catch (final JSONException e) {
|
||||
Log.e(TAG, "Json parsing error: " + e.getMessage());
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
"Json parsing error: " + e.getMessage(),
|
||||
Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}else {
|
||||
Log.e(TAG, "Couldn't get json from server.");
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
@ -196,27 +244,83 @@ public class StateActivity extends AppCompatActivity {
|
|||
//Updating parsed JSON data into ListView
|
||||
ListAdapter adapter = new SimpleAdapter(
|
||||
StateActivity.this, stateList,
|
||||
R.layout.list_item, new String[]{"name", "description", "updated_at",
|
||||
"status_name"}, new int[]{R.id.name,
|
||||
R.id.description,R.id.updated_at, R.id.status_name})
|
||||
R.layout.list_item, new String[]{"name","message", "description", "updated_at", "scheduled_at",
|
||||
"status_name", "human_status"}, new int[]{R.id.name, R.id.message,
|
||||
R.id.description,R.id.updated_at, R.id.scheduled_at, R.id.status_name, R.id.human_status})
|
||||
|
||||
//Change Color based on Status
|
||||
{
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = super.getView(position, convertView, parent);
|
||||
//Name Email
|
||||
TextView nameMail = v.findViewById(R.id.name);
|
||||
String nameMailValue = nameMail.getText().toString();
|
||||
switch (nameMailValue) {
|
||||
case "Email Service":
|
||||
nameMail.setText(R.string.EmailService);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//Name WebMail
|
||||
TextView nameWebmail = v.findViewById(R.id.name);
|
||||
String nameWebmailValue = nameWebmail.getText().toString();
|
||||
switch (nameWebmailValue) {
|
||||
case "WebMail Service":
|
||||
nameWebmail.setText(R.string.WebmailService);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//Name Cloud
|
||||
TextView nameCloud = v.findViewById(R.id.name);
|
||||
String nameCloudValue = nameCloud.getText().toString();
|
||||
switch (nameCloudValue) {
|
||||
case "WebMail Service":
|
||||
nameCloud.setText(R.string.Cloud);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//Make Last updated translatable
|
||||
TextView updated = v.findViewById(R.id.updated_at);
|
||||
String updatedValue = updated.getText().toString();
|
||||
if (updatedValue.startsWith("Last Updated: ")){
|
||||
updated.setText(updatedValue.replace("Last Updated: ",getText(R.string.LastUpdated)));
|
||||
}
|
||||
//Status
|
||||
TextView status = v.findViewById(R.id.status_name);
|
||||
String statusValue = status.getText().toString();
|
||||
switch (statusValue) {
|
||||
case "Operational":
|
||||
status.setTextColor(Color.GREEN);
|
||||
status.setText(R.string.Operational);
|
||||
break;
|
||||
case "Major Outage":
|
||||
status.setTextColor(Color.RED);
|
||||
status.setText(R.string.MajorOutage);
|
||||
break;
|
||||
default:
|
||||
case "Performance Issues":
|
||||
status.setText(R.string.PerformanceIssues);
|
||||
status.setTextColor(Color.YELLOW);
|
||||
break;
|
||||
}//Human_status
|
||||
TextView humanStatus = v.findViewById(R.id.human_status);
|
||||
String humanStatusValue = humanStatus.getText().toString();
|
||||
switch (humanStatusValue) {
|
||||
case "Fixed":
|
||||
case "Scheduled":
|
||||
humanStatus.setTextColor(Color.GREEN);
|
||||
break;
|
||||
case "Investigating":
|
||||
case "Watching":
|
||||
humanStatus.setTextColor(Color.YELLOW);
|
||||
|
||||
break;
|
||||
case "Identified":
|
||||
humanStatus.setTextColor(Color.RED);
|
||||
break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ public class Constants {
|
|||
public static final long SPLASH_SCREEN_DURATION = 3000;
|
||||
public static final long SPLASH_SCREEN_INTERVAL = 1000;
|
||||
|
||||
|
||||
public static final String title_activity_state = "StateActivity";
|
||||
public static final String URL_DisApp_FORUM = "https://forum.disroot.org/";
|
||||
public static final String URL_DisApp_CALC = "https://calc.disroot.org";
|
||||
public static final String URL_DisApp_BIN = "https://bin.disroot.org";
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -35,4 +35,23 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textColor="#49e13f"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/scheduled_at"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/human_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -136,5 +136,13 @@
|
|||
<string name="CloudDialog">Para continuar, primero necesitas instalar la app de Nextcloud.\nPor favor, selecciona Instalar para continuar desde F-Droid.</string>
|
||||
<string name="ChatDialog">Para continuar, primero necesitas instalar Conversations.\nPor favor, selecciona Instalar para continuar desde F-Droid.</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="Operational">Operational</string>
|
||||
<string name="MajorOutage">Major Outage</string>
|
||||
<string name="EmailService">Email Service</string>
|
||||
<string name="LastUpdated">Last updated: \</string>
|
||||
<string name="WebmailService">WebMail Service</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Performance Issues</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
</resources>
|
||||
|
|
|
@ -165,5 +165,13 @@
|
|||
<string name="CloudDialog">Pour continuer, vous devez d\'abord installer l\'application Nextcloud.\nVeuillez sélectionner Installer pour continuer l\'installation avec F-Droid.</string>
|
||||
<string name="ChatDialog">Pour continuer, vous devez d\'abord installer Conversations.\nVeuillez sélectionner Installer pour continuer l\'installation avec F-Droid.</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="Operational">Operational</string>
|
||||
<string name="MajorOutage">Major Outage</string>
|
||||
<string name="EmailService">Email Service</string>
|
||||
<string name="LastUpdated">Last updated: \</string>
|
||||
<string name="WebmailService">WebMail Service</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Performance Issues</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
</resources>
|
||||
|
|
|
@ -134,6 +134,14 @@
|
|||
<string name="MailDialog">Per continuare è necessario installare K9-Mail.\nSelezionate installa per continuare con l\'installazione su F-Droid.</string>
|
||||
<string name="CloudDialog">Per continuare è necessario installare la app di Nextcloud.\nSelezionate installa per continuare con l\'installazione su F-Droid.</string>
|
||||
<string name="ChatDialog">Per continuare è necessario installare Conversations.\nSelezionate installa per continuare con l\'installazione su F-Droid.</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="app_state">Stato Disroot</string>
|
||||
<string name="Operational">Operazionale</string>
|
||||
<string name="MajorOutage">Grave interruzione del servizio</string>
|
||||
<string name="EmailService">Servizio Email</string>
|
||||
<string name="LastUpdated">Ultimo aggiornamento: \</string>
|
||||
<string name="WebmailService">Servizio WebMail</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Problemi di performanza</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
</resources>
|
||||
|
|
|
@ -135,6 +135,14 @@
|
|||
<string name="MailDialog">Om verder te gaan moet u eerst K9-Mail installeren.\nSelecteer Installeren om verder te gaan met de installatie op F-Droid.</string>
|
||||
<string name="CloudDialog">Om verder te gaan moet u eerst Nextcloud app installeren.\nSelecteer Installeren om verder te gaan met de installatie op F-Droid.</string>
|
||||
<string name="ChatDialog">Om verder te gaan moet u eerst Conversations installeren.\nSelecteer Installeren om verder te gaan met de installatie op F-Droid.</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="app_state">Disroot status</string>
|
||||
<string name="Operational">Operationeel</string>
|
||||
<string name="MajorOutage">Ernstige storing</string>
|
||||
<string name="EmailService">Email Service</string>
|
||||
<string name="LastUpdated">"Laatst geupdate: \"</string>
|
||||
<string name="WebmailService">WebMail Service</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Prestatieproblemen</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
</resources>
|
||||
|
|
|
@ -135,5 +135,13 @@
|
|||
<string name="CloudDialog">To continue you need to install the Nextcloud app first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="ChatDialog">To continue you need to install Conversations first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="Operational">Operational</string>
|
||||
<string name="MajorOutage">Major Outage</string>
|
||||
<string name="EmailService">Email Service</string>
|
||||
<string name="LastUpdated">Last updated: \</string>
|
||||
<string name="WebmailService">WebMail Service</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Performance Issues</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
</resources>
|
||||
|
|
|
@ -136,5 +136,13 @@
|
|||
<string name="CloudDialog">To continue you need to install the Nextcloud app first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="ChatDialog">To continue you need to install Conversations first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="Operational">Operational</string>
|
||||
<string name="MajorOutage">Major Outage</string>
|
||||
<string name="EmailService">Email Service</string>
|
||||
<string name="LastUpdated">Last updated: \</string>
|
||||
<string name="WebmailService">WebMail Service</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Performance Issues</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
</resources>
|
||||
|
|
|
@ -134,7 +134,18 @@
|
|||
<string name="MailDialog">To continue you need to install K9-Mail first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="CloudDialog">To continue you need to install the Nextcloud app first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="ChatDialog">To continue you need to install Conversations first.\nPlease select install to continue with the installatin on F-Droid.</string>
|
||||
<string name="title_activity_state">StateActivity</string>
|
||||
<string name="title_activity_state" translatable="false">StateActivity</string>
|
||||
<string name="app_state">Disroot state</string>
|
||||
|
||||
<string name="Operational">Operational</string>
|
||||
<string name="MajorOutage">Major Outage</string>
|
||||
<string name="EmailService">Email Service</string>
|
||||
<string name="LastUpdated">"Last updated: "</string>
|
||||
<string name="WebmailService">WebMail Service</string>
|
||||
<string name="Cloud">Cloud</string>
|
||||
<string name="PerformanceIssues">Performance Issues</string>
|
||||
<string name="Notification">No issues</string>
|
||||
<string name="Notificationissues">Some systems are experiencing issues</string>
|
||||
<string name="title_activity_main2">Main2Activity</string>
|
||||
<string name="section_format">Hello World from section: %1$d</string>
|
||||
<string name="title_activity_tabbed_state">tabbed_state</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue