1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-17 22:11:35 +02:00

added donate button

This commit is contained in:
oliexdev
2019-06-02 17:41:18 +02:00
parent 2cf521fc25
commit 24498a43c9
10 changed files with 23 additions and 9 deletions

View File

@@ -37,6 +37,16 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationView; import com.google.android.material.navigation.NavigationView;
import com.health.openscale.BuildConfig; import com.health.openscale.BuildConfig;
@@ -58,15 +68,6 @@ import com.health.openscale.gui.preferences.BluetoothPreferences;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import cat.ereza.customactivityoncrash.config.CaocConfig; import cat.ereza.customactivityoncrash.config.CaocConfig;
import timber.log.Timber; import timber.log.Timber;
@@ -141,9 +142,11 @@ public class MainActivity extends BaseAppCompatActivity
if (BuildConfig.BUILD_TYPE == "light") { if (BuildConfig.BUILD_TYPE == "light") {
ImageView launcherIcon = navDrawer.getHeaderView(0).findViewById(R.id.profileImageView); ImageView launcherIcon = navDrawer.getHeaderView(0).findViewById(R.id.profileImageView);
launcherIcon.setImageResource(R.drawable.ic_launcher_openscale_light); launcherIcon.setImageResource(R.drawable.ic_launcher_openscale_light);
navDrawer.getMenu().findItem(R.id.nav_donation).setVisible(false);
} else if (BuildConfig.BUILD_TYPE == "pro") { } else if (BuildConfig.BUILD_TYPE == "pro") {
ImageView launcherIcon = navDrawer.getHeaderView(0).findViewById(R.id.profileImageView); ImageView launcherIcon = navDrawer.getHeaderView(0).findViewById(R.id.profileImageView);
launcherIcon.setImageResource(R.drawable.ic_launcher_openscale_pro); launcherIcon.setImageResource(R.drawable.ic_launcher_openscale_pro);
navDrawer.getMenu().findItem(R.id.nav_donation).setVisible(false);
} }
if (prefs.getBoolean("firstStart", true)) { if (prefs.getBoolean("firstStart", true)) {
@@ -306,6 +309,10 @@ public class MainActivity extends BaseAppCompatActivity
settingsActivityRunning = true; settingsActivityRunning = true;
startActivity(settingsIntent); startActivity(settingsIntent);
return; return;
case R.id.nav_donation:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H5KSTQA6TKTE4&source=url")));
drawerLayout.closeDrawers();
return;
case R.id.nav_help: case R.id.nav_help:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/oliexdev/openScale/wiki"))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/oliexdev/openScale/wiki")));
drawerLayout.closeDrawers(); drawerLayout.closeDrawers();

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

View File

@@ -32,6 +32,11 @@
android:icon="@drawable/ic_preferences_settings" android:icon="@drawable/ic_preferences_settings"
android:title="@string/action_settings" /> android:title="@string/action_settings" />
<item
android:id="@+id/nav_donation"
android:icon="@drawable/ic_preference_donate"
android:title="@string/action_donation" />
<item <item
android:id="@+id/nav_help" android:id="@+id/nav_help"
android:icon="@drawable/ic_preferences_help" android:icon="@drawable/ic_preferences_help"

View File

@@ -236,4 +236,5 @@
<string name="permission_location_service_info">Gewährleisten Sie den Standortzugriff in den Android-Einstellungen, um nach Bluetooth-Geräten zu suchen. Sie können es anschließend wieder widerrufen.</string> <string name="permission_location_service_info">Gewährleisten Sie den Standortzugriff in den Android-Einstellungen, um nach Bluetooth-Geräten zu suchen. Sie können es anschließend wieder widerrufen.</string>
<string name="label_is_on_right_axis">Auf der rechten Achse</string> <string name="label_is_on_right_axis">Auf der rechten Achse</string>
<string name="label_upgrade_to_openScale_pro">Bitte upgraden Sie auf openScale pro für Bluetooth-Unterstützung</string> <string name="label_upgrade_to_openScale_pro">Bitte upgraden Sie auf openScale pro für Bluetooth-Unterstützung</string>
<string name="action_donation">Spende</string>
</resources> </resources>

View File

@@ -11,6 +11,7 @@
<string name="title_general">General</string> <string name="title_general">General</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="action_bluetooth_status">Bluetooth Status</string> <string name="action_bluetooth_status">Bluetooth Status</string>
<string name="action_donation">Donation</string>
<string name="open_drawer">open</string> <string name="open_drawer">open</string>
<string name="close_drawer">close</string> <string name="close_drawer">close</string>
<string name="label_cancel">Cancel</string> <string name="label_cancel">Cancel</string>