commit 89a5ada48a41b52d5210459ccccb7ed086b72ea1 Author: Christian Basler Date: Wed Aug 5 19:48:41 2015 +0200 Initial commit A.k.a. "I should have done this some time ago" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80e1268 --- /dev/null +++ b/.gitignore @@ -0,0 +1,191 @@ +# Created by https://www.gitignore.io + +### Android ### +# Built application files +*.apk +*.ap_ + +# Files for the Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ + +# Gradle files +.gradle/ +build/ +/*/build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +### Android Patch ### +gen-external-apklibs + + +### Gradle ### +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm + +*.iml + +## Directory-based project format: +.idea/ +# if you remove the above rule, at least ignore the following: + +# User-specific stuff: +# .idea/workspace.xml +# .idea/tasks.xml +# .idea/dictionaries + +# Sensitive or high-churn files: +# .idea/dataSources.ids +# .idea/dataSources.xml +# .idea/sqlDataSources.xml +# .idea/dynamic.xml +# .idea/uiDesigner.xml + +# Gradle: +# .idea/gradle.xml +# .idea/libraries + +# Mongo Explorer plugin: +# .idea/mongoSettings.xml + +## File-based project format: +*.ipr +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties + + +### Eclipse ### +*.pydevproject +.metadata +.gradle +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath + +# Eclipse Core +.project + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse + + +### Linux ### +*~ + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + + +### OSX ### +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Windows ### +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..679e0a6 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,51 @@ +apply plugin: 'idea' +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "ch.dissem.apps.abit" + minSdkVersion 15 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.android.support:support-v4:22.2.1' + compile 'com.android.support:design:22.2.1' + + compile 'ch.dissem.jabit:jabit-domain:0.2.1-SNAPSHOT' + compile 'ch.dissem.jabit:jabit-networking:0.2.1-SNAPSHOT' + compile 'ch.dissem.jabit:jabit-repositories:0.2.1-SNAPSHOT' + compile 'ch.dissem.jabit:jabit-security-spongy:0.2.1-SNAPSHOT' + + compile 'org.sqldroid:sqldroid:1.0.3' + compile 'org.slf4j:slf4j-android:1.7.12' + + compile('com.mikepenz:materialdrawer:3.1.0@aar') { + transitive = true + } +} + +idea.module { + downloadJavadoc = true + downloadSources = true +} + +android { + lintOptions { + abortOnError false + } +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..ebd5a6a --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/chris/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/ch/dissem/apps/abit/ApplicationTest.java b/app/src/androidTest/java/ch/dissem/apps/abit/ApplicationTest.java new file mode 100644 index 0000000..bd2f7c5 --- /dev/null +++ b/app/src/androidTest/java/ch/dissem/apps/abit/ApplicationTest.java @@ -0,0 +1,13 @@ +package ch.dissem.apps.abit; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3f38a3f --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/assets/db/migration/V1.0__Create_table_inventory.sql b/app/src/main/assets/db/migration/V1.0__Create_table_inventory.sql new file mode 100644 index 0000000..bbf98ad --- /dev/null +++ b/app/src/main/assets/db/migration/V1.0__Create_table_inventory.sql @@ -0,0 +1,8 @@ +CREATE TABLE Inventory ( + hash BINARY(32) NOT NULL PRIMARY KEY, + stream INTEGER NOT NULL, + expires INTEGER NOT NULL, + data BLOB NOT NULL, + type INTEGER NOT NULL, + version INTEGER NOT NULL +); \ No newline at end of file diff --git a/app/src/main/assets/db/migration/V1.1__Create_table_address.sql b/app/src/main/assets/db/migration/V1.1__Create_table_address.sql new file mode 100644 index 0000000..61d2107 --- /dev/null +++ b/app/src/main/assets/db/migration/V1.1__Create_table_address.sql @@ -0,0 +1,8 @@ +CREATE TABLE Address ( + address VARCHAR(40) NOT NULL PRIMARY KEY, + version INTEGER NOT NULL, + alias VARCHAR(255), + public_key BLOB, + private_key BLOB, + subscribed BIT DEFAULT '0' +); \ No newline at end of file diff --git a/app/src/main/assets/db/migration/V1.2__Create_table_message.sql b/app/src/main/assets/db/migration/V1.2__Create_table_message.sql new file mode 100644 index 0000000..03ffbbe --- /dev/null +++ b/app/src/main/assets/db/migration/V1.2__Create_table_message.sql @@ -0,0 +1,40 @@ +CREATE TABLE Message ( + id INTEGER PRIMARY KEY, + iv BINARY(32) UNIQUE, + type VARCHAR(20) NOT NULL, + sender VARCHAR(40) NOT NULL, + recipient VARCHAR(40), + data BLOB NOT NULL, + sent INTEGER, + received INTEGER, + status VARCHAR(20) NOT NULL, + + FOREIGN KEY (sender) REFERENCES Address (address), + FOREIGN KEY (recipient) REFERENCES Address (address) +); + +CREATE TABLE Label ( + id INTEGER PRIMARY KEY, + label VARCHAR(255) NOT NULL, + type VARCHAR(20), + color INT NOT NULL DEFAULT 4278190080, -- FF000000 + ord INTEGER, + + CONSTRAINT UC_label UNIQUE (label), + CONSTRAINT UC_order UNIQUE (ord) +); + +CREATE TABLE Message_Label ( + message_id INTEGER NOT NULL, + label_id INTEGER NOT NULL, + + PRIMARY KEY (message_id, label_id), + FOREIGN KEY (message_id) REFERENCES Message (id), + FOREIGN KEY (label_id) REFERENCES Label (id) +); + +INSERT INTO Label(label, type, color, ord) VALUES ('Inbox', 'INBOX', 4278190335, 0); +INSERT INTO Label(label, type, color, ord) VALUES ('Drafts', 'DRAFT', 4294940928, 10); +INSERT INTO Label(label, type, color, ord) VALUES ('Sent', 'SENT', 4294967040, 20); +INSERT INTO Label(label, type, ord) VALUES ('Unread', 'UNREAD', 90); +INSERT INTO Label(label, type, ord) VALUES ('Trash', 'TRASH', 100); diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageDetailActivity.java b/app/src/main/java/ch/dissem/apps/abit/MessageDetailActivity.java new file mode 100644 index 0000000..842cc75 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/MessageDetailActivity.java @@ -0,0 +1,68 @@ +package ch.dissem.apps.abit; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.support.v4.app.NavUtils; +import android.view.MenuItem; + + +/** + * An activity representing a single Message detail screen. This + * activity is only used on handset devices. On tablet-size devices, + * item details are presented side-by-side with a list of items + * in a {@link MessageListActivity}. + *

+ * This activity is mostly just a 'shell' activity containing nothing + * more than a {@link MessageDetailFragment}. + */ +public class MessageDetailActivity extends ActionBarActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_message_detail); + + // Show the Up button in the action bar. + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + // savedInstanceState is non-null when there is fragment state + // saved from previous configurations of this activity + // (e.g. when rotating the screen from portrait to landscape). + // In this case, the fragment will automatically be re-added + // to its container so we don't need to manually add it. + // For more information, see the Fragments API guide at: + // + // http://developer.android.com/guide/components/fragments.html + // + if (savedInstanceState == null) { + // Create the detail fragment and add it to the activity + // using a fragment transaction. + Bundle arguments = new Bundle(); + arguments.putString(MessageDetailFragment.ARG_ITEM, + getIntent().getStringExtra(MessageDetailFragment.ARG_ITEM)); + MessageDetailFragment fragment = new MessageDetailFragment(); + fragment.setArguments(arguments); + getSupportFragmentManager().beginTransaction() + .add(R.id.message_detail_container, fragment) + .commit(); + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == android.R.id.home) { + // This ID represents the Home or Up button. In the case of this + // activity, the Up button is shown. Use NavUtils to allow users + // to navigate up one level in the application structure. For + // more details, see the Navigation pattern on Android Design: + // + // http://developer.android.com/design/patterns/navigation.html#up-vs-back + // + NavUtils.navigateUpTo(this, new Intent(this, MessageListActivity.class)); + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java b/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java new file mode 100644 index 0000000..8b430aa --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/MessageDetailFragment.java @@ -0,0 +1,61 @@ +package ch.dissem.apps.abit; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import ch.dissem.bitmessage.entity.Plaintext; + + +/** + * A fragment representing a single Message detail screen. + * This fragment is either contained in a {@link MessageListActivity} + * in two-pane mode (on tablets) or a {@link MessageDetailActivity} + * on handsets. + */ +public class MessageDetailFragment extends Fragment { + /** + * The fragment argument representing the item ID that this fragment + * represents. + */ + public static final String ARG_ITEM = "item"; + + /** + * The dummy content this fragment is presenting. + */ + private Plaintext item; + + /** + * Mandatory empty constructor for the fragment manager to instantiate the + * fragment (e.g. upon screen orientation changes). + */ + public MessageDetailFragment() { + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if (getArguments().containsKey(ARG_ITEM)) { + // Load the dummy content specified by the fragment + // arguments. In a real-world scenario, use a Loader + // to load content from a content provider. + item = (Plaintext) getArguments().getSerializable(ARG_ITEM); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_message_detail, container, false); + + // Show the dummy content as text in a TextView. + if (item != null) { + ((TextView) rootView.findViewById(R.id.message_detail)).setText(item.getText()); + } + + return rootView; + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java b/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java new file mode 100644 index 0000000..94376e3 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java @@ -0,0 +1,215 @@ +package ch.dissem.apps.abit; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.Menu; +import android.view.View; +import android.widget.AdapterView; +import ch.dissem.apps.abit.service.Singleton; +import ch.dissem.bitmessage.BitmessageContext; +import ch.dissem.bitmessage.entity.BitmessageAddress; +import ch.dissem.bitmessage.entity.Plaintext; +import ch.dissem.bitmessage.entity.valueobject.Label; +import com.mikepenz.google_material_typeface_library.GoogleMaterial; +import com.mikepenz.iconics.IconicsDrawable; +import com.mikepenz.materialdrawer.Drawer; +import com.mikepenz.materialdrawer.DrawerBuilder; +import com.mikepenz.materialdrawer.accountswitcher.AccountHeader; +import com.mikepenz.materialdrawer.accountswitcher.AccountHeaderBuilder; +import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; +import com.mikepenz.materialdrawer.model.ProfileDrawerItem; +import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; +import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; +import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; +import com.mikepenz.materialdrawer.model.interfaces.IProfile; +import com.mikepenz.materialdrawer.model.interfaces.Nameable; + +import java.util.ArrayList; + + +/** + * An activity representing a list of Messages. This activity + * has different presentations for handset and tablet-size devices. On + * handsets, the activity presents a list of items, which when touched, + * lead to a {@link MessageDetailActivity} representing + * item details. On tablets, the activity presents the list of items and + * item details side-by-side using two vertical panes. + *

+ * The activity makes heavy use of fragments. The list of items is a + * {@link MessageListFragment} and the item details + * (if present) is a {@link MessageDetailFragment}. + *

+ * This activity also implements the required + * {@link MessageListFragment.Callbacks} interface + * to listen for item selections. + *

+ */ +public class MessageListActivity extends AppCompatActivity + implements MessageListFragment.Callbacks { + private static final int ADD_IDENTITY = 1; + + /** + * Whether or not the activity is in two-pane mode, i.e. running on a tablet + * device. + */ + private boolean twoPane; + + private AccountHeader accountHeader; + private BitmessageContext bmc; + private Label selectedLabel; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + bmc = Singleton.getBitmessageContext(this); + selectedLabel = bmc.messages().getLabels().get(0); + + setContentView(R.layout.activity_message_list); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + if (findViewById(R.id.message_detail_container) != null) { + // The detail container view will be present only in the + // large-screen layouts (res/values-large and + // res/values-sw600dp). If this view is present, then the + // activity should be in two-pane mode. + twoPane = true; + + // In two-pane mode, list items should be given the + // 'activated' state when touched. + ((MessageListFragment) getSupportFragmentManager() + .findFragmentById(R.id.message_list)) + .setActivateOnItemClick(true); + } + + createDrawer(toolbar); + + // TODO: If exposing deep links into your app, handle intents here. + } + + private void createDrawer(Toolbar toolbar) { + final ArrayList profiles = new ArrayList<>(); + for (BitmessageAddress identity : bmc.addresses().getIdentities()) { + profiles.add(new ProfileDrawerItem() + .withName(identity.toString()) + .withEmail(identity.getAddress()) + .withTag(identity) + ); + } + profiles.add(new ProfileSettingDrawerItem() + .withName("Add Identity") + .withDescription("Create new identity") + .withIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_add) + .actionBar() + .paddingDp(5) + .colorRes(R.color.icons)) + .withIdentifier(ADD_IDENTITY) + ); + profiles.add(new ProfileSettingDrawerItem() + .withName("Manage Account") + .withIcon(GoogleMaterial.Icon.gmd_settings) + ); + // Create the AccountHeader + accountHeader = new AccountHeaderBuilder() + .withActivity(this) + .withHeaderBackground(R.drawable.header) + .withProfiles(profiles) + .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() { + @Override + public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) { + if (profile.getIdentifier() == ADD_IDENTITY) { + BitmessageAddress identity = bmc.createIdentity(false); + IProfile newProfile = new ProfileDrawerItem() + .withName(identity.toString()) + .withEmail(identity.getAddress()) + .withTag(identity); + if (accountHeader.getProfiles() != null) { + //we know that there are 2 setting elements. set the new profile above them ;) + accountHeader.addProfile(newProfile, accountHeader.getProfiles().size() - 2); + } else { + accountHeader.addProfiles(newProfile); + } + } + // false if it should close the drawer + return false; + } + }) + .build(); + + ArrayList drawerItems = new ArrayList<>(); + for (Label label : bmc.messages().getLabels()) { + drawerItems.add(new PrimaryDrawerItem().withName(label.toString()).withTag(label)); + } + + new DrawerBuilder() + .withActivity(this) + .withToolbar(toolbar) + .withAccountHeader(accountHeader) + .withDrawerItems(drawerItems) + .addStickyDrawerItems( + new SecondaryDrawerItem() + .withName(R.string.settings) + .withIcon(GoogleMaterial.Icon.gmd_settings) + ) + .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { + @Override + public boolean onItemClick(AdapterView adapterView, View view, int i, long l, IDrawerItem item) { + if (item.getTag() instanceof Label) { + selectedLabel = (Label) item.getTag(); + } else if (item instanceof Nameable) { + Nameable ni = (Nameable) item; + switch (ni.getNameRes()) { + case R.string.settings: + startActivity(new Intent(MessageListActivity.this, SettingsActivity.class)); + break; + } + } + return false; + } + }) + .build(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.main, menu); + boolean running = bmc.isRunning(); + menu.findItem(R.id.sync_enabled).setVisible(running); + menu.findItem(R.id.sync_disabled).setVisible(!running); + return true; + } + + /** + * Callback method from {@link MessageListFragment.Callbacks} + * indicating that the item with the given ID was selected. + */ + @Override + public void onItemSelected(Plaintext plaintext) { + if (twoPane) { + // In two-pane mode, show the detail view in this activity by + // adding or replacing the detail fragment using a + // fragment transaction. + Bundle arguments = new Bundle(); + arguments.putSerializable(MessageDetailFragment.ARG_ITEM, plaintext); + MessageDetailFragment fragment = new MessageDetailFragment(); + fragment.setArguments(arguments); + getSupportFragmentManager().beginTransaction() + .replace(R.id.message_detail_container, fragment) + .commit(); + + } else { + // In single-pane mode, simply start the detail activity + // for the selected item ID. + Intent detailIntent = new Intent(this, MessageDetailActivity.class); + detailIntent.putExtra(MessageDetailFragment.ARG_ITEM, plaintext); + startActivity(detailIntent); + } + } + + public Label getSelectedLabel() { + return selectedLabel; + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java b/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java new file mode 100644 index 0000000..f6d09d8 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/MessageListFragment.java @@ -0,0 +1,177 @@ +package ch.dissem.apps.abit; + +import android.app.Activity; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.v4.app.ListFragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; +import ch.dissem.apps.abit.service.Singleton; +import ch.dissem.bitmessage.BitmessageContext; +import ch.dissem.bitmessage.entity.Plaintext; + +/** + * A list fragment representing a list of Messages. This fragment + * also supports tablet devices by allowing list items to be given an + * 'activated' state upon selection. This helps indicate which item is + * currently being viewed in a {@link MessageDetailFragment}. + *

+ * Activities containing this fragment MUST implement the {@link Callbacks} + * interface. + */ +public class MessageListFragment extends ListFragment { + + /** + * The serialization (saved instance state) Bundle key representing the + * activated item position. Only used on tablets. + */ + private static final String STATE_ACTIVATED_POSITION = "activated_position"; + + /** + * The fragment's current callback object, which is notified of list item + * clicks. + */ + private Callbacks mCallbacks = sDummyCallbacks; + + /** + * The current activated item position. Only used on tablets. + */ + private int mActivatedPosition = ListView.INVALID_POSITION; + + private BitmessageContext bmc; + + /** + * A callback interface that all activities containing this fragment must + * implement. This mechanism allows activities to be notified of item + * selections. + */ + public interface Callbacks { + /** + * Callback for when an item has been selected. + */ + void onItemSelected(Plaintext plaintext); + } + + /** + * A dummy implementation of the {@link Callbacks} interface that does + * nothing. Used only when this fragment is not attached to an activity. + */ + private static Callbacks sDummyCallbacks = new Callbacks() { + @Override + public void onItemSelected(Plaintext plaintext) { + } + }; + + /** + * Mandatory empty constructor for the fragment manager to instantiate the + * fragment (e.g. upon screen orientation changes). + */ + public MessageListFragment() { + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + bmc = Singleton.getBitmessageContext(getActivity()); + + // TODO: replace with a real list adapter. + setListAdapter(new ArrayAdapter<>( + getActivity(), + android.R.layout.simple_list_item_activated_1, + android.R.id.text1, + bmc.messages().findMessages(((MessageListActivity) getActivity()).getSelectedLabel()))); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_message_list, container, false); + + // Show the dummy content as text in a TextView. + FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab_compose_message); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Toast.makeText(MessageListFragment.this.getActivity(), "TODO", Toast.LENGTH_SHORT).show(); + } + }); + + return rootView; + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + // Restore the previously serialized activated item position. + if (savedInstanceState != null + && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { + setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); + } + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + // Activities containing this fragment must implement its callbacks. + if (!(activity instanceof Callbacks)) { + throw new IllegalStateException("Activity must implement fragment's callbacks."); + } + + mCallbacks = (Callbacks) activity; + } + + @Override + public void onDetach() { + super.onDetach(); + + // Reset the active callbacks interface to the dummy implementation. + mCallbacks = sDummyCallbacks; + } + + @Override + public void onListItemClick(ListView listView, View view, int position, long id) { + super.onListItemClick(listView, view, position, id); + + // Notify the active callbacks interface (the activity, if the + // fragment is attached to one) that an item has been selected. + mCallbacks.onItemSelected((Plaintext) listView.getItemAtPosition(position)); + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + if (mActivatedPosition != ListView.INVALID_POSITION) { + // Serialize and persist the activated item position. + outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); + } + } + + /** + * Turns on activate-on-click mode. When this mode is on, list items will be + * given the 'activated' state when touched. + */ + public void setActivateOnItemClick(boolean activateOnItemClick) { + // When setting CHOICE_MODE_SINGLE, ListView will automatically + // give items the 'activated' state when touched. + getListView().setChoiceMode(activateOnItemClick + ? ListView.CHOICE_MODE_SINGLE + : ListView.CHOICE_MODE_NONE); + } + + private void setActivatedPosition(int position) { + if (position == ListView.INVALID_POSITION) { + getListView().setItemChecked(mActivatedPosition, false); + } else { + getListView().setItemChecked(position, true); + } + + mActivatedPosition = position; + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/SQLiteConfig.java b/app/src/main/java/ch/dissem/apps/abit/SQLiteConfig.java new file mode 100644 index 0000000..6b230d2 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/SQLiteConfig.java @@ -0,0 +1,37 @@ +package ch.dissem.apps.abit; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.os.Environment; +import ch.dissem.bitmessage.repository.JdbcConfig; +import org.flywaydb.core.api.android.ContextHolder; +import org.sqldroid.SQLDroidDriver; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +/** + * Created by chris on 14.07.15. + */ +public class SQLiteConfig extends JdbcConfig { + + public SQLiteConfig(Context ctx) { + super(getDbUrl(ctx), "", ""); + } + + private static String getDbUrl(Context ctx) { + SQLiteDatabase db = ctx.openOrCreateDatabase(Environment.getExternalStorageDirectory() + + "/jabit.db", Context.MODE_PRIVATE, null); + ContextHolder.setContext(ctx); + return "jdbc:sqlite:" + db.getPath() + "?timeout=5"; + } + + @Override + public Connection getConnection() throws SQLException { + Properties removeLocale = new Properties(); + removeLocale.put(SQLDroidDriver.ADDITONAL_DATABASE_FLAGS, android.database.sqlite.SQLiteDatabase.NO_LOCALIZED_COLLATORS); + return DriverManager.getConnection(dbUrl, removeLocale); + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/SettingsActivity.java b/app/src/main/java/ch/dissem/apps/abit/SettingsActivity.java new file mode 100644 index 0000000..670e299 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/SettingsActivity.java @@ -0,0 +1,27 @@ +package ch.dissem.apps.abit; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; + +/** + * Created by chris on 14.07.15. + */ +public class SettingsActivity extends AppCompatActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.toolbar_layout); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeButtonEnabled(false); + + // Display the fragment as the main content. + getFragmentManager().beginTransaction() + .replace(R.id.content, new SettingsFragment()) + .commit(); + } +} \ No newline at end of file diff --git a/app/src/main/java/ch/dissem/apps/abit/SettingsFragment.java b/app/src/main/java/ch/dissem/apps/abit/SettingsFragment.java new file mode 100644 index 0000000..ffba5a9 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/SettingsFragment.java @@ -0,0 +1,18 @@ +package ch.dissem.apps.abit; + +import android.os.Bundle; +import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; + +/** + * Created by chris on 14.07.15. + */ +public class SettingsFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.preferences); + } +} \ No newline at end of file diff --git a/app/src/main/java/ch/dissem/apps/abit/service/BitmessageService.java b/app/src/main/java/ch/dissem/apps/abit/service/BitmessageService.java new file mode 100644 index 0000000..a55d3e1 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/service/BitmessageService.java @@ -0,0 +1,104 @@ +package ch.dissem.apps.abit.service; + +import android.app.Notification; +import android.app.NotificationManager; +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.os.Binder; +import android.os.IBinder; +import android.support.v7.app.NotificationCompat; +import ch.dissem.apps.abit.R; +import ch.dissem.bitmessage.BitmessageContext; +import ch.dissem.bitmessage.entity.BitmessageAddress; +import ch.dissem.bitmessage.entity.Plaintext; +import ch.dissem.bitmessage.entity.valueobject.Label; + +import java.util.List; + +public class BitmessageService extends Service { + private static BitmessageContext ctx; + private ServiceBinder binder = new ServiceBinder(); + private NotificationCompat.Builder ongoingNotificationBuilder = new NotificationCompat.Builder(this); + private NotificationManager notifyManager; + + public BitmessageService() { + if (ctx == null) { + ctx = Singleton.getBitmessageContext(this); + } + } + + @Override + public void onCreate() { + super.onCreate(); + ongoingNotificationBuilder.setOngoing(true); + ongoingNotificationBuilder.setContentTitle(getString(R.string.bitmessage_active)); + ongoingNotificationBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); +// ongoingNotificationBuilder.setSmallIcon(R.drawable.ic_bitmessage); + notifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + } + + public void startService() { + if (!ctx.isRunning()) { + notifyManager.notify(0, ongoingNotificationBuilder.build()); + ctx.startup(new BitmessageContext.Listener() { + @Override + public void receive(Plaintext plaintext) { + Notification notification = new NotificationCompat.Builder(BitmessageService.this) + .setContentTitle(plaintext.getSubject()) + .setContentText(plaintext.getText()) + .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) + .setPriority(plaintext.getType() == Plaintext.Type.BROADCAST + ? NotificationCompat.PRIORITY_DEFAULT + : NotificationCompat.PRIORITY_HIGH) + .build(); + notifyManager.notify(plaintext.getInventoryVector().hashCode(), notification); + } + }); + } + } + + public void stopService() { + ctx.shutdown(); + notifyManager.cancel(0); + } + + public List getIdentities() { + return ctx.addresses().getIdentities(); + } + + public List getContacts() { + return ctx.addresses().getContacts(); + } + + public List

getMessages(Label label) { + return ctx.messages().findMessages(label); + } + + @Override + public IBinder onBind(Intent intent) { + return binder; + } + + public class ServiceBinder extends Binder { + public BitmessageService getService() { + return BitmessageService.this; + } + } + + public enum NetworkChoice { + /** + * A full node, receiving and relaying objects all the time. + */ + FULL, + /** + * Connect to a trusted node from time to time to get all new objects and disconnect afterwards + * (see {@link android.content.AbstractThreadedSyncAdapter}) + */ + TRUSTED, + /** + * Offline + */ + NONE + } +} diff --git a/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java b/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java new file mode 100644 index 0000000..c8b33a6 --- /dev/null +++ b/app/src/main/java/ch/dissem/apps/abit/service/Singleton.java @@ -0,0 +1,34 @@ +package ch.dissem.apps.abit.service; + +import android.content.Context; +import ch.dissem.apps.abit.SQLiteConfig; +import ch.dissem.bitmessage.BitmessageContext; +import ch.dissem.bitmessage.networking.DefaultNetworkHandler; +import ch.dissem.bitmessage.repository.*; +import ch.dissem.bitmessage.security.sc.SpongySecurity; + +/** + * Created by chris on 16.07.15. + */ +public class Singleton { + private static BitmessageContext bitmessageContext; + + public static BitmessageContext getBitmessageContext(Context ctx) { + if (bitmessageContext == null) { + synchronized (Singleton.class) { + if (bitmessageContext == null) { + JdbcConfig config = new SQLiteConfig(ctx); + bitmessageContext = new BitmessageContext.Builder() + .security(new SpongySecurity()) + .nodeRegistry(new MemoryNodeRegistry()) + .inventory(new JdbcInventory(config)) + .addressRepo(new JdbcAddressRepository(config)) + .messageRepo(new JdbcMessageRepository(config)) + .networkHandler(new DefaultNetworkHandler()) + .build(); + } + } + } + return bitmessageContext; + } +} diff --git a/app/src/main/java/im/delight/android/identicons/Identicon.java b/app/src/main/java/im/delight/android/identicons/Identicon.java new file mode 100644 index 0000000..c419318 --- /dev/null +++ b/app/src/main/java/im/delight/android/identicons/Identicon.java @@ -0,0 +1,213 @@ +package im.delight.android.identicons; + +/** + * Copyright 2014 www.delight.im <info@delight.im> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.security.MessageDigest; +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.os.Build; +import android.util.AttributeSet; +import android.view.View; + +abstract public class Identicon extends View { + + private static final String HASH_ALGORITHM = "SHA-256"; + private final int mRowCount; + private final int mColumnCount; + private final Paint mPaint; + private volatile int mCellWidth; + private volatile int mCellHeight; + private volatile byte[] mHash; + private volatile int[][] mColors; + private volatile boolean mReady; + + public Identicon(Context context) { + super(context); + + mRowCount = getRowCount(); + mColumnCount = getColumnCount(); + mPaint = new Paint(); + + init(); + } + + public Identicon(Context context, AttributeSet attrs) { + super(context, attrs); + + mRowCount = getRowCount(); + mColumnCount = getColumnCount(); + mPaint = new Paint(); + + init(); + } + + public Identicon(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + + mRowCount = getRowCount(); + mColumnCount = getColumnCount(); + mPaint = new Paint(); + + init(); + } + + @SuppressLint("NewApi") + protected void init() { + mPaint.setStyle(Paint.Style.FILL); + mPaint.setAntiAlias(true); + mPaint.setDither(true); + + setWillNotDraw(false); + if (Build.VERSION.SDK_INT >= 11) { + setLayerType(View.LAYER_TYPE_SOFTWARE, null); + } + } + + public void show(String input) { + // if the input was null + if (input == null) { + // we can't create a hash value and have nothing to show (draw to the view) + mHash = null; + } + // if the input was a proper string (non-null) + else { + // generate a hash from the string to get unique but deterministic byte values + try { + final MessageDigest digest = java.security.MessageDigest.getInstance(HASH_ALGORITHM); + digest.update(input == null ? new byte[0] : input.getBytes()); + mHash = digest.digest(); + } + catch (Exception e) { + mHash = null; + } + } + + // set up the cell colors according to the input that was provided via show(...) + setupColors(); + + // this view may now be drawn (and thus must be re-drawn) + mReady = true; + invalidate(); + } + + public void show(int input) { + show(String.valueOf(input)); + } + + public void show(long input) { + show(String.valueOf(input)); + } + + public void show(float input) { + show(String.valueOf(input)); + } + + public void show(double input) { + show(String.valueOf(input)); + } + + public void show(byte input) { + show(String.valueOf(input)); + } + + public void show(char input) { + show(String.valueOf(input)); + } + + public void show(boolean input) { + show(String.valueOf(input)); + } + + public void show(Object input) { + if (input == null) { + mHash = null; + } + else { + show(String.valueOf(input)); + } + } + + protected void setupColors() { + mColors = new int[mRowCount][mColumnCount]; + int colorVisible = getIconColor(); + + for (int r = 0; r < mRowCount; r++) { + for (int c = 0; c < mColumnCount; c++) { + if (isCellVisible(r, c)) { + mColors[r][c] = colorVisible; + } + else { + mColors[r][c] = Color.TRANSPARENT; + } + } + } + } + + protected byte getByte(int index) { + if (mHash == null) { + return -128; + } + else { + return mHash[index % mHash.length]; + } + } + + abstract protected int getRowCount(); + + abstract protected int getColumnCount(); + + abstract protected boolean isCellVisible(int row, int column); + + abstract protected int getIconColor(); + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + + mCellWidth = w / mColumnCount; + mCellHeight = h / mRowCount; + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + int size = Math.min(getMeasuredWidth(), getMeasuredHeight()); + setMeasuredDimension(size, size); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (mReady) { + int x, y; + for (int r = 0; r < mRowCount; r++) { + for (int c = 0; c < mColumnCount; c++) { + x = mCellWidth * c; + y = mCellHeight * r; + + mPaint.setColor(mColors[r][c]); + + canvas.drawRect(x, y + mCellHeight, x + mCellWidth, y, mPaint); + } + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_action_notification_sync.png b/app/src/main/res/drawable-hdpi/ic_action_notification_sync.png new file mode 100755 index 0000000..d938029 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_notification_sync.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_action_notification_sync_disabled.png b/app/src/main/res/drawable-hdpi/ic_action_notification_sync_disabled.png new file mode 100755 index 0000000..c8bcece Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_notification_sync_disabled.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_plus_sign.png b/app/src/main/res/drawable-hdpi/ic_plus_sign.png new file mode 100755 index 0000000..b1fbbf8 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_plus_sign.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_notification_sync.png b/app/src/main/res/drawable-mdpi/ic_action_notification_sync.png new file mode 100755 index 0000000..f051d5e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_notification_sync.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_notification_sync_disabled.png b/app/src/main/res/drawable-mdpi/ic_action_notification_sync_disabled.png new file mode 100755 index 0000000..d8e4526 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_notification_sync_disabled.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_plus_sign.png b/app/src/main/res/drawable-mdpi/ic_plus_sign.png new file mode 100755 index 0000000..478b2c7 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_plus_sign.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_notification_sync.png b/app/src/main/res/drawable-xhdpi/ic_action_notification_sync.png new file mode 100755 index 0000000..7e1ffed Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_notification_sync.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_notification_sync_disabled.png b/app/src/main/res/drawable-xhdpi/ic_action_notification_sync_disabled.png new file mode 100755 index 0000000..00e51af Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_notification_sync_disabled.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_plus_sign.png b/app/src/main/res/drawable-xhdpi/ic_plus_sign.png new file mode 100755 index 0000000..e94e813 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_plus_sign.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_notification_sync.png b/app/src/main/res/drawable-xxhdpi/ic_action_notification_sync.png new file mode 100755 index 0000000..4017dab Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_notification_sync.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_notification_sync_disabled.png b/app/src/main/res/drawable-xxhdpi/ic_action_notification_sync_disabled.png new file mode 100755 index 0000000..549cf6d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_notification_sync_disabled.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_plus_sign.png b/app/src/main/res/drawable-xxhdpi/ic_plus_sign.png new file mode 100755 index 0000000..8679166 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_plus_sign.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_notification_sync.png b/app/src/main/res/drawable-xxxhdpi/ic_action_notification_sync.png new file mode 100755 index 0000000..bea0812 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_action_notification_sync.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_notification_sync_disabled.png b/app/src/main/res/drawable-xxxhdpi/ic_action_notification_sync_disabled.png new file mode 100755 index 0000000..d71a99a Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_action_notification_sync_disabled.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_plus_sign.png b/app/src/main/res/drawable-xxxhdpi/ic_plus_sign.png new file mode 100755 index 0000000..1958de1 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_plus_sign.png differ diff --git a/app/src/main/res/drawable/header.png b/app/src/main/res/drawable/header.png new file mode 100644 index 0000000..988425e Binary files /dev/null and b/app/src/main/res/drawable/header.png differ diff --git a/app/src/main/res/layout-sw600dp/activity_message_list.xml b/app/src/main/res/layout-sw600dp/activity_message_list.xml new file mode 100644 index 0000000..6a40fd9 --- /dev/null +++ b/app/src/main/res/layout-sw600dp/activity_message_list.xml @@ -0,0 +1,47 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:gravity="center" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + android:elevation="4dp"/> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_below="@id/toolbar" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:baselineAligned="false" + android:divider="?android:attr/dividerHorizontal" + android:orientation="horizontal" + android:showDividers="middle" + tools:context=".MessageListActivity"> + + <!-- + This layout is a two-pane layout for the Messages + master/detail flow. + + --> + + <fragment + android:id="@+id/message_list" + android:name="ch.dissem.apps.abit.MessageListFragment" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + tools:layout="@android:layout/list_content"/> + + <FrameLayout + android:id="@+id/message_detail_container" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="3"/> + + </LinearLayout> +</RelativeLayout> diff --git a/app/src/main/res/layout/activity_message_detail.xml b/app/src/main/res/layout/activity_message_detail.xml new file mode 100644 index 0000000..9350427 --- /dev/null +++ b/app/src/main/res/layout/activity_message_detail.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:gravity="center" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + android:elevation="4dp" /> + + <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_below="@id/toolbar" + android:id="@+id/message_detail_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MessageDetailActivity" + tools:layout="@android:layout/list_content"/> +</RelativeLayout> diff --git a/app/src/main/res/layout/activity_message_list.xml b/app/src/main/res/layout/activity_message_list.xml new file mode 100644 index 0000000..8072ecf --- /dev/null +++ b/app/src/main/res/layout/activity_message_list.xml @@ -0,0 +1,25 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:gravity="center" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + android:elevation="4dp" /> + + <fragment xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_below="@id/toolbar" + android:id="@+id/message_list" + android:name="ch.dissem.apps.abit.MessageListFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MessageListActivity" + tools:layout="@android:layout/list_content"/> +</RelativeLayout> diff --git a/app/src/main/res/layout/fragment_message_detail.xml b/app/src/main/res/layout/fragment_message_detail.xml new file mode 100644 index 0000000..dce4d36 --- /dev/null +++ b/app/src/main/res/layout/fragment_message_detail.xml @@ -0,0 +1,9 @@ +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/message_detail" + style="?android:attr/textAppearanceLarge" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="16dp" + android:textIsSelectable="true" + tools:context=".MessageDetailFragment"/> diff --git a/app/src/main/res/layout/fragment_message_list.xml b/app/src/main/res/layout/fragment_message_list.xml new file mode 100644 index 0000000..26a3a1b --- /dev/null +++ b/app/src/main/res/layout/fragment_message_list.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ListView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@id/android:list" + + android:layout_alignParentTop="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_alignParentBottom="true" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/fab_compose_message" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ic_plus_sign" + app:elevation="8dp" + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_margin="16dp"/> +</RelativeLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/toolbar_layout.xml b/app/src/main/res/layout/toolbar_layout.xml new file mode 100644 index 0000000..160d7a5 --- /dev/null +++ b/app/src/main/res/layout/toolbar_layout.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:gravity="center" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + android:elevation="4dp" /> + + <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_below="@id/toolbar" + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MessageListActivity" + tools:layout="@android:layout/list_content"/> +</RelativeLayout> + diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml new file mode 100644 index 0000000..9f35ce1 --- /dev/null +++ b/app/src/main/res/menu/main.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/sync_enabled" + app:showAsAction="always" + android:icon="@drawable/ic_action_notification_sync" + android:title="@string/disable_sync"/> + <item + android:id="@+id/sync_disabled" + app:showAsAction="always" + android:icon="@drawable/ic_action_notification_sync_disabled" + android:title="@string/enable_sync"/> +</menu> \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml new file mode 100644 index 0000000..da48d07 --- /dev/null +++ b/app/src/main/res/values-de/strings.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Abit</string> + <string name="settings">Einstellungen</string> + <string name="wifi_only">Nur WLAN</string> + <string name="wifi_only_summary">Nicht mit Mobilfunknetz verbinden</string> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..9245277 --- /dev/null +++ b/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <style name="AppTheme" parent="AppTheme.Base"> + + <!-- Main theme colors --> + <!-- your app branding color for the app bar --> + <item name="android:colorPrimary">@color/primary</item> + <!-- darker variant for the status bar and contextual app bars --> + <item name="android:colorPrimaryDark">@color/primary_dark</item> + <!-- theme UI controls like checkboxes and text fields --> + <item name="android:colorAccent">@color/accent</item> + + <item name="android:windowContentTransitions">true</item> + <item name="android:windowAllowEnterTransitionOverlap">true</item> + <item name="android:windowAllowReturnTransitionOverlap">true</item> + <item name="android:windowSharedElementEnterTransition">@android:transition/move</item> + <item name="android:windowSharedElementExitTransition">@android:transition/move</item> + + <item name="android:windowDrawsSystemBarBackgrounds">true</item> + <!--<item name="android:statusBarColor">@android:color/transparent</item>--> + + </style> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml new file mode 100644 index 0000000..803fa88 --- /dev/null +++ b/app/src/main/res/values/arrays.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string-array name="connection_modes"> + <item>full</item> + <item>trusted</item> + <item>offline</item> + </string-array> + <string-array name="connection_mode_values"> + <item>A full node, receiving and relaying objects all the time.</item> + <item>Connect to a trusted node from time to time to get new objects.</item> + <item>Don\'t connect to the network.</item> + </string-array> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..42d7392 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Palette generated by Material Palette - materialpalette.com/blue-grey/orange --> +<resources> + <color name="primary">#607D8B</color> + <color name="primary_dark">#455A64</color> + <color name="primary_light">#CFD8DC</color> + <color name="accent">#FF9800</color> + <color name="primary_text">#212121</color> + <color name="secondary_text">#727272</color> + <color name="icons">#FFFFFF</color> + <color name="divider">#B6B6B6</color> +</resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..68e30b8 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,11 @@ +<resources> + <string name="app_name">Abit</string> + <string name="title_message_detail">Message Detail</string> + <string name="disable_sync">Disable Sync</string> + <string name="enable_sync">Enable Sync</string> + <string name="bitmessage_active">Bitmessage active</string> + <string name="wifi_mode">Wi-Fi Connection Mode</string> + <string name="settings">Settings</string> + <string name="wifi_only">Wi-Fi only</string> + <string name="wifi_only_summary">Don\'t connect to the mobile network</string> +</resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..1983c04 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,24 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme.Base" parent="MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus"> + + <item name="android:activatedBackgroundIndicator">@color/primary_light</item> + + <!-- MaterialDrawer specific values --> + <item name="material_drawer_background">@color/primary_dark</item> + <item name="material_drawer_icons">@color/icons</item> + <item name="material_drawer_primary_icon">@color/icons</item> + <item name="material_drawer_primary_text">@color/icons</item> + <item name="material_drawer_secondary_text">@color/icons</item> + <item name="material_drawer_hint_text">@color/icons</item> + <item name="material_drawer_divider">@color/icons</item> + <item name="material_drawer_selected">@color/primary</item> + <item name="material_drawer_selected_text">@color/icons</item> + <item name="material_drawer_header_selection_text">@color/icons</item> + + </style> + + <style name="AppTheme" parent="AppTheme.Base"/> + +</resources> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml new file mode 100644 index 0000000..e1f7327 --- /dev/null +++ b/app/src/main/res/xml/preferences.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- + <ListPreference + android:key="wifi_mode" + android:title="@string/wifi_mode" + android:dialogTitle="@string/wifi_mode" + android:entries="@array/connection_modes" + android:entryValues="@array/connection_mode_values"/> + --> + <SwitchPreference + android:key="wifi_only" + android:title="@string/wifi_only" + android:summary="@string/wifi_only_summary" + android:defaultValue="true"/> +</PreferenceScreen> \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1694c86 --- /dev/null +++ b/build.gradle @@ -0,0 +1,25 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +configurations.all { + // check for updates every build + resolutionStrategy.cacheChangingModulesFor 0, 'seconds' +} + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + mavenCentral() + maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..179dd79 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'