added red toast if no text editor is available
This commit is contained in:
parent
8cf387a79f
commit
be7528121d
@ -2,6 +2,7 @@ package com.example.aped;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -10,7 +11,9 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.example.aped.communication.Communicator;
|
import com.example.aped.communication.Communicator;
|
||||||
import com.example.aped.utils.ConfigurationHandler;
|
import com.example.aped.utils.ConfigurationHandler;
|
||||||
@ -171,8 +174,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.action_adjust_xml:
|
case R.id.action_adjust_xml:
|
||||||
Toast.makeText(this, "Adjust .xml",
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
String externalPrivateStorageDir = null;
|
String externalPrivateStorageDir = null;
|
||||||
try {
|
try {
|
||||||
externalPrivateStorageDir = ExternalStorageHandler.
|
externalPrivateStorageDir = ExternalStorageHandler.
|
||||||
@ -191,7 +192,20 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
intent.setDataAndType(uri, "text/xml");
|
intent.setDataAndType(uri, "text/xml");
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
startActivity(intent);
|
//try to launch a text editor
|
||||||
|
try {
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast toast = new Toast(this);
|
||||||
|
View toastView = getLayoutInflater().inflate(R.layout.
|
||||||
|
volley_toast, (ViewGroup) findViewById(R.id.
|
||||||
|
volleyToastContainer));
|
||||||
|
TextView textView = toastView.findViewById(R.id.text);
|
||||||
|
textView.setText("NO TEXTEDITOR AVAILABLE!");
|
||||||
|
toast.setDuration(Toast.LENGTH_LONG);
|
||||||
|
toast.setView(toastView);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.action_download_xml:
|
case R.id.action_download_xml:
|
||||||
@ -212,9 +226,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case R.id.action_update:
|
case R.id.action_update:
|
||||||
Intent intentneustart = getIntent();
|
Intent restartIntent = getIntent();
|
||||||
finish();
|
finish();
|
||||||
startActivity(intentneustart);
|
startActivity(restartIntent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -356,14 +370,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return favorite;
|
return favorite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter method for favorite.
|
|
||||||
* @param pFavorite set.
|
|
||||||
*/
|
|
||||||
public void setFavorite(final IFAVORITES pFavorite) {
|
|
||||||
this.favorite = pFavorite;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter method for xml.
|
* Getter method for xml.
|
||||||
* @return xml get.
|
* @return xml get.
|
||||||
@ -388,14 +394,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return delivery;
|
return delivery;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter method for delivery.
|
|
||||||
* @param pDelivery set.
|
|
||||||
*/
|
|
||||||
public void setDelivery(final Communicator pDelivery) {
|
|
||||||
this.delivery = pDelivery;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter method for configurationHandler.
|
* Getter method for configurationHandler.
|
||||||
* @return configurationHandler get.
|
* @return configurationHandler get.
|
||||||
@ -403,13 +401,4 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
public ConfigurationHandler getConfigurationHandler() {
|
public ConfigurationHandler getConfigurationHandler() {
|
||||||
return configurationHandler;
|
return configurationHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter method for configurationHandler.
|
|
||||||
* @param pConfigurationHandler set.
|
|
||||||
*/
|
|
||||||
public void setConfigurationHandler(final ConfigurationHandler
|
|
||||||
pConfigurationHandler) {
|
|
||||||
this.configurationHandler = pConfigurationHandler;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user