Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lint warnings/errors #66

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android-maps-extensions-demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tasks.withType(JavaCompile) {
def isCI = System.env.CI == "true"

ext {
localBuildToolsVersion = project.hasProperty("AME_BUILD_TOOLS_VERSION") ? AME_BUILD_TOOLS_VERSION : '25.0.2'
localBuildToolsVersion = project.hasProperty("AME_BUILD_TOOLS_VERSION") ? AME_BUILD_TOOLS_VERSION : '28.0.3'
localCompileSdkVersion = project.hasProperty("AME_COMPILE_SDK_VERSION") ? AME_COMPILE_SDK_VERSION : 25
localMinSdkVersion = project.hasProperty("AME_MIN_SDK_VERSION") ? AME_MIN_SDK_VERSION : 8
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -46,7 +47,7 @@ public class AnimateMarkersFragment extends BaseFragment {
private Random random = new Random();

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
Expand All @@ -30,7 +31,7 @@ public abstract class BaseFragment extends Fragment {
protected GoogleMap map;

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
createMapFragmentIfNeeded();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -38,7 +39,7 @@ public class ClusterGroupsFragment extends BaseFragment {
private static final int DYNAMIC_GROUP = ClusterGroup.FIRST_USER;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import android.graphics.Point;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -36,7 +37,7 @@ public class DeclusterificationExampleFragment extends BaseFragment {
private List<Marker> declusterifiedMarkers;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public class DemoClusterOptionsProvider implements ClusterOptionsProvider {
private static final int[] forCounts = {10, 100, 1000, 10000, Integer.MAX_VALUE};

private Bitmap[] baseBitmaps;
private LruCache<Integer, BitmapDescriptor> cache = new LruCache<Integer, BitmapDescriptor>(128);
private LruCache<Integer, BitmapDescriptor> cache = new LruCache<>(128);

private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Rect bounds = new Rect();

private ClusterOptions clusterOptions = new ClusterOptions().anchor(0.5f, 0.5f);

public DemoClusterOptionsProvider(Resources resources) {
DemoClusterOptionsProvider(Resources resources) {
baseBitmaps = new Bitmap[res.length];
for (int i = 0; i < res.length; i++) {
baseBitmaps[i] = BitmapFactory.decodeResource(resources, res[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -76,7 +77,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setUpClusteringViews(view);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
Expand Down Expand Up @@ -67,10 +68,14 @@ public static void removeDialog(FragmentActivity activity) {
}
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle args = getArguments();
int status = args.getInt(KEY_STATUS);
int status = 0;
if (args != null) {
status = args.getInt(KEY_STATUS);
}
return GooglePlayServicesUtil.getErrorDialog(status, getActivity(), 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
*/
package pl.mg6.android.maps.extensions.demo;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -31,7 +33,7 @@
public class Issue14GoogleCodeInfoWindowNotShowingClusterFragment extends BaseFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand All @@ -45,6 +47,7 @@ public View getInfoWindow(Marker marker) {
return null;
}

@SuppressLint("SetTextI18n")
@Override
public View getInfoContents(Marker marker) {
TextView view = new TextView(getActivity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -27,7 +28,7 @@
public class Issue14GoogleCodeInfoWindowNotShowingFragment extends BaseFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -32,7 +33,7 @@
public class Issue15GoogleCodeInfoWindowNotShowingClusterFragment extends BaseFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -28,7 +29,7 @@
public class Issue15GoogleCodeInfoWindowNotShowingFragment extends BaseFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -43,7 +44,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.issue_29_btn).setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -27,7 +28,7 @@
public class Issue45GitHubInfoWindowNotShowingFragment extends BaseFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -53,7 +54,7 @@ static LaunchTimeTestFragment newInstance(int clusteringType) {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.launch_time_test, container, false);
}

Expand All @@ -66,7 +67,10 @@ protected SupportMapFragment createMapFragment() {

@Override
protected void setUpMap() {
int clusteringType = getArguments().getInt(EXTRA_CLUSTERING_TYPE, CLUSTERING_DISABLED);
int clusteringType = 0;
if (getArguments() != null) {
clusteringType = getArguments().getInt(EXTRA_CLUSTERING_TYPE, CLUSTERING_DISABLED);
}

ClusteringSettings settings = new ClusteringSettings();
switch (clusteringType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends BaseActivity {
public class MainActivity extends AppCompatActivity {

private DrawerLayout drawerLayout;
private ActionBarDrawerToggle toggle;
Expand All @@ -38,13 +39,13 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

drawerLayout = (DrawerLayout) findViewById(R.id.drawer);
drawerLayout = findViewById(R.id.drawer);
initDrawerToggle();

String[] screens = {"Demo", "Animate markers", "Cluster groups", "\"Declusterification\"",
"Grid clustering (dynamic)", "No clustering (dynamic)", "Grid clustering", "No clustering"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, screens);
ListView listView = (ListView) findViewById(R.id.list);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, screens);
ListView listView = findViewById(R.id.list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
Expand All @@ -56,7 +57,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
});
if (savedInstanceState == null) {
if (GooglePlayServicesErrorDialogFragment.showDialogIfNotAvailable(this)) {
replaceMainFragment(new DemoFragment());
replaceMainFragment(new DemoFragment());
}
}
}
Expand Down Expand Up @@ -89,9 +90,11 @@ private void startExample(int position) {

private void initDrawerToggle() {
toggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.open_drawer, R.string.close_drawer);
drawerLayout.setDrawerListener(toggle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
drawerLayout.addDrawerListener(toggle);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package pl.mg6.android.maps.extensions.demo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -29,7 +30,7 @@
public class SimpleMapFragment extends BaseFragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.simple_map, container, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import android.content.Context;
import android.widget.Toast;

public class ToastHelper {
class ToastHelper {

private ToastHelper() {
}

public static void showToast(Context context, String text) {
static void showToast(Context context, String text) {
if (context != null) {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
Expand Down
Loading