Giter VIP home page Giter VIP logo

Comments (7)

efraespada avatar efraespada commented on May 22, 2024

@Narvelan I think it's possible by extending TextView class and decrypt values before show them on view. It could be a good improvement 👌​👌​

from androidlibrary.

Narvelan avatar Narvelan commented on May 22, 2024

@efraespada It's will be perfect! If you can do this =)

I try to create widget extends AppCompatTextView, but don't know get resId to setText)

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

import com.stringcare.library.SC;

public final class MyTextView extends AppCompatTextView {

    public MyTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        SC.init(context);
        setText(SC.getString( ?? ));
    }
}

from androidlibrary.

Narvelan avatar Narvelan commented on May 22, 2024

I did it

    public final class MyTextView extends AppCompatTextView {
        public MyTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
            SC.init(context);
            String text = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "text");
            if (text != null) {
                setText(SC.getString(Integer.parseInt(text.substring(1))));
            }
        }
}

from androidlibrary.

efraespada avatar efraespada commented on May 22, 2024

Perfect @Narvelan! You're great! 😄
Would you like to include it on library?

from androidlibrary.

Narvelan avatar Narvelan commented on May 22, 2024

Don't now how to do it) In my project it's java file (MyTextView.java) in widget folder with code

package ru.myapp.widgets;

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

import com.stringcare.library.SC;

    public final class MyTextView extends AppCompatTextView {

        public MyTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
            SC.init(context);
            String text = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "text");
            if (text != null) {
                setText(SC.getString(Integer.parseInt(text.substring(1))));
            }
        }
}

And in my layout files I use it like:

<ru.myapp.widgets.MyTextView
                    android:text="@string/myHiddenString"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />

from androidlibrary.

efraespada avatar efraespada commented on May 22, 2024

Okay @Narvelan, then I'll add it to library with your permission 🙂

from androidlibrary.

efraespada avatar efraespada commented on May 22, 2024

Hi @Narvelan, I released v0.9 with your improvement. I added a ContextListener for avoiding init the library with the TextView's Context. Thanks!

Documentation Usage

from androidlibrary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.