Kaydet (Commit) 34ea1ede authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

android: show progress spinner also when switching parts

Change-Id: Ie21e71aa03eddef620d470e01daf6f1936a5d7c7
üst d885cf40
......@@ -22,7 +22,8 @@
android:id="@+id/loadingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
android:gravity="center"
android:background="#9333">
<ProgressBar
android:layout_width="wrap_content"
......
......@@ -10,7 +10,7 @@ public class LOKitShell {
public static float getDpi() {
DisplayMetrics metrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
return metrics.density * 160;
return metrics.density * 160;
}
public static void sendEvent(LOEvent event) {
......@@ -27,4 +27,22 @@ public class LOKitShell {
public static void queueRedraw() {
LOKitShell.sendEvent(LOEventFactory.redraw());
}
public static void showProgressSpinner() {
getMainHandler().post(new Runnable() {
@Override
public void run() {
LibreOfficeMainActivity.mAppContext.showProgressSpinner();
}
});
}
public static void hideProgressSpinner() {
getMainHandler().post(new Runnable() {
@Override
public void run() {
LibreOfficeMainActivity.mAppContext.hideProgressSpinner();
}
});
}
}
......@@ -55,8 +55,10 @@ public class LOKitThread extends Thread {
}
private void changePart(int partIndex) {
LOKitShell.showProgressSpinner();
mTileProvider.changePart(partIndex);
refresh();
LOKitShell.hideProgressSpinner();
}
private boolean load(String filename) {
......@@ -76,14 +78,9 @@ public class LOKitThread extends Thread {
boolean isReady = mTileProvider.isReady();
if (isReady) {
LOKitShell.showProgressSpinner();
refresh();
LOKitShell.getMainHandler().post(new Runnable() {
@Override
public void run() {
LibreOfficeMainActivity.mAppContext.hideProgressBar();
}
});
LOKitShell.hideProgressSpinner();
}
return isReady;
}
......
......@@ -199,11 +199,11 @@ public class LibreOfficeMainActivity extends Activity {
}
public void showProgressBar() {
public void showProgressSpinner() {
findViewById(R.id.loadingPanel).setVisibility(View.VISIBLE);
}
public void hideProgressBar() {
public void hideProgressSpinner() {
findViewById(R.id.loadingPanel).setVisibility(View.GONE);
}
......
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