Updated code to the latest support library and build tools.
MinSDK is now 14; removed legacy code
|
@ -1,12 +1,12 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion "27.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "be.digitalia.fosdem"
|
||||
minSdkVersion 9
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
versionCode 900146
|
||||
versionName "1.4.6"
|
||||
|
@ -22,14 +22,10 @@ android {
|
|||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
aaptOptions {
|
||||
cruncherEnabled false
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
supportLibraryVersion = '23.4.0'
|
||||
supportLibraryVersion = '27.0.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -37,5 +33,5 @@ dependencies {
|
|||
compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
|
||||
compile "com.android.support:cardview-v7:$supportLibraryVersion"
|
||||
compile "com.android.support:customtabs:$supportLibraryVersion"
|
||||
compile 'com.github.chrisbanes.photoview:library:1.2.4'
|
||||
compile 'com.github.chrisbanes:PhotoView:2.1.3'
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package android.support.v4.app;
|
||||
|
||||
/**
|
||||
* Contains utility method to prevent Loaders from being forcefully retained during a configuration change.
|
||||
* Forceful retain currently causes all stopped Loaders to briefly start, causing unexpected issues for detached fragments.
|
||||
* This restores the Loaders behavior of support libraries < 24.0.0 for fragments.
|
||||
*
|
||||
* @author Christophe Beyls
|
||||
* @see <a href="https://issuetracker.google.com/issues/37916599">Bug report</a>
|
||||
*/
|
||||
public class SafeLoadersUtils {
|
||||
|
||||
public static void onRetainCustomNonConfigurationInstance(FragmentActivity activity) {
|
||||
// All loaders are already stopped or retained at that point, but calling this method again
|
||||
// sets a flag to prevent them from being forcefully retained during the next phase
|
||||
activity.mFragments.doLoaderStop(false);
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package android.support.v7.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* DividerItemDecoration is a {@link RecyclerView.ItemDecoration} that can be used as a divider
|
||||
* between items of a {@link LinearLayoutManager}. It supports both {@link #HORIZONTAL} and
|
||||
* {@link #VERTICAL} orientations.
|
||||
* <p>
|
||||
* <pre>
|
||||
* mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
|
||||
* mLayoutManager.getOrientation());
|
||||
* recyclerView.addItemDecoration(mDividerItemDecoration);
|
||||
* </pre>
|
||||
*/
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
|
||||
public static final int VERTICAL = LinearLayout.VERTICAL;
|
||||
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
|
||||
private Drawable mDivider;
|
||||
|
||||
/**
|
||||
* Current orientation. Either {@link #HORIZONTAL} or {@link #VERTICAL}.
|
||||
*/
|
||||
private int mOrientation;
|
||||
|
||||
private final Rect mBounds = new Rect();
|
||||
|
||||
/**
|
||||
* Creates a divider {@link RecyclerView.ItemDecoration} that can be used with a
|
||||
* {@link LinearLayoutManager}.
|
||||
*
|
||||
* @param context Current context, it will be used to access resources.
|
||||
* @param orientation Divider orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}.
|
||||
*/
|
||||
public DividerItemDecoration(Context context, int orientation) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
mDivider = a.getDrawable(0);
|
||||
a.recycle();
|
||||
setOrientation(orientation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the orientation for this divider. This should be called if
|
||||
* {@link RecyclerView.LayoutManager} changes orientation.
|
||||
*
|
||||
* @param orientation {@link #HORIZONTAL} or {@link #VERTICAL}
|
||||
*/
|
||||
public void setOrientation(int orientation) {
|
||||
if (orientation != HORIZONTAL && orientation != VERTICAL) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid orientation. It should be either HORIZONTAL or VERTICAL");
|
||||
}
|
||||
mOrientation = orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link Drawable} for this divider.
|
||||
*
|
||||
* @param drawable Drawable that should be used as a divider.
|
||||
*/
|
||||
public void setDrawable(@NonNull Drawable drawable) {
|
||||
mDivider = drawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
if (parent.getLayoutManager() == null) {
|
||||
return;
|
||||
}
|
||||
if (mOrientation == VERTICAL) {
|
||||
drawVertical(c, parent);
|
||||
} else {
|
||||
drawHorizontal(c, parent);
|
||||
}
|
||||
}
|
||||
|
||||
private static void getDecoratedBoundsWithMargins(View view, Rect outBounds) {
|
||||
final RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
final Rect insets = lp.mDecorInsets;
|
||||
outBounds.set(view.getLeft() - insets.left - lp.leftMargin,
|
||||
view.getTop() - insets.top - lp.topMargin,
|
||||
view.getRight() + insets.right + lp.rightMargin,
|
||||
view.getBottom() + insets.bottom + lp.bottomMargin);
|
||||
}
|
||||
|
||||
private void drawVertical(Canvas canvas, RecyclerView parent) {
|
||||
canvas.save();
|
||||
final int left = 0;
|
||||
final int right = parent.getWidth();
|
||||
|
||||
final int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
getDecoratedBoundsWithMargins(child, mBounds);
|
||||
final int bottom = mBounds.bottom + Math.round(ViewCompat.getTranslationY(child));
|
||||
final int top = bottom - mDivider.getIntrinsicHeight();
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
mDivider.draw(canvas);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void drawHorizontal(Canvas canvas, RecyclerView parent) {
|
||||
canvas.save();
|
||||
final int top = 0;
|
||||
final int bottom = parent.getHeight();
|
||||
|
||||
final int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
getDecoratedBoundsWithMargins(child, mBounds);
|
||||
final int right = mBounds.right + Math.round(ViewCompat.getTranslationX(child));
|
||||
final int left = right - mDivider.getIntrinsicWidth();
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
mDivider.draw(canvas);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
|
||||
RecyclerView.State state) {
|
||||
if (mOrientation == VERTICAL) {
|
||||
outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
|
||||
} else {
|
||||
outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
package be.digitalia.fosdem.activities;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StyleRes;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
@ -21,14 +23,34 @@ import android.view.ViewGroup;
|
|||
public class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
private int mThemeId = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
final AppCompatDelegate delegate = getDelegate();
|
||||
delegate.installViewFactory();
|
||||
delegate.onCreate(savedInstanceState);
|
||||
if (delegate.applyDayNight() && mThemeId != 0) {
|
||||
// If DayNight has been applied, we need to re-apply the theme for
|
||||
// the changes to take effect. On API 23+, we should bypass
|
||||
// setTheme(), which will no-op if the theme ID is identical to the
|
||||
// current theme ID.
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
onApplyThemeResource(getTheme(), mThemeId, false);
|
||||
} else {
|
||||
setTheme(mThemeId);
|
||||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTheme(@StyleRes final int resid) {
|
||||
super.setTheme(resid);
|
||||
// Keep hold of the theme id so that we can re-set it later if needed
|
||||
mThemeId = resid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
@ -44,8 +66,8 @@ public class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@NonNull
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
@ -76,21 +98,27 @@ public class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
getDelegate().onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public View findViewById(@IdRes int id) {
|
||||
public <T extends View> T findViewById(@IdRes int id) {
|
||||
return getDelegate().findViewById(id);
|
||||
}
|
||||
|
||||
|
@ -121,7 +149,8 @@ public class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||
getDelegate().onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
@NonNull
|
||||
public AppCompatDelegate getDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package be.digitalia.fosdem.activities;
|
||||
|
||||
import android.support.v4.app.SafeLoadersUtils;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
/**
|
||||
* Common activity code with fragment loaders fix.
|
||||
*/
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public Object onRetainCustomNonConfigurationInstance() {
|
||||
// TODO Remove when support-fragment Loaders bug is fixed
|
||||
SafeLoadersUtils.onRetainCustomNonConfigurationInstance(this);
|
||||
return super.onRetainCustomNonConfigurationInstance();
|
||||
}
|
||||
}
|
|
@ -11,7 +11,6 @@ import android.support.v4.app.NavUtils;
|
|||
import android.support.v4.app.TaskStackBuilder;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -29,7 +28,7 @@ import be.digitalia.fosdem.utils.ThemeUtils;
|
|||
*
|
||||
* @author Christophe Beyls
|
||||
*/
|
||||
public class EventDetailsActivity extends AppCompatActivity implements LoaderCallbacks<Event>, CreateNfcAppDataCallback {
|
||||
public class EventDetailsActivity extends BaseActivity implements LoaderCallbacks<Event>, CreateNfcAppDataCallback {
|
||||
|
||||
public static final String EXTRA_EVENT = "event";
|
||||
|
||||
|
|
|
@ -25,15 +25,12 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.os.AsyncTaskCompat;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v4.widget.TextViewCompat;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.AppCompatDrawableManager;
|
||||
import android.support.v7.content.res.AppCompatResources;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableString;
|
||||
|
@ -68,7 +65,7 @@ import be.digitalia.fosdem.widgets.AdapterLinearLayout;
|
|||
*
|
||||
* @author Christophe Beyls
|
||||
*/
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
||||
public static final String ACTION_SHORTCUT_BOOKMARKS = BuildConfig.APPLICATION_ID + ".intent.action.SHORTCUT_BOOKMARKS";
|
||||
public static final String ACTION_SHORTCUT_LIVE = BuildConfig.APPLICATION_ID + ".intent.action.SHORTCUT_LIVE";
|
||||
|
@ -212,14 +209,14 @@ public class MainActivity extends AppCompatActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
progressBar = (ProgressBar) findViewById(R.id.progress);
|
||||
progressBar = findViewById(R.id.progress);
|
||||
|
||||
// Setup drawer layout
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
drawerLayout = findViewById(R.id.drawer_layout);
|
||||
drawerLayout.setDrawerShadow(ContextCompat.getDrawable(this, R.drawable.drawer_shadow), GravityCompat.START);
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.main_menu, R.string.close_menu) {
|
||||
|
||||
|
@ -260,7 +257,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
// Setup Main menu
|
||||
mainMenu = findViewById(R.id.main_menu);
|
||||
final AdapterLinearLayout sectionsList = (AdapterLinearLayout) findViewById(R.id.sections);
|
||||
final AdapterLinearLayout sectionsList = findViewById(R.id.sections);
|
||||
menuAdapter = new MainMenuAdapter(getLayoutInflater());
|
||||
sectionsList.setAdapter(menuAdapter);
|
||||
mainMenu.findViewById(R.id.settings).setOnClickListener(menuFooterClickListener);
|
||||
|
@ -269,7 +266,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
LocalBroadcastManager.getInstance(this).registerReceiver(scheduleRefreshedReceiver, new IntentFilter(DatabaseManager.ACTION_SCHEDULE_REFRESHED));
|
||||
|
||||
// Last update date, below the list
|
||||
lastUpdateTextView = (TextView) mainMenu.findViewById(R.id.last_update);
|
||||
lastUpdateTextView = mainMenu.findViewById(R.id.last_update);
|
||||
updateLastUpdateTime();
|
||||
|
||||
// Restore current section
|
||||
|
@ -298,7 +295,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void run() {
|
||||
if (sectionsList.getChildCount() > currentSection.ordinal()) {
|
||||
ScrollView mainMenuScrollView = (ScrollView) findViewById(R.id.main_menu_scroll);
|
||||
ScrollView mainMenuScrollView = findViewById(R.id.main_menu_scroll);
|
||||
int requiredScroll = sectionsList.getTop()
|
||||
+ sectionsList.getChildAt(currentSection.ordinal()).getBottom()
|
||||
- mainMenuScrollView.getHeight();
|
||||
|
@ -382,8 +379,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if ((searchMenuItem != null) && (MenuItemCompat.isActionViewExpanded(searchMenuItem))) {
|
||||
MenuItemCompat.collapseActionView(searchMenuItem);
|
||||
if ((searchMenuItem != null) && searchMenuItem.isActionViewExpanded()) {
|
||||
searchMenuItem.collapseActionView();
|
||||
}
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
|
@ -407,14 +404,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
this.searchMenuItem = searchMenuItem;
|
||||
// Associate searchable configuration with the SearchView
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
|
||||
SearchView searchView = (SearchView) searchMenuItem.getActionView();
|
||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
// Animated refresh icon
|
||||
menu.findItem(R.id.refresh).setIcon(R.drawable.avd_sync_white_24dp);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -444,7 +436,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
progressBar.clearAnimation();
|
||||
progressBar.setIndeterminate(true);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
AsyncTaskCompat.executeParallel(new DownloadScheduleAsyncTask(this));
|
||||
new DownloadScheduleAsyncTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private static class DownloadScheduleAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
@ -501,9 +493,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
Section section = getItem(position);
|
||||
convertView.setSelected(section == currentSection);
|
||||
|
||||
TextView tv = (TextView) convertView.findViewById(R.id.section_text);
|
||||
TextView tv = convertView.findViewById(R.id.section_text);
|
||||
SpannableString sectionTitle = new SpannableString(getString(section.getTitleResId()));
|
||||
Drawable sectionIcon = AppCompatDrawableManager.get().getDrawable(MainActivity.this, section.getIconResId());
|
||||
Drawable sectionIcon = AppCompatResources.getDrawable(MainActivity.this, section.getIconResId());
|
||||
if (section == currentSection) {
|
||||
// Special color for the current section
|
||||
sectionTitle.setSpan(new ForegroundColorSpan(currentSectionForegroundColor), 0, sectionTitle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
|
|
@ -3,7 +3,6 @@ package be.digitalia.fosdem.activities;
|
|||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
|
@ -12,7 +11,7 @@ import be.digitalia.fosdem.R;
|
|||
import be.digitalia.fosdem.fragments.PersonInfoListFragment;
|
||||
import be.digitalia.fosdem.model.Person;
|
||||
|
||||
public class PersonInfoActivity extends AppCompatActivity {
|
||||
public class PersonInfoActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_PERSON = "person";
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.support.customtabs.CustomTabsIntent;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
|
@ -23,7 +22,7 @@ import be.digitalia.fosdem.utils.StringUtils;
|
|||
*
|
||||
* @author Christophe Beyls
|
||||
*/
|
||||
public class RoomImageDialogActivity extends AppCompatActivity {
|
||||
public class RoomImageDialogActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_ROOM_NAME = "roomName";
|
||||
public static final String EXTRA_ROOM_IMAGE_RESOURCE_ID = "imageResId";
|
||||
|
|
|
@ -5,8 +5,6 @@ import android.app.SearchManager;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -15,7 +13,7 @@ import be.digitalia.fosdem.R;
|
|||
import be.digitalia.fosdem.fragments.MessageDialogFragment;
|
||||
import be.digitalia.fosdem.fragments.SearchResultListFragment;
|
||||
|
||||
public class SearchResultActivity extends AppCompatActivity {
|
||||
public class SearchResultActivity extends BaseActivity {
|
||||
|
||||
public static final int MIN_SEARCH_LENGTH = 3;
|
||||
|
||||
|
@ -92,7 +90,7 @@ public class SearchResultActivity extends AppCompatActivity {
|
|||
MenuItem searchMenuItem = menu.findItem(R.id.search);
|
||||
// Associate searchable configuration with the SearchView
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
|
||||
searchView = (SearchView) searchMenuItem.getActionView();
|
||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
|
||||
searchView.setIconifiedByDefault(false); // Always show the search view
|
||||
setSearchViewQuery(currentQuery);
|
||||
|
|
|
@ -4,10 +4,10 @@ import android.content.SharedPreferences;
|
|||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.TwoStatePreference;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import be.digitalia.fosdem.R;
|
||||
import be.digitalia.fosdem.utils.TwoStatePreferenceCompat;
|
||||
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void updateNotificationsEnabled() {
|
||||
boolean notificationsEnabled = TwoStatePreferenceCompat.isChecked(findPreference(KEY_PREF_NOTIFICATIONS_ENABLED));
|
||||
boolean notificationsEnabled = ((TwoStatePreference) findPreference(KEY_PREF_NOTIFICATIONS_ENABLED)).isChecked();
|
||||
findPreference(KEY_PREF_NOTIFICATIONS_VIBRATE).setEnabled(notificationsEnabled);
|
||||
findPreference(KEY_PREF_NOTIFICATIONS_LED).setEnabled(notificationsEnabled);
|
||||
findPreference(KEY_PREF_NOTIFICATIONS_DELAY).setEnabled(notificationsEnabled);
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ImageView;
|
||||
|
@ -28,7 +27,7 @@ import be.digitalia.fosdem.utils.ThemeUtils;
|
|||
*
|
||||
* @author Christophe Beyls
|
||||
*/
|
||||
public class TrackScheduleActivity extends AppCompatActivity
|
||||
public class TrackScheduleActivity extends BaseActivity
|
||||
implements TrackScheduleListFragment.Callbacks,
|
||||
EventDetailsFragment.FloatingActionButtonProvider,
|
||||
CreateNfcAppDataCallback {
|
||||
|
@ -51,7 +50,7 @@ public class TrackScheduleActivity extends AppCompatActivity
|
|||
setContentView(R.layout.track_schedule);
|
||||
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
||||
|
||||
floatingActionButton = (ImageView) findViewById(R.id.fab);
|
||||
floatingActionButton = findViewById(R.id.fab);
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
day = extras.getParcelable(EXTRA_DAY);
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.viewpagerindicator.UnderlinePageIndicator;
|
||||
|
@ -32,7 +31,7 @@ import be.digitalia.fosdem.widgets.ContentLoadingProgressBar;
|
|||
*
|
||||
* @author Christophe Beyls
|
||||
*/
|
||||
public class TrackScheduleEventActivity extends AppCompatActivity implements LoaderCallbacks<Cursor>, CreateNfcAppDataCallback {
|
||||
public class TrackScheduleEventActivity extends BaseActivity implements LoaderCallbacks<Cursor>, CreateNfcAppDataCallback {
|
||||
|
||||
public static final String EXTRA_DAY = "day";
|
||||
public static final String EXTRA_TRACK = "track";
|
||||
|
@ -58,10 +57,10 @@ public class TrackScheduleEventActivity extends AppCompatActivity implements Loa
|
|||
day = extras.getParcelable(EXTRA_DAY);
|
||||
track = extras.getParcelable(EXTRA_TRACK);
|
||||
|
||||
progress = (ContentLoadingProgressBar) findViewById(R.id.progress);
|
||||
pager = (ViewPager) findViewById(R.id.pager);
|
||||
progress = findViewById(R.id.progress);
|
||||
pager = findViewById(R.id.pager);
|
||||
adapter = new TrackScheduleEventAdapter(getSupportFragmentManager());
|
||||
pageIndicator = (UnderlinePageIndicator) findViewById(R.id.indicator);
|
||||
pageIndicator = findViewById(R.id.indicator);
|
||||
pageIndicator.setSelectedColor(ContextCompat.getColor(this, track.getType().getColorResId()));
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.database.Cursor;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.TextViewCompat;
|
||||
import android.support.v7.widget.AppCompatDrawableManager;
|
||||
import android.support.v7.content.res.AppCompatResources;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -65,7 +65,7 @@ public class EventsAdapter extends RecyclerViewCursorAdapter<EventsAdapter.ViewH
|
|||
holder.title.setText(event.getTitle());
|
||||
boolean isBookmarked = DatabaseManager.toBookmarkStatus(cursor);
|
||||
Drawable bookmarkDrawable = isBookmarked
|
||||
? AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_bookmark_grey600_24dp)
|
||||
? AppCompatResources.getDrawable(context, R.drawable.ic_bookmark_grey600_24dp)
|
||||
: null;
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(holder.title, null, null, bookmarkDrawable, null);
|
||||
holder.title.setContentDescription(isBookmarked
|
||||
|
@ -104,10 +104,10 @@ public class EventsAdapter extends RecyclerViewCursorAdapter<EventsAdapter.ViewH
|
|||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
title = (TextView) itemView.findViewById(R.id.title);
|
||||
persons = (TextView) itemView.findViewById(R.id.persons);
|
||||
trackName = (TextView) itemView.findViewById(R.id.track_name);
|
||||
details = (TextView) itemView.findViewById(R.id.details);
|
||||
title = itemView.findViewById(R.id.title);
|
||||
persons = itemView.findViewById(R.id.persons);
|
||||
trackName = itemView.findViewById(R.id.track_name);
|
||||
details = itemView.findViewById(R.id.details);
|
||||
setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
|||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -70,7 +71,7 @@ public class BookmarksListFragment extends RecyclerViewFragment implements Loade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(STATE_ADAPTER, adapter.onSaveInstanceState());
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ import android.content.Intent;
|
|||
import android.graphics.drawable.Animatable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.CalendarContract;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.customtabs.CustomTabsIntent;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
|
@ -106,14 +106,14 @@ public class EventDetailsFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_event_details, container, false);
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.inflater = inflater;
|
||||
|
||||
((TextView) view.findViewById(R.id.title)).setText(event.getTitle());
|
||||
TextView textView = (TextView) view.findViewById(R.id.subtitle);
|
||||
TextView textView = view.findViewById(R.id.subtitle);
|
||||
String text = event.getSubTitle();
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
textView.setVisibility(View.GONE);
|
||||
|
@ -124,7 +124,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
MovementMethod linkMovementMethod = LinkMovementMethod.getInstance();
|
||||
|
||||
// Set the persons summary text first; replace it with the clickable text when the loader completes
|
||||
holder.personsTextView = (TextView) view.findViewById(R.id.persons);
|
||||
holder.personsTextView = view.findViewById(R.id.persons);
|
||||
String personsSummary = event.getPersonsSummary();
|
||||
if (TextUtils.isEmpty(personsSummary)) {
|
||||
holder.personsTextView.setVisibility(View.GONE);
|
||||
|
@ -135,12 +135,12 @@ public class EventDetailsFragment extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
textView = ((TextView) view.findViewById(R.id.track));
|
||||
textView = view.findViewById(R.id.track);
|
||||
text = event.getTrack().getName();
|
||||
textView.setText(text);
|
||||
textView.setContentDescription(getString(R.string.track_content_description, text));
|
||||
|
||||
textView = ((TextView) view.findViewById(R.id.time));
|
||||
textView = view.findViewById(R.id.time);
|
||||
Date startTime = event.getStartTime();
|
||||
Date endTime = event.getEndTime();
|
||||
DateFormat timeDateFormat = DateUtils.getTimeDateFormat(getActivity());
|
||||
|
@ -151,7 +151,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
textView.setText(text);
|
||||
textView.setContentDescription(getString(R.string.time_content_description, text));
|
||||
|
||||
textView = (TextView) view.findViewById(R.id.room);
|
||||
textView = view.findViewById(R.id.room);
|
||||
final String roomName = event.getRoomName();
|
||||
Spannable roomText = new SpannableString(String.format("%1$s (Building %2$s)", roomName, Building.fromRoomName(roomName)));
|
||||
final int roomImageResId = getResources().getIdentifier(StringUtils.roomNameToResourceName(roomName), "drawable", getActivity().getPackageName());
|
||||
|
@ -175,7 +175,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
textView.setContentDescription(getString(R.string.room_content_description, roomText));
|
||||
|
||||
|
||||
textView = (TextView) view.findViewById(R.id.abstract_text);
|
||||
textView = view.findViewById(R.id.abstract_text);
|
||||
text = event.getAbstractText();
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
textView.setVisibility(View.GONE);
|
||||
|
@ -183,7 +183,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
textView.setText(StringUtils.parseHtml(text, getResources()));
|
||||
textView.setMovementMethod(linkMovementMethod);
|
||||
}
|
||||
textView = (TextView) view.findViewById(R.id.description);
|
||||
textView = view.findViewById(R.id.description);
|
||||
text = event.getDescription();
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
textView.setVisibility(View.GONE);
|
||||
|
@ -193,7 +193,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
}
|
||||
|
||||
holder.linksHeader = view.findViewById(R.id.links_header);
|
||||
holder.linksContainer = (ViewGroup) view.findViewById(R.id.links_container);
|
||||
holder.linksContainer = view.findViewById(R.id.links_container);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
actionButton.setEnabled(false);
|
||||
} else {
|
||||
// Only animate if the button was showing a previous value
|
||||
animate = animate && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||
&& actionButton.isEnabled();
|
||||
animate = animate && actionButton.isEnabled();
|
||||
actionButton.setEnabled(true);
|
||||
|
||||
if (isBookmarked) {
|
||||
|
@ -289,8 +288,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
bookmarkMenuItem.setEnabled(false);
|
||||
} else {
|
||||
// Only animate if the menu item was showing a previous value
|
||||
animate = animate && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||
&& bookmarkMenuItem.isEnabled();
|
||||
animate = animate && bookmarkMenuItem.isEnabled();
|
||||
bookmarkMenuItem.setEnabled(true);
|
||||
|
||||
if (isBookmarked) {
|
||||
|
@ -457,7 +455,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
holder.linksContainer.setVisibility(View.VISIBLE);
|
||||
for (Link link : data.links) {
|
||||
View view = holder.inflater.inflate(R.layout.item_link, holder.linksContainer, false);
|
||||
TextView tv = (TextView) view.findViewById(R.id.description);
|
||||
TextView tv = view.findViewById(R.id.description);
|
||||
tv.setText(link.getDescription());
|
||||
view.setOnClickListener(new LinkClickListener(link));
|
||||
holder.linksContainer.addView(view);
|
||||
|
|
|
@ -2,6 +2,7 @@ package be.digitalia.fosdem.fragments;
|
|||
|
||||
import android.content.res.Resources;
|
||||
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.FragmentPagerAdapter;
|
||||
|
@ -25,13 +26,13 @@ public class LiveFragment extends Fragment implements RecycledViewPoolProvider {
|
|||
private ViewHolder holder;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_live, container, false);
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.pager = (ViewPager) view.findViewById(R.id.pager);
|
||||
holder.pager = view.findViewById(R.id.pager);
|
||||
holder.pager.setAdapter(new LivePagerAdapter(getChildFragmentManager(), getResources()));
|
||||
holder.slidingTabs = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
|
||||
holder.slidingTabs = view.findViewById(R.id.sliding_tabs);
|
||||
holder.slidingTabs.setViewPager(holder.pager);
|
||||
holder.recycledViewPool = new RecyclerView.RecycledViewPool();
|
||||
|
||||
|
@ -85,6 +86,7 @@ public class LiveFragment extends Fragment implements RecycledViewPoolProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
// Allow the non-primary fragments to start as soon as they are visible
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.ActivityNotFoundException;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.customtabs.CustomTabsIntent;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
@ -32,7 +33,7 @@ public class MapFragment extends Fragment {
|
|||
}
|
||||
|
||||
@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.fragment_map, container, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public class PersonsListFragment extends SmoothListFragment implements LoaderCal
|
|||
View view = inflater.inflate(R.layout.simple_list_item_1_material, parent, false);
|
||||
|
||||
ViewHolder holder = new ViewHolder();
|
||||
holder.textView = (TextView) view.findViewById(android.R.id.text1);
|
||||
holder.textView = view.findViewById(android.R.id.text1);
|
||||
view.setTag(holder);
|
||||
|
||||
return view;
|
||||
|
|
|
@ -102,7 +102,7 @@ public class RecyclerViewFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final Context context = inflater.getContext();
|
||||
|
||||
mHolder = new ViewHolder();
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RoomImageDialogFragment extends DialogFragment {
|
|||
|
||||
View contentView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_room_image, null);
|
||||
((ImageView) contentView.findViewById(R.id.room_image)).setImageResource(args.getInt(ARG_ROOM_IMAGE_RESOURCE_ID));
|
||||
Toolbar toolbar = (Toolbar) contentView.findViewById(R.id.toolbar);
|
||||
Toolbar toolbar = contentView.findViewById(R.id.toolbar);
|
||||
RoomImageDialogActivity.configureToolbar(getActivity(), toolbar, args.getString(ARG_ROOM_NAME));
|
||||
|
||||
Dialog dialog = new AlertDialog.Builder(getActivity())
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SmoothListFragment extends Fragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final Context context = inflater.getContext();
|
||||
|
||||
mHolder = new ViewHolder();
|
||||
|
|
|
@ -7,12 +7,13 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.support.v4.widget.TextViewCompat;
|
||||
import android.support.v7.widget.AppCompatDrawableManager;
|
||||
import android.support.v7.content.res.AppCompatResources;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -88,7 +89,7 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean("isListAlreadyShown", isListAlreadyShown);
|
||||
}
|
||||
|
@ -276,10 +277,10 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
|
|||
View view = inflater.inflate(R.layout.item_schedule_event, parent, false);
|
||||
|
||||
ViewHolder holder = new ViewHolder();
|
||||
holder.time = (TextView) view.findViewById(R.id.time);
|
||||
holder.title = (TextView) view.findViewById(R.id.title);
|
||||
holder.persons = (TextView) view.findViewById(R.id.persons);
|
||||
holder.room = (TextView) view.findViewById(R.id.room);
|
||||
holder.time = view.findViewById(R.id.time);
|
||||
holder.title = view.findViewById(R.id.title);
|
||||
holder.persons = view.findViewById(R.id.persons);
|
||||
holder.room = view.findViewById(R.id.room);
|
||||
view.setTag(holder);
|
||||
|
||||
return view;
|
||||
|
@ -309,7 +310,7 @@ public class TrackScheduleListFragment extends SmoothListFragment implements Han
|
|||
holder.title.setText(event.getTitle());
|
||||
boolean isBookmarked = DatabaseManager.toBookmarkStatus(cursor);
|
||||
Drawable bookmarkDrawable = isBookmarked
|
||||
? AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_bookmark_grey600_24dp)
|
||||
? AppCompatResources.getDrawable(context, R.drawable.ic_bookmark_grey600_24dp)
|
||||
: null;
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(holder.title, null, null, bookmarkDrawable, null);
|
||||
holder.title.setContentDescription(isBookmarked
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
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.FragmentStatePagerAdapter;
|
||||
|
@ -54,14 +55,14 @@ public class TracksFragment extends Fragment implements RecycledViewPoolProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_tracks, container, false);
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.contentView = view.findViewById(R.id.content);
|
||||
holder.emptyView = view.findViewById(android.R.id.empty);
|
||||
holder.pager = (ViewPager) view.findViewById(R.id.pager);
|
||||
holder.slidingTabs = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
|
||||
holder.pager = view.findViewById(R.id.pager);
|
||||
holder.slidingTabs = view.findViewById(R.id.sliding_tabs);
|
||||
holder.daysAdapter = new DaysAdapter(getChildFragmentManager());
|
||||
holder.recycledViewPool = new RecyclerView.RecycledViewPool();
|
||||
|
||||
|
@ -194,6 +195,7 @@ public class TracksFragment extends Fragment implements RecycledViewPoolProvider
|
|||
return days.get(position).toString();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
// Allow the non-primary fragments to start as soon as they are visible
|
||||
|
|
|
@ -141,8 +141,8 @@ public class TracksListFragment extends RecyclerViewFragment implements LoaderCa
|
|||
|
||||
TrackViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
name = (TextView) itemView.findViewById(android.R.id.text1);
|
||||
type = (TextView) itemView.findViewById(android.R.id.text2);
|
||||
name = itemView.findViewById(android.R.id.text1);
|
||||
type = itemView.findViewById(android.R.id.text2);
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package be.digitalia.fosdem.parsers;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
|
@ -61,6 +63,7 @@ public abstract class IterableAbstractPullParser<T> extends AbstractPullParser<I
|
|||
protected Iterable<T> parse(final XmlPullParser parser) throws Exception {
|
||||
return new Iterable<T>() {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
return new ParserIterator(parser);
|
||||
|
|
|
@ -12,8 +12,8 @@ import android.content.pm.PackageManager;
|
|||
import android.database.Cursor;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.AlarmManagerCompat;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
|
@ -242,11 +242,7 @@ public class AlarmIntentService extends IntentService {
|
|||
}
|
||||
|
||||
private static void setExactAlarm(AlarmManager manager, int type, long triggerAtMillis, PendingIntent operation) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
manager.setExact(type, triggerAtMillis, operation);
|
||||
} else {
|
||||
manager.set(type, triggerAtMillis, operation);
|
||||
}
|
||||
AlarmManagerCompat.setExact(manager, type, triggerAtMillis, operation);
|
||||
}
|
||||
|
||||
private long getDelay() {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package be.digitalia.fosdem.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.Build;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* NFC helper methods for receiving data sent by NfcSenderUtils. This class wraps API 10+ code.
|
||||
*
|
||||
* @author Christophe Beyls
|
||||
*
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
|
||||
class NfcReceiverUtils {
|
||||
|
||||
public static boolean hasAppData(Intent intent) {
|
||||
return NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction());
|
||||
}
|
||||
|
||||
public static byte[] extractAppData(Intent intent) {
|
||||
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
|
||||
NdefMessage msg = (NdefMessage) rawMsgs[0];
|
||||
return msg.getRecords()[0].getPayload();
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package be.digitalia.fosdem.utils;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import be.digitalia.fosdem.utils.NfcUtils.CreateNfcAppDataCallback;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.nfc.NfcEvent;
|
||||
import android.nfc.NfcAdapter.CreateNdefMessageCallback;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* NFC helper methods for Android Beam foreground push. This class wraps API 14+ code.
|
||||
*
|
||||
* @author Christophe Beyls
|
||||
*
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
class NfcSenderUtils {
|
||||
|
||||
public static boolean setAppDataPushMessageCallbackIfAvailable(Activity activity, final CreateNfcAppDataCallback callback) {
|
||||
NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity);
|
||||
if (adapter == null) {
|
||||
return false;
|
||||
}
|
||||
final String packageName = activity.getPackageName();
|
||||
adapter.setNdefPushMessageCallback(new CreateNdefMessageCallback() {
|
||||
|
||||
@Override
|
||||
public NdefMessage createNdefMessage(NfcEvent event) {
|
||||
byte[] appData = callback.createNfcAppData();
|
||||
if (appData == null) {
|
||||
return null;
|
||||
}
|
||||
NdefRecord[] records = new NdefRecord[] { createMimeRecord("application/" + packageName, appData),
|
||||
NdefRecord.createApplicationRecord(packageName) };
|
||||
return new NdefMessage(records);
|
||||
}
|
||||
|
||||
}, activity);
|
||||
return true;
|
||||
}
|
||||
|
||||
static NdefRecord createMimeRecord(String mimeType, byte[] payload) {
|
||||
byte[] mimeBytes = mimeType.getBytes(Charset.forName("US-ASCII"));
|
||||
return new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mimeBytes, new byte[0], payload);
|
||||
}
|
||||
}
|
|
@ -2,13 +2,18 @@ package be.digitalia.fosdem.utils;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.nfc.NfcEvent;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* NFC helper methods compatible with all API levels.
|
||||
* NFC helper methods.
|
||||
*
|
||||
* @author Christophe Beyls
|
||||
*
|
||||
*/
|
||||
public class NfcUtils {
|
||||
|
||||
|
@ -17,7 +22,6 @@ public class NfcUtils {
|
|||
*/
|
||||
public interface CreateNfcAppDataCallback {
|
||||
/**
|
||||
*
|
||||
* @return The app data, or null if no data is currently available for sharing.
|
||||
*/
|
||||
byte[] createNfcAppData();
|
||||
|
@ -28,28 +32,41 @@ public class NfcUtils {
|
|||
* to share will be "application/" followed by the app's package name. Declare it in your Manifest's intent filters as the data type with an action of
|
||||
* android.nfc.action.NDEF_DISCOVERED to handle the NFC Intents on the receiver side.
|
||||
*
|
||||
* @param activity
|
||||
* @param callback
|
||||
* @return true if NFC is available and the content was made available, false if not.
|
||||
*/
|
||||
public static boolean setAppDataPushMessageCallbackIfAvailable(Activity activity, final CreateNfcAppDataCallback callback) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
return NfcSenderUtils.setAppDataPushMessageCallbackIfAvailable(activity, callback);
|
||||
NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity);
|
||||
if (adapter == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
final String packageName = activity.getPackageName();
|
||||
adapter.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
|
||||
|
||||
@Override
|
||||
public NdefMessage createNdefMessage(NfcEvent event) {
|
||||
byte[] appData = callback.createNfcAppData();
|
||||
if (appData == null) {
|
||||
return null;
|
||||
}
|
||||
NdefRecord[] records = new NdefRecord[]{createMimeRecord("application/" + packageName, appData),
|
||||
NdefRecord.createApplicationRecord(packageName)};
|
||||
return new NdefMessage(records);
|
||||
}
|
||||
|
||||
}, activity);
|
||||
return true;
|
||||
}
|
||||
|
||||
static NdefRecord createMimeRecord(String mimeType, byte[] payload) {
|
||||
byte[] mimeBytes = mimeType.getBytes(Charset.forName("US-ASCII"));
|
||||
return new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mimeBytes, new byte[0], payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the intent contains NFC NDEF application-specific data to be extracted.
|
||||
*
|
||||
* @param intent
|
||||
* @return
|
||||
*/
|
||||
public static boolean hasAppData(Intent intent) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
return NfcReceiverUtils.hasAppData(intent);
|
||||
}
|
||||
return false;
|
||||
return NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,9 +76,8 @@ public class NfcUtils {
|
|||
* @return The extracted data
|
||||
*/
|
||||
public static byte[] extractAppData(Intent intent) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
return NfcReceiverUtils.extractAppData(intent);
|
||||
}
|
||||
return null;
|
||||
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
|
||||
NdefMessage msg = (NdefMessage) rawMsgs[0];
|
||||
return msg.getRecords()[0].getPayload();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,6 +257,7 @@ public class StringUtils {
|
|||
mLength = mString.length();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Iterator<String> iterator() {
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package be.digitalia.fosdem.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.TwoStatePreference;
|
||||
|
||||
/**
|
||||
* Utility to retrieve the checked value from a two-state preference in a backwards-compatible way.
|
||||
*/
|
||||
public class TwoStatePreferenceCompat {
|
||||
|
||||
private static final TwoStatePreferenceCompatImpl IMPL =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
|
||||
? new TwoStatePreferenceCompatICS() : new TwoStatePreferenceCompatBase();
|
||||
|
||||
public static boolean isChecked(Preference preference) {
|
||||
return IMPL.isChecked(preference);
|
||||
}
|
||||
|
||||
interface TwoStatePreferenceCompatImpl {
|
||||
boolean isChecked(Preference preference);
|
||||
}
|
||||
|
||||
static class TwoStatePreferenceCompatBase implements TwoStatePreferenceCompatImpl {
|
||||
@Override
|
||||
public boolean isChecked(Preference preference) {
|
||||
return (preference instanceof CheckBoxPreference) && ((CheckBoxPreference) preference).isChecked();
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
static class TwoStatePreferenceCompatICS implements TwoStatePreferenceCompatImpl {
|
||||
@Override
|
||||
public boolean isChecked(Preference preference) {
|
||||
return (preference instanceof TwoStatePreference) && ((TwoStatePreference) preference).isChecked();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package be.digitalia.fosdem.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Checkable;
|
||||
|
||||
/**
|
||||
* {@link android.widget.LinearLayout} implementing the {@link android.widget.Checkable}
|
||||
* interface by keeping an internal 'checked' state flag.
|
||||
*/
|
||||
public class CheckableLinearLayout extends ForegroundLinearLayout implements Checkable {
|
||||
private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
|
||||
|
||||
private boolean mChecked = false;
|
||||
|
||||
public CheckableLinearLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean b) {
|
||||
if (b != mChecked) {
|
||||
mChecked = b;
|
||||
refreshDrawableState();
|
||||
}
|
||||
}
|
||||
|
||||
public void toggle() {
|
||||
setChecked(!mChecked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] onCreateDrawableState(int extraSpace) {
|
||||
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
|
||||
if (isChecked()) {
|
||||
mergeDrawableStates(drawableState, CHECKED_STATE_SET);
|
||||
}
|
||||
return drawableState;
|
||||
}
|
||||
}
|
|
@ -114,7 +114,6 @@ public class ForegroundLinearLayout extends LinearLayoutCompat {
|
|||
return super.verifyDrawable(who) || (who == mForeground);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package be.digitalia.fosdem.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -71,7 +70,7 @@ public class MultiChoiceHelper {
|
|||
final boolean isChecked = multiChoiceHelper.isItemChecked(position);
|
||||
if (itemView instanceof Checkable) {
|
||||
((Checkable) itemView).setChecked(isChecked);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
} else {
|
||||
itemView.setActivated(isChecked);
|
||||
}
|
||||
}
|
||||
|
@ -236,25 +235,13 @@ public class MultiChoiceHelper {
|
|||
public Parcelable onSaveInstanceState() {
|
||||
SavedState savedState = new SavedState();
|
||||
savedState.checkedItemCount = checkedItemCount;
|
||||
savedState.checkStates = clone(checkStates);
|
||||
savedState.checkStates = checkStates.clone();
|
||||
if (checkedIdStates != null) {
|
||||
savedState.checkedIdStates = checkedIdStates.clone();
|
||||
}
|
||||
return savedState;
|
||||
}
|
||||
|
||||
private static SparseBooleanArray clone(SparseBooleanArray original) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
return original.clone();
|
||||
}
|
||||
final int size = original.size();
|
||||
SparseBooleanArray clone = new SparseBooleanArray(size);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
clone.append(original.keyAt(i), original.valueAt(i));
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
public void onRestoreInstanceState(Parcelable state) {
|
||||
if ((state != null) && (checkedItemCount == 0)) {
|
||||
SavedState savedState = (SavedState) state;
|
||||
|
|
|
@ -4,12 +4,10 @@ import android.content.Context;
|
|||
import android.graphics.RectF;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.os.ParcelableCompat;
|
||||
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
import uk.co.senab.photoview.PhotoView;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
|
||||
/**
|
||||
* PhotoView which saves and restores the current scale and approximate position.
|
||||
|
@ -84,10 +82,10 @@ public class SaveStatePhotoView extends PhotoView {
|
|||
out.writeFloat(pivotY);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR
|
||||
= ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks<SavedState>() {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {
|
||||
|
||||
@Override
|
||||
public SavedState createFromParcel(Parcel in, ClassLoader loader) {
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
|
@ -95,7 +93,7 @@ public class SaveStatePhotoView extends PhotoView {
|
|||
public SavedState[] newArray(int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
SavedState(Parcel in) {
|
||||
super(in);
|
||||
|
|
|
@ -211,7 +211,7 @@ public class SlidingTabLayout extends HorizontalScrollView {
|
|||
if (mTabViewLayoutId != 0) {
|
||||
// If there is a custom tab view layout id set, try and inflate it
|
||||
tabView = inflater.inflate(mTabViewLayoutId, mTabStrip, false);
|
||||
tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
|
||||
tabTitleView = tabView.findViewById(mTabViewTextViewId);
|
||||
if (tabTitleView == null) {
|
||||
tabTitleView = (TextView) tabView;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.MotionEventCompat;
|
||||
import android.support.v4.view.ViewConfigurationCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
|
@ -181,16 +180,16 @@ public class UnderlinePageIndicator extends View implements PageIndicator {
|
|||
return false;
|
||||
}
|
||||
|
||||
final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;
|
||||
final int action = ev.getAction() & MotionEvent.ACTION_MASK;
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
|
||||
mActivePointerId = ev.getPointerId(0);
|
||||
mLastMotionX = ev.getX();
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE: {
|
||||
final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
|
||||
final float x = MotionEventCompat.getX(ev, activePointerIndex);
|
||||
final int activePointerIndex = ev.findPointerIndex(mActivePointerId);
|
||||
final float x = ev.getX(activePointerIndex);
|
||||
final float deltaX = x - mLastMotionX;
|
||||
|
||||
if (!mIsDragging) {
|
||||
|
@ -235,21 +234,21 @@ public class UnderlinePageIndicator extends View implements PageIndicator {
|
|||
if (mViewPager.isFakeDragging()) mViewPager.endFakeDrag();
|
||||
break;
|
||||
|
||||
case MotionEventCompat.ACTION_POINTER_DOWN: {
|
||||
final int index = MotionEventCompat.getActionIndex(ev);
|
||||
mLastMotionX = MotionEventCompat.getX(ev, index);
|
||||
mActivePointerId = MotionEventCompat.getPointerId(ev, index);
|
||||
case MotionEvent.ACTION_POINTER_DOWN: {
|
||||
final int index = ev.getActionIndex();
|
||||
mLastMotionX = ev.getX(index);
|
||||
mActivePointerId = ev.getPointerId(index);
|
||||
break;
|
||||
}
|
||||
|
||||
case MotionEventCompat.ACTION_POINTER_UP:
|
||||
final int pointerIndex = MotionEventCompat.getActionIndex(ev);
|
||||
final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
final int pointerIndex = ev.getActionIndex();
|
||||
final int pointerId = ev.getPointerId(pointerIndex);
|
||||
if (pointerId == mActivePointerId) {
|
||||
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
|
||||
mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);
|
||||
mActivePointerId = ev.getPointerId(newPointerIndex);
|
||||
}
|
||||
mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));
|
||||
mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 809 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 809 B |
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_activated="true">
|
||||
<shape>
|
||||
<solid android:color="@color/fosdem_blue_translucent"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:drawable="@android:color/transparent"/>
|
||||
|
||||
</selector>
|
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2 KiB |
|
@ -1,4 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<color
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@android:color/transparent"/>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_activated="true">
|
||||
<shape>
|
||||
<solid android:color="@color/fosdem_blue_translucent"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:drawable="@android:color/transparent"/>
|
||||
|
||||
</selector>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_checked="true">
|
||||
<shape>
|
||||
<solid android:color="@color/fosdem_blue_translucent"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:drawable="@android:color/transparent"/>
|
||||
|
||||
</selector>
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<be.digitalia.fosdem.widgets.CheckableLinearLayout
|
||||
<be.digitalia.fosdem.widgets.ForegroundLinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:foreground="@drawable/checkable_foreground"
|
||||
android:foreground="@drawable/activated_background"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/list_item_padding"
|
||||
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
|
||||
|
@ -44,4 +44,4 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
tools:text="Saturday, 09:30 - 09:55 | Janson"/>
|
||||
|
||||
</be.digitalia.fosdem.widgets.CheckableLinearLayout>
|
||||
</be.digitalia.fosdem.widgets.ForegroundLinearLayout>
|
|
@ -11,7 +11,7 @@
|
|||
app:showAsAction="ifRoom|collapseActionView"/>
|
||||
<item
|
||||
android:id="@+id/refresh"
|
||||
android:icon="@drawable/ic_sync_white_24dp"
|
||||
android:icon="@drawable/avd_sync_white_24dp"
|
||||
android:menuCategory="secondary"
|
||||
android:title="@string/update_events_db"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Main theme -->
|
||||
|
||||
<style name="AppTheme" parent="Base.AppTheme">
|
||||
<item name="android:progressBarStyleHorizontal">@style/ProgressBar.Fosdem</item>
|
||||
<item name="android:fastScrollThumbDrawable">@drawable/fosdem_fastscroll_thumb_holo</item>
|
||||
<item name="android:selectableItemBackground">?attr/selectableItemBackground</item>
|
||||
<item name="android:listChoiceBackgroundIndicator">?attr/listChoiceBackgroundIndicator
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="ProgressBar.Fosdem" parent="android:Widget.Holo.ProgressBar.Horizontal">
|
||||
<item name="android:indeterminateDrawable">
|
||||
@drawable/fosdem_progress_indeterminate_horizontal_holo_light
|
||||
</item>
|
||||
<item name="android:progressDrawable">@drawable/fosdem_progress_horizontal_holo_light</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -16,8 +16,10 @@
|
|||
|
||||
<style name="AppTheme" parent="Base.AppTheme">
|
||||
<item name="android:progressBarStyleHorizontal">@style/ProgressBar.Fosdem</item>
|
||||
<item name="android:listViewStyle">@style/ListView.Fosdem</item>
|
||||
<item name="android:scrollViewStyle">@style/ScrollView.Fosdem</item>
|
||||
<item name="android:fastScrollThumbDrawable">@drawable/fosdem_fastscroll_thumb_holo</item>
|
||||
<item name="android:selectableItemBackground">?attr/selectableItemBackground</item>
|
||||
<item name="android:listChoiceBackgroundIndicator">?attr/listChoiceBackgroundIndicator
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
|
@ -46,23 +48,11 @@
|
|||
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="ProgressBar.Fosdem" parent="android:Widget.ProgressBar.Horizontal">
|
||||
<style name="ProgressBar.Fosdem" parent="android:Widget.Holo.ProgressBar.Horizontal">
|
||||
<item name="android:indeterminateDrawable">
|
||||
@drawable/fosdem_progress_indeterminate_horizontal_holo_light
|
||||
</item>
|
||||
<item name="android:progressDrawable">@drawable/fosdem_progress_horizontal_holo_light</item>
|
||||
<item name="android:minHeight">16dip</item>
|
||||
<item name="android:maxHeight">16dip</item>
|
||||
</style>
|
||||
|
||||
<style name="ListView.Fosdem" parent="android:Widget.ListView.White">
|
||||
<item name="android:listSelector">?attr/listChoiceBackgroundIndicator</item>
|
||||
<item name="android:fadingEdge">none</item>
|
||||
</style>
|
||||
|
||||
<style name="ScrollView.Fosdem" parent="android:Widget.ScrollView">
|
||||
<!-- Fading edges were enabled by default on older devices and are now deprecated. -->
|
||||
<item name="android:fadingEdge">none</item>
|
||||
</style>
|
||||
|
||||
<!-- Styles -->
|
||||
|
|
|
@ -2,14 +2,17 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
}
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Mon Apr 17 16:36:59 CEST 2017
|
||||
#Mon Jan 01 03:03:36 CET 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
|
|