merge ui work
140
app/app.iml
@ -1,140 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="syng-client" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugAndroidTestSources</task>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="dagger-2.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" exported="" name="json-io-2.4.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="javassist-3.15.0-GA" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-dbcp-1.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="floatingactionbutton-1.9.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="prov-1.51.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="leveldb-api-0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="logback-android-core-1.1.1-3" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="dagger-producers-2.0-beta" level="project" />
|
||||
<orderEntry type="library" exported="" name="ormlite-android-4.48" level="project" />
|
||||
<orderEntry type="library" exported="" name="java-util-1.8.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="jsonrpc2-client-1.15" level="project" />
|
||||
<orderEntry type="library" exported="" name="json-smart-1.3.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="javax.annotation-10.0-b28" level="project" />
|
||||
<orderEntry type="library" exported="" name="jackson-annotations-2.5.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="dagger-compiler-2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="core-1.51.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-collections4-4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="jackson-core-2.5.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="guava-18.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="netty-all-4.0.28.Final" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-pool-1.5.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-observablescrollview-1.5.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="json-simple-1.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="javax.inject-1" level="project" />
|
||||
<orderEntry type="library" exported="" name="jackson-databind-2.5.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="apktool-lib-1.4.4-3" level="project" />
|
||||
<orderEntry type="library" exported="" name="ormlite-core-4.48" level="project" />
|
||||
<orderEntry type="library" exported="" name="jsonrpc2-base-1.36" level="project" />
|
||||
<orderEntry type="library" exported="" name="log4j-1.2.17" level="project" />
|
||||
<orderEntry type="library" exported="" name="jsonrpc2-server-1.11" level="project" />
|
||||
<orderEntry type="library" exported="" name="circleimageview-1.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="library-1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="multidex-1.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="persistence-api-1.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="leveldb-0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="logback-android-classic-1.1.1-3" level="project" />
|
||||
<orderEntry type="library" exported="" name="design-22.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="slf4j-api-1.7.12" level="project" />
|
||||
<orderEntry type="library" exported="" name="material-dialogs-0.7.7.0" level="project" />
|
||||
<orderEntry type="module" module-name="ethereumj-core-android" exported="" />
|
||||
<orderEntry type="module" module-name="ethereumj-core" exported="" />
|
||||
</component>
|
||||
</module>
|
@ -6,7 +6,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.syng"
|
||||
minSdkVersion 17
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 22
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
@ -45,14 +45,19 @@ dependencies {
|
||||
exclude group: "org.codehaus.jackson", module: "jackson-mapper-asl"
|
||||
exclude group: "org.mapdb", module: "mapdb"
|
||||
}
|
||||
compile 'com.android.support:multidex:1.0.0'
|
||||
compile 'com.android.support:multidex:1.0.1'
|
||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||
compile 'com.android.support:recyclerview-v7:22.2.1'
|
||||
compile 'com.android.support:design:22.2.+'
|
||||
// compile 'com.android.support:support-v4:22.2.1'
|
||||
compile 'com.android.support:design:22.2.1'
|
||||
compile 'co.dift.ui.swipetoaction:library:1.1'
|
||||
compile 'de.hdodenhof:circleimageview:1.3.0'
|
||||
// compile 'de.hdodenhof:circleimageview:1.3.0'
|
||||
compile 'com.getbase:floatingactionbutton:1.9.0'
|
||||
compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
|
||||
compile 'com.afollestad:material-dialogs:0.7.7.0'
|
||||
compile 'com.android.support:support-v4:22.2.1'
|
||||
compile 'com.github.bumptech.glide:glide:3.6.1'
|
||||
|
||||
compile 'com.netflix.rxjava:rxjava-android:0.20.7'
|
||||
|
||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
|
||||
}
|
||||
|
@ -1,53 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.syng" >
|
||||
<manifest
|
||||
package="io.syng"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
<application
|
||||
android:name=".Syng"
|
||||
android:name=".app.SyngApplication"
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name" >
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
</activity>
|
||||
<activity android:name=".webview" />
|
||||
|
||||
<service
|
||||
android:name=".EthereumService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":ethereum_process" >
|
||||
</service>
|
||||
<!--android:largeHeap="true"-->
|
||||
<!--android:hardwareAccelerated="true"-->
|
||||
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:label="@string/title_activity_settings" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ProfileManagerActivity"
|
||||
android:label="@string/title_activity_profile_manager" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".SpashScreen"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:label="@string/title_activity_spash_screen"
|
||||
android:theme="@style/splashScreenTheme" >
|
||||
android:name=".activity.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:windowSoftInputMode="adjustNothing">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".activity.MainActivity"
|
||||
android:theme="@style/SettingsTheme"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.MainActivity"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.ProfileManagerActivity"
|
||||
android:label="@string/title_activity_profile_manager"/>
|
||||
|
||||
<service
|
||||
android:name=".service.EthereumService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:process=":ethereum_process"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
@ -1,379 +0,0 @@
|
||||
package io.syng;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.InputType;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import co.dift.ui.SwipeToAction;
|
||||
import io.syng.entities.Dapp;
|
||||
import io.syng.entities.DappAdapter;
|
||||
import io.syng.entities.Profile;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Activities that contain this fragment must implement the
|
||||
* {@link OnFragmentInteractionListener} interface
|
||||
* to handle interaction events.
|
||||
* Use the {@link AddProfileFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class AddProfileFragment extends Fragment {
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
private EditText profileName;
|
||||
private Switch profilePasswordProtected;
|
||||
|
||||
private RecyclerView dappsList;
|
||||
private DappAdapter adapter;
|
||||
private RecyclerView.LayoutManager layoutManager;
|
||||
private SwipeToAction swipeToAction;
|
||||
private ArrayList<Dapp> dapps = new ArrayList<>();
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
private MaterialDialog dappDialog;
|
||||
private EditText dappName;
|
||||
private EditText dappUrl;
|
||||
|
||||
private TextView accountModeButton;
|
||||
private MaterialDialog accountModeDialog;
|
||||
private RadioButton accountModeCreate;
|
||||
private RadioButton accountModeImportFile;
|
||||
private RadioButton accountModeImportString;
|
||||
private EditText accountImportSource;
|
||||
|
||||
private int accountMode;
|
||||
private String accountPrivateKey = null;
|
||||
|
||||
private Dapp addDapp = new Dapp("new_app_id", "Add new dapp");
|
||||
|
||||
protected int dapEditPosition = -1;
|
||||
|
||||
protected View.OnClickListener accountModeListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
accountMode = view.getId();
|
||||
switch(accountMode) {
|
||||
case R.id.radio_new_account:
|
||||
accountImportSource.setInputType(InputType.TYPE_NULL);
|
||||
break;
|
||||
case R.id.radio_import_file:
|
||||
case R.id.radio_import_string:
|
||||
accountImportSource.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment AddProfileFragment.
|
||||
*/
|
||||
public static AddProfileFragment newInstance(String param1, String param2) {
|
||||
|
||||
AddProfileFragment fragment = new AddProfileFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public AddProfileFragment() {
|
||||
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public void setProfile(Profile profile) {
|
||||
|
||||
profileName.setText(profile != null ? profile.getName() : "");
|
||||
profilePasswordProtected.setChecked(profile != null ? profile.getPasswordProtectedProfile() : false);
|
||||
|
||||
resetDapps();
|
||||
if (profile != null) {
|
||||
for (Dapp dapp: profile.getDapps()) {
|
||||
adapter.add(dapp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void resetDapps() {
|
||||
|
||||
adapter.clear();
|
||||
adapter.add(addDapp);
|
||||
}
|
||||
|
||||
public Profile getProfile() {
|
||||
|
||||
Profile profile = accountPrivateKey != null ? new Profile(accountPrivateKey) : new Profile();
|
||||
profile.setName(profileName.getText().toString());
|
||||
profile.setPasswordProtectedProfile(profilePasswordProtected.isChecked());
|
||||
List<Dapp> dapps = adapter.getItems();
|
||||
dapps.remove(addDapp);
|
||||
profile.setDapps(dapps);
|
||||
return profile;
|
||||
}
|
||||
|
||||
protected void editDapp(Dapp dapp) {
|
||||
|
||||
dapEditPosition = adapter.getPosition(dapp);
|
||||
dappName.setText(dapp.getName());
|
||||
dappUrl.setText(dapp.getUrl());
|
||||
dappDialog.show();
|
||||
}
|
||||
|
||||
protected void createDapp() {
|
||||
|
||||
dapEditPosition = -1;
|
||||
Dapp dapp = new Dapp();
|
||||
dappName.setText(dapp.getName());
|
||||
dappUrl.setText(dapp.getUrl());
|
||||
dappDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_add_profile, container, false);
|
||||
profileName = (EditText)view.findViewById(R.id.profile_name);
|
||||
profilePasswordProtected = (Switch)view.findViewById(R.id.profile_password_protected);
|
||||
|
||||
accountModeButton = (TextView)view.findViewById(R.id.account_mode);
|
||||
dappsList = (RecyclerView) view.findViewById(R.id.profile_dapps_list);
|
||||
|
||||
accountModeDialog = new MaterialDialog.Builder(getActivity())
|
||||
.title(R.string.account_mode_title)
|
||||
.customView(R.layout.account_creation_mode, true)
|
||||
.positiveText(R.string.ok)
|
||||
.negativeText(R.string.cancel)
|
||||
.contentColor(R.color.accent) // notice no 'res' postfix for literal color
|
||||
.dividerColorRes(R.color.accent)
|
||||
.backgroundColorRes(R.color.primary_dark)
|
||||
.positiveColorRes(R.color.accent)
|
||||
.negativeColorRes(R.color.accent)
|
||||
.widgetColorRes(R.color.accent)
|
||||
.autoDismiss(false)
|
||||
.callback(new MaterialDialog.ButtonCallback() {
|
||||
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
||||
boolean hideDialog = true;
|
||||
accountPrivateKey = null;
|
||||
switch (accountMode) {
|
||||
case R.id.radio_new_account:
|
||||
|
||||
break;
|
||||
case R.id.radio_import_file:
|
||||
File file = new File(accountImportSource.getText().toString());
|
||||
if (file.exists()) {
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
try {
|
||||
BufferedReader buffer = new BufferedReader(new FileReader(file));
|
||||
String line;
|
||||
|
||||
while ((line = buffer.readLine()) != null) {
|
||||
text.append(line);
|
||||
}
|
||||
buffer.close();
|
||||
accountPrivateKey = text.toString();
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "File not found", Toast.LENGTH_LONG).show();
|
||||
hideDialog = false;
|
||||
}
|
||||
break;
|
||||
case R.id.radio_import_string:
|
||||
accountPrivateKey = accountImportSource.getText().toString();
|
||||
break;
|
||||
}
|
||||
if (hideDialog) {
|
||||
dialog.hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegative(MaterialDialog dialog) {
|
||||
|
||||
dialog.hide();
|
||||
}
|
||||
})
|
||||
.build();
|
||||
accountModeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
accountModeDialog.show();
|
||||
}
|
||||
});
|
||||
View accountModeView = accountModeDialog.getCustomView();
|
||||
accountModeCreate = (RadioButton)accountModeView.findViewById(R.id.radio_new_account);
|
||||
accountModeImportFile = (RadioButton)accountModeView.findViewById(R.id.radio_import_file);
|
||||
accountModeImportString = (RadioButton)accountModeView.findViewById(R.id.radio_import_string);
|
||||
accountImportSource = (EditText)accountModeView.findViewById(R.id.accout_import_source);
|
||||
|
||||
accountModeCreate.setOnClickListener(accountModeListener);
|
||||
accountModeImportFile.setOnClickListener(accountModeListener);
|
||||
accountModeImportString.setOnClickListener(accountModeListener);
|
||||
// use this setting to improve performance if you know that changes
|
||||
// in content do not change the layout size of the RecyclerView
|
||||
dappsList.setHasFixedSize(true);
|
||||
|
||||
// use a linear layout manager
|
||||
layoutManager = new LinearLayoutManager(getActivity());
|
||||
dappsList.setLayoutManager(layoutManager);
|
||||
|
||||
adapter = new DappAdapter(dapps);
|
||||
resetDapps();
|
||||
dappsList.setAdapter(adapter);
|
||||
|
||||
swipeToAction = new SwipeToAction(dappsList, new SwipeToAction.SwipeListener<Dapp>() {
|
||||
@Override
|
||||
public boolean swipeLeft(final Dapp itemData) {
|
||||
|
||||
adapter.remove(itemData);
|
||||
return false; //true will move the front view to its starting position
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean swipeRight(Dapp itemData) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Dapp itemData) {
|
||||
|
||||
if (itemData.getId() == "new_app_id") {
|
||||
createDapp();
|
||||
} else {
|
||||
editDapp(itemData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongClick(Dapp itemData) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
boolean wrapInScrollView = true;
|
||||
dappDialog = new MaterialDialog.Builder(getActivity())
|
||||
.title(R.string.dapp_dialog_title)
|
||||
.customView(R.layout.dapp_form, wrapInScrollView)
|
||||
.positiveText(R.string.save)
|
||||
.negativeText(R.string.cancel)
|
||||
.contentColor(R.color.accent) // notice no 'res' postfix for literal color
|
||||
.dividerColorRes(R.color.accent)
|
||||
.backgroundColorRes(R.color.primary_dark)
|
||||
.positiveColorRes(R.color.accent)
|
||||
.negativeColorRes(R.color.accent)
|
||||
.widgetColorRes(R.color.accent)
|
||||
.callback(new MaterialDialog.ButtonCallback() {
|
||||
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
||||
View view = dialog.getCustomView();
|
||||
Dapp dapp = new Dapp();
|
||||
dapp.setName(dappName.getText().toString());
|
||||
dapp.setUrl(dappUrl.getText().toString());
|
||||
if (dapEditPosition > -1) {
|
||||
adapter.set(dapEditPosition, dapp);
|
||||
} else {
|
||||
adapter.add(dapp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegative(MaterialDialog dialog) {
|
||||
|
||||
dialog.hide();
|
||||
}
|
||||
})
|
||||
.build();
|
||||
dappName = (EditText) dappDialog.findViewById(R.id.dapp_name);
|
||||
dappUrl = (EditText) dappDialog.findViewById(R.id.dapp_url);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
// TODO: Rename method, update argument and hook method into UI event
|
||||
public void onButtonPressed(Uri uri) {
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onFragmentInteraction(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
||||
super.onAttach(activity);
|
||||
try {
|
||||
mListener = (OnFragmentInteractionListener) activity;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(activity.toString()
|
||||
+ " must implement OnFragmentInteractionListener");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
|
||||
super.onDetach();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
}
|
@ -1,344 +0,0 @@
|
||||
package io.syng;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.syng.entities.PreferenceManager;
|
||||
import io.syng.entities.Profile;
|
||||
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
Toolbar toolbar;
|
||||
protected ActionBarDrawerToggle drawerToggle;
|
||||
ArrayList<String> menuItems = new ArrayList<>(Arrays.asList("Console", "DApps", "EtherEx", "TrustDavis", "Augur"));
|
||||
protected List<Profile> profiles;
|
||||
|
||||
Spinner spinner;
|
||||
SpinnerAdapter spinnerAdapter;
|
||||
|
||||
EditText search;
|
||||
ListView drawerList;
|
||||
|
||||
TextView settings;
|
||||
TextView profileManager;
|
||||
|
||||
Profile requestProfile;
|
||||
int currentPosition;
|
||||
|
||||
protected ArrayAdapter<String> drawerListAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(final int layoutResID) {
|
||||
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
DrawerLayout fullLayout = (DrawerLayout) inflater.inflate(R.layout.drawer, null);
|
||||
LinearLayout actContent= (LinearLayout) fullLayout.findViewById(R.id.content);
|
||||
|
||||
DrawerLayout drawerLayout = (DrawerLayout) fullLayout.findViewById(R.id.drawer_layout);
|
||||
drawerList = (ListView) drawerLayout.findViewById(R.id.drawer_list);
|
||||
initDrawer();
|
||||
|
||||
toolbar = (Toolbar) inflater.inflate(layoutResID, actContent, true).findViewById(R.id.myToolbar);
|
||||
if (toolbar != null) {
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close);
|
||||
drawerLayout.setDrawerListener(drawerToggle);
|
||||
|
||||
spinner = (Spinner) drawerLayout.findViewById(R.id.nv_email);
|
||||
initSpinner();
|
||||
|
||||
search = (EditText) drawerLayout.findViewById(R.id.search);
|
||||
initSearch();
|
||||
|
||||
settings = (TextView) drawerLayout.findViewById(R.id.settings);
|
||||
settings.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
startActivity(new Intent(BaseActivity.this, SettingsActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
profileManager = (TextView) drawerLayout.findViewById(R.id.profileManager);
|
||||
profileManager.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
startActivity(new Intent(BaseActivity.this, ProfileManagerActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
super.setContentView(fullLayout);
|
||||
}
|
||||
|
||||
private void initDrawer() {
|
||||
|
||||
drawerListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, (ArrayList)menuItems.clone());
|
||||
drawerList.setAdapter(drawerListAdapter);
|
||||
drawerListAdapter.notifyDataSetChanged();
|
||||
|
||||
drawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
String item = parent.getItemAtPosition(position).toString();
|
||||
|
||||
switch (item) {
|
||||
case "Console":
|
||||
startActivity(new Intent(BaseActivity.this, MainActivity.class));
|
||||
break;
|
||||
case "DApps":
|
||||
break;
|
||||
case "EtherEx":
|
||||
break;
|
||||
case "TrustDavis":
|
||||
startActivity(new Intent(BaseActivity.this, webview.class));
|
||||
break;
|
||||
case "Augur":
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void changeProfile(Profile profile) {
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
Syng application = (Syng)getApplication();
|
||||
List<String> privateKeys = profile.getPrivateKeys();
|
||||
application.ethereum.init(privateKeys);
|
||||
currentPosition = spinnerAdapter.getPosition(profile);
|
||||
}
|
||||
|
||||
protected void requestChangeProfile(Profile profile) {
|
||||
|
||||
requestProfile = profile;
|
||||
new MaterialDialog.Builder(BaseActivity.this)
|
||||
.title(R.string.request_profile_password)
|
||||
.customView(R.layout.profile_password, true)
|
||||
.positiveText(R.string.ok)
|
||||
.negativeText(R.string.cancel)
|
||||
.contentColor(R.color.accent) // notice no 'res' postfix for literal color
|
||||
.dividerColorRes(R.color.accent)
|
||||
.backgroundColorRes(R.color.primary_dark)
|
||||
.positiveColorRes(R.color.accent)
|
||||
.negativeColorRes(R.color.accent)
|
||||
.widgetColorRes(R.color.accent)
|
||||
.callback(new MaterialDialog.ButtonCallback() {
|
||||
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
||||
View view = dialog.getCustomView();
|
||||
EditText passwordInput = (EditText) view.findViewById(R.id.passwordInput);
|
||||
if (requestProfile.decrypt(passwordInput.getText().toString())) {
|
||||
changeProfile(requestProfile);
|
||||
} else {
|
||||
dialog.hide();
|
||||
spinner.setSelection(currentPosition, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegative(MaterialDialog dialog) {
|
||||
|
||||
dialog.hide();
|
||||
spinner.setSelection(currentPosition, false);
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
|
||||
public void initSpinner() {
|
||||
|
||||
profiles = ((Syng)getApplication()).preferenceManager.getProfiles();
|
||||
spinnerAdapter = new SpinnerAdapter(this, android.R.layout.simple_dropdown_item_1line, profiles);
|
||||
spinner.setAdapter(spinnerAdapter);
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
if (adapterView != null && adapterView.getChildAt(0) != null) {
|
||||
((TextView) adapterView.getChildAt(0)).setTextColor(Color.parseColor("#ffffff"));
|
||||
}
|
||||
Profile profile = spinnerAdapter.getItem(i);
|
||||
if (profile.getPasswordProtectedProfile()) {
|
||||
requestChangeProfile(profile);
|
||||
} else {
|
||||
changeProfile(profile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
|
||||
((TextView) adapterView.getChildAt(0)).setTextColor(Color.parseColor("#ffffff"));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void initSearch() {
|
||||
|
||||
search.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
String searchValue = editable.toString();
|
||||
updateAppList(searchValue);
|
||||
}
|
||||
});
|
||||
|
||||
search.setOnKeyListener(new View.OnKeyListener() {
|
||||
|
||||
@Override
|
||||
public boolean onKey(View view, int i, KeyEvent keyEvent) {
|
||||
|
||||
if (keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(search.getWindowToken(), 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateAppList(String filter) {
|
||||
|
||||
drawerListAdapter.clear();
|
||||
int length = menuItems.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
String item = menuItems.get(i);
|
||||
if (item.toLowerCase().contains(filter.toLowerCase())) {
|
||||
drawerListAdapter.add(item);
|
||||
}
|
||||
}
|
||||
drawerListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
if (drawerToggle.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onPostCreate(savedInstanceState);
|
||||
drawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
|
||||
super.onConfigurationChanged(newConfig);
|
||||
drawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
public class SpinnerAdapter extends ArrayAdapter<Profile> {
|
||||
|
||||
private Context context;
|
||||
|
||||
private List<Profile> values;
|
||||
|
||||
public SpinnerAdapter(Context context, int textViewResourceId, List<Profile> values) {
|
||||
|
||||
super(context, textViewResourceId, values);
|
||||
this.context = context;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
|
||||
return values.size();
|
||||
}
|
||||
|
||||
public Profile getItem(int position){
|
||||
|
||||
return values.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position){
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
return getCustomView(position, convertView, parent);
|
||||
}
|
||||
|
||||
public View getCustomView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View row=inflater.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
|
||||
TextView label=(TextView)row.findViewById(android.R.id.text1);
|
||||
label.setText(spinnerAdapter.getItem(position).getName());
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,250 +0,0 @@
|
||||
package io.syng;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import org.ethereum.android.service.ConnectorHandler;
|
||||
import org.ethereum.android.service.EthereumClientMessage;
|
||||
import org.ethereum.android.service.EthereumConnector;
|
||||
import org.ethereum.android.service.events.BlockEventData;
|
||||
import org.ethereum.android.service.events.EventData;
|
||||
import org.ethereum.android.service.events.EventFlag;
|
||||
import org.ethereum.android.service.events.MessageEventData;
|
||||
import org.ethereum.android.service.events.PeerDisconnectEventData;
|
||||
import org.ethereum.android.service.events.PendingTransactionsEventData;
|
||||
import org.ethereum.android.service.events.TraceEventData;
|
||||
import org.ethereum.android.service.events.VMTraceCreatedEventData;
|
||||
import org.ethereum.config.SystemProperties;
|
||||
import org.ethereum.net.message.MessageFactory;
|
||||
import org.ethereum.net.p2p.HelloMessage;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class MainActivity extends BaseActivity implements ConnectorHandler {
|
||||
|
||||
protected static String consoleLog = "";
|
||||
|
||||
TextView consoleText;
|
||||
|
||||
boolean isPaused = false;
|
||||
|
||||
private Timer timer;
|
||||
private TimerTask timerTask;
|
||||
|
||||
private static int CONSOLE_LENGTH = 10000;
|
||||
private static int CONSOLE_REFRESH = 1000;
|
||||
|
||||
protected String handlerIdentifier = UUID.randomUUID().toString();
|
||||
|
||||
TextViewUpdater consoleUpdater = new TextViewUpdater();
|
||||
|
||||
static DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS");
|
||||
|
||||
private boolean isConnectorReady = false;
|
||||
|
||||
private class TextViewUpdater implements Runnable {
|
||||
|
||||
private String txt;
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
consoleText.setText(txt);
|
||||
}
|
||||
public void setText(String txt) {
|
||||
|
||||
this.txt = txt;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.BLACK);
|
||||
}
|
||||
|
||||
consoleText = (TextView) findViewById(R.id.console_log);
|
||||
consoleText.setText(MainActivity.consoleLog);
|
||||
consoleText.setMovementMethod(new ScrollingMovementMethod());
|
||||
|
||||
Syng application = (Syng)getApplication();
|
||||
application.ethereum.registerHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
||||
super.onPause();
|
||||
isPaused = true;
|
||||
timer.cancel();
|
||||
Syng application = (Syng)getApplication();
|
||||
application.ethereum.removeListener(handlerIdentifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
|
||||
super.onResume();
|
||||
isPaused = false;
|
||||
try {
|
||||
timer = new Timer();
|
||||
timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainActivity.this.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
int length = MainActivity.consoleLog.length();
|
||||
if (length > CONSOLE_LENGTH) {
|
||||
MainActivity.consoleLog = MainActivity.consoleLog.substring(CONSOLE_LENGTH * ((length/CONSOLE_LENGTH)-1) + length%CONSOLE_LENGTH);
|
||||
}
|
||||
consoleUpdater.setText(MainActivity.consoleLog);
|
||||
MainActivity.this.consoleText.post(consoleUpdater);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, CONSOLE_REFRESH);
|
||||
} catch (IllegalStateException e){
|
||||
android.util.Log.i("Damn", "resume error");
|
||||
}
|
||||
if (isConnectorReady) {
|
||||
Syng application = (Syng)getApplication();
|
||||
application.ethereum.addListener(handlerIdentifier, EnumSet.allOf(EventFlag.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message message) {
|
||||
|
||||
boolean isClaimed = true;
|
||||
switch(message.what) {
|
||||
case EthereumClientMessage.MSG_EVENT:
|
||||
Bundle data = message.getData();
|
||||
data.setClassLoader(EventFlag.class.getClassLoader());
|
||||
EventFlag event = (EventFlag)data.getSerializable("event");
|
||||
EventData eventData;
|
||||
MessageEventData messageEventData;
|
||||
switch(event) {
|
||||
case EVENT_BLOCK:
|
||||
BlockEventData blockEventData = data.getParcelable("data");
|
||||
addLogEntry(blockEventData.registeredTime, "Added block with " + blockEventData.receipts.size() + " transaction receipts.");
|
||||
break;
|
||||
case EVENT_HANDSHAKE_PEER:
|
||||
messageEventData = data.getParcelable("data");
|
||||
addLogEntry(messageEventData.registeredTime, "Peer " + new HelloMessage(messageEventData.message).getPeerId() + " said hello");
|
||||
break;
|
||||
case EVENT_NO_CONNECTIONS:
|
||||
eventData = data.getParcelable("data");
|
||||
addLogEntry(eventData.registeredTime, "No connections");
|
||||
break;
|
||||
case EVENT_PEER_DISCONNECT:
|
||||
PeerDisconnectEventData peerDisconnectEventData = data.getParcelable("data");
|
||||
addLogEntry(peerDisconnectEventData.registeredTime, "Peer " + peerDisconnectEventData.host + ":" + peerDisconnectEventData.port + " disconnected.");
|
||||
break;
|
||||
case EVENT_PENDING_TRANSACTIONS_RECEIVED:
|
||||
PendingTransactionsEventData pendingTransactionsEventData = data.getParcelable("data");
|
||||
addLogEntry(pendingTransactionsEventData.registeredTime, "Received " + pendingTransactionsEventData.transactions.size() + " pending transactions");
|
||||
break;
|
||||
case EVENT_RECEIVE_MESSAGE:
|
||||
messageEventData = data.getParcelable("data");
|
||||
addLogEntry(messageEventData.registeredTime, "Received message: " + messageEventData.messageClass.getName());
|
||||
break;
|
||||
case EVENT_SEND_MESSAGE:
|
||||
messageEventData = data.getParcelable("data");
|
||||
addLogEntry(messageEventData.registeredTime, "Sent message: " + messageEventData.messageClass.getName());
|
||||
break;
|
||||
case EVENT_SYNC_DONE:
|
||||
eventData = data.getParcelable("data");
|
||||
addLogEntry(eventData.registeredTime, "Sync done");
|
||||
break;
|
||||
case EVENT_VM_TRACE_CREATED:
|
||||
VMTraceCreatedEventData vmTraceCreatedEventData = data.getParcelable("data");
|
||||
addLogEntry(vmTraceCreatedEventData.registeredTime, "CM trace created: " + vmTraceCreatedEventData.transactionHash + " - " + vmTraceCreatedEventData.trace);
|
||||
break;
|
||||
case EVENT_TRACE:
|
||||
TraceEventData traceEventData = data.getParcelable("data");
|
||||
addLogEntry(traceEventData.registeredTime, traceEventData.message);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
isClaimed = false;
|
||||
}
|
||||
return isClaimed;
|
||||
}
|
||||
|
||||
protected void addLogEntry(long timestamp, String message) {
|
||||
|
||||
Date date = new Date(timestamp);
|
||||
|
||||
MainActivity.consoleLog += formatter.format(date) + " -> " + message + "\n";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
|
||||
return handlerIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectorConnected() {
|
||||
|
||||
isConnectorReady = true;
|
||||
Syng application = (Syng)getApplication();
|
||||
application.ethereum.addListener(handlerIdentifier, EnumSet.allOf(EventFlag.class));
|
||||
//ethereum.connect(SystemProperties.CONFIG.activePeerIP(), SystemProperties.CONFIG.activePeerPort(), SystemProperties.CONFIG.activePeerNodeid());
|
||||
application.ethereum.startJsonRpc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectorDisconnected() {
|
||||
|
||||
isConnectorReady = false;
|
||||
Syng application = (Syng)getApplication();
|
||||
application.ethereum.removeListener(handlerIdentifier);
|
||||
}
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package io.syng;
|
||||
|
||||
//import io.syng.util.SystemUiHider;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
public class SpashScreen extends Activity {
|
||||
|
||||
private final int SPLASH_DISPLAY_LENGTH = 1000;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_spash_screen);
|
||||
|
||||
/* New Handler to start the Menu-Activity
|
||||
* and close this Splash-Screen after some seconds.*/
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
/* Create an Intent that will start the Menu-Activity. */
|
||||
Intent mainIntent = new Intent(SpashScreen.this, MainActivity.class);
|
||||
SpashScreen.this.startActivity(mainIntent);
|
||||
SpashScreen.this.finish();
|
||||
}
|
||||
}, SPLASH_DISPLAY_LENGTH);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package io.syng;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import org.ethereum.android.service.EthereumConnector;
|
||||
|
||||
import io.syng.entities.PreferenceManager;
|
||||
|
||||
|
||||
public class Syng extends android.support.multidex.MultiDexApplication {
|
||||
|
||||
public PreferenceManager preferenceManager;
|
||||
|
||||
public static EthereumConnector ethereum = null;
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
|
||||
@Override public void onCreate() {
|
||||
|
||||
super.onCreate();
|
||||
preferenceManager = new PreferenceManager(this);
|
||||
if (ethereum == null) {
|
||||
ethereum = new EthereumConnector(this, EthereumService.class);
|
||||
ethereum.bindService();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
|
||||
super.onTerminate();
|
||||
preferenceManager.close();
|
||||
ethereum.unbindService();
|
||||
}
|
||||
}
|
271
app/src/main/java/io/syng/activity/BaseActivity.java
Normal file
@ -0,0 +1,271 @@
|
||||
package io.syng.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.syng.R;
|
||||
import io.syng.app.SyngApplication;
|
||||
import io.syng.entity.Profile;
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity implements OnItemClickListener,
|
||||
OnClickListener {
|
||||
|
||||
private static final int DRAWER_CLOSE_DELAY_SHORT = 200;
|
||||
private static final int DRAWER_CLOSE_DELAY_LONG = 400;
|
||||
|
||||
private static final String CONTRIBUTE_LINK = "https://github.com/syng-io";
|
||||
|
||||
private ArrayList<String> mMenuItemsList = new ArrayList<>(Arrays.asList("Console", "DApps",
|
||||
"EtherEx", "TrustDavis", "Augur"));
|
||||
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
private Spinner mAccountSpinner;
|
||||
private EditText mSearchTextView;
|
||||
private ListView mDrawerListView;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
|
||||
private ArrayAdapter<String> mDrawerListAdapter;
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
private Runnable mRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||
}
|
||||
};
|
||||
|
||||
protected abstract void onDAppClick(String item);
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public void setContentView(final int layoutResID) {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
mDrawerLayout = (DrawerLayout) inflater.inflate(R.layout.drawer, null, false);
|
||||
FrameLayout content = (FrameLayout) mDrawerLayout.findViewById(R.id.content);
|
||||
|
||||
mDrawerListView = (ListView) mDrawerLayout.findViewById(R.id.drawer_list);
|
||||
initDrawer();
|
||||
|
||||
Toolbar toolbar = (Toolbar) inflater.inflate(layoutResID, content, true).findViewById(R.id.myToolbar);
|
||||
if (toolbar != null) {
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar,
|
||||
R.string.drawer_open, R.string.drawer_close) {
|
||||
@Override
|
||||
public void onDrawerClosed(View drawerView) {
|
||||
super.onDrawerClosed(drawerView);
|
||||
hideKeyBoard(mSearchTextView);
|
||||
}
|
||||
};
|
||||
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
mAccountSpinner = (Spinner) mDrawerLayout.findViewById(R.id.nv_email);
|
||||
initSpinner();
|
||||
|
||||
mSearchTextView = (EditText) mDrawerLayout.findViewById(R.id.search);
|
||||
initSearch();
|
||||
|
||||
TextView settingsTextView = (TextView) mDrawerLayout.findViewById(R.id.settings);
|
||||
settingsTextView.setOnClickListener(this);
|
||||
|
||||
TextView profileTextView = (TextView) mDrawerLayout.findViewById(R.id.profile_manager);
|
||||
profileTextView.setOnClickListener(this);
|
||||
|
||||
TextView contributeTextView = (TextView) mDrawerLayout.findViewById(R.id.tv_contribute);
|
||||
contributeTextView.setOnClickListener(this);
|
||||
|
||||
ImageView header = (ImageView) mDrawerLayout.findViewById(R.id.iv_header);
|
||||
Glide.with(this).load(R.drawable.drawer).into(header);
|
||||
|
||||
super.setContentView(mDrawerLayout);
|
||||
}
|
||||
|
||||
|
||||
private void initDrawer() {
|
||||
mDrawerListAdapter = new ArrayAdapter<>(this, R.layout.simple_list_item, new ArrayList<>(mMenuItemsList));
|
||||
mDrawerListView.setAdapter(mDrawerListAdapter);
|
||||
mDrawerListView.setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
private void closeDrawer(int delayMills) {
|
||||
mHandler.postDelayed(mRunnable, delayMills);
|
||||
}
|
||||
|
||||
public void initSpinner() {
|
||||
|
||||
List<Profile> profilesList = ((SyngApplication) getApplication()).mPreferenceManager.getProfiles();
|
||||
ArrayList<String> spinnerItems = new ArrayList<>();
|
||||
for (Profile profile : profilesList) {
|
||||
spinnerItems.add(profile.getName());
|
||||
}
|
||||
mAccountSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, spinnerItems.toArray(new String[spinnerItems.size()])));
|
||||
mAccountSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
//String item = (String) adapterView.getItemAtPosition(i);
|
||||
if (adapterView != null && adapterView.getChildAt(0) != null) {
|
||||
((TextView) adapterView.getChildAt(0)).setTextColor(Color.parseColor("#ffffff"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
((TextView) adapterView.getChildAt(0)).setTextColor(Color.parseColor("#ffffff"));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void initSearch() {
|
||||
|
||||
mSearchTextView.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
String searchValue = editable.toString();
|
||||
updateAppList(searchValue);
|
||||
}
|
||||
});
|
||||
|
||||
mSearchTextView.setOnKeyListener(new View.OnKeyListener() {
|
||||
|
||||
@Override
|
||||
public boolean onKey(View view, int i, KeyEvent keyEvent) {
|
||||
|
||||
if (keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
|
||||
hideKeyBoard(mSearchTextView);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateAppList(String filter) {
|
||||
mDrawerListAdapter.clear();
|
||||
int length = mMenuItemsList.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
String item = mMenuItemsList.get(i);
|
||||
if (item.toLowerCase().contains(filter.toLowerCase())) {
|
||||
mDrawerListAdapter.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
return mDrawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
String item = parent.getItemAtPosition(position).toString();
|
||||
onDAppClick(item);
|
||||
closeDrawer(DRAWER_CLOSE_DELAY_SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.tv_contribute:
|
||||
String url = CONTRIBUTE_LINK;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(BaseActivity.this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.profile_manager:
|
||||
startActivity(new Intent(BaseActivity.this, ProfileManagerActivity.class));
|
||||
break;
|
||||
}
|
||||
closeDrawer(DRAWER_CLOSE_DELAY_LONG);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
mDrawerLayout.closeDrawer(GravityCompat.START);
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private void hideKeyBoard(View view) {
|
||||
if (view == null)
|
||||
return;
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
}
|
51
app/src/main/java/io/syng/activity/MainActivity.java
Normal file
@ -0,0 +1,51 @@
|
||||
package io.syng.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import io.syng.R;
|
||||
import io.syng.fragment.ConsoleFragment;
|
||||
import io.syng.fragment.WebViewFragment;
|
||||
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
replaceFragment(new ConsoleFragment());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDAppClick(String item) {
|
||||
switch (item) {
|
||||
case "Console":
|
||||
replaceFragment(new ConsoleFragment());
|
||||
break;
|
||||
case "DApps":
|
||||
replaceFragment(new WebViewFragment());
|
||||
break;
|
||||
case "EtherEx":
|
||||
replaceFragment(new WebViewFragment());
|
||||
break;
|
||||
case "TrustDavis":
|
||||
replaceFragment(new WebViewFragment());
|
||||
break;
|
||||
case "Augur":
|
||||
replaceFragment(new WebViewFragment());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceFragment(Fragment fragment) {
|
||||
getSupportFragmentManager().beginTransaction().
|
||||
replace(R.id.container, fragment).commit();
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +1,16 @@
|
||||
package io.syng;
|
||||
package io.syng.activity;
|
||||
|
||||
import android.app.FragmentManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import io.syng.entities.Profile;
|
||||
|
||||
|
||||
public class ProfileManagerActivity extends BaseActivity implements OnFragmentInteractionListener {
|
||||
|
||||
private FragmentManager fragmentManager;
|
||||
|
||||
private AddProfileFragment addProfileFragment;
|
||||
private ProfileManagerFragment profileManagerFragment;
|
||||
|
||||
@ -75,16 +66,15 @@ public class ProfileManagerActivity extends BaseActivity implements OnFragmentIn
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
profileManagerFragment.addProfile(profile);
|
||||
hideAddProfile();
|
||||
}
|
||||
profileManagerFragment.addProfile(profile);
|
||||
hideAddProfile();
|
||||
}
|
||||
}
|
||||
});
|
||||
addProfileLink = (TextView)findViewById(R.id.add_profile_link);
|
||||
addProfileLink = (TextView) findViewById(R.id.add_profile_link);
|
||||
addProfileLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
profileManagerFragment.resetProfilePosition();
|
||||
showAddProfile(null);
|
||||
}
|
||||
@ -102,16 +92,15 @@ public class ProfileManagerActivity extends BaseActivity implements OnFragmentIn
|
||||
addProfileContainer = findViewById(R.id.addProfileFragmentContainer);
|
||||
profileManagerContainer = findViewById(R.id.profileManagerFragmentContainer);
|
||||
|
||||
|
||||
|
||||
hideAddProfile();
|
||||
}
|
||||
|
||||
public void showAddProfile(Profile profile) {
|
||||
|
||||
profileManagerContainer.setVisibility(View.INVISIBLE);
|
||||
addProfileContainer.setVisibility(View.VISIBLE);
|
||||
addProfileLink.setVisibility(View.INVISIBLE);
|
||||
|
||||
addProfileContainer.setVisibility(View.VISIBLE);
|
||||
saveProfileLink.setVisibility(View.VISIBLE);
|
||||
|
||||
addProfileFragment.setProfile(profile);
|
||||
@ -130,14 +119,11 @@ public class ProfileManagerActivity extends BaseActivity implements OnFragmentIn
|
||||
}
|
||||
|
||||
public void addProfile(Profile profile) {
|
||||
|
||||
profileManagerFragment.addProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFragmentInteraction(Uri uri) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -157,7 +143,7 @@ public class ProfileManagerActivity extends BaseActivity implements OnFragmentIn
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
@ -1,25 +1,20 @@
|
||||
package io.syng;
|
||||
package io.syng.activity;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.RingtonePreference;
|
||||
import android.text.TextUtils;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.syng.R;
|
||||
|
||||
/**
|
||||
* A {@link PreferenceActivity} that presents a set of application settings. On
|
||||
* handset devices, settings are presented as a single list. On tablets,
|
||||
@ -31,6 +26,7 @@ import java.util.List;
|
||||
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
|
||||
* API Guide</a> for more information on developing a Settings UI.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
/**
|
||||
* Determines whether to always show the simplified settings UI, where
|
||||
@ -111,6 +107,7 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
* doesn't have an extra-large screen. In these cases, a single-pane
|
||||
* "simplified" settings UI should be shown.
|
||||
*/
|
||||
@SuppressWarnings({"PointlessBooleanExpression", "ConstantConditions"})
|
||||
private static boolean isSimplePreferences(Context context) {
|
||||
return ALWAYS_SIMPLE_PREFS
|
||||
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
|
||||
@ -123,7 +120,6 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public void onBuildHeaders(List<Header> target) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,22 +172,23 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
.getString(preference.getKey(), ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* This fragment shows general preferences only. It is used when the
|
||||
* activity is showing a two-pane settings UI.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static class GeneralPreferenceFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.pref_general);
|
||||
// /**
|
||||
// * This fragment shows general preferences only. It is used when the
|
||||
// * activity is showing a two-pane settings UI.
|
||||
// */
|
||||
// @TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
// public static class GeneralPreferenceFragment extends PreferenceFragment {
|
||||
// @Override
|
||||
// public void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// addPreferencesFromResource(R.xml.pref_general);
|
||||
//
|
||||
// // Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
// // to their values. When their values change, their summaries are
|
||||
// // updated to reflect the new value, per the Android Design
|
||||
// // guidelines.
|
||||
// bindPreferenceSummaryToValue(findPreference("runningMode"));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
// to their values. When their values change, their summaries are
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("runningMode"));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.adapter;
|
||||
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -11,13 +11,78 @@ import java.util.ArrayList;
|
||||
|
||||
import co.dift.ui.SwipeToAction;
|
||||
import io.syng.R;
|
||||
import io.syng.entity.Dapp;
|
||||
|
||||
public class DappAdapter extends RecyclerView.Adapter<DappAdapter.DappViewHolder> {
|
||||
|
||||
private ArrayList<Dapp> dataset;
|
||||
private ArrayList<Dapp> mDataSet;
|
||||
|
||||
public void add(int position, Dapp item) {
|
||||
mDataSet.add(position, item);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
public class DappViewHolder extends SwipeToAction.ViewHolder<Dapp> {
|
||||
public void set(int position, Dapp item) {
|
||||
mDataSet.set(position, item);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public void add(Dapp item) {
|
||||
mDataSet.add(item);
|
||||
int position = mDataSet.indexOf(item);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
public void remove(Dapp item) {
|
||||
int position = mDataSet.indexOf(item);
|
||||
mDataSet.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mDataSet.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public int getPosition(Dapp dapp) {
|
||||
return mDataSet.indexOf(dapp);
|
||||
}
|
||||
|
||||
public ArrayList<Dapp> getItems() {
|
||||
return mDataSet;
|
||||
}
|
||||
|
||||
public DappAdapter(ArrayList<Dapp> dataset) {
|
||||
this.mDataSet = dataset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DappAdapter.DappViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.dapp_item, parent, false);
|
||||
return new DappViewHolder(v);
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(DappViewHolder holder, int position) {
|
||||
|
||||
// - get element from your dataset at this position
|
||||
// - replace the contents of the view with that element
|
||||
final Dapp dapp = mDataSet.get(position);
|
||||
DappViewHolder viewHolder = (DappViewHolder) holder;
|
||||
viewHolder.data = dapp;
|
||||
holder.txtHeader.setText(mDataSet.get(position).getName());
|
||||
holder.txtFooter.setText("Footer: " + mDataSet.get(position).getName());
|
||||
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDataSet.size();
|
||||
}
|
||||
|
||||
static class DappViewHolder extends SwipeToAction.ViewHolder<Dapp> {
|
||||
|
||||
public TextView txtHeader;
|
||||
public TextView txtFooter;
|
||||
@ -30,83 +95,4 @@ public class DappAdapter extends RecyclerView.Adapter<DappAdapter.DappViewHolder
|
||||
}
|
||||
}
|
||||
|
||||
public void add(int position, Dapp item) {
|
||||
|
||||
dataset.add(position, item);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
public void set(int position, Dapp item) {
|
||||
|
||||
dataset.set(position, item);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public void add(Dapp item) {
|
||||
|
||||
dataset.add(item);
|
||||
int position = dataset.indexOf(item);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
public void remove(Dapp item) {
|
||||
|
||||
int position = dataset.indexOf(item);
|
||||
dataset.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
||||
dataset.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public int getPosition(Dapp dapp) {
|
||||
|
||||
return dataset.indexOf(dapp);
|
||||
}
|
||||
|
||||
public ArrayList<Dapp> getItems() {
|
||||
|
||||
return (ArrayList<Dapp>)dataset.clone();
|
||||
}
|
||||
|
||||
public DappAdapter(ArrayList<Dapp> dataset) {
|
||||
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DappAdapter.DappViewHolder onCreateViewHolder(ViewGroup parent,
|
||||
int viewType) {
|
||||
|
||||
// create a new view
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.dapp_item, parent, false);
|
||||
// set the view's size, margins, paddings and layout parameters
|
||||
DappViewHolder vh = new DappViewHolder(v);
|
||||
return vh;
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@Override
|
||||
public void onBindViewHolder(DappViewHolder holder, int position) {
|
||||
|
||||
// - get element from your dataset at this position
|
||||
// - replace the contents of the view with that element
|
||||
final Dapp dapp = dataset.get(position);
|
||||
DappViewHolder viewHolder = (DappViewHolder) holder;
|
||||
viewHolder.data = dapp;
|
||||
holder.txtHeader.setText(dataset.get(position).getName());
|
||||
holder.txtFooter.setText("Footer: " + dataset.get(position).getName());
|
||||
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
|
||||
return dataset.size();
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.adapter;
|
||||
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -11,75 +11,62 @@ import java.util.ArrayList;
|
||||
|
||||
import co.dift.ui.SwipeToAction;
|
||||
import io.syng.R;
|
||||
import io.syng.entity.Profile;
|
||||
|
||||
public class ProfileAdapter extends RecyclerView.Adapter<ProfileAdapter.ProfileViewHolder> {
|
||||
|
||||
private ArrayList<Profile> dataset;
|
||||
|
||||
|
||||
public class ProfileViewHolder extends SwipeToAction.ViewHolder<Profile> {
|
||||
|
||||
public TextView txtHeader;
|
||||
public TextView txtFooter;
|
||||
|
||||
public ProfileViewHolder(View v) {
|
||||
|
||||
super(v);
|
||||
txtHeader = (TextView) v.findViewById(R.id.firstLine);
|
||||
txtFooter = (TextView) v.findViewById(R.id.secondLine);
|
||||
}
|
||||
}
|
||||
private ArrayList<Profile> mDataSet;
|
||||
|
||||
public void add(int position, Profile item) {
|
||||
|
||||
dataset.add(position, item);
|
||||
mDataSet.add(position, item);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
public void set(int position, Profile item) {
|
||||
|
||||
dataset.set(position, item);
|
||||
mDataSet.set(position, item);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public void add(Profile item) {
|
||||
|
||||
dataset.add(item);
|
||||
int position = dataset.indexOf(item);
|
||||
mDataSet.add(item);
|
||||
int position = mDataSet.indexOf(item);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
public void remove(Profile item) {
|
||||
|
||||
int position = dataset.indexOf(item);
|
||||
dataset.remove(position);
|
||||
int position = mDataSet.indexOf(item);
|
||||
mDataSet.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
||||
dataset.clear();
|
||||
mDataSet.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public int getPosition(Profile item) {
|
||||
|
||||
return dataset.indexOf(item);
|
||||
return mDataSet.indexOf(item);
|
||||
}
|
||||
|
||||
public ArrayList<Profile> getItems() {
|
||||
|
||||
return (ArrayList<Profile>)dataset.clone();
|
||||
return (ArrayList<Profile>) mDataSet.clone();
|
||||
}
|
||||
|
||||
public ProfileAdapter(ArrayList<Profile> dataset) {
|
||||
|
||||
this.dataset = dataset;
|
||||
this.mDataSet = dataset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfileAdapter.ProfileViewHolder onCreateViewHolder(ViewGroup parent,
|
||||
int viewType) {
|
||||
int viewType) {
|
||||
|
||||
// create a new view
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.profile_item, parent, false);
|
||||
@ -94,11 +81,11 @@ public class ProfileAdapter extends RecyclerView.Adapter<ProfileAdapter.ProfileV
|
||||
|
||||
// - get element from your dataset at this position
|
||||
// - replace the contents of the view with that element
|
||||
final Profile profile = dataset.get(position);
|
||||
ProfileViewHolder viewHolder = (ProfileViewHolder) holder;
|
||||
final Profile profile = mDataSet.get(position);
|
||||
ProfileViewHolder viewHolder = holder;
|
||||
viewHolder.data = profile;
|
||||
holder.txtHeader.setText(dataset.get(position).getName());
|
||||
holder.txtFooter.setText("Footer: " + dataset.get(position).getName());
|
||||
holder.txtHeader.setText(mDataSet.get(position).getName());
|
||||
holder.txtFooter.setText("Footer: " + mDataSet.get(position).getName());
|
||||
|
||||
}
|
||||
|
||||
@ -106,7 +93,20 @@ public class ProfileAdapter extends RecyclerView.Adapter<ProfileAdapter.ProfileV
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
|
||||
return dataset.size();
|
||||
return mDataSet.size();
|
||||
}
|
||||
|
||||
public class ProfileViewHolder extends SwipeToAction.ViewHolder<Profile> {
|
||||
|
||||
public TextView txtHeader;
|
||||
public TextView txtFooter;
|
||||
|
||||
public ProfileViewHolder(View v) {
|
||||
|
||||
super(v);
|
||||
txtHeader = (TextView) v.findViewById(R.id.firstLine);
|
||||
txtFooter = (TextView) v.findViewById(R.id.secondLine);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
39
app/src/main/java/io/syng/app/SyngApplication.java
Normal file
@ -0,0 +1,39 @@
|
||||
package io.syng.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.multidex.MultiDexApplication;
|
||||
|
||||
import com.squareup.leakcanary.LeakCanary;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
|
||||
import io.syng.util.PreferenceManager;
|
||||
|
||||
|
||||
public class SyngApplication extends MultiDexApplication {
|
||||
|
||||
public PreferenceManager mPreferenceManager;
|
||||
|
||||
private RefWatcher refWatcher;
|
||||
|
||||
@Override public void onCreate() {
|
||||
super.onCreate();
|
||||
mPreferenceManager = new PreferenceManager(this);
|
||||
refWatcher = LeakCanary.install(this);
|
||||
// refWatcher = RefWatcher.DISABLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
mPreferenceManager.close();
|
||||
}
|
||||
|
||||
|
||||
public static RefWatcher getRefWatcher(Context context) {
|
||||
SyngApplication application = (SyngApplication) context.getApplicationContext();
|
||||
return application.refWatcher;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package io.syng.entities;
|
||||
|
||||
|
||||
public class RunningMode {
|
||||
|
||||
public static int FULL_CLIENT = 1;
|
||||
|
||||
public static int LIGHT_CLIENT = 2;
|
||||
|
||||
public static int JSON_RPC_CLIENT = 3;
|
||||
}
|
@ -1,65 +1,54 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.entity;
|
||||
|
||||
public class Dapp {
|
||||
|
||||
protected String name = "";
|
||||
protected String version = "";
|
||||
protected String url = "";
|
||||
|
||||
protected String id;
|
||||
|
||||
public Dapp(String id, String name) {
|
||||
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Dapp(String name) {
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Dapp() {
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +1,31 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class JsonRpcServer implements Serializable {
|
||||
|
||||
protected String host;
|
||||
|
||||
protected int port;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JsonRpcServer() {
|
||||
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
}
|
20
app/src/main/java/io/syng/entity/LogEntry.java
Normal file
@ -0,0 +1,20 @@
|
||||
package io.syng.entity;
|
||||
|
||||
public class LogEntry {
|
||||
|
||||
private long timeStamp;
|
||||
private String message;
|
||||
|
||||
public LogEntry(long timeStamp, String message) {
|
||||
this.timeStamp = timeStamp;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public long getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.entity;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -10,7 +10,6 @@ public class ObjectSerializer {
|
||||
|
||||
|
||||
public static String serialize(Serializable obj) throws Exception {
|
||||
|
||||
if (obj == null) return "";
|
||||
try {
|
||||
ByteArrayOutputStream serialObj = new ByteArrayOutputStream();
|
||||
@ -23,8 +22,7 @@ public class ObjectSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
public static Object deserialize(String str) throws Exception{
|
||||
|
||||
public static Object deserialize(String str) throws Exception {
|
||||
if (str == null || str.length() == 0) return null;
|
||||
try {
|
||||
ByteArrayInputStream serialObj = new ByteArrayInputStream(decodeBytes(str));
|
||||
@ -36,7 +34,6 @@ public class ObjectSerializer {
|
||||
}
|
||||
|
||||
public static String encodeBytes(byte[] bytes) {
|
||||
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
strBuf.append((char) (((bytes[i] >> 4) & 0xF) + ((int) 'a')));
|
||||
@ -46,13 +43,12 @@ public class ObjectSerializer {
|
||||
}
|
||||
|
||||
public static byte[] decodeBytes(String str) {
|
||||
|
||||
byte[] bytes = new byte[str.length() / 2];
|
||||
for (int i = 0; i < str.length(); i+=2) {
|
||||
for (int i = 0; i < str.length(); i += 2) {
|
||||
char c = str.charAt(i);
|
||||
bytes[i/2] = (byte) ((c - 'a') << 4);
|
||||
c = str.charAt(i+1);
|
||||
bytes[i/2] += (c - 'a');
|
||||
bytes[i / 2] = (byte) ((c - 'a') << 4);
|
||||
c = str.charAt(i + 1);
|
||||
bytes[i / 2] += (c - 'a');
|
||||
}
|
||||
return bytes;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.entity;
|
||||
|
||||
import org.ethereum.crypto.HashUtil;
|
||||
import org.spongycastle.util.encoders.Hex;
|
10
app/src/main/java/io/syng/entity/RunningMode.java
Normal file
@ -0,0 +1,10 @@
|
||||
package io.syng.entity;
|
||||
|
||||
|
||||
public final class RunningMode {
|
||||
|
||||
public final static int FULL_CLIENT = 1;
|
||||
public final static int LIGHT_CLIENT = 2;
|
||||
public final static int JSON_RPC_CLIENT = 3;
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.entity;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -25,47 +25,38 @@ public class Settings implements Serializable {
|
||||
}
|
||||
|
||||
public int getRunningMode() {
|
||||
|
||||
return runningMode;
|
||||
}
|
||||
|
||||
public void setRunningMode(int runningMode) {
|
||||
|
||||
this.runningMode = runningMode;
|
||||
}
|
||||
|
||||
public boolean getSyncInBackground() {
|
||||
|
||||
return syncInBackground;
|
||||
}
|
||||
|
||||
public void setSyncInBackground(boolean syncInBackground) {
|
||||
|
||||
this.syncInBackground = syncInBackground;
|
||||
}
|
||||
|
||||
public boolean getSyncOnlyWhenWifi() {
|
||||
|
||||
return syncOnlyWhenWifi;
|
||||
}
|
||||
|
||||
public void setSyncOnlyWhenWifi(boolean syncOnlyWhenWifi) {
|
||||
|
||||
this.syncOnlyWhenWifi = syncOnlyWhenWifi;
|
||||
}
|
||||
|
||||
public List<JsonRpcServer> getJsonRpcServers() {
|
||||
|
||||
return jsonRpcServers;
|
||||
}
|
||||
|
||||
public void setJsonRpcServers(List<JsonRpcServer> jsonRpcServers) {
|
||||
|
||||
this.jsonRpcServers = jsonRpcServers;
|
||||
}
|
||||
|
||||
public void addJsonRpcServer(String host, int port) {
|
||||
|
||||
JsonRpcServer server = new JsonRpcServer();
|
||||
server.setHost(host);
|
||||
server.setPort(port);
|
||||
@ -73,12 +64,11 @@ public class Settings implements Serializable {
|
||||
}
|
||||
|
||||
public void addJsonRpcServer(JsonRpcServer jsonRpcServer) {
|
||||
|
||||
this.jsonRpcServers.add(jsonRpcServer);
|
||||
}
|
||||
|
||||
public void removeJsonRpcServer(JsonRpcServer jsonRpcServer) {
|
||||
|
||||
this.jsonRpcServers.remove(jsonRpcServer);
|
||||
}
|
||||
|
||||
}
|
213
app/src/main/java/io/syng/fragment/AddProfileFragment.java
Normal file
@ -0,0 +1,213 @@
|
||||
package io.syng.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import co.dift.ui.SwipeToAction;
|
||||
import io.syng.R;
|
||||
import io.syng.adapter.DappAdapter;
|
||||
import io.syng.entity.Dapp;
|
||||
import io.syng.entity.Profile;
|
||||
import io.syng.interfaces.OnFragmentInteractionListener;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Activities that contain this fragment must implement the
|
||||
* {@link OnFragmentInteractionListener} interface
|
||||
* to handle interaction events.
|
||||
*/
|
||||
public class AddProfileFragment extends Fragment {
|
||||
|
||||
private EditText profileName;
|
||||
private Switch profilePasswordProtected;
|
||||
|
||||
private RecyclerView mDappsRecyclerView;
|
||||
private DappAdapter mAdapter;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
private SwipeToAction swipeToAction;
|
||||
private ArrayList<Dapp> mDappsList = new ArrayList<>();
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
private MaterialDialog dappDialog;
|
||||
private EditText dappName;
|
||||
private EditText dappUrl;
|
||||
|
||||
private Dapp addDapp = new Dapp("new_app_id", "Add new dapp");
|
||||
|
||||
private int dapEditPosition = -1;
|
||||
|
||||
public void setProfile(Profile profile) {
|
||||
|
||||
profileName.setText(profile != null ? profile.getName() : "");
|
||||
profilePasswordProtected.setChecked(profile != null ? profile.getPasswordProtectedProfile() : false);
|
||||
|
||||
resetDapps();
|
||||
if (profile != null) {
|
||||
for (Dapp dapp : profile.getDapps()) {
|
||||
mAdapter.add(dapp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void resetDapps() {
|
||||
mAdapter.clear();
|
||||
mAdapter.add(addDapp);
|
||||
}
|
||||
|
||||
public Profile getProfile() {
|
||||
Profile profile = new Profile();
|
||||
profile.setName(profileName.getText().toString());
|
||||
profile.setPasswordProtectedProfile(profilePasswordProtected.isChecked());
|
||||
List<Dapp> dapps = mAdapter.getItems();
|
||||
dapps.remove(addDapp);
|
||||
profile.setDapps(dapps);
|
||||
return profile;
|
||||
}
|
||||
|
||||
protected void editDapp(Dapp dapp) {
|
||||
dapEditPosition = mAdapter.getPosition(dapp);
|
||||
dappName.setText(dapp.getName());
|
||||
dappUrl.setText(dapp.getUrl());
|
||||
dappDialog.show();
|
||||
}
|
||||
|
||||
protected void createDapp() {
|
||||
dapEditPosition = -1;
|
||||
Dapp dapp = new Dapp();
|
||||
dappName.setText(dapp.getName());
|
||||
dappUrl.setText(dapp.getUrl());
|
||||
dappDialog.show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_add_profile, container, false);
|
||||
|
||||
profileName = (EditText) view.findViewById(R.id.profile_name);
|
||||
profilePasswordProtected = (Switch) view.findViewById(R.id.profile_password_protected);
|
||||
|
||||
mDappsRecyclerView = (RecyclerView) view.findViewById(R.id.profile_dapps_list);
|
||||
|
||||
// use this setting to improve performance if you know that changes
|
||||
// in content do not change the layout size of the RecyclerView
|
||||
mDappsRecyclerView.setHasFixedSize(true);
|
||||
|
||||
// use a linear layout manager
|
||||
mLayoutManager = new LinearLayoutManager(getActivity());
|
||||
mDappsRecyclerView.setLayoutManager(mLayoutManager);
|
||||
|
||||
mAdapter = new DappAdapter(mDappsList);
|
||||
resetDapps();
|
||||
mDappsRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
swipeToAction = new SwipeToAction(mDappsRecyclerView, new SwipeToAction.SwipeListener<Dapp>() {
|
||||
@Override
|
||||
public boolean swipeLeft(final Dapp itemData) {
|
||||
mAdapter.remove(itemData);
|
||||
return false; //true will move the front view to its starting position
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean swipeRight(Dapp itemData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Dapp itemData) {
|
||||
if (itemData.getId() == "new_app_id") {
|
||||
createDapp();
|
||||
} else {
|
||||
editDapp(itemData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongClick(Dapp itemData) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
boolean wrapInScrollView = true;
|
||||
dappDialog = new MaterialDialog.Builder(getActivity())
|
||||
.title(R.string.dapp_dialog_title)
|
||||
.customView(R.layout.dapp_form, wrapInScrollView)
|
||||
.positiveText(R.string.save)
|
||||
.negativeText(R.string.cancel)
|
||||
.contentColor(getResources().getColor(R.color.accent)) // notice no 'res' postfix for literal color
|
||||
.dividerColorRes(R.color.accent)
|
||||
.backgroundColorRes(R.color.primary_dark)
|
||||
.positiveColorRes(R.color.accent)
|
||||
.negativeColorRes(R.color.accent)
|
||||
.widgetColorRes(R.color.accent)
|
||||
.callback(new MaterialDialog.ButtonCallback() {
|
||||
|
||||
@Override
|
||||
public void onPositive(MaterialDialog dialog) {
|
||||
|
||||
View view = dialog.getCustomView();
|
||||
Dapp dapp = new Dapp();
|
||||
dapp.setName(dappName.getText().toString());
|
||||
dapp.setUrl(dappUrl.getText().toString());
|
||||
if (dapEditPosition > -1) {
|
||||
mAdapter.set(dapEditPosition, dapp);
|
||||
} else {
|
||||
mAdapter.add(dapp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegative(MaterialDialog dialog) {
|
||||
dialog.hide();
|
||||
}
|
||||
})
|
||||
.build();
|
||||
dappName = (EditText) dappDialog.findViewById(R.id.dapp_name);
|
||||
dappUrl = (EditText) dappDialog.findViewById(R.id.dapp_url);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
// TODO: Rename method, update argument and hook method into UI event
|
||||
public void onButtonPressed(Uri uri) {
|
||||
if (mListener != null) {
|
||||
mListener.onFragmentInteraction(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
try {
|
||||
mListener = (OnFragmentInteractionListener) activity;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(activity.toString()
|
||||
+ " must implement OnFragmentInteractionListener");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
}
|
258
app/src/main/java/io/syng/fragment/ConsoleFragment.java
Normal file
@ -0,0 +1,258 @@
|
||||
package io.syng.fragment;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
|
||||
import org.ethereum.android.service.ConnectorHandler;
|
||||
import org.ethereum.android.service.EthereumClientMessage;
|
||||
import org.ethereum.android.service.EthereumConnector;
|
||||
import org.ethereum.android.service.events.BlockEventData;
|
||||
import org.ethereum.android.service.events.EventData;
|
||||
import org.ethereum.android.service.events.EventFlag;
|
||||
import org.ethereum.android.service.events.MessageEventData;
|
||||
import org.ethereum.android.service.events.PeerDisconnectEventData;
|
||||
import org.ethereum.android.service.events.PendingTransactionsEventData;
|
||||
import org.ethereum.android.service.events.TraceEventData;
|
||||
import org.ethereum.android.service.events.VMTraceCreatedEventData;
|
||||
import org.ethereum.net.p2p.HelloMessage;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import io.syng.R;
|
||||
import io.syng.app.SyngApplication;
|
||||
import io.syng.entity.LogEntry;
|
||||
import io.syng.service.EthereumService;
|
||||
|
||||
|
||||
public class ConsoleFragment extends Fragment implements ConnectorHandler {
|
||||
|
||||
private final static int CONSOLE_LENGTH = 10000;
|
||||
private final static int CONSOLE_REFRESH_MILLS = 1000 * 5; //5 sec
|
||||
|
||||
private String mConsoleLog = "";
|
||||
|
||||
private static EthereumConnector sEthereumConnector;
|
||||
|
||||
private TextView mConsoleText;
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
private String mHandlerIdentifier = UUID.randomUUID().toString();
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private DateFormat mDateFormatter = new SimpleDateFormat("HH:mm:ss:SSS");
|
||||
|
||||
private Runnable mRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
int length = mConsoleLog.length();
|
||||
if (length > CONSOLE_LENGTH) {
|
||||
mConsoleLog = mConsoleLog.substring(CONSOLE_LENGTH * ((length / CONSOLE_LENGTH) - 1) + length % CONSOLE_LENGTH);
|
||||
}
|
||||
mConsoleText.setText(mConsoleLog);
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
long elapsedTime = stopTime - startTime;
|
||||
Log.d("mRunnable", Long.toString(elapsedTime));
|
||||
|
||||
mHandler.postDelayed(mRunnable, CONSOLE_REFRESH_MILLS);
|
||||
}
|
||||
};
|
||||
|
||||
public ConsoleFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_console, container, false);
|
||||
|
||||
mConsoleText = (TextView) view.findViewById(R.id.tv_console_log);
|
||||
mConsoleText.setText(mConsoleLog);
|
||||
mConsoleText.setMovementMethod(new ScrollingMovementMethod());
|
||||
|
||||
ImageView background = (ImageView) view.findViewById(R.id.iv_background);
|
||||
Glide.with(this).load(R.drawable.bg1).into(background);
|
||||
|
||||
ImageView ethereumIcon = (ImageView) view.findViewById(R.id.iv_ethereum_icon);
|
||||
ImageView ethereumText = (ImageView) view.findViewById(R.id.iv_ethereum_text);
|
||||
Glide.with(this).load(R.drawable.ethereum_text).into(ethereumText);
|
||||
Glide.with(this).load(R.drawable.ethereum_icon).into(ethereumIcon);
|
||||
|
||||
if (sEthereumConnector == null) {
|
||||
sEthereumConnector = new EthereumConnector(getActivity(), EthereumService.class);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
sEthereumConnector.removeHandler(this);
|
||||
sEthereumConnector.removeListener(mHandlerIdentifier);
|
||||
sEthereumConnector.unbindService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mHandler.post(mRunnable);
|
||||
sEthereumConnector.registerHandler(this);
|
||||
sEthereumConnector.bindService();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message message) {
|
||||
new MyAsyncTask(message).execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addLogEntry(LogEntry logEntry) {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
Date date = new Date(logEntry.getTimeStamp());
|
||||
mConsoleLog += mDateFormatter.format(date) + " -> " + logEntry.getMessage() + "\n";
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
long elapsedTime = stopTime - startTime;
|
||||
Log.d("addLogEntry", Long.toString(elapsedTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return mHandlerIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectorConnected() {
|
||||
sEthereumConnector.addListener(mHandlerIdentifier, EnumSet.allOf(EventFlag.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectorDisconnected() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
RefWatcher refWatcher = SyngApplication.getRefWatcher(getActivity());
|
||||
refWatcher.watch(this);
|
||||
if (getActivity().isFinishing()) {
|
||||
sEthereumConnector = null;
|
||||
}
|
||||
}
|
||||
|
||||
private LogEntry myHandleMessage(Message message) {
|
||||
|
||||
switch (message.what) {
|
||||
case EthereumClientMessage.MSG_EVENT:
|
||||
Bundle data = message.getData();
|
||||
data.setClassLoader(EventFlag.class.getClassLoader());
|
||||
EventFlag event = (EventFlag) data.getSerializable("event");
|
||||
EventData eventData;
|
||||
MessageEventData messageEventData;
|
||||
switch (event) {
|
||||
case EVENT_BLOCK:
|
||||
BlockEventData blockEventData = data.getParcelable("data");
|
||||
// addLogEntry(blockEventData.registeredTime, "Added block with " + blockEventData.receipts.size() + " transaction receipts.");
|
||||
return new LogEntry(blockEventData.registeredTime, "Added block with " + blockEventData.receipts.size() + " transaction receipts.");
|
||||
case EVENT_HANDSHAKE_PEER:
|
||||
messageEventData = data.getParcelable("data");
|
||||
// addLogEntry(messageEventData.registeredTime, "Peer " + new HelloMessage(messageEventData.message).getPeerId() + " said hello");
|
||||
return new LogEntry(messageEventData.registeredTime, "Peer " + new HelloMessage(messageEventData.message).getPeerId() + " said hello");
|
||||
case EVENT_NO_CONNECTIONS:
|
||||
eventData = data.getParcelable("data");
|
||||
// addLogEntry(eventData.registeredTime, "No connections");
|
||||
return new LogEntry(eventData.registeredTime, "No connections");
|
||||
case EVENT_PEER_DISCONNECT:
|
||||
PeerDisconnectEventData peerDisconnectEventData = data.getParcelable("data");
|
||||
// addLogEntry(peerDisconnectEventData.registeredTime, "Peer " + peerDisconnectEventData.host + ":" + peerDisconnectEventData.port + " disconnected.");
|
||||
return new LogEntry(peerDisconnectEventData.registeredTime, "Peer " + peerDisconnectEventData.host + ":" + peerDisconnectEventData.port + " disconnected.");
|
||||
case EVENT_PENDING_TRANSACTIONS_RECEIVED:
|
||||
PendingTransactionsEventData pendingTransactionsEventData = data.getParcelable("data");
|
||||
// addLogEntry(pendingTransactionsEventData.registeredTime, "Received " + pendingTransactionsEventData.transactions.size() + " pending transactions");
|
||||
return new LogEntry(pendingTransactionsEventData.registeredTime, "Received " + pendingTransactionsEventData.transactions.size() + " pending transactions");
|
||||
case EVENT_RECEIVE_MESSAGE:
|
||||
messageEventData = data.getParcelable("data");
|
||||
// addLogEntry(messageEventData.registeredTime, "Received message: " + messageEventData.messageClass.getName());
|
||||
return new LogEntry(messageEventData.registeredTime, "Received message: " + messageEventData.messageClass.getName());
|
||||
case EVENT_SEND_MESSAGE:
|
||||
messageEventData = data.getParcelable("data");
|
||||
// addLogEntry(messageEventData.registeredTime, "Sent message: " + messageEventData.messageClass.getName());
|
||||
return new LogEntry(messageEventData.registeredTime, "Sent message: " + messageEventData.messageClass.getName());
|
||||
case EVENT_SYNC_DONE:
|
||||
eventData = data.getParcelable("data");
|
||||
// addLogEntry(eventData.registeredTime, "Sync done");
|
||||
return new LogEntry(eventData.registeredTime, "Sync done");
|
||||
case EVENT_VM_TRACE_CREATED:
|
||||
VMTraceCreatedEventData vmTraceCreatedEventData = data.getParcelable("data");
|
||||
// addLogEntry(vmTraceCreatedEventData.registeredTime, "CM trace created: " + vmTraceCreatedEventData.transactionHash + " - " + vmTraceCreatedEventData.trace);
|
||||
return new LogEntry(vmTraceCreatedEventData.registeredTime, "CM trace created: " + vmTraceCreatedEventData.transactionHash + " - " + vmTraceCreatedEventData.trace);
|
||||
case EVENT_TRACE:
|
||||
TraceEventData traceEventData = data.getParcelable("data");
|
||||
// addLogEntry(traceEventData.registeredTime, traceEventData.message);
|
||||
return new LogEntry(traceEventData.registeredTime, traceEventData.message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private class MyAsyncTask extends AsyncTask<Void, Void, LogEntry> {
|
||||
|
||||
private final Message mMessage;
|
||||
|
||||
public MyAsyncTask(final Message message) {
|
||||
mMessage = Message.obtain(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LogEntry doInBackground(Void... params) {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
LogEntry logEntry = myHandleMessage(mMessage);
|
||||
|
||||
long stopTime = System.currentTimeMillis();
|
||||
long elapsedTime = stopTime - startTime;
|
||||
Log.d("doInBackground", Long.toString(elapsedTime));
|
||||
|
||||
return logEntry;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(LogEntry logEntry) {
|
||||
super.onPostExecute(logEntry);
|
||||
if (logEntry != null) {
|
||||
addLogEntry(logEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,21 +1,25 @@
|
||||
package io.syng;
|
||||
package io.syng.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.net.Uri;
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import co.dift.ui.SwipeToAction;
|
||||
import io.syng.entities.Profile;
|
||||
import io.syng.entities.ProfileAdapter;
|
||||
import io.syng.R;
|
||||
import io.syng.activity.BaseActivity;
|
||||
import io.syng.activity.ProfileManagerActivity;
|
||||
import io.syng.adapter.ProfileAdapter;
|
||||
import io.syng.app.SyngApplication;
|
||||
import io.syng.entity.Profile;
|
||||
import io.syng.interfaces.OnFragmentInteractionListener;
|
||||
|
||||
|
||||
/**
|
||||
@ -56,14 +60,13 @@ public class ProfileManagerFragment extends Fragment {
|
||||
}
|
||||
|
||||
public void resetProfilePosition() {
|
||||
|
||||
profileEditPosition = -1;
|
||||
}
|
||||
|
||||
public void updateProfiles() {
|
||||
|
||||
BaseActivity activity = (BaseActivity)getActivity();
|
||||
((Syng) activity.getApplication()).preferenceManager.saveProfiles(adapter.getItems());
|
||||
((SyngApplication) activity.getApplication()).mPreferenceManager.saveProfiles(adapter.getItems());
|
||||
activity.initSpinner();
|
||||
}
|
||||
|
||||
@ -91,7 +94,7 @@ public class ProfileManagerFragment extends Fragment {
|
||||
|
||||
// specify an adapter (see also next example)
|
||||
|
||||
profiles = ((Syng)getActivity().getApplication()).preferenceManager.getProfiles();
|
||||
profiles = ((SyngApplication)getActivity().getApplication()).mPreferenceManager.getProfiles();
|
||||
adapter = new ProfileAdapter(profiles);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
59
app/src/main/java/io/syng/fragment/WebViewFragment.java
Normal file
@ -0,0 +1,59 @@
|
||||
package io.syng.fragment;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebSettings;
|
||||
|
||||
import com.github.ksoichiro.android.observablescrollview.ObservableWebView;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
|
||||
import io.syng.R;
|
||||
import io.syng.app.SyngApplication;
|
||||
|
||||
|
||||
public class WebViewFragment extends Fragment {
|
||||
|
||||
private static final String HTTP_TRUSTDAVIS_METEOR_COM = "http://trustdavis.meteor.com";
|
||||
|
||||
public WebViewFragment() {
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_web_view, container, false);
|
||||
|
||||
ObservableWebView webView = (ObservableWebView) view.findViewById(R.id.web_view);
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
//
|
||||
//// webView.setWebChromeClient(new WebChromeClient() {
|
||||
//// public boolean onConsoleMessage(@NonNull ConsoleMessage cm) {
|
||||
////
|
||||
//// String output = cm.message() + " -- From line "
|
||||
//// + cm.lineNumber() + " of "
|
||||
//// + cm.sourceId();
|
||||
//// MainActivity.CONSOLE_LOG += output;
|
||||
//// Log.d("SyngJs", output);
|
||||
//// return true;
|
||||
//// }
|
||||
//// });
|
||||
webView.loadUrl(HTTP_TRUSTDAVIS_METEOR_COM);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
RefWatcher refWatcher = SyngApplication.getRefWatcher(getActivity());
|
||||
refWatcher.watch(this);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng;
|
||||
package io.syng.interfaces;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
@ -15,5 +15,5 @@ import android.net.Uri;
|
||||
public interface OnFragmentInteractionListener {
|
||||
|
||||
// TODO: Update argument type and name
|
||||
public void onFragmentInteraction(Uri uri);
|
||||
void onFragmentInteraction(Uri uri);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.syng;
|
||||
package io.syng.service;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
@ -6,15 +6,9 @@ import org.ethereum.android.service.EthereumRemoteService;
|
||||
|
||||
public class EthereumService extends EthereumRemoteService {
|
||||
|
||||
public EthereumService() {
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +1,38 @@
|
||||
package io.syng.entities;
|
||||
package io.syng.util;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.syng.entity.ObjectSerializer;
|
||||
import io.syng.entity.Profile;
|
||||
|
||||
public class PreferenceManager {
|
||||
|
||||
private SharedPreferences preferences;
|
||||
private final static String SHARED_PREFERENCES_FILE = "test";
|
||||
|
||||
private static String sharedPreferencesFile = "test";
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
public PreferenceManager(Context context) {
|
||||
|
||||
preferences = context.getSharedPreferences(sharedPreferencesFile, Context.MODE_PRIVATE);
|
||||
mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public void saveProfiles(ArrayList<Profile> profiles) {
|
||||
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
SharedPreferences.Editor editor = mPreferences.edit();
|
||||
try {
|
||||
editor.putString("profiles", ObjectSerializer.serialize(profiles));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public ArrayList<Profile> getProfiles() {
|
||||
|
||||
ArrayList<Profile> profiles = new ArrayList<>();
|
||||
try {
|
||||
profiles = (ArrayList<Profile>) ObjectSerializer.deserialize(preferences.getString("profiles", ObjectSerializer.serialize(profiles)));
|
||||
profiles = (ArrayList<Profile>) ObjectSerializer.deserialize(mPreferences.getString("profiles", ObjectSerializer.serialize(profiles)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -42,7 +40,7 @@ public class PreferenceManager {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
||||
preferences = null;
|
||||
mPreferences = null;
|
||||
}
|
||||
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
package io.syng;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.webkit.ConsoleMessage;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
||||
import com.github.ksoichiro.android.observablescrollview.ObservableWebView;
|
||||
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
||||
|
||||
|
||||
public class webview extends BaseActivity implements ObservableScrollViewCallbacks {
|
||||
|
||||
ObservableWebView webView;
|
||||
int lastTop = 0;
|
||||
int previousToLastTop = 0;
|
||||
final int hideStep = 20;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.webview);
|
||||
|
||||
webView = (ObservableWebView) findViewById(R.id.webView);
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
webView.setWebChromeClient(new WebChromeClient() {
|
||||
public boolean onConsoleMessage(ConsoleMessage cm) {
|
||||
|
||||
String output = cm.message() + " -- From line "
|
||||
+ cm.lineNumber() + " of "
|
||||
+ cm.sourceId();
|
||||
MainActivity.consoleLog += output;
|
||||
Log.d("SyngJs", output);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
webView.setScrollViewCallbacks(this);
|
||||
// webView.loadUrl("http://trustdavis.meteor.com");
|
||||
webView.loadUrl("file:///android_asset/boilerplate/index.html");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollChanged(int i, boolean b, boolean b1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownMotionEvent() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
|
||||
|
||||
if (getSupportActionBar() == null) {
|
||||
Log.d("MyTag", "Null");
|
||||
|
||||
return;
|
||||
}
|
||||
if (scrollState == ScrollState.UP) {
|
||||
|
||||
if (getSupportActionBar().isShowing()) {
|
||||
Log.d("MyTag", "Hide");
|
||||
getSupportActionBar().hide();
|
||||
|
||||
}
|
||||
} else if (scrollState == ScrollState.DOWN) {
|
||||
if (!getSupportActionBar().isShowing()) {
|
||||
Log.d("MyTag", "Show");
|
||||
getSupportActionBar().show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
getMenuInflater().inflate(R.menu.webview_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-hdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 124 B |
BIN
app/src/main/res/drawable-hdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 127 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 86 B |
BIN
app/src/main/res/drawable-mdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 88 B |
BIN
app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 97 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 97 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png
Normal file
After Width: | Height: | Size: 102 B |
Before Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable/bg1.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
@ -1,53 +0,0 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/profileManagerContainer"
|
||||
android:title="@string/manage_profiles"
|
||||
tools:context="io.syng.ProfileManagerActivity">
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primary_dark"
|
||||
android:gravity="end"
|
||||
android:theme="@style/MyToolbar"
|
||||
>
|
||||
|
||||
<RelativeLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
style="@style/ToolbarIcon"
|
||||
android:id="@+id/add_profile_link"
|
||||
android:text="@string/add_profile"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
style="@style/ToolbarIcon"
|
||||
android:id="@+id/save_profile_link"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
<FrameLayout
|
||||
android:id="@+id/profileManagerFragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible"
|
||||
android:layout_below="@id/myToolbar">
|
||||
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/addProfileFragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible"
|
||||
android:layout_below="@id/myToolbar">
|
||||
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/content"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/Container320">
|
||||
|
||||
<include layout="@layout/drawer_contents" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/addrel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/drawer_bg"
|
||||
style="@style/Drawer320">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nv_name"
|
||||
style="@style/TextDrawer320" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/nv_email"
|
||||
style="@style/SpinnertDrawer320" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
style="@style/ViewDrawer320" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/search_ll"
|
||||
style="@style/Search320">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search"
|
||||
android:inputType="text"
|
||||
style="@style/TextSearch320" />
|
||||
|
||||
<ImageView style="@style/ViewSearch320" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/drawer_list"
|
||||
style="@style/List320"
|
||||
tools:listitem="@android:layout/simple_list_item_1"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp">
|
||||
|
||||
</ListView>
|
||||
|
||||
<RelativeLayout style="@style/BottomLinks320" android:layout_below="@+id/drawer_list"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profileManager"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:text="Profile Manager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:layout_below="@+id/profileManager"
|
||||
android:text="Settings" />
|
||||
|
||||
<View
|
||||
android:id="@+id/seperator"
|
||||
style="@style/SeparatorBottomLinks320" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/help"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:layout_below="@+id/seperator"
|
||||
android:text="Help" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -1,42 +0,0 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.syng.AddProfileFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_settings"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="vertical">
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/profile_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/accent"
|
||||
android:hint="Name" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/accent">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/profile_password_protected"
|
||||
android:text="@string/profile_password_protected"
|
||||
android:layout_width="fill_parent"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/profile_dapps_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_below="@id/profile_settings"/>
|
||||
|
||||
</RelativeLayout>
|
@ -1,16 +0,0 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="io.syng.ProfileManagerFragment">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/profile_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical"/>
|
||||
</RelativeLayout>
|
@ -1,91 +0,0 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/ContainerNet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.syng.MainActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rella_lay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/console_log"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:alpha="0.8"
|
||||
android:gravity="bottom"
|
||||
android:paddingTop="51dp"
|
||||
android:scrollbarFadeDuration="0"
|
||||
android:scrollbarSize="25dip"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
android:text=" "
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="51dp"
|
||||
android:background="@drawable/fill"
|
||||
android:theme="@style/MyToolbar">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ImageButton style="@style/ToolbarButtonWhite" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dynamic_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/myToolbar">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dynamicContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="60dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1.3"
|
||||
android:src="@drawable/ethereum_icon" />
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.1" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="0.4"
|
||||
android:src="@drawable/syngeth_text" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.getbase.floatingactionbutton.FloatingActionButton xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/pink_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:layout_marginRight="7dp"
|
||||
fab:fab_colorNormal="#ffffff"
|
||||
fab:fab_colorPressed="#e9e9e9"
|
||||
fab:fab_icon="@drawable/add" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,85 +0,0 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:padding="6dip" >
|
||||
|
||||
<RelativeLayout
|
||||
android:tag="reveal-right"
|
||||
android:background="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:tint="@color/icons"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- this view reveals when swipe left -->
|
||||
<RelativeLayout
|
||||
android:tag="reveal-left"
|
||||
android:background="@color/red"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:tint="@color/icons"
|
||||
android:src="@drawable/ic_delete_black_24dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- this is the item front view -->
|
||||
<RelativeLayout
|
||||
android:tag="front"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/profile">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:contentDescription="TODO"
|
||||
android:src="@drawable/profile" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/secondLine"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="26dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:text="Description"
|
||||
android:textColor="@color/accent"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/firstLine"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/secondLine"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:gravity="center_vertical"
|
||||
android:text="Example profile"
|
||||
android:textColor="@color/accent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
@ -1,27 +0,0 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.syng.webview">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
style="@style/ToolbarCointainer"
|
||||
android:layout_width="fill_parent"
|
||||
android:background="@color/toolbar"
|
||||
app:title="Trust Davis">
|
||||
|
||||
<ImageButton
|
||||
style="@style/ToolbarIcon"
|
||||
android:src="@drawable/fav" />
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableWebView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/myToolbar" />
|
||||
|
||||
</RelativeLayout>
|
14
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/app_toolbar"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
@ -1,37 +1,38 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<RelativeLayout
|
||||
android:id="@+id/profileManagerContainer"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/profileManagerContainer"
|
||||
android:title="@string/manage_profiles"
|
||||
tools:context="io.syng.ProfileManagerActivity">
|
||||
tools:context="io.syng.activity.ProfileManagerActivity">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="@color/primary_dark"
|
||||
android:gravity="end"
|
||||
android:theme="@style/MyToolbar"
|
||||
>
|
||||
<RelativeLayout android:layout_width="wrap_content"
|
||||
android:gravity="end">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
style="@style/ToolbarIcon"
|
||||
android:id="@+id/add_profile_link"
|
||||
android:text="@string/add_profile"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_profile_link"
|
||||
style="@style/ToolbarIcon"
|
||||
android:id="@+id/save_profile_link"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" />
|
||||
android:text="@string/add_profile"
|
||||
android:textColor="@color/accent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/save_profile_link"
|
||||
style="@style/ToolbarIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/accent"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
@ -40,15 +41,17 @@
|
||||
android:id="@+id/profileManagerFragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible"
|
||||
android:layout_below="@id/myToolbar">
|
||||
android:layout_below="@id/myToolbar"
|
||||
android:visibility="visible">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/addProfileFragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible"
|
||||
android:layout_below="@id/myToolbar">
|
||||
android:layout_below="@id/myToolbar"
|
||||
android:visibility="invisible">
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -1,18 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
tools:context="io.syng.SpashScreen">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="io.syng.activity.SplashScreenActivity">
|
||||
|
||||
<ImageView android:id="@+id/splashscreen" android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:src="@drawable/syngeth_text"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<TextView android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, splash"/>
|
||||
<ImageView
|
||||
android:id="@+id/splashscreen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ethereum_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,4 +0,0 @@
|
||||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fragment"
|
||||
android:name="io.syng.TestFragment" tools:layout="@layout/fragment_test"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent" />
|
9
app/src/main/res/layout/app_toolbar.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
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="?attr/actionBarSize"
|
||||
android:background="@color/primary_dark"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
@ -1,13 +1,12 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:padding="6dip" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight">
|
||||
|
||||
<RelativeLayout
|
||||
android:tag="reveal-right"
|
||||
android:background="@color/white"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:tag="reveal-right">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
@ -20,10 +19,10 @@
|
||||
|
||||
<!-- this view reveals when swipe left -->
|
||||
<RelativeLayout
|
||||
android:tag="reveal-left"
|
||||
android:background="@color/red"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/red"
|
||||
android:tag="reveal-left">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
@ -31,16 +30,16 @@
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:tint="@color/icons"
|
||||
android:src="@drawable/ic_delete_black_24dp"/>
|
||||
android:src="@drawable/ic_delete_black_24dp"
|
||||
android:tint="@color/icons"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- this is the item front view -->
|
||||
<RelativeLayout
|
||||
android:tag="front"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primary_dark">
|
||||
android:background="@color/primary_dark"
|
||||
android:tag="front">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
@ -49,7 +48,7 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:contentDescription="TODO"
|
||||
android:src="@drawable/ico_display" />
|
||||
android:src="@drawable/ico_display"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/secondLine"
|
||||
@ -62,7 +61,7 @@
|
||||
android:singleLine="true"
|
||||
android:text="Description"
|
||||
android:textColor="@color/accent"
|
||||
android:textSize="12sp" />
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/firstLine"
|
||||
@ -76,7 +75,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:text="Example profile"
|
||||
android:textColor="@color/accent"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -1,22 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
android:id="@+id/drawer_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
android:id="@+id/content"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/Container320">
|
||||
<FrameLayout
|
||||
android:layout_width="305dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start">
|
||||
|
||||
<include layout="@layout/drawer_contents" />
|
||||
</LinearLayout>
|
||||
<include layout="@layout/drawer_contents"/>
|
||||
</FrameLayout>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
@ -1,77 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/addrel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/drawer_bg"
|
||||
style="@style/Drawer320">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nv_name"
|
||||
style="@style/TextDrawer320" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/nv_email"
|
||||
style="@style/SpinnertDrawer320" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
style="@style/ViewDrawer320" />
|
||||
android:id="@+id/iv_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nv_name"
|
||||
style="@style/TextDrawer320"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/nv_email"
|
||||
style="@style/SpinnerDrawer320"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
style="@style/ViewDrawer320"/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/search_ll"
|
||||
style="@style/Search320">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginRight="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:alpha="0.75"
|
||||
android:hint="Search"
|
||||
android:inputType="text"
|
||||
style="@style/TextSearch320" />
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/black"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<ImageView style="@style/ViewSearch320" />
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:src="@drawable/search"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/drawer_list"
|
||||
style="@style/List320"
|
||||
tools:listitem="@android:layout/simple_list_item_1"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
tools:listitem="@layout/simple_list_item">
|
||||
|
||||
</ListView>
|
||||
|
||||
<RelativeLayout style="@style/BottomLinks320" android:layout_below="@+id/drawer_list"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/profileManager"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:text="Profile Manager"
|
||||
android:id="@+id/profile_manager"
|
||||
style="@style/Base.TextAppearance.AppCompat.Body2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingStart="32dp"
|
||||
android:text="Profile Manager"
|
||||
android:textAllCaps="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:layout_below="@+id/profileManager"
|
||||
android:text="Settings" />
|
||||
style="@style/Base.TextAppearance.AppCompat.Body2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingStart="32dp"
|
||||
android:text="Settings"
|
||||
android:textAllCaps="true"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/seperator"
|
||||
style="@style/SeparatorBottomLinks320" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:alpha="0.2"
|
||||
android:background="@android:color/black"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/help"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:layout_below="@+id/seperator"
|
||||
android:text="Help" />
|
||||
</RelativeLayout>
|
||||
android:id="@+id/tv_contribute"
|
||||
style="@style/Base.TextAppearance.AppCompat.Body2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/listPreferredItemHeightSmall"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingStart="32dp"
|
||||
android:text="Contribute"
|
||||
android:textAllCaps="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -2,29 +2,26 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.syng.AddProfileFragment">
|
||||
tools:context="io.syng.fragment.AddProfileFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_settings"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/profile_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Name"
|
||||
android:textColor="@color/accent"
|
||||
android:hint="Name" />
|
||||
/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_mode"
|
||||
android:text="@string/account_mode_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -32,17 +29,20 @@
|
||||
|
||||
<Switch
|
||||
android:id="@+id/profile_password_protected"
|
||||
android:text="@string/profile_password_protected"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/profile_password_protected"
|
||||
android:textColor="@color/accent"
|
||||
android:layout_height="wrap_content" />
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/profile_dapps_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_below="@id/profile_settings"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_below="@id/profile_settings"/>
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
81
app/src/main/res/layout/fragment_console.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dynamic_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dynamicContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="60dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ethereum_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1.3"/>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.1"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_ethereum_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="0.4"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_console_log"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.8"
|
||||
android:gravity="bottom"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:scrollbarFadeDuration="0"
|
||||
android:scrollbarSize="25dip"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<com.getbase.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/pink_icon"
|
||||
xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_gravity="bottom|right"
|
||||
fab:fab_colorNormal="@color/primary_dark"
|
||||
fab:fab_colorPressed="#c7343434"
|
||||
fab:fab_icon="@drawable/ic_add_white_24dp"/>
|
||||
</FrameLayout>
|
@ -6,7 +6,7 @@
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="io.syng.ProfileManagerFragment">
|
||||
tools:context="io.syng.fragment.ProfileManagerFragment">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/profile_recycler_view"
|
||||
|
12
app/src/main/res/layout/fragment_web_view.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableWebView
|
||||
android:id="@+id/web_view"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</RelativeLayout>
|
@ -1,91 +0,0 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/ContainerNet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.syng.MainActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rella_lay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/console_log"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:alpha="0.8"
|
||||
android:gravity="bottom"
|
||||
android:paddingTop="51dp"
|
||||
android:scrollbarFadeDuration="0"
|
||||
android:scrollbarSize="25dip"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:scrollbars="vertical"
|
||||
android:text=" "
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="51dp"
|
||||
android:background="@drawable/fill"
|
||||
android:theme="@style/MyToolbar">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ImageButton style="@style/ToolbarButtonWhite" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dynamic_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/myToolbar">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dynamicContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="60dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1.3"
|
||||
android:src="@drawable/ethereum_icon" />
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.1" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="0.4"
|
||||
android:src="@drawable/syngeth_text" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.getbase.floatingactionbutton.FloatingActionButton xmlns:fab="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/pink_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:layout_marginRight="7dp"
|
||||
fab:fab_colorNormal="#ffffff"
|
||||
fab:fab_colorPressed="#e9e9e9"
|
||||
fab:fab_icon="@drawable/add" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,87 +0,0 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="@drawable/bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/ContainerNet">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/Container320">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/addrel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/drawer_bg"
|
||||
style="@style/Drawer320">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nv_name"
|
||||
style="@style/TextDrawer320" />
|
||||
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/nv_email"
|
||||
style="@style/SpinnertDrawer320"
|
||||
android:text="wgergtytu@asfgtdfg.com" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
style="@style/ViewDrawer320" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/search_ll"
|
||||
style="@style/Search320">
|
||||
|
||||
<EditText
|
||||
|
||||
android:id="@+id/search"
|
||||
style="@style/TextSearch320"/>
|
||||
|
||||
<ImageView
|
||||
style="@style/ViewSearch320"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/drawer_list"
|
||||
style="@style/List320"
|
||||
tools:listitem="@android:layout/simple_list_item_1">
|
||||
|
||||
</ListView>
|
||||
|
||||
<RelativeLayout
|
||||
style="@style/BottomLinks320">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:text="SETTINGS" />
|
||||
|
||||
<View
|
||||
android:id="@+id/seperator"
|
||||
style="@style/SeparatorBottomLinks320" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/help"
|
||||
style="@style/TextBottomLinks320"
|
||||
android:layout_below="@+id/seperator"
|
||||
android:text="HELP" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
@ -1,132 +0,0 @@
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/NvDrawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".com.hirak.assistere_doit.do_it_main_screen">
|
||||
|
||||
|
||||
<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">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
style="@style/ToolbarCointainer"
|
||||
android:title="Settings">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableWebView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/myToolbar" />
|
||||
|
||||
<ImageButton
|
||||
style="@style/ToolbarButton" />
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListContainer">
|
||||
|
||||
<TextView
|
||||
style="@style/ListTitle"
|
||||
android:text="Backend" />
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListItem">
|
||||
|
||||
<ImageView
|
||||
style="@style/ListIcon"
|
||||
android:src="@drawable/ico_switch" />
|
||||
|
||||
<Switch
|
||||
style="@style/ListSwitch"
|
||||
android:text="Running Mode"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListItem">
|
||||
|
||||
<ImageView
|
||||
style="@style/ListIcon"
|
||||
android:src="@drawable/ico_port" />
|
||||
|
||||
<Switch
|
||||
style="@style/ListSwitch"
|
||||
android:text="Sync in background"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListItem">
|
||||
|
||||
<ImageView
|
||||
style="@style/ListIcon"
|
||||
android:src="@drawable/ico_switch" />
|
||||
|
||||
<Switch
|
||||
style="@style/ListSwitch"
|
||||
android:text="Sync only on wifi"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/seperator"
|
||||
style="@style/SeparatorList" />
|
||||
|
||||
<TextView
|
||||
style="@style/ListTitle"
|
||||
android:text="Servers" />
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListItem">
|
||||
|
||||
<ImageView
|
||||
style="@style/ListIcon"
|
||||
android:src="@drawable/ico_sound" />
|
||||
|
||||
<Switch
|
||||
style="@style/ListSwitch"
|
||||
android:text="Sound" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListItem">
|
||||
|
||||
<ImageView
|
||||
style="@style/ListIcon"
|
||||
android:src="@drawable/ico_voice" />
|
||||
|
||||
<Switch
|
||||
style="@style/ListSwitch"
|
||||
android:text="Voice" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/ListItem">
|
||||
|
||||
<ImageView
|
||||
style="@style/ListIcon"
|
||||
android:src="@drawable/ico_display" />
|
||||
|
||||
<Switch
|
||||
style="@style/ListSwitch"
|
||||
android:text="Display" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="320dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="#eceff1"
|
||||
android:orientation="vertical">
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
9
app/src/main/res/layout/simple_list_item.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<TextView android:id="@android:id/text1"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingStart="32dp"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"/>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF" style="@style/SpinnertDrawer320">
|
||||
|
||||
</TextView>
|
@ -1,27 +0,0 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.syng.webview">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/myToolbar"
|
||||
style="@style/ToolbarCointainer"
|
||||
android:layout_width="fill_parent"
|
||||
android:background="@color/toolbar"
|
||||
app:title="Trust Davis">
|
||||
|
||||
<ImageButton
|
||||
style="@style/ToolbarIcon"
|
||||
android:src="@drawable/fav" />
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableWebView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/myToolbar" />
|
||||
|
||||
</RelativeLayout>
|
@ -1,6 +0,0 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" android:showAsAction="never" />
|
||||
</menu>
|
@ -1,7 +0,0 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="io.syng.ProfileManagerActivity">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
@ -1,6 +0,0 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools" tools:context="io.syng.Test">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
@ -1,15 +1,14 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".webview">
|
||||
<item android:id="@+id/fav" android:title="Favourite"
|
||||
android:icon="@drawable/fav"
|
||||
android:orderInCategory="100" android:showAsAction="always" />
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".webview">
|
||||
|
||||
<item android:id="@+id/abc" android:title="Lorem ipsem"
|
||||
<item
|
||||
android:id="@+id/fav"
|
||||
android:icon="@drawable/fav"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"/>
|
||||
android:title="Favourite"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
||||
|
||||
|
12
app/src/main/res/values-v14/styles.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<style name="SettingsTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
|
||||
<item name="android:actionBarStyle">@style/ActionBar.V14.Synq.NoTitle</item>
|
||||
</style>
|
||||
|
||||
<style name="ActionBar.V14.Synq.NoTitle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
|
||||
<item name="android:background">@color/primary_dark</item>
|
||||
<item name="android:height">56dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,19 +1,9 @@
|
||||
<resources>
|
||||
|
||||
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- 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 -->
|
||||
<style name="SettingsTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
|
||||
<item name="android:colorPrimary">@color/primary_dark</item>
|
||||
<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:textColorPrimary">@color/accent</item>
|
||||
</style>
|
||||
|
||||
-->
|
||||
<item name="windowActionBar">false</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
</resources>
|
@ -6,8 +6,8 @@
|
||||
<color name="icons">#fafafa</color>
|
||||
<color name="profile">#161c30</color>
|
||||
|
||||
<color name="primary">#ffeeeeee</color>
|
||||
<color name="primary_dark">#ff303030</color>
|
||||
<color name="primary">#e7333333</color>
|
||||
<color name="primary_dark">#303030</color>
|
||||
<color name="accent">#fafafa</color>
|
||||
|
||||
<color name="black_overlay">#66000000</color>
|
||||
|
@ -1,18 +1,10 @@
|
||||
<resources>
|
||||
<string name="app_name">Syng</string>
|
||||
|
||||
<string name="hello_world">Hello world!</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
<string name="drawer_open">Open Navigation Drawer</string>
|
||||
<string name="drawer_close">Close Navigation Drawer</string>
|
||||
<string name="title_activity_profile_manager">ProfileManagerActivity</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="title_activity_test">Test</string>
|
||||
|
||||
|
||||
<string name="add_profile">Add Profile</string>
|
||||
<string name="profile_manager_title">Profiles</string>
|
||||
<string name="profile_save">Save</string>
|
||||
@ -35,4 +27,4 @@
|
||||
|
||||
<string name="request_profile_password">Profile Password</string>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -1,46 +1,22 @@
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme1" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
|
||||
</style>
|
||||
|
||||
<style name="ContainerBG">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_gravity">start</item>
|
||||
<item name="android:background">@drawable/bg</item>
|
||||
<item name="android:background">@drawable/bg1</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<style name="ContainerNet">
|
||||
<item name="android:layout_width">fill_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_gravity">start</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
</style>
|
||||
|
||||
<!-- Container320 -->
|
||||
<style name="Container320">
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textColor">#00FF00</item>
|
||||
<item name="android:typeface">monospace</item>
|
||||
<item name="android:layout_width">320dp</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_gravity">start</item>
|
||||
<item name="android:background">#ffffff</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<!-- Drawer320 -->
|
||||
<style name="Drawer320">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">80dp</item>
|
||||
<item name="android:background">@drawable/drawer</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<style name="TextDrawer320">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
@ -56,7 +32,7 @@
|
||||
<item name="android:shadowRadius">1.2</item>
|
||||
</style>
|
||||
|
||||
<style name="SpinnertDrawer320">
|
||||
<style name="SpinnerDrawer320">
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
@ -84,103 +60,15 @@
|
||||
<item name="android:layout_marginBottom">10dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Search320 -->
|
||||
<style name="Search320">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">40dp</item>
|
||||
<item name="android:layout_below">@+id/drawer_bg</item>
|
||||
<item name="android:layout_marginTop">10dp</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:paddingEnd">10dp</item>
|
||||
<item name="android:paddingRight">10dp</item>
|
||||
<item name="android:layout_marginLeft">20dp</item>
|
||||
<item name="android:layout_marginRight">20dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextSearch320">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_marginLeft">10dp</item>
|
||||
<item name="android:layout_marginStart">10dp</item>
|
||||
<item name="android:alpha">0.75</item>
|
||||
<item name="android:hint">Search</item>
|
||||
<item name="android:textColor">#000000</item>
|
||||
<item name="android:textColorHint">#000000</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:paddingBottom">12dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ViewSearch320">
|
||||
<item name="android:layout_marginEnd">10dp</item>
|
||||
<item name="android:layout_marginRight">10dp</item>
|
||||
<item name="android:layout_marginTop">3dp</item>
|
||||
<item name="android:layout_width">20dp</item>
|
||||
<item name="android:layout_height">25dp</item>
|
||||
<item name="android:layout_alignParentEnd">true</item>
|
||||
<item name="android:layout_alignParentRight">true</item>
|
||||
<item name="android:layout_gravity">center_vertical</item>
|
||||
<item name="android:src">@drawable/search</item>
|
||||
</style>
|
||||
|
||||
<!-- List320 -->
|
||||
<style name="List320">
|
||||
<item name="android:layout_marginLeft">0dp</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_below">@+id/search_ll</item>
|
||||
<item name="android:layout_gravity">start</item>
|
||||
<item name="android:divider">#000000</item>
|
||||
<item name="android:focusableInTouchMode">true</item>
|
||||
<item name="android:choiceMode">multipleChoice</item>
|
||||
<item name="android:paddingLeft">15dp</item>
|
||||
<item name="android:paddingRight">15dp</item>
|
||||
<item name="android:paddingTop">10dp</item>
|
||||
<item name="android:paddingBottom">10dp</item>
|
||||
</style>
|
||||
|
||||
<!-- BottomLinks320 -->
|
||||
<style name="BottomLinks320">
|
||||
<item name="android:layout_marginLeft">0dp</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_alignParentBottom">true</item>
|
||||
<item name="android:paddingLeft">0dp</item>
|
||||
<item name="android:paddingTop">10dp</item>
|
||||
<item name="android:paddingRight">0dp</item>
|
||||
<item name="android:paddingBottom">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextBottomLinks320">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:alpha">0.75</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
<item name="android:paddingLeft">30dp</item>
|
||||
<item name="android:paddingTop">15dp</item>
|
||||
<item name="android:paddingBottom">15dp</item>
|
||||
<item name="android:paddingRight">30dp</item>
|
||||
</style>
|
||||
|
||||
<style name="SeparatorBottomLinks320">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">0.5dp</item>
|
||||
<item name="android:layout_below">@+id/settings</item>
|
||||
<item name="android:layout_marginBottom">5dp</item>
|
||||
<item name="android:layout_marginTop">5dp</item>
|
||||
<item name="android:alpha">0.2</item>
|
||||
<item name="android:background">#000000</item>
|
||||
</style>
|
||||
|
||||
<!-- Toolbar -->
|
||||
<style name="ToolbarCointainer">
|
||||
<item name="android:id">@id/myToolbar</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">51dp</item>
|
||||
<item name="android:theme">@style/MyToolbarWebView</item>
|
||||
<item name="android:layout_alignParentEnd">false</item>
|
||||
</style>
|
||||
|
||||
<style name="ToolbarButton">
|
||||
<item name="android:layout_width">24dp</item>
|
||||
@ -222,7 +110,7 @@
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_alignTop">@+id/webView</item>
|
||||
<item name="android:layout_alignTop">@+id/web_view</item>
|
||||
<item name="android:layout_alignParentLeft">true</item>
|
||||
<item name="android:layout_alignParentStart">true</item>
|
||||
<item name="android:weightSum">1</item>
|
||||
@ -284,7 +172,7 @@
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_alignTop">@+id/webView</item>
|
||||
<item name="android:layout_alignTop">@+id/web_view</item>
|
||||
<item name="android:layout_alignParentLeft">true</item>
|
||||
<item name="android:layout_alignParentStart">true</item>
|
||||
<item name="android:weightSum">1</item>
|
||||
@ -293,16 +181,6 @@
|
||||
<item name="android:paddingRight">15dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ToolbarGreen">
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">60dp</item>
|
||||
<item name="android:theme">@style/MyToolbarWebView</item>
|
||||
<item name="android:layout_alignParentEnd">false</item>
|
||||
<item name="android:paddingLeft">15dp</item>
|
||||
<item name="android:paddingRight">10dp</item>
|
||||
<item name="android:background">#93c54b</item>
|
||||
</style>
|
||||
|
||||
<style name="TextGreen">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
|
@ -1,78 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/ethereum_icon</item>
|
||||
</style>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<!-- darker variant for the status bar and contextual app bars -->
|
||||
<item name="colorPrimary">@color/primary_dark</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||
<!-- theme UI controls like checkboxes and text fields -->
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
|
||||
<item name="actionBarStyle">@style/MyToolbar</item>
|
||||
</style>
|
||||
|
||||
<style name="MyTheme" parent="Theme.AppCompat">
|
||||
<item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
|
||||
<item name="color">#ffffff</item>
|
||||
</style>
|
||||
|
||||
<style name="MyToolbar" parent="@style/ThemeOverlay.AppCompat">
|
||||
<!-- Title text -->
|
||||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
|
||||
<!-- Title color in AppCompat.Light -->
|
||||
<item name="android:textColorPrimaryInverse">@android:color/white</item>
|
||||
|
||||
<!-- Menu text-->
|
||||
<item name="actionMenuTextColor">@android:color/white</item>
|
||||
<!-- Overflow -->
|
||||
<item name="android:textColorSecondary">@android:color/white</item>
|
||||
<!-- This will change drawer icon -->
|
||||
<item name="drawerArrowStyle">@style/WhiteDrawerIconStyle</item>
|
||||
<!-- background of the -->
|
||||
<!-- <item name="android:background">@color/color_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="OverFlow" parent="Widget.AppCompat.ActionButton.Overflow">
|
||||
<item name="android:src">@drawable/overflow</item>
|
||||
</style>
|
||||
|
||||
<style name="MyToolbarWebView" parent="@style/ThemeOverlay.AppCompat">
|
||||
<!-- Title text -->
|
||||
<item name="android:textColorPrimary">#4d4d4d</item>
|
||||
|
||||
<item name="actionOverflowButtonStyle">@style/OverFlow</item>
|
||||
|
||||
<!-- Title color in AppCompat.Light -->
|
||||
<item name="android:textColorPrimaryInverse">@android:color/white</item>
|
||||
|
||||
<!-- Menu text-->
|
||||
<item name="actionMenuTextColor">#4d4d4d</item>
|
||||
<!-- Overflow -->
|
||||
<item name="android:textColorSecondary">@android:color/white</item>
|
||||
<!-- This will change drawer icon -->
|
||||
<item name="drawerArrowStyle">@style/GrayDrawerIconStyle</item>
|
||||
<!-- background of the -->
|
||||
<!-- <item name="android:background">@color/color_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="GrayDrawerIconStyle" parent="Widget.AppCompat.DrawerArrowToggle">
|
||||
<item name="spinBars">true</item>
|
||||
<item name="color">#4f5154</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="WhiteDrawerIconStyle" parent="Widget.AppCompat.DrawerArrowToggle">
|
||||
<item name="spinBars">true</item>
|
||||
<item name="color">@android:color/white</item>
|
||||
<style name="SettingsTheme" parent="AppTheme">
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -5,10 +5,8 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.1.0'
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
include ':app'
|
||||
include ":ethereumj-core"
|
||||
project(':ethereumj-core').projectDir = new File('../ethereumj/ethereumj-core')
|
||||
include ":ethereumj-core-android"
|
||||
project(':ethereumj-core-android').projectDir = new File('../ethereumj/ethereumj-core-android')
|
||||
include ':app'
|