Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 6ae41a4

Browse files
Update to latest release
1 parent a972825 commit 6ae41a4

19 files changed

+106
-77
lines changed

core/src/main/java/com/dm/material/dashboard/candybar/activities/CandyBarWallpaperActivity.java

+19-14
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.os.Build;
1010
import android.os.Bundle;
1111
import android.os.Handler;
12+
import android.support.annotation.ColorInt;
1213
import android.support.annotation.NonNull;
1314
import android.support.design.widget.FloatingActionButton;
1415
import android.support.v4.app.ActivityCompat;
@@ -26,6 +27,7 @@
2627

2728
import com.dm.material.dashboard.candybar.fragments.dialog.WallpaperSettingsFragment;
2829
import com.dm.material.dashboard.candybar.helpers.ViewHelper;
30+
import com.dm.material.dashboard.candybar.utils.Animator;
2931
import com.kogitune.activitytransition.ActivityTransition;
3032
import com.kogitune.activitytransition.ExitActivityTransition;
3133
import com.dm.material.dashboard.candybar.R;
@@ -130,6 +132,9 @@ public void initWallpaperActivity(Bundle savedInstanceState, Intent intent) {
130132
.duration(300)
131133
.start(savedInstanceState);
132134

135+
Animator.startAlphaAnimation(toolbar, 1000, View.VISIBLE);
136+
toolbar.setVisibility(View.VISIBLE);
137+
133138
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && savedInstanceState == null) {
134139
Transition transition = getWindow().getSharedElementEnterTransition();
135140

@@ -269,13 +274,8 @@ public void onLoadingStarted(String imageUri, View view) {
269274
@Override
270275
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
271276
super.onLoadingFailed(imageUri, view, failReason);
272-
mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);
273-
mProgress.setVisibility(View.GONE);
274277
int text = ColorHelper.getTitleTextColor(CandyBarWallpaperActivity.this, mColor);
275-
mFab.setImageDrawable(DrawableHelper.getTintedDrawable(
276-
CandyBarWallpaperActivity.this, R.drawable.ic_fab_check, text));
277-
mFab.show();
278-
mFab.setVisibility(View.VISIBLE);
278+
OnWallpaperLoaded(text);
279279
}
280280

281281
@Override
@@ -285,10 +285,6 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
285285
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
286286
}
287287

288-
mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);
289-
mRunnable = null;
290-
mHandler = null;
291-
mProgress.setVisibility(View.GONE);
292288
if (loadedImage != null) {
293289
Palette.from(loadedImage).generate(palette -> {
294290
int accent = ColorHelper.getAttributeColor(
@@ -299,14 +295,23 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
299295
mFab.setBackgroundTintList(ColorHelper.getColorStateList(
300296
android.R.attr.state_pressed,
301297
color, ColorHelper.getDarkerColor(color, 0.9f)));
302-
mFab.setImageDrawable(DrawableHelper.getTintedDrawable(
303-
CandyBarWallpaperActivity.this, R.drawable.ic_fab_check, text));
304-
mFab.show();
305-
mFab.setVisibility(View.VISIBLE);
298+
OnWallpaperLoaded(text);
306299
});
307300
}
308301
}
309302
});
310303
}
311304

305+
private void OnWallpaperLoaded(@ColorInt int textColor) {
306+
mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);
307+
mProgress.setVisibility(View.GONE);
308+
mRunnable = null;
309+
mHandler = null;
310+
311+
mFab.setImageDrawable(DrawableHelper.getTintedDrawable(
312+
CandyBarWallpaperActivity.this, R.drawable.ic_fab_check, textColor));
313+
mFab.show();
314+
mFab.setVisibility(View.VISIBLE);
315+
}
316+
312317
}

core/src/main/java/com/dm/material/dashboard/candybar/adapters/FAQsAdapter.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.dm.material.dashboard.candybar.adapters;
22

3-
import android.content.Context;
43
import android.support.annotation.NonNull;
54
import android.support.v7.widget.RecyclerView;
65
import android.view.LayoutInflater;
@@ -36,20 +35,18 @@
3635

3736
public class FAQsAdapter extends RecyclerView.Adapter<FAQsAdapter.ViewHolder> {
3837

39-
private final Context mContext;
4038
private final List<FAQs> mFAQs;
4139
private final List<FAQs> mFAQsAll;
4240

43-
public FAQsAdapter(@NonNull Context context, @NonNull List<FAQs> faqs) {
44-
mContext = context;
41+
public FAQsAdapter(@NonNull List<FAQs> faqs) {
4542
mFAQs = faqs;
4643
mFAQsAll = new ArrayList<>();
4744
mFAQsAll.addAll(mFAQs);
4845
}
4946

5047
@Override
5148
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
52-
View view = LayoutInflater.from(mContext).inflate(
49+
View view = LayoutInflater.from(parent.getContext()).inflate(
5350
R.layout.fragment_faqs_item_list, parent, false);
5451
return new ViewHolder(view);
5552
}

core/src/main/java/com/dm/material/dashboard/candybar/adapters/IntentAdapter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ private void sendRequest(ComponentName name) {
134134
if (mRequest.getStream().length() > 0) {
135135
File zip = new File(mRequest.getStream());
136136
Uri uri = FileHelper.getUriFromFile(mContext, mContext.getPackageName(), zip);
137-
if (uri != null) intent.putExtra(Intent.EXTRA_STREAM, uri);
137+
if (uri == null) uri = Uri.fromFile(zip);
138+
intent.putExtra(Intent.EXTRA_STREAM, uri);
138139
}
139140

140141
intent.putExtra(Intent.EXTRA_EMAIL,

core/src/main/java/com/dm/material/dashboard/candybar/adapters/WallpapersAdapter.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ public void onLoadingStarted(String imageUri, View view) {
110110
holder.card.setCardBackgroundColor(vibrant);
111111
int primary = ColorHelper.getAttributeColor(
112112
mContext, android.R.attr.textColorPrimary);
113-
int secondary = ColorHelper.getAttributeColor(
114-
mContext, android.R.attr.textColorSecondary);
115113
holder.name.setTextColor(primary);
116-
holder.author.setTextColor(secondary);
114+
holder.author.setTextColor(primary);
117115
}
118116
}
119117

core/src/main/java/com/dm/material/dashboard/candybar/fragments/FAQsFragment.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
public class FAQsFragment extends Fragment {
5757

5858
private RecyclerView mFAQsList;
59-
private RecyclerFastScroller mFastScroll;
6059
private TextView mSearchResult;
6160

6261
private FAQsAdapter mAdapter;
@@ -68,7 +67,6 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
6867
@Nullable Bundle savedInstanceState) {
6968
View view = inflater.inflate(R.layout.fragment_faqs, container, false);
7069
mFAQsList = (RecyclerView) view.findViewById(R.id.faqs_list);
71-
mFastScroll = (RecyclerFastScroller) view.findViewById(R.id.fastscroll);
7270
mSearchResult = (TextView) view.findViewById(R.id.search_result);
7371
return view;
7472
}
@@ -82,7 +80,10 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
8280
mFAQsList.setItemAnimator(new DefaultItemAnimator());
8381
mFAQsList.setHasFixedSize(false);
8482
mFAQsList.setLayoutManager(new LinearLayoutManager(getActivity()));
85-
mFastScroll.attachRecyclerView(mFAQsList);
83+
84+
RecyclerFastScroller fastScroller = (RecyclerFastScroller)
85+
getActivity().findViewById(R.id.fastscroll);
86+
if (fastScroller != null) fastScroller.attachRecyclerView(mFAQsList);
8687

8788
getFAQs();
8889
}
@@ -199,7 +200,7 @@ protected void onPostExecute(Boolean aBoolean) {
199200
super.onPostExecute(aBoolean);
200201
if (aBoolean) {
201202
setHasOptionsMenu(true);
202-
mAdapter = new FAQsAdapter(getActivity(), faqs);
203+
mAdapter = new FAQsAdapter(faqs);
203204
mFAQsList.setAdapter(mAdapter);
204205
}
205206
mGetFAQs = null;

core/src/main/java/com/dm/material/dashboard/candybar/fragments/HomeFragment.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public class HomeFragment extends Fragment {
6161
private LinearLayout mQuickApply;
6262
private ImageView mAppsIcon;
6363
private ImageView mQuickApplyIcon;
64-
private TextView mQuickApplyText;
6564
private NestedScrollView mScrollView;
66-
private View mShadow;
6765

6866
@Nullable
6967
@Override
@@ -78,9 +76,7 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
7876
mQuickApply = (LinearLayout) view.findViewById(R.id.quick_apply);
7977
mAppsIcon = (ImageView) view.findViewById(R.id.more_apps_icon);
8078
mQuickApplyIcon = (ImageView) view.findViewById(R.id.quick_apply_icon);
81-
mQuickApplyText = (TextView) view.findViewById(R.id.quick_apply_text);
8279
mScrollView = (NestedScrollView) view.findViewById(R.id.scrollview);
83-
mShadow = view.findViewById(R.id.shadow);
8480
return view;
8581
}
8682

@@ -109,7 +105,8 @@ public void onResume() {
109105
}
110106

111107
public void showToolbarShadow(boolean isTimeToShow) {
112-
mShadow.setVisibility(isTimeToShow ? View.VISIBLE : View.GONE);
108+
View shadow = getActivity().findViewById(R.id.shadow);
109+
if (shadow != null) shadow.setVisibility(isTimeToShow ? View.VISIBLE : View.GONE);
113110
}
114111

115112
private void initDescription() {
@@ -141,7 +138,9 @@ private void initQuickApply() {
141138
String text = getActivity().getResources().getString(R.string.quick_apply_desc) +" "+
142139
getActivity().getResources().getString(R.string.app_name) +" "+
143140
getActivity().getResources().getString(R.string.quick_apply_desc_1);
144-
mQuickApplyText.setText(text);
141+
142+
TextView quickApplyText = (TextView) getActivity().findViewById(R.id.quick_apply_text);
143+
if (quickApplyText != null) quickApplyText.setText(text);
145144
}
146145
}
147146

core/src/main/java/com/dm/material/dashboard/candybar/fragments/IconsBaseFragment.java

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public boolean onMenuItemActionExpand(MenuItem item) {
107107
FragmentManager fm = getActivity().getSupportFragmentManager();
108108
if (fm == null) return false;
109109

110+
setHasOptionsMenu(false);
110111
View view = getActivity().findViewById(R.id.shadow);
111112
if (view != null) view.animate().translationY(-mTabLayout.getHeight())
112113
.setDuration(200).start();

core/src/main/java/com/dm/material/dashboard/candybar/fragments/IconsFragment.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public class IconsFragment extends Fragment {
5353
private AutoFitRecyclerView mIconsGrid;
5454
private RecyclerFastScroller mFastScroll;
5555

56-
private IconsAdapter mAdapter;
5756
private String mTitle;
5857
private AsyncTask<Void, Void, Boolean> mGetIcons;
5958

@@ -183,8 +182,8 @@ public int compare(Object o1, Object o2) {
183182
protected void onPostExecute(Boolean aBoolean) {
184183
super.onPostExecute(aBoolean);
185184
if (aBoolean) {
186-
mAdapter = new IconsAdapter(getActivity(), icons);
187-
mIconsGrid.setAdapter(mAdapter);
185+
IconsAdapter adapter = new IconsAdapter(getActivity(), icons);
186+
mIconsGrid.setAdapter(adapter);
188187
}
189188
mGetIcons = null;
190189
}

core/src/main/java/com/dm/material/dashboard/candybar/fragments/IconsSearchFragment.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ protected Boolean doInBackground(Void... voids) {
189189
Thread.sleep(1);
190190
XmlResourceParser parser = getActivity().getResources().getXml(R.xml.drawable);
191191
int eventType = parser.getEventType();
192-
String category = "";
193192

194193
while (eventType != XmlPullParser.END_DOCUMENT) {
195194
if (eventType == XmlPullParser.START_TAG) {
@@ -199,7 +198,7 @@ protected Boolean doInBackground(Void... voids) {
199198
if (id > 0) {
200199
name = IconsHelper.replaceIconName(
201200
getActivity(), iconReplacer, name);
202-
Icon icon = new Icon(category, name, id);
201+
Icon icon = new Icon(name, id);
203202
icons.add(icon);
204203
}
205204
}

core/src/main/java/com/dm/material/dashboard/candybar/fragments/RequestFragment.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
public class RequestFragment extends Fragment implements View.OnClickListener {
8484

8585
private RecyclerView mRequestList;
86-
private RecyclerFastScroller mFastScroll;
8786
private ProgressBar mProgress;
8887
private FloatingActionButton mFab;
8988

@@ -97,7 +96,6 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
9796
@Nullable Bundle savedInstanceState) {
9897
View view = inflater.inflate(R.layout.fragment_request, container, false);
9998
mRequestList = (RecyclerView) view.findViewById(R.id.request_list);
100-
mFastScroll = (RecyclerFastScroller) view.findViewById(R.id.fastscroll);
10199
mProgress = (ProgressBar) view.findViewById(R.id.progress);
102100
mFab = (FloatingActionButton) view.findViewById(R.id.fab);
103101
return view;
@@ -126,7 +124,10 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
126124
mRequestList.getItemAnimator().setChangeDuration(0);
127125
mRequestList.setHasFixedSize(false);
128126
mRequestList.setLayoutManager(new LinearLayoutManager(getActivity()));
129-
mFastScroll.attachRecyclerView(mRequestList);
127+
128+
RecyclerFastScroller fastScroller = (RecyclerFastScroller)
129+
getActivity().findViewById(R.id.fastscroll);
130+
if (fastScroller != null) fastScroller.attachRecyclerView(mRequestList);
130131

131132
getMissingApps();
132133
}

0 commit comments

Comments
 (0)