@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences preferences; String lang; String tmp_startDir; preferences = PreferenceManager.getDefaultSharedPreferences(this); lang = preferences.getString("lang", "default"); if (lang.equals("default")) { locale = getResources().getConfiguration().locale.getDefault(); } else { locale = new Locale(lang); } Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config, null); if (N2DeviceInfo.EINK_ONYX) { tmp_startDir = preferences.getString("startDir", "/sdcard,/media/My Files"); if (tmp_startDir.equals("/sdcard,/media/My Files")) { SharedPreferences.Editor editor = preferences.edit(); editor.putString("startDir", "/mnt/storage"); editor.commit(); } tmp_startDir = preferences.getString("searchRoot", "/sdcard"); if (tmp_startDir.equals("/sdcard")) { SharedPreferences.Editor editor = preferences.edit(); editor.putString("searchRoot", "/mnt/storage"); editor.commit(); } } N2EpdController.n2MainActivity = this; app = ((ReLaunchApp) getApplicationContext()); app.RestartIntent = PendingIntent.getActivity( this, 0, getIntent(), getIntent().getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); Intent intent = new Intent(Main.this, ReLaunch.class); intent.putExtra("home", false); intent.putExtra("home1", false); intent.putExtra("shop", false); intent.putExtra("library", false); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(intent, 0); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = ((ReLaunchApp) getApplicationContext()); app.RestartIntent = PendingIntent.getActivity( this, 0, getIntent(), getIntent().getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); Intent intent = new Intent(Main.this, ReLaunch.class); intent.putExtra("home", false); intent.putExtra("home1", false); intent.putExtra("shop", false); intent.putExtra("library", false); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(intent, 0); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); app = (ReLaunchApp) getApplicationContext(); app.setFullScreenIfNecessary(this); setContentView(R.layout.viewer_layout); // Read parameters final Intent data = getIntent(); if (data.getExtras() == null) finish(); final String fname = data.getStringExtra("filename"); if (fname == null) finish(); fileName = fname; // Check file size File f = new File(fname); if (!f.exists()) finish(); final long fileSize = f.length(); if (fileSize > app.viewerMax * 1024) { AlertDialog.Builder builder = new AlertDialog.Builder(this); // "File too big" builder.setTitle(getResources().getString(R.string.jv_viewer_file_too_big)); // "File \"" + fname + "\" is too big for viewer (" + f.length() + // " bytes)\n" // + "Maximal allowed size is " + app.viewerMax + " bytes" builder.setMessage( getResources().getString(R.string.jv_viewer_file) + " \"" + fname + "\" " + getResources().getString(R.string.jv_viewer_too_big) + " (" + f.length() / 1024 + " " + getResources().getString(R.string.jv_viewer_bytes) + ")\n" + getResources().getString(R.string.jv_viewer_maximum) + " " + app.viewerMax + " " + getResources().getString(R.string.jv_viewer_bytes)); // "OK" builder.setPositiveButton( getResources().getString(R.string.app_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finish(); } }); builder.show(); } else { // Set edit button editBtn = (Button) findViewById(R.id.viewedit_btn); editBtn.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { if (fileSize > app.editorMax * 1024) { AlertDialog.Builder builder = new AlertDialog.Builder(Viewer.this); // "File too big" builder.setTitle(getResources().getString(R.string.jv_editor_file_too_big)); // "File \"" + fname + "\" is too big for editor (" + // fileSize + " bytes)" // "Maximal allowed size is " + app.editorMax + " bytes" builder.setMessage( getResources().getString(R.string.jv_editor_file) + " \"" + fname + "\" " + getResources().getString(R.string.jv_editor_too_big) + " (" + fileSize / 1024 + " " + getResources().getString(R.string.jv_editor_bytes) + "\n" + getResources().getString(R.string.jv_editor_maximum) + " " + app.editorMax + " " + getResources().getString(R.string.jv_editor_bytes)); // "OK" builder.setPositiveButton( getResources().getString(R.string.app_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) {} }); builder.show(); } else { // Start editor activity Intent intent = new Intent(Viewer.this, Editor.class); intent.putExtra("filename", fname); startActivityForResult(intent, EDITOR_ACT); } } }); // Set back button backBtn = (ImageButton) findViewById(R.id.view_btn); backBtn.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { finish(); } }); // Set title ((EditText) findViewById(R.id.view_title)).setText(fname); // Read file and set view field editTxt = (EditText) findViewById(R.id.view_txt); rereadFile(fname, editTxt); } ScreenOrientation.set(this, prefs); }
@Override protected void onResume() { super.onResume(); app.generalOnResume(TAG); }