diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-07-29 19:52:37 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-07-29 19:52:37 +0200 |
commit | 94933e21cd08c53a23e5ec6c12bc1dc383b1f3ce (patch) | |
tree | 4fa096547d0917f603252c9a279e4208ba4ef711 /src/main/java/eu/siacs/conversations/ui/startUI.java | |
parent | 50889004f3c679387d95ba9c49a53a8f882ba33c (diff) |
changed package id inside manifest and project
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/startUI.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/startUI.java | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/startUI.java b/src/main/java/eu/siacs/conversations/ui/startUI.java deleted file mode 100644 index e33e75401..000000000 --- a/src/main/java/eu/siacs/conversations/ui/startUI.java +++ /dev/null @@ -1,109 +0,0 @@ -package eu.siacs.conversations.ui; - -import android.Manifest; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.res.Configuration; -import android.net.Uri; -import android.os.Bundle; -import android.provider.Settings; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.util.Log; - -import java.util.List; - -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; -import pub.devrel.easypermissions.AfterPermissionGranted; -import pub.devrel.easypermissions.EasyPermissions; - -public class StartUI extends AppCompatActivity - implements EasyPermissions.PermissionCallbacks { - - private static final int NeededPermissions = 1000; - - String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - }; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_start_ui); - requestNeededPermissions(); - } - - @AfterPermissionGranted(NeededPermissions) - private void requestNeededPermissions() { - String PREFS_NAME = "FirstStart"; - SharedPreferences FirstStart = getApplicationContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); - long FirstStartTime = FirstStart.getLong("FirstStart", 0); - if (EasyPermissions.hasPermissions(this, perms)) { - // Already have permission, start ConversationsActivity - Log.d(Config.LOGTAG, "All permissions granted, starting "+getString(R.string.app_name) + "(" +FirstStartTime + ")"); - Intent intent = new Intent (this, ConversationActivity.class); - intent.putExtra("FirstStart", FirstStartTime); - startActivity(intent); - finish(); - } else { - // set first start to 0 if there are permissions to request - Log.d(Config.LOGTAG, "Requesting required permissions"); - SharedPreferences.Editor editor = FirstStart.edit(); - editor.putLong("FirstStart", 0); - editor.commit(); - // Do not have permissions, request them now - EasyPermissions.requestPermissions(this, getString(R.string.request_permissions_message), - NeededPermissions, perms); - } - } - - - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - // Forward results to EasyPermissions - EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this); - } - - @Override - public void onPermissionsGranted(int requestCode, List<String> list) { - Log.d(Config.LOGTAG, "Permissions granted:" + requestCode); - } - - @Override - public void onPermissionsDenied(int requestCode, List<String> list) { - Log.d(Config.LOGTAG, "Permissions denied:" + requestCode); - AlertDialog dialog = new AlertDialog.Builder(this) - .setMessage(getString(R.string.request_permissions_message_again)) - .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); - Uri uri = Uri.fromParts("package", getPackageName(), null); - intent.setData(uri); - startActivity(intent); - } - }) - .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - finish(); - } - }) - .create(); - dialog.show(); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - } -}
\ No newline at end of file |