Added a dark mode (#151)
* first draft of dark mode, still needs some work * changed dark mode colors * fixed more buttons in dark mode * Ran linter and fixed a few things * mades things more kotlin-like * added night mode selector in settings, but doesn't seem to work * WIP Theme settings * Fix callback not getting called (not registered) * added theme test * removed useless strings * Fix dark mode not being applied * Our app isn't called ThemedApplication and fixed fix * changed default theme for API versions lower than 29 * WIP splashscreen nightmode * Added custom splashscreen * added night mode for splashscreen * removed useless night values * adapted icons for dark mode * fixed light mode colors * fixed a few light mode color bugs * fixed bad login button * fixed search tabs color * fixed weird text input in post creation * removed hardcoded strings in settings test * removed unnecessary margin in login activity * replace getIntrumentation.context with getInstrumentation.targetContext in settings test Co-authored-by: Matthieu De Beule <61561059+Wv5twkFEKh54vo4tta9yu7dHa3@users.noreply.github.com>
|
@ -24,6 +24,9 @@ android {
|
|||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
testInstrumentationRunnerArguments clearPackageData: 'true'
|
||||
}
|
||||
lintOptions{
|
||||
disable 'MissingTranslation'
|
||||
}
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/java'
|
||||
test.java.srcDirs += 'src/test/java'
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.view.Gravity
|
|||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.contrib.DrawerMatchers
|
||||
|
@ -53,7 +54,28 @@ class DrawerMenuTest {
|
|||
// Start the screen of your activity.
|
||||
onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_settings))
|
||||
// Check that settings activity was opened.
|
||||
onView(withText(R.string.signature_title)).check(matches(isDisplayed()))
|
||||
onView(withText(R.string.theme_title)).check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testThemeSettings() {
|
||||
// Start the screen of your activity.
|
||||
onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_settings))
|
||||
val themes = getInstrumentation().targetContext.resources.getStringArray(R.array.theme_entries)
|
||||
//select theme modes
|
||||
onView(withText(R.string.theme_title)).perform(click())
|
||||
onView(withText(themes[2])).perform(click())
|
||||
|
||||
//Select an other theme
|
||||
onView(withText(R.string.theme_title)).perform(click())
|
||||
onView(withText(themes[0])).perform(click())
|
||||
|
||||
//Select the last theme
|
||||
onView(withText(R.string.theme_title)).perform(click())
|
||||
onView(withText(themes[1])).perform(click())
|
||||
|
||||
//Check that we are back in the settings page
|
||||
onView(withText(R.string.theme_header)).check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -96,7 +96,7 @@ class IntentTest {
|
|||
intended(expectedIntent)
|
||||
}
|
||||
|
||||
fun clickClickableSpanInDescription(textToClick: CharSequence): ViewAction {
|
||||
private fun clickClickableSpanInDescription(textToClick: CharSequence): ViewAction {
|
||||
return object : ViewAction {
|
||||
|
||||
override fun getConstraints(): Matcher<View> {
|
||||
|
@ -104,7 +104,7 @@ class IntentTest {
|
|||
}
|
||||
|
||||
override fun getDescription(): String {
|
||||
return "clicking on a ClickableSpan";
|
||||
return "clicking on a ClickableSpan"
|
||||
}
|
||||
|
||||
override fun perform(uiController: UiController, view: View) {
|
||||
|
@ -116,7 +116,7 @@ class IntentTest {
|
|||
throw NoMatchingViewException.Builder()
|
||||
.includeViewHierarchy(true)
|
||||
.withRootView(textView)
|
||||
.build();
|
||||
.build()
|
||||
}
|
||||
|
||||
// Get the links inside the TextView and check if we find textToClick
|
||||
|
@ -128,9 +128,9 @@ class IntentTest {
|
|||
val start = spannableString.getSpanStart(spanCandidate)
|
||||
val end = spannableString.getSpanEnd(spanCandidate)
|
||||
val sequence = spannableString.subSequence(start, end)
|
||||
if (textToClick.toString().equals(sequence.toString())) {
|
||||
if (textToClick.toString() == sequence.toString()) {
|
||||
span.onClick(textView)
|
||||
return;
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,12 +117,12 @@ class MockedServerTest {
|
|||
Thread.sleep(1000)
|
||||
|
||||
// Unfollow
|
||||
onView(withId(R.id.followButton)).perform((ViewActions.click()))
|
||||
onView(withId(R.id.followButton)).perform((click()))
|
||||
Thread.sleep(1000)
|
||||
onView(withId(R.id.followButton)).check(matches(withText("Follow")))
|
||||
|
||||
// Follow
|
||||
onView(withId(R.id.followButton)).perform((ViewActions.click()))
|
||||
onView(withId(R.id.followButton)).perform((click()))
|
||||
Thread.sleep(1000)
|
||||
onView(withId(R.id.followButton)).check(matches(withText("Unfollow")))
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ class MockedServerTest {
|
|||
Thread.sleep(1000)
|
||||
|
||||
// Open followers list
|
||||
onView(withId(R.id.nbFollowersTextView)).perform((ViewActions.click()))
|
||||
onView(withId(R.id.nbFollowersTextView)).perform((click()))
|
||||
Thread.sleep(1000)
|
||||
// Open follower's profile
|
||||
onView(withText("ete2")).perform((ViewActions.click()))
|
||||
onView(withText("ete2")).perform((click()))
|
||||
Thread.sleep(1000)
|
||||
|
||||
onView(withId(R.id.accountNameTextView)).check(matches(withText("Christian")))
|
||||
|
@ -174,7 +174,7 @@ class MockedServerTest {
|
|||
onView(withId(R.id.view_pager)).perform(ViewActions.swipeUp()).perform(ViewActions.swipeDown())
|
||||
|
||||
Thread.sleep(1000)
|
||||
onView(withText("Dobios liked your post")).perform(ViewActions.click())
|
||||
onView(withText("Dobios liked your post")).perform(click())
|
||||
|
||||
Thread.sleep(1000)
|
||||
onView(withText("6 Likes")).check(matches(withId(R.id.nlikes)))
|
||||
|
@ -190,7 +190,7 @@ class MockedServerTest {
|
|||
onView(withId(R.id.view_pager)).perform(ViewActions.swipeUp()).perform(ViewActions.swipeDown())
|
||||
Thread.sleep(1000)
|
||||
|
||||
onView(withText("Dobios followed you")).perform(ViewActions.click())
|
||||
onView(withText("Dobios followed you")).perform(click())
|
||||
Thread.sleep(1000)
|
||||
onView(withText("Andrew Dobis")).check(matches(withId(R.id.accountNameTextView)))
|
||||
}
|
||||
|
@ -205,10 +205,10 @@ class MockedServerTest {
|
|||
onView(withId(R.id.view_pager)).perform(ViewActions.swipeUp()).perform(ViewActions.swipeDown())
|
||||
Thread.sleep(1000)
|
||||
|
||||
onView(withText("Dobios liked your post")).perform(ViewActions.click())
|
||||
onView(withText("Dobios liked your post")).perform(click())
|
||||
Thread.sleep(1000)
|
||||
|
||||
onView(withId(R.id.username)).perform(ViewActions.click())
|
||||
onView(withId(R.id.username)).perform(click())
|
||||
Thread.sleep(10000)
|
||||
onView(withText("Dante")).check(matches(withId(R.id.accountNameTextView)))
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class MockedServerTest {
|
|||
onView(withId(R.id.view_pager)).perform(ViewActions.swipeUp()).perform(ViewActions.swipeDown())
|
||||
Thread.sleep(1000)
|
||||
|
||||
onView(withText("Clement shared your post")).perform(ViewActions.click())
|
||||
onView(withText("Clement shared your post")).perform(click())
|
||||
Thread.sleep(1000)
|
||||
|
||||
onView(first(withText("Clement"))).check(matches(withId(R.id.username)))
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.junit.runner.RunWith
|
|||
@RunWith(AndroidJUnit4::class)
|
||||
class PostCreationActivityTest {
|
||||
|
||||
val mockServer = MockServer()
|
||||
private val mockServer = MockServer()
|
||||
|
||||
@get:Rule
|
||||
val globalTimeout: Timeout = Timeout.seconds(30)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<uses-feature android:name="android.hardware.location.gps" />
|
||||
|
||||
<application
|
||||
android:name=".Pixeldroid"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
@ -14,7 +14,7 @@ import retrofit2.Callback
|
|||
import retrofit2.Response
|
||||
|
||||
class FollowsActivity : AppCompatActivity() {
|
||||
var followsFragment = AccountListFragment()
|
||||
private var followsFragment = AccountListFragment()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
|
|
@ -34,7 +34,6 @@ import kotlinx.android.synthetic.main.activity_main.*
|
|||
import kotlinx.android.synthetic.main.nav_header.view.drawer_account_name
|
||||
import kotlinx.android.synthetic.main.nav_header.view.drawer_avatar
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
private lateinit var preferences: SharedPreferences
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.h.pixeldroid
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Application
|
||||
import android.view.WindowManager
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.h.pixeldroid.utils.ThemeUtils
|
||||
|
||||
class Pixeldroid: Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
val sharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(this)
|
||||
ThemeUtils.setThemeFromPreferences(sharedPreferences, resources)
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ import retrofit2.Response
|
|||
|
||||
class PostActivity : AppCompatActivity() {
|
||||
private lateinit var preferences: SharedPreferences
|
||||
lateinit var postFragment : PostFragment
|
||||
private lateinit var postFragment : PostFragment
|
||||
lateinit var domain : String
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
|
|
@ -47,10 +47,12 @@ class PostCreationActivity : AppCompatActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_post_creation)
|
||||
val imageUri: Uri = intent.getParcelableExtra<Uri>("picture_uri")!!
|
||||
|
||||
val imageUri: Uri = intent.getParcelableExtra("picture_uri")!!
|
||||
|
||||
saveImage(imageUri)
|
||||
|
||||
pictureFrame = findViewById<ImageView>(R.id.post_creation_picture_frame)
|
||||
pictureFrame = findViewById(R.id.post_creation_picture_frame)
|
||||
pictureFrame.setImageURI(image.toUri())
|
||||
|
||||
preferences = getSharedPreferences(
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
package com.h.pixeldroid
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.h.pixeldroid.utils.ThemeUtils.Companion.setThemeFromPreferences
|
||||
|
||||
class SettingsActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private var restartActivitiesOnExit = false
|
||||
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContentView(R.layout.settings)
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
|
@ -15,7 +24,31 @@ class SettingsActivity : AppCompatActivity() {
|
|||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
private fun restartCurrentActivity() {
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
super.startActivity(intent)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||
when (key) {
|
||||
"theme" -> setThemeFromPreferences(sharedPreferences, resources)
|
||||
}
|
||||
|
||||
restartActivitiesOnExit = true
|
||||
restartCurrentActivity()
|
||||
}
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||
}
|
||||
|
|
|
@ -6,6 +6,5 @@ import androidx.room.RoomDatabase
|
|||
@Database(entities = [InstanceDatabaseEntity::class, UserDatabaseEntity::class], version = 1)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun instanceDao(): InstanceDao
|
||||
|
||||
abstract fun userDao(): UserDao
|
||||
}
|
|
@ -149,7 +149,7 @@ abstract class FeedsRecyclerViewAdapter<T: FeedContent, VH : RecyclerView.ViewHo
|
|||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: T, newItem: T): Boolean {
|
||||
return oldItem == newItem
|
||||
return oldItem.equals(newItem)
|
||||
}
|
||||
}
|
||||
){
|
||||
|
|
|
@ -8,8 +8,7 @@ import retrofit2.Call
|
|||
|
||||
class PublicTimelineFragment: PostsFeedFragment() {
|
||||
|
||||
inner class SearchFeedDataSource(
|
||||
) : FeedDataSource(null, null){
|
||||
inner class SearchFeedDataSource : FeedDataSource(null, null){
|
||||
|
||||
override fun newSource(): FeedDataSource {
|
||||
return SearchFeedDataSource()
|
||||
|
|
|
@ -34,8 +34,7 @@ class SearchPostsFragment: PostsFeedFragment(){
|
|||
return view
|
||||
}
|
||||
|
||||
inner class SearchFeedDataSource(
|
||||
) : FeedDataSource(null, null){
|
||||
inner class SearchFeedDataSource : FeedDataSource(null, null){
|
||||
|
||||
override fun newSource(): FeedDataSource {
|
||||
return SearchFeedDataSource()
|
||||
|
|
|
@ -3,10 +3,6 @@ package com.h.pixeldroid.objects
|
|||
abstract class FeedContent {
|
||||
abstract val id: String
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return super.equals(other)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return id.hashCode()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package com.h.pixeldroid.objects
|
||||
|
||||
class Field {
|
||||
|
||||
}
|
||||
class Field
|
||||
|
|
|
@ -2,6 +2,4 @@ package com.h.pixeldroid.objects
|
|||
|
||||
import java.io.Serializable
|
||||
|
||||
class Poll : Serializable {
|
||||
|
||||
}
|
||||
class Poll : Serializable
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package com.h.pixeldroid.objects
|
||||
|
||||
class Source {
|
||||
|
||||
}
|
||||
class Source
|
||||
|
|
|
@ -209,22 +209,26 @@ data class Status(
|
|||
isActivity : Boolean
|
||||
) {
|
||||
//Setup username as a button that opens the profile
|
||||
val username = rootView.findViewById<TextView>(R.id.username)
|
||||
username.text = this.getUsername()
|
||||
username.setTypeface(null, Typeface.BOLD)
|
||||
username.setOnClickListener { account.openProfile(rootView.context) }
|
||||
rootView.findViewById<TextView>(R.id.username).apply {
|
||||
text = this@Status.getUsername()
|
||||
setTypeface(null, Typeface.BOLD)
|
||||
setOnClickListener { account.openProfile(rootView.context) }
|
||||
}
|
||||
|
||||
val usernameDesc = rootView.findViewById<TextView>(R.id.usernameDesc)
|
||||
usernameDesc.text = this.getUsername()
|
||||
usernameDesc.setTypeface(null, Typeface.BOLD)
|
||||
rootView.findViewById<TextView>(R.id.usernameDesc).apply {
|
||||
text = this@Status.getUsername()
|
||||
setTypeface(null, Typeface.BOLD)
|
||||
}
|
||||
|
||||
val nlikes = rootView.findViewById<TextView>(R.id.nlikes)
|
||||
nlikes.text = this.getNLikes()
|
||||
nlikes.setTypeface(null, Typeface.BOLD)
|
||||
rootView.findViewById<TextView>(R.id.nlikes).apply {
|
||||
text = this@Status.getNLikes()
|
||||
setTypeface(null, Typeface.BOLD)
|
||||
}
|
||||
|
||||
val nshares = rootView.findViewById<TextView>(R.id.nshares)
|
||||
nshares.text = this.getNShares()
|
||||
nshares.setTypeface(null, Typeface.BOLD)
|
||||
rootView.findViewById<TextView>(R.id.nshares).apply {
|
||||
text = this@Status.getNShares()
|
||||
setTypeface(null, Typeface.BOLD)
|
||||
}
|
||||
|
||||
//Convert the date to a readable string
|
||||
ISO8601toDate(created_at, rootView.postDate, isActivity)
|
||||
|
@ -246,7 +250,7 @@ data class Status(
|
|||
|
||||
|
||||
//Set comment initial visibility
|
||||
rootView.findViewById<LinearLayout>(R.id.commentIn).visibility = View.GONE
|
||||
rootView.findViewById<LinearLayout>(R.id.commentIn).visibility = GONE
|
||||
|
||||
imagePopUpMenu(rootView, homeFragment.requireActivity())
|
||||
}
|
||||
|
@ -254,8 +258,10 @@ data class Status(
|
|||
fun setDescription(rootView: View, api : PixelfedAPI, credential: String) {
|
||||
val desc = rootView.findViewById<TextView>(R.id.description)
|
||||
|
||||
desc.text = this.getDescription(api, rootView.context, credential)
|
||||
desc.movementMethod = LinkMovementMethod.getInstance()
|
||||
desc.apply {
|
||||
text = this@Status.getDescription(api, rootView.context, credential)
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}
|
||||
|
||||
fun activateReblogger(
|
||||
|
@ -264,19 +270,21 @@ data class Status(
|
|||
credential: String,
|
||||
isReblogged : Boolean
|
||||
) {
|
||||
//Set initial button state
|
||||
holder.reblogger.isChecked = isReblogged
|
||||
holder.reblogger.apply {
|
||||
//Set initial button state
|
||||
isChecked = isReblogged
|
||||
|
||||
//Activate the button
|
||||
holder.reblogger.setEventListener { _, buttonState ->
|
||||
if (buttonState) {
|
||||
Log.e("REBLOG", "Reblogged post")
|
||||
// Button is active
|
||||
reblogPost(holder, api, credential, this)
|
||||
} else {
|
||||
Log.e("REBLOG", "Undo Reblogged post")
|
||||
// Button is inactive
|
||||
undoReblogPost(holder, api, credential, this)
|
||||
//Activate the button
|
||||
setEventListener { _, buttonState ->
|
||||
if (buttonState) {
|
||||
Log.e("REBLOG", "Reblogged post")
|
||||
// Button is active
|
||||
reblogPost(holder, api, credential, this@Status)
|
||||
} else {
|
||||
Log.e("REBLOG", "Undo Reblogged post")
|
||||
// Button is inactive
|
||||
undoReblogPost(holder, api, credential, this@Status)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,20 +295,23 @@ data class Status(
|
|||
credential: String,
|
||||
isLiked: Boolean
|
||||
) {
|
||||
//Set initial state
|
||||
holder.liker.isChecked = isLiked
|
||||
|
||||
//Activate the liker
|
||||
holder.liker.setEventListener { _, buttonState ->
|
||||
holder.liker.apply {
|
||||
//Set initial state
|
||||
isChecked = isLiked
|
||||
|
||||
//Activate the liker
|
||||
setEventListener { _, buttonState ->
|
||||
if (buttonState) {
|
||||
// Button is active
|
||||
likePostCall(holder, api, credential, this)
|
||||
likePostCall(holder, api, credential, this@Status)
|
||||
} else {
|
||||
// Button is inactive
|
||||
unLikePostCall(holder, api, credential, this)
|
||||
unLikePostCall(holder, api, credential, this@Status)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun showComments(
|
||||
|
@ -310,14 +321,16 @@ data class Status(
|
|||
) {
|
||||
//Show all comments of a post
|
||||
if (replies_count == 0) {
|
||||
holder.viewComment.text = "No comments on this post..."
|
||||
holder.viewComment.text = holder.context.getString(R.string.NoCommentsToShow)
|
||||
} else {
|
||||
holder.viewComment.text = "View all $replies_count comments..."
|
||||
holder.viewComment.setOnClickListener {
|
||||
holder.viewComment.visibility = View.GONE
|
||||
holder.viewComment.apply {
|
||||
text = "$replies_count ${holder.context.getString(R.string.CommentDisplay)}"
|
||||
setOnClickListener {
|
||||
visibility = GONE
|
||||
|
||||
//Retrieve the comments
|
||||
retrieveComments(holder, api, credential, this)
|
||||
//Retrieve the comments
|
||||
retrieveComments(holder, api, credential, this@Status)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +362,7 @@ data class Status(
|
|||
}
|
||||
|
||||
|
||||
fun imagePopUpMenu(view: View, activity: FragmentActivity) {
|
||||
private fun imagePopUpMenu(view: View, activity: FragmentActivity) {
|
||||
val anchor = view.findViewById<FrameLayout>(R.id.post_fragment_image_popup_menu_anchor)
|
||||
if (!media_attachments.isNullOrEmpty() && media_attachments.size == 1) {
|
||||
view.findViewById<ImageView>(R.id.postPicture).setOnLongClickListener {
|
||||
|
|
|
@ -111,8 +111,8 @@ class HtmlUtils {
|
|||
}
|
||||
}
|
||||
|
||||
builder.removeSpan(span);
|
||||
builder.setSpan(customSpan, start, end, flags);
|
||||
builder.removeSpan(span)
|
||||
builder.setSpan(customSpan, start, end, flags)
|
||||
|
||||
// Add zero-width space after links in end of line to fix its too large hitbox.
|
||||
if (end >= builder.length || builder.subSequence(end, end + 1).toString() == "\n") {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.h.pixeldroid.utils
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.h.pixeldroid.R
|
||||
import com.h.pixeldroid.api.PixelfedAPI
|
||||
import com.h.pixeldroid.fragments.feeds.PostViewHolder
|
||||
|
@ -26,7 +28,7 @@ abstract class PostUtils {
|
|||
when(holder.commentIn.visibility) {
|
||||
View.VISIBLE -> {
|
||||
holder.commentIn.visibility = View.GONE
|
||||
setImageFromDrawable(holder.postView, holder.commenter, R.drawable.ic_comment_empty)
|
||||
setImageFromDrawable(holder.postView, holder.commenter, R.drawable.ic_comment_empty)
|
||||
}
|
||||
View.GONE -> {
|
||||
holder.commentIn.visibility = View.VISIBLE
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.h.pixeldroid.utils
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.h.pixeldroid.R
|
||||
|
||||
class ThemeUtils {
|
||||
companion object {
|
||||
/**
|
||||
* @brief Updates the application's theme depending on the given preferences and resources
|
||||
*/
|
||||
fun setThemeFromPreferences(preferences: SharedPreferences, resources : Resources) {
|
||||
val themes = resources.getStringArray(R.array.theme_values)
|
||||
val theme = preferences.getString("theme", "")
|
||||
Log.e("themePref", theme!!)
|
||||
//Set the theme
|
||||
when(theme) {
|
||||
//Light
|
||||
themes[1] -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
}
|
||||
//Dark
|
||||
themes[2] -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
else -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 92 KiB |
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="24dp" android:viewportHeight="48"
|
||||
android:viewportWidth="48" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="m18.9609,24.1172q0,2.793 1.3867,4.3945 1.3867,1.582 3.8086,1.582 2.4023,0 3.7695,-1.6016 1.3867,-1.6016 1.3867,-4.375 0,-2.7344 -1.4063,-4.3359 -1.4063,-1.6211 -3.7891,-1.6211 -2.3633,0 -3.7695,1.6016 -1.3867,1.6016 -1.3867,4.3555zM29.6055,29.957q-1.1719,1.5039 -2.6953,2.2266 -1.5039,0.7031 -3.5156,0.7031 -3.3594,0 -5.4688,-2.4219 -2.0898,-2.4414 -2.0898,-6.3477 0,-3.9063 2.1094,-6.3477 2.1094,-2.4414 5.4492,-2.4414 2.0117,0 3.5352,0.7422 1.5234,0.7227 2.6758,2.207v-2.5586h2.793v14.375q2.8516,-0.4297 4.4531,-2.5977 1.6211,-2.1875 1.6211,-5.6445 0,-2.0898 -0.625,-3.9258 -0.6055,-1.8359 -1.8555,-3.3984 -2.0313,-2.5586 -4.9609,-3.9063 -2.9102,-1.3672 -6.3477,-1.3672 -2.4023,0 -4.6094,0.6445 -2.207,0.625 -4.082,1.875 -3.0664,1.9922 -4.8047,5.2344 -1.7188,3.2227 -1.7188,6.9922 0,3.1055 1.1133,5.8203 1.1328,2.7148 3.2617,4.7852 2.0508,2.0313 4.7461,3.0859 2.6953,1.0742 5.7617,1.0742 2.5195,0 4.9414,-0.8594 2.4414,-0.8398 4.4727,-2.4219l1.7578,2.168q-2.4414,1.8945 -5.332,2.8906 -2.8711,1.0156 -5.8398,1.0156 -3.6133,0 -6.8164,-1.2891 -3.2031,-1.2695 -5.7031,-3.7109 -2.5,-2.4414 -3.8086,-5.6445 -1.3086,-3.2227 -1.3086,-6.9141 0,-3.5547 1.3281,-6.7773 1.3281,-3.2227 3.7891,-5.6641 2.5195,-2.4805 5.8203,-3.7891 3.3008,-1.3281 6.9922,-1.3281 4.1406,0 7.6758,1.6992 3.5547,1.6992 5.957,4.8242 1.4648,1.9141 2.2266,4.1602 0.7813,2.2461 0.7813,4.6484 0,5.1367 -3.1055,8.1055 -3.1055,2.9688 -8.5742,3.0859z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M20,2L4,2c-1.1,0 -2,0.9 -2,2v18l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM20,16L6,16l-2,2L4,4h16v12z"/>
|
||||
</vector>
|
|
@ -4,6 +4,6 @@
|
|||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,16h6v-6h4l-7,-7 -7,7h4zM5,18h14v2L5,20z"/>
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M17,15h2V7c0,-1.1 -0.9,-2 -2,-2H9v2h8v8zM7,17V1H5v4H1v2h4v10c0,1.1 0.9,2 2,2h10v4h2v-4h4v-2H7z"/>
|
||||
</vector>
|
|
@ -0,0 +1,25 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"
|
||||
android:strokeWidth="0.82808512"
|
||||
android:fillColor="#7f7f7f"
|
||||
android:fillAlpha="1"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M24.0666,16.1964m-6.6463,0a6.6463,6.6463 0,1 1,13.2926 0a6.6463,6.6463 0,1 1,-13.2926 0"
|
||||
android:strokeWidth="0.46640581"/>
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M24,27.5161L24,27.5161A5.4669,13.0074 90,0 1,37.0074 32.983L37.0074,32.983A5.4669,13.0074 90,0 1,24 38.4498L24,38.4498A5.4669,13.0074 90,0 1,10.9926 32.983L10.9926,32.983A5.4669,13.0074 90,0 1,24 27.5161zM10.9926,32.983l26.0147,0l0,5.4669l-26.0147,0z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M24,27.5161L24,27.5161A5.4669,13.0074 90,0 1,37.0074 32.983L37.0074,32.983A5.4669,13.0074 90,0 1,24 38.4498L24,38.4498A5.4669,13.0074 90,0 1,10.9926 32.983L10.9926,32.983A5.4669,13.0074 90,0 1,24 27.5161z"/>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M10.9926,32.983l26.0147,0l0,5.4669l-26.0147,0z"/>
|
||||
</group>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M15,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM6,10L6,7L4,7v3L1,10v2h3v3h2v-3h3v-2L6,10zM15,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="18dp" android:viewportHeight="512"
|
||||
android:viewportWidth="512" android:width="18dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M462.3,62.6C407.5,15.9 326,24.3 275.7,76.2L256,96.5l-19.7,-20.3C186.1,24.3 104.5,15.9 49.7,62.6c-62.8,53.6 -66.1,149.8 -9.9,207.9l193.5,199.8c12.5,12.9 32.8,12.9 45.3,0l193.5,-199.8c56.3,-58.1 53,-154.3 -9.8,-207.9z"/>
|
||||
</vector>
|
|
@ -0,0 +1,6 @@
|
|||
<vector android:height="21.6dp" android:viewportHeight="99"
|
||||
android:viewportWidth="110" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#00000000"
|
||||
android:pathData="M54.5,94.5C58.2,90.74 79.39,69.25 92.63,55.83C104.5,43.8 104.24,26.26 93.46,15.39C82.67,4.5 65.23,4.55 54.5,15.48C43.76,4.55 26.32,4.5 15.54,15.38C4.75,26.25 4.5,43.79 16.36,55.83C29.6,69.25 50.79,90.74 54.5,94.5Z"
|
||||
android:strokeColor="#FFFFFF" android:strokeWidth="9"/>
|
||||
</vector>
|
|
@ -0,0 +1,15 @@
|
|||
<vector android:height="24dp" android:viewportHeight="85"
|
||||
android:viewportWidth="111" android:width="31.341177dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#00000000"
|
||||
android:pathData="M30.5,64.5L90.5,64.5L90.5,39.81"
|
||||
android:strokeColor="#FFFFFF" android:strokeWidth="9"/>
|
||||
<path android:fillColor="#FFFFFF"
|
||||
android:pathData="M90.5,25.56L100,44.56L90.5,39.81L81,44.56Z"
|
||||
android:strokeColor="#FFFFFF" android:strokeWidth="9"/>
|
||||
<path android:fillColor="#00000000"
|
||||
android:pathData="M80.5,18.5L20.5,18.5L20.5,44.19"
|
||||
android:strokeColor="#FFFFFF" android:strokeWidth="9"/>
|
||||
<path android:fillColor="#FFFFFF"
|
||||
android:pathData="M20.5,58.44L11,39.44L20.5,44.19L30,39.44Z"
|
||||
android:strokeColor="#FFFFFF" android:strokeWidth="9"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:centerColor="#009688"
|
||||
android:endColor="#00695C"
|
||||
android:startColor="#4DB6AC"
|
||||
android:type="linear" />
|
||||
</shape>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
|
||||
<!-- The background color, preferably the same as your normal theme -->
|
||||
<item android:drawable="@android:color/white"/>
|
||||
<!-- Your product logo - 144dp color version of your app icon -->
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/index"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
|
||||
<!-- The background color, preferably the same as your normal theme -->
|
||||
<item android:drawable="@android:color/black"/>
|
||||
<!-- Your product logo - 144dp color version of your app icon -->
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/index_night"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
</layer-list>
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 117 KiB |
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M9,16h6v-6h4l-7,-7 -7,7h4zM5,18h14v2L5,20z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
|
||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
|
||||
</vector>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
|
||||
<!-- The background color, preferably the same as your normal theme -->
|
||||
<item android:drawable="@android:color/black"/>
|
||||
<!-- Your product logo - 144dp color version of your app icon -->
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/index_night"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -14,7 +14,8 @@
|
|||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/ic_default_user" />
|
||||
tools:src="@drawable/ic_default_user"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/account_entry_username"
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:srcCompat="@drawable/ic_fred_phone" />
|
||||
app:srcCompat="@drawable/ic_fred_phone"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/login_activity_instance_chooser_layout"
|
||||
|
@ -53,6 +54,8 @@
|
|||
android:id="@+id/login_activity_instance_chooser_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"
|
||||
android:text="@string/enter"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -79,6 +82,8 @@
|
|||
android:id="@+id/connect_instance_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"
|
||||
android:text="@string/connect_to_pixelfed" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabMode="fixed"
|
||||
app:tabBackground="@color/colorPrimary">
|
||||
app:tabBackground="@color/colorPrimaryTab">
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<ImageView
|
||||
android:id="@+id/post_creation_picture_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -25,16 +26,17 @@
|
|||
app:errorEnabled="true"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingStart="15dp"
|
||||
android:textColorHint="@color/cardview_light_background"
|
||||
app:errorTextColor="@color/cardview_light_background">
|
||||
android:textColorHint="@color/colorPrimaryTab"
|
||||
app:errorTextColor="@color/colorPrimaryError">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/new_post_description_input_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:ems="10"
|
||||
android:inputType="textMultiLine"
|
||||
android:textColor="@color/cardview_light_background"/>
|
||||
android:textColor="@color/colorPrimary"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
@ -43,8 +45,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/send"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textColor="@color/cardview_light_background"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"
|
||||
android:layout_margin="15dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:ignore="PrivateResource"/>
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_weight="1"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
tools:srcCompat="@tools:sample/avatars"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -111,18 +112,19 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Follow"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:visibility="invisible"
|
||||
android:textColor="@color/colorButtonText"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/editButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorButtonText"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:text="Edit profile"
|
||||
android:textColor="@color/cardview_light_background"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -143,16 +145,18 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/colorPrimary"
|
||||
android:src="@android:drawable/ic_dialog_dialer" />
|
||||
android:background="@color/colorPrimaryTab"
|
||||
android:src="@android:drawable/ic_dialog_dialer"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/collectionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/colorPrimary"
|
||||
android:src="@android:drawable/ic_menu_gallery" />
|
||||
android:background="@color/colorPrimaryTab"
|
||||
android:src="@android:drawable/ic_menu_gallery"
|
||||
android:contentDescription="TODO" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
android:id="@+id/search_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabBackground="@color/colorPrimary"
|
||||
app:tabMode="fixed"/>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
android:padding="15dp"
|
||||
android:layout_margin="15dp"
|
||||
android:text="@string/upload_a_picture"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textColor="@color/cardview_light_background"/>
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"/>
|
||||
<Button
|
||||
android:id="@+id/edit_picture_button"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -26,8 +26,8 @@
|
|||
android:padding="15dp"
|
||||
android:layout_margin="15dp"
|
||||
android:text="Edit a picture"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textColor="@color/cardview_light_background"/>
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/uploaded_picture_view"
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
android:id="@+id/imageImageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"/>
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
|
||||
</FrameLayout>
|
|
@ -11,7 +11,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/create_a_new_post"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="25sp"
|
||||
android:layout_marginBottom="50dp"/>
|
||||
|
||||
|
@ -23,8 +22,8 @@
|
|||
android:gravity="center"
|
||||
android:padding="15dp"
|
||||
android:text="@string/upload_a_picture"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textColor="@color/cardview_light_background"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"
|
||||
tools:ignore="PrivateResource" />
|
||||
|
||||
<TextView
|
||||
|
@ -40,8 +39,8 @@
|
|||
android:gravity="center"
|
||||
android:padding="15dp"
|
||||
android:text="@string/take_a_picture"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textColor="@color/cardview_light_background"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"
|
||||
tools:ignore="PrivateResource" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/notification_type"
|
||||
tools:src="@drawable/ic_default_user" />
|
||||
tools:src="@drawable/ic_default_user"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notification_photo_thumbnail"
|
||||
|
@ -50,7 +51,8 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/notification_type"
|
||||
tools:src="@drawable/ic_default_user"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notification_post_description"
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
<ImageView
|
||||
android:id="@+id/postPreview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp" />
|
||||
android:layout_height="100dp"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="Search"
|
||||
android:backgroundTint="@color/colorButtonBg"
|
||||
android:textColor="@color/colorButtonText"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/search"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/search" />
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
android:id="@+id/drawer_avatar"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@drawable/ic_default_user" />
|
||||
android:src="@drawable/ic_default_user"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/drawer_account_name"
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_default_user"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
|
@ -89,7 +90,8 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@color/browser_actions_bg_grey"
|
||||
android:longClickable="true"/>
|
||||
android:longClickable="true"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/post_fragment_image_popup_menu_anchor"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:showIn="navigation_view">
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
android:id="@+id/action_upload"
|
||||
android:orderInCategory="100"
|
||||
android:title="CREATE POST"
|
||||
android:icon="@drawable/ic_file_upload_black_24dp"
|
||||
android:icon="@drawable/ic_file_upload_24dp"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_save"
|
||||
android:orderInCategory="101"
|
||||
android:title="SAVE"
|
||||
android:icon="@drawable/ic_save_black_24dp"
|
||||
android:icon="@drawable/ic_save_24dp"
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
|
@ -1,2 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
</resources>
|
|
@ -1,2 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
</resources>
|
|
@ -1,2 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
</resources>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#FFFFFF</color>
|
||||
<color name="colorPrimaryTab">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
<color name="colorButtonBg">#6200EE</color>
|
||||
<color name="colorButtonText">#FFFFFF</color>
|
||||
|
||||
<color name="filterLabelNormal">#8A8889</color>
|
||||
<color name="filterLabelSelected">#221F20</color>
|
||||
<color name="colorOptionMenu">#FF3990</color>
|
||||
<color name="colorPrimaryError">#FF0000</color>
|
||||
</resources>
|
|
@ -0,0 +1,35 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
<style name="AppTheme.Launcher">
|
||||
<item name="android:windowBackground">@drawable/theme_night</item>
|
||||
</style>
|
||||
<style name="NoActionBar" parent="AppTheme">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar.FullScreen">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
<style name="posts_title">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_marginBottom">8dp</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
<item name="android:background">@android:color/holo_orange_light</item>
|
||||
<item name="android:textAppearance">@android:style/TextAppearance.Large</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -1,2 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
</resources>
|
|
@ -9,4 +9,16 @@
|
|||
<item>reply</item>
|
||||
<item>reply_all</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="theme_values">
|
||||
<item>default</item>
|
||||
<item>light</item>
|
||||
<item>dark</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="theme_entries">
|
||||
<item>Default (Follows system)</item>
|
||||
<item>Light</item>
|
||||
<item>Dark</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -1,10 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryTab">#FFFFFF</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
<color name="colorButtonBg">#6200EE</color>
|
||||
<color name="colorButtonText">#FFFFFF</color>
|
||||
|
||||
<color name="filterLabelNormal">#8A8889</color>
|
||||
<color name="filterLabelSelected">#221F20</color>
|
||||
<color name="colorOptionMenu">#FF3990</color>
|
||||
<color name="colorPrimaryError">#FF0000</color>
|
||||
</resources>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<string name="app_name">PixelDroid</string>
|
||||
<string name="menu_slideshow">Account name</string>
|
||||
<string name="menu_subtitle">Account informations</string>
|
||||
<string name="menu_subtitle">Account information</string>
|
||||
<string name="menu_account">My Profile</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="invalid_domain">"Invalid domain"</string>
|
||||
|
@ -11,17 +11,10 @@
|
|||
<string name="auth_failed">"Could not authenticate"</string>
|
||||
<string name="token_error">"Error getting token"</string>
|
||||
<string name="title_activity_settings2">Settings</string>
|
||||
<!-- Preference Titles -->
|
||||
<string name="messages_header">Messages</string>
|
||||
<string name="sync_header">Sync</string>
|
||||
<!-- Messages Preferences -->
|
||||
<string name="signature_title">Your signature</string>
|
||||
<string name="reply_title">Default reply action</string>
|
||||
<!-- Sync Preferences -->
|
||||
<string name="sync_title">Sync email periodically</string>
|
||||
<string name="attachment_title">Download incoming attachments</string>
|
||||
<string name="attachment_summary_on">Automatically download attachments for incoming emails
|
||||
</string>
|
||||
<!-- Theme Preferences -->
|
||||
<string name="theme_title">Application Theme</string>
|
||||
<string name="theme_header">Theme</string>
|
||||
|
||||
<string name="attachment_summary_off">Only download attachments when manually requested</string>
|
||||
<string name="followed_notification">%1$s followed you</string>
|
||||
<string name="mention_notification">%1$s mentioned you</string>
|
||||
|
@ -48,15 +41,14 @@
|
|||
<string name="image_download_downloading">Downloading…</string>
|
||||
<string name="image_download_success">Image downloaded successfully</string>
|
||||
<string name="share_picture">Share picture…</string>
|
||||
<string name="NoCommentsToShow">No comments on this post…</string>
|
||||
<string name="CommentDisplay"> to show…</string>
|
||||
<string name="domain_of_your_instance">Domain of your instance</string>
|
||||
<string name="connect_to_pixelfed">Connect to Pixelfed</string>
|
||||
<string name="login_connection_required_once">You need to connect to the internet at least once to use PixelDroid :(</string>
|
||||
<string name="you_are_in_offline_mode">You are in offline mode, but you can still view some content!</string>
|
||||
<string name="enter">Enter</string>
|
||||
<string name="auth_error_toast_msg">Server has responded with an error, try again!</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="login_empty_string_error">Instance address cannot be empty!</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
|
@ -10,7 +10,7 @@
|
|||
<style name="AppTheme.Launcher">
|
||||
<item name="android:windowBackground">@drawable/theme</item>
|
||||
</style>
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<style name="NoActionBar" parent="AppTheme">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
|
|
@ -1,35 +1,13 @@
|
|||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory app:title="@string/messages_header">
|
||||
|
||||
<EditTextPreference
|
||||
app:key="signature"
|
||||
app:title="@string/signature_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<PreferenceCategory app:title="@string/theme_header">
|
||||
<ListPreference
|
||||
app:defaultValue="reply"
|
||||
app:entries="@array/reply_entries"
|
||||
app:entryValues="@array/reply_values"
|
||||
app:key="reply"
|
||||
app:title="@string/reply_title"
|
||||
app:defaultValue="Default"
|
||||
app:entries="@array/theme_entries"
|
||||
app:entryValues="@array/theme_values"
|
||||
app:key="theme"
|
||||
app:title="@string/theme_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/sync_header">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="sync"
|
||||
app:title="@string/sync_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:dependency="sync"
|
||||
app:key="attachment"
|
||||
app:summaryOff="@string/attachment_summary_off"
|
||||
app:summaryOn="@string/attachment_summary_on"
|
||||
app:title="@string/attachment_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -16,7 +16,7 @@ import retrofit2.Call
|
|||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class APIUnitTest {
|
||||
val referenceFirstStatus = Status(id="140364967936397312", uri="https://pixelfed.de/p/Miike/140364967936397312",
|
||||
private val referenceFirstStatus = Status(id="140364967936397312", uri="https://pixelfed.de/p/Miike/140364967936397312",
|
||||
created_at="2020-03-03T08:00:16.000000Z",
|
||||
account=Account(id="115114166443970560", username="Miike", acct="Miike",
|
||||
url="https://pixelfed.de/Miike", display_name="Miike Duart", note="",
|
||||
|
@ -59,7 +59,7 @@ class APIUnitTest {
|
|||
, bookmarked = false, card = null, poll = null, text= null,url= "https://pixelfed.de/p/dante/144456497894658048")
|
||||
)
|
||||
@get:Rule
|
||||
public var wireMockRule = WireMockRule(8089)
|
||||
var wireMockRule = WireMockRule(8089)
|
||||
/*@Test
|
||||
fun mocked_api_publicTimeline_test(){
|
||||
/* Given */
|
||||
|
@ -141,7 +141,7 @@ class APIUnitTest {
|
|||
.timelineHome("abc", null, null, null,null, null)
|
||||
val statusesHome = callHome.execute().body()
|
||||
val f = statuses!![0]
|
||||
val g = statuses!![0]
|
||||
val g = statuses[0]
|
||||
assertEquals(referenceFirstStatus, f)
|
||||
assertEquals(referenceFirstStatus, g)
|
||||
//same as before, but otherwise coverage is not detected for the data classes
|
||||
|
|