Skip to content

Commit

Permalink
Fix Checkstyle violations
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Jun 10, 2015
1 parent 0f2115c commit 13c52e0
Show file tree
Hide file tree
Showing 23 changed files with 495 additions and 575 deletions.
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@
<system>jira</system>
</issueManagement>

<properties>
<!-- delete license.skip and checkstyle.skip once you have resolved all reported issues -->
<checkstyle.skip>true</checkstyle.skip>
</properties>

<build>
<plugins>
<plugin>
Expand Down
41 changes: 16 additions & 25 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,29 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.hawkular.client.android"
android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.hawkular.client.android"
android:installLocation="auto">

<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:name=".HawkularApplication"
android:label="@string/application_name"
android:theme="@style/Theme.Hawkular">
<application android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:name=".HawkularApplication"
android:label="@string/application_name" android:theme="@style/Theme.Hawkular">

<activity
android:name=".activity.LauncherActivity">
<activity android:name=".activity.LauncherActivity">

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
</activity>

<activity
android:name=".activity.ResourceTypesActivity">
</activity>
<activity android:name=".activity.ResourceTypesActivity">
</activity>

<service
android:name="org.jboss.aerogear.android.authorization.oauth2.OAuth2AuthzService">
</service>
<service android:name="org.jboss.aerogear.android.authorization.oauth2.OAuth2AuthzService">
</service>

</application>
</application>

</manifest>
35 changes: 17 additions & 18 deletions src/main/java/org/hawkular/client/android/HawkularApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,24 @@

import timber.log.Timber;

public class HawkularApplication extends Application
{
@Override
public void onCreate() {
super.onCreate();
public class HawkularApplication extends Application {
@Override
public void onCreate() {
super.onCreate();

setUpLogging();
setUpDetections();
}
setUpLogging();
setUpDetections();
}

private void setUpLogging() {
if (Android.isDebugging()) {
Timber.plant(new Timber.DebugTree());
}
}
private void setUpLogging() {
if (Android.isDebugging()) {
Timber.plant(new Timber.DebugTree());
}
}

private void setUpDetections() {
if (Android.isDebugging()) {
StrictMode.enableDefaults();
}
}
private void setUpDetections() {
if (Android.isDebugging()) {
StrictMode.enableDefaults();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,98 +39,96 @@
import butterknife.OnClick;
import timber.log.Timber;

public final class LauncherActivity extends AppCompatActivity implements Callback<String>
{
@InjectView(R.id.toolbar)
Toolbar toolbar;
public final class LauncherActivity extends AppCompatActivity implements Callback<String> {
@InjectView(R.id.toolbar)
Toolbar toolbar;

@InjectView(R.id.edit_server)
EditText serverEdit;
@InjectView(R.id.edit_server)
EditText serverEdit;

@Override
protected void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.activity_launcher);
@Override
protected void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.activity_launcher);

setUpBindings();
setUpBindings();

setUpToolbar();
setUpToolbar();

setUpServerUrl();
}
setUpServerUrl();
}

private void setUpBindings() {
ButterKnife.inject(this);
}
private void setUpBindings() {
ButterKnife.inject(this);
}

private void setUpToolbar() {
setSupportActionBar(toolbar);
}
private void setUpToolbar() {
setSupportActionBar(toolbar);
}

private void setUpServerUrl() {
serverEdit.setText(BackendEndpoints.COMMUNITY);
}
private void setUpServerUrl() {
serverEdit.setText(BackendEndpoints.COMMUNITY);
}

@OnClick(R.id.button_fetch_tenants)
public void setUpContent() {
setUpClient();
@OnClick(R.id.button_fetch_tenants)
public void setUpContent() {
setUpClient();

setUpAuthorization();
}
setUpAuthorization();
}

private void setUpClient() {
BackendClient.getInstance().setServerUrl(getServerUrl());
}
private void setUpClient() {
BackendClient.getInstance().setServerUrl(getServerUrl());
}

private String getServerUrl() {
return serverEdit.getText().toString().trim();
}
private String getServerUrl() {
return serverEdit.getText().toString().trim();
}

private void setUpAuthorization() {
if (!BackendClient.getInstance().isAuthorized()) {
BackendClient.getInstance().authorize(this, this);
} else {
setUpTenants();
}
}
private void setUpAuthorization() {
if (!BackendClient.getInstance().isAuthorized()) {
BackendClient.getInstance().authorize(this, this);
} else {
setUpTenants();
}
}

@Override
public void onSuccess(String authorizationResult) {
Timber.d("Authorization :: Success!");
@Override
public void onSuccess(String authorizationResult) {
Timber.d("Authorization :: Success!");

setUpTenants();
}
setUpTenants();
}

@Override
public void onFailure(Exception authenticationException) {
Timber.d(authenticationException, "Authorization :: Failure...");
}
@Override
public void onFailure(Exception authenticationException) {
Timber.d(authenticationException, "Authorization :: Failure...");
}

private void setUpTenants() {
LoaderPipe<Tenant> tenantsPipe = BackendClient.getInstance().getPipe(BackendPipes.Names.TENANTS, this);
private void setUpTenants() {
LoaderPipe<Tenant> tenantsPipe = BackendClient.getInstance().getPipe(BackendPipes.Names.TENANTS, this);

tenantsPipe.read(new TenantsCallback());
}
tenantsPipe.read(new TenantsCallback());
}

private void startResourceTypesActivity(Tenant tenant) {
Intent intent = Intents.Builder.of(this).buildResourceTypesIntent(tenant);
startActivity(intent);
}
private void startResourceTypesActivity(Tenant tenant) {
Intent intent = Intents.Builder.of(this).buildResourceTypesIntent(tenant);
startActivity(intent);
}

private static final class TenantsCallback extends AbstractActivityCallback<List<Tenant>>
{
@Override
public void onSuccess(List<Tenant> tenants) {
Timber.d("Tenants :: Success!");
private static final class TenantsCallback extends AbstractActivityCallback<List<Tenant>> {
@Override
public void onSuccess(List<Tenant> tenants) {
Timber.d("Tenants :: Success!");

LauncherActivity activity = (LauncherActivity) getActivity();
LauncherActivity activity = (LauncherActivity) getActivity();

activity.startResourceTypesActivity(tenants.get(0));
}
activity.startResourceTypesActivity(tenants.get(0));
}

@Override
public void onFailure(Exception e) {
Timber.d("Tenants :: Failure...");
}
}
@Override
public void onFailure(Exception e) {
Timber.d("Tenants :: Failure...");
}
}
}

0 comments on commit 13c52e0

Please sign in to comment.