Search in sources :

Example 6 with ScrollingMovementMethod

use of android.text.method.ScrollingMovementMethod in project android_frameworks_base by crdroidandroid.

the class SoundTriggerTestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Make sure that this activity can punch through the lockscreen if needed.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mDebugView = (TextView) findViewById(R.id.console);
    mScrollView = (ScrollView) findViewById(R.id.scroller_id);
    mRadioGroup = (RadioGroup) findViewById(R.id.model_group_id);
    mPlayTriggerButton = (Button) findViewById(R.id.play_trigger_id);
    mDebugView.setText(mDebugView.getText(), TextView.BufferType.EDITABLE);
    mDebugView.setMovementMethod(new ScrollingMovementMethod());
    mCaptureAudioCheckBox = (CheckBox) findViewById(R.id.caputre_check_box);
    mPlayCapturedAudioButton = (Button) findViewById(R.id.play_captured_id);
    mHandler = new Handler();
    mButtonModelUuidMap = new HashMap();
    mModelButtons = new HashMap();
    mModelNames = new HashMap();
    mModelRadioButtons = new LinkedList();
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    // Make sure that the service is started, so even if our activity goes down, we'll still
    // have a request for it to run.
    startService(new Intent(getBaseContext(), SoundTriggerTestService.class));
    // Bind to SoundTriggerTestService.
    Intent intent = new Intent(this, SoundTriggerTestService.class);
    bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
}
Also used : HashMap(java.util.HashMap) Handler(android.os.Handler) Intent(android.content.Intent) ScrollingMovementMethod(android.text.method.ScrollingMovementMethod) LinkedList(java.util.LinkedList)

Example 7 with ScrollingMovementMethod

use of android.text.method.ScrollingMovementMethod in project grpc-java by grpc.

the class RouteGuideActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_routeguide);
    mHostEdit = (EditText) findViewById(R.id.host_edit_text);
    mPortEdit = (EditText) findViewById(R.id.port_edit_text);
    mStartRouteGuideButton = (Button) findViewById(R.id.start_route_guide_button);
    mExitRouteGuideButton = (Button) findViewById(R.id.exit_route_guide_button);
    mGetFeatureButton = (Button) findViewById(R.id.get_feature_button);
    mListFeaturesButton = (Button) findViewById(R.id.list_features_button);
    mRecordRouteButton = (Button) findViewById(R.id.record_route_button);
    mRouteChatButton = (Button) findViewById(R.id.route_chat_button);
    mResultText = (TextView) findViewById(R.id.result_text);
    mResultText.setMovementMethod(new ScrollingMovementMethod());
    disableButtons();
}
Also used : ScrollingMovementMethod(android.text.method.ScrollingMovementMethod)

Example 8 with ScrollingMovementMethod

use of android.text.method.ScrollingMovementMethod in project android by owncloud.

the class ErrorsWhileCopyingHandlerActivity method onCreate.

/**
     * {@link}
     */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /// read extra parameters in intent
    Intent intent = getIntent();
    mAccount = intent.getParcelableExtra(EXTRA_ACCOUNT);
    mRemotePaths = intent.getStringArrayListExtra(EXTRA_REMOTE_PATHS);
    mLocalPaths = intent.getStringArrayListExtra(EXTRA_LOCAL_PATHS);
    mStorageManager = new FileDataStorageManager(mAccount, getContentResolver());
    mHandler = new Handler();
    if (mCurrentDialog != null) {
        mCurrentDialog.dismiss();
        mCurrentDialog = null;
    }
    /// load generic layout
    setContentView(R.layout.generic_explanation);
    /// customize text message
    TextView textView = (TextView) findViewById(R.id.message);
    String appName = getString(R.string.app_name);
    String message = String.format(getString(R.string.sync_foreign_files_forgotten_explanation), appName, appName, appName, appName, mAccount.name);
    textView.setText(message);
    textView.setMovementMethod(new ScrollingMovementMethod());
    /// load the list of local and remote files that failed
    ListView listView = (ListView) findViewById(R.id.list);
    if (mLocalPaths != null && mLocalPaths.size() > 0) {
        mAdapter = new ErrorsWhileCopyingListAdapter();
        listView.setAdapter(mAdapter);
    } else {
        listView.setVisibility(View.GONE);
        mAdapter = null;
    }
    /// customize buttons
    Button cancelBtn = (Button) findViewById(R.id.cancel);
    Button okBtn = (Button) findViewById(R.id.ok);
    okBtn.setText(R.string.foreign_files_move);
    cancelBtn.setOnClickListener(this);
    okBtn.setOnClickListener(this);
}
Also used : ListView(android.widget.ListView) Button(android.widget.Button) FileDataStorageManager(com.owncloud.android.datamodel.FileDataStorageManager) Handler(android.os.Handler) Intent(android.content.Intent) TextView(android.widget.TextView) ScrollingMovementMethod(android.text.method.ScrollingMovementMethod)

Example 9 with ScrollingMovementMethod

use of android.text.method.ScrollingMovementMethod in project kcanotify by antest1.

the class KcaQuestViewService method setQuestView.

@SuppressLint("DefaultLocale")
public void setQuestView(int api_disp_page, int api_page_count, JsonArray api_list, boolean checkValid) {
    if (api_page_count > 0) {
        ((TextView) questview.findViewById(R.id.quest_page)).setText(String.format(getStringWithLocale(R.string.questview_page), api_disp_page, api_page_count));
        if (checkValid)
            helper.checkValidQuest(api_disp_page, api_page_count, api_list);
        for (int i = 0; i < api_list.size(); i++) {
            int index = i + 1;
            JsonElement api_list_item = api_list.get(i);
            if (api_list_item.isJsonObject()) {
                JsonObject item = api_list_item.getAsJsonObject();
                String api_no = item.get("api_no").getAsString();
                int api_category = item.get("api_category").getAsInt();
                int api_type = item.get("api_type").getAsInt();
                int api_progress = item.get("api_progress_flag").getAsInt();
                int api_state = item.get("api_state").getAsInt();
                String api_title = String.format("[%s] %s", api_no, item.get("api_title").getAsString());
                String api_detail = item.get("api_detail").getAsString();
                if (kcQuestInfoData.has(api_no)) {
                    String code = kcQuestInfoData.getAsJsonObject(api_no).get("code").getAsString();
                    String name = kcQuestInfoData.getAsJsonObject(api_no).get("name").getAsString();
                    api_title = String.format("[%s] %s", code, name);
                    api_detail = kcQuestInfoData.getAsJsonObject(api_no).get("desc").getAsString();
                    if (kcQuestInfoData.getAsJsonObject(api_no).has("memo")) {
                        // Temporary
                        String memo = kcQuestInfoData.getAsJsonObject(api_no).get("memo").getAsString();
                        api_detail = api_detail.concat(" (").concat(memo).concat(")");
                    }
                }
                ((TextView) questview.findViewById(getId(String.format("quest%d_category", index), R.id.class))).setText(getStringWithLocale(getId(String.format("quest_category_%d", api_category), R.string.class)));
                questview.findViewById(getId(String.format("quest%d_category", index), R.id.class)).setBackgroundColor(ContextCompat.getColor(getApplicationContext(), getId(String.format("colorQuestCategory%d", api_category), R.color.class)));
                ((TextView) questview.findViewById(getId(String.format("quest%d_type", index), R.id.class))).setText(getStringWithLocale(getId(String.format("quest_type_%d", api_type), R.string.class)));
                questview.findViewById(getId(String.format("quest%d_type", index), R.id.class)).setBackgroundColor(ContextCompat.getColor(getApplicationContext(), getId(String.format("colorQuestType%d", api_type), R.color.class)));
                ((TextView) questview.findViewById(getId(String.format("quest%d_name", index), R.id.class))).setText(api_title);
                ((TextView) questview.findViewById(getId(String.format("quest%d_desc", index), R.id.class))).setText(api_detail);
                ((TextView) questview.findViewById(getId(String.format("quest%d_desc", index), R.id.class))).setMovementMethod(new ScrollingMovementMethod());
                if (api_progress != 0) {
                    ((TextView) questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class))).setText(getStringWithLocale(getId(String.format("quest_progress_%d", api_progress), R.string.class)));
                    questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class)).setBackgroundColor(ContextCompat.getColor(getApplicationContext(), getId(String.format("colorQuestProgress%d", api_progress), R.color.class)));
                    questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class)).setVisibility(View.VISIBLE);
                } else {
                    questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class)).setVisibility(View.GONE);
                }
                if (isQuestTrackable(api_no)) {
                    boolean noshowflag = false;
                    questTracker.test();
                    List<String> trackinfo_list = new ArrayList<>();
                    String trackinfo_text = "";
                    JsonObject questTrackInfo = getQuestTrackInfo(api_no);
                    if (questTrackInfo != null) {
                        JsonArray trackCond = questTrackInfo.getAsJsonArray("cond");
                        JsonArray trackData = questTracker.getQuestTrackInfo(api_no);
                        if (trackData.size() == 1) {
                            JsonArray updatevalue = new JsonArray();
                            if (api_progress == 1 && trackData.get(0).getAsFloat() < trackCond.get(0).getAsFloat() * PROGRESS_1) {
                                updatevalue.add((int) (Math.ceil(trackCond.get(0).getAsFloat() * PROGRESS_1)));
                            } else if (api_progress == 2 && api_no.equals("211")) {
                                // 보급3회퀘 80%인 경우
                                updatevalue.add(2);
                            } else if (api_progress == 2 && trackData.get(0).getAsFloat() < trackCond.get(0).getAsFloat() * PROGRESS_2) {
                                updatevalue.add((int) (Math.ceil(trackCond.get(0).getAsFloat() * PROGRESS_2)));
                            } else if (api_state == 3) {
                                updatevalue.add(trackCond.get(0).getAsInt());
                            }
                            if (updatevalue.size() > 0) {
                                questTracker.updateQuestTrackValueWithId(api_no, updatevalue);
                                trackData = questTracker.getQuestTrackInfo(api_no);
                            }
                        }
                        for (int n = 0; n < trackData.size(); n++) {
                            int cond = trackCond.get(n).getAsInt();
                            int val = trackData.get(n).getAsInt();
                            Log.e("KCA-QV", api_no + " " + String.valueOf(val) + " " + String.valueOf(cond));
                            trackinfo_list.add(String.format("%d/%d", Math.min(val, cond), cond));
                        }
                        if (trackinfo_list.size() > 0) {
                            trackinfo_text = joinStr(trackinfo_list, ", ");
                        } else {
                            noshowflag = true;
                        }
                        ((TextView) questview.findViewById(getId(String.format("quest%d_progress_track", index), R.id.class))).setText(trackinfo_text);
                        questview.findViewById(getId(String.format("quest%d_progress_track", index), R.id.class)).setVisibility(View.VISIBLE);
                    }
                    if (noshowflag) {
                        questview.findViewById(getId(String.format("quest%d_progress_track", index), R.id.class)).setVisibility(View.GONE);
                    }
                } else {
                    questview.findViewById(getId(String.format("quest%d_progress_track", index), R.id.class)).setVisibility(View.GONE);
                }
                ((TextView) questview.findViewById(getId(String.format("quest%d_name", index), R.id.class))).setTextColor(ContextCompat.getColor(getApplicationContext(), getId(String.format("colorQuestState%d", api_state), R.color.class)));
                questview.findViewById(getId(String.format("quest%d", index), R.id.class)).setVisibility(View.VISIBLE);
            } else {
                ((TextView) questview.findViewById(getId(String.format("quest%d_category", index), R.id.class))).setText("");
                ((TextView) questview.findViewById(getId(String.format("quest%d_type", index), R.id.class))).setText("");
                ((TextView) questview.findViewById(getId(String.format("quest%d_name", index), R.id.class))).setText("");
                ((TextView) questview.findViewById(getId(String.format("quest%d_desc", index), R.id.class))).setText("");
                ((TextView) questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class))).setText("");
                questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class)).setVisibility(View.GONE);
                questview.findViewById(getId(String.format("quest%d", index), R.id.class)).setVisibility(View.INVISIBLE);
            }
        }
    } else {
        ((TextView) questview.findViewById(R.id.quest_page)).setText(getStringWithLocale(R.string.questview_nopage));
        for (int i = 0; i < 5; i++) {
            int index = i + 1;
            ((TextView) questview.findViewById(getId(String.format("quest%d_category", index), R.id.class))).setText("");
            ((TextView) questview.findViewById(getId(String.format("quest%d_type", index), R.id.class))).setText("");
            ((TextView) questview.findViewById(getId(String.format("quest%d_name", index), R.id.class))).setText("");
            ((TextView) questview.findViewById(getId(String.format("quest%d_desc", index), R.id.class))).setText("");
            ((TextView) questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class))).setText("");
            questview.findViewById(getId(String.format("quest%d_progress", index), R.id.class)).setVisibility(View.GONE);
            questview.findViewById(getId(String.format("quest%d", index), R.id.class)).setVisibility(View.INVISIBLE);
        }
    }
}
Also used : JsonArray(com.google.gson.JsonArray) JsonElement(com.google.gson.JsonElement) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) TextView(android.widget.TextView) ScrollingMovementMethod(android.text.method.ScrollingMovementMethod) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) SuppressLint(android.annotation.SuppressLint)

Aggregations

ScrollingMovementMethod (android.text.method.ScrollingMovementMethod)9 Intent (android.content.Intent)6 Handler (android.os.Handler)5 HashMap (java.util.HashMap)4 LinkedList (java.util.LinkedList)4 TextView (android.widget.TextView)3 ListView (android.widget.ListView)2 SuppressLint (android.annotation.SuppressLint)1 Point (android.graphics.Point)1 Button (android.widget.Button)1 ListAdapter (android.widget.ListAdapter)1 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)1 ArrayList (java.util.ArrayList)1