Skip to content

Commit

Permalink
Update to release 1.6.1
Browse files Browse the repository at this point in the history
- Fixed #17, fixed #18
- About description now supports html formatting
  • Loading branch information
danimahardhika authored Feb 2, 2017
1 parent 266512a commit f005f87
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public View getView(final int position, View view, ViewGroup viewGroup) {
} else {
holder = (ViewHolder) view.getTag();
}
if (position > 0 && position < mInAppBillings.length) {
if (position >= 0 && position < mInAppBillings.length) {
final InAppBilling inAppBilling = mInAppBillings[position];
if (inAppBilling != null) {
holder.radio.setChecked(mSelectedPosition == position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,12 @@ public void selectAll() {
return;
}

mSelectedAll = true;
mSelectedItems.clear();
for (int i = 0; i < mRequests.size(); i++) {
mSelectedItems.put(i, true);
if (!mRequests.get(i).isRequested())
mSelectedItems.put(i, true);
}
mSelectedAll = mSelectedItems.size() > 0;
notifyDataSetChanged();
try {
RequestListener listener = (RequestListener) mContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.res.XmlResourceParser;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
Expand All @@ -23,7 +24,6 @@
import android.widget.Toast;

import com.dm.material.dashboard.candybar.R;
import com.dm.material.dashboard.candybar.helpers.ColorHelper;
import com.dm.material.dashboard.candybar.helpers.DrawableHelper;
import com.dm.material.dashboard.candybar.helpers.IconsHelper;
import com.dm.material.dashboard.candybar.items.Icon;
Expand Down Expand Up @@ -98,9 +98,6 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_search, menu);
MenuItem search = menu.findItem(R.id.menu_search);
int color = ColorHelper.getAttributeColor(getActivity(), R.attr.toolbar_icon);
search.setIcon(DrawableHelper.getTintedDrawable(getActivity(),
R.drawable.ic_toolbar_search, color));

MenuItemCompat.setOnActionExpandListener(search, new MenuItemCompat.OnActionExpandListener() {
@Override
Expand All @@ -123,18 +120,21 @@ public void onAnimationEnd(android.animation.Animator animation) {
PagerIconsAdapter adapter = (PagerIconsAdapter) mPager.getAdapter();
if (adapter == null) return;

try {
SearchListener listener = (SearchListener) getActivity();
listener.OnSearchExpanded(true);
} catch (Exception ignored) {}
SearchListener listener = (SearchListener) getActivity();
listener.OnSearchExpanded(true);

fm.beginTransaction()
FragmentTransaction ft = fm.beginTransaction()
.replace(R.id.container,
IconsSearchFragment.newInstance(adapter.mIcons),
IconsSearchFragment.newInstance(adapter.getIcons()),
IconsSearchFragment.TAG)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.addToBackStack(null)
.commit();
.addToBackStack(null);

try {
ft.commit();
} catch (Exception e) {
ft.commitAllowingStateLoss();
}
}
}).start();

Expand Down Expand Up @@ -226,8 +226,10 @@ protected void onPostExecute(Boolean aBoolean) {
for (int i = 0; i < adapter.getCount(); i++) {
TabLayout.Tab tab = mTabLayout.getTabAt(i);
if (tab != null) {
tab.setCustomView(R.layout.fragment_icons_base_tab);
tab.setText(adapter.getPageTitle(i));
if (i < adapter.getCount()) {
tab.setCustomView(R.layout.fragment_icons_base_tab);
tab.setText(adapter.getPageTitle(i));
}
}
}
} else {
Expand All @@ -244,7 +246,7 @@ private class PagerIconsAdapter extends FragmentStatePagerAdapter {

private final List<Icon> mIcons;

PagerIconsAdapter(FragmentManager fm, List<Icon> icons) {
PagerIconsAdapter(@NonNull FragmentManager fm, @NonNull List<Icon> icons) {
super(fm);
mIcons = icons;
}
Expand All @@ -264,6 +266,10 @@ public int getCount() {
return mIcons.size();
}

public List<Icon> getIcons() {
return mIcons;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import com.nostra13.universalimageloader.core.ImageLoader;
import com.dm.material.dashboard.candybar.preferences.Preferences;

import org.sufficientlysecure.htmltextview.HtmlTextView;

/*
* CandyBar - Material Dashboard
*
Expand Down Expand Up @@ -68,6 +70,7 @@ public static void showAbout(FragmentManager fm) {

private ImageView mImageView;
private CircularImageView mProfile;
private HtmlTextView mDescription;
private MaterialRippleLayout mEmailContainer;
private TextView mEmail;
private TextView mLink1;
Expand All @@ -86,6 +89,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

mImageView = (ImageView) dialog.findViewById(R.id.image);
mProfile = (CircularImageView) dialog.findViewById(R.id.profile);
mDescription = (HtmlTextView) dialog.findViewById(R.id.about_desc);
mEmailContainer = (MaterialRippleLayout) dialog.findViewById(R.id.container_email);
mEmail = (TextView) dialog.findViewById(R.id.email);
mLink1 = (TextView) dialog.findViewById(R.id.link1);
Expand Down Expand Up @@ -184,6 +188,9 @@ private void initProfileImage() {
}

private void initAbout() {
String desc = getActivity().getResources().getString(R.string.about_desc);
mDescription.setHtml(desc);

String email = getActivity().getResources().getString(R.string.about_email);
if (email.length() == 0) mEmailContainer.setVisibility(View.GONE);
String link2 = getActivity().getResources().getString(R.string.about_link_2_url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void showIntentChooserDialog(@NonNull FragmentManager fm, @NonNull
try {
DialogFragment dialog = IntentChooserFragment.newInstance(request);
dialog.show(ft, TAG);
} catch (IllegalArgumentException ignored) {}
} catch (IllegalArgumentException | IllegalStateException ignored) {}
}

private ListView mIntentList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void showWallpaperOptionsDialog(FragmentManager fm, String url, St
try {
DialogFragment dialog = WallpaperOptionsFragment.newInstance(url, name);
dialog.show(ft, TAG);
} catch (IllegalArgumentException ignored) {}
} catch (IllegalArgumentException | IllegalStateException ignored) {}
}

private LinearLayout mApply;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public static void showWallpaperSettings(FragmentManager fm) {
}
ft.addToBackStack(null);

DialogFragment dialog = WallpaperSettingsFragment.newInstance();
dialog.show(ft, TAG);
try {
DialogFragment dialog = WallpaperSettingsFragment.newInstance();
dialog.show(ft, TAG);
} catch (IllegalArgumentException | IllegalStateException ignored) {}
}

private AppCompatRadioButton mEnableScrollRadio;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ public void tryUpdate(String wallpaperUrl) {
private void publishArtwork(Wallpaper wallpaper) {
File file = new File(Preferences.getPreferences(this).getWallsDirectory()
+ wallpaper.getName() + FileHelper.IMAGE_EXTENSION);
Uri uri = null;
if (file.exists()) uri = FileHelper.getUriFromFile(this, getPackageName(), file);
if (uri == null) uri = Uri.parse(wallpaper.getURL());

publishArtwork(new Artwork.Builder()
.title(wallpaper.getName())
.byline(wallpaper.getAuthor())
.imageUri(file.exists() ?
Uri.fromFile(file) :
Uri.parse(wallpaper.getURL()))
.imageUri(uri)
.build());

scheduleUpdate(System.currentTimeMillis() +
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
android:textSize="16sp"
fontPath="fonts/Font-Medium.ttf"/>

<TextView
<org.sufficientlysecure.htmltextview.HtmlTextView
android:id="@+id/about_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/about_content_padding"
Expand All @@ -60,9 +61,8 @@
android:layout_marginEnd="@dimen/about_content_padding"
android:layout_marginTop="2dp"
android:gravity="center"
android:text="@string/about_desc"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
android:textSize="@dimen/text_content"
fontPath="fonts/Font-Regular.ttf"/>

<LinearLayout
Expand Down
11 changes: 5 additions & 6 deletions core/src/main/res/values/dashboard_configurations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,11 @@
<string name="about_title">CandyBar Material Dashboard</string>

<!-- About description below title -->
<string name="about_desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.</string>
<string name="about_desc"><![CDATA[
About description now supports html formatting, <b>bold description</b>,
<i>italic description</i>, <u>underline description</u>,
<a href="https://github.com/danimahardhika">link inside description</a>.
]]></string>

<!-- Email that showed in about
* This part must be email
Expand Down

0 comments on commit f005f87

Please sign in to comment.