Search in sources :

Example 71 with Toolbar

use of androidx.appcompat.widget.Toolbar in project dropbox-sdk-java by dropbox.

the class OpenWithActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open_with);
    Toolbar toolbar = (Toolbar) findViewById(R.id.app_bar);
    setSupportActionBar(toolbar);
    Button generateIntentButton = (Button) findViewById(R.id.generate_intent);
    generateIntentButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            EditText editText = (EditText) findViewById(R.id.editText);
            String path = editText.getText().toString();
            // fake OpenWithIntent with some dummy parameters
            Intent fakeOpenWithIntent = generateOpenWithIntent(path);
            // encode the fake OpenWithIntent into UtmContent
            String encodedFakeIntent = encodeOpenWithIntent(fakeOpenWithIntent);
            try {
                // test that decoding utmcontent works
                Intent decodedIntent = DbxOfficialAppConnector.generateOpenWithIntentFromUtmContent(encodedFakeIntent);
                // start that fake OpenWithIntent. This will lead us to a new OpenWithActivity.
                startActivity(decodedIntent);
            } catch (DropboxParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });
    Button mInstalled = (Button) findViewById(R.id.is_installed);
    mInstalled.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            DbxOfficialAppConnector.DbxOfficialAppInstallInfo installInfo = DbxOfficialAppConnector.isInstalled(OpenWithActivity.this);
            showToast((installInfo != null) ? installInfo.toString() : "Not installed!");
        }
    });
    Button mGenLinked = (Button) findViewById(R.id.is_linked_any_button);
    mGenLinked.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isSigned = DbxOfficialAppConnector.isAnySignedIn(OpenWithActivity.this);
            showToast("Any Signed in?:" + isSigned);
        }
    });
    Button mSpecLinked = (Button) findViewById(R.id.is_linked_spec_button);
    mSpecLinked.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isSigned = mDoac.isSignedIn(OpenWithActivity.this);
            showToast("Signed in?:" + isSigned);
        }
    });
    Button mPreview = (Button) findViewById(R.id.preview_button);
    mPreview.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            EditText editText = (EditText) findViewById(R.id.editText);
            String path = editText.getText().toString();
            Intent pIntent = mDoac.getPreviewFileIntent(OpenWithActivity.this, path, "");
            startActivity(pIntent);
        }
    });
    Button mUpgrade = (Button) findViewById(R.id.upgrade_button);
    mUpgrade.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent uIntent = mDoac.getUpgradeAccountIntent(OpenWithActivity.this);
            startActivity(uIntent);
        }
    });
}
Also used : EditText(android.widget.EditText) Button(android.widget.Button) DropboxParseException(com.dropbox.core.android.DropboxParseException) Intent(android.content.Intent) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar)

Example 72 with Toolbar

use of androidx.appcompat.widget.Toolbar in project BaseRecyclerViewAdapterHelper by CymChad.

the class BaseActivity method initToolbar.

private void initToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
    }
    if (getSupportActionBar() != null) {
        // Enable the Up button
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    }
    back = findViewById(R.id.img_back);
    title = findViewById(R.id.title);
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar)

Example 73 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChangelogActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.changelog_activity);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.changelog_name);
    setSupportActionBar(toolbar);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.changelog);
    recyclerView.setHasFixedSize(true);
    ArrayList<ChangelogItem> changeLogArray = new ArrayList<>();
    try {
        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy", Locale.ENGLISH);
        Date date;
        Date nowDate = new Date();
        BufferedReader reader = new BufferedReader(new FileReader(CHANGELOG_PATH));
        String line;
        String directory = "";
        String commits = "";
        boolean checknext = false;
        while ((line = reader.readLine()) != null) {
            if (!line.matches("={20}") && !Objects.equals(line.trim(), "")) {
                if (line.matches("     (\\d\\d\\-\\d\\d\\-\\d{4})")) {
                    // it's date
                    date = sdf.parse(line.trim());
                    long now = nowDate.getTime();
                    long time = date.getTime();
                    final long diff = now - time;
                    String timeString;
                    if (diff < 1000 * 60 * 60 * 24) {
                        timeString = "Today";
                    } else if (diff < 1000 * 60 * 60 * 24 * 2) {
                        timeString = "Yesterday";
                    } else if (diff < 1000 * 60 * 60 * 24 * 3) {
                        timeString = "Two days ago";
                    } else if (diff < 1000 * 60 * 60 * 24 * 4) {
                        timeString = "Three days ago";
                    } else if (diff < 1000 * 60 * 60 * 24 * 5) {
                        timeString = "Four days ago";
                    } else if (diff < 1000 * 60 * 60 * 24 * 6) {
                        timeString = "Five days ago";
                    } else if (diff < 1000 * 60 * 60 * 24 * 7) {
                        timeString = "Six days ago";
                    } else if (diff < 1000 * 60 * 60 * 24 * 14) {
                        timeString = "A week ago";
                    } else if (diff < 1000 * 60 * 60 * 24 * 21) {
                        timeString = "Two weeks ago";
                    } else if (diff < 1000L * 60 * 60 * 24 * 28) {
                        timeString = "Three weeks ago";
                    } else {
                        timeString = line.trim().replaceAll("-", "/");
                    }
                    changeLogArray.add(new ChangelogItem(timeString));
                } else if (line.matches("^\\s*(   \\* )\\S*")) {
                    // it's directory
                    if (checknext) {
                        // remove lf on end
                        commits = commits.substring(0, commits.lastIndexOf("\n\n"));
                        changeLogArray.add(new ChangelogItem(directory, commits));
                        // reset commits
                        commits = "";
                        checknext = false;
                    } else {
                        checknext = true;
                        commits = "";
                    }
                    directory = line.replaceAll("(   \\* )", "");
                } else {
                    final String re = "^([a-f0-9]{1,12}) ";
                    line = line.replaceFirst(re, "");
                    commits += line + "\n\n";
                    checknext = true;
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    ChangeLogAdapter adapter = new ChangeLogAdapter(this, changeLogArray);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
Also used : ArrayList(java.util.ArrayList) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Date(java.util.Date) BufferedReader(java.io.BufferedReader) RecyclerView(androidx.recyclerview.widget.RecyclerView) FileReader(java.io.FileReader) SimpleDateFormat(java.text.SimpleDateFormat) Toolbar(androidx.appcompat.widget.Toolbar)

Example 74 with Toolbar

use of androidx.appcompat.widget.Toolbar in project aware-client by denzilferreira.

the class Aware_Client method onPreferenceTreeClick.

@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, final Preference preference) {
    if (preference instanceof PreferenceScreen) {
        Dialog subpref = ((PreferenceScreen) preference).getDialog();
        ViewGroup root = (ViewGroup) subpref.findViewById(android.R.id.content).getParent();
        Toolbar toolbar = new Toolbar(this);
        toolbar.setBackgroundColor(ContextCompat.getColor(preferenceScreen.getContext(), R.color.primary));
        toolbar.setTitleTextColor(ContextCompat.getColor(preferenceScreen.getContext(), android.R.color.white));
        toolbar.setTitle(preference.getTitle());
        // add to the top
        root.addView(toolbar, 0);
        subpref.setOnDismissListener(new DialogInterface.OnDismissListener() {

            @Override
            public void onDismiss(DialogInterface dialog) {
                new SettingsSync().execute(preference);
            }
        });
    }
    return super.onPreferenceTreeClick(preferenceScreen, preference);
}
Also used : Dialog(android.app.Dialog) ViewGroup(android.view.ViewGroup) Toolbar(androidx.appcompat.widget.Toolbar)

Example 75 with Toolbar

use of androidx.appcompat.widget.Toolbar in project zype-android by zype.

the class BaseVideoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getLayoutId());
    baseView = getBaseView();
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mActionBar = getSupportActionBar();
    mActionBar.setDisplayHomeAsUpEnabled(true);
    progressBar = (ProgressBar) baseView.findViewById(R.id.progress);
    initVideo();
    // Block ChromeCast
    if (isShowChromeCastMenu()) {
        initVideoCastManager();
    }
    if (mType != TYPE_WEB && mType != PlayerFragment.TYPE_VIDEO_LIVE && mType != PlayerFragment.TYPE_AUDIO_LIVE) {
        changeFragment(isChromecastConntected());
    }
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)284 View (android.view.View)116 TextView (android.widget.TextView)58 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)43 Intent (android.content.Intent)39 NonNull (androidx.annotation.NonNull)36 Fragment (androidx.fragment.app.Fragment)33 ActionBar (androidx.appcompat.app.ActionBar)29 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)29 Nullable (androidx.annotation.Nullable)28 BarPainter (com.xabber.android.ui.color.BarPainter)26 R (org.thoughtcrime.securesms.R)26 Context (android.content.Context)25 ViewGroup (android.view.ViewGroup)25 EditText (android.widget.EditText)23 MenuItem (android.view.MenuItem)21 ImageView (android.widget.ImageView)20 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20