mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Fixed misc lint warnings and replaced deprecated methods
This commit is contained in:
parent
e1ac84d605
commit
782f45034c
11 changed files with 43 additions and 36 deletions
|
@ -25,7 +25,9 @@ import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v4.widget.TextViewCompat;
|
import android.support.v4.widget.TextViewCompat;
|
||||||
|
@ -39,7 +41,6 @@ import android.text.Spanned;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -222,7 +223,7 @@ public class MainActivity extends AppCompatActivity implements Handler.Callback
|
||||||
// Setup drawer layout
|
// Setup drawer layout
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
drawerLayout.setDrawerShadow(getResources().getDrawable(R.drawable.drawer_shadow), Gravity.LEFT);
|
drawerLayout.setDrawerShadow(ContextCompat.getDrawable(this, R.drawable.drawer_shadow), GravityCompat.START);
|
||||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.main_menu, R.string.close_menu) {
|
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.main_menu, R.string.close_menu) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -475,7 +476,7 @@ public class MainActivity extends AppCompatActivity implements Handler.Callback
|
||||||
|
|
||||||
TextView tv = (TextView) convertView.findViewById(R.id.section_text);
|
TextView tv = (TextView) convertView.findViewById(R.id.section_text);
|
||||||
SpannableString sectionTitle = new SpannableString(getString(section.getTitleResId()));
|
SpannableString sectionTitle = new SpannableString(getString(section.getTitleResId()));
|
||||||
Drawable sectionIcon = getResources().getDrawable(section.getIconResId());
|
Drawable sectionIcon = ContextCompat.getDrawable(MainActivity.this, section.getIconResId());
|
||||||
if (section == currentSection) {
|
if (section == currentSection) {
|
||||||
// Special color for the current section
|
// Special color for the current section
|
||||||
sectionTitle.setSpan(new ForegroundColorSpan(currentSectionForegroundColor), 0, sectionTitle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
sectionTitle.setSpan(new ForegroundColorSpan(currentSectionForegroundColor), 0, sectionTitle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
|
|
@ -610,7 +610,7 @@ public class DatabaseManager {
|
||||||
final String matchQuery = query + "*";
|
final String matchQuery = query + "*";
|
||||||
String[] selectionArgs = new String[]{matchQuery, "%" + query + "%", matchQuery, String.valueOf(limit)};
|
String[] selectionArgs = new String[]{matchQuery, "%" + query + "%", matchQuery, String.valueOf(limit)};
|
||||||
// Query is similar to getSearchResults but returns different columns, does not join the Day table or the Bookmark table and limits the result set.
|
// Query is similar to getSearchResults but returns different columns, does not join the Day table or the Bookmark table and limits the result set.
|
||||||
Cursor cursor = helper.getReadableDatabase().rawQuery(
|
return helper.getReadableDatabase().rawQuery(
|
||||||
"SELECT e.id AS " + BaseColumns._ID
|
"SELECT e.id AS " + BaseColumns._ID
|
||||||
+ ", et.title AS " + SearchManager.SUGGEST_COLUMN_TEXT_1
|
+ ", et.title AS " + SearchManager.SUGGEST_COLUMN_TEXT_1
|
||||||
+ ", IFNULL(GROUP_CONCAT(p.name, ', '), '') || ' - ' || t.name AS " + SearchManager.SUGGEST_COLUMN_TEXT_2
|
+ ", IFNULL(GROUP_CONCAT(p.name, ', '), '') || ' - ' || t.name AS " + SearchManager.SUGGEST_COLUMN_TEXT_2
|
||||||
|
@ -637,7 +637,6 @@ public class DatabaseManager {
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " GROUP BY e.id"
|
+ " GROUP BY e.id"
|
||||||
+ " ORDER BY e.start_time ASC LIMIT ?", selectionArgs);
|
+ " ORDER BY e.start_time ASC LIMIT ?", selectionArgs);
|
||||||
return cursor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Event toEvent(Cursor cursor, Event event) {
|
public static Event toEvent(Cursor cursor, Event event) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package be.digitalia.fosdem.fragments;
|
package be.digitalia.fosdem.fragments;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
@ -93,10 +92,10 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(activity);
|
super.onAttach(context);
|
||||||
if (activity instanceof Callbacks) {
|
if (context instanceof Callbacks) {
|
||||||
listener = (Callbacks) activity;
|
listener = (Callbacks) context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,9 +236,6 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
|
||||||
|
|
||||||
private static class TrackScheduleAdapter extends CursorAdapter {
|
private static class TrackScheduleAdapter extends CursorAdapter {
|
||||||
|
|
||||||
private static final int[] PRIMARY_TEXT_COLORS
|
|
||||||
= new int[]{android.R.attr.textColorPrimary, android.R.attr.textColorPrimaryInverse};
|
|
||||||
|
|
||||||
private final LayoutInflater inflater;
|
private final LayoutInflater inflater;
|
||||||
private final DateFormat timeDateFormat;
|
private final DateFormat timeDateFormat;
|
||||||
private final int timeBackgroundColor;
|
private final int timeBackgroundColor;
|
||||||
|
@ -255,9 +251,9 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
|
||||||
timeBackgroundColor = ContextCompat.getColor(context, R.color.schedule_time_background);
|
timeBackgroundColor = ContextCompat.getColor(context, R.color.schedule_time_background);
|
||||||
timeRunningBackgroundColor = ContextCompat.getColor(context, R.color.schedule_time_running_background);
|
timeRunningBackgroundColor = ContextCompat.getColor(context, R.color.schedule_time_running_background);
|
||||||
|
|
||||||
TypedArray a = context.getTheme().obtainStyledAttributes(PRIMARY_TEXT_COLORS);
|
TypedArray a = context.getTheme().obtainStyledAttributes(R.styleable.PrimaryTextColors);
|
||||||
timeForegroundColor = a.getColor(0, 0);
|
timeForegroundColor = a.getColor(R.styleable.PrimaryTextColors_android_textColorPrimary, 0);
|
||||||
timeRunningForegroundColor = a.getColor(1, 0);
|
timeRunningForegroundColor = a.getColor(R.styleable.PrimaryTextColors_android_textColorPrimaryInverse, 0);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package be.digitalia.fosdem.fragments;
|
package be.digitalia.fosdem.fragments;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -18,13 +16,16 @@ import android.support.v4.view.ViewPager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.example.android.common.view.SlidingTabLayout;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import be.digitalia.fosdem.R;
|
import be.digitalia.fosdem.R;
|
||||||
import be.digitalia.fosdem.db.DatabaseManager;
|
import be.digitalia.fosdem.db.DatabaseManager;
|
||||||
import be.digitalia.fosdem.loaders.GlobalCacheLoader;
|
import be.digitalia.fosdem.loaders.GlobalCacheLoader;
|
||||||
import be.digitalia.fosdem.model.Day;
|
import be.digitalia.fosdem.model.Day;
|
||||||
|
|
||||||
import com.example.android.common.view.SlidingTabLayout;
|
|
||||||
|
|
||||||
public class TracksFragment extends Fragment implements LoaderCallbacks<List<Day>> {
|
public class TracksFragment extends Fragment implements LoaderCallbacks<List<Day>> {
|
||||||
|
|
||||||
private static class ViewHolder {
|
private static class ViewHolder {
|
||||||
|
@ -136,7 +137,7 @@ public class TracksFragment extends Fragment implements LoaderCallbacks<List<Day
|
||||||
if (totalPages == 0) {
|
if (totalPages == 0) {
|
||||||
holder.contentView.setVisibility(View.GONE);
|
holder.contentView.setVisibility(View.GONE);
|
||||||
holder.emptyView.setVisibility(View.VISIBLE);
|
holder.emptyView.setVisibility(View.VISIBLE);
|
||||||
holder.pager.setOnPageChangeListener(null);
|
holder.pager.clearOnPageChangeListeners();
|
||||||
} else {
|
} else {
|
||||||
holder.contentView.setVisibility(View.VISIBLE);
|
holder.contentView.setVisibility(View.VISIBLE);
|
||||||
holder.emptyView.setVisibility(View.GONE);
|
holder.emptyView.setVisibility(View.GONE);
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class NfcUtils {
|
||||||
*
|
*
|
||||||
* @return The app data, or null if no data is currently available for sharing.
|
* @return The app data, or null if no data is currently available for sharing.
|
||||||
*/
|
*/
|
||||||
public byte[] createNfcAppData();
|
byte[] createNfcAppData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -272,13 +272,13 @@ public class UnderlinePageIndicator extends View implements PageIndicator {
|
||||||
}
|
}
|
||||||
if (mViewPager != null) {
|
if (mViewPager != null) {
|
||||||
//Clear us from the old pager.
|
//Clear us from the old pager.
|
||||||
mViewPager.setOnPageChangeListener(null);
|
mViewPager.removeOnPageChangeListener(this);
|
||||||
}
|
}
|
||||||
if (viewPager.getAdapter() == null) {
|
if (viewPager.getAdapter() == null) {
|
||||||
throw new IllegalStateException("ViewPager does not have adapter instance.");
|
throw new IllegalStateException("ViewPager does not have adapter instance.");
|
||||||
}
|
}
|
||||||
mViewPager = viewPager;
|
mViewPager = viewPager;
|
||||||
mViewPager.setOnPageChangeListener(this);
|
mViewPager.addOnPageChangeListener(this);
|
||||||
invalidate();
|
invalidate();
|
||||||
post(new Runnable() {
|
post(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_pressed="true">
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_pressed="true">
|
||||||
<objectAnimator
|
<objectAnimator
|
||||||
android:duration="@android:integer/config_shortAnimTime"
|
android:duration="@android:integer/config_shortAnimTime"
|
||||||
android:propertyName="translationZ"
|
android:propertyName="translationZ"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -46,5 +46,7 @@
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:layout_marginRight="20dp"
|
android:layout_marginRight="20dp"
|
||||||
android:layout_marginTop="100dp"
|
android:layout_marginTop="100dp"
|
||||||
|
android:contentDescription="@string/add_bookmark"
|
||||||
android:src="@drawable/ic_bookmark_outline_white_24dp"/>
|
android:src="@drawable/ic_bookmark_outline_white_24dp"/>
|
||||||
</FrameLayout>
|
|
||||||
|
</merge>
|
|
@ -23,6 +23,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/main_menu_header_height"
|
android:layout_height="@dimen/main_menu_header_height"
|
||||||
|
android:contentDescription="@string/app_name"
|
||||||
android:padding="@dimen/main_menu_padding"
|
android:padding="@dimen/main_menu_padding"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/fosdem_title"/>
|
android:src="@drawable/fosdem_title"/>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
@ -22,4 +22,4 @@
|
||||||
android:layout_height="2dp"
|
android:layout_height="2dp"
|
||||||
android:layout_gravity="bottom"/>
|
android:layout_gravity="bottom"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</merge>
|
|
@ -16,4 +16,9 @@
|
||||||
<attr name="insetForeground" format="color|reference"/>
|
<attr name="insetForeground" format="color|reference"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="PrimaryTextColors">
|
||||||
|
<attr name="android:textColorPrimary"/>
|
||||||
|
<attr name="android:textColorPrimaryInverse"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue