Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F-Droid flavor #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ android {
zipAlignEnabled true
}
}
flavorDimensions "store"
productFlavors {
play {
}

fdroid {
}
}
lintOptions {
checkReleaseBuilds false // Add this
abortOnError false
Expand All @@ -49,16 +57,17 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:preference-v7:26.1.0'
implementation 'com.android.support:preference-v14:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
def supportLibVersion = '26.0.2'
implementation 'com.android.support:appcompat-v7:${supportLibVersion}'
implementation 'com.android.support:preference-v7:${supportLibVersion}'
implementation 'com.android.support:preference-v14:${supportLibVersion}'
implementation 'com.android.support:support-v4:${supportLibVersion}'
implementation 'com.android.support:recyclerview-v7:${supportLibVersion}'
implementation 'com.android.support:design:${supportLibVersion}'
implementation 'com.android.support:cardview-v7:${supportLibVersion}'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.billingclient:billing:1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
implementation 'com.android.billingclient:billing:dp-1'
playImplementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.zacharee1.systemuituner.activites;

import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.zacharee1.systemuituner.R;
import com.zacharee1.systemuituner.misc.BillingUtil;
import com.zacharee1.systemuituner.misc.OptionSelected;
import com.zacharee1.systemuituner.misc.RecreateHandler;

@SuppressWarnings("unused")
public class MainActivity extends AppCompatActivity
{
@SuppressWarnings("FieldCanBeLocal")
private static boolean DARK = false;
private BillingUtil mBilling;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
DARK = sharedPreferences.getBoolean("dark_mode", false);

setTheme(DARK ? R.style.AppTheme_Dark : R.style.AppTheme);

RecreateHandler.onCreate(this);

setContentView(R.layout.activity_main);

mBilling = new BillingUtil(this);
}

@Override
protected void onDestroy()
{
RecreateHandler.onDestroy(this);
super.onDestroy();
}

@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item)
{
return OptionSelected.doAction(item, this);
}

public void launchList(@Nullable View v) {
startActivity(new Intent(this, ItemListActivity.class));
}

public void onDonatePayPalClicked(View v) {
BillingUtil.onDonatePayPalClicked(this);
}

public void onDonate1Clicked(View v) {
mBilling.onDonateClicked("donate_1");
}

public void onDonate2Clicked(View v) {
mBilling.onDonateClicked("donate_2");
}

public void onDonate5Clicked(View v) {
mBilling.onDonateClicked("donate_5");
}

public void onDonate10Clicked(View v) {
mBilling.onDonateClicked("donate_10");
}
}
44 changes: 44 additions & 0 deletions app/src/fdroid/res/xml/settings_general.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

<PreferenceCategory
android:title="@string/general">

<SwitchPreference
android:title="@string/dark_mode"
android:key="dark_mode" />

<SwitchPreference
android:title="@string/hide_welcome_screen"
android:key="hide_welcome_screen" />

</PreferenceCategory>

<PreferenceCategory
android:title="@string/danger_zone">

<SwitchPreference
android:title="@string/safe_mode"
android:key="safe_mode"
android:summary="@string/safe_mode_summary"/>

<SwitchPreference
android:title="@string/enable_custom_settings_input"
android:key="allow_custom_settings_input" />

</PreferenceCategory>

<PreferenceCategory
android:title="@string/tasker_support">

<SwitchPreference
android:title="@string/enabled"
android:key="tasker_support_enabled" />

<Preference
android:title="@string/instructions"
android:key="tasker_instructions" />

</PreferenceCategory>

</PreferenceScreen>