Many improvements
- Use linearadapter for syndicate-to - Fix problem when finding url in text - Rewrite WebSignin in Kotlin - Cleanup bookmark interface
|
@ -1,4 +1,5 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
|
@ -43,7 +44,7 @@ dependencies {
|
|||
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
|
||||
testImplementation 'com.squareup.okhttp3:mockwebserver:3.9.1';
|
||||
testImplementation "org.robolectric:robolectric:3.7.1"
|
||||
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
// Logging
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
|
||||
// ViewModel and LiveData
|
||||
|
@ -58,5 +59,11 @@ dependencies {
|
|||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
||||
|
||||
compile 'com.android.support:support-annotations:22.2.0'
|
||||
implementation 'com.android.support:support-annotations:27.0.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
||||
|
||||
implementation "io.reactivex.rxjava2:rxjava:2.1.12"
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_logo_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -21,7 +22,6 @@ import android.widget.Toast;
|
|||
import eu.stuifzand.micropub.client.Client;
|
||||
import eu.stuifzand.micropub.client.Post;
|
||||
import eu.stuifzand.micropub.databinding.ActivityBookmarkBinding;
|
||||
import eu.stuifzand.micropub.databinding.ContentBookmarkBinding;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
public class BookmarkActivity extends AppCompatActivity {
|
||||
|
@ -36,14 +36,39 @@ public class BookmarkActivity extends AppCompatActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActivityBookmarkBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_bookmark);
|
||||
|
||||
postModel = ViewModelProviders.of(BookmarkActivity.this).get(PostViewModel.class);
|
||||
client = ViewModelProviders.of(BookmarkActivity.this).get(Client.class);
|
||||
|
||||
binding.setViewModel(postModel);
|
||||
binding.setClient(client);
|
||||
// contentBinding.setViewModel(postModel);
|
||||
// contentBinding.setClient(client);
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
Log.i("micropub", intent.toString());
|
||||
String urlOrNote = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
if (urlOrNote != null) {
|
||||
HttpUrl url = HttpUrl.parse(urlOrNote);
|
||||
if (url != null) {
|
||||
postModel.bookmarkOf.set(urlOrNote);
|
||||
} else {
|
||||
postModel.findBookmarkOf(urlOrNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
accountManager = AccountManager.get(this);
|
||||
|
||||
AccountManager am = AccountManager.get(this);
|
||||
Bundle options = new Bundle();
|
||||
|
||||
postModel = ViewModelProviders.of(BookmarkActivity.this).get(PostViewModel.class);
|
||||
client = ViewModelProviders.of(BookmarkActivity.this).get(Client.class);
|
||||
|
||||
TokenReady callback = (accountType, accountName, token) -> {
|
||||
Account[] accounts = accountManager.getAccountsByType(accountType);
|
||||
if (accounts.length == 0)
|
||||
|
@ -73,14 +98,6 @@ public class BookmarkActivity extends AppCompatActivity {
|
|||
Snackbar.make(coordinator, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
client.getMediaResponse().observe(BookmarkActivity.this, response -> {
|
||||
Log.i("micropub", "media response received " + response.isSuccess());
|
||||
if (response.isSuccess()) {
|
||||
postModel.setPhoto(response.getUrl());
|
||||
Toast.makeText(BookmarkActivity.this, "Photo upload succesful, photo url filled", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
AuthError onError = (msg) -> {
|
||||
|
@ -100,30 +117,6 @@ public class BookmarkActivity extends AppCompatActivity {
|
|||
new OnTokenAcquired(this, callback, onError),
|
||||
null
|
||||
);
|
||||
|
||||
// setContentView(R.layout.activity_main);
|
||||
ActivityBookmarkBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_bookmark);
|
||||
ContentBookmarkBinding contentBinding = DataBindingUtil.setContentView(this, R.layout.content_bookmark);
|
||||
|
||||
binding.setViewModel(postModel);
|
||||
binding.setClient(client);
|
||||
contentBinding.setViewModel(postModel);
|
||||
contentBinding.setClient(client);
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
Log.i("micropub", intent.toString());
|
||||
String urlOrNote = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
if (urlOrNote != null) {
|
||||
HttpUrl url = HttpUrl.parse(urlOrNote);
|
||||
if (url != null) {
|
||||
postModel.bookmarkOf.set(urlOrNote);
|
||||
} else {
|
||||
postModel.findBookmarkOf(urlOrNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
109
app/src/main/java/eu/stuifzand/micropub/LinearAdapter.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
package eu.stuifzand.micropub;
|
||||
|
||||
import android.content.Context;
|
||||
import android.databinding.BindingAdapter;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.databinding.ObservableList;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Formatter;
|
||||
|
||||
import eu.stuifzand.micropub.client.Syndication;
|
||||
import eu.stuifzand.micropub.databinding.ListItemBinding;
|
||||
|
||||
public class LinearAdapter extends ObservableList.OnListChangedCallback<ObservableArrayList<Syndication>> {
|
||||
private final LayoutInflater inflater;
|
||||
private final Handler uiHandler;
|
||||
private LinearLayout view;
|
||||
|
||||
public LinearAdapter(LinearLayout l) {
|
||||
view = l;
|
||||
inflater = (LayoutInflater) view.getContext()
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
uiHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(ObservableArrayList<Syndication> syndications) {
|
||||
//updateList(syndications);
|
||||
Formatter formatter = new Formatter();
|
||||
formatter.format("onChanged");
|
||||
Log.i("micropub", formatter.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableArrayList<Syndication> syndications, int f, int n) {
|
||||
int l = view.getChildCount();
|
||||
|
||||
uiHandler.post(() -> {
|
||||
for (int i = 0; i < n; i++) {
|
||||
Log.i("micropub", "onItemRangeChanged f=" + f + " n=" + n + " l=" + l);
|
||||
ListItemBinding binding = null;
|
||||
if (f + i < l) {
|
||||
Log.i("micropub", "onItemRangeChanged convert: f+i=" + f + i);
|
||||
View convertView = view.getChildAt(f + i);
|
||||
binding = DataBindingUtil.bind(convertView);
|
||||
} else {
|
||||
Log.i("micropub", "onItemRangeChanged new: f+i=" + f + i);
|
||||
binding = DataBindingUtil.inflate(inflater, R.layout.list_item, view, false);
|
||||
view.addView(binding.getRoot(), f + i);
|
||||
}
|
||||
binding.setInfo(syndications.get(f + i));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableArrayList<Syndication> syndications, int f, int n) {
|
||||
|
||||
int l = view.getChildCount();
|
||||
|
||||
uiHandler.post(() -> {
|
||||
Log.i("micropub", "onItemRangeInserted: f=" + f + " n=" + n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
Log.i("micropub", "onItemRangeInserted new: f+i=" + f + i);
|
||||
{
|
||||
ListItemBinding binding = null;
|
||||
binding = DataBindingUtil.inflate(inflater, R.layout.list_item, view, false);
|
||||
binding.setInfo(syndications.get(f + i));
|
||||
view.addView(binding.getRoot(), f + i >= l ? -1 : f + i);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableArrayList<Syndication> syndications, int f, int f2, int n) {
|
||||
Formatter formatter = new Formatter();
|
||||
formatter.format("onItemRangeMoved: %d, %d, %d", f, f2, n);
|
||||
Log.i("micropub", formatter.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableArrayList<Syndication> syndications, int f, int n) {
|
||||
uiHandler.post(() -> {
|
||||
view.removeViews(f, n);
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateList(ObservableArrayList<Syndication> list) {
|
||||
for (Syndication s : list) {
|
||||
ListItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.list_item, view, false);
|
||||
binding.setInfo(s);
|
||||
view.addView(binding.getRoot());
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("app:multipleItems")
|
||||
public static void bindList(LinearLayout view, ObservableArrayList<Syndication> list) {
|
||||
assert list != null;
|
||||
list.addOnListChangedCallback(new LinearAdapter(view));
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.databinding.BindingAdapter;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.provider.ContactsContract;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -42,10 +43,15 @@ public class ListAdapter extends BaseAdapter {
|
|||
inflater = (LayoutInflater) parent.getContext()
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
ListItemBinding binding = null;
|
||||
|
||||
if (convertView == null) {
|
||||
binding = DataBindingUtil.inflate(inflater, R.layout.list_item, parent, false);
|
||||
} else {
|
||||
binding = DataBindingUtil.bind(convertView);
|
||||
}
|
||||
|
||||
ListItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.list_item, parent, false);
|
||||
binding.setInfo(list.get(position));
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,18 +3,15 @@ package eu.stuifzand.micropub;
|
|||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Activity;
|
||||
import android.app.Notification;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.media.session.MediaSession;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.view.menu.ActionMenuItemView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
|
@ -28,9 +25,9 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import eu.stuifzand.micropub.databinding.ActivityMainBinding;
|
||||
import eu.stuifzand.micropub.client.Client;
|
||||
import eu.stuifzand.micropub.client.Post;
|
||||
import eu.stuifzand.micropub.databinding.ActivityMainBinding;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
import static eu.stuifzand.micropub.utils.IOUtils.getBytes;
|
||||
|
@ -45,9 +42,14 @@ public class MainActivity extends AppCompatActivity {
|
|||
private Client client;
|
||||
private PostViewModel postModel;
|
||||
|
||||
private ActionMenuItemView actionSend;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
accountManager = AccountManager.get(this);
|
||||
|
||||
AccountManager am = AccountManager.get(this);
|
||||
|
@ -119,7 +121,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
binding.setViewModel(postModel);
|
||||
binding.setClient(client);
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.stuifzand.micropub;
|
||||
|
||||
import android.arch.lifecycle.MutableLiveData;
|
||||
import android.arch.lifecycle.ViewModel;
|
||||
import android.databinding.ObservableArrayList;
|
||||
import android.databinding.ObservableField;
|
||||
|
@ -16,9 +17,9 @@ import okhttp3.HttpUrl;
|
|||
|
||||
public class PostViewModel extends ViewModel {
|
||||
private static final Pattern urlPattern = Pattern.compile(
|
||||
"(?:^|[\\W])((ht|f)tp(s?):\\/\\/|www\\.)"
|
||||
"(?:^|[\\W])(((ht|f)tp(s?):\\/\\/|www\\.)"
|
||||
+ "(([\\w\\-]+\\.){1,}?([\\w\\-.~]+\\/?)*"
|
||||
+ "[\\p{Alnum}.,%_=?&#\\-+()\\[\\]\\*$~@!:/{};']*)",
|
||||
+ "[\\p{Alnum}.,%_=?&#\\-+()\\[\\]\\*$~@!:/{};']*))",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
|
||||
public final ObservableField<String> name = new ObservableField<>();
|
||||
|
@ -71,7 +72,12 @@ public class PostViewModel extends ViewModel {
|
|||
public void findBookmarkOf(String urlOrNote) {
|
||||
Matcher matcher = urlPattern.matcher(urlOrNote);
|
||||
if (matcher.find()) {
|
||||
bookmarkOf.set(matcher.group(1));
|
||||
String url = matcher.group(1);
|
||||
bookmarkOf.set(url);
|
||||
String s = urlOrNote.replaceFirst(urlPattern.pattern(), "");
|
||||
this.name.set(s);
|
||||
} else {
|
||||
this.content.set(urlOrNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,5 +24,4 @@ public class AuthenticatorService extends Service {
|
|||
public IBinder onBind(Intent intent) {
|
||||
return authenticator.getIBinder();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
package eu.stuifzand.micropub.auth;
|
||||
|
||||
import android.accounts.AccountAuthenticatorResponse;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import eu.stuifzand.micropub.R;
|
||||
|
||||
|
||||
public class WebSigninActivity extends AppCompatActivity {
|
||||
|
||||
public static final int AUTHENTICATION_REQUEST = 14;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_web_signin);
|
||||
}
|
||||
|
||||
public void startWebsignin(View view) {
|
||||
EditText profileUrl = (EditText) findViewById(R.id.profileUrl);
|
||||
String url = profileUrl.getText().toString();
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
url = "https://" + url;
|
||||
}
|
||||
Intent intent = getIntent();
|
||||
AccountAuthenticatorResponse parcelable = intent.getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
|
||||
new WebsigninTask(this, parcelable).execute(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == AUTHENTICATION_REQUEST) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package eu.stuifzand.micropub.auth
|
||||
|
||||
import android.accounts.AccountAuthenticatorResponse
|
||||
import android.accounts.AccountManager
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.view.View
|
||||
import eu.stuifzand.micropub.R
|
||||
import kotlinx.android.synthetic.main.activity_web_signin.*
|
||||
|
||||
const val AUTHENTICATION_REQUEST = 14;
|
||||
|
||||
class WebSigninActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_web_signin)
|
||||
}
|
||||
|
||||
fun startWebsignin(view : View) {
|
||||
val url = profileUrl.text.toString();
|
||||
val me = if (!url.matches(Regex.fromLiteral("^https?://"))) "https://$url" else url
|
||||
val parcelable = intent.getParcelableExtra<AccountAuthenticatorResponse>(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
|
||||
WebsigninTask(this, parcelable).execute(me);
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == AUTHENTICATION_REQUEST) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,9 +25,11 @@ import java.util.regex.Pattern;
|
|||
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
import static eu.stuifzand.micropub.auth.WebSigninActivityKt.AUTHENTICATION_REQUEST;
|
||||
|
||||
|
||||
public class WebsigninTask extends AsyncTask<String, Void, Bundle> {
|
||||
public static final String ME = "eu.stuifzand.micropub.ME";
|
||||
static final String ME = "eu.stuifzand.micropub.ME";
|
||||
protected AccountAuthenticatorResponse response;
|
||||
protected Activity activity;
|
||||
|
||||
|
@ -118,6 +120,6 @@ public class WebsigninTask extends AsyncTask<String, Void, Bundle> {
|
|||
intent.putExtras(bundle);
|
||||
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
|
||||
|
||||
this.activity.startActivityForResult(intent, WebSigninActivity.AUTHENTICATION_REQUEST);
|
||||
this.activity.startActivityForResult(intent, AUTHENTICATION_REQUEST);
|
||||
}
|
||||
}
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_send_blue.png
Normal file
After Width: | Height: | Size: 295 B |
BIN
app/src/main/res/drawable-hdpi/ic_send_disabled.png
Normal file
After Width: | Height: | Size: 306 B |
BIN
app/src/main/res/drawable-hdpi/ic_send_primary.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
app/src/main/res/drawable-mdpi/ic_send_blue.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
app/src/main/res/drawable-mdpi/ic_send_disabled.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
app/src/main/res/drawable-mdpi/ic_send_primary.png
Normal file
After Width: | Height: | Size: 257 B |
BIN
app/src/main/res/drawable-xhdpi/ic_send_blue.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
app/src/main/res/drawable-xhdpi/ic_send_disabled.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
app/src/main/res/drawable-xhdpi/ic_send_primary.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_send_blue.png
Normal file
After Width: | Height: | Size: 513 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_send_disabled.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_send_primary.png
Normal file
After Width: | Height: | Size: 492 B |
|
@ -1,9 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="eu.stuifzand.micropub.BookmarkActivity">
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
|
@ -15,8 +14,11 @@
|
|||
</data>
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
tools:context="eu.stuifzand.micropub.BookmarkActivity"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -32,14 +34,14 @@
|
|||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_bookmark" />
|
||||
<include
|
||||
layout="@layout/content_bookmark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:client="@{client}"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:layout_editor_absoluteY="-4dp" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</layout>
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
android:id="@+id/coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="eu.stuifzand.micropub.MainActivity">
|
||||
tools:context="eu.stuifzand.micropub.MainActivity"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -35,13 +36,12 @@
|
|||
|
||||
<include
|
||||
layout="@layout/content_main"
|
||||
android:layout_height="607dp"
|
||||
app:viewModel="@{viewModel}"
|
||||
app:client="@{client}"
|
||||
tools:layout_editor_absoluteY="-4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:client="@{client}"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
/>
|
||||
app:viewModel="@{viewModel}"
|
||||
tools:layout_editor_absoluteY="-4dp" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</layout>
|
|
@ -14,145 +14,162 @@
|
|||
type="eu.stuifzand.micropub.client.Client" />
|
||||
</data>
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/coordinator"
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView_bookmark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="eu.stuifzand.micropub.BookmarkActivity"
|
||||
tools:showIn="@layout/activity_bookmark">
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/editBookmarkOfTextLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/contentLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="574dp"
|
||||
android:overScrollMode="always"
|
||||
android:paddingTop="8dp"
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editBookmarkOfText"
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/editBookmarkOfTextLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Bookmark of"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewModel.bookmarkOf}" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editNameLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="spread_inside">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/contentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/content"
|
||||
app:counterEnabled="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editNameLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/editBookmarkOfTextLayout">
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editBookmarkOfText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Bookmark of"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewModel.bookmarkOf}" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100sp"
|
||||
android:ems="10"
|
||||
android:gravity="top"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine|textCapSentences|textAutoComplete"
|
||||
android:lines="5"
|
||||
android:nextFocusForward="@id/editCategory"
|
||||
android:scrollbars="vertical"
|
||||
android:text="@={viewModel.content}"
|
||||
tools:layout_editor_absoluteY="101dp" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/editNameLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/name"
|
||||
app:counterEnabled="false"
|
||||
app:layout_constraintBottom_toTopOf="@+id/listLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/contentLayout">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56sp"
|
||||
android:ems="10"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textAutoComplete|textUri"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:nextFocusForward="@id/content"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewModel.name}"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editInReplyToLayout" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/editCategoryLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/categories"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/listLayout">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editCategory"
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/contentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewModel.category}" />
|
||||
android:layout_marginBottom="8dp"
|
||||
android:hint="@string/content"
|
||||
app:counterEnabled="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editCategoryLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editNameLayout">
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100sp"
|
||||
android:ems="10"
|
||||
android:gravity="top"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine|textCapSentences|textAutoComplete"
|
||||
android:lines="5"
|
||||
android:nextFocusForward="@id/editCategory"
|
||||
android:scrollbars="vertical"
|
||||
android:text="@={viewModel.content}"
|
||||
tools:layout_editor_absoluteY="101dp" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top|fill"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editCategoryLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editNameLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/syndication"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listSyndication"
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/editNameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="69dp"
|
||||
android:isScrollContainer="false"
|
||||
app:list="@{client.syndicates}" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/name"
|
||||
app:counterEnabled="false"
|
||||
app:layout_constraintBottom_toTopOf="@+id/contentLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editBookmarkOfTextLayout">
|
||||
|
||||
</LinearLayout>
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56sp"
|
||||
android:ems="10"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textAutoComplete|textUri"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:nextFocusForward="@id/content"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewModel.name}"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editInReplyToLayout" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="top|fill"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editCategoryLayout"
|
||||
tools:layout_editor_absoluteX="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/syndication"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listSyndication"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:multipleItems="@{client.syndicates}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/editCategoryLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/categories"
|
||||
app:layout_constraintTop_toBottomOf="@+id/contentLayout"
|
||||
tools:layout_editor_absoluteX="0dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editCategory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewModel.category}" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</layout>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="eu.stuifzand.micropub.PostViewModel" />
|
||||
|
@ -17,13 +18,7 @@
|
|||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
android:fillViewport="true"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
tools:context="eu.stuifzand.micropub.MainActivity"
|
||||
tools:showIn="@layout/activity_main">
|
||||
|
||||
|
@ -34,7 +29,7 @@
|
|||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="617dp"
|
||||
android:overScrollMode="always"
|
||||
android:paddingTop="8dp"
|
||||
android:scrollbars="vertical">
|
||||
|
@ -44,8 +39,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/in_reply_to"
|
||||
app:layout_constraintBottom_toTopOf="@+id/contentLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
@ -71,19 +67,21 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:hint="@string/content"
|
||||
app:counterEnabled="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editCategoryLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editInReplyToLayout">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:gravity="top"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine|textCapSentences|textAutoComplete"
|
||||
android:lines="5"
|
||||
android:lines="10"
|
||||
android:nextFocusForward="@id/editCategory"
|
||||
android:scrollbars="vertical"
|
||||
android:text="@={viewModel.content}"
|
||||
|
@ -95,9 +93,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/categories"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editPhotoLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/contentLayout">
|
||||
app:layout_constraintTop_toBottomOf="@+id/contentLayout">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editCategory"
|
||||
|
@ -119,9 +119,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="top|fill"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/contentLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/editCategoryLayout">
|
||||
app:layout_constraintTop_toBottomOf="@+id/editPhotoLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
|
@ -148,9 +150,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:hint="Photo url"
|
||||
app:layout_constraintBottom_toTopOf="@+id/listLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/listLayout">
|
||||
app:layout_constraintTop_toBottomOf="@+id/editCategoryLayout">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/editPhoto"
|
||||
|
@ -165,7 +169,14 @@
|
|||
android:text="@={viewModel.photo}" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</layout>
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="info"
|
||||
type="eu.stuifzand.micropub.client.Syndication" />
|
||||
|
@ -11,14 +12,13 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/enabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="@={info.checked}"
|
||||
android:text="@{info.name}"
|
||||
/>
|
||||
android:text="@{info.name}" />
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -19,7 +19,7 @@
|
|||
<item
|
||||
android:id="@+id/action_send"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_send"
|
||||
android:icon="@drawable/ic_send_primary"
|
||||
android:orderInCategory="10"
|
||||
android:title="@string/action_send"
|
||||
app:showAsAction="always" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
|
@ -13,7 +13,9 @@
|
|||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package eu.stuifzand.micropub;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
public class PostViewModelTest {
|
||||
private static final Pattern urlPattern = Pattern.compile(
|
||||
"(?:^|[\\W])(((ht|f)tp(s?):\\/\\/|www\\.)"
|
||||
+ "(([\\w\\-]+\\.){1,}?([\\w\\-.~]+\\/?)*"
|
||||
+ "[\\p{Alnum}.,%_=?&#\\-+()\\[\\]\\*$~@!:/{};']*))",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
|
||||
@Test
|
||||
public void parseUrl() {
|
||||
String text = "HELLO WORLD: https://medium.com/@abangkis/architecture-components-livedata-and-fusedlocationprovider-de46580d0481 and text after";
|
||||
String url = "https://medium.com/@abangkis/architecture-components-livedata-and-fusedlocationprovider-de46580d0481";
|
||||
|
||||
Matcher matcher = urlPattern.matcher(text);
|
||||
assertTrue(matcher.find());
|
||||
String group = matcher.group(1);
|
||||
assertEquals(url, group);
|
||||
}
|
||||
}
|
|
@ -1,14 +1,15 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
ext.kotlin_version = '1.2.31'
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
|
||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sun Feb 18 19:57:52 CET 2018
|
||||
#Tue Mar 27 07:29:19 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
|
|