Revert D8954095: [sonar] Add SonarDiagnosticActivity to android
Differential Revision: D8954095 Original commit changeset: b4a638bc0ba2 fbshipit-source-id: 6165b7429477e80520fb0e149da1c2ef893e1d90
This commit is contained in:
committed by
Facebook Github Bot
parent
7fc7061fca
commit
fadd392349
@@ -24,8 +24,7 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.facebook.sonar.android.diagnostics.SonarDiagnosticActivity"
|
|
||||||
android:exported="true"/>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.facebook.sonar.android.diagnostics;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import com.facebook.sonar.android.AndroidSonarClient;
|
|
||||||
import com.facebook.sonar.core.SonarClient;
|
|
||||||
import com.facebook.sonar.core.SonarStateUpdateListener;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
|
|
||||||
public class SonarDiagnosticActivity extends Activity implements SonarStateUpdateListener {
|
|
||||||
|
|
||||||
private TextView textView;
|
|
||||||
private ScrollView scrollView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
LinearLayout root = new LinearLayout(this);
|
|
||||||
|
|
||||||
textView = new TextView(this);
|
|
||||||
scrollView = new ScrollView(this);
|
|
||||||
scrollView.addView(textView);
|
|
||||||
root.addView(scrollView);
|
|
||||||
|
|
||||||
setContentView(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
SonarClient client = AndroidSonarClient.getInstance(this);
|
|
||||||
client.subscribeForUpdates(this);
|
|
||||||
textView.setText(client.getState());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
scrollView.fullScroll(View.FOCUS_DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate() {
|
|
||||||
final Context context = this;
|
|
||||||
final String state = AndroidSonarClient.getInstance(context).getState();
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
textView.setText(state);
|
|
||||||
scrollView.fullScroll(View.FOCUS_DOWN);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
SonarClient client = AndroidSonarClient.getInstance(this);
|
|
||||||
client.unsubscribe();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user