From 81b095667d7c226601db23cc2d1d41a05e1efaaa Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Wed, 11 Apr 2018 00:22:59 +0200 Subject: [PATCH] Many improvements - Use linearadapter for syndicate-to - Fix problem when finding url in text - Rewrite WebSignin in Kotlin - Cleanup bookmark interface --- app/build.gradle | 11 +- app/src/main/AndroidManifest.xml | 3 +- .../stuifzand/micropub/BookmarkActivity.java | 65 ++--- .../eu/stuifzand/micropub/LinearAdapter.java | 109 ++++++++ .../eu/stuifzand/micropub/ListAdapter.java | 10 +- .../eu/stuifzand/micropub/MainActivity.java | 14 +- .../eu/stuifzand/micropub/PostViewModel.java | 12 +- .../micropub/auth/AuthenticatorService.java | 1 - .../micropub/auth/WebSigninActivity.java | 43 --- .../micropub/auth/WebSigninActivity.kt | 36 +++ .../micropub/auth/WebsigninTask.java | 6 +- .../main/res/drawable-hdpi/ic_send_blue.png | Bin 0 -> 295 bytes .../res/drawable-hdpi/ic_send_disabled.png | Bin 0 -> 306 bytes .../res/drawable-hdpi/ic_send_primary.png | Bin 0 -> 339 bytes .../main/res/drawable-mdpi/ic_send_blue.png | Bin 0 -> 221 bytes .../res/drawable-mdpi/ic_send_disabled.png | Bin 0 -> 235 bytes .../res/drawable-mdpi/ic_send_primary.png | Bin 0 -> 257 bytes .../main/res/drawable-xhdpi/ic_send_blue.png | Bin 0 -> 345 bytes .../res/drawable-xhdpi/ic_send_disabled.png | Bin 0 -> 364 bytes .../res/drawable-xhdpi/ic_send_primary.png | Bin 0 -> 379 bytes .../main/res/drawable-xxhdpi/ic_send_blue.png | Bin 0 -> 513 bytes .../res/drawable-xxhdpi/ic_send_disabled.png | Bin 0 -> 446 bytes .../res/drawable-xxhdpi/ic_send_primary.png | Bin 0 -> 492 bytes app/src/main/res/layout/activity_bookmark.xml | 28 +- app/src/main/res/layout/activity_main.xml | 12 +- app/src/main/res/layout/content_bookmark.xml | 259 ++++++++++-------- app/src/main/res/layout/content_main.xml | 37 ++- app/src/main/res/layout/list_item.xml | 6 +- app/src/main/res/menu/menu_main.xml | 2 +- app/src/main/res/values/styles.xml | 6 +- .../stuifzand/micropub/PostViewModelTest.java | 28 ++ build.gradle | 7 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 33 files changed, 439 insertions(+), 260 deletions(-) create mode 100644 app/src/main/java/eu/stuifzand/micropub/LinearAdapter.java delete mode 100644 app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.java create mode 100644 app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.kt create mode 100644 app/src/main/res/drawable-hdpi/ic_send_blue.png create mode 100644 app/src/main/res/drawable-hdpi/ic_send_disabled.png create mode 100644 app/src/main/res/drawable-hdpi/ic_send_primary.png create mode 100644 app/src/main/res/drawable-mdpi/ic_send_blue.png create mode 100644 app/src/main/res/drawable-mdpi/ic_send_disabled.png create mode 100644 app/src/main/res/drawable-mdpi/ic_send_primary.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_send_blue.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_send_disabled.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_send_primary.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_send_blue.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_send_disabled.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_send_primary.png create mode 100644 app/src/test/java/eu/stuifzand/micropub/PostViewModelTest.java diff --git a/app/build.gradle b/app/build.gradle index 61a8773..f8d7ea7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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() } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c89dcb2..2b01314 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -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"> { 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 diff --git a/app/src/main/java/eu/stuifzand/micropub/LinearAdapter.java b/app/src/main/java/eu/stuifzand/micropub/LinearAdapter.java new file mode 100644 index 0000000..98828ff --- /dev/null +++ b/app/src/main/java/eu/stuifzand/micropub/LinearAdapter.java @@ -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> { + 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 syndications) { + //updateList(syndications); + Formatter formatter = new Formatter(); + formatter.format("onChanged"); + Log.i("micropub", formatter.toString()); + } + + @Override + public void onItemRangeChanged(ObservableArrayList 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 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 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 syndications, int f, int n) { + uiHandler.post(() -> { + view.removeViews(f, n); + }); + } + + protected void updateList(ObservableArrayList 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 list) { + assert list != null; + list.addOnListChangedCallback(new LinearAdapter(view)); + } +} diff --git a/app/src/main/java/eu/stuifzand/micropub/ListAdapter.java b/app/src/main/java/eu/stuifzand/micropub/ListAdapter.java index 20876ea..1199b0e 100644 --- a/app/src/main/java/eu/stuifzand/micropub/ListAdapter.java +++ b/app/src/main/java/eu/stuifzand/micropub/ListAdapter.java @@ -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(); } diff --git a/app/src/main/java/eu/stuifzand/micropub/MainActivity.java b/app/src/main/java/eu/stuifzand/micropub/MainActivity.java index a1088b4..3f14da6 100644 --- a/app/src/main/java/eu/stuifzand/micropub/MainActivity.java +++ b/app/src/main/java/eu/stuifzand/micropub/MainActivity.java @@ -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(); diff --git a/app/src/main/java/eu/stuifzand/micropub/PostViewModel.java b/app/src/main/java/eu/stuifzand/micropub/PostViewModel.java index 2b8f687..263086d 100644 --- a/app/src/main/java/eu/stuifzand/micropub/PostViewModel.java +++ b/app/src/main/java/eu/stuifzand/micropub/PostViewModel.java @@ -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 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); } } diff --git a/app/src/main/java/eu/stuifzand/micropub/auth/AuthenticatorService.java b/app/src/main/java/eu/stuifzand/micropub/auth/AuthenticatorService.java index 6b1949d..1021398 100644 --- a/app/src/main/java/eu/stuifzand/micropub/auth/AuthenticatorService.java +++ b/app/src/main/java/eu/stuifzand/micropub/auth/AuthenticatorService.java @@ -24,5 +24,4 @@ public class AuthenticatorService extends Service { public IBinder onBind(Intent intent) { return authenticator.getIBinder(); } - } diff --git a/app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.java b/app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.java deleted file mode 100644 index d7aad77..0000000 --- a/app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.java +++ /dev/null @@ -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(); - } - } - } -} diff --git a/app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.kt b/app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.kt new file mode 100644 index 0000000..3d926f1 --- /dev/null +++ b/app/src/main/java/eu/stuifzand/micropub/auth/WebSigninActivity.kt @@ -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(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(); + } + } + } +} diff --git a/app/src/main/java/eu/stuifzand/micropub/auth/WebsigninTask.java b/app/src/main/java/eu/stuifzand/micropub/auth/WebsigninTask.java index 150e6d1..5f525a3 100644 --- a/app/src/main/java/eu/stuifzand/micropub/auth/WebsigninTask.java +++ b/app/src/main/java/eu/stuifzand/micropub/auth/WebsigninTask.java @@ -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 { - 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 { intent.putExtras(bundle); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); - this.activity.startActivityForResult(intent, WebSigninActivity.AUTHENTICATION_REQUEST); + this.activity.startActivityForResult(intent, AUTHENTICATION_REQUEST); } } diff --git a/app/src/main/res/drawable-hdpi/ic_send_blue.png b/app/src/main/res/drawable-hdpi/ic_send_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..596c08ec44b86c0d964ddc31d4dad94e73686aec GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpUtcb+beAr-gYUf;-fFhJy3A+wwC zWc3L*R9do2p6iXA*= z6Xn)VXZ*grXu{TLX@#{$3Y#8(%{<`T)4tWzc82!A@AFL p9tS$TP4s(T81%K-YE!PC{xWt~$(698LcdTamy literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_send_disabled.png b/app/src/main/res/drawable-hdpi/ic_send_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..0368955cc16e6da9ec88a258453295bcf326b8aa GIT binary patch literal 306 zcmV-20nPr2P)6q({$}+`vM(UweQS z&m)8oLI@!b(OS>rINl~nGKCa~qDYIt#g?2Oq)bs1T}Xk7$Vp~qCC34zKt<$ic)cp%OuRlJP>+`}rvEj8EXzi6(`6Wj8);xCb-cyn z9T9td*=D>td7cl0Aec!lq?xsCNE+MQQHF`vJ$&EqDW%3T!m8=)wGuC60h|cIKg95_ z(ZBtW!7e3W7juxyY1j=7?3NO8QxE@Jg%CmrA>;?S0z^lCfDX`s?f?J)07*qoM6N<$ Ef`(6j(EtDd literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_send_primary.png b/app/src/main/res/drawable-hdpi/ic_send_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..149a7f7da08924294146e440b2be2a752c1b6ddf GIT binary patch literal 339 zcmV-Z0j&OsP)$DF5s%0m=aOuKlfv*QNqn7q4#%ti&rB zpAVHLfM(uqOZj002ovPDHLkV1mAZksAO2 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_send_blue.png b/app/src/main/res/drawable-mdpi/ic_send_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..4c203f55bc86084722652f931609dbfc9b2dfa84 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJC7v#hAr-fh6C_v{Cy4Yk1v;>7 z(EA^s6#UKp?7|=WPc&E@SoWpf`T}Em!QHVD}U!@@RVNnIhH3nR5rVI?eQy=bp SWta(aHiM_DpUXO@geCw#Wmx?H literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_send_disabled.png b/app/src/main/res/drawable-mdpi/ic_send_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..ceccb534b6bf581dab1918437b20b7886f811d1b GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJO`a}}Ar-fh6C_v{Cy4Yg*&MiW z!{Ypf3m5!cU0Z7x$XrNFN-`4e_}%y>KtW7WgT29Ug1v0V=7tDnjk6x*>r zvO`x#N2H;T`BwTP&LbNgVmL}-q%~ABY(RY*0VsIG2}wiGtLLMHL6M7B{Z# hb3dpd!K%!}z)+a9`nHvsrxDQg44$rjF6*2UngHT3QfB}F literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_send_primary.png b/app/src/main/res/drawable-mdpi/ic_send_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..ef3648fd21be3afc4b4bf27907843e8bccc38738 GIT binary patch literal 257 zcmV+c0sj7pP)pF&K>jHp z?z1iXZ^ppzpONkkK*6Q|SJ6Cr@HznDkbTxA{|l_k{!0yv1CXKzNcU1TdTfgS8-s$` zs^otj(3f4nT(K1B;{!y5$|~#P|3Ng19^>-={I00000NkvXX Hu0mjfAU|_x literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_send_blue.png b/app/src/main/res/drawable-xhdpi/ic_send_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..2e4581625c07ab2e52ca0ffd70587893c2f3a136 GIT binary patch literal 345 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7T#lEU{vsQaSW-r_4bCL7qg?p(T@rl ziK{!vzZCck4?_A0Qq zBqqi7pK8O(sxRxehWRj*UP|k*+T5P+w0O7H%bV}+|Fcj&W|ntqt^4Ywi&yY+CvBHD z-4IzcGya5`7k_2{gJp8|l3SwIuHTZ%D0|MTx@%4QeFmG*1AmoX{4+k`*0I*W-uVw- pvBIH=Gafq!en0*Q;uD501I9hyP1ohuoBjcbc)I$ztaD0e0std1=dS)2u(oH7)W=00@E)S93T{Fcb#7hs-}V(+2*tr$Xp--F;NxuJ zX}&ZX4?000000000ulPHQl!Z3VwUH8$XfFKB#l5kMFQ%yY28<-SOEX|0yT0hV8 z2a^H{A~wf(s5&ME{MIoZaU4&4-|w3gP!O?KJCls(#>C?i0ga5uwE`Lwk6Q)QJ|6cH zP}_KvA)p}QOV1xyIv!;T_#2NTNxaI%Lmhk32)%2x7OL$}XUi0_u5>)IENiD}+S8uk zNuAA9BXxGFTB$xw#p4u?<8(EZhx*#bdXcwVXHTW$@ei|SUF*e_2?33dfVq#L`QM=V zg%C?&HbZQOIS}DUj6+e5#km+Ue>G*f7FJ?y(x8?-x zA53CuOXs$3u)ert)8@@r4#jP`;VH(vX~|c{Bq?usg&!=lylR)9U){kb7?_+={@&8y z%#`Ve|CT*pei3LY82nJn^gk?6x}$WB=yWEhWvee-UhFyJmd%SNSwBS#tQYC6HQwdA zP<1|2oV%21Wv6@KU_^@8gfP4Y!UY z=P`!%AD_>;BFjch@j-6NuIj$_(xbcl8RZ`(8kKp8^WXmXHZt*f*pnMwdpCal+mz~) zW2cd8V|F}>Pd)1PJME20-!J literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_send_blue.png b/app/src/main/res/drawable-xxhdpi/ic_send_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..bd64d31a1b5a611c963037b4522d6b59ba02d7c6 GIT binary patch literal 513 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>U_9aJ;uunK>+NlS?~p(V_Jp&o z+qj~(ycFhm#tZAc`t= zU0U<@%cI=weZNnK-nn3`%4CswH?HPX;Ku6JU6!^X3Ju0_fX>B_oC z_i~@E3}A46s=3~JZQYqydzlz}db*x>p9((6&~_>~?tPT)RIY@SuS;x1xe~V6MA}Z} z0rP-@6<@D(AK%$C_u^|-rXTBUz9zd?T5&FjJ)XFju_imeFWmqC-)DLI(_s_*Zq9#81gZ&a@T=lr)Om39zUBW%Po1Xs%_I$*=^Gq_n!FO z{AS1b{iW+xJev8b#IxBkCeya(_4D3&IqN@d=ik3;=jS&smmjTYEB?CZ;$+!B?=C%E z*(dwdlfi3(=M9w{$t>kGocRpj8H8G wcVQr}AP>l!7pKJ_pJ8%d-3u1LK>GhGFVdQ&MBb@0I<~OH2?qr literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_send_disabled.png b/app/src/main/res/drawable-xxhdpi/ic_send_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..5b724e9f8d0de2aa50677b740a9ec51fbdf80aa1 GIT binary patch literal 446 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>U~KhtaSW-r_4baT_u&8$whLUl zRxMtAj&EtM)Nw1zj=XbC7M8nTJkWWeqVes16*Je;$=!R!?^}NGuu_Y^cm4X3w;3!z zv%ug3_vM#gvdm`3_8os*o35EkEXeRP}g6yXD( zs>AlIT7HBftSP{MCgY0bQH+1ibWP`Yq_nO2T#^&RtCb!M*@-qQfGVy8PlV!yaQ3y= znr`<~Y(qH`w$4j(+Y;(Ol_`Srk?l6~&p-bJFuZ!1f3)j~4&MjOW6>WK{?*#%ey!ba zy~e9eTklw9&+Cd>`Pna;LTnH>_W(!up^) zl9O@8%q0w0e1aIV)D#&^CyO-9I>~*Y|BIPy!z@p(1N>V*GX)sW=5sjvg!RGuELgZT aq}4J$vR-gP{YbtBNX*mK&t;ucLK6Usk;0|` literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_send_primary.png b/app/src/main/res/drawable-xxhdpi/ic_send_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..4e4e24926ca1427f8820ecf92d7d5bc0f6b8055c GIT binary patch literal 492 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>VBGBK;uunK>+K!eJYh!(wuE36 zc84YB8JT>$1g=S6WXsC9?BXE#C^mX!66eG|W(Rgr^$r$Y*F_!HwLRQNPKn+%|7h25 zvMKuf?$1^K)rEoPfI*OZf*>pcg#BX`1_Xr+gHCg>&=@nwTGc? zad&>MxPH8D@@<|}mJj7$J_g&SvVG9!_&P=EK$NX%?VbStNJgGlD_=f(`#I9as9O@m zS<}(q-d&MnX3Qkf6K4CAZNa=OP6yjip@yne>I`2)ycu4toWyYL)yoxEF8_OeL&zab zp!Sc({Cu}ie^XY270YKE+1b2K@@M#&SabJ9Ro1h@plScUXNvF7;!9%rD#Fh<{bNDt zshyEW3XQuj2Qf~6>Rzw;c$d$Cxm8|UtQxAS#CEH8EMxfs6sep!!GGoI^vkbb?prf2 z@SSbw&Z=Wk{-NvSzN#>Yrf7dt&oRFe_Qv7NN)GkMS9&gAWZGaJoXeo+xl6--5yPEn zlY|?jHybep7<)3Vm^p{xijNyZmYODm>12_HS)LpRl2>^$Rs>jUGOX9~;BYvr!up`p e6c(}vI{q^LPrkOo(Lq)KB - + xmlns:tools="http://schemas.android.com/tools"> + + android:layout_height="match_parent" + tools:context="eu.stuifzand.micropub.BookmarkActivity" + android:windowSoftInputMode="adjustResize"> - + - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 35c2019..0fd7b45 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -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"> + app:viewModel="@{viewModel}" + tools:layout_editor_absoluteY="-4dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/content_bookmark.xml b/app/src/main/res/layout/content_bookmark.xml index 7df8b99..cb42312 100644 --- a/app/src/main/res/layout/content_bookmark.xml +++ b/app/src/main/res/layout/content_bookmark.xml @@ -14,145 +14,162 @@ type="eu.stuifzand.micropub.client.Client" /> - - + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="8dp"> - + - - + 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: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: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"> - + - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 9e48ab5..bf4c59d 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools"> + @@ -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 @@ @@ -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"> + app:layout_constraintTop_toBottomOf="@+id/contentLayout"> + app:layout_constraintTop_toBottomOf="@+id/editPhotoLayout"> + app:layout_constraintTop_toBottomOf="@+id/editCategoryLayout"> + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml index 8974ddd..e0c0bdc 100644 --- a/app/src/main/res/layout/list_item.xml +++ b/app/src/main/res/layout/list_item.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools"> + @@ -11,14 +12,13 @@ + android:layout_height="wrap_content"> + android:text="@{info.name}" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 2b3d162..b949a04 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -19,7 +19,7 @@ diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 545b9c6..cd1c5de 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ - -