diff --git a/app/src/full/AndroidManifest.xml b/app/src/full/AndroidManifest.xml index 4e5849b0d..82a320d2b 100644 --- a/app/src/full/AndroidManifest.xml +++ b/app/src/full/AndroidManifest.xml @@ -28,6 +28,9 @@ + { new MarkDownWindow(this, getString(R.string.app_changelog), getResources().openRawResource(R.raw.changelog)).exec(); @@ -64,14 +63,9 @@ public class AboutActivity extends BaseActivity { appTranslators.setSummary(translators); } - appSourceCode.removeSummary(); - appSourceCode.setOnClickListener(view -> Utils.openLink(this, Uri.parse(Const.Url.SOURCE_CODE_URL))); - - supportThread.removeSummary(); - supportThread.setOnClickListener(view -> Utils.openLink(this, Uri.parse(Const.Url.XDA_THREAD))); - - donation.removeSummary(); - donation.setOnClickListener(view -> Utils.openLink(this, Uri.parse(Const.Url.DONATION_URL))); + appSourceCode.setOnClickListener(v -> Utils.openLink(this, Uri.parse(Const.Url.SOURCE_CODE_URL))); + supportThread.setOnClickListener(v -> Utils.openLink(this, Uri.parse(Const.Url.XDA_THREAD))); + twitter.setOnClickListener(v -> Utils.openLink(this, Uri.parse(Const.Url.TWITTER_URL))); setFloating(); } diff --git a/app/src/full/java/com/topjohnwu/magisk/Const.java b/app/src/full/java/com/topjohnwu/magisk/Const.java index 834c38408..38bab71bc 100644 --- a/app/src/full/java/com/topjohnwu/magisk/Const.java +++ b/app/src/full/java/com/topjohnwu/magisk/Const.java @@ -78,7 +78,9 @@ public class Const { public static final String REPO_URL = "https://api.github.com/users/Magisk-Modules-Repo/repos?per_page=100&sort=pushed&page=%d"; public static final String FILE_URL = "https://raw.githubusercontent.com/Magisk-Modules-Repo/%s/master/%s"; public static final String ZIP_URL = "https://github.com/Magisk-Modules-Repo/%s/archive/master.zip"; - public static final String DONATION_URL = "https://www.paypal.me/topjohnwu"; + public static final String PAYPAL_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=CC7FZ7526MNGG"; + public static final String PATREON_URL = "https://www.patreon.com/topjohnwu"; + public static final String TWITTER_URL = "https://twitter.com/topjohnwu"; public static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382"; public static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk"; } diff --git a/app/src/full/java/com/topjohnwu/magisk/DonationActivity.java b/app/src/full/java/com/topjohnwu/magisk/DonationActivity.java new file mode 100644 index 000000000..16d7dafe0 --- /dev/null +++ b/app/src/full/java/com/topjohnwu/magisk/DonationActivity.java @@ -0,0 +1,45 @@ +package com.topjohnwu.magisk; + +import android.net.Uri; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v7.app.ActionBar; +import android.support.v7.widget.Toolbar; + +import com.topjohnwu.magisk.components.AboutCardRow; +import com.topjohnwu.magisk.components.BaseActivity; +import com.topjohnwu.magisk.utils.Utils; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class DonationActivity extends BaseActivity { + + @BindView(R.id.toolbar) Toolbar toolbar; + @BindView(R.id.paypal) AboutCardRow paypal; + @BindView(R.id.patreon) AboutCardRow patreon; + + @Override + public int getDarkTheme() { + return R.style.AppTheme_StatusBar_Dark; + } + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_donation); + ButterKnife.bind(this); + + setSupportActionBar(toolbar); + toolbar.setNavigationOnClickListener(view -> finish()); + + ActionBar ab = getSupportActionBar(); + if (ab != null) { + ab.setTitle(R.string.donation); + ab.setDisplayHomeAsUpEnabled(true); + } + + paypal.setOnClickListener(v -> Utils.openLink(this, Uri.parse(Const.Url.PAYPAL_URL))); + patreon.setOnClickListener(v -> Utils.openLink(this, Uri.parse(Const.Url.PATREON_URL))); + } +} diff --git a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java index 144e01466..406a1c7dc 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java @@ -160,6 +160,9 @@ public class MainActivity extends BaseActivity case "about": itemId = R.id.app_about; break; + case "donation": + itemId = R.id.donation; + break; } } navigate(itemId); @@ -196,6 +199,10 @@ public class MainActivity extends BaseActivity startActivity(new Intent(this, AboutActivity.class)); mDrawerItem = bak; break; + case R.id.donation: + startActivity(new Intent(this, DonationActivity.class)); + mDrawerItem = bak; + break; } } diff --git a/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java b/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java index db022cc97..b377ddad8 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/AboutCardRow.java @@ -28,19 +28,18 @@ import android.widget.TextView; import com.topjohnwu.magisk.R; +import butterknife.BindView; +import butterknife.ButterKnife; + /** * @author dvdandroid */ public class AboutCardRow extends LinearLayout { - private final String title; - private final Drawable icon; - - private final TextView mTitle; - private final TextView mSummary; - private final ImageView mIcon; - - private final View mView; + @BindView(android.R.id.title) TextView mTitle; + @BindView(android.R.id.summary) TextView mSummary; + @BindView(android.R.id.icon) ImageView mIcon; + @BindView(R.id.container) View mView; public AboutCardRow(Context context) { this(context, null); @@ -53,21 +52,17 @@ public class AboutCardRow extends LinearLayout { public AboutCardRow(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutInflater.from(context).inflate(R.layout.info_item_row, this); - TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0); + ButterKnife.bind(this, this); + TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0); + String title; + Drawable icon; try { title = a.getString(R.styleable.AboutCardRow_text); icon = a.getDrawable(R.styleable.AboutCardRow_icon); } finally { a.recycle(); } - - mView = findViewById(R.id.container); - - mTitle = (TextView) findViewById(android.R.id.title); - mSummary = (TextView) findViewById(android.R.id.summary); - mIcon = (ImageView) findViewById(android.R.id.icon); - mTitle.setText(title); mIcon.setImageDrawable(icon); } @@ -80,10 +75,7 @@ public class AboutCardRow extends LinearLayout { } public void setSummary(String s) { + mSummary.setVisibility(VISIBLE); mSummary.setText(s); } - - public void removeSummary() { - mSummary.setVisibility(GONE); - } } \ No newline at end of file diff --git a/app/src/full/res/drawable/ic_patreon.xml b/app/src/full/res/drawable/ic_patreon.xml new file mode 100644 index 000000000..8e425724e --- /dev/null +++ b/app/src/full/res/drawable/ic_patreon.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/full/res/drawable/ic_paypal.xml b/app/src/full/res/drawable/ic_paypal.xml new file mode 100644 index 000000000..c0c88c934 --- /dev/null +++ b/app/src/full/res/drawable/ic_paypal.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/full/res/drawable/ic_twitter.xml b/app/src/full/res/drawable/ic_twitter.xml new file mode 100644 index 000000000..1bdb389c4 --- /dev/null +++ b/app/src/full/res/drawable/ic_twitter.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/full/res/layout/activity_about.xml b/app/src/full/res/layout/activity_about.xml index 2d77018df..3eb5142dc 100644 --- a/app/src/full/res/layout/activity_about.xml +++ b/app/src/full/res/layout/activity_about.xml @@ -75,6 +75,13 @@ app:icon="@drawable/ic_language" app:text="@string/app_translators"/> + + - - - - - - - - - - diff --git a/app/src/full/res/layout/info_item_row.xml b/app/src/full/res/layout/info_item_row.xml index ea51a6de1..f3ad583e4 100644 --- a/app/src/full/res/layout/info_item_row.xml +++ b/app/src/full/res/layout/info_item_row.xml @@ -49,6 +49,7 @@ diff --git a/app/src/full/res/menu/drawer.xml b/app/src/full/res/menu/drawer.xml index 4d44c765a..1a6011215 100644 --- a/app/src/full/res/menu/drawer.xml +++ b/app/src/full/res/menu/drawer.xml @@ -52,12 +52,24 @@ android:icon="@drawable/ic_settings" android:title="@string/settings"/> + + + + + + diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml index f7a010afb..0acb39075 100644 --- a/app/src/full/res/values/strings.xml +++ b/app/src/full/res/values/strings.xml @@ -68,6 +68,7 @@ Donation Translators Support thread + Follow me on Twitter Close diff --git a/app/src/main/res/layout/activity_donation.xml b/app/src/main/res/layout/activity_donation.xml new file mode 100644 index 000000000..48be5f29a --- /dev/null +++ b/app/src/main/res/layout/activity_donation.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file