commit 22eccee75b8cc59dab03304f758b23a0db693deb Author: scoute-dich Date: Thu Mar 3 17:46:31 2016 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c6cbe562 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..27df2eec --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Diaspora \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 00000000..96cc43ef --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 00000000..e7bedf33 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 00000000..39139a6c --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..fbb68289 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..b52c2f0c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 00000000..7f68460d --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..6564d52d --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 00000000..0c09c6e6 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + useLibrary 'org.apache.http.legacy' + + defaultConfig { + applicationId "de.baumann.diaspora" + minSdkVersion 15 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.1.1' + compile 'com.android.support:design:23.1.1' + compile 'com.getbase:floatingactionbutton:1.9.1' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 00000000..3d42d48c --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /home/juergen/Android/Sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/de/baumann/diaspora/ApplicationTest.java b/app/src/androidTest/java/de/baumann/diaspora/ApplicationTest.java new file mode 100644 index 00000000..4e7d2ba8 --- /dev/null +++ b/app/src/androidTest/java/de/baumann/diaspora/ApplicationTest.java @@ -0,0 +1,13 @@ +package de.baumann.diaspora; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..aeeebb37 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java b/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java new file mode 100644 index 00000000..1f36ccce --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java @@ -0,0 +1,31 @@ +package de.baumann.diaspora; + +/** + * Created by juergen on 29.02.16. + */ +import android.content.Context; +import android.support.design.widget.CoordinatorLayout; +import android.support.design.widget.Snackbar.SnackbarLayout; +import android.util.AttributeSet; +import android.view.View; + +import com.getbase.floatingactionbutton.FloatingActionButton; +import com.getbase.floatingactionbutton.FloatingActionsMenu; + +public class FloatingActionsMenuBehavior extends CoordinatorLayout.Behavior { + + public FloatingActionsMenuBehavior(Context context, AttributeSet attrs) { + } + + @Override + public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionsMenu child, View dependency) { + return dependency instanceof SnackbarLayout; + } + + @Override + public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionsMenu child, View dependency) { + float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight()); + child.setTranslationY(translationY); + return true; + } +} diff --git a/app/src/main/java/de/baumann/diaspora/MainActivity.java b/app/src/main/java/de/baumann/diaspora/MainActivity.java new file mode 100644 index 00000000..cae3c838 --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/MainActivity.java @@ -0,0 +1,1149 @@ +/* + This file is part of the Diaspora Native WebApp. + + Diaspora Native WebApp is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora Native WebApp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora Native WebApp. + + If not, see . + */ + +package de.baumann.diaspora; + +import android.Manifest; +import android.annotation.SuppressLint; +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Picture; +import android.net.Uri; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.provider.MediaStore; +import android.support.annotation.NonNull; +import android.support.design.widget.NavigationView; +import android.support.design.widget.Snackbar; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.support.v4.widget.SwipeRefreshLayout; +import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.webkit.JavascriptInterface; +import android.webkit.JsResult; +import android.webkit.ValueCallback; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.EditText; +import android.widget.ProgressBar; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.TextView; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import de.baumann.diaspora.utils.Helpers; +import de.baumann.diaspora.utils.PrefManager; + +public class MainActivity extends AppCompatActivity + implements NavigationView.OnNavigationItemSelectedListener { + + + private static final String URL_MESSAGE = "URL_MESSAGE"; + final Handler myHandler = new Handler(); + WebView webView; + static final String TAG = "Diaspora Main"; + String podDomain; + Menu menu; + int notificationCount = 0; + int conversationCount = 0; + ValueCallback mFilePathCallback; + String mCameraPhotoPath; + public static final int INPUT_FILE_REQUEST_CODE = 1; + com.getbase.floatingactionbutton.FloatingActionsMenu fab; + TextView txtTitle; + ProgressBar progressBar; + WebSettings wSettings; + PrefManager pm; + private SwipeRefreshLayout swipeView; + final private int REQUEST_CODE_ASK_PERMISSIONS = 123; + + @SuppressLint("SetJavaScriptEnabled") + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if (android.os.Build.VERSION.SDK_INT >= 21) + WebView.enableSlowWholeDocumentDraw(); + + setContentView(R.layout.activity_main); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( + this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); + drawer.setDrawerListener(toggle); + toggle.syncState(); + + NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); + navigationView.setNavigationItemSelectedListener(this); + + progressBar = (ProgressBar)findViewById(R.id.progressBar); + pm = new PrefManager(MainActivity.this); + + SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); + podDomain = config.getString("podDomain", null); + + fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions); + fab.setVisibility(View.GONE); + + swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe); + swipeView.setColorSchemeResources(R.color.colorPrimary, + R.color.fab_big); + + webView = (WebView)findViewById(R.id.webView); + webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); + webView.addJavascriptInterface(new JavaScriptInterface(), "NotificationCounter"); + + if (savedInstanceState != null) { + webView.restoreState(savedInstanceState); + } + + wSettings = webView.getSettings(); + wSettings.setJavaScriptEnabled(true); + wSettings.setUseWideViewPort(true); + wSettings.setLoadWithOverviewMode(true); + wSettings.setDomStorageEnabled(true); + wSettings.setMinimumFontSize(pm.getMinimumFontSize()); + wSettings.setLoadsImagesAutomatically(pm.getLoadImages()); + + if (android.os.Build.VERSION.SDK_INT >= 21) + wSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + + /* + * WebViewClient + */ + webView.setWebViewClient(new WebViewClient() { + public boolean shouldOverrideUrlLoading(WebView view, String url) { + if (!url.contains(podDomain)) { + Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + startActivity(i); + return true; + } + return false; + } + + public void onPageFinished(WebView view, String url) { + swipeView.setRefreshing(false); + } + }); + + swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + if (Helpers.isOnline(MainActivity.this)) { + webView.reload(); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + swipeView.setRefreshing(false); + } + } + }); + + /* + * WebChromeClient + */ + webView.setWebChromeClient(new WebChromeClient() { + + public void onProgressChanged(WebView wv, int progress) { + progressBar.setProgress(progress); + + if (progress > 0 && progress <= 60) { + Helpers.getNotificationCount(wv); + } + + if (progress > 60) { + Helpers.hideTopBar(wv); + fab.setVisibility(View.VISIBLE); + } + + if (progress == 100) { + fab.collapse(); + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + } + } + + @Override + public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) { + if (mFilePathCallback != null) mFilePathCallback.onReceiveValue(null); + + mFilePathCallback = filePathCallback; + + Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + if (takePictureIntent.resolveActivity(getPackageManager()) != null) { + // Create the File where the photo should go + File photoFile = null; + try { + photoFile = createImageFile(); + takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); + } catch (IOException ex) { + // Error occurred while creating the File + Snackbar.make(swipeView, R.string.image, Snackbar.LENGTH_LONG).show(); + return false; + } + + // Continue only if the File was successfully created + if (photoFile != null) { + mCameraPhotoPath = "file:" + photoFile.getAbsolutePath(); + takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, + Uri.fromFile(photoFile)); + } else { + takePictureIntent = null; + } + } + + Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); + contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); + contentSelectionIntent.setType("image/*"); + + Intent[] intentArray; + if (takePictureIntent != null) { + intentArray = new Intent[]{takePictureIntent}; + } else { + intentArray = new Intent[0]; + } + + Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER); + chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent); + chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser"); + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray); + + startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); + + return true; + } + + public boolean onJsAlert(WebView view, String url, String message, JsResult result) { + return super.onJsAlert(view, url, message, result); + } + }); + + + if (savedInstanceState == null) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadData("", "text/html", null); + webView.loadUrl("https://"+podDomain); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + } + + /* + * Fab button events + */ + + public void fab1_click (View v){ + fab.collapse(); + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/status_messages/new"); + setTitle(R.string.fab1_title); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + public void fab2_click(View v){ + fab.collapse(); + if (Helpers.isOnline(MainActivity.this)) { + final AlertDialog.Builder alert = new AlertDialog.Builder(this); + final EditText input = new EditText(this); + alert.setView(input); + alert.setTitle(R.string.search_alert_title); + alert.setPositiveButton(R.string.search_alert_people, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + String inputTag = input.getText().toString().trim(); + String cleanTag = inputTag.replaceAll("\\*", ""); + // this validate the input data for tagfind + if (cleanTag == null || cleanTag.equals("")) { + dialog.cancel(); // if user don�t have added a tag + Snackbar.make(swipeView, R.string.search_alert_bypeople_validate_needsomedata, Snackbar.LENGTH_LONG).show(); + } else { // User have added a search tag + webView.loadUrl("https://" + podDomain + "/people.mobile?q=" + cleanTag); + setTitle(R.string.fab2_title_person); + } + } + }).setNegativeButton(R.string.search_alert_tag, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + String inputTag = input.getText().toString().trim(); + String cleanTag = inputTag.replaceAll("\\#", ""); + // this validate the input data for tagfind + if (cleanTag == null || cleanTag.equals("")) { + dialog.cancel(); // if user hasn't added a tag + Snackbar.make(swipeView, R.string.search_alert_bytags_validate_needsomedata, Snackbar.LENGTH_LONG).show(); + } else { // User have added a search tag + webView.loadUrl("https://" + podDomain + "/tags/" + cleanTag); + setTitle(R.string.fab2_title_tag); + } + } + }); + alert.show(); + } + else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + public void fab3_click(View v){ + fab.collapse(); + webView.scrollTo(0,0); + } + + private File createImageFile() throws IOException { + // Create an image file name + String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); + String imageFileName = "JPEG_" + timeStamp + "_"; + File storageDir = Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_PICTURES); + return File.createTempFile( + imageFileName, /* prefix */ + ".jpg", /* suffix */ + storageDir /* directory */ + ); + } + + + @Override + public void onActivityResult (int requestCode, int resultCode, Intent data) { + if(requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { + super.onActivityResult(requestCode, resultCode, data); + return; + } + Uri[] results = null; + if(resultCode == Activity.RESULT_OK) { + if(data == null) { + if(mCameraPhotoPath != null) { + results = new Uri[]{Uri.parse(mCameraPhotoPath)}; + } + } else { + String dataString = data.getDataString(); + if (dataString != null) { + results = new Uri[]{Uri.parse(dataString)}; + } + } + } + + mFilePathCallback.onReceiveValue(results); + mFilePathCallback = null; + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + webView.saveState(outState); + } + + @Override + protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) { + super.onRestoreInstanceState(savedInstanceState); + webView.restoreState(savedInstanceState); + } + + @Override + protected void onResume() { + super.onResume(); + registerReceiver(brLoadUrl, new IntentFilter(URL_MESSAGE)); + } + + @Override + public void onBackPressed() { + fab.collapse(); + if (webView.canGoBack()) { + webView.goBack(); + setTitle(R.string.app_name); + Snackbar snackbar = Snackbar + .make(swipeView, R.string.confirm_exit, Snackbar.LENGTH_LONG) + .setAction(R.string.yes, new View.OnClickListener() { + @Override + public void onClick(View view) { + moveTaskToBack(true); + } + }); + snackbar.show(); + } else { + Snackbar snackbar = Snackbar + .make(swipeView, R.string.confirm_exit, Snackbar.LENGTH_LONG) + .setAction(R.string.yes, new View.OnClickListener() { + @Override + public void onClick(View view) { + moveTaskToBack(true); + } + }); + snackbar.show(); + } + } + + private BroadcastReceiver brLoadUrl = new BroadcastReceiver() { + + @Override + public void onReceive(Context context, Intent intent) { + String url = intent.getStringExtra("url"); + txtTitle.setText(R.string.app_name); + webView.loadUrl(url); + } + }; + + @Override + protected void onPause() { + unregisterReceiver(brLoadUrl); + super.onPause(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + this.menu = menu; + MenuItem itemNotification = menu.findItem(R.id.notifications); + if (itemNotification != null) { + if (notificationCount > 0) { + itemNotification.setIcon(R.drawable.ic_bell_ring_white_24dp); + } else { + itemNotification.setIcon(R.drawable.ic_bell_outline_white_24dp); + } + + MenuItem itemConversation = menu.findItem(R.id.conversations); + if (conversationCount > 0) { + itemConversation.setIcon(R.drawable.ic_message_text_white_24dp); + } else { + itemConversation.setIcon(R.drawable.ic_message_text_outline_white_24dp); + } + } + return super.onPrepareOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.notifications) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/notifications"); + setTitle(R.string.jb_notifications); + return true; + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + return false; + } + } + + if (id == R.id.conversations) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/conversations"); + setTitle(R.string.jb_conversations); + return true; + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + return false; + } + } + + if (id == R.id.exit) { + Snackbar snackbar = Snackbar + .make(swipeView, R.string.confirm_exit, Snackbar.LENGTH_LONG) + .setAction(R.string.yes, new View.OnClickListener() { + @Override + public void onClick(View view) { + moveTaskToBack(true); + } + }); + snackbar.show(); + } + + if (id == R.id.help_license) { + final CharSequence[] options = { getString(R.string.help_license), getString(R.string.help_help), getString(R.string.help_donate) }; + new AlertDialog.Builder(MainActivity.this) + .setItems(options, new DialogInterface.OnClickListener() { + + @Override + + public void onClick(DialogInterface dialog, int item) { + + if (options[item].equals(getString(R.string.help_license))) + + { + new AlertDialog.Builder(MainActivity.this) + .setMessage(getString(R.string.about_text)) + .setPositiveButton(getString(R.string.about_yes), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/scoute-dich/Diaspora-Native-WebApp")); + startActivity(i); + dialog.cancel(); + } + }) + .setNegativeButton(getString(R.string.about_no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } + + if (options[item].equals(getString(R.string.help_help))) + + { + new AlertDialog.Builder(MainActivity.this) + .setMessage(getString(R.string.markdown_text)) + .setNegativeButton(getString(R.string.about_no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } + + if (options[item].equals(getString(R.string.help_donate))) + + { + new AlertDialog.Builder(MainActivity.this) + .setMessage(getString(R.string.donate_text)) + .setPositiveButton(getString(R.string.donate_1), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://martinv.tip.me/")); + startActivity(i); + dialog.cancel(); + } + }) + .setNegativeButton(getString(R.string.about_no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } + + } + + }).show(); + } + + if (id == R.id.view) { + final CharSequence[] options = { getString(R.string.settings_font), getString(R.string.settings_view),getString(R.string.settings_image) }; + new AlertDialog.Builder(MainActivity.this) + .setItems(options, new DialogInterface.OnClickListener() { + + @Override + + public void onClick(DialogInterface dialog, int item) { + + if (options[item].equals(getString(R.string.settings_font))) + + { + if (Helpers.isOnline(MainActivity.this)) { + alertFormElements(); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options[item].equals(getString(R.string.settings_view))) + + { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/mobile/toggle"); + } else { // No Internet connection + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options[item].equals(getString(R.string.settings_image))) + + { + if (Helpers.isOnline(MainActivity.this)) { + wSettings.setLoadsImagesAutomatically(!pm.getLoadImages()); + pm.setLoadImages(!pm.getLoadImages()); + webView.loadUrl(webView.getUrl()); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + } + + }).show(); + } + + if (id == R.id.share) { + final CharSequence[] options = { getString(R.string.share_link), getString(R.string.share_screenshot),getString(R.string.take_screenshot) }; + new AlertDialog.Builder(MainActivity.this) + .setItems(options, new DialogInterface.OnClickListener() { + + @Override + + public void onClick(DialogInterface dialog, int item) { + + if (options[item].equals(getString(R.string.share_link))) + + { + Intent sharingIntent = new Intent(Intent.ACTION_SEND); + sharingIntent.setType("image/png"); + sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle()); + sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); + startActivity(Intent.createChooser(sharingIntent, "Share using")); + } + + if (options[item].equals(getString(R.string.share_screenshot))) + + { + if (android.os.Build.VERSION.SDK_INT >= 23) { + int hasWRITE_EXTERNAL_STORAGE = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); + if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) { + if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { + new AlertDialog.Builder(MainActivity.this) + .setMessage(R.string.permissions) + .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (android.os.Build.VERSION.SDK_INT >= 23) + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, + REQUEST_CODE_ASK_PERMISSIONS); + } + }) + .setNegativeButton(getString(R.string.no), null) + .show(); + return; + } + requestPermissions(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, + REQUEST_CODE_ASK_PERMISSIONS); + return; + } + } + + Snackbar.make(swipeView, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show(); + File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"); + if (!directory.exists()) { + directory.mkdirs(); + } + + Date date = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm"); + + Picture picture = webView.capturePicture(); + Bitmap b = Bitmap.createBitmap(picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888); + Canvas c = new Canvas(b); + + File screen = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + + dateFormat.format(date) + ".jpg"); + if (screen.exists()) + screen.delete(); + + picture.draw(c); + + FileOutputStream fos = null; + try { + + fos = new FileOutputStream(screen); + if (fos != null) { + b.compress(Bitmap.CompressFormat.JPEG, 90, fos); + + fos.close(); + } + } catch (Exception e) { + e.getMessage(); + + } + + Intent sharingIntent = new Intent(Intent.ACTION_SEND); + sharingIntent.setType("image/png"); + sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle()); + sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); + Uri bmpUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + + dateFormat.format(date) + ".jpg")); + sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); + startActivity(Intent.createChooser(sharingIntent, "Share using")); + + File file = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + + dateFormat.format(date) + ".jpg"); + Uri uri = Uri.fromFile(file); + Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri); + sendBroadcast(intent); + } + + if (options[item].equals(getString(R.string.take_screenshot))) + + { + if (android.os.Build.VERSION.SDK_INT >= 23) { + int hasWRITE_EXTERNAL_STORAGE = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE); + if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) { + if (!shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { + new AlertDialog.Builder(MainActivity.this) + .setMessage(R.string.permissions) + .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (android.os.Build.VERSION.SDK_INT >= 23) + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, + REQUEST_CODE_ASK_PERMISSIONS); + } + }) + .setNegativeButton(getString(R.string.no), null) + .show(); + return; + } + requestPermissions(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, + REQUEST_CODE_ASK_PERMISSIONS); + return; + } + } + + Snackbar.make(swipeView, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show(); + + File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"); + if (!directory.exists()) { + directory.mkdirs(); + } + + Date date = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm"); + + Picture picture = webView.capturePicture(); + Bitmap b = Bitmap.createBitmap(picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888); + Canvas c = new Canvas(b); + + File screen = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + + dateFormat.format(date) + ".jpg"); + if (screen.exists()) + screen.delete(); + + picture.draw(c); + + FileOutputStream fos = null; + try { + + fos = new FileOutputStream(screen); + if (fos != null) { + b.compress(Bitmap.CompressFormat.JPEG, 90, fos); + + fos.close(); + } + } catch (Exception e) { + e.getMessage(); + + } + + File file = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + + dateFormat.format(date) + ".jpg"); + Uri uri = Uri.fromFile(file); + Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri); + sendBroadcast(intent); + } + + } + + }).show(); + } + return super.onOptionsItemSelected(item); + } + + + + public void alertFormElements() { + + /* + * Inflate the XML view. activity_main is in + * res/layout/form_elements.xml + */ + LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View formElementsView = inflater.inflate(R.layout.font_size_chooser, + null, false); + + final RadioGroup rgFontSize = (RadioGroup) formElementsView + .findViewById(R.id.genderRadioGroup); + + // the alert dialog + new AlertDialog.Builder(MainActivity.this).setView(formElementsView) + .setTitle("Set Font Size") + .setNegativeButton("OK", new DialogInterface.OnClickListener() { + @TargetApi(11) + public void onClick(DialogInterface dialog, int id) { + + int selectedId = rgFontSize + .getCheckedRadioButtonId(); + + // find the radiobutton by returned id + RadioButton selectedRadioButton = (RadioButton) formElementsView + .findViewById(selectedId); + + if (selectedRadioButton.getId() == R.id.radNormal) { + pm.setMinimumFontSize(8); + } else if (selectedRadioButton.getId() == R.id.radLarge) { + pm.setMinimumFontSize(16); + } else if (selectedRadioButton.getId() == R.id.radLarger) { + pm.setMinimumFontSize(20); + } + + wSettings.setMinimumFontSize(pm.getMinimumFontSize()); + + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl(webView.getUrl()); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + dialog.cancel(); + } + }).show(); + } + + public class JavaScriptInterface { + @JavascriptInterface + public void setNotificationCount(final String webMessage){ + myHandler.post(new Runnable() { + @Override + public void run() { + notificationCount = Integer.valueOf(webMessage); + + MenuItem item = menu.findItem(R.id.notifications); + + if (item != null) { + if (notificationCount > 0) { + item.setIcon(R.drawable.ic_bell_ring_white_24dp); + } else { + item.setIcon(R.drawable.ic_bell_outline_white_24dp); + } + } + + + } + }); + } + + @JavascriptInterface + public void setConversationCount(final String webMessage){ + myHandler.post(new Runnable() { + @Override + public void run() { + conversationCount = Integer.valueOf(webMessage); + + MenuItem item = menu.findItem(R.id.conversations); + + if (item != null) { + if (conversationCount > 0) { + item.setIcon(R.drawable.ic_message_text_white_24dp); + } else { + item.setIcon(R.drawable.ic_message_text_outline_white_24dp); + } + } + + } + }); + } + + } + + @SuppressWarnings("StatementWithEmptyBody") + @Override + public boolean onNavigationItemSelected(MenuItem item) { + // Handle navigation view item clicks here. + int id = item.getItemId(); + + if (id == R.id.jb_stream) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/stream"); + setTitle(R.string.jb_stream); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_followed_tags) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/followed_tags"); + setTitle(R.string.jb_followed_tags); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_aspects) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/aspects"); + setTitle(R.string.jb_aspects); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_activities) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/activity"); + setTitle(R.string.jb_activities); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_liked) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/liked"); + setTitle(R.string.jb_liked); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_commented) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/commented"); + setTitle(R.string.jb_commented); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_mentions) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/mentions"); + setTitle(R.string.jb_mentions); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_public) { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/public"); + setTitle(R.string.jb_public); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } else if (id == R.id.jb_settings_view) { + final CharSequence[] options = { getString(R.string.settings_font), getString(R.string.settings_view),getString(R.string.settings_image) }; + new AlertDialog.Builder(MainActivity.this) + .setItems(options, new DialogInterface.OnClickListener() { + + @Override + + public void onClick(DialogInterface dialog, int item) { + + if (options[item].equals(getString(R.string.settings_font))) + + { + if (Helpers.isOnline(MainActivity.this)) { + alertFormElements(); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options[item].equals(getString(R.string.settings_view))) + + { + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/mobile/toggle"); + } else { // No Internet connection + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options[item].equals(getString(R.string.settings_image))) + + { + if (Helpers.isOnline(MainActivity.this)) { + wSettings.setLoadsImagesAutomatically(!pm.getLoadImages()); + pm.setLoadImages(!pm.getLoadImages()); + webView.loadUrl(webView.getUrl()); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + } + + }).show(); + + } else if (id == R.id.jb_settings_diaspora) { + final CharSequence[] options2 = { getString(R.string.jb_settings), getString(R.string.jb_manage_tags), + getString(R.string.jb_contacts), getString(R.string.jb_pod) }; + new AlertDialog.Builder(MainActivity.this) + .setItems(options2, new DialogInterface.OnClickListener() { + + @Override + + public void onClick(DialogInterface dialog, int item) { + + if (options2[item].equals(getString(R.string.jb_settings))) + + { + setTitle(R.string.jb_settings); + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/user/edit"); + } else { // No Internet connection + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options2[item].equals(getString(R.string.jb_manage_tags))) + + { + setTitle(R.string.jb_manage_tags); + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/tag_followings/manage"); + } else { // No Internet connection + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options2[item].equals(getString(R.string.jb_contacts))) + + { + setTitle(R.string.jb_contacts); + if (Helpers.isOnline(MainActivity.this)) { + webView.loadUrl("https://" + podDomain + "/contacts"); + } else { // No Internet connection + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + if (options2[item].equals(getString(R.string.jb_pod))) + + { + if (Helpers.isOnline(MainActivity.this)) { + new AlertDialog.Builder(MainActivity.this) + .setTitle(getString(R.string.confirmation)) + .setMessage(getString(R.string.change_pod_warning)) + .setPositiveButton(getString(R.string.yes), + new DialogInterface.OnClickListener() { + @TargetApi(11) + public void onClick(DialogInterface dialog, int id) { + webView.clearCache(true); + dialog.cancel(); + Intent i = new Intent(MainActivity.this, PodsActivity.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { + @TargetApi(11) + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } else { + Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + } + + }).show(); + + } else if (id == R.id.jb_license_help) { + final CharSequence[] options = { getString(R.string.help_license), getString(R.string.help_help), getString(R.string.help_donate) }; + new AlertDialog.Builder(MainActivity.this) + .setItems(options, new DialogInterface.OnClickListener() { + + @Override + + public void onClick(DialogInterface dialog, int item) { + + if (options[item].equals(getString(R.string.help_license))) + + { + new AlertDialog.Builder(MainActivity.this) + .setTitle(R.string.about_title) + .setMessage(getString(R.string.about_text)) + .setPositiveButton(getString(R.string.about_yes), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/scoute-dich/Diaspora-Native-WebApp")); + startActivity(i); + dialog.cancel(); + } + }) + .setNegativeButton(getString(R.string.about_no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } + + if (options[item].equals(getString(R.string.help_help))) + + { + new AlertDialog.Builder(MainActivity.this) + .setMessage(getString(R.string.markdown_text)) + .setNegativeButton(getString(R.string.about_no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } + + if (options[item].equals(getString(R.string.help_donate))) + + { + new AlertDialog.Builder(MainActivity.this) + .setMessage(getString(R.string.donate_text)) + .setPositiveButton(getString(R.string.donate_1), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://martinv.tip.me/")); + startActivity(i); + dialog.cancel(); + } + }) + .setNegativeButton(getString(R.string.about_no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + } + + } + + }).show(); + } + + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + drawer.closeDrawer(GravityCompat.START); + return true; + } + +} \ No newline at end of file diff --git a/app/src/main/java/de/baumann/diaspora/PodsActivity.java b/app/src/main/java/de/baumann/diaspora/PodsActivity.java new file mode 100644 index 00000000..15340cff --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/PodsActivity.java @@ -0,0 +1,262 @@ +/* + This file is part of the Diaspora Native WebApp. + + Diaspora Native WebApp is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora Native WebApp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora Native WebApp. + + If not, see . + */ + +package de.baumann.diaspora; + +import android.annotation.TargetApi; +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.os.Build; +import android.os.Bundle; +import android.support.design.widget.Snackbar; +import android.support.v7.app.ActionBarActivity; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.webkit.CookieManager; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.Collections; + +import de.baumann.diaspora.services.GetPodsService; +import de.baumann.diaspora.utils.Helpers; + + +public class PodsActivity extends ActionBarActivity { + + BroadcastReceiver podListReceiver; + EditText filter; + ListView lv; + ImageView imgSelectPod; + ProgressDialog progressDialog; + private static final String TAG = "Diaspora Pods"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pods); + + filter = (EditText) findViewById(R.id.edtFilter); + lv = (ListView) findViewById(R.id.lstPods); + lv.setTextFilterEnabled(true); + + imgSelectPod = (ImageView) findViewById(R.id.imgSelectPod); + imgSelectPod.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (filter.getText().length() > 4 && filter.getText().toString().contains(".")) + askConfirmation(filter.getText().toString()); + else + Snackbar.make(lv, R.string.valid_pod, Snackbar.LENGTH_LONG).show(); + } + }); + + podListReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.hasExtra("pods")) { + Bundle extras = intent.getExtras(); + String[] pods = extras.getStringArray("pods"); + + if (progressDialog != null) + progressDialog.dismiss(); + + if (pods != null && pods.length>0) + updateListview(pods); + else { + Snackbar.make(lv, R.string.podlist_error, Snackbar.LENGTH_LONG).show(); + } + } else { + // List of pods empty + } + } + }; + + registerReceiver(podListReceiver, new IntentFilter(GetPodsService.MESSAGE)); + + progressDialog = new ProgressDialog(PodsActivity.this); + progressDialog.setCancelable(false); + progressDialog.setIndeterminate(true); + progressDialog.setMessage(getString(R.string.loading_podlist)); + + if (Helpers.isOnline(PodsActivity.this)) { + progressDialog.show(); + } else { + Snackbar.make(lv, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + + } + + @Override + protected void onResume() { + super.onResume(); + Intent i= new Intent(PodsActivity.this, GetPodsService.class); + startService(i); + } + + + private void updateListview(String[] source) { + final ArrayList podList = new ArrayList<>(); + + for (int i = 0 ; i < source.length ; i++) { + podList.add(source[i].toLowerCase()); + } + Collections.sort(podList); + + final ArrayAdapter adapter = new ArrayAdapter( + PodsActivity.this, + android.R.layout.simple_list_item_1, + podList); + lv.setAdapter(adapter); + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + askConfirmation(((TextView) view).getText().toString()); + } + }); + + adapter.getFilter().filter(filter.getText()); + filter.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + (adapter).getFilter().filter(s.toString()); + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void afterTextChanged(Editable s) { + } + }); + + } + + public void askConfirmation(final String podDomain) { + if (Helpers.isOnline(PodsActivity.this)) { + new AlertDialog.Builder(PodsActivity.this) + .setTitle(getString(R.string.confirmation)) + .setMessage(getString(R.string.confirm_pod)+podDomain+"?") + .setPositiveButton("YES", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + + SharedPreferences sp = getSharedPreferences("PodSettings", MODE_PRIVATE); + SharedPreferences.Editor editor = sp.edit(); + editor.putString("podDomain", podDomain); + editor.apply(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + try { + CookieManager.getInstance().removeAllCookies(null); + CookieManager.getInstance().removeSessionCookies(null); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + try { + CookieManager.getInstance().removeAllCookie(); + CookieManager.getInstance().removeSessionCookie(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + Intent i = new Intent(PodsActivity.this, MainActivity.class); + dialog.cancel(); + startActivity(i); + finish(); + } + }) + .setNegativeButton("NO", new DialogInterface.OnClickListener() { + @TargetApi(11) + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).show(); + + } else { + Snackbar.make(lv, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + } + } + + + @Override + public void onBackPressed() { + Snackbar snackbar = Snackbar + .make(lv, R.string.confirm_exit, Snackbar.LENGTH_LONG) + .setAction(R.string.yes, new View.OnClickListener() { + @Override + public void onClick(View view) { + moveTaskToBack(true); + } + }); + snackbar.show(); + } + + @Override + protected void onDestroy() { + unregisterReceiver(podListReceiver); + super.onDestroy(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_pods, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.reload) { + if (Helpers.isOnline(PodsActivity.this)) { + progressDialog.show(); + Intent i= new Intent(PodsActivity.this, GetPodsService.class); + startService(i); + return true; + } else { + Snackbar.make(lv, R.string.no_internet, Snackbar.LENGTH_LONG).show(); + return false; + } + } + + return super.onOptionsItemSelected(item); + } + + +} + + diff --git a/app/src/main/java/de/baumann/diaspora/ShareActivity.java b/app/src/main/java/de/baumann/diaspora/ShareActivity.java new file mode 100644 index 00000000..553f2502 --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/ShareActivity.java @@ -0,0 +1,307 @@ +/* + This file is part of the Diaspora Native WebApp. + + Diaspora Native WebApp is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora Native WebApp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora Native WebApp. + + If not, see . + */ + +package de.baumann.diaspora; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.content.Intent; +import android.content.SharedPreferences; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.provider.MediaStore; +import android.support.design.widget.Snackbar; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.webkit.JsResult; +import android.webkit.ValueCallback; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; +import android.widget.TextView; + +import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import de.baumann.diaspora.utils.Helpers; + + +public class ShareActivity extends MainActivity { + + private WebView webView; + private static final String TAG = "Diaspora Share"; + private String podDomain; + private ValueCallback mFilePathCallback; + private String mCameraPhotoPath; + private com.getbase.floatingactionbutton.FloatingActionsMenu fab; + private TextView txtTitle; + private ProgressBar progressBar; + + @SuppressLint("SetJavaScriptEnabled") + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + progressBar = (ProgressBar)findViewById(R.id.progressBar); + + txtTitle.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (Helpers.isOnline(ShareActivity.this)) { + txtTitle.setText(R.string.jb_stream); + Intent i = new Intent(ShareActivity.this, MainActivity.class); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + finish(); + } else { + Snackbar.make(v, R.string.no_internet, Snackbar.LENGTH_SHORT).show(); + } + } + }); + + + SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); + podDomain = config.getString("podDomain", null); + + fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions); + fab.setVisibility(View.GONE); + + webView = (WebView)findViewById(R.id.webView); + webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); + + WebSettings wSettings = webView.getSettings(); + wSettings.setJavaScriptEnabled(true); + wSettings.setBuiltInZoomControls(true); + + if (Build.VERSION.SDK_INT >= 21) + wSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + + /* + * WebViewClient + */ + webView.setWebViewClient(new WebViewClient() { + public boolean shouldOverrideUrlLoading(WebView view, String url) { + Log.d(TAG, url); + if (!url.contains(podDomain)) { + Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + startActivity(i); + return true; + } + return false; + + } + + public void onPageFinished(WebView view, String url) { + Log.i(TAG, "Finished loading URL: " + url); + } + + public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { + Log.e(TAG, "Error: " + description); + + new AlertDialog.Builder(ShareActivity.this) + .setIcon(android.R.drawable.ic_dialog_alert) + .setMessage(description) + .setPositiveButton("CLOSE", null) + .show(); + } + }); + + + /* + * WebChromeClient + */ + webView.setWebChromeClient(new WebChromeClient() { + + public void onProgressChanged(WebView wv, int progress) { + progressBar.setProgress(progress); + + if (progress > 0 && progress <= 60) { + Helpers.getNotificationCount(wv); + } + + if (progress > 60) { + Helpers.hideTopBar(wv); + } + + if (progress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + } + } + + @Override + public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) { + if (mFilePathCallback != null) mFilePathCallback.onReceiveValue(null); + + mFilePathCallback = filePathCallback; + + Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + if (takePictureIntent.resolveActivity(getPackageManager()) != null) { + // Create the File where the photo should go + File photoFile = null; + try { + photoFile = createImageFile(); + takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); + } catch (IOException ex) { + // Error occurred while creating the File + Snackbar.make(getWindow().findViewById(R.id.drawer_layout), "Unable to get image", Snackbar.LENGTH_SHORT).show(); + } + + // Continue only if the File was successfully created + if (photoFile != null) { + mCameraPhotoPath = "file:" + photoFile.getAbsolutePath(); + takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, + Uri.fromFile(photoFile)); + } else { + takePictureIntent = null; + } + } + + Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); + contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); + contentSelectionIntent.setType("image/*"); + + Intent[] intentArray; + if (takePictureIntent != null) { + intentArray = new Intent[]{takePictureIntent}; + } else { + intentArray = new Intent[0]; + } + + Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER); + chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent); + chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser"); + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray); + + startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); + + return true; + } + + public boolean onJsAlert(WebView view, String url, String message, JsResult result) { + return super.onJsAlert(view, url, message, result); + } + }); + + + + + Intent intent = getIntent(); + final Bundle extras = intent.getExtras(); + String action = intent.getAction(); + + if (Intent.ACTION_SEND.equals(action)) { + webView.setWebViewClient(new WebViewClient() { + + public void onPageFinished(WebView view, String url) { + + if (extras.containsKey(Intent.EXTRA_TEXT) && extras.containsKey(Intent.EXTRA_SUBJECT)) { + final String extraText = (String) extras.get(Intent.EXTRA_TEXT); + final String extraSubject = (String) extras.get(Intent.EXTRA_SUBJECT); + + webView.setWebViewClient(new WebViewClient() { + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + + finish(); + + Snackbar.make(webView, R.string.please_reload, Snackbar.LENGTH_LONG).show(); + + Intent i = new Intent(ShareActivity.this, MainActivity.class); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(i); + + return false; + } + }); + + webView.loadUrl("javascript:(function() { " + + "document.getElementsByTagName('textarea')[0].style.height='110px'; " + + "document.getElementsByTagName('textarea')[0].innerHTML = '[" + extraSubject + "](" + extraText + ") #ViaDiasporaNativeWebApp'; " + + " if(document.getElementById(\"main_nav\")) {" + + " document.getElementById(\"main_nav\").parentNode.removeChild(" + + " document.getElementById(\"main_nav\"));" + + " } else if (document.getElementById(\"main-nav\")) {" + + " document.getElementById(\"main-nav\").parentNode.removeChild(" + + " document.getElementById(\"main-nav\"));" + + " }" + + "})();"); + + } + } + }); + } + + if (savedInstanceState == null) { + if (Helpers.isOnline(ShareActivity.this)) { + webView.loadUrl("https://"+podDomain+"/status_messages/new"); + } else { + Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); + } + } + + } + + private File createImageFile() throws IOException { + String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); + String imageFileName = "JPEG_" + timeStamp + "_"; + File storageDir = Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_PICTURES); + return File.createTempFile( + imageFileName, /* prefix */ + ".jpg", /* suffix */ + storageDir /* directory */ + ); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_compose, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.reload) { + if (Helpers.isOnline(ShareActivity.this)) { + webView.reload(); + return true; + } else { + Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); + return false; + } + } + + return super.onOptionsItemSelected(item); + } + +} diff --git a/app/src/main/java/de/baumann/diaspora/SplashActivity.java b/app/src/main/java/de/baumann/diaspora/SplashActivity.java new file mode 100644 index 00000000..7bb03d09 --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/SplashActivity.java @@ -0,0 +1,71 @@ +/* + This file is part of the Diaspora Native WebApp. + + Diaspora Native WebApp is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora Native WebApp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora Native WebApp. + + If not, see . + */ + +package de.baumann.diaspora; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.TypedArray; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.WindowManager; +import android.widget.ImageView; + +import java.util.Timer; +import java.util.TimerTask; + + +public class SplashActivity extends AppCompatActivity { + + ImageView imgSplash; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + setContentView(R.layout.activity_splash); + + imgSplash = (ImageView) findViewById(R.id.imgSplash); + + TypedArray images = getResources().obtainTypedArray(R.array.splash_images); + int choice = (int) (Math.random() * images.length()); + imgSplash.setImageResource(images.getResourceId(choice, R.drawable.splashscreen1)); + images.recycle(); + + final SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); + + Timer timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + Intent i; + if (config.getString("podDomain", null) != null) { + i = new Intent(SplashActivity.this, MainActivity.class); + } else { + i = new Intent(SplashActivity.this, PodsActivity.class); + } + startActivity(i); + finish(); + } + }, 2000); + + } + +} diff --git a/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java b/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java new file mode 100644 index 00000000..6a0ab86c --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java @@ -0,0 +1,139 @@ +/* + This file is part of the Diaspora Native WebApp. + + Diaspora Native WebApp is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora Native WebApp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora Native WebApp. + + If not, see . + */ + +package de.baumann.diaspora.services; + +import android.app.Service; +import android.content.Intent; +import android.os.AsyncTask; +import android.os.IBinder; +import android.util.Log; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.StatusLine; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +public class GetPodsService extends Service { + public static final String MESSAGE = "de.baumann.diaspora.podsreceived"; + + private static final String TAG = "Diaspora Pod Service"; + + public GetPodsService() { } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + getPods(); + return super.onStartCommand(intent, flags, startId); + } + + private void getPods() { + /* + * Most of the code in this AsyncTask is from the file getPodlistTask.java + * from the app "Diaspora Webclient". + * A few modifications and adaptations were made by me. + * Source: + * https://github.com/voidcode/Diaspora-Webclient/blob/master/src/com/voidcode/diasporawebclient/getPodlistTask.java + * Thanks to Terkel Sørensen + */ + AsyncTask getPodsAsync = new AsyncTask() { + @Override + protected String[] doInBackground(Void... params) { + + // TODO: Update deprecated code + + StringBuilder builder = new StringBuilder(); + HttpClient client = new DefaultHttpClient(); + List list = null; + try { + HttpGet httpGet = new HttpGet("http://podupti.me/api.php?key=4r45tg&format=json"); + HttpResponse response = client.execute(httpGet); + StatusLine statusLine = response.getStatusLine(); + int statusCode = statusLine.getStatusCode(); + if (statusCode == 200) { + HttpEntity entity = response.getEntity(); + InputStream content = entity.getContent(); + BufferedReader reader = new BufferedReader( + new InputStreamReader(content)); + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + } + } else { + //TODO Notify User about failure + Log.e(TAG, "Failed to download list of pods"); + } + } catch (IOException e) { + //TODO handle json buggy feed + e.printStackTrace(); + } + //Parse the JSON Data + try { + JSONObject j = new JSONObject(builder.toString()); + JSONArray jr = j.getJSONArray("pods"); + Log.d(TAG, "Number of entries " + jr.length()); + list = new ArrayList(); + for (int i = 0; i < jr.length(); i++) { + JSONObject jo = jr.getJSONObject(i); + Log.d(TAG, jo.getString("domain")); + String secure = jo.getString("secure"); + if (secure.equals("true")) + list.add(jo.getString("domain")); + } + + } catch (Exception e) { + //TODO Handle Parsing errors here + e.printStackTrace(); + } + if (list != null) + return list.toArray(new String[list.size()]); + else + return null; + } + + @Override + protected void onPostExecute(String[] strings) { + Intent broadcastIntent = new Intent(MESSAGE); + if (strings != null) + broadcastIntent.putExtra("pods", strings); + sendBroadcast(broadcastIntent); + stopSelf(); + } + }; + getPodsAsync.execute(); + } + + @Override + public IBinder onBind(Intent intent) { + // TODO: Return the communication channel to the service. + throw new UnsupportedOperationException("Not yet implemented"); + } + +} diff --git a/app/src/main/java/de/baumann/diaspora/utils/Helpers.java b/app/src/main/java/de/baumann/diaspora/utils/Helpers.java new file mode 100644 index 00000000..489cefc3 --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/utils/Helpers.java @@ -0,0 +1,64 @@ +/* + This file is part of the Diaspora Native WebApp. + + Diaspora Native WebApp is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora Native WebApp is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora Native WebApp. + + If not, see . + */ + +package de.baumann.diaspora.utils; + + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.webkit.WebView; + +public class Helpers { + + public static boolean isOnline(Context context){ + ConnectivityManager cnm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo ni = cnm.getActiveNetworkInfo(); + return ni != null && ni.isConnectedOrConnecting(); + } + + public static void hideTopBar(WebView wv) { + wv.loadUrl("javascript: ( function() {" + + " if(document.getElementById('main_nav')) {" + + " document.getElementById('main_nav').parentNode.removeChild(" + + " document.getElementById('main_nav'));" + + " } else if (document.getElementById('main-nav')) {" + + " document.getElementById('main-nav').parentNode.removeChild(" + + " document.getElementById('main-nav'));" + + " }" + + "})();"); + } + + public static void getNotificationCount(WebView wv) { + wv.loadUrl("javascript: ( function() {" + + " if (document.getElementById('notification')) {" + + " var count = document.getElementById('notification').innerHTML;" + + " NotificationCounter.setNotificationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" + + " } else {" + + " NotificationCounter.setNotificationCount('0');" + + " }" + + " if (document.getElementById('conversation')) {" + + " var count = document.getElementById('conversation').innerHTML;" + + " NotificationCounter.setConversationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" + + " } else {" + + " NotificationCounter.setConversationCount('0');" + + " }" + + "})();"); + } +} diff --git a/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java b/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java new file mode 100644 index 00000000..9cceb3e3 --- /dev/null +++ b/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java @@ -0,0 +1,52 @@ +package de.baumann.diaspora.utils; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.preference.PreferenceManager; + +public class PrefManager { + + private final Context context; + private boolean loadImages = true; + private int minimumFontSize = 0; + + public PrefManager(Context ctx) { + SharedPreferences sp = null; + this.context = ctx; + try { + sp = PreferenceManager.getDefaultSharedPreferences(context); + } catch (Exception e) { + e.printStackTrace(); + } + + if (sp != null) { + loadImages = sp.getBoolean("loadImages", true); + minimumFontSize = sp.getInt("minimumFontSize", 8); + } + } + + public boolean getLoadImages() { + return loadImages; + } + + public void setLoadImages(boolean loadImages) { + this.loadImages = loadImages; + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + Editor edit = sp.edit(); + edit.putBoolean("loadImages", loadImages); + edit.commit(); + } + + public int getMinimumFontSize() { + return minimumFontSize; + } + + public void setMinimumFontSize(int minimumFontSize) { + this.minimumFontSize = minimumFontSize; + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + Editor edit = sp.edit(); + edit.putInt("minimumFontSize", minimumFontSize); + edit.commit(); + } +} diff --git a/app/src/main/res/drawable-hdpi/ic_bell_outline_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_bell_outline_white_24dp.png new file mode 100644 index 00000000..b53dde90 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_bell_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_bell_ring_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_bell_ring_white_24dp.png new file mode 100644 index 00000000..9cc1f069 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_bell_ring_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 00000000..d212a834 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_message_text_outline_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_message_text_outline_white_24dp.png new file mode 100644 index 00000000..610aa130 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_message_text_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_message_text_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_message_text_white_24dp.png new file mode 100644 index 00000000..a086bcbb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_message_text_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_sync_white_24dp.png new file mode 100644 index 00000000..013d1c2a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_bell_outline_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_bell_outline_white_24dp.png new file mode 100644 index 00000000..0d4b0a1d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_bell_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_bell_ring_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_bell_ring_white_24dp.png new file mode 100644 index 00000000..56001f7b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_bell_ring_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 00000000..d212a834 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_message_text_outline_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_message_text_outline_white_24dp.png new file mode 100644 index 00000000..576b5274 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_message_text_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_message_text_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_message_text_white_24dp.png new file mode 100644 index 00000000..aee3a1ce Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_message_text_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.png new file mode 100644 index 00000000..91770671 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_bell_outline_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_bell_outline_white_24dp.png new file mode 100644 index 00000000..657e69d8 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_bell_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_bell_ring_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_bell_ring_white_24dp.png new file mode 100644 index 00000000..be2a70e0 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_bell_ring_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 00000000..d212a834 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_message_text_outline_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_message_text_outline_white_24dp.png new file mode 100644 index 00000000..d66b733a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_message_text_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_message_text_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_message_text_white_24dp.png new file mode 100644 index 00000000..5155a77a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_message_text_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png new file mode 100644 index 00000000..01a969d5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_bell_outline_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_bell_outline_white_24dp.png new file mode 100644 index 00000000..069bb3e5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_bell_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_bell_ring_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_bell_ring_white_24dp.png new file mode 100644 index 00000000..cdb2c24f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_bell_ring_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..d212a834 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_message_text_outline_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_message_text_outline_white_24dp.png new file mode 100644 index 00000000..9fcb8682 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_message_text_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_message_text_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_message_text_white_24dp.png new file mode 100644 index 00000000..1d3d19e7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_message_text_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png new file mode 100644 index 00000000..9b0836da Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_bell_outline_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_bell_outline_white_24dp.png new file mode 100644 index 00000000..2756e2ae Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_bell_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_bell_ring_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_bell_ring_white_24dp.png new file mode 100644 index 00000000..7ed1a2f2 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_bell_ring_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..d212a834 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_message_text_outline_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_message_text_outline_white_24dp.png new file mode 100644 index 00000000..26a10423 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_message_text_outline_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_message_text_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_message_text_white_24dp.png new file mode 100644 index 00000000..3fd53a5a Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_message_text_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_sync_white_24dp.png new file mode 100644 index 00000000..73cf22ca Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable/fab_compose.png b/app/src/main/res/drawable/fab_compose.png new file mode 100644 index 00000000..5ef731b4 Binary files /dev/null and b/app/src/main/res/drawable/fab_compose.png differ diff --git a/app/src/main/res/drawable/fab_label_background.xml b/app/src/main/res/drawable/fab_label_background.xml new file mode 100644 index 00000000..83f55c97 --- /dev/null +++ b/app/src/main/res/drawable/fab_label_background.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/fab_search.png b/app/src/main/res/drawable/fab_search.png new file mode 100644 index 00000000..78f32f75 Binary files /dev/null and b/app/src/main/res/drawable/fab_search.png differ diff --git a/app/src/main/res/drawable/fab_top.png b/app/src/main/res/drawable/fab_top.png new file mode 100644 index 00000000..402daf58 Binary files /dev/null and b/app/src/main/res/drawable/fab_top.png differ diff --git a/app/src/main/res/drawable/header.jpg b/app/src/main/res/drawable/header.jpg new file mode 100644 index 00000000..915e324c Binary files /dev/null and b/app/src/main/res/drawable/header.jpg differ diff --git a/app/src/main/res/drawable/jb_activities.png b/app/src/main/res/drawable/jb_activities.png new file mode 100644 index 00000000..f4f7d131 Binary files /dev/null and b/app/src/main/res/drawable/jb_activities.png differ diff --git a/app/src/main/res/drawable/jb_aspects.png b/app/src/main/res/drawable/jb_aspects.png new file mode 100644 index 00000000..1f2b3a4f Binary files /dev/null and b/app/src/main/res/drawable/jb_aspects.png differ diff --git a/app/src/main/res/drawable/jb_commented.png b/app/src/main/res/drawable/jb_commented.png new file mode 100644 index 00000000..64f27b0b Binary files /dev/null and b/app/src/main/res/drawable/jb_commented.png differ diff --git a/app/src/main/res/drawable/jb_heart.png b/app/src/main/res/drawable/jb_heart.png new file mode 100644 index 00000000..ea9685e3 Binary files /dev/null and b/app/src/main/res/drawable/jb_heart.png differ diff --git a/app/src/main/res/drawable/jb_license.png b/app/src/main/res/drawable/jb_license.png new file mode 100644 index 00000000..b552a1c7 Binary files /dev/null and b/app/src/main/res/drawable/jb_license.png differ diff --git a/app/src/main/res/drawable/jb_mentions.png b/app/src/main/res/drawable/jb_mentions.png new file mode 100644 index 00000000..726393c0 Binary files /dev/null and b/app/src/main/res/drawable/jb_mentions.png differ diff --git a/app/src/main/res/drawable/jb_settings.png b/app/src/main/res/drawable/jb_settings.png new file mode 100644 index 00000000..9d65f2a1 Binary files /dev/null and b/app/src/main/res/drawable/jb_settings.png differ diff --git a/app/src/main/res/drawable/jb_stream.png b/app/src/main/res/drawable/jb_stream.png new file mode 100644 index 00000000..a5586dbd Binary files /dev/null and b/app/src/main/res/drawable/jb_stream.png differ diff --git a/app/src/main/res/drawable/jb_tag2.png b/app/src/main/res/drawable/jb_tag2.png new file mode 100644 index 00000000..c8711117 Binary files /dev/null and b/app/src/main/res/drawable/jb_tag2.png differ diff --git a/app/src/main/res/drawable/splashscreen1.jpg b/app/src/main/res/drawable/splashscreen1.jpg new file mode 100644 index 00000000..bd2f04d6 Binary files /dev/null and b/app/src/main/res/drawable/splashscreen1.jpg differ diff --git a/app/src/main/res/drawable/splashscreen2.jpg b/app/src/main/res/drawable/splashscreen2.jpg new file mode 100644 index 00000000..2be7268d Binary files /dev/null and b/app/src/main/res/drawable/splashscreen2.jpg differ diff --git a/app/src/main/res/drawable/splashscreen3.jpg b/app/src/main/res/drawable/splashscreen3.jpg new file mode 100644 index 00000000..8f1a8997 Binary files /dev/null and b/app/src/main/res/drawable/splashscreen3.jpg differ diff --git a/app/src/main/res/drawable/splashscreen4.jpg b/app/src/main/res/drawable/splashscreen4.jpg new file mode 100644 index 00000000..77ef17d6 Binary files /dev/null and b/app/src/main/res/drawable/splashscreen4.jpg differ diff --git a/app/src/main/res/drawable/splashscreen5.jpg b/app/src/main/res/drawable/splashscreen5.jpg new file mode 100644 index 00000000..e1128818 Binary files /dev/null and b/app/src/main/res/drawable/splashscreen5.jpg differ diff --git a/app/src/main/res/drawable/splashscreen6.jpg b/app/src/main/res/drawable/splashscreen6.jpg new file mode 100644 index 00000000..6f97fa4c Binary files /dev/null and b/app/src/main/res/drawable/splashscreen6.jpg differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..a61d8a63 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/app/src/main/res/layout/activity_pods.xml b/app/src/main/res/layout/activity_pods.xml new file mode 100644 index 00000000..5e10d409 --- /dev/null +++ b/app/src/main/res/layout/activity_pods.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml new file mode 100644 index 00000000..7d4c9e9a --- /dev/null +++ b/app/src/main/res/layout/activity_splash.xml @@ -0,0 +1,16 @@ + + + + diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml new file mode 100644 index 00000000..b82ae34f --- /dev/null +++ b/app/src/main/res/layout/app_bar_main.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml new file mode 100644 index 00000000..b7591b66 --- /dev/null +++ b/app/src/main/res/layout/content_main.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/font_size_chooser.xml b/app/src/main/res/layout/font_size_chooser.xml new file mode 100644 index 00000000..a5217a0a --- /dev/null +++ b/app/src/main/res/layout/font_size_chooser.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml new file mode 100644 index 00000000..81140fb1 --- /dev/null +++ b/app/src/main/res/layout/nav_header_main.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml new file mode 100644 index 00000000..8d15fa2c --- /dev/null +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_compose.xml b/app/src/main/res/menu/menu_compose.xml new file mode 100644 index 00000000..bf90ed68 --- /dev/null +++ b/app/src/main/res/menu/menu_compose.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml new file mode 100644 index 00000000..819d986d --- /dev/null +++ b/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_pods.xml b/app/src/main/res/menu/menu_pods.xml new file mode 100644 index 00000000..44943da0 --- /dev/null +++ b/app/src/main/res/menu/menu_pods.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/mipmap-hdpi/ic_arrow_right_grey600_24dp.png b/app/src/main/res/mipmap-hdpi/ic_arrow_right_grey600_24dp.png new file mode 100644 index 00000000..65248d20 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_arrow_right_grey600_24dp.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_arrow_right_grey600_24dp.png b/app/src/main/res/mipmap-mdpi/ic_arrow_right_grey600_24dp.png new file mode 100644 index 00000000..dd79fff4 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_arrow_right_grey600_24dp.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_arrow_right_grey600_24dp.png b/app/src/main/res/mipmap-xhdpi/ic_arrow_right_grey600_24dp.png new file mode 100644 index 00000000..d2fd86fa Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_arrow_right_grey600_24dp.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_arrow_right_grey600_24dp.png b/app/src/main/res/mipmap-xxhdpi/ic_arrow_right_grey600_24dp.png new file mode 100644 index 00000000..7f3a9f19 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_arrow_right_grey600_24dp.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_arrow_right_grey600_24dp.png b/app/src/main/res/mipmap-xxxhdpi/ic_arrow_right_grey600_24dp.png new file mode 100644 index 00000000..fd116d1c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_arrow_right_grey600_24dp.png differ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml new file mode 100644 index 00000000..eda8f3d6 --- /dev/null +++ b/app/src/main/res/values-de/strings.xml @@ -0,0 +1,144 @@ + + + Neu laden + Pod auswählen + Pod-Domain eingeben + App beenden + Pod-Adresse bestätigen + Anmerkung: Auf dieser Liste finden sich nur Einträge von podupti.me + Bitte einen gültigen Domain-Namen (URL) eingeben + Fehler: Konnte die Podliste nicht abfragen! + Podliste wird geladen... + Entschuldigung, du musst mit dem Internet verbunden sein um fortzufahren. + Bestätigung + Willst du folgenden Pod benutzen: + Möchtest du die App verlassen? + JA + NEIN + Das wird alle Cookies und Session-Daten löschen. Willst du wirklich den Pod wechseln? + + Du musst der App Zugriff auf den Gerätespeicher gewähren, damit das Bildschirmfoto + gespeichert werden kann. Danach solltest du die Anwendung komplett schließen oder das Telefon neu starten. + Wenn du den Zugriff verweigerst und die Funktion später doch nutzen willst, kannst du die Berechtigung + nachträglich erteilen. Öffne dafür: Systemeinstellungen - Apps - Wetter. Im Bereich Berechtigungen kannst + dann die entsprechende Einstellung vornehmen. + + // Drawer and App + + Einstellungen + Stream + Benachrichtigungen + Unterhaltungen + Gelikete Beiträge + Kommentierte Beiträge + Kontakte + Erwähnungen + Meine Aktivitäten + Verfolgte Tags + Tags verwalten + Persönliche Einstellungen + Meine Aspekte + Pod wechseln + Öffentliche Aktivitäten + + // Floating Action Buttons - Titles + + Nach oben scrollen + Suche nach Tags oder Personen ... + Neuer Beitrag + + Suche + nach Tags + nach Personen + Füge einen Namen ein. + Versuche einen Tag wie: #neuhier oder #kunst + + //Dialog + + + //Dialog + Unterhaltungen + Neuer Beitrag + Benachrichtigungen + Schriftgröße ändern + Bilder laden umschalten + Ansicht wechseln + Bitte den Stream neu laden. + normal + groß + riesig + Konnte Bild nicht laden ... + Inhalt Teilen + Link als Text teilen + Bildschirmfoto teilen + Bildschirmfoto machen + Bildschirmfoto wird gespeichert... + Diaspora Einstellungen + Ansichtseinstellungen + OK + Markdown Formatierung + Lizenz + Lizenz | Hilfe | Spende + "Auf Diaspora* ist es möglich, dass du deinen Text in Nachrichten, Kommentaren und Unterhaltungen formatierst, indem du ein vereinfachtes Mark-Up-System namens Markdown verwendest. Diese Seite stellt eine kurze Einleitung dar, um grundlegende Formatierungen anwenden zu können.\n\n + + Überschriften\n + # das ist eine sehr große Überschrift\n + ## halb so groß wie die oben drüber\n + ### doppelt so groß wie normaler Text\n\n + + Kursiv und fett\n + Kursiv: *Wort* oder _Wort_\n + Fett: **Wort** oder __Wort__\n + Fett kursiv: ***Wort*** oder ___Wort___\n\n + + Aufzählung\n + *, + oder - vor jeder Linie die du als Teil der Aufzählung haben willst oder 1., 2., usw. vor jedem Aufzählungspunkt.\n\n + + Zitat\n + Wenn du einen Teil eines Artikels oder eines anderen Kommentares zitieren willst, kannst du deinen Text bequem formatieren, indem du die Zeile oder den Abschnitt mit einem > Zeichen beginnst.\n\n + + Horizontale Linie\n + Um eine horizontale Linie zu erstellen benutzt du mindestens drei - - -, _ _ _ oder * * * in einer separaten Linie. Jede größere Anzahl bewirkt dasselbe und Leerzeichen zwischen den Zeichen stören nicht.\n\n + + Inline Link\n + [displayed text here](http://link.address.here \"alt text\") Der 'alt text' ist optional, und zeigt einen Tool-Tip, wenn der Curser sich über den Link bewegt.\n\n + + Externe Bilder\n + ![Alt text](http://website.com/image.jpg \"optional title\") Der 'alt text' in der eckigen Klammer wird angezeigt, wenn das Bild nicht geladen werden kann. Der optionale Titel zeigt einen Tool-Tip, wenn der Curser sich über den Link bewegt. Beides ist nützlich aber nicht nötig.\n\n + + Escape\n + Wenn du in deiner Nachricht ein Zeichen benutzen willst, das ebenfalls zur Markdownformatierung verwendet wird, kannst du verhindern, dass es von Markdown als Formatcode gelesen wird, indem du es 'escapest'. Um dies zu tun, musst du einen Backslash vor das Zeichen setzen. Du kannst trotzdem 'diaspora*' oder 'D*' schreiben, ohne dass das Sternchen als formatierender Code gelesen wird!\n\n + + Sonderzeichen\n + Du kannst Symbole und Sonderzeichen nutzen, indem du bestimmte Zeichenfolgen verwendest. Z.B.:\n + (c) = © ; (r) = ® ; x^2 = x²" + Besuche die Projektseite auf GitHub + Zuerst einmal: ich bin kein Entwickler. Ich verstehe ein paar Grundlagen, aber das Meiste meiner + Arbeit ist mit \"Copy and Paste\" passiert. Diese App ist ein Fork der original \"DiasporaNativeWebApp\" + von \"martinchodev\" (der die allermeiste Arbeit erledigt hat -> mein großer Dank gilt ihm), welche unter der GPL-Lizenz + veröffentlicht wurde.\n\n + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.\n\n + + Die Bilder des Startbildschirms können auf Flickr gefunden werden: + https://www.flickr.com/photos/129581906@N06/sets/72157651933980136/with/16594947123/. + Sie wurden von \"Lydia\" veröffentlicht und stehen unter der cc by-nc-sa Lizenz. + Suche nach Personen ... + Suche nach Tags ... + per Bitcoin + Wenn dir die App gefällt, kannst du dem Entwickler der original \"DiasporaNativeWebApp\" + eine Kleinigkeit spenden: + Spenden + Startbildschirm + diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml new file mode 100644 index 00000000..251fb9fb --- /dev/null +++ b/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,9 @@ +> + + + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 00000000..63fc8164 --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/app/src/main/res/values-w820dp/strings.xml b/app/src/main/res/values-w820dp/strings.xml new file mode 100644 index 00000000..03fdcf71 --- /dev/null +++ b/app/src/main/res/values-w820dp/strings.xml @@ -0,0 +1,21 @@ + + Diaspora Native WebApp + Reload + Select Pod + Enter pod domain + Exit app + Confirm pod url + Diaspora + Note: This list is populated with only the secure pods from podupti.me + Please enter a valid domain name + Error: Could not retrieve list of pods! + Loading pod list ... + Sorry, you must be connected to the Internet to proceed + Confirmation + Do you want to use the pod: + Are you sure you want to exit? + YES + NO + This will erase all cookies and session data. Do you really want to change pods? + New post + diff --git a/app/src/main/res/values/color.xml b/app/src/main/res/values/color.xml new file mode 100644 index 00000000..b4ade840 --- /dev/null +++ b/app/src/main/res/values/color.xml @@ -0,0 +1,17 @@ + + + #607d8b + #607d8b + #ff9800 + + #ff9800 + #ffb74d + + #607d8b + #90a4ae + + #99212121 + #ffffff + + #ffffff + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000..05cdb953 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,8 @@ + + + 16dp + 160dp + + 16dp + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..32acf2ba --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,166 @@ + + + //Application + + Open navigation drawer + Close navigation drawer + Diaspora + Reload + You must grant \"Access Storage Permission\" to save screenshots. After that you should + completely close the app or restart the phone. If you don\'t permit the storage access but want to use the + screenshot function at a later time, you can grant the permission later. Please open then: systemsettings - apps - + weather. In the permissions section you can grant the \"write storage permission\". + + //Pod Activity + + Select Pod + Enter pod domain + Confirm pod url + Note: This list is populated with only the secure pods from podupti.me + Please enter a valid domain name + Error: Could not retrieve list of pods! + Loading pod list ... + + + Sorry, you must be connected to the Internet to proceed + Confirmation + Do you want to use the pod: + Do you want to exit? + YES + NO + This will erase all cookies and session data. Do you really want to change pods? + New + Notifications + Conversations + + // Drawer and App + + The community-run distributed social network + Settings + License | Help | Donate + Stream + Notifications + Conversations + Liked + Commented + Contacts + Mentions + My activity + Followed Hashtags + Manage Hashtags + Personal settings + My aspects + Change pod + Public activities + View settings + Diaspora settings + Share content + + Change font size + Toggle image loading + Change view + Share link as text + Share screenshot of webpage + Take screenshot of webpage + + License + Markdown formating + Donate + + Taking screenshot ... + + + // Floating Action Buttons - Titles + + Go to top + Search by tags or persons + Search for tag ... + Search for person ... + New message + + + Search + by tags + by people + Please add a name + Try to add a tag like: #newhere or #art + + //Dialog //License + + "On diaspora* it's possible to format your text in status messages, comments and conversations using a simplified mark-up system called Markdown. This page gives an introduction to the codes used to create this formatting.\n\n + + Heading\n + # This is an extremely large header\n + ## Half as big as the one above\n + ### Twice the size of normal text\n\n + + Italics and bold\n + Italics: *word* or _word_\n + Bold: **word** or __word__\n + Bold italics: ***word*** or ___word___\n\n + + Bulleted list\n + *, + or - in front of each line you want as part of the list or 1., 2., etc. in front of the list items\n\n + + Quotation\n + When you want to quote an extract of an article or another comment, you can conveniently format your text by starting the line or the paragraph by the > character\n\n + + Horizontal line\n + To create a horizontal line, use at least three - - -, _ _ _ or * * * on a separate line. Any number above three will do the same thing and spaces between the characters do not matter.\n\n + + Inline link\n + [displayed text here](http://link.address.here \"alt text\") The 'alt text' is optional, and is displayed as a tool-tip when the cursor is moved over the link.\n\n + + External images\n + ![Alt text](http://website.com/image.jpg \"optional title\") The alternative text in the square brackets is displayed if the image cannot be loaded, and the optional title is displayed as a tool-tip when the cursor is moved over the image; both are useful but not essential.\n\n + + Escape\n + If you want your message to include a character which is also used in Markdown coding, you can prevent it from being read by Markdown as a formatting code by 'escaping' it. To do this, place a backslash in front of the character. You can, however, type 'diaspora*' or 'D*' without the asterisk becoming a formatting code!\n\n + + Special characters\n + You can create the following symbols and other special characters using a combination of characters:\n + (c) = © ; (r) = ® ; x^2 = x²" + + If you like the app fell free to donate to the devoloper of the original \"DiasporaNativeWebApp\": + Via Bitcoin + + Visit projectsite on Github + OK + Copyright © 2016 by scoute-dich + First of all: I am not a developer. I understand a few basics and most of my work is done + by copy and paste. This app is a fork of the original \"DiasporaNativeWebApp\" + from \"martinchodev\" (who did most of the work -> big thanks to him), which is released under the GPL-license.\n\n + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses/.\n\n + + The splashscreen images can be found on flickr: https://www.flickr.com/photos/129581906@N06/sets/72157651933980136/with/16594947123/. + They were published by \"Lydia\" and are licensed under cc by-nc-sa. + + Splash screen + Please reload the stream + Normal + Large + Huge + + Unable to get image + + + @drawable/splashscreen1 + @drawable/splashscreen2 + @drawable/splashscreen3 + @drawable/splashscreen4 + @drawable/splashscreen5 + @drawable/splashscreen6 + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..f5182805 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,25 @@ + + + + + + + + + + diff --git a/app/src/test/java/de/baumann/diaspora/ExampleUnitTest.java b/app/src/test/java/de/baumann/diaspora/ExampleUnitTest.java new file mode 100644 index 00000000..807b065f --- /dev/null +++ b/app/src/test/java/de/baumann/diaspora/ExampleUnitTest.java @@ -0,0 +1,15 @@ +package de.baumann.diaspora; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * To work on unit tests, switch the Test Artifact in the Build Variants view. + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..e0b366a7 --- /dev/null +++ b/build.gradle @@ -0,0 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..1d3591c8 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..05ef575b Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..f23df6e4 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Oct 21 11:34:03 PDT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..9d82f789 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..e7b4def4 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'