Kaydet (Commit) 116fd062 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

android: disable reinitialization on orientation change or resume

Change-Id: Ia87f27395acdf35a50d37212106674e9f9f34c0d
üst 966fe14a
......@@ -19,7 +19,8 @@
android:theme="@style/AppTheme">
<activity
android:name="org.libreoffice.LibreOfficeMainActivity"
android:label="@string/app_name" >
android:label="@string/app_name"
android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
......
......@@ -82,11 +82,12 @@ public class LibreOfficeMainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
mAppContext = this;
mMainHandler = new Handler();
super.onCreate(savedInstanceState);
if (mMainHandler == null) {
mMainHandler = new Handler();
}
String inputFile;
if (getIntent().getData() != null) {
......@@ -100,13 +101,20 @@ public class LibreOfficeMainActivity extends Activity {
getActionBar().setDisplayHomeAsUpEnabled(false);
getActionBar().setHomeButtonEnabled(false);
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
if (mGeckoLayout == null) {
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
}
if (mDrawerLayout == null) {
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
}
if (mDocumentPartViewListAdpater == null) {
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDocumentPartViewListAdpater = new DocumentPartViewListAdpater(this, R.layout.document_part_list_layout, mDocumentPartView);
mDrawerList.setAdapter(mDocumentPartViewListAdpater);
mDrawerList.setOnItemClickListener(new DocumentPartClickListener());
mDocumentPartViewListAdpater = new DocumentPartViewListAdpater(this, R.layout.document_part_list_layout, mDocumentPartView);
mDrawerList.setAdapter(mDocumentPartViewListAdpater);
mDrawerList.setOnItemClickListener(new DocumentPartClickListener());
}
if (mLayerController == null) {
mLayerController = new LayerController(this);
......@@ -119,28 +127,23 @@ public class LibreOfficeMainActivity extends Activity {
mGeckoLayout.addView(mLayerController.getView(), 0);
}
sLOKitThread = new LOKitThread(inputFile);
sLOKitThread.start();
if (sLOKitThread == null) {
sLOKitThread = new LOKitThread(inputFile);
sLOKitThread.start();
}
Log.w(LOGTAG, "UI almost up");
}
private class DocumentPartClickListener implements android.widget.AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DocumentPartView partView = mDocumentPartViewListAdpater.getItem(position);
LOKitShell.sendEvent(LOEvent.changePart(partView.getPartIndex()));
mDrawerLayout.closeDrawer(mDrawerList);
}
}
@Override
protected void onResume() {
Log.i(LOGTAG, "Resume..");
super.onResume();
}
@Override
protected void onPause() {
Log.i(LOGTAG, "Pause..");
super.onPause();
}
......@@ -151,9 +154,19 @@ public class LibreOfficeMainActivity extends Activity {
public List<DocumentPartView> getDocumentPartView() {
return mDocumentPartView;
}
public DocumentPartViewListAdpater getDocumentPartViewListAdpater() {
return mDocumentPartViewListAdpater;
}
private class DocumentPartClickListener implements android.widget.AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DocumentPartView partView = mDocumentPartViewListAdpater.getItem(position);
LOKitShell.sendEvent(LOEvent.changePart(partView.getPartIndex()));
mDrawerLayout.closeDrawer(mDrawerList);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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