Asking for support

This commit is contained in:
M66B 2018-07-08 07:56:55 +00:00
parent 40d96793a3
commit bcbd82d48b
6 changed files with 67 additions and 9 deletions

View File

@ -46,11 +46,13 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.SwitchCompat;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
@ -401,6 +403,27 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
// Support
LinearLayout llSupport = findViewById(R.id.llSupport);
TextView tvSupport = findViewById(R.id.tvSupport);
SpannableString content = new SpannableString(getString(R.string.app_support));
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
tvSupport.setText(content);
llSupport.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Util.isPlayStoreInstall(ActivityMain.this))
startActivity(new Intent(ActivityMain.this, ActivityPro.class));
else {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://contact.faircode.eu/?product=netguardstandalone"));
startActivity(intent);
}
}
});
// Handle intent
checkExtras(getIntent());
}
@ -438,6 +461,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
if (adapter != null)
adapter.notifyDataSetChanged();
LinearLayout llSupport = findViewById(R.id.llSupport);
llSupport.setVisibility(IAB.isPurchasedAny(this) ? View.GONE : View.VISIBLE);
super.onResume();
}

View File

@ -195,7 +195,7 @@ public class IAB implements ServiceConnection {
try {
if (Util.isDebuggable(context)) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return !(prefs.getBoolean("debug_iab", false) || prefs.getBoolean("debug_ads", false));
return !(prefs.getBoolean("debug_iab", false));
}
SharedPreferences prefs = context.getSharedPreferences("IAB", Context.MODE_PRIVATE);

View File

@ -148,6 +148,45 @@
android:text="@android:string/ok"
android:textAppearance="@style/TextSmall" />
</LinearLayout>
<LinearLayout
android:id="@+id/llSupport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginStart="4dp"
android:orientation="horizontal">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_security_color_24dp" />
<TextView
android:id="@+id/tvSupport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginStart="4dp"
android:textAppearance="@style/TextSmall"
android:textColor="?attr/colorOff" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View

View File

@ -11,6 +11,7 @@ however it is impossible to guarantee NetGuard will work correctly on every devi
\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR \'\'AS IS\'\' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</string>
<string name="app_agree">I agree</string>
<string name="app_disagree">I disagree</string>
<string name="app_support">NetGuard needs your help. Tap to purchase pro features to keep the project going.</string>
<string name="channel_foreground">Running services</string>
<string name="channel_notify">General notifications</string>

View File

@ -348,10 +348,6 @@
android:defaultValue="false"
android:key="debug_iab"
android:title="Debug IAB" />
<CheckBoxPreference
android:defaultValue="false"
android:key="debug_ads"
android:title="Debug advertisements" />
</PreferenceCategory>
</PreferenceScreen>

View File

@ -348,10 +348,6 @@
android:defaultValue="false"
android:key="debug_iab"
android:title="Debug IAB" />
<eu.faircode.netguard.SwitchPreference
android:defaultValue="false"
android:key="debug_ads"
android:title="Debug advertisements" />
</PreferenceCategory>
</PreferenceScreen>